query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
Convenience method to update the delay value for the current type. Returns false if the health monitor is not enabled or is not an http monitor, the new value if it succeeds, and raises an exception otherwise. | def body_regex=(value)
return false unless @enabled && ['HTTP','HTTPS'].include?(self.type)
update(:type => self.type, :body_regex => value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delay=(value)\n return false unless @enabled\n update(:type => self.type, :delay => value)\n end",
"def delay=(value)\n\t\t\t@delay = value\n\t\tend",
"def delay=(value)\n\t\t\t@delay = value\n\t\tend",
"def delay(value)\n model.delay = value\n end",
"def delay(value)\n model.delay = value\n end",
"def delay=(sec)\n raise ArgumentError, 'Delay sec can not be a negative number.' if sec.to_f < 0\n @delay = sec.to_f\n end",
"def delay\n @delay ||= 600\n end",
"def delay_time=(seconds)\n end",
"def delay\n @delay || initial_delay\n end",
"def set_delay(delay)\n @delay = delay\n end",
"def watch_delay\n @conn.watch(Web.keys[:delay]) do\n yield if block_given?\n end\n end",
"def delay\n self['Delay'].to_i || 0\n end",
"def delay\n @delay || initial_delay\n end",
"def delay_ms(ms)\n @delay_ms = ms\n end",
"def default_delay=(v)\n @@default_delay = v\n end",
"def timeout=(value)\n return false unless @enabled\n update(:type => self.type, :timeout => value)\n end",
"def increment_delay!\n @delay = [delay * multiplier, max_delay].min\n end",
"def delay\n if @delay_den != 0\n @delay_num/@delay_den\n else\n @delay_num/100\n end\n end",
"def delay(input, val=nil)\n raise ArgumentError unless (0..31) === input\n input = input.to_i\n reg = input / DELAYS_PER_REG\n shift = (input % DELAYS_PER_REG) * BITS_PER_DELAY\n regval = send(\"delay_#{reg}\")\n if val\n regval &= ~( DELAY_MASK << shift)\n regval |= ((DELAY_MASK & val) << shift)\n send(\"delay_#{reg}=\", regval)\n self\n else\n (regval >> shift) & DELAY_MASK\n end\n end",
"def increment_delay!\n @delay = [delay * multiplier, max_delay].min\n end",
"def delay=(d)\n raise ArgumentError, 'delay must be greater than or equal to 0' if Integer(d) < 0\n\n @images.each { |f| f.delay = Integer(d) }\n end",
"def set_timeout(value)\n if value.nil?\n @timeout = 2\n else\n return skip_resource 'timeout is not numeric' unless value.to_s =~ /^\\d+$/\n @timeout = value\n end\n end",
"def with_delay(delay, &block)\n # Delay should be either an integer or a range of integers.\n if (delay.is_a?(Numeric))\n raise(ArgumentError, \"Delay should be a non-negative number; got #{delay}!\") unless delay >= 0\n delay = delay..delay\n elsif delay.is_a?(Range)\n raise(ArgumentError, \"Range members should be numbers; got #{delay}!\") unless delay.first.is_a?(Numeric) && delay.last.is_a?(Numeric)\n raise(ArgumentError, \"Range members should be non-negative; got #{delay}!\") unless delay.first >= 0 && delay.last >= 0\n raise(ArgumentError, \"Range's end should be greater than or equal to range's start; got #{delay}!\") unless delay.first <= delay.last\n else\n raise(ArgumentError, \"Delay should be either an number or a range of numbers; got #{delay}!\")\n end\n raise(ArgumentError, 'Delay policy has already been specified!') if @delay_policy\n @delay_policy = lambda{Kernel.sleep(delay.first + rand(delay.count))}\n\n attempt(block)\n end",
"def sleep\n @property_hash['sleep'] || 0\n end",
"def update(options={})\n data = Hash.new\n data[:type] = options[:type].upcase if options[:type]\n data[:delay] = options[:delay] if options[:delay]\n data[:timeout] = options[:timeout] if options[:timeout]\n data['attemptsBeforeDeactivation'] = options[:attempts_before_deactivation] if options[:attempts_before_deactivation]\n data[:type].upcase! if data[:type]\n if ['HTTP','HTTPS'].include?(data[:type])\n data[:path] = options[:path] if options[:path]\n data['statusRegex'] = options[:status_regex] if options[:status_regex]\n data['bodyRegex'] = options[:body_regex] if options[:body_regex]\n end\n response = @connection.lbreq(\"PUT\",@lbmgmthost,\"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@load_balancer.id.to_s)}/healthmonitor\",@lbmgmtport,@lbmgmtscheme,{},data.to_json)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n populate\n true\n end",
"def sleep? module_name = nil, refresh_delay = 60 # {{{\n\n # Pre-condition check # {{{\n raise ArgumentError, \"Module name cannot be nil, but it is\" if( module_name.nil? )\n raise ArgumentError, \"Module name should be of type string, but it is (#{module_name.class.to_s})\" unless( module_name.is_a?(String) )\n # }}}\n\n # Main\n sleep_time = 60 # make sure we always wait 60 s if we get no valid feedback\n\n website = Website.first( :name => module_name )\n\n # We have never accessed this website so we need to create an initial DB entry\n if( website.nil? )\n new = Website.new\n new.name = module_name\n new.last_access = Time.now\n new.save!\n website = new\n end\n\n last_access = Time.parse( website.last_access.to_s )\n\n raise ArgumentError, \"last_access cannot be nil\" if( last_access.nil? )\n raise ArgumentError, \"last_access needs to be of type Time, but is (#{last_access.class.to_s})\" unless( last_access.is_a?( Time ) )\n\n now = Time.now\n diff = ( now - last_access ).to_i\n\n @log.message :debug, \"Sleep function result is - Now (#{now.to_s}) - Last Access (#{last_access.to_s}) - Mandatori Refresh Delay (#{refresh_delay.to_s}) - Now-Last (#{diff.to_s}) - Sleep (#{diff.to_s})\"\n\n sleep_time = ( diff > refresh_delay ) ? ( 0 ) : ( refresh_delay - diff )\n\n # Post-condition check\n raise ArgumentError, \"Result of this function is supposed to be of type integer, but is (#{sleep_time.class.to_s})\" unless( sleep_time.is_a?(Integer) )\n\n sleep_time\n end",
"def delay_time\n return (self.aggressive == false ? 0 : (15 - self.aggressive) * 3)\n end",
"def get_delay\n return @retry_timeout unless @retry_timeout.nil?\n\n if !response.nil? && !response.headers['Retry-After'].nil?\n return response.headers['Retry-After'].to_i\n end\n\n return AsyncOperationStatus::DEFAULT_DELAY\n end",
"def pickup_delay=(v) self['PickupDelay'] = v end",
"def ensure=(value)\n debug \"Waiting for host '#{@resource[:name]}' to change status to '#{value}'\"\n @resource[:count].times do\n return if status == value\n sleep @resource[:step]\n end\n fail \"Timeout waiting for host '#{@resource[:name]}' status to become '#{value}' after #{@resource[:count] * @resource[:step]} seconds!\"\n end",
"def delay_sanitize\n \tself.delay ||= 0\n end",
"def default_delay\n @@default_delay ||= 0\n end",
"def idle_delay(arg = nil)\n set_or_return(:idle_delay, arg, kind_of: Integer)\n end",
"def should_delay?\n @class == FaviconParty::Curl::DNSError\n end",
"def delay_time\n end",
"def delay! seconds\n @delay_received << seconds\n end",
"def sleep_if_set\n sleep_sec = config[:sleep].to_i\n if sleep_sec > 0\n info(\"Sleep #{config[:sleep]} seconds...\")\n sleep sleep_sec\n end\n end",
"def set_queue_delay\n new_delay = params[:delay].to_f\n if new_delay == 0\n head :bad_request\n else\n Rails.application.config.queue_delay = new_delay\n render :get_queue_delay\n end\n end",
"def sleep_value\n 20\n end",
"def delayed_update\n self.delay.update_metrics!\n end",
"def _libnotify_urgency(type)\n case type\n when 'failed'\n :normal\n else\n :low\n end\n end",
"def delay(seconds); end",
"def delay(seconds); end",
"def setJavascriptDelay(delay)\n if (!(Integer(delay) >= 0))\n raise Error.new(Pdfcrowd.create_invalid_value_message(delay, \"setJavascriptDelay\", \"html-to-image\", \"Must be a positive integer number or 0.\", \"set_javascript_delay\"), 470);\n end\n \n @fields['javascript_delay'] = delay\n self\n end",
"def await_event(type=\"Scaleout\", delay=120)\n des = description.desired_capacity\n result = false\n count = 0\n Log.log \"Awaiting #{type}... \", newline: false\n while count < delay && !result\n s = summary\n result = (s[:size] == des && s[:in_service] && s[:healthy])\n sleep 1\n count += 1\n end\n Log.log \"done\", timestamp: false\n Log.log \"Summary: #{summary.inspect}\"\n end",
"def delay(mode)\n if mode == @mode\n d = @deadline - Time.now\n d = 0 if d < 0 # No negative delays\n @deadline += @delay\n block_given? ? yield(d) : d\n end\n end",
"def set_duration(type, duration)\r\n if $g_os_type == :win32_system\r\n @duration_win[type] = Sound::ASYNC\r\n if duration == :loop\r\n @duration_win[type] = Sound::ASYNC|Sound::LOOP\r\n end\r\n end\r\n if $g_os_type == :linux\r\n @duration_linux[type] = duration\r\n end\r\n \r\n end",
"def standbydelay\n return nil unless @property_hash.has_key? 'standbydelay'\n\n @property_hash['standbydelay'].to_i\n end",
"def default_delay\n 0.seconds\n end",
"def operation_delay\n begin\n if $ITEST2_OPERATION_DELAY && $ITEST2_OPERATION_DELAY > 0 &&\n $ITEST2_OPERATION_DELAY && $ITEST2_OPERATION_DELAY < 30000 then # max 30 seconds\n sleep($ITEST2_OPERATION_DELAY / 1000)\n end\n\n while $ITEST2_PAUSE\n debug(\"Paused, waiting ...\")\n sleep 1\n end\n rescue => e\n puts \"Error on delaying: #{e}\"\n # ignore\n end\n end",
"def delay\n val = (self['min-time']/1000.0/60.0)\n val < 1 ? val.round(1) : val.round\n end",
"def lock_on_sleep= value\n put_settings(get_settings.tap {|s| s[:lock_on_sleep] = value ? 1 : 0})\n end",
"def delay\n sleep(2)\n end",
"def sleep_for\n @sleep_for ||= 5\n end",
"def delay\n \"%3d days %2d hours %2d minutes %2d seconds\" % distance_of_time_as_array( timestamp_device, timestamp_server)\n end",
"def calculate_sleep\n if @timeouts.empty?\n @sleep_for = DefaultSleepFor\n else\n diff = @timeouts.first.value.timeout_at.to_f - Time.now.to_f\n\n if diff < 0.0\n @sleep_for = 0\n else\n @sleep_for = diff\n end\n end\n end",
"def update(name, mon_type, interval, timeout, max_retries,\n method: nil,\n url: nil,\n expect_code: nil,\n port: nil, **opts)\n\n self._set('slb.hm.update', name, mon_type, interval, timeout, max_retries,\n method: method,\n url: url,\n expect_code: expect_code,\n port: port, **opts)\n end",
"def wfs_delay\n (datastore['WfsDelay'] || 0).to_i\n end",
"def set_SleepTimeEnabled(value)\n set_input(\"SleepTimeEnabled\", value)\n end",
"def minretrydelay=(retry_delay)\r\n\t\t\t`#{BITS::BITSADMIN} /setminretrydelay {#{@id}} #{retry_delay}`\r\n\t\tend",
"def sleep_for=(seconds)\n seconds ||= 0\n if Integer === seconds && seconds >= 0\n @sleep_for = seconds\n else\n raise ArgumentError, \"argument must be nil or an integer >= 0\"\n end\n end",
"def sub_delay _value, _abs=0\n send_cmd(\"sub_delay #{_value} #{_abs}\")\n end",
"def check(type)\n if config[type]\n send(type, \"Unix socket backlog value (#{@data}) [#{config[:socket]}]\") if (below?(type) || above?(type))\n end\n end",
"def resolve_retry_delay(delay)\n if delay.respond_to?(:queue_retry_delay)\n resolve_retry_delay(delay.queue_retry_delay)\n elsif delay.is_a?(Integer) # numerical\n delay\n else # default\n Backburner.configuration.retry_delay\n end\n end",
"def delay(time)\n @context.backend.delay(time)\n end",
"def delay; end",
"def delay; end",
"def delay; end",
"def delay_1() sleep(3) end",
"def delayed?\n @delayed\n end",
"def delayed\n NotImplementedError\n end",
"def giveUp(timeDelay)\n @delayTime = timeDelay.abs.to_i\n @timerField = NSTextField.alloc.initWithFrame([[0, 0], [40, 20]])\n .tap do |obj| # origin will be set later\n obj.bordered = false\n obj.drawsBackground = false\n obj.font = NSFont.fontWithName('Menlo Bold', size: 12) # mono-spaced\n obj.editable = false\n obj.selectable = false\n obj.alignment = NSTextAlignmentCenter\n obj.toolTip = 'time remaining'\n end unless defined?(@timerField)\n end",
"def timeout_ms=(value)\n Curl.set_option(:timeout_ms, value_for(value, :int), handle)\n end",
"def stale(value)\n unless (['ok', 'update_after'].include?(value.to_s))\n raise \"View#stale can only be set with 'ok' or 'update_after'.\"\n end\n update_query(:stale => value.to_s)\n end",
"def persistent_delay\n get_config_value(:persistent_delay, 5)\n end",
"def set_animation_delay(key, delay)\r\n anim = AnimationManager.get_anim key\r\n anim.delay = delay\r\n end",
"def wait_time(value)\n define_singleton_method(:wait_time_value) { value }\n private_class_method :wait_time_value\n end",
"def timeout?(value)\n value.is_a? Pinglish::TooLong\n end",
"def sleep(dur=0) end",
"def update_uptime_check_config config_name: nil,\n new_display_name: nil,\n new_http_check_path: nil\n require \"google/cloud/monitoring\"\n\n client = Google::Cloud::Monitoring.uptime_check_service\n config = { name: config_name }\n field_mask = { paths: [] }\n unless new_display_name.to_s.empty?\n field_mask[:paths].push \"display_name\"\n config[:display_name] = new_display_name\n end\n unless new_http_check_path.to_s.empty?\n field_mask[:paths].push \"http_check.path\"\n config[:http_check] = { path: new_http_check_path }\n end\n client.update_uptime_check_config uptime_check_config: config,\n update_mask: field_mask\nend",
"def setTimer\n return NSTimer.timerWithTimeInterval( 1.0,\n target: self,\n selector: 'updateCountdown:',\n userInfo: nil,\n repeats: true )\n .tap do |timer|\n @countdown = @delayTime\n @timerField.stringValue = @countdown.to_int.to_s\n end if @delayTime > 1\n nil\n end",
"def update!(**args)\n @not_after_sec = args[:not_after_sec] if args.key?(:not_after_sec)\n @status_code = args[:status_code] if args.key?(:status_code)\n end",
"def retry_delay\n 30\n end",
"def set_url_status\n self.update_attribute(:dead, true) unless self.url_active?\n end",
"def [](key)\n delay = data[key]\n delay ? delay.value! : nil\n end",
"def keep_alive_rate=(value)\n @keep_alive_rate = validate!(:keep_alive_rate, value)\n end",
"def delay(seconds)\n sleep(seconds)\n end",
"def delay_seconds\n seconds = nil\n if delay = @delay || @config_delay\n min_delay = max_delay = nil\n if delay =~ /([\\d]+)\\.\\.([\\d]+)/\n min_delay = Regexp.last_match[1].to_i\n max_delay = Regexp.last_match[2].to_i\n elsif delay.to_i.to_s == delay\n min_delay = max_delay = delay.to_i\n end\n if min_delay && max_delay\n seconds = rand(max_delay - min_delay + 1) + min_delay\n end\n end\n seconds || 0\n end",
"def timeout=(value)\n @transfer[:timeout] = value\n end",
"def page_delay\n if $TESTWISE_PAGE_DELAY && $TESTWISE_PAGE_DELAY.to_i > 0 && $TESTWISE_PAGE_DELAY.to_i < 100\n sleep $TESTWISE_PAGE_DELAY.to_i\n end \n end",
"def set_integer_for(type, value)\n load_balancer.client['LocalLB.Monitor']\n .set_template_integer_property([new_resource.monitor_name],\n [{ 'type' => type, 'value' => value }])\n end",
"def ensure=(value)\n debug \"Call: ensure=(#{value})\"\n debug \"Waiting for HAProxy backend: '#{@resource[:name]}' to change its status to: '#{value}'\"\n @resource[:count].times do\n stats_reset\n if self.status == value\n debug get_haproxy_debug_report\n return true\n end\n sleep @resource[:step]\n end\n debug get_haproxy_debug_report\n fail \"Timeout waiting for HAProxy backend: '#{@resource[:name]}' status to become: '#{value}' after #{@resource[:count] * @resource[:step]} seconds!\"\n end",
"def os_boot_watchdog_timer=(os_boot_watchdog_timer)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"enabled\", \"disabled\"])\n unless validator.valid?(os_boot_watchdog_timer)\n fail ArgumentError, \"invalid value for \\\"os_boot_watchdog_timer\\\", must be one of #{validator.allowable_values}.\"\n end\n @os_boot_watchdog_timer = os_boot_watchdog_timer\n end",
"def os_boot_watchdog_timer_timeout=(os_boot_watchdog_timer_timeout)\n validator = EnumAttributeValidator.new('String', [\"platform-default\", \"5-minutes\", \"10-minutes\", \"15-minutes\", \"20-minutes\"])\n unless validator.valid?(os_boot_watchdog_timer_timeout)\n fail ArgumentError, \"invalid value for \\\"os_boot_watchdog_timer_timeout\\\", must be one of #{validator.allowable_values}.\"\n end\n @os_boot_watchdog_timer_timeout = os_boot_watchdog_timer_timeout\n end",
"def gateway_retry_delay\n delay = @options &&\n (\n @options[:gateway_retry_delay] ||\n @options['gateway_retry_delay']\n )\n delay.nil? ? 1.0 : delay.to_f\n end",
"def gateway_retry_delay\n delay = @options &&\n (\n @options[:gateway_retry_delay] ||\n @options['gateway_retry_delay']\n )\n delay.nil? ? 1.0 : delay.to_f\n end",
"def update_status(type, state)\n if [:auth, :api, :router, :broker].include?(type)\n case state\n when :connected\n if @agent.mode == :http\n # Require connectivity to both API and router to be considered fully connected\n status = @agent.client.status\n if status[:api] == :connected && status[:router] == :connected\n RightScale::Sender.instance.disable_offline_mode\n end\n else\n RightScale::Sender.instance.disable_offline_mode\n end\n when :disconnected\n RightScale::Sender.instance.enable_offline_mode\n when :failed\n RightScale::Log.error(\"RightNet connectivity failure for #{type}, need to re-enroll\")\n # Randomize when re-enroll to prevent possibly having multiple instances do so simultaneously\n EM.add_timer(rand(MAX_REENROLL_DELAY)) { RightScale::ReenrollManager.reenroll! }\n when :authorized, :unauthorized, :expired, :closing\n else\n RightScale::Log.error(\"Unrecognized state for #{type}: #{state}\")\n end\n end\n true\n end",
"def update!(**args)\n @timeout = args[:timeout] if args.key?(:timeout)\n end",
"def follow_on_delay\n default_delay\n end",
"def sleep_time\n\t\t\t# TODO: Hard-coded for now. See doc/app_manager.rdoc for some\n\t\t\t# thoughts on this.\n\t\t\t1\n\t\tend",
"def set_Timeout(value)\n set_input(\"Timeout\", value)\n end"
] | [
"0.68817335",
"0.6076384",
"0.6076384",
"0.5865073",
"0.5865073",
"0.57650197",
"0.5617089",
"0.56079096",
"0.56066304",
"0.55951947",
"0.55925936",
"0.5566893",
"0.5532277",
"0.5370051",
"0.53396606",
"0.53258497",
"0.53172684",
"0.52903444",
"0.5277283",
"0.52732867",
"0.52414054",
"0.52400464",
"0.5209475",
"0.51462483",
"0.5134103",
"0.5104241",
"0.4967632",
"0.49634945",
"0.49629813",
"0.49052614",
"0.48942176",
"0.48862338",
"0.48653042",
"0.48644996",
"0.485531",
"0.48536342",
"0.48524538",
"0.48209748",
"0.48178127",
"0.47964102",
"0.47854334",
"0.47590995",
"0.47590995",
"0.47512642",
"0.47492605",
"0.47477862",
"0.47394887",
"0.47373226",
"0.4721869",
"0.47167113",
"0.46818966",
"0.4661259",
"0.46511236",
"0.46308285",
"0.46253172",
"0.46180904",
"0.46163937",
"0.46163937",
"0.4613517",
"0.46076778",
"0.45977664",
"0.45694274",
"0.45648405",
"0.45546195",
"0.45403457",
"0.45312825",
"0.45312825",
"0.45312825",
"0.45260444",
"0.45251077",
"0.45113268",
"0.45105484",
"0.45081267",
"0.45065868",
"0.45039463",
"0.45014217",
"0.44971934",
"0.44884944",
"0.4484953",
"0.4483737",
"0.44630682",
"0.4457814",
"0.44559953",
"0.44475263",
"0.44461206",
"0.44453847",
"0.44269633",
"0.4415831",
"0.44138765",
"0.440822",
"0.44067493",
"0.43872365",
"0.4381021",
"0.4378683",
"0.4376886",
"0.4376886",
"0.43690842",
"0.43650654",
"0.43597436",
"0.43581748",
"0.4350318"
] | 0.0 | -1 |
Removes the current health monitor. Returns true if successful, exception otherwise. >> monitor.destroy! => true | def destroy!
response = @connection.lbreq("DELETE",@lbmgmthost,"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@load_balancer.id.to_s)}/healthmonitor",@lbmgmtport,@lbmgmtscheme)
CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)
@enabled = false
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop_monitor\n self.monitor.kill if self.monitor\n self.monitor = nil\n end",
"def delete(monitor_instance_id)\n if @monitors.key?(monitor_instance_id)\n @monitors.delete(monitor_instance_id)\n end\n end",
"def delete_monitor monitor_name\n response = RestClient.delete(\"http://#{@host}/loadbalancers/tenant/#{@tenant}/monitors/#{monitor_name}\",\n :content_type => :json,\n :accept => :json,\n :'X-Auth-Token' => @keystone_token)\n raise LBModelException.new \"Expected HTTP 202 but got #{response.code} instead\" unless response.code == 202\n\n parse_jobids response\n end",
"def reset_monitor\n @monitor.reset if @monitor\n end",
"def unmonitor_monit\n monit_status = \"monit status | grep -q #{adapter}_#{app['shortname']}\"\n context.execute \"monit unmonitor #{adapter}_#{app['shortname']}\" do\n retries 3\n only_if monit_status\n end\n end",
"def stop_monitor\n @thread&.exit\n end",
"def destroy\n begin\n exitMaintenanceMode\n rescue\n Puppet.err 'Could not find Host system.Either Host is not exist or disconnected'\n end\n end",
"def stop!\n @monitor.kill\n @logger.info({context: :monitor, action: :stop!})\n end",
"def destroy\n @monitorium.destroy\n respond_to do |format|\n format.html { redirect_to monitoria_url, notice: 'Monitoria foi cancelada com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @class_monitor.destroy\n respond_to do |format|\n format.html { redirect_to class_monitors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n start = Time.now\n debug 'Uninstalling LogicMonitor collector'\n collector = get_agent_by_description(nil, resource[:description], 'id')\n if collector\n # Collector shutdown process\n `#{resource[:install_dir]}agent/bin/sbshutdown`\n `#{resource[:install_dir]}agent/bin/uninstall.pl`\n\n if resource[:architecture].include?('64')\n installation_binary = \"#{resource[:install_dir]}logicmonitorsetup#{id}_64.bin\"\n else\n installation_binary = \"#{resource[:install_dir]}logicmonitorsetup#{id}_32.bin\"\n end\n File.delete installation_binary\n end\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n end",
"def destroy\n @monitor_profile = MonitorProfile.find(params[:id])\n @monitor_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to monitor_profiles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @monitor_profile = MonitorProfile.find(params[:id])\n @monitor_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to monitor_profiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n destroy!\n rescue AnsibleTowerClient::Error\n false\n end",
"def destroy\n @server_monitor_log.destroy\n respond_to do |format|\n format.html { redirect_to server_monitor_logs_url, notice: 'Server monitor log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @health_status.destroy\n respond_to do |format|\n format.html { redirect_to health_statuses_url, notice: 'Health status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @monitor_record = MonitorRecord.find(params[:id])\n @monitor_record.destroy\n\n respond_to do |format|\n format.html { redirect_to(monitor_records_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n destroyer = ensure_destroyer\n destroyer.destroy(@resource).success?\n end",
"def destroy\n @ui.logger.debug { \"Container Destroy: #{self.id}\" }\n\n self.node.alive? or return false\n\n please_wait(:ui => @ui, :message => format_object_action(self, 'Destroy', :red)) do\n self.lxc.destroy(%(-f))\n self.lxc_clone.destroy(%(-f))\n\n do_provisioner_callbacks(self, :destroy, @ui)\n end\n\n true\n end",
"def unwatch\n if @watcher\n @watcher = nil\n @enabled = false\n end\n end",
"def destroy\n @health.destroy\n respond_to do |format|\n format.html { redirect_to healths_url, notice: 'Health was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def excel_destroy\n if defined? @excel && [email protected]?\n @workbook.Close(false) if (defined? @workbook) && [email protected]?\n @excel.Quit\n @excel = nil\n # Kill the Excel process, if it is still alive.\n Process.kill('KILL', pid)\n end\n rescue\n @logger.warn(\"Could not destroy Excel object - #{format_exception($!)}\")\n end",
"def destroy\n @health.destroy\n respond_to do |format|\n format.html { redirect_to \"/dashboard\" }\n format.json { head :no_content }\n end\n end",
"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",
"def cleanup!(h)\n Sudo::System.kill h[:pid]\n Sudo::System.unlink h[:socket]\n end",
"def cleanup \n # close the sockets \n @servers.each{ |server| server[:listner].stop }\n @monitor.close\n end",
"def disconnect!\n context.with_connection do |connection|\n connection.disconnect!\n end\n @monitor.stop! and true\n end",
"def cleanup\n cleanup_primitive full_name, hostname\n wait_for_status name\n end",
"def destroy\n @event_time_monitoring.destroy\n respond_to do |format|\n format.html { redirect_to event_time_monitorings_url, notice: \"Event time monitoring was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @health_level.destroy\n\n respond_to do |format|\n format.html { redirect_to health_levels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n unless @disconnecting\n send_command 'QUIT'\n end\n\n unless @caps == nil\n @caps.destroy\n @caps = nil\n end\n\n Events.delete_for self\n end",
"def destroy\n # typically the ensure block should have this\n # @panel = @window.panel if @window\n #Ncurses::Panel.del_panel(@panel) if [email protected]? \n #@window.delwin if [email protected]?\n $log.debug \"win destroy start\"\n\n #@panel = @window.panel if @window\n Ncurses::Panel.del_panel(@panel) if [email protected]? \n @window.delwin if [email protected]?\n $log.debug \"win destroy end\"\n end",
"def unmute_monitor_by_id(mon_id)\n logger.info \"Unmuting monitor by ID #{mon_id}\"\n check_dog_result(@dog.unmute_monitor(mon_id, all_scopes: true))\n end",
"def destroy\n go = -> { redirect_to zabbix_servers_url }\n begin\n @zabbix_server.destroy!\n rescue StandardError => ex\n flash[:alert] = ex.message\n go.call and return\n end\n\n ws_send(t('zabbix_servers.msg.deleted', name: @zabbix_server.fqdn), true)\n go.call and return\n end",
"def delete(object)\n @monitor.delete(object.key)\n object.unsubscribe(self)\n super(object)\n end",
"def destroy!\n manager.delete(self)\n end",
"def destroy!\n manager.delete(self)\n end",
"def destroy\n run_callbacks :destroy do\n if directory?\n logger.info \"Delete directory at #{absolute_path}\"\n FileUtils.rmdir absolute_path\n else\n logger.info \"Delete file at #{absolute_path}\"\n # TODO if the file has added state (not committed), reset it to HEAD\n if status_file.untracked\n FileUtils.rm absolute_path\n else\n remove\n end\n end\n true\n end\n end",
"def remove_mirror(hostname)\n if running?\n puts \"shut down the daemon first\"\n else\n mirror = Mirror.find_by_hostname hostname\n\n if mirror\n mirror.destroy\n\n puts \"done\"\n else\n puts \"hostname not found\"\n end\n end\n\n nil\nend",
"def destroy\n @health_record.destroy\n respond_to do |format|\n format.html { redirect_to health_records_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @screen.destroy\n respond_to do |format|\n format.html { redirect_to screens_url, notice: 'Screen was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scanhost.destroy\n respond_to do |format|\n format.html { redirect_to scanhosts_url, notice: 'Scanhost was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @environment_variable.destroy!\n head :ok\n end",
"def destroy\n @screen = Screen.find(params[:id])\n @screen.destroy\n\n respond_to do |format|\n format.html { redirect_to(hiring_screens_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @main_screen.destroy\n respond_to do |format|\n format.html { redirect_to main_screens_url, notice: 'Main screen was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n start = Time.now\n debug(\"Deleting device group: \\\"#{resource[:full_path]}\\\"\")\n connection = self.class.get_connection(resource[:account])\n device_group = get_device_group(connection, resource[:full_path], 'id')\n if device_group\n delete_device_group = rest(connection,\n Puppet::Provider::Logicmonitor::DEVICE_GROUP_ENDPOINT % device_group['id'],\n Puppet::Provider::Logicmonitor::HTTP_DELETE)\n valid_api_response?(delete_device_group) ? nil : alert(delete_device_group)\n end\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n end",
"def destroy\n @uptime.destroy\n respond_to do |format|\n format.html { redirect_to uptimes_url, notice: 'Uptime was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy; @win.destroy if @win; @win = nil; end",
"def destroy\n router_bgp('no')\n end",
"def destroy!\n response = @connection.dbreq(\"DELETE\", @lbmgmthost, \"#{@lbmgmtpath}/instances/#{CloudDB.escape(@id.to_s)}\",@lbmgmtport,@lbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^202$/)\n true\n end",
"def destroy!\n if exists?\n run_callbacks :destroy do\n #destroy main object\n RedisModelExtension::Database.redis {|r| r.del(redis_key) }\n destroy_aliases!\n end\n end\n end",
"def destroy\n stop\n Process.kill('TERM', xvfb_pid) if read_pid\n end",
"def destroy\n @system.destroy\n\n redirect_to root_path\n end",
"def close\n Wrapper.Quit(@native_manager) if @native_manager\n ensure\n @native_manager = nil\n end",
"def destroy\n self.cleanTitle\n @label = []\n \n # Clean up the windows.\n CDK.deleteCursesWindow(@field_win)\n CDK.deleteCursesWindow(@label_win)\n CDK.deleteCursesWindow(@shadow_win)\n CDK.deleteCursesWindow(@win)\n\n # Clean the key bindings.\n self.cleanBindings(self.object_type)\n\n # Unregister this object\n CDK::SCREEN.unregister(self.object_type, self)\n end",
"def unregister_host(hostname,uri=nil)\n uri,hostname=Controller::rename_uri_and_host(uri,hostname)\n open_fds=lsof.length\n unregistered=false\n @vp_lock.synchronize do\n if uri.nil? or @hostname2uri[hostname]==uri\n @hostname2vp.delete(hostname)\n @hostname2uri.delete(hostname)\n unregistered=true\n end\n end\n if unregistered\n log { \"Unregistered #{hostname}: #{vp_count} total, #{open_fds} of #{self.ulimit} FDs\" }\n else\n log { \"Not unregistering #{hostname}: given URI #{uri} does not match stored one #{@hostname2uri[hostname]}\" }\n end\n end",
"def cleanup(vm_ref)\n ui.warn \"Clenaing up work and exiting\"\n xapi.VM.destroy(vm_ref)\n exit 1 \n end",
"def destroy\n @health_record = HealthRecord.find(params[:id])\n @health_record.destroy\n\n respond_to do |format|\n format.html { redirect_to health_records_url }\n format.json { head :no_content }\n end\n end",
"def cleanup_connection!\n Models::JanusInstance.destroys\n end",
"def destroy\n FileUtils.rm_rf(@root)\n true\n end",
"def destroy_vm(_pool_name, _vm_name)\n\n machine = virtual_box.find_machine(:nameOrId => _vm_name)\n return true if machine.nil?\n \n sess = @web_session_mgr.get_session_object\n begin\n machine.lock_machine(:session => sess, :lockType => 'VM')\n progress = sess.console.power_down()\n progress.wait_for_completion(:timeout => -1)\n rescue Exception => e\n $logger.log('s', \"[x] can't destroy vm: can't get lock [#{_pool_name}] '#{machine}'. #{e.message}\")\n return false\n end\n\n begin\n machine.unregister(:cleanupMode => 'Full')\n rescue Exception => e\n $logger.log('s', \"[x] can't unregister vm: can't get lock [#{_pool_name}] '#{machine}'. #{e.message}\")\n return false\n end\n\n return true\n\n end",
"def close\n begin\n FileUtils.remove_entry_secure @dir\n lay_to_rest(@pid) if @pid\n @monitor.cleanup if @monitor\n ensure\n setvar 'SSH_AGENT_PID', @agentpid\n setvar 'DISPLAY', @display\n setvar 'SSH_ASKPASS', @askpass\n setvar 'SSH_AUTH_SOCK', @sshauth\n setvar 'HOME', @home\n end\n end",
"def destroy(*args)\n destroy!(*args)\n rescue *exceptions\n false\n end",
"def destroy\n @heartbeat.destroy\n\n head :no_content\n end",
"def destroy\n @management_info_system_report = ManagementInfoSystemReport.find(params[:id])\n @management_info_system_report.destroy\n\n respond_to do |format|\n format.html { redirect_to(management_info_system_reports_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n ret = qmgmt(['volume', 'config', 'delete', resource[:name]])\n if ( ret.exitstatus != 0 )\n fail(\"quobyte volume config delete #{resource[:name]} failed with status #{ret.exitstatus.to_s}. Output follows.\" + out.join(\"\\n\"))\n end\n end",
"def terminate\n self.destroy\n end",
"def destroy\n @wireless_router.destroy\n respond_to do |format|\n format.html { redirect_to wireless_routers_url, notice: 'Wireless router was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @health_insurance.destroy\n respond_to do |format|\n format.html { redirect_to health_insurances_url, notice: 'Health insurance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @actuator = Actuator.find(params[:id])\n @actuator.destroy\n\n respond_to do |format|\n format.html { redirect_to(actuators_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n self.run_hook :before_destroy\n result = Driver.client[self.class.coll_name].find({'_id' => self._id}).delete_one\n self.run_hook :after_destroy\n\n result ? true : false\n end",
"def destroy!\n response = @connection.dbreq(\"DELETE\",@dbmgmthost,\"#{@dbmgmtpath}/instances/#{CloudDB.escape(@instance.id.to_s)}/databases/#{CloudDB.escape(@name.to_s)}\",@dbmgmtport,@dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n true\n end",
"def destroy\n begin\n destroy!\n rescue API::VersionMismatch\n false\n end\n end",
"def destroy\n onesecgroup('delete', resource[:name])\n @property_hash.clear\n end",
"def destroy\n @report_display.destroy\n respond_to do |format|\n format.html { redirect_to report_displays_url, notice: 'Report display was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n vm.destroy\n FileUtils.rm_rf dir\n end",
"def destroy\n @winddir.destroy\n respond_to do |format|\n format.html { redirect_to winddirs_url, notice: 'Winddir was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deallocate_disk\n return false\n end",
"def destroy\n @management.destroy\n respond_to do |format|\n format.html { redirect_to managements_url, notice: 'Management was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @system_stat.destroy\n respond_to do |format|\n format.html { redirect_to system_stats_url }\n format.json { head :no_content }\n end\n end",
"def ensure_destroy\n ensure_stop\n destroy if exist?\n end",
"def destroy\n @scanner.destroy\n respond_to do |format|\n format.html { redirect_to scanners_url, notice: 'Scanner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scanner.destroy\n respond_to do |format|\n format.html { redirect_to scanners_url, notice: 'Scanner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy_eventually\n block = block_given? ? Proc.new : nil\n _self = self\n Parse::Stack::Async.run do\n begin\n result = true\n _self.destroy\n rescue => e\n result = false\n puts \"[DestroyEventually] Failed for object #{_self.parse_class}##{_self.id}: #{e}\"\n ensure\n block.call(result) if block\n block = nil\n _self = nil\n end # begin\n end # do\n end",
"def destroy\n info(\"Disabling Metricbeat module\")\n metricbeat(['modules','disable',@resource[:name]])\n end",
"def end_watch\n if @listener\n @listener.stop\n end\n end",
"def close\n Klass.close(@handle)\n\t sleep 0.2\n Klass.delete(@handle)\n true\n end",
"def destroy\n FileUtils.rm_r(directory) if exist?\n end",
"def destroy\n @watcher.destroy\n respond_to do |format|\n format.html { redirect_to watchers_url, notice: 'Watcher was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n FileUtils.rm_rf(@working_dir)\n end",
"def cleanup\n vm_id = VMHelper.get_vm(service_manager.vapi_config, vm_name)\n status = vm_power_svc.get(vm_id)\n if status.state == VM_POWER_CLASS::State::POWERED_ON ||\n status.state == VM_POWER_CLASS::State::SUSPENDED\n log.info \"The VM #{vm_name} would be powered OFF\"\n vm_power_svc.stop(vm_id)\n end\n log.info \"Cleanup :: Deleting the VM #{vm_name}\"\n vm_svc.delete(vm_id)\n end",
"def decrease_health\n @health.update { |v| v - 1 }\n end",
"def rm(hostname)\n hosts.delete hostname\n end",
"def destroy\n ValidNetwork.find_by_guid(segment_config_network.guid).destroy if segment_config_network &&ValidNetwork.find_by_guid(segment_config_network.guid)\n meas_locations.each {|mloc| MeasLocation.find_by_guid(mloc.guid).destroy if mloc && MeasLocation.find_by_guid(mloc.guid)}\n super\n end",
"def destroy\n if @summary.destroy\n \n end\n end",
"def cleanup_storage vm\n vm.volumes.each do |vol|\n @logger.debug \"Deleting volume #{vol.name} for OpenStack host #{vm.name}\"\n vm.detach_volume(vol.id)\n vol.wait_for { ready? }\n vol.destroy\n end\n end",
"def _destroy\n marked_for_destruction?\n end",
"def destroy\n @splashscreen.destroy\n respond_to do |format|\n format.html { redirect_to splashscreens_url, notice: 'Splashscreen was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n FFI::NCurses.del_panel(@panel) if @panel\n FFI::NCurses.delwin(@pointer) if @pointer\n @panel = @pointer = nil # prevent call twice\n end",
"def destroy\n kill\n reset\n end"
] | [
"0.6627919",
"0.5984936",
"0.59543437",
"0.5859098",
"0.57966596",
"0.562554",
"0.5597796",
"0.55347276",
"0.5470935",
"0.5425685",
"0.5413738",
"0.5387723",
"0.5339462",
"0.5324221",
"0.52160877",
"0.51552993",
"0.50998926",
"0.5078183",
"0.5039362",
"0.5033613",
"0.49981368",
"0.49960586",
"0.49746048",
"0.49716482",
"0.49655867",
"0.49595055",
"0.4920613",
"0.4909315",
"0.4903799",
"0.48976287",
"0.48891586",
"0.48846808",
"0.4869957",
"0.484195",
"0.48407063",
"0.48402408",
"0.48402408",
"0.48208117",
"0.48186004",
"0.48074666",
"0.47945684",
"0.47897723",
"0.47679955",
"0.47627136",
"0.47467417",
"0.47375497",
"0.4732524",
"0.47276828",
"0.47211763",
"0.4707963",
"0.47054252",
"0.47005466",
"0.46999216",
"0.46944603",
"0.4690855",
"0.46783435",
"0.4674945",
"0.46693605",
"0.46677953",
"0.46665877",
"0.4665099",
"0.4653118",
"0.4638057",
"0.46270368",
"0.46248996",
"0.4620406",
"0.46123606",
"0.46020925",
"0.46019185",
"0.4598418",
"0.45885062",
"0.45861962",
"0.45846313",
"0.45843944",
"0.4578751",
"0.45779422",
"0.45640245",
"0.45627952",
"0.45579082",
"0.45576018",
"0.45534095",
"0.45520237",
"0.45520237",
"0.45436043",
"0.45273083",
"0.45270228",
"0.45225617",
"0.45225063",
"0.45206475",
"0.45138636",
"0.4513402",
"0.45130888",
"0.45093155",
"0.4507577",
"0.45075202",
"0.45074844",
"0.45062938",
"0.4506272",
"0.4505176",
"0.45022637"
] | 0.6022731 | 1 |
This is the games controller | def games
@remember_token = User.hash_token(cookies[:remember_token])
@user = User.find_by(remember_token: @remember_token)
# defaultParams.merge(params) Will keep defaults and new ones will overwrite dup keys
if (!params[:order])
params[:order] = ""
end
games = getInventoryFromSelector(Ownership, :games)
if (params.has_key?(:console_id))
@ownership = games.where(:console_general => {:eng_name => params[:console_id]})
else # Make some config or user set results per page
@ownership = games.all
end
@image = Image.all
@gameConsoles = Ownership.where(user_id: @user).joins(:games => :console_general).order("eng_name").uniq.pluck(:eng_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @games = current_creator.games\n redirect_to root_path\n end",
"def index\n\t\t@games = Game.all\n\tend",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n @games = Game.all\n end",
"def index\n listing_games\n end",
"def index\n @games = Game.get_all_active\n end",
"def games\n redirect_to navigation_games_path\n end",
"def index\n @user = user_session.current_user\n @new_game = Game.new(player1_id: @user.id)\n @ongoing_games = @user.ongoing_games\n @waiting_games = Game.waiting_games(@user)\n @user_waiting_game = @user.waiting_game\n @recent_games = @user.completed_games(5)\n end",
"def index\n @available_games = Game.available(current_user)\n @users_games = Game.users_games(current_user)\n end",
"def index\n @league_games = LeagueGame.all\n end",
"def index\n @board_games = BoardGame.all\n end",
"def index\n @board_games = BoardGame.all\n end",
"def index\n @admin_games = Game.all\n end",
"def show\n # before_action\n @games = @player.games\n end",
"def index\n @game_studios = GameStudio.all\n end",
"def index\n @playedgames = Playedgame.all\n end",
"def index\n @games = current_user.games\n end",
"def index\n @players = @game.players\n end",
"def index\n @players = @game.players\n end",
"def index\n @games = Game.paginate(page: params[:page], per_page: 10) # list 10 games per page\n end",
"def index\n @user_games = UserGame.all\n \n end",
"def index\n @gameservers = Gameserver.all\n end",
"def index\n @gameservers = Gameserver.all\n end",
"def index\n @games = Game.available\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = @organization.games\n end",
"def index\n @game_infos = GameInfo.all\n end",
"def index\n @game_players = GamePlayer.all\n end",
"def index\n @g_game_boards = GGameBoard.all\n end",
"def index\n @wantedgames = Wantedgame.all\n end",
"def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @mini_games = MiniGame.all\n end",
"def index\n if not current_user\n redirect_to new_user_session_path \n return\n end\n #@games = current_user.games\n # HACK WARNING!!!\n #@games.each do |game|\n # @games = @games - [game] if @games.include? game\n # @games << game\n #end\n @games = Game.all\n end",
"def index\n @games_teams = GamesTeam.all\n end",
"def index\n @games_from_results = GamesFromResult.all\n end",
"def index\n @gameobjects = Gameobject.all\n end",
"def index\n @games = current_user.games\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n game = Game.find(params[:game_id])\n @player_games = game.player_games\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @player_games }\n format.json { render :json => @player_games}\n end\n end",
"def index\n if current_user.admin?\n @games = Game.all\n else\n @games = Game.upcoming.publicly_available\n end\n end",
"def index\n @paddle_games = PaddleGame.all\n end",
"def index\n @game_plays = GamePlay.all\n end",
"def index\n @race_games = RaceGame.all\n end",
"def index # this is actually an edit permissions page\n @game = Game.find(params[:game_id])\n end",
"def new_game \n Game.new.play_game\n end",
"def index\n @game_items = GameItem.all\n end",
"def index\n @games = Game.all\n raise RecordNotFound, 'No records on games' if @games.empty?\n\n # TODO: Just for Test. Do not forget to delete when finish the test.\n # raise 'error !!'\n # sleep 1\n\n render 'index', formats: 'json', handlers: 'jbuilder'\n end",
"def index\n @qa_games = QaGame.all\n end",
"def game\n game_id = params[:game_id].to_i\n if game_id != 0\n @game = Game.find(game_id)\n unless @game.active?\n flash.notice = 'The game is over.'\n back_to_index\n end\n unless @game.players_turn?(current_user.id)\n back_to_index\n end\n @opponent = @game.opponent(current_user.id)\n if @game.challenge_round?\n ask_another_question(@game.id)\n end\n end\n end",
"def index\n @howtoplaygames = Howtoplaygame.all\n end",
"def index\n @games = Game.all \n @users = User.all \n @current_user_joined = false \n \n end",
"def index\n @games = @season.games #Game.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @games }\n end\n end",
"def index\n @game = Game.find(current_user.game_setting_id || 1)\n authorize @game\n @levels = @game.levels\n @modes = @game.modes\n @strategies = @game.strategies\n @strategy = Strategy.new\n end",
"def index\n @football_games = FootballGame.all\n end",
"def index\n @presenter = MetaGamePresenter.new\n end",
"def index\n player = params[:player].present? ? params[:player] : nil\n @games = if player\n Game.joins(:players).where('players.id = ?', player)\n else\n Game.all\n end\n end",
"def index\n @games = Game.all\n render json: @games\n end",
"def index\n @games = Game.is_available\n end",
"def index\n gon.yourID = current_user.id\n current_user.game == nil ? @games = Game.all : @games = Game.find(current_user.game.id)\n @team1 = @games.team1.users if @games.try :team1\n @team2 = @games.team2.users if @games.try :team2\n respond_to do |format|\n format.html\n format.json { render :json => { :games => @games.to_json(:include => [:users]),\n :user => current_user.game,\n :will => current_user.will,\n :team1 => @team1,\n :team2 => @team2 }\n }\n end\n end",
"def index\n @games = Game.accessible_by(current_ability, :manage).actual\n end",
"def index\n @games = Game.all.page(params[:page]).per(10)\n # @games = Game.all\n end",
"def get_game\n @game = Game.find(params[:game_id])\n end",
"def get_game\n @game = Game.find(params[:game_id])\n end",
"def show\n @game = Game.find(params[:id])\n end",
"def show\n @game = Game.find(params[:id])\n end",
"def show\n @game = Game.find(params[:id])\n end",
"def show\n @game = Game.find(params[:id])\n end",
"def index\n @times_games = TimesGame.all\n end",
"def index\n team_name = params[:team_name]\n team = Team.is_like(team_name).first if team_name.present?\n if team\n redirect_to team_path(team)\n end\n\n @show_jumbo = anonymous and request.path == '/'\n @games = Game.relevant.order(updated_at: :desc )\n end",
"def index\n @game_game_instances = if admin? || staff?\n Game::GameInstance.all\n else\n if !current_identity.nil? && current_identity.insider?\n Game::GameInstance.available.visible\n else \n Game::GameInstance.available.visible.visible_to_non_insiders\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json do\n if !current_identity.nil?\n @game_game_instances.each { |instance| instance.current_identity = current_identity }\n render json: @game_game_instances, :methods => [:random_selected_servers, :has_player_joined?, :default_game?]\n else\n render json: @game_game_instances, :methods => [:random_selected_servers, :default_game?]\n end\n end\n end\n end",
"def index\n @games = Game.order('title')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n if (params[:num_players] != nil)\n @num_players = params[:num_players]\n @games = Game.where(numplay: @num_players)\n else\n @num_players = \"All\"\n @games = Game.all\n end\n\n \n @games = @games.order(date: :desc)\n end",
"def index\n @gameplays = initialize_grid(Gameplay,:include=>[:user])\n end",
"def index\n @game_titles = GameTitle.all\n @times = TimesGame.all\n @users = User.all\n end",
"def index\n @games = Admin::Game.all.order(\"date DESC\").paginate(page: params[:page], per_page: 20)\n end",
"def index\n @games = Game.all\n @player_games = current_user.games rescue nil\n @ongoing_games = Game.where(outcome: 'In progress').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def show\n @game = Game.find(params[:game_id])\n end",
"def index\n @gamers = Gamer.all\n end"
] | [
"0.7696546",
"0.76638573",
"0.7568997",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7567566",
"0.7333824",
"0.7322052",
"0.7214571",
"0.71674997",
"0.7157436",
"0.71459305",
"0.7143836",
"0.7143836",
"0.7140582",
"0.71373934",
"0.71221733",
"0.7105658",
"0.7100913",
"0.7098898",
"0.7098898",
"0.70787644",
"0.7077135",
"0.70421225",
"0.70421225",
"0.7026753",
"0.6994389",
"0.69781977",
"0.6959352",
"0.69540924",
"0.69490623",
"0.6946781",
"0.6946081",
"0.6946081",
"0.6946081",
"0.692925",
"0.6926802",
"0.6915653",
"0.69137496",
"0.69113594",
"0.69083947",
"0.69051284",
"0.6879661",
"0.68680936",
"0.6867679",
"0.6866206",
"0.68552077",
"0.6847508",
"0.6837321",
"0.6833952",
"0.6829287",
"0.6828672",
"0.6823982",
"0.680174",
"0.6795251",
"0.6790674",
"0.6781622",
"0.6775188",
"0.6774073",
"0.67737263",
"0.6759619",
"0.675053",
"0.67413235",
"0.6737379",
"0.6730049",
"0.6730049",
"0.67198414",
"0.67198414",
"0.67198414",
"0.67198414",
"0.6715818",
"0.67156917",
"0.67149824",
"0.6710018",
"0.67074794",
"0.6704043",
"0.670361",
"0.66953474",
"0.6687306",
"0.6679043",
"0.6677028"
] | 0.0 | -1 |
Allows +Model.for_search_params+ to do equalitybased searching for the given +attr_names+. Date attributes (ending in "_on") will take Rubyparseable date strings as well as the common US case "mm/dd/yyyy". searchable :first_name, :last_name, :born_on | def searchable(*attr_names)
attr_names.each do |attr_name|
scope "search_#{attr_name}", -> attr_value do
where(attr_name => (attr_name =~ /_on$/ ? parse_date_string(attr_value) : attr_value))
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def criterion_list searchable_attr = {}, formats ={}, criteria = {}\n\n searchable_attr.each{|attr|\n criterion_key = attr_2_criterion_sym(attr)\n #operator_key = attr_2_operator(attr)\n if params[criterion_key] then\n if not params[criterion_key].blank? then\n if criterion_key.to_s.ends_with?('_date') || criterion_key.to_s.ends_with?('_at') then\n # This is a bit shakey: duck programming at its \"best\" providing you know ath all date attributes must end with \"_date\"\n #criteria[attr] = DateTime.strptime(params[criterion_key], ((formats[criterion_key].nil?)?t($DF + \"default\") : t(formats[criterion_key])))\n criteria[attr] = DateTime.strptime(params[criterion_key], ((formats[criterion_key].nil?)?$DATE_TRANSFER_FORMAT : t(formats[criterion_key])))\n else\n criteria[attr] =params[criterion_key]\n end\n #else\n \n \n end # not blank\n end \n }\n return criteria\n end",
"def searchable_by *fields\n self.fields = process_fields(fields)\n end",
"def has_dates(*attrs)\n options = attrs.extract_options!\n attrs.each do |attr|\n\n attr_reader attr\n define_reader_with_options(attr,options)\n define_method(\"#{attr.to_s}=\") do |val| \n val = val.to_date unless val.nil?\n instance_variable_set(\"@#{attr}\", val )\n attributes[attr] = val\n val\n\n end\n end\n end",
"def searchable_date(attribute)\n searchable do\n time attribute\n string attribute\n end\n end",
"def search_fields(*args)\n @@search_fields = args.map { |a| a.to_sym }\n end",
"def act_as_virtual_date(*attributes)\n \n attributes.each do |attribute|\n # Setter\n define_method \"#{attribute.to_s}_str=\" do |arg|\n send(\"#{attribute.to_s}=\", to_date(arg, true))\n end \n # Getter\n define_method \"#{attribute.to_s}_str\" do\n date_format send(\"#{attribute.to_s}\")\n end\n end\n \n end",
"def append_date_condition(search,r_name)\n if params[:date_selected]\n search += \" AND created_at Between :start_date AND :end_date \"\n r_name += \" created between #{params[:date_start]} - #{params[:date_end]}\"\n end\n [search,r_name]\n end",
"def search\n\tdob=current_user.date_of_birth\n\tstart_date=Date.civil(dob.year+params[:search][:younger].to_i,dob.month,dob.day)\n\tend_date=Date.civil(dob.year-params[:search][:older].to_i,dob.month,dob.day)\n\t@user=User.where([\"(date_of_birth <= ? and date_of_birth>=?)\",start_date,end_date])\n end",
"def searchable_on(*fields)\n # Make sure that the table to be searched actually exists\n if self.table_exists?\n if fields.first.class.to_s == 'Hash'\n if fields.first.has_key?(:only)\n fields = fields.first[:only]\n elsif fields.first.has_key?(:except)\n fields = self.column_names.collect { |column| \n fields.first[:except].include?(column.to_sym) ? nil : column.to_sym }.compact\n end\n end\n \n assoc_models = self.reflections.collect { |m| m[0] }\n assoc_fields = fields - self.column_names.collect { |column| column.to_sym }\n fields -= assoc_fields\n \n assoc_groupings = {}\n assoc_models.each do |assoc_model|\n assoc_groupings[assoc_model] = []\n \tassoc_fields.each do |assoc_field|\n \t unless assoc_field.to_s.match(/^#{assoc_model.to_s}_/).nil?\n assoc_groupings[assoc_model] << assoc_field.to_s.sub(/^#{assoc_model.to_s}_/, '').to_sym \n end\n end\n end\n \n assoc_groupings = assoc_groupings.delete_if {|group, field_group| field_group.empty?}\n \n self.cattr_accessor :scoped_search_fields, :scoped_search_assoc_groupings\n self.scoped_search_fields = fields\n self.scoped_search_assoc_groupings = assoc_groupings\n self.named_scope :search_for, lambda { |keywords| self.build_scoped_search_conditions(keywords) }\n end\n end",
"def register_search_fields(*names)\n names.each do |name|\n search_fields << name.to_s\n end\n end",
"def convert_date\n params[:search][:date_lte] = params[:search]['date_lte(1i)'].to_s + \"-\" + params[:search]['date_lte(2i)'].to_s + \"-\" + params[:search]['date_lte(3i)'].to_s\n params[:search][:date_gte] = params[:search]['date_gte(1i)'].to_s + \"-\" + params[:search]['date_gte(2i)'].to_s + \"-\" + params[:search]['date_gte(3i)'].to_s\n ['date_lte(1i)', 'date_lte(2i)', 'date_lte(3i)', 'date_gte(1i)', 'date_gte(2i)', 'date_gte(3i)'].each do |d|\n params[:search].delete(d)\n end \n end",
"def conditions_for(fields=[])\n predicate = []\n values = []\n fields.each do |field|\n predicate << \"lower(#{field.to_s}) like ?\"\n values << \"'%' + @search_key.downcase + '%'\"\n end\n eval(\"[\\\"#{predicate.join(' OR ')}\\\", #{values.join(',')}]\")\n end",
"def search_fields(options)\n search_fields = options.delete(:use_key)\n if search_fields\n search_fields = [search_fields] unless search_fields.is_a?(Array)\n search_fields = search_fields.sort_by{|f| f.to_s}\n else\n search_fields = options[:conditions].to_a.sort_by{|f| f.first.to_s}.map(&:first)\n end\n\n # If no seach field fall back on :created_at or :id\n if search_fields.empty?\n if property_names.include?(:created_at)\n search_fields << :created_at\n else\n search_fields << :_id\n end\n end\n\n # Deal with missing underscore automatically\n search_fields << :_id if search_fields.delete(:id)\n search_fields << :_rev if search_fields.delete(:rev)\n search_fields\n end",
"def search(live=false)\n doctor = nil\n user = nil\n patient = nil\n date = nil\n\n doctor = \"%\" + params[:doctor_field] + \"%\" if !params[:doctor_field].nil? and params[:doctor_field].length > 0\n user = \"%\" + params[:user_field] + \"%\" if !params[:user_field].nil? and params[:user_field].length > 0\n patient = \"%\" + params[:patient_field] + \"%\" if !params[:patient_field].nil? and params[:patient_field].length > 0\n date = (!params[:Time][:tomorrow].nil? and params[:Time][:tomorrow].length > 0) ? params[:Time][:tomorrow] : Time.tomorrow\n#Learn how to handle Dates in rails' forms\n # date = params[:date_field].nil? ? Date.new. : params[:date_field]\n\n# logger.error \"D: #{doctor}/#{params[:doctor_field]}; U: #{user}/#{params[:user_field]}; P: #{patient}/#{params[:patient_field]}; T: #{date}/#{params[:Time][:now]}\\n\"\n\n tables = ['form_instances']\n tables.push('doctors') unless doctor.nil?\n tables.push('users') unless user.nil?\n tables.push('patients') unless patient.nil?\n\n matches = ['form_instances.status_number=4 AND form_instances.created_at < :date'] #Put the date field in first by default - there will always be a date to search for.\n matches.push('form_instances.doctor_id=doctors.id') unless doctor.nil?\n matches.push('form_instances.user_id=users.id') unless user.nil?\n matches.push('form_instances.patient_id=patients.id') unless patient.nil?\n matches.push('doctors.friendly_name LIKE :doctor') unless doctor.nil?\n matches.push('users.friendly_name LIKE :user') unless user.nil?\n matches.push('(patients.first_name LIKE :patient OR patients.last_name LIKE :patient OR patients.account_number LIKE :patient OR patients.address LIKE :patient)') unless patient.nil?\n\n @form_values = {:Time => {:tomorrow => date}} #put the date field in first by default - there will always be a date to search for.\n @values = {:date => date}\n @form_values.merge!({:doctor_field => params[:doctor_field]}) unless doctor.nil?\n @values.merge!({:doctor => doctor}) unless doctor.nil?\n @form_values.merge!({:user_field => params[:user_field]}) unless user.nil?\n @values.merge!({:user => user}) unless user.nil?\n @form_values.merge!({:patient_field => params[:patient_field]}) unless patient.nil?\n @values.merge!({:patient => patient}) unless patient.nil?\n\n# SELECT form_instances.* FROM form_instances,doctors,users,patients WHERE form_instances.doctor_id=doctors.id AND form_instances.user_id=users.id AND form_instances.patient_id=patients.id AND doctors.friendly_name LIKE :doctor AND users.friendly_name LIKE :user AND (patients.first_name LIKE :patient OR patients.last_name LIKE :patient OR patients.account_number LIKE :patient OR patients.address LIKE :patient)\n\n @result_pages, @results = paginate_by_sql(FormInstance, [\"SELECT form_instances.* FROM \" + tables.join(',') + \" WHERE \" + matches.join(' AND ') + \" ORDER BY form_instances.created_at DESC\", @values], 30, options={})\n @search_entity = @results.length == 1 ? \"Archived Form\" : \"Archived Forms\"\n render :layout => false\n end",
"def custom_search\n\n # if we’ve no searchable fields, then just fail out\n return [] if @searchable_fields.empty?\n\n # otherwise, construct our query\n fields = []\n values = []\n @searchable_fields.each do |f|\n\n fields << \"#{f} LIKE ?\"\n values << \"%#{params[:search]}%\"\n\n end\n\n # run the query\n @model_class.where( fields.join( ' OR '), *values )\n\n\n end",
"def search_attrs_prep(initial_search_attr_values)\n self.search_attr_values = initial_search_attr_values\n self.search_attr_values = use_defaults if using_defaults\n\n if search_attr_values.respond_to? :to_unsafe_h\n self.search_attr_values = search_attr_values.to_unsafe_h.symbolize_keys\n end\n\n search_attributes = self.search_attributes.symbolize_keys\n ks = search_attributes.keys\n ks.each do |k|\n search_attr_values[k] = nil unless search_attr_values.key? k\n end\n\n search_attr_values.slice!(*ks)\n\n search_attr_values.each do |k, v|\n if v.blank?\n search_attr_values[k] = nil\n elsif v.is_a? Hash\n search_attr_values[k] = v.collect { |_, v1| v1 }\n elsif v.is_a?(String) && v.include?(\"\\n\")\n search_attr_values[k] = if search_attributes_config[k.to_sym].multiple == 'multiple-regex'\n \"(#{v.split(\"\\n\").map(&:squish).join('|')})\"\n else\n v.split(\"\\n\").map(&:squish)\n end\n end\n end\n\n search_attr_values[:ids_filter_previous] = nil\n\n if previous_filtering.sql_requests_filtering\n previous_filtering.requested = (search_attr_values[:_filter_previous_] == 'true')\n search_attr_values[:ids_filter_previous] = previous_filtering.filtering_ids\n end\n end",
"def search_in_date_range(by_direction, with_date)\n logger.debug \"Searched #{date_field} on #{self.class.name} with a scope\"\n where(\"#{table_name}.#{date_field} #{by_direction}= ?\", coalesce_date(with_date, by_direction))\n end",
"def validates_as_date(*attr_names)\n configuration = { :message => \"attribute should be of type Date\" }\n validates_each(attr_names, configuration) do |record, attr_name, value|\n unless value.is_a?(Date)\n record.errors.add(attr_name, :invalid, :default => configuration[:message], :value => value)\n end\n end\n end",
"def initialize(attributes = {})\n attributes.each do |name, value|\n if name.to_s != 'start_date' && name.to_s != 'end_date'\n send(\"#{name}=\", value)\n else\n send(\"#{name}=\", convert_date(value))\n end\n end \n end",
"def search_params\n # note: search_fields_attributes are assigned id's when errors occur,\n # so we remove them since no records are in the db for this search:\n unless params['search']['search_fields_attributes'].blank?\n params['search']['search_fields_attributes'].each { |k,v| v.delete('id') }\n end\n # remove single/double quotes from name which cause chart's to fail:\n params[:search][:name] = params[:search][:name].gsub(/'/, '').gsub(/\"/, '') unless params[:search][:name].blank?\n params.require(:search).permit(\n :name, :query, :sources,\n :date_from, :time_from, :date_to, :time_to, :relative_timestamp,\n :host_from, :host_to,\n :search_type, :group_by,\n :query_params,\n search_fields_attributes: [\n :id, :_destroy,\n :and_or, :data_source_id, :data_source_field_id, :match_or_attribute_value\n ]\n )\n end",
"def search_params\n params.require(:search).permit(:start_date, :end_date, :investment_amount)\n end",
"def attr_searchable(*args)\n if table_exists?\n opts = args.extract_options!\n args.flatten.each do |attr|\n attr = attr.to_s\n raise(ArgumentError, \"No persisted attribute (column) named #{attr} in #{self}\") unless self.columns_hash.has_key?(attr)\n self._metasearch_include_attributes = self._metasearch_include_attributes.merge(\n attr => {\n :if => opts[:if]\n }\n )\n end\n end\n end",
"def search_attributes\n\t\t['dn', self.attr_firstname, self.attr_lastname, self.attr_mail, self.attr_member]\n\tend",
"def filterable_by_date_range(with_name = :created_at)\n @_filterable_by_date_range_field = with_name.to_s\n end",
"def initialize(attributes = {})\n attributes.each do |name, value|\n if name.to_s != 'start_date' && name.to_s != 'end_date'\n send(\"#{name}=\", value)\n else\n send(\"#{name}=\", convert_date(value))\n end\n end\n end",
"def search(options = {})\n self.date = options[:date] || date\n self.hd = options[:hd] || hd\n response = HTTParty.get(DEFAULT_URL, query: attributes)\n handle_response(response)\n end",
"def searchable_attribute_names\n if model.respond_to?(:searchable_alchemy_resource_attributes)\n model.searchable_alchemy_resource_attributes\n else\n attributes.select { |a| searchable_attribute?(a) }\n .concat(searchable_relation_attributes(attributes))\n .collect { |h| h[:name] }\n end\n end",
"def fast_match params={}\n dob = (params[:dateofbirth] || params[:date_of_birth])\n opts = {:single_quoted => false}\n params = {\n :query => {\n \"ClientToken\" => self.token,\n \"FirstName\" => Type::String.safe_value(params[:firstname] || params[:first_name], opts),\n \"MiddleName\" => Type::String.safe_value(params[:middlename] || params[:middle_name], opts),\n \"LastName\" => Type::String.safe_value(params[:lastname] || params[:last_name], opts),\n \"ReturnFields\" => (params[:return_fields] || Table.default_fields),\n \"Reg_AddressZip5\" => Type::String.safe_value(params[:reg_addresszip5] || params[:zip], opts),\n \"DateOfBirth\" => Type::Date.safe_value(dob, opts.merge(:format => :no_dash)),\n \"Limit\" => Type::Number.safe_value(params[:limit] || 5)\n }\n }\n get 'fast_match.php', params\n end",
"def search_params\n params.require(:event).permit(:search, :start_date, :end_date, search_by_tags: [])\n end",
"def build_for_name_search(search_term)\n\t\t@where_clause << case_insensitive_search(:first_name)\n\t\t@where_args[:first_name] = starts_with(search_term)\n\n\t\t@where_clause << ' OR #{case_insensitive_search(:last_name)}'\n\t\t@where_args[:last_name] = starts_with(search_term)\n\n\t\t@order = \"last_name asc\"\n\tend",
"def searchPatients\n search_by_first_name = params[:patient][:first_name]\n search_by_last_name = params[:patient][:last_name]\n search_by_id = params[:patient][:patient_id]\n search_by_email_id = params[:patient][:email_id]\n sql = String.new\n\n if !search_by_id.blank?\n sql = \"id = \" + search_by_id\n end\n if !search_by_email_id.blank?\n if sql.blank?\n sql += \"email_id like '%\"+ search_by_email_id + \"%'\"\n else\n sql += \" or email_id like '%\"+ search_by_email_id + \"%'\"\n end\n end\n if !search_by_first_name.blank?\n if sql.blank?\n sql += \"first_name like '%\"+ search_by_first_name + \"%'\"\n else\n sql += \" or first_name like '%\"+ search_by_first_name + \"%'\"\n end\n end\n\n if !search_by_last_name.blank?\n if sql.blank?\n sql += \"last_name like '%\"+ search_by_last_name + \"%'\"\n else\n sql += \" or last_name like '%\"+ search_by_last_name + \"%'\"\n end\n end\n\n if !sql.blank?\n @patients = Patient.where(sql).paginate(:page => params[:page], :per_page => 5)\n end\n end",
"def profile_search_params\n params.permit([:first_name, :last_name])\n end",
"def search\n # simply render the search.html page\n # put all this in the index action and remove the mapping from the routes.rb\n # => for the search by date, put it in the model\n if params[:date]\n date = params[:date]\n str_date = date[:year] + '-' + date[:month] + '-' + date[:day]\n @distributions = Distribution.search(str_date)\n render 'byDate'\n end\n end",
"def search(criteria = {})\r\n \r\n end",
"def search\n # figure out if the search parameter looks like a first or last name only, or both\n @search = params[:search]\n if @search && [email protected]?\n \tnames = @search.strip.split(' ')\n \tconditions = [[],[]]\n \tif (names.size > 1)\n\t \tfirst = names[0].to_s\n \t\tlast = names[1].to_s\n\t \tconditions[0] << \"#{_(:last_name, :person)} LIKE ? AND #{_(:first_name, :person)} LIKE ? \"\n\t \tconditions[1] << last + \"%\"\n\t \tconditions[1] << first + \"%\"\n\t \telse\n\t \t name = names.join\n\t \t\tconditions[0] << \"(#{_(:last_name, :person)} LIKE ? OR #{_(:first_name, :person)} LIKE ?) \"\n\t \t\tconditions[1] << name+'%'\n\t \t\tconditions[1] << name+'%' \n\t \tend\n\t \tif params[:filter_ids].present?\n\t \t conditions[0] << \"#{_(:id, :person)} NOT IN(?)\"\n\t \t conditions[1] << params[:filter_ids]\n \t end\n \t \n \t # Scope by the user's ministry / campus involvements\n \t involvement_condition = \"(\"\n \t if my_campus_ids.present?\n \t involvement_condition += \"#{CampusInvolvement.table_name}.#{_(:campus_id, :campus_involvement)} IN(?) OR \" \n \t \tconditions[1] << my_campus_ids\n \t end\n \t involvement_condition += \"#{MinistryInvolvement.table_name}.#{_(:ministry_id, :ministry_involvement)} IN(?) )\" \n \t \n\t \tconditions[0] << involvement_condition\n\t \tconditions[1] << current_ministry.self_plus_descendants.collect(&:id)\n\t \t\n\t \t@conditions = [ conditions[0].join(' AND ') ] + conditions[1]\n \n includes = [:current_address, :campus_involvements, :ministry_involvements]\n\t \t@people = Person.find(:all, :order => \"#{_(:last_name, :person)}, #{_(:first_name, :person)}\", :conditions => @conditions, :include => includes)\n\t \trespond_to do |format|\n\t \t if params[:context]\n\t \t format.js {render :partial => params[:context] + '/results', :locals => {:people => @people, :type => params[:type], :group_id => params[:group_id]}}\n \t else\n \t format.js {render :action => 'results'}\n\t end\n\t \tend\n\t else\n\t render :nothing => true\n\t end\n end",
"def build_search(records, search)\n records = records.where(name: search.name) if search.name.present?\n records = records.where(profession: search.profession) if search.profession.present?\n records = records.where(grade: search.grade) if search.grade.present?\n\n records\n end",
"def set_search_fields(fields, precision)\n condition = nil\n # when the results have match with all fields\n condition = \"AND\" if params[\"Match all\"]\n fields.each do |field|\n @results = @data.search_by params[field], field, condition, precision unless params[field]==\"\"\n end\n end",
"def search_params\r\n\t new_date = Date.today # Default value\r\n\t if(params[:chosen_date])\r\n\t choice = params[:chosen_date]\r\n\t new_date = Date.new(choice[\"date(1i)\"].to_i, choice[\"date(2i)\"].to_i, 1)\r\n\t end\r\n\t \r\n\t { title_keywords: params[:title_keywords], chosen_date: new_date, free_food_select: params[:free_food_select] } \r\n\tend",
"def index\n search = params[:search]\n if search.present?\n @from_date = Date.new search[\"from_date(1i)\"].to_i, search[\"from_date(2i)\"].to_i, search[\"from_date(3i)\"].to_i\n @to_date = Date.new search[\"to_date(1i)\"].to_i, search[\"to_date(2i)\"].to_i, search[\"to_date(3i)\"].to_i\n else\n @from_date = Date.today\n @to_date = Date.today + 10.days\n end\n\n @notes = current_user.notes.between_dates(@from_date, @to_date)\n end",
"def name_search( type, search_for, order_by = 'name' )\n self.send(type.to_sym, { namesearch: search_for, order: order_by })\n end",
"def name_conditions\n [\"(lower(users.first_name) LIKE ? AND lower(users.last_name) LIKE ?) OR (lower(users.first_name) LIKE ? AND lower(users.last_name) LIKE ?)\", \"%#{first_name}%\", \"%#{last_name}%\", \"%#{last_name}%\", \"%#{first_name}%\"] unless name.blank?\n end",
"def build_date_from_params(params, search_object, search_date)\n\n anio = params[search_object][search_date + \"(1i)\"]\n mes = params[search_object][search_date + \"(2i)\"]\n dia = params[search_object][search_date + \"(3i)\"]\t\t\n\n\t\treturn Date.new(anio.to_i, mes.to_i, dia.to_i)\n\n\tend",
"def filter_search(attributes)\n # TODO CHANGE because to _unsafe h permits to inject all the things of attributes\n attributes.to_unsafe_h.inject(self) do |scope, (key, value)|\n # return scope.scoped if value.blank?\n if value.blank?\n scope.all\n else\n case key.to_sym\n when :order # order=field-(ASC|DESC)\n attribute, order = value.split('-')\n scope.order(\"#{table_name}.#{attribute} #{order}\")\n\n else # unknown key (do nothing or raise error, as you prefer to)\n scope.all\n end\n\n end\n end\n end",
"def build_from_params(params)\n super\n if params[:from].present? && params[:to].present?\n add_filter('date_in', '><', [params[:from], params[:to]])\n elsif params[:from].present?\n add_filter('date_in', '>=', [params[:from]])\n elsif params[:to].present?\n add_filter('date_in', '<=', [params[:to]])\n end\n self\n end",
"def delegate_to_search_pattern\n /(?:_equals|_contains|_gte|_lte)\\z/\n end",
"def search(live=false)\n user = nil\n patient = nil\n date = nil\n\n user = \"%\" + params[:user_field] + \"%\" if !params[:user_field].nil? and params[:user_field].length > 0\n patient = \"%\" + params[:patient_field] + \"%\" if !params[:patient_field].nil? and params[:patient_field].length > 0\n date = (!params[:Time][:tomorrow].nil? and params[:Time][:tomorrow].length > 0) ? params[:Time][:tomorrow] : Time.tomorrow\n #Learn how to handle Dates in rails' forms\n # date = params[:date_field].nil? ? Date.new. : params[:date_field]\n\n # logger.error \"D: #{doctor}/#{params[:doctor_field]}; U: #{user}/#{params[:user_field]}; P: #{patient}/#{params[:patient_field]}; T: #{date}/#{params[:Time][:now]}\\n\"\n\n tables = ['form_instances']\n tables.push('users') unless user.nil?\n tables.push('patients') unless patient.nil?\n\n matches = [\"form_instances.doctor_id=:doctor_id AND form_instances.status_number=4 AND form_instances.created_at < :date\"] #Put the date field in first by default - there will always be a date to search for.\n matches.push('form_instances.user_id=users.id') unless user.nil?\n matches.push('form_instances.patient_id=patients.id') unless patient.nil?\n matches.push('users.friendly_name LIKE :user') unless user.nil?\n matches.push('(patients.first_name LIKE :patient OR patients.last_name LIKE :patient OR patients.account_number LIKE :patient OR patients.address LIKE :patient)') unless patient.nil?\n\n @form_values = {:Time => {:tomorrow => date}} #put the date field in first by default - there will always be a date to search for.\n @values = {:date => date, :doctor_id => current_doctor.id}\n @form_values.merge!({:user_field => params[:user_field]}) unless user.nil?\n @values.merge!({:user => user}) unless user.nil?\n @form_values.merge!({:patient_field => params[:patient_field]}) unless patient.nil?\n @values.merge!({:patient => patient}) unless patient.nil?\n\n # SELECT form_instances.* FROM form_instances,doctors,users,patients WHERE form_instances.doctor_id=doctors.id AND form_instances.user_id=users.id AND form_instances.patient_id=patients.id AND doctors.friendly_name LIKE :doctor AND users.friendly_name LIKE :user AND (patients.first_name LIKE :patient OR patients.last_name LIKE :patient OR patients.account_number LIKE :patient OR patients.address LIKE :patient)\n\n @result_pages, @results = paginate_by_sql(FormInstance, [\"SELECT form_instances.* FROM \" + tables.join(',') + \" WHERE \" + matches.join(' AND ') + \" ORDER BY form_instances.created_at DESC\", @values], 30, options={})\n @search_entity = @results.length == 1 ? \"Archived Form\" : \"Archived Forms\"\n render :layout => false\n end",
"def initialize(model, name, options = {})\n super\n @attribute = options[:attribute] || begin\n name_str = name.to_s\n name_str =~ /_at$/ ? name : (name_str << \"_at\").to_sym\n end\n @named_scope = options[:named_scope] || @name\n @model.named_scope @named_scope, lambda { |range|\n if range.respond_to?(:[])\n range = range[:period] && @model.date_range_for(range[:period], range[:start])\n end\n if range\n {:conditions => \"#{@model.table_name}.#{@attribute} #{range.to_s :db}\"}\n else\n {}\n end\n }\n end",
"def index\n delocalize_dates([:fecha_greater_than_or_equal_to, :fecha_less_than_or_equal_to]) if params[:search]\n @nominas = do_index(Nomina, params)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nominas }\n end\n end",
"def search\n @users = User.all.order(:user_id)\n if params[:search][:annual].present?\n @users = @users.where(\"annual like '%\" + params[:search][:annual] + \"%' \").order(:user_id) \n end\n if params[:search][:name].present?\n @users = @users.where(\"name like '%\" + params[:search][:name] + \"%' \").order(:user_id)\n end\n @name = params[:search][:name]\n @annual = params[:search][:annual]\n render :index\n end",
"def validate_with_key(record, compare_date_attr, compare_date, key, attr_name)\n case key\n when :end_date_attr # compare_date: { end_date_attr: :lease_end_date}\n validate_date_range(record, compare_date_attr, compare_date, attr_name)\n when :equal_date_attr # compare_date: { equal_date_attr: :relevant_date}\n validate_dates_equal(record, compare_date_attr, compare_date, attr_name)\n when :triennial_date_attr # compare_date: { equal_date_attr: :relevant_date}\n validate_triennial_dates(record, compare_date_attr, compare_date, attr_name)\n end\n end",
"def search\n\t\tquery_str = \"\"\n\t\tis_first = true\n\t\tval_list = []\n\n\t\tparams.each do |key, value|\n\t\t\tif key == 'first_name' or key == 'last_name' or key == 'dot_number'\n\t\t\t\t\tquery_str += \" AND \" unless is_first\n\n\t\t\t\t\tis_first = false\n\t\t\t\t\tquery_str += key + \" = ?\"\n\t\t\t\t\tval_list << value\n\t\t\tend\n\t\tend\n\n\t\tputs query_str\n\n\t\trender json: Student.where(query_str, *val_list)\n\tend",
"def search filter\n if filter && is_searchable?\n filter = [filter, Chronic.parse(filter).strftime(\"%Y-%m-%d\")] rescue filter\n handle_joins(self.fields, scoped.select(\"DISTINCT(`#{self.table_name}`.`id`), `#{self.table_name}`.*\"))\n .where(build_filter(filter, self.fields))\n else\n scoped\n end\n end",
"def query_by(*attributes)\n @query_by = attributes\n end",
"def search\n col_dict = {\n :unit_code => \"0\",\n :name => \"1\",\n :email => \"2\"\n }\n \n if params[:filter]\n col_dict.keys.each do |k|\n search = params[:filter][ col_dict[k] ]\n next if search.blank?\n \n if k == :name\n fn, ln = search.split(\" \", 2)\n \n if !ln.blank?\n params[:first_name] = fn\n params[:last_name] = ln\n \n else\n params[:first_name] = fn\n end\n \n else\n params[k] = search\n end\n \n end\n end\n \n # tablesorter page index start with 0\n params[:page] = params[:page].to_i + 1\n \n filter_residents(10)\n \n #render :json => {:resident_path => @resident ? property_resident_path(@property, @resident, :anchor => \"addTicket\") : nil }\n \n render template: \"residents/table.json.rabl\" \n \n end",
"def specific_search(**args)\n params = parameters(args) do\n required_params :term, :field_type, :field_key\n optional_params :term, :exact_match, :field_type, :field_key, :return_field_key, :return_item_ids, :start, :limit\n end\n request(:get, 'searchResults/field', params)\n end",
"def flightsearch_params\n params.require(:flightsearch).permit(:departure_date, :arrival_date, :airport)\n end",
"def search_field_name\n searchable_attribute_names.join(\"_or_\") + \"_cont\"\n end",
"def to_conditions(params={})\n # Create an object to store named parameter conditions\n conditioner = OpenStruct.new\n conditioner.or = []\n conditioner.and = []\n conditioner.parameters = {}\n \n if @start_date && @end_date\n conditioner.and << \" CAST(start_date AS DATE) >= :start_date AND CAST(start_date AS DATE) <= :end_date\"\n conditioner.parameters[:start_date] = @start_date.to_s(:db)\n conditioner.parameters[:end_date] = @end_date.to_s(:db)\n end\n statement = conditioner.or.join(' OR ')\n statement += \" AND \" if !conditioner.or.empty? and !conditioner.and.empty?\n statement += conditioner.and.join(' AND ')\n return [statement, conditioner.parameters]\n end",
"def search_on_params(params, conditions = {})\n joins = [] # list of joined tables\n wheres = {} # set of equality where clauses\n wheresalt = [nil, {}] # list of non-equality where clauses (such as LIKE)\n selects = ['masters.id', 'masters.rank as master_rank', 'masters.pro_info_id', 'masters.pro_id', 'masters.msid']\n\n params.each do |params_key, params_val|\n if params_val.is_a? Hash\n\n if params_val.first.first == '0'\n # Grab the first array item from the parameters if there is one to reset the context\n params_val = params_val.first.last\n end\n\n # Handle nested attributes\n # Get the key name for the table by removing the _attributes extension from the key\n\n if params_key.to_s.include? '_attributes'\n condition_key = params_key.to_s.gsub('_attributes', '').to_sym\n r = Master.reflect_on_association(condition_key)\n logger.debug \"checking master association #{condition_key}\"\n logger.debug \"r: #{r}\"\n logger.debug \"condition_key: #{condition_key}\"\n logger.debug \"Reflection: #{r.klass.table_name}\"\n logger.debug \"Source Reflection: #{r.source_reflection.name && r.source_reflection.name}\"\n condition_table = if r.klass # r.source_reflection #\n r.klass.table_name # r.source_reflection.name.to_s #\n else\n r.plural_name.to_s\n end\n else\n # Generate a pluralized table name for associations that are has_one\n condition_table = params_key.to_s.pluralize\n end\n\n # Keep only non-nil attributes for the primary wheres that don't have an alternative condition string\n\n basic_condition_attribs = params_val.select do |key1, v1|\n !v1.nil? && !alt_condition(condition_key, [key1, v1])\n end\n\n # Pull the attributes with an alternative condition string (note that this returns nil values too)\n # format: {condition: condition_clause, reference: {reference_name => value}, joins: joins_clauses}\n alt_condition_attribs = params_val.reject { |_, v1| v1.nil? }.map { |v2| alt_condition(condition_key, v2) }\n\n logger.debug \"Param: #{params_key} has condition_table: #{condition_table}\"\n logger.debug \"basic_condition_attribs #{basic_condition_attribs} -- alt_condition_attribs #{alt_condition_attribs}\"\n\n # If we have a set of attributes that is not empty\n # add the equality conditions to the list of wheres\n if !basic_condition_attribs.empty? || !alt_condition_attribs.empty?\n\n # When this is a basic condition\n unless basic_condition_attribs.empty?\n logger.debug \"This is a basic condition for condition_table #{condition_table}\"\n # When the where for the condition_table is an array of key/values already, just add to it\n # otherwise store the basic condition attributes directly\n if wheres[condition_table] && wheres[condition_table].first.last.is_a?(Array)\n wheres[condition_table][basic_condition_attribs.first.first] += basic_condition_attribs.first.last\n else\n wheres[condition_table] = basic_condition_attribs\n end\n end\n # When there is a defined alternative condition\n unless alt_condition_attribs.empty?\n logger.info \"Merging alternative conditions FOR #{alt_condition_attribs}\"\n # For each alternative condition attribute, check if it has a defined condition, then\n # generate alternative where clauses\n alt_condition_attribs.each do |alt_condition_attrib|\n next unless alt_condition_attrib && alt_condition_attrib[:condition]\n\n logger.info \"Alt Condition: #{alt_condition_attrib[:condition]}\"\n wheresalt[0] = \"#{wheresalt[0]}#{wheresalt[0] ? ' AND ' : ''}#{alt_condition_attrib[:condition]}\"\n wheresalt[1].merge! alt_condition_attrib[:reference]\n if alt_condition_attrib[:joins].is_a?(Symbol) && alt_condition_attrib[:joins] != :no_join\n joins << alt_condition_attrib[:joins]\n logger.info \"Adding alt join #{alt_condition_attrib[:joins]}\"\n elsif alt_condition_attrib[:joins].is_a? String\n joins << alt_condition_attrib[:joins]\n logger.info \"Adding alt joins #{alt_condition_attrib[:joins]}\"\n elsif alt_condition_attrib[:joins].is_a? Array\n joins += alt_condition_attrib[:joins]\n logger.info \"Adding alt joins #{alt_condition_attrib[:joins]}\"\n else\n logger.info 'Not Adding alt joins'\n end\n end\n end\n\n logger.debug \"Adding condition_key to joins: #{condition_key}\"\n joins << condition_key unless NoDefaultJoinFor.include?(condition_key)\n logger.info \"adding standard join params_val=#{condition_table.to_sym} when basic_condition_attribs = #{basic_condition_attribs}\"\n conditions[condition_key] = basic_condition_attribs\n end\n # Always add the table to the list of joins and select (so we can get the data)\n\n elsif !params_val.nil?\n # Handle Master level attributes\n wheres[params_key] = params_val\n end\n end\n\n # No conditions were recognized. Exit now.\n return nil if wheres.empty? && !wheresalt.first\n\n logger.debug \"joins: #{joins}\"\n logger.debug \"Standard wheres: #{wheres}\"\n logger.debug \"Alt wheres: #{wheresalt}\"\n res = Master.select(selects).joins(joins).where(wheres).distinct\n res = res.where(wheresalt.first, wheresalt.last) if wheresalt.first\n\n res.default_sort\n end",
"def index\n #@website_details = WebsiteDetail.all\n\n @website_details = WebsiteDetail.search(params[:dateF], params[:agentF])\n \n end",
"def birthdaysearch\n end",
"def filter_params\n params.permit(:date_lte, :date_gte, :time_lte, :time_gte, :month_details)\n end",
"def date_filter options\n # date search\n if date_present?(options[\"date_from\"]) || date_present?(options[\"date_to\"])\n from, to = date_set(options[\"date_from\"], options[\"date_to\"])\n options[\"f\"] = [] if !options.key?(\"f\")\n options[\"f\"] << \"date|#{from}|#{to}\"\n end\n options.delete(\"date_from\")\n options.delete(\"date_to\")\n [options, from, to]\n end",
"def searchable_columns\n # Declare strings in this format: ModelName.column_name\n #@searchable_columns ||= ['Take.name', 'Movement_Group.name', 'SensorType.name', 'Mover.name', 'DataTrack.technician', 'DataTrack.recorded_on']\n @searchable_columns ||= ['Take.name', 'MovementGroup.name', 'Mover.name']\n end",
"def search_data\n merge = {\n station_name: weather_station.name,\n\n # http://apidock.com/rails/String/to_time\n reading_date: reading_date.to_time,\n }\n attributes.merge(merge)\n end",
"def search_params_user\n params.require(:search).permit(:handle, :first_name, :last_name, :email)\n end",
"def search\n conditions = Kokyaku.where(\"\\\"delFlg\\\" = ?\", 0)\n conditions = conditions.where(\"\\\"kokyakuId\\\" >= ?\", params[:kokyaku][:kokyakuIdFrom].to_i) if params[:kokyaku][:kokyakuIdFrom] != \"\"\n conditions = conditions.where(\"\\\"kokyakuId\\\" <= ?\", params[:kokyaku][:kokyakuIdTo].to_i) if params[:kokyaku][:kokyakuIdTo] != \"\"\n conditions = conditions.where(\"\\\"kokyakuNm1\\\" LIKE ?\", \"%\" + params[:kokyaku][:kokyakuNm1] + \"%\") if params[:kokyaku][:kokyakuNm1] != \"\"\n conditions = conditions.where(\"\\\"kokyakuNm2\\\" LIKE ?\", \"%\" + params[:kokyaku][:kokyakuNm2] + \"%\") if params[:kokyaku][:kokyakuNm2] != \"\"\n conditions = conditions.where(\"\\\"kokyakuNmKana1\\\" LIKE ?\", \"%\" + params[:kokyaku][:kokyakuNmKana1] + \"%\") if params[:kokyaku][:kokyakuNmKana1] != \"\"\n conditions = conditions.where(\"\\\"kokyakuNmKana2\\\" LIKE ?\", \"%\" + params[:kokyaku][:kokyakuNmKana2] + \"%\") if params[:kokyaku][:kokyakuNmKana2] != \"\"\n conditions = conditions.where(\"\\\"seibetsu\\\" = ?\", params[:kokyaku][:seibetsu]) if params[:kokyaku][:seibetsu] != \"\"\n\n # 生年月日は「元号」「年」「月」「日」を連結して比較する\n adapter = Rails.configuration.database_configuration[Rails.env]['adapter']\n logger.debug(adapter)\n if adapter == \"sqlite3\" then\n # for sqlite\n tanjoDtCondition = str_sql_concat(\"SUBSTR('0'||\\\"tanjoGengo\\\",-1,1)\", \"SUBSTR('00'||\\\"tanjoYear\\\",-2,2)\", \"SUBSTR('00'||\\\"tanjoMonth\\\",-2,2)\", \"SUBSTR('00'||\\\"tanjoDay\\\",-2,2)\")\n else\n # for mysql、postgres\n tanjoDtCondition = str_sql_concat(\"LPAD(CAST(\\\"tanjoGengo\\\" AS char), 1, '0') \", \" LPAD(CAST(\\\"tanjoYear\\\" AS char), 2, '0') \", \" LPAD(CAST(\\\"tanjoMonth\\\" AS char), 2, '0') \", \" LPAD(CAST(\\\"tanjoDay\\\" AS char), 2, '0')\")\n end\n\n if adapter == \"mysql2\" then\n # for mysql\n strIntegerType = \"SIGNED\"\n else\n # for sqlite、postgres\n strIntegerType = \"INTEGER\"\n end\n\n if params[:kokyaku][:tanjoGengoFrom].present? || params[:kokyaku][:tanjoYearFrom].present? || params[:kokyaku][:tanjoMonthFrom].present? || params[:kokyaku][:tanjoDayFrom].present?\n tanjoGengoFrom = \"0\"\n tanjoYearFrom = \"00\"\n tanjoMonthFrom = \"00\"\n tanjoDayFrom = \"00\"\n\n if params[:kokyaku][:tanjoGengoFrom].present?\n tanjoGengoFrom = format(\"%01d\", params[:kokyaku][:tanjoGengoFrom])\n end\n if params[:kokyaku][:tanjoYearFrom].present?\n tanjoYearFrom = format(\"%02d\", params[:kokyaku][:tanjoYearFrom])\n end\n if params[:kokyaku][:tanjoMonthFrom].present?\n tanjoMonthFrom = format(\"%02d\", params[:kokyaku][:tanjoMonthFrom])\n end\n if params[:kokyaku][:tanjoDayFrom].present?\n tanjoDayFrom = format(\"%02d\", params[:kokyaku][:tanjoDayFrom])\n end\n\n tanjoDtFrom = (tanjoGengoFrom.to_s + tanjoYearFrom.to_s + tanjoMonthFrom.to_s + tanjoDayFrom.to_s).to_i\n conditions = conditions.where(\"CAST(\" + tanjoDtCondition + \" AS \" + strIntegerType + \" ) >= ?\", tanjoDtFrom)\n end\n\n if params[:kokyaku][:tanjoGengoTo].present? || params[:kokyaku][:tanjoYearTo].present? || params[:kokyaku][:tanjoMonthTo].present? || params[:kokyaku][:tanjoDayTo].present?\n tanjoGengoTo = \"9\"\n tanjoYearTo = \"99\"\n tanjoMonthTo = \"99\"\n tanjoDayTo = \"99\"\n\n if params[:kokyaku][:tanjoGengoTo].present?\n tanjoGengoTo = format(\"%01d\", params[:kokyaku][:tanjoGengoTo])\n end\n if params[:kokyaku][:tanjoYearTo].present?\n tanjoYearTo = format(\"%02d\", params[:kokyaku][:tanjoYearTo])\n end\n if params[:kokyaku][:tanjoMonthTo].present?\n tanjoMonthTo = format(\"%02d\", params[:kokyaku][:tanjoMonthTo])\n end\n if params[:kokyaku][:tanjoDayTo].present?\n tanjoDayTo = format(\"%02d\", params[:kokyaku][:tanjoDayTo])\n end\n\n tanjoDtTo = (tanjoGengoTo.to_s + tanjoYearTo.to_s + tanjoMonthTo.to_s + tanjoDayTo.to_s).to_i\n conditions = conditions.where(\"CAST(\" + tanjoDtCondition + \" AS \" + strIntegerType + \" ) <= ?\", tanjoDtTo)\n end\n\n conditions = conditions.where(\"\\\"postNo\\\" LIKE ?\", params[:kokyaku][:postNo] + \"%\") if params[:kokyaku][:postNo] != \"\"\n conditions = conditions.where(\"address1 LIKE ?\", \"%\" + params[:kokyaku][:address1] + \"%\") if params[:kokyaku][:address1] != \"\"\n conditions = conditions.where(\"address2 LIKE ?\", \"%\" + params[:kokyaku][:address2] + \"%\") if params[:kokyaku][:address2] != \"\"\n conditions = conditions.where(\"tel1 LIKE ?\", params[:kokyaku][:tel1] + \"%\") if params[:kokyaku][:tel1] != \"\"\n conditions = conditions.where(\"tel2 LIKE ?\", params[:kokyaku][:tel2] + \"%\") if params[:kokyaku][:tel2] != \"\"\n conditions = conditions.where(\"fax LIKE ?\", params[:kokyaku][:fax] + \"%\") if params[:kokyaku][:fax] != \"\"\n conditions = conditions.where(str_sql_concat(\"COALESCE(sb1.\\\"shobyoNm\\\", '') \", \"COALESCE(sb2.\\\"shobyoNm\\\", '') \", \"COALESCE(sb3.\\\"shobyoNm\\\", '') \") + \" LIKE ?\", \"%\" + params[:kokyaku][:shobyoNm] + \"%\") if params[:kokyaku][:shobyoNm] != \"\"\n conditions = conditions.where(\"\\\"gakkoNm\\\" LIKE ?\", \"%\" + params[:kokyaku][:gakkoNm] + \"%\") if params[:kokyaku][:gakkoNm] != \"\"\n #logger.debug(conditions)\n\n\n # 検索に必要なSQL文を取得する\n select, joins = get_select_stmt\n\n records = conditions.count(:joins => joins)\n\n limit = params[:rows].to_i\n page = params[:page].to_i\n if records > 0\n n = records.quo(limit)\n total_pages = n.ceil\n else\n total_pages = 0\n end\n start = limit * page - limit;\n @kokyakus = conditions.find(\n :all,\n :select => select,\n :joins => joins,\n # :joins => \"LEFT OUTER JOIN shobyos shobyo2 ON shobyos.shobyoCd = kokyakus.shobyouCd2\",\n # :joins => \"LEFT OUTER JOIN shobyos shobyo3 ON shobyos.shobyoCd = kokyakus.shobyouCd3\",\n # :include => [:shobyo],\n :offset => start,\n :limit => limit,\n :order => \"\\\"kokyakuId\\\" DESC\")\n\n @responce = {\n total: total_pages.to_s,\n page: params[:page],\n records: records.to_s,\n rows: @kokyakus\n }\n #logger.debug(@responce)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @responce }\n end\n end",
"def build_conditions(params)\n\n conditions, joins = merge_conditions, []\n\n query_params = params.dup\n %w(action controller).each { |param| query_params.delete(param) }\n\n # Remove from params those with empty string.\n query_params.delete_if { |k, v| v.empty? }\n\n # If a search is performed.\n if query_params[:search]\n query = ActiveRecord::Base.connection.quote_string(query_params[:search].downcase)\n search = []\n typus_search_fields.each do |key, value|\n _query = case value\n when \"=\" then query\n when \"^\" then \"#{query}%\"\n when \"@\" then \"%#{query}%\"\n end\n search << \"#{key} LIKE '#{_query}'\"\n end\n conditions = merge_conditions(conditions, search.join(\" OR \"))\n end\n\n query_params.each do |key, value|\n\n filter_type = model_fields[key.to_sym] || model_relationships[key.to_sym]\n\n case filter_type\n when :boolean\n condition = { key => (value == 'true') ? true : false }\n conditions = merge_conditions(conditions, condition)\n when :datetime\n interval = case value\n when 'today' then Time.new.midnight..Time.new.midnight.tomorrow\n when 'last_few_days' then 3.days.ago.midnight..Time.new.midnight.tomorrow\n when 'last_7_days' then 6.days.ago.midnight..Time.new.midnight.tomorrow\n when 'last_30_days' then Time.new.midnight.prev_month..Time.new.midnight.tomorrow\n end\n condition = [\"#{key} BETWEEN ? AND ?\", interval.first.to_s(:db), interval.last.to_s(:db)]\n conditions = merge_conditions(conditions, condition)\n when :date\n if value.is_a?(Hash)\n date_format = Date::DATE_FORMATS[typus_date_format(key)]\n\n begin\n unless value[\"from\"].blank?\n date_from = Date.strptime(value[\"from\"], date_format)\n conditions = merge_conditions(conditions, [\"#{key} >= ?\", date_from])\n end\n\n unless value[\"to\"].blank?\n date_to = Date.strptime(value[\"to\"], date_format)\n conditions = merge_conditions(conditions, [\"#{key} <= ?\", date_to])\n end\n rescue\n end\n else\n # TODO: Improve and test filters.\n interval = case value\n when 'today' then nil\n when 'last_few_days' then 3.days.ago.to_date..Date.tomorrow\n when 'last_7_days' then 6.days.ago.midnight..Date.tomorrow\n when 'last_30_days' then (Date.today << 1)..Date.tomorrow\n end\n if interval\n condition = [\"#{key} BETWEEN ? AND ?\", interval.first, interval.last]\n elsif value == 'today'\n condition = [\"#{key} = ?\", Date.today]\n end\n conditions = merge_conditions(conditions, condition)\n end\n when :integer, :string\n condition = { key => value }\n conditions = merge_conditions(conditions, condition)\n when :has_and_belongs_to_many\n condition = { key => { :id => value } }\n conditions = merge_conditions(conditions, condition)\n joins << key.to_sym\n end\n\n end\n\n return conditions, joins\n\n end",
"def search_params\n params.permit(:name, :artist, :instruments, :players_lower, :players_upper, :date_lower, :date_upper, :has_media, :original)\n end",
"def index\n if params[:search].present? || params[:date_filter].present?\n # @ingoing = Document.search(\n # params[:search], \n # where: {\n # outgoing: false,\n # date: {\n # gte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').beginning_of_day, \n # lte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').end_of_day\n # } \n # }, \n # order: {created_at: :desc} )\n # @outgoing = Document.search(\n # params[:search], \n # where: {\n # outgoing: true,\n # date: {\n # gte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').beginning_of_day, \n # lte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').end_of_day\n # } \n # }, \n # order: {created_at: :desc} )\n\n search = params[:search].present? ? params[:search] : \"*\"\n where = {}\n\n # if params[:date_filter].present?\n # where[:date] = {\n # gte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').beginning_of_day,\n # lte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').end_of_day\n # }\n # end\n\n # @ingoing = Document.search(search, where.merge(outgoing: false))\n # @outgoing = Document.search(search, where.merge(outgoing: true))\n\n # search = params[:search].present? ? params[:search] : \"*\"\n # where = {misspellings: false}\n\n if params[:date_filter].present?\n where[:date] = {\n gte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').beginning_of_day,\n lte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').end_of_day\n }\n end\n\n @ingoing = Document.search( search, where: where.merge(:outgoing => false), order: {created_at: :desc}, misspellings: false )\n @outgoing = Document.search( search, where: where.merge(:outgoing => true), order: {created_at: :desc}, misspellings: false )\n\n else\n @documents = Document.where(archival: false)\n @ingoing = @documents.where(outgoing: false).order('created_at desc')\n @outgoing = @documents.where(outgoing: true).order('created_at desc')\n end\n\n respond_to do |format|\n format.html\n format.xlsx {\n render xlsx: \"index\", filename: \"documents_spreadsheet.xlsx\"\n }\n end\n end",
"def index\n\n start_date = DateTime.new(2015,01,1)\n end_date = DateTime.new(2015,02,28)\n if params[:search]\n @students = Student.index_search(params[:search]).order(\"last_name ASC\").paginate(:page => params[:page]).where(\"created_at between (?) and (?)\", start_date, end_date)\n else\n @students = Student.order(\"last_name ASC\").paginate(:page => params[:page]).where(\"created_at between (?) and (?)\", start_date, end_date)\n end\n # if params[:search]\n # @query = Student.solr_search do\n # fulltext params[:search]\n # end\n # @students = @query.results\n # else\n # @students = Student.all\n # @students = Student.paginate(:page => params[:page], :per_page => 4)\n # end\n end",
"def search_for(**search_by)\n search_by.keys.each do |key|\n raise \"Illegal search modifier: #{key}\" unless VALID_SEARCH_PARAMETERS.member?(key)\n end\n\n log.info \"[ACTION] Search with #{search_by.to_json}\"\n\n # Remove these 3 from search_by as they are used to next loop doesn't try to use them\n fill_in_if(:search_text, search_by.delete(:search_text))\n fill_in_if(:min_price, search_by.delete(:min_price))\n fill_in_if(:max_price, search_by.delete(:max_price))\n\n search_by.each do |locate_by, value|\n set_checkbox(locate_by, value)\n end\n\n click_search\n\n # Return WebPage object\n self.class.send(:given)\n end",
"def set_search_params \n # TODO: figure out how to do this without having to change params to symbols\n symbolic_params = {}\n search_params.each_pair do |key, value|\n symbolic_params.merge!(key.to_sym => value)\n end\n @search_params = symbolic_params\n end",
"def people_date_params\n params.fetch(:people_date, {})\n end",
"def to_search\n self.class.properties.map do |name, opts|\n next unless opts\n val = instance_variable_get( \"@#{ name }\" )\n next unless val\n val = val.strftime \"%Y-%m-%dT%H:%M:%S\" if val.respond_to? :strftime\n case opts[:search]\n when :prefix\n \"#{ name }:\" + val.to_s\n when :fulltext\n val.to_s\n end\n end.compact.join \"\\n\"\n end",
"def search_params\n params.require(:search).permit(:ticker, :year, :filing )\n end",
"def search_params\n params.require(:search).permit(:searchType, :fullTextSearch, :flightNumber, :pic, :sic, :airfield, :revenue, :memberName, :dateStart, :dateEnd, :prepMin, :prepMax, :caterMin, :caterMax, :depMin, :depMax, :flightMin, :flightMax, :arrMin, :arrMax, :maintMin, :maintMax, :catering, :maint, :createdBy, :hasComments, :save_search, :save_search_name, :overallmin, :overallmax, :user_id)\n end",
"def fetch_custom_search_params; end",
"def index\n if params[:start_date] and params[:end_date]\n start_date = Chronic.parse(params[:start_date]).try(:to_date)\n end_date = Chronic.parse(params[:end_date]).try(:to_date)\n @foos = Foo.where(foo_date: start_date..end_date)\n else\n @foos = Foo.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foos }\n end\n end",
"def search_params\n params.require(:search).permit(:city, :Date, :Type)\n end",
"def to_search_result\n row = self.attributes \n row.delete(\"order_id\") \n row[\"name\"].capitalize! if !row[\"name\"].nil?\n row[\"date_in\"] = OrderEntity.format_pretty_date(self.attributes[\"date_in\"])\n row[\"date_out\"] = OrderEntity.format_pretty_date(self.attributes[\"date_out\"]) \n row\n end",
"def search\n conditions = KonyuRireki.where(\"konyu_rirekis.\\\"delFlg\\\" = ?\", 0)\n conditions = add_condition_int(conditions, \"konyu_rirekis.\\\"kokyakuId\\\"\", :kokyakuIdFrom, :kokyakuIdTo)\n conditions = add_condition_int(conditions, \"konyu_rirekis.\\\"hokenShubetsuCd1\\\"\", :hokenShubetsuCd1)\n conditions = add_condition_int(conditions, \"konyu_rirekis.\\\"hokenShubetsuCd2\\\"\", :hokenShubetsuCd2)\n conditions = add_condition_date(conditions, \"\\\"juchuDt\\\"\", :juchuDtFrom, :juchuDtTo)\n conditions = add_condition_name(conditions, \"byoins.\\\"byoinNm\\\"\", :byoinNm)\n conditions = add_condition_date(conditions, \"\\\"kariAwaseDt\\\"\", :kariAwaseDtFrom, :kariAwaseDtTo)\n conditions = add_condition_name(conditions, \"kokyakus.\\\"kokyakuNm1\\\"\", :kokyakuNm1)\n conditions = add_condition_name(conditions, \"kokyakus.\\\"kokyakuNm2\\\"\", :kokyakuNm2)\n conditions = add_condition_name(conditions, \"konyu_rirekis.\\\"shohinNm\\\"\", :shohinNm)\n conditions = add_condition_date(conditions, \"\\\"nohinDt\\\"\", :nohinDtFrom, :nohinDtTo)\n conditions = add_condition_name(conditions, \"kokyakus.\\\"kokyakuNmKana1\\\"\", :kokyakuNmKana1)\n conditions = add_condition_name(conditions, \"kokyakus.\\\"kokyakuNmKana2\\\"\", :kokyakuNmKana2)\n conditions = add_condition_userNm(conditions, \"ust\", :uketsukeSesakuTantoNm)\n conditions = add_condition_date(conditions, \"\\\"kofuDt\\\"\", :kofuDtFrom, :kofuDtTo)\n conditions = add_condition_str(conditions, \"konyu_rirekis.\\\"shubetsuKn\\\"\", :shubetsuKn)\n conditions = add_condition_userNm(conditions, \"kat\", :kariAwaseTantoNm)\n conditions = add_condition_date(conditions, \"\\\"nyukinDt\\\"\", :nyukinDtFrom, :nyukinDtTo)\n conditions = add_condition_name(conditions, \"seihins.\\\"hinmeiNm\\\"\", :hinmeiNm)\n conditions = add_condition_userNm(conditions, \"nt\", :nohinTantoNm)\n conditions = add_condition_date(conditions, \"\\\"oshiinDt\\\"\", :oshiinDtFrom, :oshiinDtTo)\n conditions = add_condition_userNm(conditions, \"mt\", :mitsumoriTantoEigyoNm)\n conditions = add_condition_date(conditions, \"\\\"kanryoDt\\\"\", :kanryoDtFrom, :kanryoDtTo)\n conditions = add_condition_date(conditions, \"\\\"mitsumoriDt\\\"\", :mitsumoriDtFrom, :mitsumoriDtTo)\n\n # 検索に必要なSQL文を取得する\n select, joins = get_select_stmt(:select)\n\n records = conditions.count(:joins => joins)\n limit = params[:rows].to_i\n page = params[:page].to_i\n if records > 0\n n = records.quo(limit)\n total_pages = n.ceil\n else\n total_pages = 0\n end\n start = limit * page - limit;\n\n @konyu_rirekis = conditions.find(\n :all,\n :select => select,\n :joins => joins,\n :offset => start,\n :limit => limit,\n :order => \"konyu_rirekis.\\\"kokyakuId\\\" ASC\")\n\n @responce = {\n total: total_pages.to_s,\n page: params[:page],\n records: records.to_s,\n rows: @konyu_rirekis\n }\n logger.debug(@responce)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @responce }\n end\n end",
"def appctrl_dates_from_search( default_start, default_end )\n a = appctrl_date_from_params( :search_range_start ) || default_start\n b = appctrl_date_from_params( :search_range_end ) || default_end\n\n a, b = b, a if ( a > b )\n\n return [ a, b ]\n end",
"def fullsearch\n if params[:isbn]\n @books = Book.where(:ISBN => params[:isbn])\n elsif params[:title]\n @books = Book.where(\"Title LIKE :title1\", { :title1 => \"#{params[:title]}%\"})\n elsif params[:author]\n @books = Book.where(\"Authors LIKE :author1\", { :author1 => \"#{params[:author]}%\"})\n elsif params[:description]\n @books = Book.where(\"Description LIKE :description1\", { :description1 => \"#{params[:description]}%\"})\n else\n @books = Book.all\n end\n end",
"def method_missing(method_id, *arguments)\n if match = /find_(all_by|by)_([_a-zA-Z]\\w*)/.match(method_id.to_s)\n finder = determine_finder(match)\n\n facets = extract_attribute_names_from_match(match)\n super unless all_attributes_exists?(facets)\n\n #Overrride facets to use appropriate attribute name for current locale\n facets.collect! {|attr_name| respond_to?(:globalize_facets) && globalize_facets.include?(attr_name.intern) ? localized_facet(attr_name) : attr_name}\n\n attributes = construct_attributes_from_arguments(facets, arguments)\n\n case extra_options = arguments[facets.size]\n when nil\n options = { :conditions => attributes }\n set_readonly_option!(options)\n ActiveSupport::Deprecation.silence { send(finder, options) }\n\n when Hash\n finder_options = extra_options.merge(:conditions => attributes)\n validate_find_options(finder_options)\n set_readonly_option!(finder_options)\n\n if extra_options[:conditions]\n with_scope(:find => { :conditions => extra_options[:conditions] }) do\n ActiveSupport::Deprecation.silence { send(finder, finder_options) }\n end\n else\n ActiveSupport::Deprecation.silence { send(finder, finder_options) }\n end\n\n else\n raise ArgumentError, \"Unrecognized arguments for #{method_id}: #{extra_options.inspect}\"\n end\n elsif match = /find_or_(initialize|create)_by_([_a-zA-Z]\\w*)/.match(method_id.to_s)\n instantiator = determine_instantiator(match)\n facets = extract_attribute_names_from_match(match)\n super unless all_attributes_exists?(facets)\n\n if arguments[0].is_a?(Hash)\n attributes = arguments[0].with_indifferent_access\n find_attributes = attributes.slice(*facets)\n else\n find_attributes = attributes = construct_attributes_from_arguments(facets, arguments)\n end\n options = { :conditions => find_attributes }\n set_readonly_option!(options)\n\n find_initial(options) || send(instantiator, attributes)\n else\n super\n end\n end",
"def index\n delocalize_dates([:created_at_greater_than_or_equal_to, :created_at_less_than_or_equal_to]) if params[:search]\n @payments = do_index(Payment, params)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @payments }\n end\n end",
"def restrict_date_range( objects )\n # set start_date to either passed param, or beginning of time\n start_date = params[:start_date].blank? ? Date.new(0) : Date.strptime(params[:start_date], \"%Y-%m-%d\")\n # set end_date to either passed param or now\n end_date = params[:end_date].blank? ? Date.today : Date.strptime(params[:end_date], \"%Y-%m-%d\")\n\n filtered = []\n objects.each do |obj|\n # apperantly things can have nil created_at\n if obj.created_at.blank?\n if params[:start_date].blank? && params[:end_date].blank?\n filtered += [obj]\n end\n elsif start_date <= obj.created_at.to_date && end_date >= obj.created_at.to_date\n filtered += [obj]\n end\n end\n return filtered\n end",
"def restrict_date_range( objects )\n # set start_date to either passed param, or beginning of time\n start_date = params[:start_date].blank? ? Date.new(0) : Date.strptime(params[:start_date], \"%Y-%m-%d\")\n # set end_date to either passed param or now\n end_date = params[:end_date].blank? ? Date.today : Date.strptime(params[:end_date], \"%Y-%m-%d\")\n\n filtered = []\n objects.each do |obj|\n # apperantly things can have nil created_at\n if obj.created_at.blank?\n if params[:start_date].blank? && params[:end_date].blank?\n filtered += [obj]\n end\n elsif start_date <= obj.created_at.to_date && end_date >= obj.created_at.to_date\n filtered += [obj]\n end\n end\n return filtered\n end",
"def restrict_date_range( objects )\n # set start_date to either passed param, or beginning of time\n start_date = params[:start_date].blank? ? Date.new(0) : Date.strptime(params[:start_date], \"%Y-%m-%d\")\n # set end_date to either passed param or now\n end_date = params[:end_date].blank? ? Date.today : Date.strptime(params[:end_date], \"%Y-%m-%d\")\n\n filtered = []\n objects.each do |obj|\n # apperantly things can have nil created_at\n if obj.created_at.blank?\n if params[:start_date].blank? && params[:end_date].blank?\n filtered += [obj]\n end\n elsif start_date <= obj.created_at.to_date && end_date >= obj.created_at.to_date\n filtered += [obj]\n end\n end\n return filtered\n end",
"def date_set(date_from, date_to)\n # if the first parameter is empty, default to using second date instead\n date_from = date_overwrite(date_from, date_to)\n date_to = date_overwrite(date_to, date_from)\n\n # after date potentially duplicated above, use first/last entry years\n # and first/last day of year to cover missing year, month, and day\n date_from = date_default(date_from, [DATE_FIRST[0], \"01\", \"01\"])\n date_to = date_default(date_to, [DATE_LAST[0], \"12\", \"31\"])\n\n date_from = date_format(date_from, default_year: DATE_FIRST[0].to_i)\n date_to = date_format(date_to, default_year: DATE_LAST[0].to_i)\n\n # Set parameters so form populated with calculated dates\n params[:date_from] = date_from.split(\"-\")\n params[:date_to] = date_to.split(\"-\")\n\n [date_from, date_to]\n end",
"def index\n if params[:start_date] || params[:end_date]\n start_date = Date.civil(params[:start_date][:year].to_i, params[:start_date][:month].to_i, params[:start_date][:day].to_i)\n end_date = Date.civil(params[:end_date][:year].to_i, params[:end_date][:month].to_i, params[:end_date][:day].to_i)\n end\n if params[:search] || params[:status] || params[:roles] || params[:company_name] ||params[:start_date] || params[:end_date]\n @products = Product.all\n .joins(:provider)\n .order(\"updated_at DESC\")\n .where(['name LIKE ?', \"%#{params[:search]}%\"])\n .where(['products.status LIKE ?', \"%#{params[:status]}%\"])\n .where(['company_name LIKE ?', \"%#{params[:company_name]}%\"])\n .where(\"products.updated_at >= :start_date AND products.updated_at <= :end_date\",{start_date: start_date, end_date: end_date})\n .paginate page: params[:page], per_page: 12\n else\n @products = Product.order(\"updated_at DESC\").paginate page: params[:page], per_page: 12\n end \n end",
"def process_attributes(attributes = nil)\n return attributes if attributes.blank?\n multi_parameter_attributes = {}\n new_attributes = {}\n attributes.each_pair do |key, value|\n if key.match(DATE_KEY_REGEX)\n match = key.to_s.match(DATE_KEY_REGEX)\n found_key = match[1]\n index = match[2].to_i\n (multi_parameter_attributes[found_key] ||= {})[index] = value.empty? ? nil : value.send(\"to_#{$3}\")\n else\n new_attributes[key] = value\n end\n end\n\n multi_parameter_attributes.empty? ? new_attributes : process_multiparameter_attributes(multi_parameter_attributes, new_attributes)\n end",
"def index\n @full_name = params[:full_name] || \"\"\n\n if @full_name != \"\"\n @users = User.all.where(\"lower(first_name) like lower(?)\",\"%#{@full_name}%\").or(User.where(\"lower(last_name) like lower(?)\",\"%#{@full_name}%\")).or(User.where(\"lower(email) like lower(?)\",\"%#{@full_name}%\")).paginate(page: params[:page], per_page: 30).order('id desc')\n else\n @users = User.all.paginate(page: params[:page], per_page: 30).order('id desc')\n end\n end",
"def search_params\n params.require(:search).permit(:ris)\n end",
"def search(params = {})\n\n mapper = lambda do |val|\n if val.class == Date || val.class == DateTime || val.class == Time\n val.strftime('%Y-%m-%dT%H:%M:%S')\n elsif val.class == Channel\n val.name\n elsif val.class == TrueClass\n '1'\n elsif val.class == FalseClass\n '0'\n else\n val.to_s\n end\n end\n\n new_params = params.map do |key, val|\n if val.class == Array\n [ key, val.map(&mapper) ]\n else\n [ key, mapper.call(val) ]\n end\n end\n\n data = data_for(:search_results, Hash[new_params]).merge({\n 'query' => params\n })\n\n build :search_results, :using => data\n end",
"def attr_reader(*attrs)\n attrs.each do |attr|\n define_attribute_method(attr)\n define_predicate_method(attr)\n end\n end",
"def search(params)\n invalid_keys = params.keys - SEARCH_KEYS\n raise InvalidRequest.new \"Invalid keys: #{invalid_keys.join(\", \")}\" unless invalid_keys.empty?\n\n # Convert arrays into CSVs\n [:keywords, :keywords_exclude].each do |key|\n params[key] = params[key].join(\",\") unless params[key].nil?\n end\n\n # Convert any Time/DateTime objects to UNIX time integers\n params[:updated_min] = params[:updated_min].to_i unless params[:updated_min].nil?\n\n process_location! params\n\n request :search_listings, params\n end",
"def super_search\n @browse_state.attributes=(params)\n @search_filter1 = @browse_state.make_search_filter\n \n ## Condition - when to include or exlude romance from the search list.\n if params[:search_filter].nil? || (!params[:search_filter].nil? && params[:search_filter][:romance] == \"19\") \n cond = params[:search_filter][:romance].to_i if !params[:search_filter].nil? && !params[:search_filter][:romance].nil?\n cond = 19 if !params[:search_filter].nil? && params[:search_filter][:romance].nil?\n cond = 19 if params[:search_filter].nil?\n else\n cond = 0\n end\n \n ## Month validation as it should not be greater than 12.\n if !params[:search_filter].nil? && ( !params[:search_filter][:start_time].nil? || !params[:search_filter][:end_time].nil?) \n if params[:search_filter][:start_time] && params[:search_filter][:start_time] != \"MM/DD/YYYY\"\n s = params[:search_filter][:start_time].split('/')\n if s[0].to_i > 12\n params[:search_filter][:start_time] = Time.now.utc\n end\n end\n \n if params[:search_filter][:end_time] && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n s = params[:search_filter][:end_time].split('/')\n if s[0].to_i > 12\n params[:search_filter][:end_time] = Time.now.utc\n end\n end\n end\n \n ## Condition for getting activity id range.\n if !params[:search_filter].nil? && !params[:search_filter][:purpose_id].blank? \n p_id = params[:search_filter][:purpose_id].to_i\n elsif !params[:search_filter].nil? && params[:search_filter][:purpose_id].blank?\n p_id = 1..21\n end \n \n ## Condition for getting purpose id range.\n if !params[:search_filter].nil? && !params[:search_filter][:activity_id].blank? \n a_id = params[:search_filter][:activity_id].to_i\n elsif !params[:search_filter].nil? && params[:search_filter][:activity_id].blank?\n a_id = 1..14\n end \n \n ## Condition for getting zip codes in the given radius.\n if params[:checked_locat] == \"1\"\n if params[:search_filter][:city] == \"Atlanta\" or params[:search_filter][:city] == \"atlanta\" or params[:search_filter][:city] == \"ATLANTA\"\n st = \"GA\"\n elsif params[:search_filter][:city] == \"Boulder\" or params[:search_filter][:city] == \"boulder\" or params[:search_filter][:city] == \"BOULDER\"\n st = \"CO\"\n elsif params[:search_filter][:city] == \"San Diego\" or params[:search_filter][:city] == \"san diego\" or params[:search_filter][:city] == \"SAN DIEGO\"\n st = \"CA\"\n elsif params[:search_filter][:city] == \"Dallas\" or params[:search_filter][:city] == \"dallas\" or params[:search_filter][:city] == \"DALLAS\"\n st = \"TX\"\n elsif params[:search_filter][:city] == \"Houston\" or params[:search_filter][:city] == \"houston\" or params[:search_filter][:city] == \"HOUSTON\"\n st = \"TX\"\n elsif params[:search_filter][:city] == \"Miami\" or params[:search_filter][:city] == \"miami\" or params[:search_filter][:city] == \"MIAMI\"\n st = \"FL\"\n elsif params[:search_filter][:city] == \"San Francisco\" or params[:search_filter][:city] == \"san francisco\" or params[:search_filter][:city] == \"SAN FRANCISCO\"\n st = \"CA\"\n elsif params[:search_filter][:city] == \"Portland\" or params[:search_filter][:city] == \"portland\" or params[:search_filter][:city] == \"PORTLAND\"\n st = \"OR\"\n elsif params[:search_filter][:city] == \"San Jose\" or params[:search_filter][:city] == \"san jose\" or params[:search_filter][:city] == \"SAN JOSE\"\n st = \"CA\"\n end\n \n if !params[:search_filter].nil? && (!params[:search_filter][:zip].blank? || !params[:search_filter][:city].blank?)\n if st != \"\"\n r = ZipCode.find(:first,:select => \"latitude,longitude\",:conditions => [\"zip = ? or (city = '#{params[:search_filter][:city]}' and state = '#{st}')\",params[:search_filter][:zip]])\n else\n r = ZipCode.find(:first,:select => \"latitude,longitude\",:conditions => [\"zip = ? or city = ?\",params[:search_filter][:zip],params[:search_filter][:city]])\n end\n rad = params[:search_filter][:radius].to_i\n if !r.nil?\n sql = \"SELECT dest.id,dest.zip,3956 * 2 * ASIN(SQRT( POWER(SIN((orig.latitude - dest.latitude) * pi()/180 / 2), 2) + COS(orig.latitude * pi()/180) * COS(dest.latitude * pi()/180) * POWER(SIN((orig.longitude -dest.longitude) * pi()/180 / 2), 2) )) as distance FROM zip_codes dest, zip_codes orig WHERE dest.id = orig.id and dest.longitude between #{r.longitude}-#{rad}/abs(cos(radians(#{r.latitude}))*69) and #{r.longitude}+#{rad}/abs(cos(radians(#{r.latitude}))*69) and dest.latitude between #{r.latitude}-(#{rad}/69) and #{r.latitude}+(#{rad}/69) LIMIT 4096\"\n z = ZipCode.find_by_sql(sql)\n zcids = z.collect(&:id)\n end\n else\n zcids = \"\"\n end\n end\n \n zcids = \"\" if r.nil?\n \n params[:search_filter] ||= params[\"amp;search_filter\"] # Hack to stop a malformed feed url from causing an exception - dave\n if params[:search_filter].nil?\n @search_filter = SearchFilter.new\n else\n @search_filter = SearchFilter.new(params[:search_filter])\n end\n \n if !params[:search_filter].nil?\n if params[:search_filter][:start_time] == \"MM/DD/YYYY\" && params[:search_filter][:end_time] == \"MM/DD/YYYY\"\n @search_filter.start_time = Time.now.utc\n elsif params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] == \"MM/DD/YYYY\"\n @search_filter.start_time = params[:search_filter][:start_time].to_date.to_time\n elsif params[:search_filter][:start_time] == \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n @search_filter.start_time = params[:search_filter][:end_time].to_date.to_time\n @search_filter.end_time = nil\n elsif params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n if params[:search_filter][:start_time].nil? && !params[:search_filter][:start_date].nil?\n params[:search_filter][:start_time] = params[:search_filter][:start_date]\n end\n @search_filter.start_time = params[:search_filter][:start_time].to_date.to_time if !params[:format] && !params[:search_filter][:start_time].nil?\n @search_filter.start_time = Time.now.utc if !params[:format] && params[:search_filter][:start_time].nil?\n @search_filter.end_time = params[:search_filter][:end_time].to_date.to_time if !params[:search_filter][:end_time].nil? \n end\n end\n \n if !params[:search_filter].nil?\n location = params[:search_filter][:location] ? params[:search_filter][:location] : ''\n terms = params[:search_filter][:terms] ? params[:search_filter][:terms] : ''\n person = params[:search_filter][:person] ? params[:search_filter][:person] : ''\n state = params[:search_filter][:state] ? params[:search_filter][:state] : ''\n country = params[:search_filter][:country] ? params[:search_filter][:country] : ''\n airport_id = params[:search_filter][:airport_id] ? params[:search_filter][:airport_id] : ''\n param_string = \"posted #{country} #{state} #{location} #{terms} #{person} #{airport_id}\" if !private_mw?\n param_string = \"posted #{state} #{location} #{terms} #{person} #{airport_id}\" if private_mw?\n if params[:search_filter][:virtual_f] == \"0\" && params[:checked_locat] == \"1\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => @search_filter.start_time..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:virtual_f => \"no_flag\",:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] == \"MM/DD/YYYY\" && params[:search_filter][:end_time] == \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:start_time].to_date.to_time.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:virtual_f => \"no_flag\",:university_name => @univ_account}, :order => :id, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] == \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => @search_filter.start_time..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:virtual_f => \"no_flag\",:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] == \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:end_time].to_date.to_time,:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:virtual_f => \"no_flag\",:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n elsif params[:search_filter][:virtual_f] == \"v_flag\" && (params[:checked_locat] == \"0\" || params[:checked_locat] == \"\")\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => @search_filter.start_time..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id},:conditions => {:virtual_f => \"v_flag\",:university_name => @univ_account}, :without => {:purpose_id => cond}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 \n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:start_time].to_date.to_time.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id}, :without => {:purpose_id => cond},:conditions => {:virtual_f => \"v_flag\",:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] == \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => @search_filter.start_time..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id},:conditions => {:virtual_f => \"v_flag\",:university_name => @univ_account}, :without => {:purpose_id => cond}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] == \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:end_time].to_date.to_time,:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id}, :without => {:purpose_id => cond},:conditions => {:virtual_f => \"v_flag\",:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n else\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => @search_filter.start_time..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :id, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] == \"MM/DD/YYYY\" && params[:search_filter][:end_time] == \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:start_time].to_date.to_time.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] == \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => @search_filter.start_time..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] == \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\"\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:end_time].to_date.to_time,:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\" && !params[:search_filter][:start_time].nil? && !params[:search_filter][:end_time].nil? && !params[:format]\n\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:start_time].to_date.to_time.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\" && !params[:search_filter][:start_time].nil? && params[:search_filter][:end_time].nil? && !params[:format]\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_time].to_date.to_time..params[:search_filter][:start_time].to_date.to_time.advance(:days => 1000),:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\" && !params[:search_filter][:start_time].nil? && params[:search_filter][:end_time].nil? && !params[:format]\n @invitations = Invitation.search \"#{param_string}\",:with => {:start_date => params[:search_filter][:start_date].to_date.to_time..params[:search_filter][:start_date].to_date.to_time,:is_public => 1,:deactivated => 0,:purpose_id => p_id,:activity_id => a_id,:zip_code_id => zcids}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 if params[:search_filter][:start_time] != \"MM/DD/YYYY\" && params[:search_filter][:end_time] != \"MM/DD/YYYY\" && params[:format]\n end\n else\n @search_filter.start_time = Time.now.utc\n @invitations = Invitation.search \"posted\",:with => {:start_date => @search_filter.start_time..Time.now.utc.advance(:days => 1000),:is_public => 1,:deactivated => 0}, :without => {:purpose_id => cond},:conditions => {:university_name => @univ_account}, :order => :start_date, :sort_mode => :desc, :page => params[:page], :per_page => 10 \n end\n @feed_params = @search_filter.to_rss_params \n if params[:format]\n handle_rss()\n else\n render :action => \"new_super_search\", :layout => 'new_super_search' unless check_render_facebook('super_search')\n end\n end",
"def process_attrs_before_write_params(patient_params)\n if patient_params[:date_of_birth].present?\n patient_params[:date_of_birth] = patient_params[:date_of_birth].to_s\n end\n end",
"def set_matters_revenue_conditions(conditions_hash)\n search = \"company_id = :company_id \"\n if params[:date_selected]\n conditions_hash[:start_date] = params[:date_start].to_time\n conditions_hash[:end_date] = params[:date_end].to_time + (23.9*60*60)\n end\n search += \" AND matter_type_id = :matter_type_id\" unless params[:report][:summarize_by].blank?\n search += \" AND created_at Between :date_start AND :date_end \" if params[:date_selected].eql?(\"1\")\n\n search\n end"
] | [
"0.6207823",
"0.591569",
"0.58887076",
"0.584572",
"0.5769055",
"0.5568031",
"0.55450124",
"0.5537399",
"0.5518184",
"0.548063",
"0.54466534",
"0.54076564",
"0.53269756",
"0.53159285",
"0.5294487",
"0.527706",
"0.5255387",
"0.5232297",
"0.5230948",
"0.5229895",
"0.52182484",
"0.5207536",
"0.5178264",
"0.5176327",
"0.5173425",
"0.5158829",
"0.51569486",
"0.51554465",
"0.5124063",
"0.5103361",
"0.50980103",
"0.50965405",
"0.5094479",
"0.509313",
"0.5069074",
"0.503349",
"0.5025347",
"0.501637",
"0.50087935",
"0.5007294",
"0.4993217",
"0.49797574",
"0.49782026",
"0.49764642",
"0.49719644",
"0.49307722",
"0.4923935",
"0.49212706",
"0.49122784",
"0.49088246",
"0.48988602",
"0.4898237",
"0.4884943",
"0.48496023",
"0.4849546",
"0.48369792",
"0.48333085",
"0.48244393",
"0.48160133",
"0.48066255",
"0.47957054",
"0.4790364",
"0.47861797",
"0.47854984",
"0.47854465",
"0.47794876",
"0.47793755",
"0.47583348",
"0.47566307",
"0.47475865",
"0.47437993",
"0.47427312",
"0.47401363",
"0.4737433",
"0.47370028",
"0.47348267",
"0.47347194",
"0.47331256",
"0.47045314",
"0.4702786",
"0.46967223",
"0.4692805",
"0.46925446",
"0.468611",
"0.46860784",
"0.46809742",
"0.46778226",
"0.46778226",
"0.46778226",
"0.4674586",
"0.46743563",
"0.46730852",
"0.46727878",
"0.46700257",
"0.46630186",
"0.46566865",
"0.46555495",
"0.4655356",
"0.46552864",
"0.46517596"
] | 0.8257089 | 0 |
Time complexity: O(n) => Because it loops 1 time in 'reverse' method depending on the input size, and it loops 1 time in 'reverse_sentence' method. Since a constant drops, it becomes O(n) Space complexity: O(1) => Because it does not create any extra array. | def reverse!(string, i, j) # " I can do this! "
while i < j
string[i], string[j] = string[j], string[i]
# # same as above
# temp = string[i]
# string[i] = string[j]
# string[j] = temp
i += 1
j -= 1
end
return string # " !siht od nac I "
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverse_sentence(sentence)\n array = sentence.split(' ')\n reverse_array = []\n idx = array.size\n\n loop do\n idx -= 1\n break if idx < 0\n reverse_array << array[idx]\n end\n\n reverse_array.join(' ')\nend",
"def reverse_words(sentence)\n arr_of_words = split_sentence(sentence)\n arr_of_reversed_words = reverse_array(arr_of_words)\n join_array(arr_of_reversed_words)\nend",
"def reverse_sentence(sentence)\n sentence_array = sentence.split(\" \")\n reverse_array = []\n iterator = sentence_array.length\n while iterator > 0\n reverse_array << sentence_array[(iterator - 1)]\n iterator -= 1\n end\n reverse_array.join(' ')\nend",
"def reverse_sentence(sentence)\n s_array = sentence.split\n r_array = []\n s_array.length.times do\n r_array << s_array.pop\n end\n r_array.join(' ')\nend",
"def reverse_sentence(my_sentence)\n return nil if my_sentence.nil? \n new_arr = []\n holder = []\n i = 0\n while i < my_sentence.length\n\n if my_sentence[i] == \" \" \n new_arr << holder.join \n new_arr << \" \" \n holder = [] \n else\n holder << my_sentence[i] \n end\n i += 1\n end \n\n new_arr << holder.join \n\n # creating the reversed string from the above array\n k = new_arr.length - 1\n i = 0\n while k >= 0\n \n if i < k\n temp = new_arr[i] # temporarly save words in the first half of the array \n new_arr[i] = new_arr[k] # swap each words in the array\n new_arr[k] = temp\n i += 1\n end\n k -= 1\n end\n \n i = 0\n new_sentence = new_arr.join\n\n while i < new_sentence.length\n my_sentence[i] = new_sentence[i] \n i += 1\n end\n return my_sentence\nend",
"def reverse_sentence(sentence)\n words = sentence.split(' ')\n reversed_words = []\n\n (words.size).downto(1) do |i|\n reversed_words << words[i-1]\n end\n\n reversed_words.join(' ')\nend",
"def reverse(sentence)\n initial = 0 \n last = sentence.length - 1\n \n while initial < last\n memo = sentence[initial]\n sentence[initial] = sentence[last]\n \n sentence[last] = memo\n \n initial += 1\n last -= 1\n \n return sentence \n end\nend",
"def reverse_sentence(my_sentence)\n return nil if my_sentence.nil?\n\n array = my_sentence.split(/(\\S+)|(\\W)/)\n\n first_index = 0\n last_index = (array.length) - 1\n \n while first_index < last_index\n temp = array[first_index]\n array[first_index] = array[last_index]\n array[last_index] = temp\n first_index += 1\n last_index -= 1\n end\n\n array = array.join(\"\")\n\n array.length.times do |n|\n my_sentence[n] = array[n]\n end\n return my_sentence \nend",
"def reverse_sentence(my_sentence)\n return nil if my_sentence.nil?\n new_arr = []\n holder = []\n i = 0\n while i < my_sentence.length\n if my_sentence[i] == \" \"\n new_arr << holder.join # [\"Hello\"]\n new_arr << \" \" # [\"Hello\", \" \"]\n holder = [] # empty array for the next word\n else\n holder << my_sentence[i]\n end\n i += 1\n end\n new_arr << holder.join # [\"Hello\", \" \", \"world\"]\n # creating the reversed string from the above array\n k = new_arr.length - 1\n i = 0\n while k >= 0\n if i < k\n temp = new_arr[i] # temporarly save words in the first half of the array\n new_arr[i] = new_arr[k] # swap each words in the array\n new_arr[k] = temp\n i += 1\n end\n k -= 1\n end\n # [\"world\", \" \", \"Hello\"]\n i = 0\n new_sentence = new_arr.join\n while i < new_sentence.length\n my_sentence[i] = new_sentence[i] #my_sentence at index 0 is replaced by new_sentence at index 0\n i += 1\n end\n return my_sentence\nend",
"def reverse_sentence(my_sentence)\r\n reverse_words(my_sentence)\r\n string_reverse(my_sentence)\r\nend",
"def reverse_sentence(my_sentence)\n # raise NotImplementedError\n return my_sentence if my_sentence.nil? || my_sentence.empty?\n\n array = my_sentence.split(/\\s(\\s$)?/)\n\n reverse_array = []\n i = array.length - 1\n\n while i >= 0\n reverse_array << array[i]\n i -= 1\n end\n\n joined_sentence = reverse_array.join(\" \")\n j = 0\n while j < joined_sentence.length\n my_sentence[j] = joined_sentence[j]\n j += 1\n end\n\nend",
"def reverse_sentence(my_sentence)\n if my_sentence.nil?\n return nil\n end\n \n word_array = my_sentence.split(/\\.?\\s+/)\n \n i = 0\n end_position = word_array.length - 1\n \n while i <= end_position\n temp = word_array[i]\n word_array[i] = word_array[end_position]\n word_array[end_position] = temp\n i += 1\n end_position -= 1 \n end \n \n result = word_array.join(' ')\n word_array.join(' ').length.times do |x|\n my_sentence[x] = result[x]\n end\n \n return my_sentence\nend",
"def reverse_sentence(my_sentence)\n if my_sentence != nil\n # Creates array of words and spaces\n words_array = words(my_sentence)\n\n # Revereses the order of the words\n length = words_array.length\n i = 0\n j = length - 1\n (length / 2).times do\n # selects word at smallest index that has not been swapped\n word_1 = words_array[i]\n # selects words at largest index that has not been swapped\n word_2 = words_array[j]\n \n words_array[i] = word_2\n words_array[j] = word_1\n \n i += 1\n j -= 1\n end\n \n reverse = words_array.join\n\n # Overrides original string with order of characters in reverse\n i = 0\n my_sentence.length.times do\n my_sentence[i] = reverse[i]\n i += 1\n end\n end\n\n return my_sentence\nend",
"def reverse_sentence(my_sentence)\n return false if my_sentence == nil || my_sentence.length == 0\n word_start = 0\n word_end = 0\n i = 0\n new_sentence = \"\"\n \n while i < my_sentence.length\n while i < my_sentence.length && my_sentence[i] == \" \"\n new_sentence = my_sentence[i] + new_sentence\n i += 1\n end\n word_start = i\n\n while i < my_sentence.length && my_sentence[i] != \" \"\n i += 1\n end\n word_end = i - 1\n\n while word_start <= word_end\n new_sentence = my_sentence[word_end] + new_sentence\n word_end -= 1\n end\n end\n j = 0\n while j < my_sentence.length\n my_sentence[j] = new_sentence[j]\n j += 1\n end\n return my_sentence\nend",
"def reverse_sentence(sentence)\n p sentence.split.reverse.concat.join(\" \")\nend",
"def reverse_sentence(my_sentence)\n \n return nil if my_sentence == nil\n \n # reverses all characters in sentence\n i = 0\n j = my_sentence.length - 1\n \n while i < my_sentence.length / 2\n temp_i = my_sentence[i]\n temp_j = my_sentence[j]\n \n my_sentence[i] = temp_j\n my_sentence[j] = temp_i\n \n i += 1 \n j -= 1\n end\n \n \n # reverses any words in the sentence\n i = 0\n word_start = 0\n word_end = 0\n in_word = true\n \n while i < my_sentence.length\n if ( my_sentence[i] == \" \" || i == my_sentence.length - 1 ) && in_word == true\n \n word_end = i \n word_end -= 1 if my_sentence[i] == \" \"\n \n word_length = word_end - word_start + 1\n count = 0\n \n while count < word_length / 2\n temp_start = my_sentence[word_start]\n temp_end = my_sentence[word_end]\n \n my_sentence[word_start] = temp_end\n my_sentence[word_end] = temp_start\n \n word_start += 1\n word_end -= 1\n count += 1\n end\n \n in_word = false\n end\n \n if my_sentence[i] != \" \" && in_word == false\n word_start = i\n in_word = true\n end\n \n i += 1\n end\n \n return my_sentence\nend",
"def reverse_each_word(sentence1)\n \n reverse_array=[]\n split_sentence_array=sentence1.split(\" \")\n reversed=split_sentence_array.collect {|word| word.reverse}\n reversed.join(\" \")\n \nend",
"def reverse_sentence(my_sentence)\n #check if my_sentence even exists\n if my_sentence.nil? || my_sentence == \"\" || my_sentence.length == 0\n return my_sentence\n end\n\n #example input: \"coffee is the best\"\n #output: #output: \"best is the coffee\"\n # 0 1 2 3\n #store into temp array = [\"coffee\", \"is\", \"the\", \"best\"]\n #split sentence\n #\n temp_array = my_sentence.split(/(\\s+|\\S+)/)\n\n #make another array for storage = reversed_array = []\n reversed_array = []\n #loop, start at lastword = temp array.length - 1\n i = temp_array.length - 1\n while i >= 0\n # push word = \"best\" into reversed_array\n reversed_array.push(temp_array[i])\n #decrement \n i -= 1\n end\n \n # ['12','34','35','231'].join(', ')\n reversed_sentence = reversed_array.join(\"\")\n \n #clear the input using mutations http://rubyblog.pro/2017/09/pass-by-value-or-pass-by-reference\n my_sentence.clear\n\n #use string manipulation\n my_sentence.concat(reversed_sentence)\n\n #cannot do this because ruby is pass by value and not reference\n #my_sentence = reversed_sentence\nend",
"def reverse_sentence(sentence)\n words = sentence.split(' ')\n reversed_words = []\n\n i = 0\n while i < words.length\n reversed_words = [words[i]] + reversed_words\n i += 1\n end\n\n reversed_words.join(' ')\nend",
"def reverse_sentence(sentence)\n words = sentence.split(' ')\n reversed_words = []\n\n i = 0\n while i < words.length\n reversed_words = [words[i]] + reversed_words\n i += 1\n end\n\n reversed_words.join(' ')\nend",
"def reverse_sentence(my_sentence)\n return nil if my_sentence.nil?\n return my_sentence if my_sentence.length == 0\n\n string_reverse(my_sentence)\n reverse_words(my_sentence)\n return my_sentence\nend",
"def reverse_sentence(my_sentence)\n return nil if my_sentence.nil?\n return my_sentence if my_sentence.length == 0\n\n string_reverse(my_sentence)\n reverse_words(my_sentence)\n return my_sentence\nend",
"def reverse_sentence(my_sentence)\n if my_sentence == nil\n return nil\n end\n \n regex = /[A-Za-z']+[!\\?\\.,]?| +/\n a = my_sentence.scan(regex) #O(n)\n i = 0\n j = (a.length)-1\n while i < j\n temp = a[i]\n a[i] = a[j]\n a[j] = temp \n i += 1\n j -= 1\n end\n\n string = \"\" #O(n)\n k = 0\n while k < a.length #O(m)\n string << a[k]\n k += 1\n end\n\n l = 0\n while l < string.length #O(n)\n my_sentence[l] = string[l]\n l += 1\n end\n\n return my_sentence \nend",
"def reverse_words(sentence)\n if sentence != \"\"\n sent_array = sentence.split\n sent_array.each do |word|\n word.reverse!\n end\n sentence = sent_array.join(\" \")\n end\n sentence\nend",
"def reverse_sentence(str)\n # turn the string into an array\n arr = str.split(' ')\n\n # create a new array to store the reversed array\n new_arr = []\n\n # get the last element of that array\n # add that element to the first element to a new array\n # in a loop\n ndx = arr.length-1\n while ndx >= 0\n element = arr[ndx]\n new_arr.push(element)\n ndx -= 1\n end\n\n # join the array into a sentence\n new_arr.join(' ')\nend",
"def reversal(sentence)\n sentence.split(' ').reverse.join(' ')\nend",
"def reverse_sentence(my_sentence)\n # raise NotImplementedError\n return my_sentence if my_sentence.nil? || my_sentence.empty?\n\n sentence_start = 0\n sentence_end = my_sentence.length - 1\n\n word_reverse(my_sentence, sentence_start, sentence_end)\n reverse_words(my_sentence)\nend",
"def reverse_words(sentence)\n # sentence_array = sentence.split\n sentence.split.map(&:reverse)\n .join(' ')\n\nend",
"def reverse_sentence(input)\n sentence = []\n sentence << input.split.reverse.join(' ')\n\nend",
"def reverse_sentence(my_sentence)\n return nil if my_sentence == nil\n start_index = 0\n end_index = my_sentence.length\n string = string_reverse(my_sentence, start_index, end_index)\n sentence = reverse_words(string)\n\n return sentence \nend",
"def reverse_sentence(my_sentence)\n #1. check if my_sentence even exists\nif my_sentence.nil? || my_sentence == \"\" || my_sentence.length == 0\n return my_sentence\nend\n\n#example input: \"coffee is the best\"\n#output: #output: \"best is the coffee\"\n# 0 1 2 3\n#store into temp array = [\"coffee\", \"is\", \"the\", \"best\"]\n#2. SPLIT SENTENCE, SAVE INTO TEMP ARRAY\n#\\s+ = whitespace\n#\\S+ = everything else not caught by \\s whitespace\ntemp_array = my_sentence.split(/(\\s+|\\S+)/)\n\n#IMPORTANT BUSINESS LOGIC STARTS BELOW\n#make another array for storage = reversed_array = []\nreversed_array = []\n#LOOP, start at lastword = temp array.length - 1\ni = temp_array.length - 1\nwhile i >= 0\n # push word = \"best\" into reversed_array\n reversed_array.push(temp_array[i])\n #decrement \n i -= 1\nend\n\n#JOIN strings from reversed_array\n# ['12','34','35','231'].join(', ')\nreversed_sentence = reversed_array.join(\"\")\n\n#clear the input using mutations http://rubyblog.pro/2017/09/pass-by-value-or-pass-by-reference\nmy_sentence.clear\n\n#use string manipulation\nmy_sentence.concat(reversed_sentence)\n\n#cannot do this because ruby is pass by value and not reference\n#my_sentence = reversed_sentence\nend",
"def reverse_sentence(string)\n array_string = string.split\n array_string.reverse #discovered after looking at the solution, adding .join(\" \") here yields a true conditional\nend",
"def reverse_each_word(sentence)\n array_of_split_string = []\n reversed_words = []\n array_of_split_string = sentence.split\n array_of_split_string.collect {|words| reversed_words << words.reverse!}\n reversed_words.join(\" \")\nend",
"def reverse_each_word (sentence)\n array_sentence = sentence.split()\n array_reversed = array_sentence.collect do |word|\n word.reverse\n end\n array_reversed.join(\" \")\nend",
"def reverse_sentence(sentence)\n words = sentence.split(' ')\n reversed_words = []\n\n i = 0\n while i < words.length\n # reversed_words = words[i] + reversed_words\n reversed_words.unshift(words[i])\n i += 1\n end\n\n reversed_words.join(' ')\nend",
"def reverse_sentence(my_sentence)\n i = 0\n each_word_array = []\n word = \"\"\n reverse_sentence = \"\"\n until i > my_sentence.length\n if my_sentence[i] != \" \" && my_sentence[i] != nil\n word += my_sentence[i]\n i += 1\n elsif my_sentence[i] == nil\n each_word_array << word\n\n (each_word_array.length - 1).times do |j|\n reverse_sentence += \"#{each_word_array[each_word_array.length - (j + 1)]}\"\n i += 1\n end\n\n return reverse_sentence += \"#{each_word_array[0]}\"\n else\n each_word_array << word\n each_word_array << my_sentence[i]\n word = \"\"\n i += 1\n end\n end\nend",
"def reverse_each_word(sentence)\r\n array1 = sentence.split(\" \")\r\n array1.collect do |x|\r\n x.reverse!\r\n end\r\n array1.join(\" \")\r\nend",
"def reverse_sentence(sentence)\n reverse = sentence.split(' ').reverse.join(' ')\nend",
"def reverse_words(sentence)\n if sentence == nil || sentence.length < 2\n return sentence\n else\n index = 0\n start_index = 0\n finish_index = 0\n\n until finish_index > sentence.length\n if sentence[index] == \" \" || index + 1 == sentence.length\n a = start_index\n\n if sentence[index] == \" \"\n b = finish_index - 1\n elsif index + 1 == sentence.length\n b = finish_index\n end\n\n while a < b\n temp = sentence[b]\n sentence[b] = sentence[a]\n sentence[a] = temp\n a += 1\n b -= 1\n end\n index += 1\n finish_index += 1\n start_index = finish_index\n\n elsif sentence[index] != \" \"\n index += 1\n finish_index += 1\n end\n end\n\n return sentence\n\n end\nend",
"def reverse_sentence(sentence)\n words = sentence.split(' ')\n reversed_words = []\n\n i = 0\n while i < words.length\n reversed_words.unshift(words[i])\n i += 1\n end\n\n reversed_words.join(' ')\nend",
"def reverse_each_word(sentence)\n sentence_array = []\n split_sentence = sentence.split\n \n split_sentence.collect do |element|\n reverse = element.reverse\n sentence_array << reverse\n \n end\nreverse_sentence = sentence_array.join(\" \")\nreverse_sentence\nend",
"def reverse_each_word(sentence)\n word_array = []\n rev_array = []\n word_array = sentence.split\n word_array.collect {|word| rev_array << word.reverse}\n return rev_array.join(\" \")\nend",
"def reverse_sentence(my_sentence)\n if my_sentence == nil\n return nil\n elsif my_sentence == \"\"\n return \"\"\n end\n words = my_sentence.split(/(\\s)/)\n return my_sentence if words.length < 2\n\n hi = words.length - 1\n low = 0\n until low >= hi\n bottom = words[low]\n top = words[hi]\n words[low] = top\n words[hi] = bottom\n hi -= 1\n low += 1\n end\n my_sentence = words.join\n return my_sentence\nend",
"def reverse_sentence(my_sentence)\n if my_sentence == nil || my_sentence.empty?\n return my_sentence\n end\n\n i = 0\n j = 0\n temp = []\n\n until i == my_sentence.length\n until my_sentence[j] == \" \" && my_sentence[j + 1] != \" \" || my_sentence[j] != \" \" && my_sentence[j + 1] == \" \" || j == my_sentence.length - 1\n j += 1\n end\n\n temp << my_sentence[i..j]\n\n j += 1\n i = j\n end\n\n total_index = my_sentence.length\n\n temp.each do |capture|\n total_index = total_index - capture.length\n my_sentence[total_index..(total_index + capture.length - 1)] = capture\n end\nend",
"def reverse_sentence(my_sentence)\r\n my_sentence = reverse_words(my_sentence)\r\n my_sentence = string_reverse(my_sentence)\r\nend",
"def reverse_sentence(string)\n array = string.split\n array.reverse!\n array.join(\" \")\nend",
"def reverse_sentence(my_sentence)\n if my_sentence == nil\n return nil\n end\n\n reverse_words(my_sentence)\n reverse(my_sentence, 0, my_sentence.length - 1)\nend",
"def reverse_words(sentence)\n array = sentence.split(\" \")\n reversed_array = []\n array.each do |word|\n reversedWord = word.reverse\n reversed_array.push(reversedWord)\n end\n return reversed_array.join(\" \")\nend",
"def reverse_sentence(my_sentence)\n return [] if my_sentence == nil\n\n # reverse entire sentence\n reverse(my_sentence.length - 1, 0, my_sentence[0], my_sentence)\n\n first_index = 0\n my_sentence.length.times do |i|\n first_character = my_sentence[first_index]\n # reverse the last word\n if i == my_sentence.length - 1\n reverse(i, first_index, first_character, my_sentence)\n elsif my_sentence[i] == \" \"\n reverse(i - 1, first_index, first_character, my_sentence)\n # find new first_index\n first_index = i\n first_index += 1 until my_sentence[first_index] != \" \"\n end\n end\n \n return my_sentence\nend",
"def solution(sentence)\n sentence.split.reverse.join(\" \")\nend",
"def reverse_sentence2(sentence)\n words = sentence.split\n reversed = []\n words.each { |word| reversed.unshift(word) }\n reversed.join(' ')\nend",
"def reverse_sentence(sentence)\n sentence.split.reverse.join(' ')\nend",
"def reverse_sentence(words)\n words.split.reverse.join(' ')\nend",
"def reverse_each_word(sentence)\n\n sentence_array = sentence.split\n \n joined_sentence = sentence_array.collect do |something|\n something.reverse\n\n end\n joined_sentence.join(\" \")\nend",
"def reverse_sentence(string)\n reverse = []\n words = string.split(\" \")\n words.length.times do\n reverse << words.pop\n end\n reverse.join(\" \")\nend",
"def reverse_each_word(sentence)\n array = sentence.split()\n reversed_words = array.collect do |word|\n word.reverse\n end\n reversed_words.join(\" \")\nend",
"def reverse_words(sentence)\n temp_array = sentence.split(' ')\n temp_array.map! do |x| x.reverse end\n temp_array.join(' ')\nend",
"def reverse_each_word(sentence1)\n sentence1.split.collect {|word| word.reverse}.join(\" \")\n# new_array = []\n# reversed_words = []\n# new_array << sentence1.split.collect(&:reverse!).join(\" \")\n #reversed_words << new_array.collect(&:reverse!)\n #new_array.collect {|word| reversed_words << word.reverse}\n# sentence1.split('').reverse.join('').reverse\n #binding.pry\n #new_array\nend",
"def reverse(s)\n return s if s.length <= 1\n\n reverse_array = []\n return help_rev(s, reverse_array, s.length)\nend",
"def reverse_sentence(sentence)\n reverse_string = reverse_string(sentence)\n \n reverse_words = reverse_string.split\n \n new_words = []\n \n reverse_words.each do |word|\n new_words << reverse_string(word)\n end\n \n return new_words.join(\" \")\nend",
"def reverse_sentence(string)\n result = []\n\n array = string.split(' ')\n \n i = 0\n loop do\n break if i == array.size\n result << array.pop\n end\n\n answer = result.join(' ')\n answer\nend",
"def reverse_sentence(my_sentence)\n if my_sentence.nil?\n return nil\n end\n reverse_string(my_sentence)\n index = 0\n\n while index < my_sentence.length\n if my_sentence[index] == \" \"\n # do nothing\n else\n start_index = index\n end_index = index\n while my_sentence[end_index] != \" \" && my_sentence[end_index] != nil\n end_index += 1\n end\n # puts my_sentence[start_index]\n # puts my_sentence[end_index - 1]\n reverse_string(my_sentence, start_index, end_index - 1)\n index = end_index\n end\n index += 1\n end\nend",
"def reverse_words(words)\n word_array = words.split(\" \")\n word_array.map!{ |word| word.reverse }\n reverse_sentence = word_array.join(\" \")\nend",
"def reverse_each_word(sentence)\n sentence_array = sentence.split #convert to array\n reverse_sentence_array = sentence_array.collect do |word| #returns new array\n word.reverse #reverse order of returned argument\n end\n reverse_sentence = reverse_sentence_array.join(\" \") #returns the array to a string\n return reverse_sentence #run that puppy\nend",
"def reverse_each_word(sentence)\narrayed = sentence.split (\" \")\nreversed = arrayed.collect {|i| i.reverse}\nreversed.join (\" \")\nend",
"def reverse_sentence(string)\n results = []\n\n split_string = string.split(' ')\n\n split_string.size.times do \n results << split_string.pop\n end\n\n results.join(\" \")\nend",
"def reverse_words(sentence)\n \tsentence.reverse\n end",
"def reverse_each_word(array)\n reverse_sentence = []\n reverse_sentence = array.split.collect {|x| x.reverse}\n reverse_sentence.join(\" \")\nend",
"def reverse_each_word(sentence1)\n ## sentence1.split turns the string into an array, where each word is an element of the array. No spaces.\n sentence_array = sentence1.split\n sentence_array.collect { |word|\n \n ## .reverse! reverses each word \"in place\", not creating new\n word.reverse!\n }\n ## .join(\" \") takes the elements of the array, joins them as a string with a space between each \n sentence_array.join(\" \")\nend",
"def reverse_each_word(sentence)\n words_array = sentence.split(\" \") \n new_array = []\n new_array = words_array.collect {|word| word.reverse}\n new_array.join(\" \")\nend",
"def reverse_words(sentence)\r\n\tsent_arr = sentence.split(\" \")\r\n\tsent_arr.each do |word|\r\n\t\tsent_arr[sent_arr.index(word)] = word.reverse\r\n\tend\r\n\treturn sent_arr.join(\" \")\r\nend",
"def reverse_sentence(my_sentence)\r\n # hold index of first character of original my_sentence\r\n i = 0\r\n # hold index of last character of first group of chars (whitespace or word)\r\n j = 0\r\n if my_sentence[1] == \" \"\r\n j += 1 while my_sentence[j + 1] == \" \"\r\n else\r\n j += 1 while my_sentence[j + 1] != \" \"\r\n end\r\n # hold max_index\r\n max_index = my_sentence.length - 1\r\n while j < max_index\r\n # find first group of chars (whitespace or word) starting from the end of my_sentence\r\n first_char = max_index\r\n if my_sentence[max_index] == \" \"\r\n first_char -= 1 while my_sentence[first_char - 1] == \" \"\r\n else\r\n first_char -= 1 while my_sentence[first_char - 1] != \" \"\r\n end\r\n chars = my_sentence[first_char..max_index]\r\n # put this group of chars before the index of the first char of the original my_sentence\r\n my_sentence[first_char..max_index] = \"\"\r\n my_sentence[i] = chars + my_sentence[i]\r\n i += max_index - first_char + 1\r\n j += max_index - first_char + 1\r\n end\r\nend",
"def reverse_sentence(my_words)\n\n string_reverse(my_words)\n\n if my_words == nil\n return nil\n end\n\n length = (my_words.length - 1)\n i = 0\n while i < length\n\n while my_words[i] == \" \"\n i = i + 1\n end\n\n start = i\n\n while my_words[i] != \" \"\n i = i + 1\n break if my_words[i].nil?\n end\n\n end_i = i - 1\n\n reverse_word(my_words, start, end_i)\n\n end\n return my_words\nend",
"def reverse_each_word(sentence)\n\tarray_of_words = sentence.split(' ')\n\tarray_of_words.collect do |word|\n word.reverse!\n\tend\n\tarray_of_words.join(\" \")\nend",
"def reverse_each_word(sentence)\n array = sentence.split\n array = array.collect {|word| word.reverse}\n array.join(\" \")\nend",
"def reverse_each_word(sentence)\n new_array = sentence.split(\" \").collect do |word|\n word.reverse!\n end\n new_array.join(\" \")\nend",
"def reverse_sentence(str)\n words_array = str.split.reverse.join(' ')\n words_array\nend",
"def reverse_words(sentence)\n new_sentence = []\n reversed_sentence = []\n new_sentence = sentence.split(\" \")\n new_sentence.each do |word|\n new_word = word.reverse\n reversed_sentence << new_word\n end\n reversed_sentence.join(\" \")\nend",
"def reverse_it(sentence)\n sentence.split(' ').reverse.join(' ')\nend",
"def reverse_each_word(sentence)\n array =[ ]\n new_sentence = \" \"\n(sentence.split).collect do |word|\n word.reverse\n array << (word.reverse)\nend\narray.join(\" \")\nend",
"def reverse_each_word(sentence)\n sentence.reverse.split.reverse.join(\" \")\n \nend",
"def reverse_words(sentence)\n\twords = sentence.split(' ')\n\twords.each do |word|\n\t\tword.reverse!\n\tend\n\treversed_sentence = words.join(\" \")\nend",
"def reverse_sentence(str)\n word_array = str.split(\" \")\n word_array.each do |item| \n item.reverse! if item.size >= 5\n end\n word_array.join(\" \")\nend",
"def reverse_a_string(string)\n puts \"Give me a sentence\"\n sentence = gets.chomp\n sentence_split = sentence.split \n p sentence_split\n reverse_array = [] \n x = sentence_split.count\n p x \n counter = x-1 \n x.times do \n reverse_array << sentence_split[counter]\n counter -= 1 \n end\n puts reverse_array \nend",
"def solution(sentence)\n return sentence.split.reverse.join(\" \")\nend",
"def reverse_sentence(sentence)\n p sentence # String # \"Hello World\"\n p sentence.split # Array # [\"Hello\", \"World\"]\n p sentence.split.reverse # Array # [\"World\", \"Hello\"]\n p sentence.split.reverse.join # String # \"WorldHello\"\n p sentence.split.reverse.join(' ') # String # \"World Hello\"\nend",
"def reverse_words(sentence)\n sentence = reverse(sentence)\n words = sentence.split(/ /)\n words.map! { |word| reverse(word) }\n words.join(\" \")\nend",
"def reverse_words(sentence)\n\t# improved readability by making this code into two separate lines.\n\tnew_sentence = sentence.split.map! do |word| \n\t\tword.reverse!\n\tend\n\t# removed an unnecessary \"return\"\n\tnew_sentence.join(\" \")\nend",
"def reverse_each_word(sentence2)\n sentence2.split.collect {|word| word.reverse}.join(\" \")\nend",
"def reverse_each_word(sentence)\n\treversed = Array.new\n\tsentence.split(\" \").map do |word|\n\t\treversed << word.reverse.to_s\n\tend\n\treversed.join(\" \")\nend",
"def reverse_words(string)\n word_array = string.split\n reversed_sentence = [ ]\n \n word_array.each do |word|\n reversed_sentence.push(word.reverse)\n end\n\n p reversed_sentence.join(\" \")\nend",
"def reverse_each_word(sentence)\n sentence_array = sentence.split(/ /) \n final_sentence = sentence_array.collect {|word| word.reverse}\n final_sentence.join(\" \")\nend",
"def reverse_each_word(sentence1)\r\nnew_array = []\r\nsentence1.split.collect do |words| new_array << \"#{words}\".reverse\r\n end\r\nnew_array.join(\" \")\r\nend",
"def wordReverse(sentence) \n\tsentence = sentence.split (\" \")\n\tsentence.each do |words|\n\tend\n\tputs sentence.reverse\nend",
"def reverse_sentence(string)\n array_of_words = string.split.reverse.join(\" \")\nend",
"def reverse_each_word(sentence)\n array = sentence.split\n new_arr = []\n array.collect do |word| \n new_arr << word.reverse\n end\n p new_arr.join(' ')\nend",
"def reverse_words(word)\n word_array= sentence.split(\" \").to_a\n reversed_sent= []\n \n if sentence == \"\"\n \treturn \"\"\n elsif word_array.length== 1\n \tprint sentence.reverse!\n else\n \treversed_sent << word_array[0..-2].map { |word|\n \t word.reverse! + \" \"}\n end\n reversed_sent << word_array[-1].reverse!\n print reversed_sent.join\nend",
"def reverse_each_word(sentence)\n sentence.reverse.split.reverse.join(\" \")\nend",
"def reverse_each_word(sentence)\n sentence.reverse.split.reverse.join(\" \")\nend",
"def reverse_sentence(string)\n \n arr = string.split\n arr = arr.reverse\n arr.join(' ')\nend",
"def reverse_each_word (sentence)\r\n arr = sentence.split\r\n new_sentence = []\r\n arr.collect do |word|\r\n new_sentence << word.reverse\r\n end\r\n new_sentence.join(\" \")\r\nend"
] | [
"0.7852244",
"0.77709776",
"0.77423114",
"0.77300787",
"0.7554715",
"0.75056994",
"0.74355966",
"0.7396846",
"0.7384749",
"0.7379366",
"0.7362837",
"0.7339589",
"0.73385704",
"0.7324409",
"0.7316939",
"0.7311594",
"0.73070496",
"0.7303315",
"0.7302605",
"0.7302605",
"0.7298879",
"0.7283187",
"0.7279353",
"0.72782594",
"0.7277939",
"0.7269878",
"0.72643477",
"0.7255575",
"0.72488177",
"0.7240108",
"0.72239923",
"0.7218735",
"0.72112346",
"0.7199234",
"0.71752816",
"0.71725345",
"0.7167527",
"0.7156924",
"0.71459526",
"0.7145214",
"0.71291757",
"0.71290475",
"0.71207285",
"0.7106271",
"0.7104609",
"0.710158",
"0.7096522",
"0.70945317",
"0.7083057",
"0.70824033",
"0.7080209",
"0.707724",
"0.70690376",
"0.70656973",
"0.7055627",
"0.7054378",
"0.70454836",
"0.7043878",
"0.70192146",
"0.7015472",
"0.7012096",
"0.70065606",
"0.7001773",
"0.700052",
"0.699633",
"0.6989763",
"0.69850093",
"0.6983622",
"0.6981236",
"0.6978502",
"0.6974894",
"0.69687533",
"0.6952155",
"0.6951828",
"0.69514066",
"0.6951383",
"0.69483125",
"0.69430506",
"0.6942224",
"0.6938888",
"0.69359815",
"0.6933944",
"0.6928232",
"0.6917538",
"0.68997705",
"0.6896475",
"0.68955696",
"0.689095",
"0.6887183",
"0.6883726",
"0.6875097",
"0.68750393",
"0.6873665",
"0.68723714",
"0.68653744",
"0.68545574",
"0.68508345",
"0.68472284",
"0.68472284",
"0.6846586",
"0.6845864"
] | 0.0 | -1 |
Create ID from current timestamp this, obviously, can be called exactly and only once in an object's lifetime. | def new_timestamp_and_uuid()
u = UUID.timestamp_create()
[u.hexdigest, u.timestamp]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id\n @id ||= Time.now.utc.to_i\n end",
"def make_id\n Time.now.to_f.to_s.ljust(16, '0') + rand(10).to_s\n end",
"def generate_temporary_id\n (Time.now.to_f*1000).to_i.to_s\n end",
"def generate_id(_)\n accurate_timestamp = (Time.now.to_f * 1000).round\n time_part = (accurate_timestamp - DISCORD_EPOCH) << 22\n random_part = rand(0...2**22)\n\n time_part | random_part\n end",
"def id\n @id ||= \"%x-%s\" % [ Time.now.to_i, SecureRandom::hex(2) ]\n end",
"def newId\r\n @seed = @seed + 1\r\n \"X#{@seed}\"\r\n end",
"def generate_id(t=nil)\n t ||= Time.new.to_i\n buf = ByteBuffer.new\n buf.put_int(t & 0xffffffff)\n buf.put_array(MACHINE)\n buf.put_array(PID)\n i = index_for_time(t)\n buf.put(i & 0xff)\n buf.put((i >> 8) & 0xff)\n buf.put((i >> 16) & 0xff)\n\n buf.rewind\n buf.to_a.dup\n end",
"def generate_id\n @mutex.synchronize { @current_id += 1 }\n end",
"def new_uuid\n UUIDTools::UUID.timestamp_create.hexdigest\n end",
"def generate_public_id\n self.public_id = Time.now.to_i.to_s 36\n end",
"def unique_id\n id || @generated_dom_id || (@generated_dom_id = Time.now.to_f.to_s.gsub('.', '_'))\n end",
"def assign_uuid\n self.id = UUIDTools::UUID.timestamp_create().to_s\n end",
"def generate_new_id\n Util::UUID.generate\n end",
"def unique_id\n $unique_id_increment = ($unique_id_increment || 0) + 1\n return (Time.new.to_f * 1000).to_i.to_s + $unique_id_increment.to_s\nend",
"def generate_submission_id(time = nil, prefix: true)\n prefix = SID_PREFIX if prefix.is_a?(TrueClass)\n time = time.is_a?(DateTime) ? time.to_time : (time || Time.now)\n base_id = time.tv_sec\n letter = SID_LETTERS.first + rand(SID_LETTER_SPAN)\n sprintf('%s%x%c%02d', prefix, base_id, letter, sid_counter)\n end",
"def generate_tid\n # Input string we feed into the hash algorithm\n # It IS possible to have hash collisions:\n #\n # 1. Let's assume our system clock is perfect. The only way to get a hash\n # collision is to somehow submit multiple tag creation requests with the\n # same data at the exact same time. \n #\n # 2. Now, in reference to this article...\n # infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time\n # If our system clock screws up, hash collisions could happen in the\n # following manner:\n # * Leap seconds\n # * Clock somehow gets \"reset\" to some previous time in the past, allowing\n # someone to replay past requests at the exact same times.\n sha1 = OpenSSL::Digest::SHA1.new\n sha1 << self.location\n sha1 << self.user_id.to_s\n sha1 << Time.now.to_f.to_s\n tid = sha1.hexdigest\n\n self.tid = tid\n end",
"def generate_unique_id\n \"1.3.6.1.4.1.21367.2009.5.14.#{id}.#{Time.now.to_i}\"\n end",
"def generate_id\n now = Time.now\n parts = [now.to_i, now.usec, $$, rand(16**8)]\n parts.map {|i| i.to_s(16)}.join('-')\n end",
"def identifier\n time.ymdHMS\n end",
"def new_id\n @last_id ||= 0\n @last_id += 1\n end",
"def new_id\n @last_id ||= 0\n @last_id += 1\n end",
"def gen_uid\n \"#{rand(100000)}-#{Time.now.to_i}-#{rand(100000)}\"\n end",
"def _new_id\n @lock.synchronize do\n begin\n # Generate a random number. It's recommended to not store more than\n # 2**62 objects in the same store.\n id = rand(2**64)\n # Ensure that we don't have already another object with this ID.\n end while @in_memory_objects.include?(id) || @db.include?(id)\n\n id\n end\n end",
"def generate_id\n Util::UUID.generate\n end",
"def new_resource_id!\n uuid = Viziwiki::new_uuid\n # TODO write lock with create only\n #do\n # uuid = Viziwiki::new_uuid\n #unless lock_resource (uuid)\n uuid\n end",
"def new_id\n @last_id ||= 0\n @last_id += 1\n end",
"def create_guid\n self.id ||= UUIDTools::UUID.random_create.to_s\n end",
"def new_id\n SecureRandom.uuid\n end",
"def create_new_id\n @new_session = true\n self.class.generate_unique_id\n end",
"def set_id\n self.id = SecureRandom.random_number(9223372036854775807)\n end",
"def assign_id\n self.uid = service.mint unless new_record? && uid.present?\n self.id = service.hash(uid)\n end",
"def assign_id\n self.uid = service.mint unless new_record? && uid.present?\n self.id = service.hash(uid)\n end",
"def generate_id \n end",
"def unique_identifier\n @u_id ||= \"T1\"\n @u_id = @u_id.succ\n end",
"def identify!\n self.id ||= SecureRandom.uuid\n end",
"def timestamp() @timestamp ||= Time.now.strftime(\"%Y%m%d%H%M%SZ\") end",
"def generate_token\n\t\tUUIDTools::UUID.timestamp_create.to_s\n\tend",
"def assign_identifier\n self.id ||= SecureRandom.uuid\n end",
"def initialize\n @id = \"_\" + UUID.new.generate\n @version = \"2.0\"\n @issue_instant = Time.now.utc\n end",
"def unique_id\n # Consider using SecureRandom.hex here, and benchmark which one is better\n (Time.now.to_f * 1000).to_i.to_s(36) + rand(1_000_000).to_s(36)\n end",
"def initialize\n @uuid = \"_\" + UUID.new.generate\n end",
"def generate_timestamp\n Time.now.strftime(\"%Y-%m-%dT%T.%N%:z\")\n end",
"def generate_id\n id = @id\n @id += 1\n id\n end",
"def mint_uuid\n self.url_uuid ||= Time.now.to_i\n end",
"def unique_id\n object_id.abs.to_s(16)\n end",
"def create_new_id\n require 'securerandom'\n begin\n # by OpenSSL, or system provided entropy pool\n session_id = SecureRandom.hex(16)\n rescue NotImplementedError\n # never happens on modern systems\n require 'digest'\n d = Digest('SHA512').new\n now = Time::now\n d.update(now.to_s)\n d.update(String(now.usec))\n d.update(String(rand(0)))\n d.update(String($$))\n d.update('foobar')\n session_id = d.hexdigest[0, 32]\n end\n session_id\n end",
"def set_unique_id\n self.update_column(:unique_id, Digest::MD5.hexdigest(self.id.to_s+Time.now.to_s))\n end",
"def generate_packet_id\n self.class.current_id ||= 0\n self.class.current_id += 1\n end",
"def new_generateduid\n CFUUIDCreateString(nil, CFUUIDCreate(nil))\n end",
"def new_generateduid\n CFUUIDCreateString(nil, CFUUIDCreate(nil))\n end",
"def generate_uid\n [Time.now.strftime('%Y%m%d%H%M%S'), \"%05d\" % rand(10000)].join\n end",
"def generate_id\n id_generator.call\n end",
"def generate_id\n synchronize do\n n = (get_random() % @@MOD_LEN) + @@MOD_LEN\n time_val = Time.now.to_i\n t = ((time_val / 2) % @@MAX_TICKS) + @@MAX_TICKS\n if time_val != @@last_time_val\n @@session_count = 0\n @@last_time_val = time_val\n end\n @@session_count += 1\n \"#{n.to_s(36)[1..-1]}#{t.to_s(36)[1..-1]}#{@@session_count.to_s(36)}\"\n end\n end",
"def temporary_id\n @temporary_id ||= id || \"t#{self.__id__}\"\n end",
"def new_id(id=nil)\n # self.class.new_id\n @new_id ||= -1\n if id\n @new_id = id if @new_id < id\n id\n else\n @new_id += 1\n end\n end",
"def get_uuid\n rand_str = SecureRandom.hex\n timestamp = Time.now.to_i.to_s\n\n rand_str + timestamp\n end",
"def created_at\n id.generation_time\n end",
"def make_id\n new_id = @id\n @id += 1\n new_id\n end",
"def unique_id #:nodoc:\n @unique_id = (@unique_id || 0) + 1\n end",
"def generate_uid(prefix=\"uid\")\n\t$uid_base += 1\n\tdate_str = DateTime::now().strftime($uid_datetime_fmt)\n\treturn \"#{prefix}.#{date_str}.#{$uid_base}\"\nend",
"def get_new_uuid\n uuid = UUID.new\n return uuid.generate\n end",
"def generate_id()\n return nil unless @name and @represents\n @id ||= Digest::SHA1.hexdigest(@name + @represents)[0..5].force_encoding('utf-8').to_s\n end",
"def create_timestamp\n self.created_at = Time.now\n end",
"def create_timestamp\n self.created_at = Time.now\n end",
"def id\n (published_at.to_date.to_s(:db).gsub('-','') + published_at.min.to_s + published_at.sec.to_s).to_i\n end",
"def generate_new_id\n UUIDTools::UUID.random_create.to_s\n end",
"def time_id(time)\n time.strftime(\"%Y%m%d\")\n end",
"def signed_id(expires_in: nil, expires_at: nil, purpose: nil)\n raise ArgumentError, \"Cannot get a signed_id for a new record\" if new_record?\n\n self.class.signed_id_verifier.generate id, expires_in: expires_in, expires_at: expires_at, purpose: self.class.combine_signed_id_purposes(purpose)\n end",
"def new_id\n id = (@xid_next ||= 0)\n @xid_next += 1\n\n (id & @internal.resource_id_mask) | @internal.resource_id_base\n end",
"def new_id\n dbm = self.class.dbm\n\n max = dbm.keys.map { |k| k.to_i }.max || 0\n id = max + 1\n\n dbm[id.to_s] ||= \"\"\n\n id.to_s\n end",
"def generate_uuid\n# self[:uuid] = UUID.sha1_create(UUID_OID_NAMESPACE, Time.now.utc.to_f.to_s).to_s\n end",
"def get_next_id\n id = java.lang.System.nanoTime.to_s\n $log.info(\"*** get_next_id: \" + id)\n return id\n end",
"def generate_uuid(*args)\n\t\t\t\tnow = Time.now\n\t\t\t\t# Turn the time into a very large integer.\n\t\t\t\ttime = (now.to_i * 10_000_000) + (now.tv_usec * 10) + Epoch\n\n\t\t\t\t# Now break that integer into three chunks.\n\t\t\t\tt1 = time & 0xFFFF_FFFF\n\t\t\t\tt2 = time >> 32\n\t\t\t\tt2 = t2 & 0xFFFF\n\t\t\t\tt3 = time >> 48\n\t\t\t\tt3 = t3 & 0b0000_1111_1111_1111\n\t\t\t\tt3 = t3 | 0b0001_0000_0000_0000\n\n\t\t\t\ttime_string = TimeFormat % [t1,t2,t3]\n\t\t\t\targ_string = Digest::SHA1.hexdigest(args.collect {|arg| Proxy === arg ? arg.object_id.to_s : arg.to_s}.sort.to_s)\n\t\t\t\t\"#{time_string}-#{arg_string}-#{rand(RandHigh).to_s(16)}\"\n\t\t\tend",
"def basic_generate_id(str); end",
"def created_at\n # parse date from utc_random generated id\n Time.at(id[0, 14].to_i(16) / 1000 / 1000).utc\n end",
"def get_time_stamp\n Time.now.strftime('%Y-%m-%d_%H-%M-%S')\n end",
"def id_generator; end",
"def creation_epoch\n saved_at.try(:to_i)\n end",
"def set_id\n\t\t\trand(111111111...999999999)\n\t\tend",
"def last_id()\n #This is a stub, used for indexing\n end",
"def timestamp\n Time.now.utc.to_i\n end",
"def create_unique_id\n\t\tself.unique_id = loop do\n\t\t\trandom_token = SecureRandom.urlsafe_base64\n\t\t\tbreak random_token unless User.exists?(unique_id: random_token)\n\t\tend\n\tend",
"def __object_unique_id__\n name\n end",
"def __object_unique_id__\n name\n end",
"def insert_timestamp object_id\n if @timestamps[object_id].nil?\n @timestamps[object_id] = [@current_time]\n else\n @timestamps[object_id] << @current_time\n end\n end",
"def initialize(date)\n @id = Time.parse(date).to_f\n @date = date\n save\n end",
"def createGuid\n chars = (0...2).map{ ('a'..'z').to_a[rand(26)] }.join\n prefix = \"#{Time.new.year}#{chars}-\"\n\n return prefix + SecureRandom.uuid\nend",
"def current_timestamp\n Time.now.to_i\n end",
"def timestamp\n TimeStamp.new\n end",
"def set_identifier\n self.identifier ||= SecureRandom.uuid\n end",
"def generate\n\t\tif self.token == nil\n\t\t\tself.token = SecureRandom.hex\n\t\tend\n\t\ta = Mashup.create! name: 'temporal'\n\t\tself.mashup_id = a.id\n\tend",
"def create_id(parent)\n \"#{parent}/#{noid_service.mint}\"\n end",
"def get_next_id\r\n id = java.lang.System.nanoTime.to_s\r\n $log.info(\"*** get_next_id: \" + id)\r\n return id\r\n end",
"def gen_nonce\n Time.now.utc.to_i.to_s\n end",
"def create_record(init)\n subject.transaction(requires_new: true) do\n InternalId.create!(\n **scope,\n usage: usage_value,\n last_value: init.call(subject) || 0\n )\n end\n rescue ActiveRecord::RecordNotUnique\n lookup\n end",
"def set_uuid\n self.uuid = UUIDTools::UUID::timestamp_create.to_s if self.uuid.blank?\n end",
"def ensure_id\n self[:_id] = ( id ? escape_doc_id : database.server.next_uuid )\n end",
"def generate_new_id()\n\t\tbegin\n\t\t\t(id = rand(9000)+1000)\n\t\tend while @objects[id]\n\t\treturn id\n\tend",
"def generate_machine_id()\n \n end",
"def create_guid\n self.guid = SecureRandom.uuid\n end",
"def ensure_id\n self[:_id] = ( id ? escape_doc_id : database.server.next_uuid )\n end"
] | [
"0.74145633",
"0.7164073",
"0.7049503",
"0.7027662",
"0.69806236",
"0.68769115",
"0.6836673",
"0.6817502",
"0.66826814",
"0.6678174",
"0.6647231",
"0.66210765",
"0.6604489",
"0.65806615",
"0.656927",
"0.655393",
"0.6540355",
"0.65176755",
"0.65074134",
"0.6487702",
"0.6487702",
"0.6406634",
"0.64034283",
"0.63850456",
"0.63829523",
"0.6380671",
"0.6374705",
"0.6367508",
"0.6351862",
"0.63513017",
"0.6344598",
"0.6344598",
"0.63090104",
"0.63049465",
"0.6302178",
"0.6294848",
"0.6277504",
"0.6272155",
"0.6268441",
"0.6258489",
"0.62520707",
"0.6249113",
"0.6242943",
"0.6242301",
"0.6222237",
"0.62220335",
"0.6213137",
"0.61963344",
"0.6149421",
"0.6149421",
"0.6138231",
"0.6132736",
"0.6125323",
"0.61212206",
"0.6101492",
"0.610071",
"0.60974914",
"0.6091752",
"0.608776",
"0.608483",
"0.6082422",
"0.6082187",
"0.60656786",
"0.6064727",
"0.6053957",
"0.6052724",
"0.6039936",
"0.6014727",
"0.60049736",
"0.5998608",
"0.5989149",
"0.597672",
"0.5968191",
"0.59634125",
"0.5960417",
"0.59602535",
"0.5946124",
"0.59371257",
"0.5923646",
"0.5922862",
"0.5920962",
"0.59206337",
"0.5914624",
"0.5914624",
"0.59140164",
"0.59130675",
"0.5911417",
"0.5907731",
"0.5907073",
"0.59058946",
"0.5900623",
"0.5899942",
"0.5899071",
"0.58968675",
"0.5887702",
"0.5882738",
"0.5875547",
"0.5871709",
"0.5856733",
"0.5844032",
"0.58390707"
] | 0.0 | -1 |
Create namespaced ID from the instance method given to acts_as_snowflake (some method which guaranteed intrinsic uniqueness a URL, say, or a permalink) | def namespaced_uuid()
UUID.sha1_create(self.class.uuid_namespace, self.send(self.class.uuid_generating_method)).hexdigest
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_id\n \"#{self.class.name.downcase}#{id}\"\n end",
"def tag_id\n \"#{sanitized_object_name}_#{sanitized_method_name}\"\n end",
"def to_id\n\t\treturn self.\n\t\t\tgsub(\"::\", \"\").\n\t\t\tgsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n\t\t\tgsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n\t\t\tdowncase.\n\t\t\tgsub(\"_\", \"-\")\n\tend",
"def generate_identifier\n self.identifier ||= self.name.parameterize.underscore\n end",
"def id\n super.to_s.tr('.', '_')\n end",
"def identifier_method_name #:nodoc:\n short_identifier.gsub(/[^a-z0-9_]/, '_')\n end",
"def generate_html_id(method_name, value='input') #:nodoc:\n index = if options.has_key?(:index)\n options[:index]\n elsif defined?(@auto_index)\n @auto_index\n else\n \"\"\n end\n sanitized_method_name = method_name.to_s.gsub(/[\\?\\/\\-]$/, '')\n\n [custom_namespace, sanitized_object_name, index, sanitized_method_name, value].reject{|x|x.blank?}.join('_')\n end",
"def gen_inst_id_str(inst_str)\n return inst_str.gsub(/[\\.:\\[\\]]/,'_').upcase\nend",
"def id\n @id || self.class.name.underscore.split('/').last #gsub('/', '_')\n end",
"def id\n \"#{kind}_#{@id}\"\n end",
"def id\n \"#{kind}_#{@id}\"\n end",
"def identifier_for identifier\n \"#{name.gsub(/^.*::/,'').downcase}s.#{identifier}\"\n end",
"def generate_custom_slug\n\t\t# \"#{convert_to_lowercase_to} #{convert_to_lowercase_from}\"\n\t\t\"#{self.id}\"\n\tend",
"def get_id\n default_id = self.class.to_s.split('::').last\n default_id[0] = default_id[0].downcase\n return default_id\n end",
"def id_for(_name, _id=nil)\n n = \"#{@object_name}_#{_name}\"\n n += \"_#{_id}\" if _id\n end",
"def call_id_as_meth(hash={})\n\t\thash['id'].gsub!(' ', '_')\n\t\tsend(hash['id'], hash) rescue()\n\tend",
"def id_attribute_for(class_name)\n class_name = class_name.match(/([^:]+)$/)[1]\n class_name.gsub!(/([A-Z])([A-Z][a-z])/, '\\1_\\2')\n class_name.gsub!(/([a-z])([A-Z])/, '\\1_\\2')\n\n \"#{class_name.downcase}_id\"\n end",
"def generate_html_id(method_name, value='input') #:nodoc:\n if options.has_key?(:index)\n index = \"_#{options[:index]}\"\n elsif defined?(@auto_index)\n index = \"_#{@auto_index}\"\n else\n index = \"\"\n end\n sanitized_method_name = method_name.to_s.gsub(/[\\?\\/\\-]$/, '')\n\n \"#{sanitized_object_name}#{index}_#{sanitized_method_name}_#{value}\"\n end",
"def to_identifier\n \"#{self.document_template.identifier}::#{self.identifier}\"\n end",
"def id\n \"#{controller.url}/#{name}\"[1..-1].gsub('/', '_')\n end",
"def id2name() end",
"def id2name() end",
"def reuseIdentifier\n self.class.name\n end",
"def service_id(instance, index)\n \"a-bot-#{ fetch(:stage) }-#{ instance[:id] }-#{ index }\"\nend",
"def short_identify\n \"# #{self.id}\"\n end",
"def unique_safe_name\n \"#{safe_name}_#{id}\"\n end",
"def object_id() end",
"def __id__() end",
"def silver_spoon_key(id, namespace, scope)\n \"#{namespace}:#{scope}:#{id}\"\n end",
"def generate_id(v)\n @collection_id + '-' + v.downcase.gsub(/\\/+/, '_').gsub(/;+|\\.+/, '').gsub(/ /, '-')\n end",
"def link_to_identifier; end",
"def link_to_identifier; end",
"def self_param_id\n \"#{name.underscore}_id\".to_sym\n end",
"def self_param_id\n \"#{name.underscore}_id\".to_sym\n end",
"def self_param_id\n \"#{name.underscore}_id\".to_sym\n end",
"def cached_slug\n id.to_s\n end",
"def to_endpoint id\n t=id.split('/')\n domain = t[1..-2].join('_')\n type = t[-1]\n \"freebase_tsv_#{domain}__#{type}\"\nend",
"def namespaced_id(field)\n \"#{namespaces.join('_')}#{'_' unless namespaces.empty?}#{field}\"\n end",
"def id() end",
"def to_sym\n self.class.endpoint_name.to_sym\nend",
"def to_identifier(identifier)\n case identifier\n when String, Symbol then identifier.to_sym\n when Util::Identifier then identifier.send(identifier_method) # if module is included\n end\n end",
"def generate_slug\n self.slug=self.send(self.class.slug_column)\n self.slug=self.slug.tr(\" /=\",\"_\")\nend",
"def id\n name.gsub /-/, '_'\n end",
"def identifier\n send(self.class.identifier)\n end",
"def key_name\n \"#{prefix}:#{@id}\"\n end",
"def __object_unique_id__\n name\n end",
"def __object_unique_id__\n name\n end",
"def dom_id\n \"#{self.class.name.gsub(/:+/,\"_\")}_#{self.object_id}\"\n end",
"def generate\n base_name = camel_case identifier.to_s\n decorate_klass_name base_name\n end",
"def id_generator; end",
"def get_unique_dom_id( prefix, target_datetime )\n \"#{prefix}_#{target_datetime}\".gsub(/[òàèùçé^!\"'£$%&?.,;:§°<>]/,'').gsub(/[\\s|]/,'_').gsub(/[\\\\\\/=]/,'-')\n end",
"def make_identifiable(symbol)\n if symbol.end_with?(\"%\")\n type = symbol.chomp(\"%\")\n quote(type + new_identifier_for(type).to_s)\n else\n symbol\n end\n end",
"def id\n #NOOP\n end",
"def dom_identifier\n self.identifier.gsub(/\\//, '-')\n end",
"def id_for(request)\n raise NotImplementedError\n end",
"def loser_id\n return self.send(\"#{loser}_id\".intern)\n end",
"def to_id(use_old = false)\n use_old ? @attributes[self.class.id_method] : send(self.class.id_method)\n end",
"def identifier\n \"#{self.namespace}/#{self.name}/#{self.snapshot}\"\n end",
"def make_sym_id(variation = nil)\n @id_seq ||= 0\n @id_seq += 1\n [\"_#{@sym}_#{@id_seq}#{variation}\".to_sym, (\"#{@id}.#{@id_seq}#{variation}\" if @id)]\n end",
"def dom_id(object)\n object.class.to_s.tableize + '_' + object.id.to_s\n end",
"def wrapper_name(java_classname)\n (\"convert_\" + java_classname.gsub(/\\./, \"_\")).downcase.to_sym\n end",
"def _hashback_id_key\n self.__send__(self.class.__send__(:class_variable_get, :@@_key_method_sym))\n end",
"def id\n name.gsub(':', '-')\n end",
"def mint_uuid\n self.url_uuid ||= Time.now.to_i\n end",
"def generate_id(str); end",
"def method_prefix\n if singleton_class?\n if Module === singleton_instance\n \"#{WrappedModule.new(singleton_instance).nonblank_name}.\"\n else\n \"self.\"\n end\n else\n \"#{nonblank_name}#\"\n end\n end",
"def generate_slug!\n\t\tself.slug = self.id.to_s(36)\n\t\tsave\n\tend",
"def identifier\n name.gsub(/[^A-Za-z0-9_]/, '_')\n end",
"def identifier\n name.gsub(/[^A-Za-z0-9_]/, '_')\n end",
"def str2id(s)\n s.id.delete('/hostedzone/')\nend",
"def unique_object_name_for(name)\n \"#{name}_#{SecureRandom.hex(5)}\"\n end",
"def identifier\n to_be_overridden\n end",
"def normalize_link_id(id); end",
"def id_fragment\n return ActiveSupport::Inflector.demodulize(self.class.name)\n end",
"def basic_generate_id(str); end",
"def make_key class_name\n name = class_name.to_s.pluralize.gsub(/::/, '__').underscore\n only_last_part_plural(name).to_sym\n end",
"def id_for(obj)\n \"#{obj.class.name.underscore}-#{obj.id}\"\n end",
"def dom_id\n display_id = new_record? ? \"new\" : id\n prefix = prefix.nil? ? self.class.name.underscore : \"#{prefix}_#{self.class.name.underscore}\"\n prefix.gsub!('/', '_')\n \"#{prefix}_#{display_id}\"\n end",
"def generate_short_url\n self.update_attribute :short_url, self.class.convert_to_base62(self.id)\n end",
"def sub_id() @tag.sub( /.*_/, '' ) end",
"def sub_id() @tag.sub( /.*_/, '' ) end",
"def get_news_api_id\n if self.name.include?(\".com\")\n self.news_api_id = null\n else\n self.news_api_id = self.name.downcase.gsub!(/\\s/, '-')\n self.save\n news_api_id\n end\n end",
"def make_identifier_suffix( url )\n\t\treturn url.to_s.gsub( /\\W+/, '-' )\n\tend",
"def set_identifier\n self.identifier = self.name.downcase.gsub(/[^a-zA-Z0-9]+/, '-').chomp('-')\n end",
"def globally_unique_identifier\n super\n end",
"def id()\n #This is a stub, used for indexing\n end",
"def id\n begin\n if self.class == Piwik::Site\n self.idsite\n else\n attributes.send(:\"id#{self.class.to_s.gsub('Piwik::','')}\")\n end\n rescue Exception => e\n $stderr.puts e\n end\n end",
"def slug_base_string\n self.id || sluggify\n end",
"def identifier\n @identifier ||= \"#{ATTRIBUTE_PREFIX}.#{Model::to_id @schema_ref}.#{Model::to_id @reference}\"\n end",
"def unique_format_name\n string_with_id(format_name)\n end",
"def polymorphic_id_param\n \"#{key}_id\".to_sym\n end",
"def __name__\n ɴ = self.class.__instances__[ self ]\n namespace.name_get_hook.( ɴ ) if ɴ\n end",
"def id\n source.split('/')[-1].split('_')[0]\n end",
"def set_identifier\n time_tag = \"#{Time.now.to_s}\".gsub(/[^0-9]/,'')[0,14]\n fingerprint_tag = \"#{fingerprint}\".gsub(/[^0-9a-zA-Z]/,'')[-6,6]\n self.identifier ||=\n begin\n case key_type\n when KEY_TYPE_USER\n user.gitolite_identifier\n #\"#{user.gitolite_identifier}_#{fingerprint_tag}_#{time_tag}\"\n when KEY_TYPE_DEPLOY\n \"#{user.gitolite_identifier}_#{fingerprint_tag}_#{time_tag}_#{DEPLOY_PSEUDO_USER}\"\n end\n end\n end",
"def create_unique_handler_name(string)\n begin\n int = (10000*rand).round\n handler_name = \"#{NAMESPACE}.#{string}_#{int}\"\n end while @handlers.include?(handler_name)\n return handler_name\n end",
"def create_id(parent)\n \"#{parent}/#{noid_service.mint}\"\n end",
"def class_name_id object\n return object.class.to_s.split(/(?=[A-Z])/).join('-').downcase\n end",
"def identifier; end",
"def identifier; end",
"def css_id name\n attr \"##{name}\"\n end"
] | [
"0.62714684",
"0.6266793",
"0.61359364",
"0.60451907",
"0.6012351",
"0.5975649",
"0.59534305",
"0.5949041",
"0.59419",
"0.5904787",
"0.5904787",
"0.5900741",
"0.5756918",
"0.5754005",
"0.56980914",
"0.5688284",
"0.56838524",
"0.5627143",
"0.562359",
"0.5618909",
"0.5609349",
"0.5609349",
"0.5571325",
"0.5548729",
"0.5519787",
"0.5493697",
"0.5491003",
"0.54526335",
"0.54463005",
"0.54358995",
"0.5407149",
"0.5407149",
"0.5400987",
"0.5400987",
"0.5400987",
"0.53986037",
"0.5388351",
"0.5375145",
"0.5369479",
"0.53659046",
"0.53658575",
"0.5360663",
"0.5356652",
"0.534159",
"0.53377473",
"0.5335546",
"0.5335546",
"0.5329075",
"0.5328731",
"0.53149545",
"0.52939135",
"0.52894676",
"0.52835715",
"0.52818584",
"0.52726793",
"0.52701813",
"0.52656615",
"0.5255204",
"0.5244514",
"0.5237239",
"0.5230059",
"0.52276117",
"0.5226947",
"0.5224263",
"0.5223404",
"0.5222676",
"0.52082485",
"0.5201164",
"0.5201164",
"0.5198459",
"0.51933396",
"0.5190432",
"0.5183873",
"0.5183221",
"0.5181379",
"0.5172861",
"0.5172466",
"0.517235",
"0.5165289",
"0.5157352",
"0.5157352",
"0.5157075",
"0.51558864",
"0.51498747",
"0.5148419",
"0.51441234",
"0.51434773",
"0.514315",
"0.512878",
"0.5128433",
"0.5123562",
"0.51232713",
"0.51188457",
"0.5108636",
"0.5100608",
"0.50993717",
"0.509884",
"0.50954646",
"0.50954646",
"0.5092754"
] | 0.6300916 | 0 |
Retrieve a file from the filesystem, based on the calculated store_dir and the filename stored in the database. | def retrieve(filename, instance = nil, attribute = nil, options = {}) #:nodoc:
self.new(:retrieve, filename, instance, attribute, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_file_named name\n @store.find_file_named name\n end",
"def stored_file_path\n File.join(path, stored_name)\n end",
"def retrieve!(identifier)\n File.new(uploader, self, uploader.store_path(identifier))\n end",
"def retrieve!(identifier)\n self.class.configure_qcloud_sdk(uploader)\n\n if uploader.file # file is present after store!\n uploader.file\n else\n file_path = uploader.store_path(identifier)\n File.new(nil).tap do |file|\n file.path = file_path\n end\n end\n end",
"def retrieve!(identifier)\n CarrierWave::Storage::Couch::File.new(uploader, uploader.store_path(identifier))\n end",
"def retrieve!(identifier)\n CarrierWave::Storage::GridFS::File.new(uploader, uploader.store_path(identifier))\n end",
"def retrieve!(identifier)\n CarrierWave::Storage::GridFS::File.new(uploader, uploader.store_path(identifier))\n end",
"def retrieve!(identifier)\n HesCloudStorage::HesCloudStorageEngine::File.new(uploader, self, ::File.basename(uploader.store_path(identifier), uploader.root))\n end",
"def _get_file(name)\n File.read(\"%s/%s\" % [uri, name])\n end",
"def get_file(key, use_cache = true)\n if use_cache\n db = (@current_site.get_meta(cache_key) || {})[File.dirname(key)] || {}\n else\n db = objects(File.dirname(key)) unless use_cache\n end\n (db[:files][File.basename(key)] || db[:folders][File.basename(key)]) rescue nil\n end",
"def get_file_data(file_id)\n return $db.execute(\"SELECT * FROM files WHERE file_id = ?\", file_id).first\nend",
"def get_file_from_url(url)\n return $db.execute(\"SELECT * FROM files WHERE unique_url = ?\", url)[0]\nend",
"def database_file(id)\n if repo\n if id == :not_specified || !id || id == ''\n f = 'store.json'\n else\n f = \"store_#{id.to_s.downcase}.json\"\n end\n \"#{git_database_dir}/#{f}\"\n end\n end",
"def filepath\n base = storage_root_path\n if base\n File.join(base, storage_key)\n else\n raise StandardError.new(\"no filesystem path found for datafile: #{self.web_id}\")\n end\n end",
"def fetch(name)\n file_path = file_for(name)\n return File.read(file_path).strip.to_i if File.exist?(file_path)\n store(name)\n end",
"def fetchFile #:doc:\n \n begin\n @user = User.find_by_username(params[:username])\n @device = @user.devices.find_by_dev_name(params[:devicename])\n \n getPathAndFilename\n @file = @device.devfiles.find(:first, :conditions => [\"name = ? and path = ?\", @filename, @path])\n @blob = Blob.find_by_id(@file.blob_id)\n rescue => e\n puts e\n return false\n end\n \n # if not found\n if @file == nil\n return false\n end\n return true\n end",
"def new_store_path(for_file=filename)\n File.join([generate_new_store_dir, full_filename(for_file)].compact)\n end",
"def getFile(file)\n return fileByName.fetch(file, nil)\n end",
"def file\n TestIds.database_file(id)\n end",
"def get_file_path(v1_url)\n store.get(table_key + '_path', v1_url)\n end",
"def get_full_file_path(file_id)\n path = $db.execute(\"SELECT file_path FROM files WHERE id = ?\", file_id)[0][\"file_path\"]\n return path + $db.execute(\"SELECT file_name FROM files WHERE id = ?\", file_id)[0][\"file_name\"]\nend",
"def get_file_from_store(file)\n Cloudsync::File.from_s3_obj( get_obj_from_store(file), self.to_s )\n end",
"def get_file(id)\n id = self.to_id(id)\n self.grid.get(id).read\n end",
"def retrieve_from_cache!(identifier)\n CarrierWave::Storage::GridFS::File.new(uploader, uploader.cache_path(identifier))\n end",
"def retrieve!(identifier)\n CarrierWave::Storage::UpYun::File.new(uploader, self, uploader.store_path(identifier))\n end",
"def get\n file = XFile.get(params[:id])\n raise RequestError.new(:file_not_found, \"File not found\") unless file\n raise RequestError.new(:bad_access, \"No access\") unless file.users.include? session[:user]\n raise RequestError.new(:bad_param, \"Can't get a folder\") if file.folder\n raise RequestError.new(:file_not_uploaded, \"File not completely uploaded\") unless file.uploaded\n raise RequestError.new(:bad_part, \"Incorrect content\") if file.content.nil?\n\n @result = retrieve(file, params[:part].to_i) if (!params[:direct] || params[:direct] != \"true\")\n \tsend_data(full_retrieve(file), filename: file.name) if (params[:direct] == \"true\")\n end",
"def store_path\n store_path ||= build_store_path\n end",
"def get_file_name(file_id)\n return $db.execute(\"SELECT file_name FROM files WHERE id = ?\", file_id)[0][\"file_name\"]\nend",
"def fetch_site_file(filename=\"Gumdrop\")\n here= Dir.pwd\n found= File.file? here / filename\n # TODO: Should be smarter -- This is a hack for Windows support \"C:\\\"\n while !found and File.directory?(here) and File.dirname(here).length > 3\n here= File.expand_path here /'..'\n found= File.file? here / filename\n end\n if found\n File.expand_path here / filename\n else\n nil\n end\n end",
"def find(filename)\n find_location filename do |file|\n return File.new file\n end\n end",
"def load_file_through_database(filename, extension = \"csv\", path = \"/tmp/\")\n full_file_path = \"#{q(path)}#{q(filename)}.#{q(extension)}\"\n logger.debug(\" >> load_file_through_database(#{filename})\")\n file = ActiveRecord::Base.connection.execute(\"select LOAD_FILE('#{full_file_path}')\") #.fetch_row()[0]\n if file.first[0]\n File.open(full_file_path, 'w') { |f| f.write(file.first[0].encode(\"UTF-8\", :invalid => :replace, :undef => :replace, :replace => \"?\")) }\n logger.debug(\" >> load_file_through_database = file\")\n return filename\n else\n logger.debug(\" << load_file_through_database = nil\")\n return nil\n end\n end",
"def get_single_file_id(file_name, owner_id)\n return $db.execute(\"SELECT file_id FROM files WHERE owner_id = ? AND file_name = ?\", owner_id, file_name)[0][\"file_id\"]\nend",
"def file_matching_path\n !!container.stored_files.where(file_name: file_name, path: path).first\n end",
"def retrieve!(file_id)\n # allow for use of either path or ID as the file identifier\n id = file_id.match(/^id:/) ? file_id : \"/#{uploader.store_path file_id}\"\n CarrierWave::Storage::Dropbox::File.new(uploader, config, id, dropbox_client)\n end",
"def db_file\n self.class.db_root.join(id) if id\n end",
"def store_dir\n \"attachment/#{model.id}\"\n end",
"def store_dir\n \"attachment/#{model.id}\"\n end",
"def retrieve!(identifier)\n CarrierWave::Storage::TrueVault::File.new(api_key, vault_id, identifier)\n end",
"def file_path\n File.join(dir,filename)\n end",
"def get(id, file = nil, options = {})\n start_time = Time.now\n logger.debug(\"getting '#{id}' start: #{start_time}\")\n\n if file\n get_file(id, file)\n file.flush\n else\n result = nil\n temp_path do |path|\n File.open(path, 'w') { |f| get_file(id, f) }\n result = File.open(path, 'r') { |f| f.read }\n end\n logger.debug(\"getting '#{id}' (took #{Time.now - start_time})\")\n result\n end\n rescue BlobstoreError => e\n raise e\n rescue Exception => e\n raise BlobstoreError,\n sprintf('Failed to fetch object, underlying error: %s %s', e.inspect, e.backtrace.join(\"\\n\"))\n ensure\n logger.debug(\"getting '#{id}' (took #{Time.now - start_time})\")\n end",
"def get_local_file(fname)\n if File.exist?(@dir+'/'+fname) then\n fname = @dir+'/'+fname\n end\n return File.open(fname)\n end",
"def relative_store_dir\n parse_dir_options(:store_dir)\n end",
"def cache_file key\n File.join( store, key+\".cache\" )\n end",
"def find_by(id:)\n path = file_path(id)\n storage_object_id, file_category = id_from_path(path)\n\n moab_path = find_moab_filepath(storage_object_id, path, file_category)\n\n Valkyrie::StorageAdapter::File.new(id: Valkyrie::ID.new(id.to_s), io: ::File.open(moab_path, 'rb'))\n rescue ::Moab::FileNotFoundException\n raise Valkyrie::StorageAdapter::FileNotFound\n end",
"def retrieval_path\n file_path = nil\n current_user_role_names.each do |role_name|\n file_path = path_for role_name: role_name\n break if file_path\n end\n\n file_path\n end",
"def get_data_file(dir, file_name)\n File.join(dir, file_name)\n end",
"def file_path\n storage.file_path(self.class, @id)\n end",
"def content\n file = Store::File.find_by(id: store_file_id)\n if !file\n raise \"No such file #{store_file_id}!\"\n end\n\n file.content\n end",
"def db_record\n db or MyBiaDJ::Table(:files)[:path => relative_path, :name => name.to_s]\n end",
"def get_cache_file(key)\n _find_file_key(key)\n end",
"def fetch(filename, filesize)\n end",
"def filename\n get \"filename\"\n end",
"def retrieve_file_from(id, retrieval_type, for_action:, container: nil, activity_log: nil, force: nil)\n container ||= self.container\n activity_log ||= self.activity_log\n\n unless container.allows_current_user_access_to? :access\n raise FsException::NoAccess, 'user does not have access to this container'\n end\n\n unless force || container.send(\"can_#{for_action}?\")\n raise FsException::NoAccess, \"user is not authorized to #{for_action.to_s.humanize}\"\n end\n\n unless activity_log\n res = ModelReference.find_where_referenced_from(container).first\n if res\n raise FsException::NoAccess,\n 'Attempting to browse a container that is referenced by activity logs, without specifying which one'\n end\n end\n\n item_for_filter = activity_log || container\n filtered_files = filtered_files_as_scopes(item_for_filter)\n\n raise FsException::Download, 'No file filters are configured.' unless filtered_files\n\n case retrieval_type\n when :stored_file\n retrieved_file = filtered_files[:stored_files].find { |f| f.id == id }\n when :archived_file\n retrieved_file = filtered_files[:archived_files].find { |f| f.id == id }\n else\n raise FsException::Download, \"Invalid retrieval type requested for download: #{retrieval_type}\"\n end\n\n unless retrieved_file\n raise FsException::Download, 'The requested file either does not exist or you do not have access to it'\n end\n\n # Save the list of gids this user has\n self.user_groups = retrieved_file.current_user_group_ids\n self.container = retrieved_file.container\n self.user = current_user\n\n # The details we save is dependent on whether we are downloading a single file, or a set of multiple items\n if multiple_items\n self.all_action_items ||= []\n\n self.all_action_items << {\n\n retrieval_type: retrieval_type,\n container_id: container.id,\n id: id,\n file_name: retrieved_file.file_name,\n parent_name: retrieved_file.container.parent_sub_dir || \"master-id-#{retrieved_file.container.master_id}\",\n container_name: retrieved_file.container.directory_name,\n container_path: retrieved_file.container_path(no_filename: true),\n retrieval_path: retrieved_file.retrieval_path,\n file_metadata: retrieved_file.file_metadata,\n retrieved_file: retrieved_file\n }\n else\n self.retrieval_path = retrieved_file.retrieval_path\n self.retrieval_type = retrieval_type\n self.file_metadata = retrieved_file.file_metadata\n end\n\n FsException::NotFound.new 'file not found with available group access' unless retrieval_path\n\n retrieval_path\n end",
"def file\n @file ||= find_file\n end",
"def set_stored_file\n @stored_file = StoredFile.find(params[:id])\n end",
"def file_by_url(url)\n return file_by_id(url_to_id(url))\n end",
"def file\n @pathname.to_s\n end",
"def file_for(provider)\n if cursor = provides?(provider)\n cursor.file.to_s\n else\n raise ProviderNotFound.new(\"The file for provider '#{provider}' is not found.\")\n end\n end",
"def file(filename) File.read(File.absolute_path(filename, File.dirname($PROGRAM_NAME))) end",
"def item_by_file(filename)\n item = self.item.select do |it|\n it.path.match(/.*(?:\\\\|\\/|^)(.+)$/)[1] == filename\n end\n item.first if item\n end",
"def find_by(id:)\n return unless handles?(id: id)\n Valkyrie::StorageAdapter::File.new(id: Valkyrie::ID.new(id.to_s), io: ::File.open(file_path(id), 'rb'))\n end",
"def open_photo(name)\n File.open(Rails.root.join(\"db\", \"restaurant-images\", name))\nend",
"def retrieve file, part\n key = \"#{file.content.content_hash}/#{part}\"\n raise RequestError.new(:no_bucket, \"Bucket not found\") if Storage['woda-files'].nil?\n if (Storage.use_aws ? Storage['woda-files'][key].exists? == false : Storage['woda-files'][key].nil? ) then\n raise RequestError.new(:no_key, \"Key path not found\")\n end\n data = Storage['woda-files'][key].read()\n if part == 0 then\n file.downloads += 1\n file.save\n end\n uncrypt(file, data, part)\n end",
"def get(filename)\n @ftp.getbinaryfile(filename, nil)\n end",
"def get_file(path)\n raise FileNotFoundError.new(path) unless @files[path]\n \n return Chance.get_file(@files[path])\n end",
"def distro_file(filename)\n if File.exist?(file(filename))\n file(filename)\n else\n @distro.file(filename)\n end\n end",
"def get_file(path)\n if not @files[path]\n file_not_found(path)\n end\n \n return Chance.get_file(@files[path])\n end",
"def downloaded_file\n filename = source[:cached_name] if source[:cached_name]\n filename ||= File.basename(source[:url], \"?*\")\n File.join(Config.cache_dir, filename)\n end",
"def retrieve!(file)\n CarrierWave::Storage::Dropbox::File.new(uploader, config, uploader.store_path(file), dropbox_client)\n end",
"def retrieve!(file)\n CarrierWave::Storage::Dropbox::File.new(uploader, config, uploader.store_path(file), dropbox_client)\n end",
"def full_filename\n File.join(path, self.disk_filename)\n end",
"def path\n @filename\n end",
"def get_file(filename, options={})\n end",
"def get\n file\n end",
"def file_get(id)\n response = get('FileService.getFile', id)\n end",
"def store_dir\n\n \"#{model.publication.product_code}/#{model.product_id}\"\n end",
"def retrieve(path)\n directory = connection.directories.get(self.bucket)\n directory ||= connection.directories.create(self.permissions.merge(:key => self.bucket))\n\n file = directory.files.get(path)\n\n body = file.body\n\n extname = File.extname(path)\n basename = File.basename(path, extname)\n\n file = Tempfile.new([basename, extname])\n file.binmode\n file.write(body)\n file.rewind\n\n file\n end",
"def store_dir\n \"files/#{model.album.path}\"\n end",
"def file\n File.join(root, FILENAME)\n end",
"def find_file_path(filename)\n filepath=\"#{ENV['IMPORT_PATH']}/#{filename}\"\n #filepath = Dir.glob(\"#{ENV['IMPORT_PATH']}/#{filename}\").first\n raise \"Cannot find file #{filename}... Are you sure it has been uploaded and that the filename matches?\" if filepath.nil?\n filepath\n end",
"def store_dir\n \"city-of-meridian/files/\"\n end",
"def file_path\n @file_path ||= lookup_file_path\n end",
"def get_file_source(opts)\n BawWorkers::Validation.check_custom_hash(opts, BawWorkers::Jobs::Analysis::Payload::OPTS_FIELDS)\n\n file_sources = @original_store.existing_paths(opts)\n\n if file_sources.empty?\n possible_sources = @original_store.possible_paths(opts)\n msg = \"No original audio files found in #{possible_sources.join(', ')} using #{opts.to_json}.\"\n @logger.error(@class_name) do msg end\n raise BawAudioTools::Exceptions::AudioFileNotFoundError, msg\n end\n\n File.expand_path(BawWorkers::Validation.normalise_path(file_sources.last, nil))\n end",
"def retrieve(identifier)\n @file = @client.get_document(identifier)\n @file ||= @file.parsed_response\n end",
"def fetch_local_image(filename)\r\n filename = ProductImport.settings[:product_image_path] + filename\r\n unless File.exists?(filename) && File.readable?(filename)\r\n log(\"Image #{filename} was not found on the server, so this image was not imported.\", :warn)\r\n return nil\r\n else\r\n return File.open(filename, 'rb')\r\n end\r\n end",
"def collect\n file_path = File.join(@raw_file.cached_path, @raw_file.name)\n begin\n case @raw_file.cached_storage_location\n when AppConfig.file_locations.database\n gridfs_file = Mongo::GridFileSystem.new(Mongoid.database).open(file_path, 'r')\n send_data gridfs_file.read, :filename => @raw_file.name\n when AppConfig.file_locations.filesystem\n send_file file_path, :filename => @raw_file.name\n end\n rescue\n render :status => :not_found\n end\n end",
"def get_file(filename, &block)\n if block_given?\n http.get(200, luwak, escape(filename), &block)\n nil\n else\n tmpfile = LuwakFile.new(escape(filename))\n begin\n response = http.get(200, luwak, escape(filename)) do |chunk|\n tmpfile.write chunk\n end\n tmpfile.content_type = response[:headers]['content-type'].first\n tmpfile\n ensure\n tmpfile.close\n end\n end\n end",
"def full_retrieve file\n filedata = ''\n parts = (file.content.size / PART_SIZE) + (!!(file.content.size % PART_SIZE) ? 1 : 0)\n parts.times do |part|\n filedata += retrieve(file, part)\n end\n filedata\n end",
"def local_file_path\n afilePath = building.local_path + SAVE_PATH + id.to_s\n\n if file_suffix != \"\" && file_suffix != nil\n afilePath = afilePath + \".\" + file_suffix\n end\n\n afilePath \n end",
"def store_dir\n \"photo/#{model.id}\"\n end",
"def get_file_instance(id)\n raise 'The primary key must be an integer.' unless id.instance_of? Integer\n name_list = []\n while true\n file = Fileinfo[id] \n break if id == file.parent_id\n name_list.push(file.name)\n id = file.parent_id\n end\n find_file(name_list.reverse, 1)\n end",
"def store_dir\n \"uploads/#{model.Mid}\"\n end",
"def find_file path, options = {}\n ensure_connection!\n resp = connection.get_file name, path, options\n if resp.success?\n File.from_gapi resp.data, connection\n else\n fail ApiError.from_response(resp)\n end\n end",
"def mirror_filename(woc_file)\n\t\tfile_row = @db.get_first_row(\"SELECT filename, length, published_at FROM mirror_files WHERE file_type = ? AND file_id = ?\", woc_file.file_type, woc_file.file_id)\n\t\tif file_row.nil?\n\t\t\tfile_row = self.mirror_file(woc_file)\n\t\t\treturn file_row\n\t\telse\n\t\t\treturn file_row \n\t\tend\n\tend",
"def openid_file_store_path(value = nil)\n if value.nil?\n read_inheritable_attribute(:openid_file_store_path) || openid_file_store_path((defined?(RAILS_ROOT) && RAILS_ROOT + \"/tmp/openids\") || (defined?(Merb) && Merb.root + \"/tmp/openids\"))\n else\n write_inheritable_attribute(:openid_file_store_path, value)\n end\n end",
"def file\r\n LocalFile\r\n end",
"def file_download\n if !model.edgarj_file?(params[:column])\n flash[:error] = t('edgarj_file.no_assoc')\n return\n end\n\n file_info_id = user_scoped.find(params[:id]).send(params[:column])\n if file_info_id\n file_info = FileInfo.find(file_info_id)\n if file_info\n send_file(file_info.full_filename, :filename => file_info.filename)\n return\n end\n end\n logger.warn 'invalid file_info'\n end",
"def generate_storage_path\n update_column(:file, File.join(File.dirname(request.file),\n \"#{id}-response.xml\"))\n end",
"def store_dir\n File.join STORE_DIR, \"#{model.id}\"\n end",
"def store_dir\n \"#{base_store_dir}/#{model.id}\"\n end",
"def store_dir\n \"#{base_store_dir}/#{model.id}\"\n end"
] | [
"0.6791648",
"0.6456668",
"0.63623524",
"0.6324057",
"0.6178648",
"0.61600244",
"0.61600244",
"0.6151353",
"0.61383575",
"0.60007495",
"0.59835124",
"0.59783983",
"0.5911264",
"0.5891454",
"0.58463174",
"0.58177775",
"0.5812456",
"0.578017",
"0.5746379",
"0.5737273",
"0.57355505",
"0.5708617",
"0.5687042",
"0.5678585",
"0.5645775",
"0.560846",
"0.5600981",
"0.558936",
"0.5527039",
"0.550079",
"0.54840505",
"0.5468135",
"0.54663426",
"0.54456294",
"0.5443736",
"0.5420815",
"0.5420815",
"0.5413846",
"0.54119897",
"0.54108477",
"0.5408442",
"0.5400232",
"0.5398471",
"0.539568",
"0.53931695",
"0.53922987",
"0.5390368",
"0.53779936",
"0.5369802",
"0.5367794",
"0.53645104",
"0.53624755",
"0.53528345",
"0.5352029",
"0.53475094",
"0.5338509",
"0.5336145",
"0.53302807",
"0.53242797",
"0.53225625",
"0.53103733",
"0.5297406",
"0.52942914",
"0.5291129",
"0.52884704",
"0.52815855",
"0.52767843",
"0.5275777",
"0.5259627",
"0.5259627",
"0.5252048",
"0.5243233",
"0.52420133",
"0.5236698",
"0.52361095",
"0.5228623",
"0.5224041",
"0.5223993",
"0.5212027",
"0.5210026",
"0.52076745",
"0.52063626",
"0.5202814",
"0.5198238",
"0.51901764",
"0.51887965",
"0.5184242",
"0.51809573",
"0.5178954",
"0.51730514",
"0.51690024",
"0.51645005",
"0.51644003",
"0.5162385",
"0.51622045",
"0.5158134",
"0.5155979",
"0.51532805",
"0.51404417",
"0.5131873",
"0.5131873"
] | 0.0 | -1 |
Retreieve a file that was stored as a temp file | def retrieve_temp(path, instance = nil, attribute = nil, options = {}) #:nodoc:
self.new(:retrieve_temp, path, instance, attribute, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tmpfile\n \n unless @tmpfile\n \n return download\n \n end\n \n return @tmpfile\n \n end",
"def download_to_temp_file\n source_key = self.effective_key\n ext = self.format&.extensions&.first || \"tmp\"\n tempfile = Tempfile.new([\"#{self.class}-download_to_temp_file-#{self.id}\", \".#{ext}\"])\n begin\n ObjectSpace.undefine_finalizer(tempfile)\n PersistentStore.instance.get_object(key: source_key,\n response_target: tempfile.path)\n rescue => e\n tempfile.unlink\n raise e\n end\n tempfile\n end",
"def tempfile; end",
"def tempfile; end",
"def tempfile\n unless @tempfile\n @tempfile = Tempfile.new(binmode: true)\n @tempfile.write(@read || read_from(closest))\n @tempfile.open\n end\n @tempfile\n end",
"def download_file\n tmp_file = Tempfile.new '', SimplyRets.configuration.temp_folder_path\n content_disposition = raw.headers['Content-Disposition']\n if content_disposition\n filename = content_disposition[/filename=['\"]?([^'\"\\s]+)['\"]?/, 1]\n path = File.join File.dirname(tmp_file), filename\n else\n path = tmp_file.path\n end\n # close and delete temp file\n tmp_file.close!\n\n File.open(path, 'w') { |file| file.write(raw.body) }\n SimplyRets.logger.info \"File written to #{path}. Please move the file to a proper folder for further processing and delete the temp afterwards\"\n return File.new(path)\n end",
"def temp_file\n f = Tempfile.new('')\n $files_to_delete.push(f.path)\n return f\nend",
"def temporary_file(path)\n tmp_path = temporary_path(path)\n file = open(tmp_path)\n files_to_close << file\n file\n end",
"def get_free_file_path\n tempfile = Tempfile.new('foo', \"#{Rails.root}/test/fixtures/data/upload\")\n res = tempfile.path\n tempfile.close\n tempfile.unlink\n res\n end",
"def received_file\n if env['rack.input']\n make_tempfile(env['rack.input'], :filename => env['HTTP_X_FILE_NAME'], :type => env[\"CONTENT_TYPE\"])\n end\n end",
"def temp_file(*args, &block)\n self.class.temp_file(prefix_suffix, *args, &block)\n end",
"def http_get(_request, h_r, temp_location)\n return nil unless ::File.exist?(temp_location)\n\n h_r.update_header('Content-Type', 'application/octet-stream')\n h_r.update_header('Content-Length', ::File.size(temp_location))\n h_r.update_header('X-Sabre-Temp', 'true')\n h_r.status = 200\n h_r.body = ::File.open(temp_location, 'r')\n false\n end",
"def tempfile content\n Tempfile.new(@NAME).tap do |body_io|\n body_io.unlink\n body_io.write content\n body_io.flush\n body_io.rewind\n end\n end",
"def temp_file(text)\n file = Tempfile.new(\"ari\")\n file << text\n file.close\n file.path\nend",
"def path\n @tmpname\n end",
"def temp_file\n File.join($config[\"processed_loc\"], File.basename(@origional_file).sub('.'+process_tag, '').sub(File.extname(@origional_file), '.mkv'))\n end",
"def path\n tempfile.path\n end",
"def close; @tempfile.close; end",
"def result\n Jobler::FileDownload.new(\n file_name: \"some-file.zip\",\n temp_file: temp_file_for_result(name: \"my-file\")\n )\n end",
"def tempfile\n ::Tempfile.new(filename, tempfile_path).tap do |tmp|\n tmp.write s3obj.value\n tmp.close\n end\n end",
"def read(file_tmp_id)\n content = nil\n if !file_tmp_id.nil? && file_tmp_id != \"\" && file_tmp_id.to_i >= 0\n path = create_file_path(file_tmp_id)\n if File.exists? path\n content = IO.read(path)\n end\n end\n \n yield(self,content)\n return content \n end",
"def temp_file(ext='.rb')\n file = Tempfile.new(['pry', ext])\n yield file\nensure\n file.close(true) if file\n File.unlink(\"#{file.path}c\") if File.exists?(\"#{file.path}c\") # rbx\nend",
"def next_tempfile\n p = nil\n Tempfile.open(\"onix\") do |tf|\n tf.close\n p = tf.path\n end\n p\n end",
"def seperate_file(filename, tmp_folder_name)\n handler = File.open(filename,'r')\n\n\n end",
"def tempfile\n ::Tempfile.new(filename, tempfile_path).tap do |tmp|\n tmp.binmode\n tmp.write(blob)\n tmp.close\n end\n end",
"def tmpfile(*args); end",
"def file\r\n LocalFile\r\n end",
"def open\n @tmpfile.close if @tmpfile\n @tmpfile = File.open(@tmpname, @mode, @opts)\n __setobj__(@tmpfile)\n end",
"def gen_tempfile_path\n tf = Tempfile.new('filechanges.tgz')\n tf_path = tf.path\n tf.close\n tf.unlink\n tf_path\n end",
"def get_file(filename, &block)\n if block_given?\n http.get(200, luwak, escape(filename), &block)\n nil\n else\n tmpfile = LuwakFile.new(escape(filename))\n begin\n response = http.get(200, luwak, escape(filename)) do |chunk|\n tmpfile.write chunk\n end\n tmpfile.content_type = response[:headers]['content-type'].first\n tmpfile\n ensure\n tmpfile.close\n end\n end\n end",
"def with_tmp_zip_file\n file = Tempfile.new('retrieve')\n begin\n file.binmode\n file.write(zip_file)\n file.rewind\n yield file\n ensure\n file.close\n file.unlink\n end\n end",
"def create_tmp_file(comment)\n file = Tempfile.new('foo')\n file.write(comment)\n file.close\n\n file.path\nend",
"def create_temp_file\n copy_to_temp_file full_filename\n end",
"def get_file(path)\n remove_file path\n resource = File.join(TEMPLATE_HOST, TEMPLATE_BRANCH, 'files', path)\n create_file path, download_resource(resource)\nend",
"def sprint_temp_file(type)\n file_name = \"#{Time.now.to_f}.#{self.class.default_ext(type)}\"\n File.join(msg_tmp_dir(),File.basename(file_name))\n end",
"def generate_tmp_file\n FileUtils.mkdir_p(local_tmp_dir) unless File.exists?(local_tmp_dir)\n #TODO avoid name collision\n stored = File.new(local_file_pathname, 'wb')\n stored.write s3_obj.read\n stored.close\n # Download and write the file in blocks off the HTTP Response (see S3Object.read in aws-sdk docs)\n # File.open(local_file_pathname, 'w') do |file|\n # s3_obj.read do |chunk|\n # file.write(chunk)\n # end\n # file\n # end\n end",
"def temp_file_from_name(file_name)\n File.join(@temp_dir, file_name).to_s\n end",
"def get\n file\n end",
"def path\n Path.new(@tmpname)\n end",
"def get\n uploaded_file(read) if read\n end",
"def tempfile=(_arg0); end",
"def get_tempfile(content)\n tmp = ASUtils.tempfile(\"doc-#{Time.now.to_i}\")\n tmp.write(content)\n tmp.flush\n $icky_hack_to_avoid_gc ||= []\n $icky_hack_to_avoid_gc << tmp\n tmp\n end",
"def download\n \n @tmpfile = fetch_remote(location)\n \n @fetched_at = Time.new\n \n return @tmpfile\n \n end",
"def remote_tmp_path\n '/tmp'\n end",
"def get_file(path, options={})\n remove_file path\n resource = File.join(prefs[:remote_host], prefs[:remote_branch], 'files', path)\n replace_file path, download_resource(resource, options)\nend",
"def temp_value #:nodoc:\n if tempfile?\n if original_filename\n %(#{@temp_name}/#{filename};#{original_filename})\n else\n %(#{@temp_name}/#{filename})\n end\n end\n end",
"def with_tmpfile\n path = [@file, $$.to_s(36), Thread.current.object_id.to_s(36)].join\n file = File.open(path, 'wb')\n yield(path, file)\n ensure\n file.close unless file.closed?\n File.unlink(path) if File.exists?(path)\n end",
"def temp_file(prefix_suffix = nil, *args, &block)\n prefix_suffix = fix_prefix_suffix(prefix_suffix || 'f')\n Tempfile.open(self, prefix_suffix, *args, &block)\n end",
"def temporary_file(contents=nil)\n f = Tempfile.new(\"vagrant-unit\")\n\n if contents\n f.write(contents)\n f.flush\n end\n\n # Store the tempfile in an instance variable so that it is not\n # garbage collected, so that the tempfile is not unlinked.\n @_temp_files << f\n\n return Pathname.new(f.path)\n end",
"def get_file(path, local_file_path)\n path = File.join('/', path)\n response = nil\n File.open(local_file_path, \"w\") do |file|\n file.binmode if file.respond_to?(:binmode)\n response = self.class.get(path, request_options.merge!(stream_body: true)) do |fragment|\n file.write(fragment)\n end\n end\n notify_of_error(response, \"getting file. #{path}\") if response && response.code != 200\n end",
"def access_path\n @tempfile_path || path\n end",
"def create_temp_file(basename = '__pdf.html.object',ext = 'html',tmpdir = Dir::tmpdir,mode = 'wb')\r\n @@_temp_file_mutex ||= Mutex.new\r\n\r\n failures = n = 0\r\n begin\r\n @@_temp_file_mutex.lock\r\n begin\r\n tmpname = File.join(tmpdir, sprintf('%s.%d.%d.%s', basename, $$, n, ext))\r\n n += 1\r\n end while File.exists?(tmpname)\r\n return File.open(tmpname,mode)\r\n rescue\r\n failures += 1\r\n retry if failures < 10\r\n raise ZPdf::RenderError.new(\"ZPdf::HtmlPdfObject cannot create temp file\")\r\n ensure\r\n @@_temp_file_mutex.unlock\r\n end\r\n end",
"def file\n @file\n end",
"def get_data\n buffer = 4096\n\n return tmp if read(@filehandle, tmp, buffer)\n\n # No data to return\n return nil\n end",
"def file\n return @file\n end",
"def file\n return @file\n end",
"def temp_file(ext = '.rb')\n file = Tempfile.new(['pry', ext])\n yield(file)\n ensure\n file.close(true)\n end",
"def request_file\n @queue.shift\n end",
"def recieve_and_read_file\n read_file(@message)\n end",
"def method_missing(method_name, *args, &block)\n tempfile.public_send(method_name, *args, &block)\n end",
"def file(options = {})\r\n options[:file_name] ||= 'pass.mswallet'\r\n temp_file = Tempfile.new(options[:file_name])\r\n temp_file.write self.stream.string\r\n temp_file.close\r\n temp_file\r\n end",
"def buffer\n @buffer ||= Tempfile.new(\"#{SecureRandom.hex(4)}.csv\")\n end",
"def temp_file_path(prefix_suffix = nil, *args)\n if block_given?\n temp_file(prefix_suffix, *args) do |file|\n file.close\n yield file.path\n end\n else\n file = temp_file(prefix_suffix, *args)\n file.close\n path = file.path\n path.instance_variable_set(:@__temp_file, file)\n path\n end\n end",
"def get_file(uri, dest_dir)\n response = get_client(uri, Net::HTTP::Get, :get)[URI.escape(uri)].get :accept => \"application/zip\"\n filename = response.headers[:content_disposition] == nil ? \"tmp_#{rand}.zip\" : response.headers[:content_disposition].split(\"filename=\")[1]\n filename = File.join(dest_dir, filename)\n File.open(filename, 'w') { |f| f.write(response.body) }\n filename\n end",
"def get_local_file(fname)\n if File.exist?(@dir+'/'+fname) then\n fname = @dir+'/'+fname\n end\n return File.open(fname)\n end",
"def get_file(from, to)\n run_session do |ssh|\n $log&.debug(\"#{self.class}##{__method__} - Copying file #{host}:#{from} to #{to}.\")\n data = ssh.sftp.download!(from, to)\n $log&.debug(\"#{self.class}##{__method__} - Copying of #{host}:#{from} to #{to}, complete.\")\n return data\n end\n end",
"def create_temp_url(file, expires = Time.now.to_i + 600, account_meta_key = @account_meta_key)\n \n # Generate tempURL\n method = 'GET'\n \n public_url = URI(file.public_url)\n base = \"#{public_url.scheme}://#{public_url.host}/\"\n path = public_url.path\n\n hmac_body = \"#{method}\\n#{expires}\\n#{path}\"\n sig = Digest::HMAC.hexdigest(hmac_body, account_meta_key, Digest::SHA1)\n\n \"#{file.public_url}?temp_url_sig=#{sig}&temp_url_expires=#{expires}\"\n end",
"def temp_file(ext='.rb')\n file = Tempfile.new(['pry', ext])\n yield file\n ensure\n file.close(true) if file\n end",
"def tmpfile_path(filename)\n # Ensure that the ?dl=1 parameter is removed\n Pathname.new(Dir.tmpdir).join(\n filename.sub(DOWNLOAD_PARAMETER_REGEX, \"\")\n )\n end",
"def temp_path(filename)\n \"#{Rails.root}/tmp/import-#{filename}.xlsx\"\n end",
"def file() nil; end",
"def tmp_file\n counter = 1\n path = nil\n dir = Rails.root + \"/tmp/pdfs\"\n FileUtils.mkdir_p(dir)\n dir = Pathname.new(dir).realpath\n while path.nil? || File.file?(path)\n path = \"#{dir}/pdf-#{counter}\"\n counter += 1\n end\n path\n end",
"def download\n return file if file\n\n self.file = retrieve_file\n end",
"def generic_file\n # TODO: This should be in its own job, not this event job\n @generic_file ||= begin\n file = ::GenericFile.find(id)\n file.proxy_depositor = file.depositor\n file.clear_permissions! if reset\n file.apply_depositor_metadata(login)\n file.save!\n file\n end\n end",
"def create_temp_file\n write_to_temp_file current_data\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def tmpio\n fp = begin\n TmpIO.open(\"#{Dir::tmpdir}/#{rand}\",\n File::RDWR|File::CREAT|File::EXCL, 0600)\n rescue Errno::EEXIST\n retry\n end\n File.unlink(fp.path)\n fp.binmode\n fp.sync = true\n fp\n end",
"def path\n @unlinked ? nil : @tmpfile.path\n end",
"def get_file(path)\n return File.new(path)\n end",
"def download_blob_to_tempfile(&block); end",
"def download_blob_to_tempfile(&block); end",
"def filedata= fd\n fd.rewind\n @pending_file_data = fd.read\n @original_name = fd.original_filename\n end",
"def open\n @tmpfile.close if @tmpfile\n \n # dbeswick\n mode = if !@binary\n 'r+'\n else\n 'r+b'\n end\n \n @tmpfile = _open_file(@tmpname, mode)\n @data[1] = @tmpfile\n __setobj__(@tmpfile)\n end",
"def get_file(file_id)\n\tputs \"Getting file: \" + file_id\n\tresponse = request_get('/api/partner/file/' + file_id)\n\tputs response.body\nend",
"def tmp_filename(user = current_user)\n \"#{ENCLOSURE_PATH}tmp_#{user.login}\"\n end",
"def write_temporary_file(file_attr)\n config = self.class.cached_uploads[file_attr.to_sym]\n file = send file_attr\n \n if file.present?\n # Read the uploaded file, calc its MD5, and write the MD5 instance variable.\n file.rewind\n md5 = Digest::MD5.hexdigest(file.read)\n send \"#{config[:tmp_md5_attr]}=\", md5\n \n # Write the temporary file, using its MD5 hash to generate the filename.\n file.rewind\n File.open(send(config[:tmp_path_method]), 'wb') do |out_file|\n out_file.write file.read\n end\n else\n raise \"Called #write_temporary_file(:#{file_attr}), but ##{file_attr} was not present.\"\n end\n end",
"def download_original ; path_download_file(:original).download end",
"def temporary_path(filename)\n Global.temporary_directory + filename\n end",
"def create_download_file\n download = initiate_download\n\n File.open(\"#{file_path_and_name}.tmp\", \"wb\") do |file|\n fail Geoblacklight::Exceptions::WrongDownloadFormat unless matches_mimetype?(download)\n file.write download.body\n end\n File.rename(\"#{file_path_and_name}.tmp\", file_path_and_name)\n file_name\n rescue Geoblacklight::Exceptions::WrongDownloadFormat => error\n Geoblacklight.logger.error \"#{error} expected #{@options[:content_type]} \" \\\n \"received #{download.headers[\"content-type\"]}\"\n File.delete(\"#{file_path_and_name}.tmp\")\n raise Geoblacklight::Exceptions::ExternalDownloadFailed, message: \"Wrong download type\"\n end",
"def get_file(from, to)\n run_session do |ssh|\n $log&.debug(\"MiqSshUtil::get_file - Copying file #{@host}:#{from} to #{to}.\")\n data = ssh.sftp.download!(from, to)\n $log&.debug(\"MiqSshUtil::get_file - Copying of #{@host}:#{from} to #{to}, complete.\")\n return data\n end\n end",
"def send_file(path); end",
"def to_file\n replace_with_tempfile unless @tempfile_in\n flush\n self\n end",
"def file\n @zip_fs_file\n end",
"def temp_file(extension)\n File.join(@temp_dir, ::SecureRandom.hex(7) + '.' + extension.trim('.', '')).to_s\n end",
"def uploaded_file(path, content_type=\"application/octet-stream\", filename=nil)\n filename ||= File.basename(path)\n t = Tempfile.new(filename)\n FileUtils.copy_file(path, t.path)\n (class << t; self; end;).class_eval do\n alias local_path path\n define_method(:original_filename) { filename }\n define_method(:content_type) { content_type }\n end\n return t\n end",
"def uploaded_file(path, content_type=\"application/octet-stream\", filename=nil)\n filename ||= File.basename(path)\n t = Tempfile.new(filename)\n FileUtils.copy_file(path, t.path)\n (class << t; self; end;).class_eval do\n alias local_path path\n define_method(:original_filename) { filename }\n define_method(:content_type) { content_type }\n end\n return t\n end",
"def get_file(filename, options={})\n end",
"def file\n FILE\n end"
] | [
"0.7691312",
"0.7332111",
"0.6890964",
"0.6890964",
"0.6821964",
"0.6816823",
"0.6810895",
"0.6745262",
"0.66822535",
"0.659709",
"0.6517863",
"0.64941216",
"0.64708686",
"0.64658666",
"0.64645886",
"0.64344466",
"0.64258504",
"0.6425363",
"0.6417232",
"0.6406318",
"0.637572",
"0.63714314",
"0.63680685",
"0.6342554",
"0.63301206",
"0.63267934",
"0.6295485",
"0.62905455",
"0.6284484",
"0.6258104",
"0.6255019",
"0.6247275",
"0.6243937",
"0.62411284",
"0.62326527",
"0.6217781",
"0.6215692",
"0.6215321",
"0.6183272",
"0.6162139",
"0.6157148",
"0.61404914",
"0.6135341",
"0.6128693",
"0.6127794",
"0.61251354",
"0.61219937",
"0.61145395",
"0.6102696",
"0.60839814",
"0.6077309",
"0.60575944",
"0.6054321",
"0.60232306",
"0.6019363",
"0.6019363",
"0.6009213",
"0.6001768",
"0.59987134",
"0.5986675",
"0.59845334",
"0.59812987",
"0.5973461",
"0.59722066",
"0.5962724",
"0.59483486",
"0.594469",
"0.59440494",
"0.59435153",
"0.5938518",
"0.5937223",
"0.5931489",
"0.59289336",
"0.5916169",
"0.5912611",
"0.5906637",
"0.5906637",
"0.5906637",
"0.5906637",
"0.5900575",
"0.5892593",
"0.58904",
"0.5883615",
"0.5883615",
"0.587735",
"0.5875528",
"0.5875042",
"0.5865545",
"0.58650315",
"0.5864255",
"0.58591634",
"0.58561885",
"0.58505714",
"0.58440113",
"0.58398557",
"0.5838494",
"0.583818",
"0.5837667",
"0.5837667",
"0.5831606",
"0.5831022"
] | 0.0 | -1 |
Returns the directory where tmp files are stored for this UploadedFile, relative to :root_dir | def relative_tmp_dir
parse_dir_options(:tmp_dir)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tmp_dir\n File.expand_path(self.relative_tmp_dir, @options[:root_dir])\n end",
"def tmp_dir\n @tmp_dir ||= root / 'tmp'\n end",
"def get_tmp_dir\n return \"#{Dir.tmpdir}/FilesRebuilder\"\n end",
"def tmp_dir\n return Dir.tmpdir if path_of('tmp_dir').nil?\n return path_of('tmp_dir')\n end",
"def temp_dir\n name = 'tmp_' + rand.to_s.gsub(/\\D/, '')\n File.join(@temp_root, name)\n end",
"def tmp_root_path\n @tmp_root_path ||= File.realpath(Dir.mktmpdir)\n end",
"def get_temp_directory\n defined?(Rails) ? \"#{Rails.root}/tmp\" : \"/tmp\"\n end",
"def publish_tmp_dir_path()\n user_tmp_dir_container = ENV['DOCS_TMP_DIR_CONTAINER']\n if (not user_tmp_dir_container.nil?) && user_tmp_dir_container.length > 0\n subdir = File.join(\n user_tmp_dir_container,\n SecureRandom.uuid\n )\n else\n subdir = SecureRandom.uuid\n end\n\n return File.join(\n Dir.tmpdir(),\n subdir\n )\n end",
"def dir_path\n RAILS_ROOT + '/temp_files/' + Digest::MD5.hexdigest(self.id.to_s)[0..1] + '/'\n end",
"def tmp_path\n File.join gem_root, 'tmp'\n end",
"def app_tmp_dir\n base_dir = app_sandbox_dir\n if base_dir.nil?\n nil\n else\n File.join(base_dir, 'tmp')\n end\n end",
"def tmp_path\n root_path.join('tmp')\nend",
"def get_tmp_path(temp_path)\n if not temp_path\n temp_path = Dir.tmpdir\n end\n\n Mongolicious.logger.info(\"Using #{temp_path} as root for our temp backup.\")\n return \"#{temp_path}/#{Time.now.to_i}\"\n end",
"def lock_dir\n File.join(Dir.home, \"tmp\")\n end",
"def store_dir\n raise \"Can't upload files for an unknown user!\" unless model.user\n @store_dir = File.join(model.user.upload_dir, mounted_as.to_s, model.id.to_s)\n return @store_dir\n end",
"def store_dir\n\t\t\"magic_beans/upload/tmp/#{model.id}\"\n\tend",
"def local_path\n TMP_PATH\n end",
"def tmp_path\n File.expand_path(@dirs.first.to_s)\nend",
"def tempdir #:doc:\n Dir.tmpdir\n end",
"def store_dir\n if Rails.env == \"production\"\n ENV['CONFIG_FILE_UPLOAD_PATH']\n else\n \"uploads\"\n end\n end",
"def files_dir\n return File.absolute_path(File.join(@root_dir, 'lib', 'files'))\n end",
"def store_dir\n \"#{Rails.root}/tmp/upload/\"\n end",
"def tmp_path\n Berkshelf.root.join(\"spec/tmp\")\n end",
"def tempdir_name\n dir = File.join(Dir.tmpdir, SecureRandom.uuid)\n refute(Dir.exists?(dir))\n dir\n end",
"def temporary_directory\n \"#{ROOT}/spec/tmp\"\n end",
"def store_dir\n base_dir = ENV.fetch('FILE_STORE_DIR', \"uploads\")\n if base_dir != \"uploads\"\n public_uploads = File.join(Rails.root, \"public\", \"uploads\")\n FileUtils.symlink(base_dir, public_uploads) unless File.symlink?(public_uploads)\n base_dir = public_uploads\n end\n \"#{base_dir}/#{Rails.env}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def file_cache_dir\n @file_cache_dir || FileHelper.tmpdir\n end",
"def tmp_resource_dir(path)\n @tmp_resource_dir = \"#{tmp_dir}/#{path}\" unless path.blank?\n end",
"def store_dir\n configured_upload_path + \"#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def tmpdir\n used? ? File.join(DOCKER_MACHINE_DOCKER_HOME, 'tmp', Dir.tmpdir) : Dir.tmpdir\n end",
"def tmp_path(path)\n return File.expand_path(File.join(@@config['tmpPath'], path))\n end",
"def store_dir\n Rails.root + \"app/assets/tmp/#{model.id}\"\n end",
"def temp_mounted_path\n mounted_path.sub(\"#{archive_file_name}#{ArchiveMountSuffix}\", \".tmp-#{archive_file_name}#{ArchiveMountSuffix}\")\n end",
"def get_tmp_path\n \"#{Dir.tmpdir}/#{Time.now.to_i * rand}\"\n end",
"def remote_tmp_path\n '/tmp'\n end",
"def temp_dir\n if @temp_dir.nil?\n @@get_temp_dir_api = Win32::API.new('GetTempPath', 'LP', 'L') unless @@get_temp_dir_api\n buffer = 0.chr * MAX_PATH\n @@get_temp_dir_api.call(buffer.length, buffer)\n @temp_dir = pretty_path(buffer.unpack('A*').first.chomp('\\\\'))\n end\n rescue\n @temp_dir = File.join(Dir::WINDOWS, \"temp\")\n ensure\n return @temp_dir\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def tmpdir\n @tmpdir ||= File.join(Dir.tmpdir, 'sample_file', 'image')\n end",
"def cache_dir\n \"#{Rails.root}/tmp/uploads\"\n end",
"def store_dir\n \"#{Rails.root}/app/files/uploads/#{ENV['PROJECT_ID']}/\"\n end",
"def tmpdir\n @tmpdir ||= configuration[:copy_dir] || Dir.tmpdir\n end",
"def tmpdir\n @tmpdir ||= configuration[:copy_dir] || Dir.tmpdir\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n '%suploads/peoplefinder/%s/%s/%s' % [\n base_upload_dir,\n model.class.to_s.underscore,\n mounted_as_without_legacy_prefix,\n model.id\n ]\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{partition_dir(model.id)}/#{model.id}\"\n end",
"def root_path\n Pathname.new(upload_path_value).join(search_directory)\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\" \n end",
"def cache_dir\n \"#{Rails.root}/tmp/uploads\"\n end",
"def cache_dir\n \"#{Rails.root}/tmp/uploads\"\n end",
"def cache_dir\n \"#{Rails.root}/tmp/uploads\"\n end",
"def cache_dir\n \"#{Rails.root}/tmp/uploads\"\n end",
"def cache_dir\n \"#{Rails.root}/tmp/uploads\"\n end",
"def tmpdir_for_with_input_file\n expected_size = binary_size || current_root.size(storage_key)\n if expected_size > 500.megabytes\n StorageManager.instance.tmpdir\n else\n Dir.tmpdir\n end\n end",
"def store_dir\n \"uploads/#{model.request_id}\"\n end",
"def store_dir\n\t\t\"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n\tend",
"def store_dir\n cls = \"#{model.class.to_s.underscore}\"\n \"uploads/#{Rails.env}/#{cls}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"system/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"system/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n if model.is_a?(Asset) && !model.theme_id.blank?\n \"uploads/#{model.class.to_s.underscore}/#{model.theme_id}\"\n else\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end\n end",
"def store_dir\n sub_dir = model.id % 100 # 100 dirs for all images\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{sub_dir}\"\n end",
"def store_dir\n \"assets/#{Site.current.key}/uploads/\"\n end",
"def store_dir\r\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\r\n end",
"def store_dir\r\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\r\n end",
"def generate_temp_dir\n empty_directory File.join(Rails.root, \"tmp\", \"fusioncharts\")\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.attachable_type}/#{model.attachable_id}/#{mounted_as}/#{model.id}\"\n end",
"def root_dir\n is_rails? ? Rails.root.to_s : Dir.pwd.to_s\n end",
"def make_tmp_dir\n if(!File.directory? @temp_dir)\n Dir.mkdir(@temp_dir)\n end\n end",
"def root_dir\n superblock.root_dir\n end",
"def store_dir\n 'file_uploads'\n end",
"def store_dir\n format(\n '%suploads/peoplefinder/%s/%s/%s',\n base_upload_dir,\n model.class.to_s.underscore,\n mounted_as_without_legacy_prefix,\n model.id\n )\n end",
"def store_dir\n # \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n # This works for the file storage as well as Amazon S3 and Rackspace Cloud Files.\n # Define store_dir as nil if you'd like to store files at the root level.\n nil\n end",
"def cache_dir\n Padrino.root(\"tmp\")\n end",
"def cache_dir\n Padrino.root(\"tmp\")\n end",
"def files_dir\n return File.absolute_path(File.join(@root_dir, 'weather'))\n end",
"def clean_dir_root\n File.join(root_dir, \"test\", \"tmp\", \"cleanreps\")\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end"
] | [
"0.8917042",
"0.80941606",
"0.8021649",
"0.79896575",
"0.79452497",
"0.77799755",
"0.769591",
"0.7695052",
"0.7612141",
"0.7512705",
"0.74828345",
"0.733629",
"0.7198152",
"0.71881074",
"0.7181632",
"0.7140849",
"0.71403235",
"0.7123725",
"0.7115414",
"0.70686316",
"0.7038196",
"0.7019252",
"0.701699",
"0.6909864",
"0.68836385",
"0.6873432",
"0.6870871",
"0.68537873",
"0.6806695",
"0.68061626",
"0.67903394",
"0.6771995",
"0.67636657",
"0.6759508",
"0.6741902",
"0.67281365",
"0.67215216",
"0.67215216",
"0.67215216",
"0.67215216",
"0.67215216",
"0.6709002",
"0.6703866",
"0.6690739",
"0.6673931",
"0.6673931",
"0.6672669",
"0.6655975",
"0.6649632",
"0.6648114",
"0.66184765",
"0.66159165",
"0.66159165",
"0.66159165",
"0.66159165",
"0.66159165",
"0.66106606",
"0.6608502",
"0.6591167",
"0.65836364",
"0.6580154",
"0.6580154",
"0.65774757",
"0.6573363",
"0.65728724",
"0.6557585",
"0.6557585",
"0.65492517",
"0.65453756",
"0.6541628",
"0.6536203",
"0.6516964",
"0.6512364",
"0.6505977",
"0.65057456",
"0.650138",
"0.650138",
"0.65010774",
"0.6485655",
"0.64811987",
"0.64811987",
"0.64811987",
"0.64811987",
"0.64811987",
"0.64811987",
"0.64811987",
"0.64811987",
"0.64811987",
"0.64811987",
"0.64811987",
"0.64811987",
"0.64811987",
"0.64811987",
"0.64811987",
"0.64811987",
"0.64811987",
"0.64811987",
"0.64811987",
"0.64811987",
"0.64811987"
] | 0.7826861 | 5 |
Returns the directory where tmp files are stored for this UploadedFile | def tmp_dir
File.expand_path(self.relative_tmp_dir, @options[:root_dir])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tmp_dir\n return \"#{Dir.tmpdir}/FilesRebuilder\"\n end",
"def tmp_dir\n return Dir.tmpdir if path_of('tmp_dir').nil?\n return path_of('tmp_dir')\n end",
"def temp_dir\n name = 'tmp_' + rand.to_s.gsub(/\\D/, '')\n File.join(@temp_root, name)\n end",
"def tmp_dir\n @tmp_dir ||= root / 'tmp'\n end",
"def get_temp_directory\n defined?(Rails) ? \"#{Rails.root}/tmp\" : \"/tmp\"\n end",
"def relative_tmp_dir\n parse_dir_options(:tmp_dir)\n end",
"def tmp_path\n File.join gem_root, 'tmp'\n end",
"def dir_path\n RAILS_ROOT + '/temp_files/' + Digest::MD5.hexdigest(self.id.to_s)[0..1] + '/'\n end",
"def publish_tmp_dir_path()\n user_tmp_dir_container = ENV['DOCS_TMP_DIR_CONTAINER']\n if (not user_tmp_dir_container.nil?) && user_tmp_dir_container.length > 0\n subdir = File.join(\n user_tmp_dir_container,\n SecureRandom.uuid\n )\n else\n subdir = SecureRandom.uuid\n end\n\n return File.join(\n Dir.tmpdir(),\n subdir\n )\n end",
"def store_dir\n\t\t\"magic_beans/upload/tmp/#{model.id}\"\n\tend",
"def tmp_path\n File.expand_path(@dirs.first.to_s)\nend",
"def app_tmp_dir\n base_dir = app_sandbox_dir\n if base_dir.nil?\n nil\n else\n File.join(base_dir, 'tmp')\n end\n end",
"def local_path\n TMP_PATH\n end",
"def remote_tmp_path\n '/tmp'\n end",
"def tmp_path\n root_path.join('tmp')\nend",
"def tmp_path\n Berkshelf.root.join(\"spec/tmp\")\n end",
"def store_dir\n raise \"Can't upload files for an unknown user!\" unless model.user\n @store_dir = File.join(model.user.upload_dir, mounted_as.to_s, model.id.to_s)\n return @store_dir\n end",
"def tempdir #:doc:\n Dir.tmpdir\n end",
"def store_dir\n \"#{Rails.root}/tmp/upload/\"\n end",
"def lock_dir\n File.join(Dir.home, \"tmp\")\n end",
"def store_dir\n if Rails.env == \"production\"\n ENV['CONFIG_FILE_UPLOAD_PATH']\n else\n \"uploads\"\n end\n end",
"def tmp_root_path\n @tmp_root_path ||= File.realpath(Dir.mktmpdir)\n end",
"def tempdir_name\n dir = File.join(Dir.tmpdir, SecureRandom.uuid)\n refute(Dir.exists?(dir))\n dir\n end",
"def get_tmp_path(temp_path)\n if not temp_path\n temp_path = Dir.tmpdir\n end\n\n Mongolicious.logger.info(\"Using #{temp_path} as root for our temp backup.\")\n return \"#{temp_path}/#{Time.now.to_i}\"\n end",
"def file_cache_dir\n @file_cache_dir || FileHelper.tmpdir\n end",
"def store_dir\n \"uploads/#{model.request_id}\"\n end",
"def tmp_path(path)\n return File.expand_path(File.join(@@config['tmpPath'], path))\n end",
"def get_tmp_path\n \"#{Dir.tmpdir}/#{Time.now.to_i * rand}\"\n end",
"def path\n @tmpname\n end",
"def tmp_resource_dir(path)\n @tmp_resource_dir = \"#{tmp_dir}/#{path}\" unless path.blank?\n end",
"def path\n Path.new(@tmpname)\n end",
"def store_dir\n configured_upload_path + \"#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def tmpdir\n @tmpdir ||= File.join(Dir.tmpdir, 'sample_file', 'image')\n end",
"def temp_mounted_path\n mounted_path.sub(\"#{archive_file_name}#{ArchiveMountSuffix}\", \".tmp-#{archive_file_name}#{ArchiveMountSuffix}\")\n end",
"def cache_dir\n \"#{Rails.root}/tmp/uploads\"\n end",
"def store_dir\n Rails.root + \"app/assets/tmp/#{model.id}\"\n end",
"def store_dir\n '%suploads/peoplefinder/%s/%s/%s' % [\n base_upload_dir,\n model.class.to_s.underscore,\n mounted_as_without_legacy_prefix,\n model.id\n ]\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def tmpdir\n used? ? File.join(DOCKER_MACHINE_DOCKER_HOME, 'tmp', Dir.tmpdir) : Dir.tmpdir\n end",
"def temporary_directory\n \"#{ROOT}/spec/tmp\"\n end",
"def tmpdir\n @tmpdir ||= configuration[:copy_dir] || Dir.tmpdir\n end",
"def tmpdir\n @tmpdir ||= configuration[:copy_dir] || Dir.tmpdir\n end",
"def tmp_path\n return @tmp_path if @tmp_path\n\n raise NotImplementedError.new (\"implement this before running on the cluster!\")\n\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def temp_dir\n if @temp_dir.nil?\n @@get_temp_dir_api = Win32::API.new('GetTempPath', 'LP', 'L') unless @@get_temp_dir_api\n buffer = 0.chr * MAX_PATH\n @@get_temp_dir_api.call(buffer.length, buffer)\n @temp_dir = pretty_path(buffer.unpack('A*').first.chomp('\\\\'))\n end\n rescue\n @temp_dir = File.join(Dir::WINDOWS, \"temp\")\n ensure\n return @temp_dir\n end",
"def cache_dir\n \"#{Rails.root}/tmp/uploads\"\n end",
"def cache_dir\n \"#{Rails.root}/tmp/uploads\"\n end",
"def cache_dir\n \"#{Rails.root}/tmp/uploads\"\n end",
"def cache_dir\n \"#{Rails.root}/tmp/uploads\"\n end",
"def cache_dir\n \"#{Rails.root}/tmp/uploads\"\n end",
"def store_dir\n \"#{Rails.root}/app/files/uploads/#{ENV['PROJECT_ID']}/\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.attachable_id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.attachable_type}/#{model.attachable_id}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n 'file_uploads'\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{partition_dir(model.id)}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\" \n end",
"def store_dir\n cls = \"#{model.class.to_s.underscore}\"\n \"uploads/#{Rails.env}/#{cls}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n base_dir = ENV.fetch('FILE_STORE_DIR', \"uploads\")\n if base_dir != \"uploads\"\n public_uploads = File.join(Rails.root, \"public\", \"uploads\")\n FileUtils.symlink(base_dir, public_uploads) unless File.symlink?(public_uploads)\n base_dir = public_uploads\n end\n \"#{base_dir}/#{Rails.env}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n\t\t\"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n\tend",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end",
"def store_dir\n # NOTE that we are storing avatars by wca_id. There are two consequences of this:\n # - A user must have a wca_id to have an avatar (see validations in user.rb).\n # - Changing the wca_id for a user is complicated, and not something we\n # are bothering to handle very well.\n \"uploads/#{model.class.to_s.underscore}/avatar/#{model.wca_id}\"\n end",
"def store_dir\n if model.is_a?(Asset) && !model.theme_id.blank?\n \"uploads/#{model.class.to_s.underscore}/#{model.theme_id}\"\n else\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end\n end",
"def files_dir\n return File.absolute_path(File.join(@root_dir, 'lib', 'files'))\n end",
"def store_dir\r\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\r\n end",
"def store_dir\r\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\r\n end",
"def store_dir\n \"system/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"system/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def tmpdir; end",
"def tempfile_dirnames\n # in why-run mode we need to create a Tempfile to compare against, which we will never\n # wind up deploying, but our enclosing directory for the destdir may not exist yet, so\n # instead we can reliably always create a Tempfile to compare against in Dir::tmpdir\n if Chef::Config[:why_run]\n [ Dir.tmpdir ]\n else\n case Chef::Config[:file_staging_uses_destdir]\n when :auto\n # In auto mode we try the destination directory first and fallback to ENV['TMP'] if\n # that doesn't work.\n [ ::File.dirname(@new_resource.path), Dir.tmpdir ]\n when true\n [ ::File.dirname(@new_resource.path) ]\n when false\n [ Dir.tmpdir ]\n else\n raise Chef::Exceptions::ConfigurationError, \"Unknown setting '#{Chef::Config[:file_staging_uses_destdir]}' for Chef::Config[:file_staging_uses_destdir]. Possible values are :auto, true or false.\"\n end\n end\n end",
"def elasticsearch_hdfs_tmp_dir io\n cleaner = %r{[^\\w/\\.\\-\\+]+}\n io_part = [io.index, io.mapping].compact.map { |s| s.gsub(cleaner, '') }.join('/')\n File.join(settings[:es_tmp_dir] || '/', io_part || '', Time.now.strftime(\"%Y-%m-%d-%H-%M-%S\"))\n end",
"def store_dir\n \"uploads/attachments/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n format(\n '%suploads/peoplefinder/%s/%s/%s',\n base_upload_dir,\n model.class.to_s.underscore,\n mounted_as_without_legacy_prefix,\n model.id\n )\n end",
"def set_tmp_attachments_directory\n Attachment.storage_path = $redmine_tmp_attachments_directory\n end",
"def store_dir\n \"uploads/#{Rails.env}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.uid}\"\n end",
"def tmpdir_for_with_input_file\n expected_size = binary_size || current_root.size(storage_key)\n if expected_size > 500.megabytes\n StorageManager.instance.tmpdir\n else\n Dir.tmpdir\n end\n end",
"def store_dir\n #\"public/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n #\"#{Rails.root}/tmp/uploads\"\n\n #\"#{Rails.root}/tmp/tracks/#{model.id}\"\n \"users/#{model.id}\"\n\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end"
] | [
"0.819052",
"0.8118195",
"0.7872873",
"0.7868546",
"0.78356504",
"0.7819804",
"0.76912093",
"0.76743865",
"0.75486195",
"0.74656415",
"0.7349417",
"0.73411703",
"0.7313828",
"0.7286001",
"0.72314376",
"0.7217275",
"0.7216671",
"0.7206421",
"0.7182542",
"0.71772563",
"0.7115949",
"0.71119255",
"0.70447534",
"0.70242655",
"0.69979066",
"0.699381",
"0.69898677",
"0.69629216",
"0.6933087",
"0.69164",
"0.6895148",
"0.6888023",
"0.6870459",
"0.68663895",
"0.6862972",
"0.6853113",
"0.6850753",
"0.6831536",
"0.6831536",
"0.6831536",
"0.6831536",
"0.6831536",
"0.68262506",
"0.68235683",
"0.6806695",
"0.6806695",
"0.67963785",
"0.67878634",
"0.67853117",
"0.6784624",
"0.6784624",
"0.6784624",
"0.6784624",
"0.6784624",
"0.6764686",
"0.6762105",
"0.676069",
"0.67562705",
"0.6751963",
"0.6743315",
"0.67342395",
"0.6705722",
"0.6705442",
"0.66962993",
"0.66871446",
"0.6686954",
"0.6685614",
"0.6684652",
"0.6684652",
"0.6684146",
"0.6684146",
"0.66804904",
"0.667633",
"0.66458505",
"0.6645244",
"0.66303056",
"0.66214454",
"0.6620382",
"0.66172016",
"0.66170037",
"0.66078705",
"0.66078705",
"0.66078705",
"0.66078705",
"0.66078705",
"0.66078705",
"0.66078705",
"0.66078705",
"0.66078705",
"0.66078705",
"0.66078705",
"0.66078705",
"0.66078705",
"0.66078705",
"0.66078705",
"0.66078705",
"0.66078705",
"0.66078705",
"0.66078705",
"0.66078705"
] | 0.84387743 | 0 |
Returns the directory where files are stored for this UploadedFile, relative to :root_dir | def relative_store_dir
parse_dir_options(:store_dir)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def files_dir\n return File.absolute_path(File.join(@root_dir, 'lib', 'files'))\n end",
"def store_dir\n if Rails.env == \"production\"\n ENV['CONFIG_FILE_UPLOAD_PATH']\n else\n \"uploads\"\n end\n end",
"def store_dir\n raise \"Can't upload files for an unknown user!\" unless model.user\n @store_dir = File.join(model.user.upload_dir, mounted_as.to_s, model.id.to_s)\n return @store_dir\n end",
"def store_dir\n File.expand_path(self.relative_store_dir, @options[:root_dir])\n end",
"def store_dir\n base_dir = ENV.fetch('FILE_STORE_DIR', \"uploads\")\n if base_dir != \"uploads\"\n public_uploads = File.join(Rails.root, \"public\", \"uploads\")\n FileUtils.symlink(base_dir, public_uploads) unless File.symlink?(public_uploads)\n base_dir = public_uploads\n end\n \"#{base_dir}/#{Rails.env}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def files_dir\n return File.absolute_path(File.join(@root_dir, 'weather'))\n end",
"def store_dir\n '%suploads/peoplefinder/%s/%s/%s' % [\n base_upload_dir,\n model.class.to_s.underscore,\n mounted_as_without_legacy_prefix,\n model.id\n ]\n end",
"def store_dir\n format(\n '%suploads/peoplefinder/%s/%s/%s',\n base_upload_dir,\n model.class.to_s.underscore,\n mounted_as_without_legacy_prefix,\n model.id\n )\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def root_path\n Pathname.new(upload_path_value).join(search_directory)\n end",
"def store_dir\n sub_dir = model.id % 100 # 100 dirs for all images\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{sub_dir}\"\n end",
"def store_dir\n configured_upload_path + \"#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{partition_dir(model.id)}/#{model.id}\"\n end",
"def root_dir\n superblock.root_dir\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\" \n end",
"def store_dir\n \"assets/#{Site.current.key}/uploads/\"\n end",
"def store_dir\n \"#{Rails.root}/app/files/uploads/#{ENV['PROJECT_ID']}/\"\n end",
"def basedir\n File.dirname File.absolute_path options[:file]\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.attachable_type}/#{model.attachable_id}/#{mounted_as}/#{model.id}\"\n end",
"def _FILESDIR; Config._FILES; end",
"def store_dir\n if model.is_a?(Asset) && !model.theme_id.blank?\n \"uploads/#{model.class.to_s.underscore}/#{model.theme_id}\"\n else\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end\n end",
"def store_dir\n\t\t\"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n\tend",
"def store_dir\n cls = \"#{model.class.to_s.underscore}\"\n \"uploads/#{Rails.env}/#{cls}/#{mounted_as}/#{model.id}\"\n end",
"def directory\n File.dirname @path\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.attachable_id}\"\n end",
"def containing_directory\n path.dirname\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end",
"def directory\n File.dirname(@path) + '/'\n end",
"def dir\n File.dirname(self.path)\n end",
"def tmp_dir\n File.expand_path(self.relative_tmp_dir, @options[:root_dir])\n end",
"def store_dir\n \"files/#{model.album.path}\"\n end",
"def store_dir\r\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\r\n end",
"def store_dir\r\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\r\n end",
"def store_dir\n # \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n # This works for the file storage as well as Amazon S3 and Rackspace Cloud Files.\n # Define store_dir as nil if you'd like to store files at the root level.\n nil\n end",
"def store_dir\n File.join Rails.root, root_dir, model_dir, partition_dir\n end",
"def dir\n @dir ||= self.class.normalize_dir(::File.dirname(@path))\n end",
"def store_dir\n 'file_uploads'\n end",
"def root_dir\n is_rails? ? Rails.root.to_s : Dir.pwd.to_s\n end",
"def generated_files_dir\n dir(@generated_files_dir || default_generated_files_dir)\n end",
"def get_root_directory\n return @@root_directory\n end",
"def get_root_directory\n return @@root_directory\n end",
"def store_dir\n \"system/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"system/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end"
] | [
"0.8034254",
"0.75140756",
"0.74367803",
"0.7360707",
"0.73503864",
"0.7302906",
"0.72121084",
"0.71303934",
"0.71080935",
"0.71080935",
"0.71080935",
"0.71080935",
"0.71080935",
"0.71036386",
"0.70779467",
"0.70674735",
"0.70621413",
"0.70465064",
"0.69920796",
"0.69803447",
"0.69727707",
"0.69607186",
"0.69574493",
"0.6952756",
"0.69500566",
"0.69465625",
"0.69374895",
"0.69257873",
"0.69078505",
"0.6901364",
"0.69008046",
"0.68943083",
"0.68868667",
"0.6886439",
"0.6861595",
"0.68545413",
"0.6851812",
"0.6851812",
"0.6844704",
"0.6844039",
"0.6837227",
"0.68346393",
"0.68308794",
"0.6812544",
"0.68088496",
"0.68088496",
"0.6804345",
"0.6804345",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566",
"0.67973566"
] | 0.0 | -1 |
Returns the directory where files are stored for this UploadedFile | def store_dir
File.expand_path(self.relative_store_dir, @options[:root_dir])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def files_dir\n return File.absolute_path(File.join(@root_dir, 'lib', 'files'))\n end",
"def store_dir\n if Rails.env == \"production\"\n ENV['CONFIG_FILE_UPLOAD_PATH']\n else\n \"uploads\"\n end\n end",
"def store_dir\n raise \"Can't upload files for an unknown user!\" unless model.user\n @store_dir = File.join(model.user.upload_dir, mounted_as.to_s, model.id.to_s)\n return @store_dir\n end",
"def store_dir\n '%suploads/peoplefinder/%s/%s/%s' % [\n base_upload_dir,\n model.class.to_s.underscore,\n mounted_as_without_legacy_prefix,\n model.id\n ]\n end",
"def directory\n File.dirname @path\n end",
"def store_dir\n format(\n '%suploads/peoplefinder/%s/%s/%s',\n base_upload_dir,\n model.class.to_s.underscore,\n mounted_as_without_legacy_prefix,\n model.id\n )\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.attachable_id}\"\n end",
"def containing_directory\n path.dirname\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.attachable_type}/#{model.attachable_id}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n base_dir = ENV.fetch('FILE_STORE_DIR', \"uploads\")\n if base_dir != \"uploads\"\n public_uploads = File.join(Rails.root, \"public\", \"uploads\")\n FileUtils.symlink(base_dir, public_uploads) unless File.symlink?(public_uploads)\n base_dir = public_uploads\n end\n \"#{base_dir}/#{Rails.env}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{partition_dir(model.id)}/#{model.id}\"\n end",
"def store_dir\n configured_upload_path + \"#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\" \n end",
"def store_dir\n \"uploads/#{model.request_id}\"\n end",
"def store_dir\n cls = \"#{model.class.to_s.underscore}\"\n \"uploads/#{Rails.env}/#{cls}/#{mounted_as}/#{model.id}\"\n end",
"def file_dir\n 'files'\n end",
"def directory\n self.path.directory\n end",
"def file_path\n dir\n end",
"def store_dir\n \"files/#{model.album.path}\"\n end",
"def store_dir\n if model.is_a?(Asset) && !model.theme_id.blank?\n \"uploads/#{model.class.to_s.underscore}/#{model.theme_id}\"\n else\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end\n end",
"def store_dir\n\t\t\"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n\tend",
"def store_dir\n 'file_uploads'\n end",
"def store_dir\n \"uploads/attachments/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def directory\n File.dirname(@path) + '/'\n end",
"def dir\n File.dirname(self.path)\n end",
"def store_dir\n sub_dir = model.id % 100 # 100 dirs for all images\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{sub_dir}\"\n end",
"def store_dir\n \"#{Rails.root}/app/files/uploads/#{ENV['PROJECT_ID']}/\"\n end",
"def store_dir\r\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\r\n end",
"def store_dir\r\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\r\n end",
"def generated_files_dir\n dir(@generated_files_dir || default_generated_files_dir)\n end",
"def files_dir\n return File.absolute_path(File.join(@root_dir, 'weather'))\n end",
"def store_dir\n if model.class.name == 'Monologue::Post'\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n else\n \"uploads/#{model.imageable.class.name}/#{mounted_as}/#{model.id}\"\n end\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}_#{mounted_as.to_s.pluralize}\"\n end",
"def folder\n if Rails.configuration.respond_to?(:echo_uploads) and Rails.configuration.echo_uploads.folder\n Rails.configuration.echo_uploads.folder\n else\n ::File.join Rails.root, 'echo_uploads', Rails.env\n end\n end",
"def store_dir\n \"assets/#{Site.current.key}/uploads/\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end"
] | [
"0.7729136",
"0.76253194",
"0.75435305",
"0.74663854",
"0.7353605",
"0.7321854",
"0.730594",
"0.730594",
"0.730594",
"0.730594",
"0.730594",
"0.7293797",
"0.72683626",
"0.7263094",
"0.72493297",
"0.724176",
"0.7221386",
"0.7217307",
"0.71907794",
"0.7182425",
"0.717423",
"0.71661603",
"0.715454",
"0.7150245",
"0.7145114",
"0.7140301",
"0.7128452",
"0.7128436",
"0.71283424",
"0.7128143",
"0.71271646",
"0.7093326",
"0.7069516",
"0.70571506",
"0.7039887",
"0.7039887",
"0.7029968",
"0.7022426",
"0.7017895",
"0.70157576",
"0.70118386",
"0.7004776",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906",
"0.6995906"
] | 0.0 | -1 |
Returns the path of the file relative to :root_dir | def relative_path
self.path.sub(File.expand_path(options[:root_dir]) + '/', '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def root_file_path; end",
"def file_root(path = '')\n File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', path))\n end",
"def root_path(path) File.join(root, path) end",
"def relroot\n Pathname.new(File.expand_path(path)).\n relative_path_from(Pathname.new(File.expand_path(root))).to_s\n end",
"def root\n Pathname.new(File.dirname(__dir__))\n end",
"def root_path\n @root_path ||= File.expand_path(File.join('.', '../..'))\n end",
"def root_file\n File.find(name) or raise 'No root file!'\n end",
"def get_root\n return File.join('/root/path', SETTINGS[:project])\n end",
"def root_path\n path = File.join(File.dirname(__FILE__), '../')\n Pathname.new(path).realpath\nend",
"def root\n '../' * file.count('/')\n end",
"def root_path\n Pathname.new(File.expand_path(File.join(__dir__, '..', '..')))\nend",
"def root\n File.expand_path(File.dirname(File.dirname(File.dirname(__dir__))))\n end",
"def path\n real_path = Pathname.new(root).realpath.to_s\n full_path.sub(%r{^#{real_path}/}, '')\n end",
"def root; Pathname(__dir__).parent; end",
"def relative_directory\n return '' unless @directory_root\n @path - @directory_root - name\n end",
"def root\n File.dirname __dir__\n end",
"def root\n File.dirname __dir__\n end",
"def root\n File.expand_path(File.dirname(__dir__))\n end",
"def fullpath\n File.join(@root, @path)\n end",
"def root\n File.dirname(__FILE__)\n end",
"def root\n Dir.pwd\n end",
"def root\n File.dirname __dir__\n end",
"def files_dir\n return File.absolute_path(File.join(@root_dir, 'lib', 'files'))\n end",
"def root\n Pathname.new File.expand_path('../../', File.dirname(__FILE__))\n end",
"def root\n File.expand_path '../../..', __FILE__\n end",
"def root_path(*args)\n relative = File.join(*args)\n return relative if relative.expand_path == relative\n root.expand_path / relative\n end",
"def root_path(*args)\n relative = File.join(*args)\n return relative if relative.expand_path == relative\n root.expand_path / relative\n end",
"def file\n File.join(root, FILENAME)\n end",
"def basedir\n return nil if !file\n File.dirname File.absolute_path @file\n end",
"def file_path\n File.join(dir,filename)\n end",
"def path()\n return ::File.join(@root, @name)\n end",
"def file_path\n dir\n end",
"def basedir\n File.dirname File.absolute_path options[:file]\n end",
"def root_path\n @root_path ||= `git rev-parse --show-toplevel`.chomp\n end",
"def location\n return unless exists?\n folder_pathname.relative_path_from(root_path)\n end",
"def get_project_path\n return File.absolute_path File.join(root_dir, src)\n end",
"def root\n @root ||= Pathname.new(File.expand_path('../../../../', __FILE__))\n end",
"def root\n \"#{File.dirname(__FILE__)}/..\"\nend",
"def files_dir\n return File.absolute_path(File.join(@root_dir, 'weather'))\n end",
"def curr_srcdir\n \"#{srcdir_root()}/#{relpath()}\"\n end",
"def curr_srcdir\n \"#{srcdir_root()}/#{relpath()}\"\n end",
"def relative_path\n must_be File\n Pathname.new(self.full_path).relative_path_from(Pathname.new(Dir.pwd)).to_s\n end",
"def root(path = nil)\n base = File.expand_path(File.dirname(__FILE__))\n path ? File.join(base, path) : base\n end",
"def root\n @root ||= Pathname.new(File.expand_path(\"..\", __dir__))\n end",
"def based_on_root(rel_path)\n File.expand_path(File.join(options.root,rel_path))\n end",
"def relative_path(path = @pwd, to = @root)\n Pathname.new(path).relative_path_from(Pathname.new(to)).to_s\n end",
"def root path\n File.dirname(find_dotjam(path))\n end",
"def root(config = Pantry.config)\n Pathname.new(config.root_dir)\n end",
"def curr_srcdir\n \"#{srcdir_root()}/#{relpath()}\"\n end",
"def root\n @root ||= Pathname.new(File.expand_path(\"../../\", __FILE__))\n end",
"def root\n return @root if @root\n @root = dir = Dir.pwd\n begin\n dir = File.dirname(dir)\n return @root = dir if File.exist?(File.join(dir, \"#{BASENAME}.rb\"))\n end while dir != '/'\n\n @root\n end",
"def root\n @root ||= Pathname.new(__FILE__).dirname.dirname.expand_path.to_s\n end",
"def root\n @root ||= Pathname.new(\"#{__dir__}/../../../..\").cleanpath\n end",
"def root\n File.expand_path(options[:root] || Dir.pwd)\n end",
"def relative_file_path(file_path)\n file_path.gsub(/#{pwd}\\//, '')\n end",
"def base_path\n Dir.pwd + \"/\"\n end",
"def get_file_path(filename)\n # dir = File.realdirpath(File.join(File.dirname(__FILE__), '..', 'config'))\n File.join(@dir, filename)\n end",
"def root\n @root ||= Pathname.new(File.expand_path('../../../', __FILE__))\n end",
"def file_path\n File.dirname(__FILE__) + '/' + @file_name\n end",
"def root\n @root ||= Pathname.new(File.expand_path('../../', __FILE__))\n end",
"def root\n self.config[:root] || Dir.pwd rescue Dir.pwd\n end",
"def dir_base\n File.expand_path(File.dirname(__FILE__)+\"/../..\")\n end",
"def file_name_with_path\n root_path.dup + file_name\n end",
"def root_path\n Pathname.new(upload_path_value).join(search_directory)\n end",
"def root_path\n RUBYCOCOA_ROOT.to_s\n end",
"def file_path\n dir_name + file_name\n end",
"def relativize_root_path(path)\n path.to_s.sub(/^#{Regexp.escape(@root)}/, '$root')\n end",
"def base_relative_dir\n \t\[email protected](/^\\//,\"\")\n \tend",
"def files_path\n File.expand_path(\"#{Config.project_root}/files\")\n end",
"def relative_path(filename)\n pieces = split_filename(File.expand_path(filename))\n File.join(pieces[@mount_dir_pieces.size..-1])\n end",
"def root\n self.config[:root] || Dir.pwd rescue Dir.pwd\n end",
"def source_root\n FilePath.new(build_module.root, name).canonicalize\n end",
"def full_path\n container.root.join(path)\n end",
"def full_path\n container.root.join(path)\n end",
"def relative_path\n @relative_path ||= File.join(*[@dir, @name].map(&:to_s).reject(&:empty?)).delete_prefix(\"/\")\n end",
"def test_path\n File.join(root_path, \"test\")\n end",
"def root_dir\n is_rails? ? Rails.root.to_s : Dir.pwd.to_s\n end",
"def current_dir\n File.dirname(file_path)\n end",
"def root_path(*path)\n File.join(root, *path)\n end",
"def root_path(*args)\n File.join(ROOT_DIR, *args)\nend",
"def root_path(*args)\n File.join(ROOT_DIR, *args)\nend",
"def root\n Pathname.new(ENV[\"RAILS_ROOT\"] || Dir.pwd)\n end",
"def path_to_root\n path_to_script = Pathname.new(File.expand_path $PROGRAM_NAME)\n path_to_parent = path_to_script.parent\n\n if path_to_parent.basename.to_s == 'bin'\n path_to_parent = path_to_parent.parent\n end\n path_to_parent\n end",
"def abspath(file)\n File.absolute_path(file)\nend",
"def qualify_path(path, root = @app_dir)\n \"$PWD/#{Pathname.new(path).relative_path_from(Pathname.new(root))}\"\n end",
"def talia_root(path = '')\n File.join('..', '..', '..', '..', path)\n end",
"def relative_path\n @relative_path ||= File.join(@dir, @name)\n end",
"def root_dir\n superblock.root_dir\n end",
"def root\n if @root.nil?\n root = ENV['PWD']\n until File.exists?(\"#{root}/Eulerfile.rb\") || File.expand_path(root) == '/' do\n root = File.dirname(root)\n end\n if not File.exists?(\"#{root}/Eulerfile.rb\")\n raise Euler::EulerFileNotFoundError.new \"Unable to find an Eulerfile.rb in any of the parent directories.\"\n end\n @root = root\n end\n @root\n end",
"def path\n ::File.join(@folder, @file)\n end",
"def where_to_save\n output_dir = @template_options[OUTPUT_DIR]\n # assume absolute\n full_path = output_dir\n if (Pathname.new(output_dir)).relative?\n full_path = File.expand_path(output_dir, Dir.pwd)\n end\n return full_path\n end",
"def caller_root_path(caller_info)\n caller_dirname = File.expand_path(File.dirname(caller_info[0]))\n if (test_dir_pos = caller_dirname.index(TEST_REGEX)) > 0\n root_dir = caller_dirname[0..(test_dir_pos-1)]\n end\n end",
"def relative_path(filename)\n @mount_dir_pieces ||= @mount_dir.size\n pieces = split_filename(File.expand_path(filename))\n File.join(pieces[@mount_dir_pieces..-1])\n end",
"def relative_directory; end",
"def project_root\n File.expand_path(\"#{__dir__}/..\")\n end",
"def resource_root\n FilePath.new(build_module.root, name + \".resources\").canonicalize\n end",
"def base_path\n @base_path ||= Dir.pwd\n end",
"def root_path\n ENV['TM_PROJECT_DIRECTORY'] || File.join(ENV['TM_DIRECTORY'], \"..\")\n end",
"def figure_rootpath()\n name = File.basename(path)\n dirname = File.dirname(path)\n extname = File.extname(path)\n raise(\"Invalid property file name: '#{path}': too many underscores.\") if name.count(\"_\") > 2\n \n first_underscore = name.index('_')\n if first_underscore\n @rootpath = File.join(dirname, name[0, first_underscore] + extname)\n else\n @rootpath = path\n end\n end",
"def fullpath\n @fullpath = File.join(root, path)\n end"
] | [
"0.7819564",
"0.7704712",
"0.76036805",
"0.7540507",
"0.7524881",
"0.75204736",
"0.75198686",
"0.74684554",
"0.74460965",
"0.7441767",
"0.74259174",
"0.7421771",
"0.7387253",
"0.7341055",
"0.73232394",
"0.72543246",
"0.72543246",
"0.7245849",
"0.7191325",
"0.7189784",
"0.71797943",
"0.7167496",
"0.71622294",
"0.71610534",
"0.71338207",
"0.7128822",
"0.7128822",
"0.71166414",
"0.7110121",
"0.7110104",
"0.7097848",
"0.7067982",
"0.7060874",
"0.70605344",
"0.7051985",
"0.7037536",
"0.70290965",
"0.7018795",
"0.70138043",
"0.6988617",
"0.6988617",
"0.6972045",
"0.69692886",
"0.6965889",
"0.6938684",
"0.6938288",
"0.6936623",
"0.69319904",
"0.6928903",
"0.69201654",
"0.69185126",
"0.6910837",
"0.6910518",
"0.6898928",
"0.68939346",
"0.6893321",
"0.6887963",
"0.6873018",
"0.6872298",
"0.6868866",
"0.68642277",
"0.68599635",
"0.684853",
"0.6835673",
"0.68245894",
"0.6812857",
"0.6809922",
"0.68015885",
"0.68007237",
"0.6796255",
"0.6793092",
"0.67707866",
"0.6770032",
"0.6770032",
"0.67514986",
"0.6733121",
"0.6731692",
"0.66957194",
"0.66944975",
"0.6690708",
"0.6690708",
"0.66853696",
"0.6679635",
"0.6674118",
"0.6666583",
"0.6654928",
"0.66543186",
"0.6642138",
"0.66357243",
"0.66303575",
"0.6616469",
"0.6604492",
"0.65956473",
"0.65877223",
"0.65864664",
"0.6586269",
"0.65840733",
"0.65793246",
"0.6576135",
"0.65728706"
] | 0.78295726 | 0 |
returns the full path of the file. | def path; super; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path\n @file.path\n end",
"def fullpath\n File.expand_path( @file )\n end",
"def get_file_path\n @path\n end",
"def path\n @file\n end",
"def file_path\n File.join(dir,filename)\n end",
"def file_path\n dir\n end",
"def path\n @file.path\n end",
"def path\n ::File.join(@folder, @file)\n end",
"def path\n @file\n end",
"def file_path\n File.dirname(__FILE__) + '/' + @file_name\n end",
"def path\n return if @file.blank?\n if is_path?\n File.expand_path(@file)\n elsif @file.respond_to?(:path) && [email protected]?\n File.expand_path(@file.path)\n end\n end",
"def file_path\n @file_path ||= lookup_file_path\n end",
"def path\n self.file.to_s\n end",
"def path\n file.url\n end",
"def file\n File.join(directory, @file)\n end",
"def file\n @pathname.to_s\n end",
"def full_path\n File.join(@path, @name)\n end",
"def file_path\n dir_name + file_name\n end",
"def file_path(filename)\n File.join(path, filename)\n end",
"def file_path\n end",
"def file_path\n\t\tself.class.file_path\n\tend",
"def current_path\n file.try(:path)\n end",
"def full_file_path\n Rails.root.join('uploads', filepath).to_s\n end",
"def current_file_path\n current_file.to_path\n end",
"def path\n @filename\n end",
"def path\n File.join(self.folder, self.filename)\n end",
"def file_path; end",
"def file_path(ext = nil)\n return nil unless file_name(ext)\n \"#{self.base_path}/#{file_name(ext)}\"\n end",
"def file_name\n return unless @file\n\n @file.absolute_name\n end",
"def file\n File.join(root, FILENAME)\n end",
"def path_of(path)\n File.join(self.path, path)\n end",
"def file_path\n File.join(AssetMapper.assets_dir, filename)\n end",
"def filepath\n @filepath\n end",
"def filepath\n @filepath\n end",
"def filepath\n @filepath\n end",
"def path\n if @file\n @file.name\n elsif @path\n @path.to_s\n elsif @stream.is_a?(File)\n @stream.path\n end\n end",
"def file_path\n FileUtils.mkdir_p @path unless Dir.exist? @path\n\n @path\n end",
"def path\n \"%s/%s\" % [dirname, filename]\n end",
"def abspath(file)\n File.absolute_path(file)\nend",
"def path\n if [email protected]? && File.exists?(@path)\n @path\n end\n end",
"def path\n @path ||= File.join(folder.path, filename)\n end",
"def path()\n return ::File.join(@root, @name)\n end",
"def path\n return self.saved? ? @realfile.path : nil\n end",
"def path\n @path ||= @filename ? pathname.to_s : nil\n end",
"def file_path\n \"#{Time.now.to_f}.#{filename}\"\n end",
"def file_path\n self.class.file_path\n end",
"def file_path\n self.class.file_path\n end",
"def file_path\n self.class.file_path\n end",
"def path\n real_path = Pathname.new(root).realpath.to_s\n full_path.sub(%r{^#{real_path}/}, '')\n end",
"def file_path\n storage.file_path(self.class, @id)\n end",
"def user_file_path(file)\n path = \"#{Settings.source_dir}/#{file}\"\n ext = \".#{Settings.partials_extension}\"\n return path if path.end_with? ext\n\n \"#{path}#{ext}\"\n end",
"def rel_path(file)\n File.dirname(file)\n end",
"def path\n File.join(@base, @name)\n end",
"def fullpath\n File.join(@root, @path)\n end",
"def file(filename) File.read(File.absolute_path(filename, File.dirname($PROGRAM_NAME))) end",
"def file_name\n File.basename @path\n end",
"def current_file_path\n clurl = AssetSettings[:local_assets][@file_id].last\n clurl.sub(/\\A#{AssetSettings[:local_assets].assets_url_prefix}/,\n '') if clurl\n end",
"def path\n @path ||= Pathname.new(dir) + filename\n end",
"def full_path\n File.dirname(File.expand_path(serialized_filename))\n end",
"def determine_path\n if source_line.file == SourceLine::DEFAULT_FILE\n return source_line.file\n end\n\n full_path = File.expand_path(source_line.file)\n pwd = Dir.pwd\n\n if full_path.start_with?(pwd)\n from = Pathname.new(full_path)\n to = Pathname.new(pwd)\n\n return from.relative_path_from(to).to_s\n else\n return full_path\n end\n end",
"def path\n File.join(@base, @name)\n end",
"def full_path\n path\n end",
"def get_file_path(filename)\n # dir = File.realdirpath(File.join(File.dirname(__FILE__), '..', 'config'))\n File.join(@dir, filename)\n end",
"def filename\n\t\treturn self.fullpath.split('/').last\n\tend",
"def filename\n return @file_object.io.path if @file_object.io.respond_to?(:path) && File.exist?(@file_object.io.path)\n end",
"def fullpath; end",
"def filePath()\n return File.join(@@publicDir, @@tracksDir, \"#{self.fileName}#{self.fileType}\").to_s\n end",
"def path\n File.join(self.drive.path, self.relative_path)\n end",
"def cookbook_file_path(file)\n File.join(@path, file)\n end",
"def path\n io.path\n end",
"def full_path\n must_be File\n File.realpath(self.path)\n end",
"def path\n begin\n file_path = @assignment.path\n rescue StandardError\n file_path = nil\n end\n file_path\n end",
"def asset_filepath(file)\n File.join(base_path, file)\n end",
"def file\n return @file\n end",
"def file\n return @file\n end",
"def full_path(relative_filename)\n File.join(@mount_dir, relative_filename)\n end",
"def fep(file)\n return File.expand_path(file)\n end",
"def working_file(file)\n \"#{working_dir}/#{file_string(file)}\"\n end",
"def file_path path\n File.join(output_path, manifest.lookup(path).split('/')[2..-1])\n end",
"def get_filename (file)\n\t\tif file.is_a? File\n\t\t\tfile = file.path\n\t\tend\n\t\treturn file\n\tend",
"def file\n FILE\n end",
"def full_filename\n File.join(path, self.disk_filename)\n end",
"def local_file(file)\n File.join @cwd, file\n end",
"def path\n File.join(@base, @target)\n end",
"def file_name\n return @file_name\n end",
"def file_name\n return @file_name\n end",
"def path\n return @path\n end",
"def path\n return @path\n end",
"def path\n return @path\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def path\n @reader.path\n end",
"def file\n @file\n end",
"def path(file)\n File.join File.dirname(__FILE__), '../../templates/', file\n end",
"def path\n name + extension\n end",
"def file_path(file_name)\n file_map[file_name]['path']\n end",
"def file_path(file_name)\n file_map[file_name]['path']\n end",
"def full_path\n container.root.join(path)\n end",
"def full_path\n container.root.join(path)\n end"
] | [
"0.8444844",
"0.8357334",
"0.8300974",
"0.82767045",
"0.82736427",
"0.8195983",
"0.81881636",
"0.81694776",
"0.8158934",
"0.8122875",
"0.8099653",
"0.79950494",
"0.7919896",
"0.7878709",
"0.7827936",
"0.77674913",
"0.77567095",
"0.77423656",
"0.7736344",
"0.77033156",
"0.7681927",
"0.7677316",
"0.76148754",
"0.7614465",
"0.760864",
"0.7603272",
"0.757401",
"0.7571865",
"0.75513583",
"0.7532245",
"0.75127554",
"0.7498638",
"0.74854267",
"0.74854267",
"0.74854267",
"0.7466483",
"0.74664545",
"0.742849",
"0.7423765",
"0.7413787",
"0.7410749",
"0.74077266",
"0.7377068",
"0.7375546",
"0.7371204",
"0.7355568",
"0.7355568",
"0.7355568",
"0.7346621",
"0.73326933",
"0.7293432",
"0.7289685",
"0.7288584",
"0.7283675",
"0.725856",
"0.7258361",
"0.7243558",
"0.72411865",
"0.72352403",
"0.723224",
"0.7228358",
"0.72254264",
"0.7196321",
"0.7171417",
"0.716555",
"0.71531034",
"0.7125212",
"0.7098133",
"0.70960104",
"0.70937943",
"0.70846736",
"0.7076344",
"0.70614153",
"0.7058872",
"0.7058872",
"0.7058161",
"0.70492417",
"0.7023376",
"0.70212936",
"0.7002527",
"0.6988473",
"0.6988008",
"0.69811493",
"0.69772726",
"0.69766504",
"0.69766504",
"0.6964142",
"0.6964142",
"0.6964142",
"0.6951245",
"0.6951245",
"0.6951245",
"0.6951245",
"0.6945117",
"0.6935157",
"0.6930101",
"0.69295114",
"0.6923384",
"0.6923384",
"0.69226766",
"0.69226766"
] | 0.0 | -1 |
returns the directory where the file is currently stored. | def dir
File.dirname(self.path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_dir\n File.dirname(file_path)\n end",
"def directory\n File.dirname @path\n end",
"def directory\n File.dirname(@path) + '/'\n end",
"def dir\n @working_directory\n end",
"def containing_directory\n path.dirname\n end",
"def dir\n File.dirname(__FILE__)\n end",
"def file_path\n dir\n end",
"def current_directory\n File.expand_path @current_directory\n end",
"def directory\n @directory ||= File.expand_path(File.dirname(file))\n end",
"def directory\n self.path.directory\n end",
"def dir\n @dir ||= File.dirname(fullpath)\n end",
"def store_dir\n \"city-of-meridian/files/\"\n end",
"def directory\n return @directory\n end",
"def dir\n @dir ||= self.class.normalize_dir(::File.dirname(@path))\n end",
"def directory\n return _meta_data['directory'] if _meta_data.has_key? 'directory'\n dir\n end",
"def working_dir\n ENV['PWD'] || Dir.pwd\n end",
"def current_dir; end",
"def file_dir\n 'files'\n end",
"def store_dir\n @dir = Dir.pwd\n end",
"def directory\r\n \[email protected]\r\n end",
"def dir\n calc_dir(@basename)\n end",
"def dir_name\n File.dirname(file_name)\n end",
"def dir_path\n File.expand_path(File.dirname(@path))\n end",
"def path\n @directory.path\n end",
"def dirname\n File.dirname(filename)\n end",
"def get_local_dir\n return @resource[:local_dir]\n end",
"def basedir\n return nil if !file\n File.dirname File.absolute_path @file\n end",
"def dirname\n File.dirname(filename)\n end",
"def getwd\n Dir.getwd\n end",
"def path_dir\n File.split(path).first\n end",
"def files_dir\n return File.absolute_path(File.join(@root_dir, 'lib', 'files'))\n end",
"def dir\n @directory\n end",
"def store_dir\n File.expand_path(self.relative_store_dir, @options[:root_dir])\n end",
"def prefixed_working_directory\n return self.storage.prefixed_working_directory\n end",
"def file_dir\n @parent_generator.file_dir\n end",
"def working_directory\n @options[:working_directory]\n end",
"def working_directory\n if @working_directory.nil?\n raise \"`working_directory` for the current storage provider is `nil` as the `#download` method was never called\"\n end\n return @working_directory\n end",
"def dir\n Rails.root.join(ROOT, type, name).to_s\n end",
"def directory\n self.class.directory\n end",
"def directory\n self.class.directory\n end",
"def base_dir\r\n datastore['WritableDir']\r\n end",
"def dirname\n return File.dirname( self.path )\n end",
"def work\n '/' + File.dirname(file)\n end",
"def root\n File.dirname __dir__\n end",
"def root\n File.dirname __dir__\n end",
"def root\n File.dirname __dir__\n end",
"def directory\n @directory ||= site.in_source_dir(\n File.join(container, relative_directory)\n )\n end",
"def dir\n @dir ||= File.join Hoboku.data_dir, name\n end",
"def pos_directory\n pos_fil_trailer\n end",
"def dir\n @zip_fs_dir\n end",
"def store_dir\n raise \"Can't upload files for an unknown user!\" unless model.user\n @store_dir = File.join(model.user.upload_dir, mounted_as.to_s, model.id.to_s)\n return @store_dir\n end",
"def locate\r\n File.dirname(__FILE__)\r\n end",
"def locate\r\n File.dirname(__FILE__)\r\n end",
"def basedir\n File.dirname File.absolute_path options[:file]\n end",
"def store_dir\n if model[\"#{mounted_as}\"]\n fname = model[\"#{mounted_as}\"]\n else\n fname = self.filename\n end\n p1,p2 = fname[0,1],fname[1,1]\n [model.class.to_s.underscore,p1,p2].join(\"/\")\n end",
"def file_dir\n nil\n end",
"def where_to_save\n output_dir = @template_options[OUTPUT_DIR]\n # assume absolute\n full_path = output_dir\n if (Pathname.new(output_dir)).relative?\n full_path = File.expand_path(output_dir, Dir.pwd)\n end\n return full_path\n end",
"def directory_path\n @directory_path ||= url_file_path.sub /([^\\/]*)\\z/, ''\n end",
"def store_dir\n File.join Rails.root, root_dir, model_dir, partition_dir\n end",
"def file_dir # :nodoc:\n nil\n end",
"def root\n Dir.pwd\n end",
"def current_file_path\n current_file.to_path\n end",
"def workspace_folder\n @pwd\n end",
"def log_directory\n File.join(@relative_to_base, LOG_DIRECTORY_NAME)\n end",
"def dump_directory\n File.join(@relative_to_base, DUMP_DIRECTORY_NAME)\n end",
"def store_dir\n Rails.root.join('data', model.data_dir, model.id.to_s)\n end",
"def current_working_directory; @rye_current_working_directory; end",
"def directory_path\n @directory_path || Ferver::DEFAULT_FILE_SERVER_DIR_PATH\n end",
"def store_dir\n %(#{Rails.root}/storage/#{model.parent.class.name.pluralize.downcase}/#{model.parent.id})\n end",
"def store_dir\n if Rails.env == \"production\"\n ENV['CONFIG_FILE_UPLOAD_PATH']\n else\n \"uploads\"\n end\n end",
"def files_dir\n return File.absolute_path(File.join(@root_dir, 'weather'))\n end",
"def current_path\n current_folder.path\n end",
"def dir\n File.expand_path( File.join( File.dirname( File.expand_path(__FILE__) ), '..' ) )\n end",
"def working_dir\n return nil if !repo || !user\n return \"#{Bini.data_dir}/repos/#{user}/#{repo}\"\n end",
"def dir\n self\n end",
"def getWorkingDir\n if(@workingDir != nil)\n return @workingDir\n end\n currDir = Dir.pwd\n dr = \"\"\n currDir.split(\"/\").each{ |entry|\n dr = dr+entry+\"/\"\n #puts dr\n if(File.directory? dr+\".hoster\")\n @workingDir = dr+\".hoster\"\n end\n }\n @workingDir\n end",
"def get_config_directory()\n\t\t\tconfig_directory= File.join(@base_directory, \"config\")\n\t\t\treturn config_directory\n\t\tend",
"def root_dir\n superblock.root_dir\n end",
"def osw_dir\n File.dirname(@osw_abs_path)\n end",
"def osw_dir\n File.dirname(@osw_abs_path)\n end",
"def integration_cwd\n root.to_s\n end",
"def dir\n self.a_dir.join '/'\n end",
"def enclosed_directory\n \".\"\nend",
"def getWorkingDir\n currDir = Dir.pwd\n dr = \"\"\n currDir.split(\"/\").each{ |entry|\n dr = dr+entry+\"/\"\n #puts dr\n if(File.directory? dr+\".hoster\")\n @workingDir = dr+\".hoster\"\n end\n }\n @workingDir\n end",
"def cwd\n Dir.getwd\n end",
"def cwd\n return cd(\"\").to_s\n end",
"def store_dir\n base_dir = ENV.fetch('FILE_STORE_DIR', \"uploads\")\n if base_dir != \"uploads\"\n public_uploads = File.join(Rails.root, \"public\", \"uploads\")\n FileUtils.symlink(base_dir, public_uploads) unless File.symlink?(public_uploads)\n base_dir = public_uploads\n end\n \"#{base_dir}/#{Rails.env}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def pwd\n Dir.pwd\n end",
"def work_dir; end",
"def relative_store_dir\n parse_dir_options(:store_dir)\n end",
"def working_directory\n @link.WorkingDirectory\n end",
"def store_dir\n \"assets/#{Site.current.key}/uploads/\"\n end",
"def store_dir\n \"#{Rails.root}/app/files/uploads/#{ENV['PROJECT_ID']}/\"\n end",
"def store_dir\n format(\n '%suploads/peoplefinder/%s/%s/%s',\n base_upload_dir,\n model.class.to_s.underscore,\n mounted_as_without_legacy_prefix,\n model.id\n )\n end",
"def stored_file_path\n File.join(path, stored_name)\n end",
"def store_dir\n \"media/documents/#{Time.now.year}/#{Time.now.month}/#{Time.now.day}\"\n end",
"def a_dir\n self.path.split('/')[0...-1]\n end",
"def store_dir\n '%suploads/peoplefinder/%s/%s/%s' % [\n base_upload_dir,\n model.class.to_s.underscore,\n mounted_as_without_legacy_prefix,\n model.id\n ]\n end",
"def base_path\n Dir.pwd + \"/\"\n end",
"def data_directory\n @data_directory\n end"
] | [
"0.817147",
"0.8151737",
"0.7895601",
"0.7824955",
"0.7761911",
"0.7753266",
"0.7742757",
"0.7715699",
"0.7707661",
"0.7680336",
"0.75549287",
"0.7502023",
"0.74801034",
"0.7371983",
"0.7367305",
"0.73578525",
"0.7349935",
"0.73481506",
"0.733297",
"0.7316246",
"0.7309208",
"0.7306743",
"0.72829163",
"0.7280575",
"0.72785676",
"0.72712076",
"0.7250564",
"0.7233263",
"0.72328883",
"0.72281563",
"0.7224493",
"0.7209498",
"0.72016925",
"0.7199203",
"0.7196734",
"0.71512413",
"0.7146172",
"0.7142149",
"0.7137917",
"0.7137917",
"0.7084869",
"0.70817316",
"0.70664304",
"0.7057424",
"0.70528924",
"0.70528924",
"0.70503575",
"0.70468396",
"0.7042556",
"0.7034977",
"0.7034837",
"0.703475",
"0.703475",
"0.70322335",
"0.70061153",
"0.70036507",
"0.7002381",
"0.6977228",
"0.69713455",
"0.6969224",
"0.6968846",
"0.6961788",
"0.6956959",
"0.69371796",
"0.6935684",
"0.69280255",
"0.6923354",
"0.6915065",
"0.6897895",
"0.689474",
"0.6877333",
"0.6876394",
"0.68492615",
"0.6814717",
"0.68133324",
"0.67999876",
"0.6794363",
"0.67937267",
"0.6779457",
"0.6779457",
"0.67784494",
"0.677686",
"0.67641485",
"0.6757595",
"0.6744172",
"0.6743227",
"0.6740904",
"0.6739235",
"0.6738496",
"0.67311674",
"0.6718638",
"0.6714698",
"0.6714337",
"0.67091686",
"0.6706295",
"0.6705495",
"0.66969883",
"0.6696693",
"0.66930735",
"0.66792226"
] | 0.774434 | 6 |
return true if the file has just been uploaded. | def new_file?
@new_file
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uploaded?(uploaded_file)\n uploaded_file.storage_key == storage_key.to_s\n end",
"def uploaded?( filename, buffer )\n return false if @upload_dir.nil?\n\n savedfile = \"#{@upload_dir}/#{filename}\"\n return false unless File.exist?( savedfile )\n\n old = File.read( savedfile, encoding: buffer.encoding )\n return true if buffer == old\n\n false\n end",
"def stored?(file = self.file)\n uploaded?(file, store_key)\n end",
"def already_uploaded?\n false\n seen_before = Zaphod::PhotoStorage.get(\"seen_id_#{@post_id}\",\"recommendation\")\n if seen_before && seen_before == @post_id\n @log.debug(\"already uploaded ID #{seen_before}... skipping\")\n true\n end\n end",
"def saved?\n return [email protected]?\n end",
"def file?\n original_filename.present?\n end",
"def fully_uploaded?(file_url)\n retry_network_errors(@network_error_retry_options) do\n @http_client.get_url_time(file_url) < Time.now - 2.hours\n end\n end",
"def file?\n [email protected]?\n end",
"def promote?(uploaded_file)\n uploaded_file && cache.uploaded?(uploaded_file)\n end",
"def already_stored?\n !file_uniqueness\n end",
"def file_uploaded_now?(item = nil)\n item ||= default_to_self\n item.reload if item.is_a?(ActiveRecord::Base)\n file_uploaded?(item)\n end",
"def uploaded?(file, storage_key)\n file&.storage_key == storage_key\n end",
"def exam_been_uploaded?\n self.split_pdf_logs.exists?\n end",
"def is_up?\n\t\tFile.exists?(@file)\n\tend",
"def finished?\n @files[@files.index(@current_image) + 1].nil?\n end",
"def file?\n self.file.file?\n end",
"def stored?(file)\n ok_file = get_ok_file_for(file)\n fail_file = get_fail_file_for(file) \n if ( File.exists?(ok_file) or File.exists?(fail_file) )\n return true\n end \n return false\n end",
"def file?\n !!@file ||= false\n end",
"def can_upload?\n false\n end",
"def has_failed_upload?\n num_uploads = tasks.upload.count\n num_complete_uploads = tasks.upload.with_status(Task::COMPLETE).count\n num_valid_uploads = tasks.upload.valid.count # i.e. not-cancelled\n num_cancelled_uploads = num_uploads - num_valid_uploads\n\n # easy cases first\n return false if num_uploads == 0\n return false if num_complete_uploads == num_uploads\n return false if num_complete_uploads > 1\n return true if num_cancelled_uploads == num_uploads\n\n return false # conservative default\n end",
"def resumable_upload? file #:nodoc:\n ::File.size?(file).to_i > Storage.resumable_threshold\n end",
"def pokemon_uploaded?(id = $pokemon_party.online_id)\n r = execute('hasPokemonUploaded', id: id)\n log_error(r) unless r == 'yes' || r == 'no'\n return r == 'yes'\n end",
"def valid?\n return false if @file_id.nil?\n true\n end",
"def already_loaded?(uploaded_file)\n uploaded_file.reload\n originals = uploaded_file.original_inputs\n return false unless originals.present?\n sha2_hashes = []\n originals.each do |orig|\n return false if orig.nil? || orig.sha2_hash.nil?\n sha2_hashes << orig.sha2_hash\n end\n\n return false if sha2_hashes.empty?\n\n UploadedFile.joins(:original_inputs)\n .where(status: 'S')\n .where(validate_only: false)\n .where(original_input: {sha2_hash: sha2_hashes,\n mime_type: 'text/stix'}).count > 0\n end",
"def upload_limit_reached?\n self.uploads.sum(:file_file_size) > UPLOAD_LIMIT\n end",
"def processing?\n try(:upload_set).try(:status) == ['processing'.freeze]\n end",
"def is_uploaded_file?(param)\n if param.respond_to?(:has_key?)\n [:filename, :type, :name, :tempfile, :head].each do |k|\n return false if !param.has_key?(k)\n end\n\n return true\n else\n return false\n end\n end",
"def process_upload\n return if @upload_processed\n @file.file.process!\n @upload_processed = true\n end",
"def accepts_file_upload?\n true\n end",
"def accepts_file_upload?\n true\n end",
"def accepts_file_upload?\n true\n end",
"def accepts_file_upload?\n true\n end",
"def accepts_file_upload?\n true\n end",
"def accepts_file_upload?\n true\n end",
"def can_upload?\n klass.model_class && mime_types && mime_types.keys.include?(file_mime_type)\n end",
"def already_being_processed?\n # if origional exists and destination has existed for 30s+\n # assume a previous run didn't get around to cleaning up the file\n if(File.exist?(@origional_file) && File.exist?(destination_file) && !recently_modified?(destination_file))\n $logger.info \"Found origional and transcoded file; moving origional\"\n move_origional_file\n return true\n end\n\n if File.exist? temp_file\n # if file has been modified in the last 30 seconds consider it in flight by another\n if recently_modified?(temp_file)\n $logger.info \" temp file modified recently (maybe by another process?) so skipping #{temp_file}\"\n return true\n else\n $logger.info \" temp file is old, deleting #{temp_file}\"\n File.delete temp_file\n end\n end\n false\n end",
"def file_uploaded_during_this_membership_term?\n return false unless current_member? || in_grace_period?\n\n if current_member?\n file_uploaded_on_or_after?(current_membership.first_day)\n else\n # is in_grace_period\n file_uploaded_on_or_after?(most_recent_membership.first_day) # FIXME is this correct?\n end\n end",
"def persisted?\n path.file? || @last_saved_file_path && @last_saved_file_path.file?\n end",
"def cached?(file = self.file)\n uploaded?(file, cache_key)\n end",
"def has_file\n if id == nil \n false\n else\n FileTest.exists?( local_file_path )\n end\n end",
"def validate_local_files\n expected_user_id = user.id\n uploaded_files.each do |file|\n if file.user_id != expected_user_id\n Rails.logger.error \"User #{user.user_key} attempted to ingest uploaded_file #{file.id}, but it belongs to a different user\"\n return false\n end\n end\n true\n end",
"def upload(_io, _path)\n false\n end",
"def is_file?\n !file_type.empty?\n end",
"def is_new?\n !File.exists? @filename\n end",
"def attached?\n !!file\n end",
"def file_backed?\n @tempfile_in\n end",
"def changed?(uploaded_file)\n record.reload\n super\n end",
"def remote_file?\n file? && @remote_file\n end",
"def validate_files\n expected_user_id = user.id\n uploaded_files.each do |file|\n if file.user_id != expected_user_id\n Rails.logger.error \"User #{user.user_key} attempted to ingest uploaded_file #{file.id}, but it belongs to a different user\"\n return false\n end\n end\n true\n end",
"def failed_multipart_upload? response\n response.request_type == :complete_multipart_upload &&\n extract_error_details(response)\n end",
"def preview_file_ready?\n if !session[:preview_filename] || !File.exist?(session[:preview_filename])\n render nothing: true, status: :not_found\n end\n end",
"def has_files?\n attachments.count > 0\n end",
"def route_upload?\n request.post? && path.match(%r{^/#{doc}/upload$})\n end",
"def file_ok?(item = nil)\n status_ok?(item, column: :file_status)\n end",
"def persisted?\n db_file && db_file.file?\n end",
"def uploaded?\n Debate.where(:log_date => date).size > 0\n end",
"def file_is_physically_present?\n field.file.size > 0\n end",
"def watched_file?(filename)\n false\n end",
"def file_exists?\n !!file_path\n end",
"def file_exists?\n !!file_path\n end",
"def has_file?(filename)\n\t\t!self.files.detect(filename).nil?\n\tend",
"def file_modified?\n modified = false\n\n if @name\n begin\n mtime = File.mtime( @name )\n\n if mtime > @last_modification_check\n modified = true\n @last_modification_check = mtime\n end\n rescue Errno::ENOENT\n # Ignore if file doesn't exist\n end\n end\n\n modified\n end",
"def file?\n repos.stat(fs_path, revision).file?\n end",
"def finished?\n\t\tfinished_on.present?\n\tend",
"def finished?\n\t\tfinished_on.present?\n\tend",
"def temporary?\n @file == @default_file\n end",
"def check_for_signature\n if signature_file_name_changed?\n sign if signature.present?\n end\n true\n end",
"def exists?\n # self.class.exists?(:filename => filename)\n 'CarrierWave::Storage::ActiveRecord::File#exists? FIXME!'\n end",
"def multipart?\n false\n end",
"def removed?\n !File.exist?(path)\n end",
"def empty?\n @file.nil? || self.size.nil? || (self.size.zero? && !self.exists?)\n end",
"def filecheck\n return file.nil? ? false : File.exist?(file)\n end",
"def multipart?\n\t true\n\tend",
"def preview?\n \n self.preview ? File.exists?(self.preview.path) : false\n end",
"def is_file_open?\n (@file_handle != nil)\n end",
"def is_file_open?\n (@file_handle != nil)\n end",
"def exists?\n file.exists?\n end",
"def add_files?\n false\n end",
"def in_previous_version?\n prev_res = resource.previous_resource\n return false if prev_res.nil?\n\n prev_file = self.class.where(resource_id: prev_res.id, upload_file_name: upload_file_name).order(id: :desc).first\n return false if prev_file.nil? || prev_file.file_state == 'deleted'\n\n true # otherwise it existed last version because file state is created, copied or nil (nil is assumed to be copied)\n end",
"def imported?\n import_progress[:status] == IMPORT_COMPLETE\n end",
"def check( _upload )\n @original = _upload\n path = File.join( @uploadDir, @original )\n res = UploadUtils.filename( path )\n @uploadPath = res['path']\n @ext = res['ext']\n @filename = res['filename']\n end",
"def size(filename)\n begin\n @ftp.size(filename)\n rescue\n return false\n end\n end",
"def has_file?(path)\n @files.has_key?(path)\n end",
"def has_photo?\n send('file_uploader_url').present?\n end",
"def buffer?\n @buffer && @buffer != \"\" && @buffer.original_filename.length > 0\n end",
"def completed?\n child_files = self.bundled_files\n child_file_types = child_files.map {|file| file['file_type']}\n if child_file_types.size < BUNDLE_REQUIREMENTS[self.bundle_type].size || ( (child_file_types.size == BUNDLE_REQUIREMENTS[self.bundle_type].size) &&\n (child_file_types & BUNDLE_REQUIREMENTS[self.bundle_type] != child_file_types))\n return false\n end\n if child_file_types.size > BUNDLE_REQUIREMENTS[self.bundle_type].size\n return false\n end\n # make sure all files have at least uploaded to the server\n self.study_files.each do |study_file|\n if !study_file.uploaded?\n return false\n end\n end\n true\n end",
"def already_uploaded_this_acf?(nmd)\n !ReadyForShipmentBatch.find_by_acf_integrity_hash(nmd.integrity_hash).nil?\n end",
"def multipart?\n @multipart\n end",
"def multipart?\n @multipart\n end",
"def storage_exists?\n File.exists?(file_path)\n end",
"def file_exist?\n return FileTest.exist?(@fileurl)\n end",
"def pfile?\n @raw_image_files.first.pfile?\n end",
"def has_file?(path)\n @files.has_key?(path)\n end",
"def successful?\n return self.error.nil?\n end",
"def save_attachment?\n @save_attachment\n end",
"def sending_file?\n @_body.is_a?(::Rack::File::Iterator)\n end",
"def add_files?\n true\n end",
"def file?\n @node.kind_of?(SvnTransform::File)\n end",
"def image_file?\n false\n end",
"def successful?\n @progress == 'COMPLETED'\n end"
] | [
"0.75458515",
"0.74913377",
"0.73320407",
"0.72018564",
"0.69525474",
"0.69102746",
"0.688982",
"0.68801033",
"0.68694013",
"0.6859565",
"0.6820747",
"0.6801161",
"0.6773614",
"0.67502207",
"0.6749296",
"0.67491275",
"0.6742957",
"0.6724087",
"0.67143565",
"0.6683608",
"0.6588979",
"0.6582936",
"0.6582861",
"0.6578148",
"0.6564984",
"0.6562178",
"0.6552605",
"0.6517176",
"0.65121764",
"0.65121764",
"0.65121764",
"0.65121764",
"0.65121764",
"0.65121764",
"0.6511",
"0.6493175",
"0.6489608",
"0.64807314",
"0.64633995",
"0.6408084",
"0.6391857",
"0.63800335",
"0.6372458",
"0.6370635",
"0.6364788",
"0.63544965",
"0.6350254",
"0.63423777",
"0.63274485",
"0.63216686",
"0.6306193",
"0.62826025",
"0.6262327",
"0.62587893",
"0.6244271",
"0.6227465",
"0.6213262",
"0.6211294",
"0.6208252",
"0.6206898",
"0.6206396",
"0.6203621",
"0.62023705",
"0.6193402",
"0.6193402",
"0.61703265",
"0.61657244",
"0.6164138",
"0.61607647",
"0.61520636",
"0.6130486",
"0.6130117",
"0.6125634",
"0.61208117",
"0.61117214",
"0.6111532",
"0.61096036",
"0.61022025",
"0.6097833",
"0.6085116",
"0.6084213",
"0.6080214",
"0.6075421",
"0.60497224",
"0.6049201",
"0.6049194",
"0.60404044",
"0.60329425",
"0.60329425",
"0.6028599",
"0.6026536",
"0.6024496",
"0.6020815",
"0.6020184",
"0.6017771",
"0.6016244",
"0.601614",
"0.60161185",
"0.6013373",
"0.60045403"
] | 0.668375 | 19 |
returns the url of the file, by merging the relative path with the web_root option. | def public_path
# TODO: this might present an attack vector if the file is outside the web_root
options[:web_root].to_s + '/' + self.relative_path.gsub("\\", "/")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url(options = {})\n if file.respond_to?(:url)\n tmp_url = file.method(:url).arity.zero? ? file.url : file.url(options)\n return tmp_url if tmp_url.present?\n end\n\n if file.respond_to?(:path)\n path = encode_path(file.path.sub(File.expand_path(root), ''))\n\n if (host = asset_host)\n if host.respond_to? :call\n \"#{host.call(file)}#{path}\"\n else\n \"#{host}#{path}\"\n end\n else\n (base_path || \"\") + path\n end\n end\n end",
"def url\n ::File.join \"/\", path.to_s\n end",
"def absolute_url\n return unless fileable?\n Rails.application.routes.default_url_options[:host] ||= \"http://localhost:3000\"\n Rails.application.routes.url_helpers.root_url[0..-2] + file.url\n end",
"def url; \"file:#{@root}\"; end",
"def url(options = {})\n file.path\n end",
"def url\n\t\tif relative? then\n\t\t\tif page.bases[0] then\n\t\t\t\t page.bases[0].href + src\n\t\t\telse\n\t\t\t\tpage.uri + src\n\t\t\tend\n\t\telse\n\t\t\tsrc\n\t\tend\n\tend",
"def base_url\n File.join(host, path)\n end",
"def relative_url_root; end",
"def relative_url_root; end",
"def relative_url_root; end",
"def relative_path(options = {})\n File.join(self.site.content_dir(options), sanitize_filename(self.name))\n end",
"def url\n [ Configuration.url, @path ].join\n end",
"def _site_path(config, filename)\n \"#{config['baseurl']}/#{asset_path(config)}#{filename}\"\n end",
"def absolute_url\n domain + path\n end",
"def url\n filepath.sub( %r{\\A#{Regexp.escape (Rails.root + \"public\").to_s}}, '').to_s\n end",
"def local_url\n File.join(AssetSettings[:local_assets].assets_url_prefix, file_path)\n end",
"def url\n Config.site.url.chomp('/') + self.path\n end",
"def file_url\n resource.send(mount_point).url\n end",
"def url(p = path)\n \"/\" + relative_path(p).to_s.downcase.gsub(/\\s/, \" \")\n end",
"def relative_root\n Rails.configuration.relative_url_root || \"\"\n end",
"def url\n File.join(server.url, path)\n end",
"def relativeWebPath()\n return File.join('/', @@tracksDir, \"#{self.fileName}#{self.fileType}\")\n end",
"def get_absolute_file_url(url)\n orig_url = url.to_s.strip\n \n url = file_url(orig_url)\n # If a file:// was stripped from the url, this means it will always point\n # to a file\n force_file = (orig_url != url)\n # Indicates wether the base url is a network url or a file/directory\n base_is_net = !base_file_url.is_a?(String)\n # Try to find if we have a \"net\" URL if we aren't sure if this is a file. In\n # case the base url is a network url, we'll always assume that the\n # url is also a net thing. Otherwise we only have a net url if it contains a\n # '://' string\n is_net_url = !force_file && (base_is_net || url.include?('://'))\n # The url is absolute if there is a : character to be found\n \n \n if(is_net_url)\n base_is_net ? join_url(base_file_url, url) : url\n else\n base_is_net ? url : join_files(base_file_url, url)\n end\n end",
"def to_relative_url\n to_relative_uri.to_s\n end",
"def url\n return @url if @url\n\n url = permalink ?\n if site.config['relative_permalinks']\n File.join(@dir, permalink)\n else\n permalink\n end :\n {\n 'lang' => self.lang,\n 'categories' => self.categories,\n 'basename' => self.basename,\n }.inject(template) { |result, token|\n result.gsub(/:#{token.first}/, token.last)\n }.gsub(/\\/\\//, '/')\n\n # sanitize url\n @url = url.split('/').reject { |part| part =~ /^\\.+$/ }.join('/')\n @url += '/' if url =~ /\\/$/\n @url.gsub!(/\\A([^\\/])/, '/\\1')\n @url\n end",
"def url\n File.join(environment.config.url, @logical_path).sub /(index)?\\.html?$/, ''\n end",
"def absolute_url(request, opts={})\n cdn_url(opts) || (request.protocol + request.host_with_port + public_filename)\n end",
"def url_for(path)\n raise \"no file at path: #{path}\" unless File.exists?(File.expand_path(path, File.dirname(@source)))\n target_path(path)\n end",
"def url(**options)\n file&.url(**options)\n end",
"def absolute_url\n File.join(BLOG.url, url)\n end",
"def relative_url(input); end",
"def url\n url_path = destination_path\n if app.config[:strip_index_file]\n url_path = url_path.sub(/(^|\\/)#{Regexp.escape(app.config[:index_file])}$/,\n app.config[:trailing_slash] ? '/' : '')\n end\n File.join(app.config[:http_prefix], url_path)\n end",
"def get_url(is_local = true)\n is_local ? (return '../../../www/public/') : (return 'https://whimsy.apache.org/public/')\n end",
"def relative_url_root=(_); end",
"def url_file_path\n return @url_file_path if @url_file_path\n url_parts = url.match /\\A[^:]+:\\/*[^\\/]+\\/(?<path_portion>.*)/\n url_parts = url.match /\\A\\/?(?<path_portion>.*)/ unless url_parts\n @url_file_path = url_parts[:path_portion]\n end",
"def absolute_path(options = {})\n if !@absolute_path\n # Pre-conditions\n raise ArgumentError.new(\"No document root set\") if @document_root.nil?\n\n @absolute_path = filename.sub(%r{^#@document_root}, '').sub(/^\\/?/, '/')\n @absolute_path = \"#{Juicer::Asset::Path.host_with_scheme(options[:host])}#@absolute_path\"\n end\n\n path_with_cache_buster(@absolute_path, options)\n end",
"def zip_url\n #TODO Pretty sure that will break in production (since root_url isn't set)\n root_url[0..-2] + self.zip_file.url if self.zip_file.file\n end",
"def target_url(target)\n File.join(\"/\", Pathname.new(target).relative_path_from(Pathname.new(DST_DIR)).to_s)\nend",
"def url\n return @url unless @url.nil?\n @url = destination.sub(::Webby.site.output_dir, '')\n end",
"def relative_path\n self.path.sub(File.expand_path(options[:root_dir]) + '/', '')\n end",
"def web_endpoint\n File.join(@web_endpoint, \"\")\n end",
"def web_endpoint\n File.join(@web_endpoint, \"\")\n end",
"def web_endpoint\n File.join(@web_endpoint, \"\")\n end",
"def url\n if @website_file.in_blog?\n blog_folder.currentpath + @name + \"index.html\"\n else\n siteroot.currentpath + @name + \"index.html\"\n end\n end",
"def relative_url_root=(_arg0); end",
"def relative_url_root=(_arg0); end",
"def abs_url(site)\n\t\t\turl = site.config['url']\n\t\t\turl = url[0..-2] if site.config['url'].end_with?(\"/\")\n\t\t\turl + fix_path(site.config['git_to_rss_file_path'])\n\t\tend",
"def path\n http_url RDoc::RDoc.current.generator.file_dir\n end",
"def main_url\n @main_page = @options.main_page\n @main_page_ref = nil\n if @main_page\n @main_page_ref = RDoc::Generator::AllReferences[@main_page]\n if @main_page_ref then\n @main_page_path = @main_page_ref.path\n else\n $stderr.puts \"Could not find main page #{@main_page}\"\n end\n end\n\n unless @main_page_path then\n file = @files.find { |context| context.document_self }\n @main_page_path = file.path if file\n end\n\n unless @main_page_path then\n $stderr.puts \"Couldn't find anything to document\"\n $stderr.puts \"Perhaps you've used :stopdoc: in all classes\"\n exit 1\n end\n\n @main_page_path\n end",
"def local_uri\n\n return nil unless self.uri\n u = full_uri\n u[0, 1] == '/' ? \"#{RAILS_ROOT}/public#{u}\" : u\n end",
"def find_file(path)\n # Absolute url, starting with /\n if path.value.match(%r{^\\/[^\\/]})\n File.join(@options[:roger_html_path], path.value)\n else\n # Relative url - we can join from .scss position\n File.join(File.dirname(@options[:filename]), path.value)\n end\n end",
"def file_path( target )\n # theme.site do not work.\n File.join(page_layout.site.path, self.path, file_name(target)) \n end",
"def local_to_remote_url local\n local.match /#{config[:relative_dir_regex]}/\n subdir = $2\n basename = File.basename local\n File.join(config[:root_path], subdir, basename)\n end",
"def file_url\n file.attached? ? url_for(file) : ''\n end",
"def web_file_path \n afilePath = building.web_path + SAVE_PATH + id.to_s\n if file_suffix != \"\" && file_suffix != nil\n afilePath = afilePath + \".\" + file_suffix \n end\n\n afilePath\n end",
"def url_for_project_directory( project, options = nil )\n # setup_project_urls( project )\n # return the base url for this project\n project.domain + project.directory_url\n end",
"def url(path = \"/\")\n uri = URI.join(\"http://#{self.base_domain}\", path)\n uri.to_s\n end",
"def url\n make_file_name('html', name)\n end",
"def url\n host = @uploader.ucloud_cdn_host || @uploader.ucloud_bucket_host\n return nil unless host\n [host, @path].join(\"/\")\n end",
"def get_webview_url(file_path)\n file_path.gsub(%r{/#{local_source_path}}, @webview_url)\n end",
"def asset_url(file)\n Assets.compute_path(file)\n end",
"def url\n URL(@site.url).join(attributes[\"RootFolder\"]).to_s\n # # Dirty. Used to use RootFolder, but if you get the data from the bulk calls, RootFolder is the empty\n # # string rather than what it should be. That's what you get with web services as an afterthought I guess.\n # view_url = ::File.dirname(attributes[\"DefaultViewUrl\"])\n # result = URL(@site.url).join(view_url).to_s\n # if ::File.basename(result) == \"Forms\" and dir = ::File.dirname(result) and dir.length > @site.url.length\n # result = dir\n # end\n # result\n end",
"def web_url(filename, version=nil)\n fail NotImplementedError\n end",
"def url(**options)\n if uploaded_file = get\n uploaded_file.url(**options)\n else\n default_url(**options)\n end\n end",
"def page_url\n @page_url ||= generate_file_name(@site.config[\"url\"], @site.config[\"baseurl\"]).chomp('index.html').chomp('.html')\n end",
"def local_path\n check_and_copy_local_file_to_rails_public\n File.join('ajaxlibs', library_name, version, file_name)\n end",
"def url\n type = File.directory?(file) ? \"tree\" : \"raw\"\n name = file.path.split('/').last\n %{#{upstream}/#{type}/#{branch}/#{folder_name}/#{name}}\n end",
"def item_url(item)\n return unless files_url && item.file\n\n realpath = item.file.realpath\n return unless realpath.to_path.start_with?(local_root_realpath)\n\n path = realpath.relative_path_from(local_root_realpath)\n fragment =\n if item.start_line && (item.start_line != item.end_line)\n item_url_multiline_fragment(item.start_line, item.end_line)\n else\n item_url_line_fragment(item.line)\n end\n\n \"#{files_url}/#{path}##{fragment}\"\n end",
"def _local_path(config, filename)\n # TODO: move directly to _site?\n \"#{asset_path(config)}#{filename}\"\n end",
"def relative\n return self if relative?\n @relativized ||= relative_path_from root\n end",
"def relative_url_root\n @context.registers[:relative_url_root]\n end",
"def uri(path)\n return File.join(@base_url, path)\n end",
"def relative_path; end",
"def relative_path; end",
"def relative_path; end",
"def relative_path; end",
"def relative_path; end",
"def relative_config_file\n File.join(@settings[:config_dir], @settings[:config_file])\n end",
"def path_to_url(path, relative_to = nil)\n\n # Find the parent path we're in\n path = Pathname.new(path).realpath\n base = self.load_paths.find{|lp| path.to_s =~ /\\A#{Regexp.escape(lp.realpath.to_s)}/ }\n\n path = path.relative_path_from(base).cleanpath\n \n if relative_to\n if relative_to.to_s =~ /\\A\\//\n relative_to = Pathname.new(File.dirname(relative_to.to_s)).relative_path_from(base).cleanpath\n else\n relative_to = Pathname.new(File.dirname(relative_to.to_s))\n end\n path = Pathname.new(\"/\" + path.to_s).relative_path_from(Pathname.new(\"/\" + relative_to.to_s))\n path.to_s\n else\n \"/\" + path.to_s\n end\n \n end",
"def relative_path(options = {})\n @relative_path ||= Pathname.new(filename).relative_path_from(Pathname.new(base)).to_s\n path_with_cache_buster(@relative_path, options)\n end",
"def site_url(href)\n path_resolver = (@path_resolver ||= PathResolver.new)\n base_dir = path_resolver.posixify(@document.base_dir)\n site_root = path_resolver.posixify(@document.attr('site-root', base_dir))\n unless path_resolver.is_root? site_root\n raise ::ArgumentError, %(site-root must be an absolute path: #{site_root})\n end\n base_dir_to_root = nil\n if (base_dir != site_root) && (base_dir.start_with? site_root)\n comp, root = path_resolver.partition_path(base_dir.slice(site_root.length + 1, base_dir.length))\n base_dir_to_root = '../' * comp.length\n end\n path_resolver.web_path(href, base_dir_to_root)\n end",
"def response_uri(file)\n file.base_uri\n end",
"def pathWebSite\n \"./website/\"\nend",
"def relative_path\n @relative_path ||= File.join('_static', @name)\n end",
"def base_url_path; end",
"def base_url\n base_href || url\n end",
"def absolutize_url(url)\n # file_path = File.expand_path(File.join(working_directory, url))\n # full_path = File.expand_path(File.join(path, url))\n # full_path.gsub(File.expand_path(path), '')\n ('/' + url.split('./').last).gsub(%r(/+), '/')\n end",
"def path\n http_url @store.rdoc.generator.file_dir\n end",
"def path\n file.url\n end",
"def urlpath\n path = cleanpath\n path.blank? ? '/root' : '/' + path\n end",
"def base_url\n current_base_href = base_href.to_s.strip.empty? ? nil : URL.absolutify(base_href, URL.new(url).root_url)\n current_base_href || url\n end",
"def filename_to_url(filename)\n # Remove the cache path\n f = strip_prefix(filename, path)\n # Remove the leading . from the base filename\n f = strip_filename_prefix(f, '.')\n # Remove the leading / from the path\n f.slice!(0) if f.start_with?('/')\n # Return the full Aspire linked data URL\n ld_api.api_url(f)\n end",
"def compute_public_path(source, dir, options = {})\n source = source.to_s\n return source if is_uri?(source)\n\n source = rewrite_extension(source, options[:ext]) if options[:ext]\n source = rewrite_asset_path(source, dir, options)\n logger.debug \"1 #{source}\"\n source = rewrite_relative_url_root(source, ActionController::Base.relative_url_root)\n logger.debug \"2 #{source}\"\n source = rewrite_host_and_protocol(source, options[:protocol])\n logger.debug \"3 #{source}\"\n source\n end",
"def relative_path_to(path, relative_to = nil)\n if relative_to\n path = File.expand_path(\n # symlink, e.g. \"../../../../grid5000/environments/etch-x64-base-1.0.json\"\n path,\n # e.g. : File.join(\"/\", File.dirname(\"grid5000/sites/rennes/environments/etch-x64-base-1.0\"))\n File.join('/', File.dirname(relative_to))\n ).gsub(%r{^/}, '')\n end\n path\n end",
"def absolutify_url(src, base_url, parent_url)\n if src.nil? || src.empty? || src == \"//:\" || src =~ /\\s*http:\\/\\//i\n return src\n end\n \n return \"#{base_url}#{src}\" if src =~ /^\\s*\\//\n return \"#{parent_url}#{src}\" if parent_url\n return src\n end",
"def absolute_url\n\t\treturn \"#{$domain}/#{self.photo.url}\"\n\tend",
"def url\n if @url\n @url\n else\n begin\n\n page_name = File.basename(self.name, '.*')\n config = @config['permalinks'][page_name]\n\n if config.is_a? String\n @url = config\n self.data['permalink'] = nil\n else\n @config['permalinks'][File.basename(self.name, '.*')] = self.data['permalink']\n end\n rescue; end\n\n super\n\n if @url && @url =~ /\\/$/\n if self.ext == '.xml'\n @url = File.join(@url, \"index.xml\")\n else\n @url = File.join(@url, \"index.html\")\n end\n end\n\n @url\n end\n end",
"def file_url\n return nil if target_item.files.empty?\n target_item.files.last.uri.to_s\n end",
"def relative_url\n begin\n return Rails.application.routes.url_helpers.rails_blob_path(video, only_path: true)\n # url_for(clip.video) # for redirect links\n # rails_blob_path(clip.video, disposition: \"attachment\") # for downloads links\n rescue\n nil\n end\n end",
"def path\r\n url.gsub(/https?:\\/\\/[^\\/]+\\//i, '').scan(/([^&]+)/i).first().first()\r\n end"
] | [
"0.7806334",
"0.7460358",
"0.7424791",
"0.7263887",
"0.7171022",
"0.7136243",
"0.7017039",
"0.7009962",
"0.7009962",
"0.7009962",
"0.69828564",
"0.69804144",
"0.6970337",
"0.6915831",
"0.6847198",
"0.68245906",
"0.68220896",
"0.6810768",
"0.6796626",
"0.6789026",
"0.67888916",
"0.6754953",
"0.6733336",
"0.67332315",
"0.67178804",
"0.66662216",
"0.666346",
"0.6618121",
"0.66056365",
"0.6592661",
"0.65791804",
"0.65785336",
"0.6566199",
"0.65636754",
"0.6555059",
"0.6545865",
"0.6530041",
"0.65199953",
"0.65190667",
"0.6508344",
"0.6498595",
"0.6498595",
"0.6498595",
"0.64975375",
"0.64866114",
"0.64866114",
"0.64862657",
"0.64686143",
"0.6465592",
"0.64434433",
"0.6434318",
"0.64311624",
"0.6428171",
"0.64241135",
"0.6419228",
"0.6407787",
"0.6407481",
"0.6388914",
"0.63882804",
"0.6376143",
"0.63751173",
"0.63676506",
"0.6350915",
"0.6349147",
"0.63417435",
"0.63361394",
"0.63265723",
"0.6323197",
"0.6317771",
"0.6314194",
"0.63121843",
"0.62971514",
"0.6291182",
"0.6291182",
"0.6291182",
"0.6291182",
"0.6291182",
"0.62839",
"0.62808526",
"0.6278671",
"0.62712216",
"0.6267495",
"0.6264796",
"0.62497693",
"0.6245772",
"0.6244217",
"0.6243774",
"0.6238933",
"0.6238353",
"0.6226468",
"0.6199766",
"0.61881596",
"0.6187722",
"0.6175102",
"0.6171476",
"0.6167494",
"0.6166063",
"0.6164016",
"0.61625725",
"0.616021"
] | 0.6772832 | 21 |
this is the value returned when avatar_temp is called, where avatar is an upload_column | def temp_value #:nodoc:
if tempfile?
if original_filename
%(#{@temp_name}/#{filename};#{original_filename})
else
%(#{@temp_name}/#{filename})
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def avatar\n @data['avatar']\n end",
"def avatar\n @data['avatar']\n end",
"def avatar_file\n @attributes[:avatar_file]\n end",
"def avatar\n if object.dp.present?\n k = object.dp.url.gsub('upload','upload/g_face,c_thumb,w_150,h_150')\n else\n k = object.avatar\n end\n end",
"def defavatar\n @data['defAvatar']\n end",
"def defavatar\n @data['defAvatar']\n end",
"def father_avatar\n\n Tweet.find(self.tweet_id).user.url_photo\n\n end",
"def avatar\n avatar_id.nil? ? Photo.last : Photo.find(avatar_id)\n end",
"def avatar_url\n @data['avatarUrl']\n end",
"def avatar\n object.avatar.url\n end",
"def defAvatar\n @obj['defAvatar']\n end",
"def avatar_url\r\n return @user.avatar_url\r\n end",
"def avatar_url\n @attributes[:avatar_url]\n end",
"def avatar_url\n @attributes[:avatar_url]\n end",
"def get_avatar\n u = User.find_by_id(self.id)\n if u.role == 'user'\n return u.avatar.url unless u.avatar.nil?\n else\n info = Info.find_by_email(self.email)\n return info.info_avatar.image.url unless info.nil?\n end\n return nil\n end",
"def avatar_param\n nil\n end",
"def avatar_url\n uploaded ? avatar.url : \"/assets/no_avatar.png\"\n end",
"def avatar_filename\n if avatar_content_type == 'image/jpeg'\n self.avatar_file_name = 'avatar.jpg' if avatar.present?\n end\n end",
"def user_avatar_url\n @raw['user']['avatar_url']\n end",
"def getUploadedBy\r\n\t\t\t\t\treturn @uploadedBy\r\n\t\t\t\tend",
"def avatar\n if object.avatar.attached?\n if Rails.env === 'production'\n object.avatar.url\n else\n rails_blob_url(object.avatar)\n end\n end\n end",
"def picture\n if self.avatar?\n self.avatar.url\n elsif self.image_url != nil\n self.image_url\n else\n 'generic_avatar'\n end\n end",
"def author_avatar\n is_anonymous ? Avatar.default.url : user.profile.avatar.url\n end",
"def profile_photo\n\tend",
"def getPicturePath\n\t\t#return User.find(self.user_id)\n @profile = Profile.find(:first, :conditions => {:user_id => self.user_id})\n if @profile.avatar != '' and @profile.avatar!=nil\n return @profile.avatar\n else\n return @profile.picture_path\n end\n\t\t#return Profile.find(:first, :conditions => {:user_id => self.user_id}).picture_path\n\tend",
"def profile_picture\n profile_picture_file_name\n end",
"def getUploadedOn\r\n\t\t\t\t\treturn @uploadedOn\r\n\t\t\t\tend",
"def avatar_delete\n @attributes[:avatar_delete]\n end",
"def avatar\n image = images.where(:thumbnail => true).first \n if image.present?\n { :original => image.url(\"original\"),\n :listing => image.url(\"listing\"),\n :mini => image.url(\"mini\"),\n :thumb => image.url(\"thumb\") }\n end\n end",
"def avatar(avatar_holder)\n if avatar_holder.avatar.attached?\n avatar = avatar_holder.avatar\n else\n avatar = \"https://arena-fighter.s3.eu-west-3.amazonaws.com/avatar.jpg\"\n end\n end",
"def user_avatar(user)\n user.avatar ? user.avatar.photo.url(:thumb) : \"default-avatar.jpg\"\n end",
"def pull_image(value)\n user_hash = pull_records(value)\n id = user_hash[0][\"id\"]\n image_name = user_hash[0][\"image\"]\n image = \"images/uploads/#{id}/#{image_name}\"\nend",
"def author_avatar\n anonymous? ? Avatar.default.url : user.profile.avatar.url\n end",
"def show_avatar\n\n end",
"def show_avatar\n\n end",
"def avatar_url\n avatar_uri(object)\n end",
"def sender_picture\n user = User.find_by_id(sent_by)\n user.avatar_url\n end",
"def get_image_profile_pic\n last_pic = images.where(\"kind = ?\", \"profile_pic\").last\n\n if last_pic.nil?\n return \"/assets/octacat-resized.png\"\n else\n last_pic.url\n end\n end",
"def image\n return unless resource.avatar\n \"#{Seek::Config.site_base_host}/#{resource.class.table_name}\" \\\n \"/#{resource.id}/avatars/#{resource.avatar.id}?size=250\"\n end",
"def profile_photo\n photos = self.profile_photos\n photos.empty? ? 'http://ragatzi.s3.amazonaws.com/uploads/profile_default_1.png' : photos.last.photo.url\n end",
"def thumbnail\n thumbnails[3]\n end",
"def avatar\n respond_with(@user)\n end",
"def last_upload\n @last_upload ||= uploads.find(:first)\n end",
"def avatar_score\n \n if avatar.nil?\n User::F\n else\n User::A\n end\n end",
"def to_jq_upload\n {\n \"name\" => read_attribute(:avatar),\n \"size\" => avatar.size,\n \"url\" => avatar.url,\n \"thumbnail_url\" => avatar.thumb.url,\n \"delete_url\" => picture_path(:id => id),\n \"delete_type\" => \"DELETE\"\n }\n end",
"def file_field; end",
"def picdata\n object.imgdata\n end",
"def avatar\n return \"default_user.png\" unless self.job_id.present?\n the_job = Job.where(id: self.job_id).first\n return \"default_user.png\" unless the_job.present?\n the_job.icon_path\n end",
"def user_icon()\n photo_name_column(get_person, 65)\n end",
"def effective_avatar(ob, user, query)\n\n picture = ob.profile.picture\n\n if picture\n result = rest_reference(picture, query, true)\n result.name = \"avatar\"\n result\n else\n result = LibXML::XML::Node.new('avatar')\n result['resource'] = Conf.base_uri + '/images/avatar.png'\n result\n end\nend",
"def assignment_upload_file_name\n read_attribute(:file_name)\n end",
"def uploaded_file\n instance_read(:uploaded_file)\n end",
"def receiver_picture\n user = users.select { |user| !user.id.eql?(sent_by) }.first\n user.avatar_url\n end",
"def user_img_URL\n self.user.image_url\n end",
"def artist_avatar\n if self.avatar.attached?\n image_tag artist.avatar\n else\n image_tag 'default_avatar.jpg'\n end\n end",
"def user_avatar(user)\n if user.avatar.attached?\n return user.avatar\n elsif user.gender == \"Male\"\n return \"jimmy.png\"\n elsif user.gender == \"Female\"\n return \"sue.svg\"\n elsif user.gender == \"Non-Binary\"\n return \"yanny.svg\"\n else\n return \"blank-avatar.svg\"\n end\n end",
"def profile_image(id)\n unless id.blank?\n profile = Profile.find_by_user_id(id)\n if !profile.profile_image.blank?\n return url_for_file_column(profile, \"profile_image\",\"submain\")\n else \n return \"/images/home/noprofile_photo.gif\"\n end\nend\nend",
"def getUploadfile\r\n\t\t\t\t\treturn @uploadfile\r\n\t\t\t\tend",
"def dataset_uid\n @raw_image_files.first.dicom_series_uid ? \n @raw_image_files.first.dicom_series_uid : @raw_image_files.first.image_uid\n end",
"def cur_image\n self\n end",
"def image\n 0\n end",
"def avatar_content_type\n false\n end",
"def photo\n Photo.find_by_id(self.profile_photo_id)\n end",
"def has_avatar?\n avatar.present? or read_attribute(:fb_avatar)\n end",
"def get_image_name(user_hash)\n image_name = user_hash[\"image\"][:filename]\nend",
"def picture\n if model.picture and File.file?(model.asset_path_for_image)\n model.picture\n else\n model.update_cache\n ''\n end\n end",
"def uploaded_data\n return \"\"\n end",
"def fb_avatar(format=:normal)\n if format == :normal\n self.read_attribute(:fb_avatar).gsub(/^http:/, 'https:').split(\"?\")[0] << \"?width=200&height=200\" unless self.read_attribute(:fb_avatar).nil?\n elsif :thumb\n self.read_attribute(:fb_avatar).gsub(/^http:/, 'https:').split(\"?\")[0] << \"?width=50&height=50\" unless self.read_attribute(:fb_avatar).nil?\n elsif :small_thumb\n self.read_attribute(:fb_avatar).gsub(/^http:/, 'https:').split(\"?\")[0] << \"?width=30&height=30\" unless self.read_attribute(:fb_avatar).nil?\n else\n self.read_attribute(:fb_avatar).gsub(/^http:/, 'https:').split(\"?\")[0] << \"?width=100&height=100\" unless self.read_attribute(:fb_avatar).nil?\n end\n end",
"def profilepicture\n if portfolio\n portfolio.photo\n end\n end",
"def image()\n @image__\n end",
"def render_super_tiny_avatar_for(user)\n if user.avatar?\n image_tag(user.avatar.small.url, class: 'media-object thumbnail').html_safe\n else\n image_tag('fallback/default.gif', height: '35px', width: '35px', class: 'media-object thumbnail').html_safe\n end\n end",
"def avatar_image=(val)\n return false if avatar_state == :locked\n\n # Clear out the old avatar first, in case of failure to get new avatar.\n # The order of these attributes is standard throughout the method.\n self.avatar_image_source = 'no_pic'\n self.avatar_image_url = nil\n self.avatar_image_updated_at = Time.zone.now\n self.avatar_state = 'approved'\n\n # Return here if we're passed a nil val or any non-hash val (both of which\n # will just nil the user's avatar).\n return unless val.is_a?(Hash)\n external_avatar_url_patterns = Setting.get('avatar_external_url_patterns', '^https://[a-zA-Z0-9.-]+\\.instructure\\.com/').split(/,/).map {|re| Regexp.new re}\n\n if val['url'] && val['url'].match?(GRAVATAR_PATTERN)\n self.avatar_image_source = 'gravatar'\n self.avatar_image_url = val['url']\n self.avatar_state = 'submitted'\n elsif val['type'] == 'attachment' && val['url']\n self.avatar_image_source = 'attachment'\n self.avatar_image_url = val['url']\n self.avatar_state = 'submitted'\n elsif val['url'] && external_avatar_url_patterns.find { |p| val['url'].match?(p) }\n self.avatar_image_source = 'external'\n self.avatar_image_url = val['url']\n self.avatar_state = 'submitted'\n end\n end",
"def profile_picture\n\t\tFbGraph::User.me(self.oauth_token).fetch.picture(width: 150, height: 200)\n\tend",
"def base_image\n self\n end",
"def avatar_delete\n @avatar_delete ||= \"0\"\n end",
"def image_uid\n @dicom_image_uid || @image_uid\n end",
"def file_name\n uploaded_file_file_name\n end",
"def poster_image\n super.presence || cell.poster_image\n end",
"def unit_members_thumb\n Staff.find(:all, :conditions=> ['id IN?', unit_members]).map(&:thumb_id).compact #[5658]\n end",
"def avatar_photo (person)\n if person.image.attached?\n image_tag person.image\n else\n image_tag \"static/placeholder.jpg\"\n end\n end",
"def image_file\n return @image_file\n end",
"def default_image\n \t @default_photo = PhotoUser.where('user_id = ? AND first_image = 1 AND image IS NOT NULL',self.id)\n \t if @default_photo.count > 0\n \t\t@mydefault_photo = PhotoUser.find(@default_photo[0].id)\n \t\treturn @mydefault_photo\n \t else\n \t\treturn nil\n \t end\n end",
"def rep_image\n\t photos.first\n\tend",
"def avatar\n @user = current_user\n @user.avatar.attach(params[:avatar][:avatar])\n respond_to do |format|\n format.js\n end\n end",
"def thumb_title_photo\n title_photo\n end",
"def store_blob(object,field_name,blob)\n super #=> returns blob[:tempfile]\n end",
"def scanned_image_id\n scanned_retreat_id\n end",
"def default_avatar\n not object.avatar.present?\n end",
"def main_image\n self.images.first.image\n end",
"def role_avatar\n \"/assets/#{role}_profile_pics/thumb/missing.png\"\n end",
"def image_column(record)\n image_tag url_for_file_column(record, 'image') if record.image\nend",
"def profile_avatar\n if current_user.update(params.require(:user).permit(:avatar))\n render :profile_avatar\n else\n render(json: { errors: current_user.errors.full_messages }, status: :unprocessable_entity) && return\n end\n end",
"def user_avatar(user_id)\n user = User.find!(user_id)\n if user.avatar.attached?\n image_tag user.avatar\n else\n image_tag \"../images/Littlefinger_Main.jpg\"\n end\n end",
"def attributes\n data = super\n photo_path = File.join(api_user_dir(data[:username]), USER_PHOTO_FILENAME)\n username = (File.exists? photo_path)? data[:username]: 'default'\n photo_url = \"#{user_url(options[:host], username)}/#{USER_PHOTO_FILENAME}\"\n data.to_a.insert(6, [:photo_url, photo_url]).to_h\n end",
"def thumbnail\n\t\t\t@data[\"thumbnail\"][\"source\"]\n\t\tend",
"def render_avatar(request)\n if !request.after_photo_url.blank?\n render partial: \"avatar\", locals: { link: request.after_photo_url_url(:thumb) }\n else\n if current_user && current_user.id == request.requestor_id && request.current_status >= 10\n render partial: \"upload_photo\", locals: { request: request }\n else\n if !request.before_photo_url.blank?\n render partial: \"avatar\", locals: { link: request.before_photo_url_url(:thumb) }\n else\n render partial: \"avatar\", locals: { link: \"profile.png\" }\n end\n end\n end\n end",
"def get_upload_response(var)\n return nil unless is_upload?(var)\n\n Upload.find(self[var.to_sym].map { |up_hash| up_hash[:id] })\n end",
"def has_shelby_avatar() !self.avatar_file_name.blank?; end",
"def image\n return @children['image'][:value]\n end",
"def render_tiny_avatar_for(user)\n if user.avatar?\n image_tag(user.avatar.tiny.url).html_safe\n else\n image_tag('fallback/default.gif', height: '35px', width: '35px').html_safe\n end\n end",
"def image_hash; end"
] | [
"0.7060572",
"0.7060572",
"0.69240475",
"0.6830996",
"0.6807751",
"0.6807751",
"0.6607059",
"0.65829194",
"0.65310305",
"0.65066284",
"0.6438627",
"0.64014286",
"0.6387693",
"0.6387693",
"0.6367911",
"0.6359177",
"0.6346424",
"0.6255814",
"0.6240763",
"0.6220346",
"0.6193119",
"0.6150645",
"0.61010873",
"0.60704404",
"0.6052006",
"0.6019767",
"0.59998286",
"0.5966701",
"0.59371173",
"0.59189683",
"0.58785546",
"0.58771676",
"0.5864527",
"0.58326733",
"0.58326733",
"0.5826924",
"0.58053166",
"0.5804355",
"0.57986003",
"0.57923335",
"0.57921183",
"0.57779205",
"0.5759692",
"0.5756849",
"0.5741547",
"0.5738566",
"0.57291",
"0.57202244",
"0.57102215",
"0.570957",
"0.57023144",
"0.57012576",
"0.56989014",
"0.5673491",
"0.56414634",
"0.5641116",
"0.56318253",
"0.5615214",
"0.560853",
"0.5608215",
"0.5605888",
"0.5603266",
"0.5597571",
"0.558982",
"0.5586566",
"0.55864537",
"0.5585604",
"0.55789644",
"0.55746406",
"0.5574563",
"0.55650896",
"0.5562951",
"0.5556428",
"0.55540377",
"0.5546745",
"0.55453557",
"0.554098",
"0.5540684",
"0.5535195",
"0.5531668",
"0.5526492",
"0.55186",
"0.55133337",
"0.5509169",
"0.5508269",
"0.54961556",
"0.54852736",
"0.54762256",
"0.54733616",
"0.5463365",
"0.5461975",
"0.5452222",
"0.54486126",
"0.54363286",
"0.5425163",
"0.5419951",
"0.53957677",
"0.5394122",
"0.5390783",
"0.5380236",
"0.53735185"
] | 0.0 | -1 |
TODO: this is a public method, should be specced | def move_to_directory(dir)
p = File.join(dir, self.filename)
if copy_file(p)
@path = p
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def probers; end",
"def schubert; end",
"def implementation; end",
"def implementation; end",
"def custom; end",
"def custom; end",
"def identify; end",
"def refutal()\n end",
"def weber; end",
"def formation; end",
"def overrides; end",
"def internal; end",
"def suivre; end",
"def spec; end",
"def spec; end",
"def terpene; end",
"def wrapper; end",
"def private_method\n end",
"def offences_by; end",
"def verdi; end",
"def sitemaps; end",
"def intensifier; end",
"def operations; end",
"def operations; end",
"def isolated; end",
"def isolated; end",
"def extra; end",
"def strategy; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def berlioz; end",
"def who_we_are\r\n end",
"def from; end",
"def from; end",
"def from; end",
"def from; end",
"def anchored; end",
"def handle; end",
"def tell()\n #This is a stub, used for indexing\n end",
"def stderrs; end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def zuruecksetzen()\n end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def original; end",
"def initialize\n\n end",
"def initialize\n\n end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def initialize\n\t\t\n\tend",
"def implemented_in; end",
"def reflector; end",
"def reflector; end",
"def trd; end",
"def original_result; end",
"def villian; end",
"def processor; end",
"def used?; end",
"def loc; end",
"def loc; end",
"def loc; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def initialize; end",
"def r; end",
"def r; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def call; end",
"def call; end"
] | [
"0.7712056",
"0.673119",
"0.673119",
"0.673119",
"0.673119",
"0.64687943",
"0.63749635",
"0.6203464",
"0.6203464",
"0.6079689",
"0.6079689",
"0.60192215",
"0.6017107",
"0.59162885",
"0.5862696",
"0.5795702",
"0.5789549",
"0.57723945",
"0.57695085",
"0.57695085",
"0.5726146",
"0.57110304",
"0.570974",
"0.57021296",
"0.56903195",
"0.56733626",
"0.5650563",
"0.5639167",
"0.5639167",
"0.56226164",
"0.56226164",
"0.56060576",
"0.5574384",
"0.55365896",
"0.55365896",
"0.55365896",
"0.55365896",
"0.55365896",
"0.55365896",
"0.55365896",
"0.55365896",
"0.55365896",
"0.55331415",
"0.553062",
"0.55236334",
"0.55236334",
"0.55236334",
"0.55236334",
"0.5514434",
"0.5504609",
"0.5501904",
"0.5482464",
"0.5477053",
"0.5477053",
"0.5477053",
"0.5477053",
"0.5469887",
"0.54681045",
"0.54681045",
"0.54598165",
"0.5456114",
"0.5456114",
"0.5450997",
"0.5450997",
"0.5450997",
"0.5450997",
"0.5449687",
"0.5444704",
"0.54424936",
"0.54424936",
"0.5440696",
"0.5437507",
"0.5433239",
"0.54268956",
"0.540211",
"0.5398249",
"0.5398249",
"0.5398249",
"0.5377071",
"0.5377071",
"0.5377071",
"0.5377071",
"0.5377071",
"0.5377071",
"0.5377071",
"0.5377071",
"0.5377071",
"0.5377071",
"0.5377071",
"0.53755295",
"0.53755295",
"0.53730464",
"0.53730464",
"0.53730464",
"0.53730464",
"0.53730464",
"0.53730464",
"0.53730464",
"0.53730464",
"0.5372448",
"0.5372448"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def postular_params
params.require(:postular).permit(:user_id, :idea_id, :oferta)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] | 0.0 | -1 |
CORRECT. This works, but the only thing is that if one of the numbers is correct but the other incorrect, it makes you start over, instead of saving the correct number and only asking for the incorrect number again. Better userexperience if it saves the correct number. Provided answer: | def valid_number?(number_string)
number_string.to_i.to_s == number_string && number_string.to_i != 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number2(second_guess)\n\tsecond_guess = gets.chomp\n\n\tif second_guess == secret_number\n\t\tputs \"Yes, #{second_guess} is correct. You win Secret Number!\"\n\telse\n\t\tputs \"#{second_guess} is not correct either. You have one more guess.\"\n\t\tlast_guess = number3(last_guess)\n\tend\n\nend",
"def correct!\n correct\n save if changed?\n reset\n end",
"def check_guess\n reset_guess\n check_number_and_position\n check_number_only\n fill_result\n @result\n end",
"def number3(last_guess)\n\t\tlast_guess = gets.chomp\n\n\tif last_guess == secret_number\n\t\tputs \"Yup, #{last_guess} is the Secret Number. You win Secret Number!\"\n\telse \n\t\tputs \"#{last_guess} is not correct. Sorry, you lose the game..the Secret Number was 8.\"\n\tend\n\nend",
"def number1(first_guess)\n\tfirst_guess = gets.chomp\n\n\tif first_guess == secret_number\n\t\tputs \"Nice job, #{first_guess} is correct. You win Secret Number!\"\n\telse \n\t\tputs \"#{first_guess} is not correct. You have two guesses left. Try again!\"\n\t\tsecond_guess = number2(second_guess)\n\tend\n\nend",
"def guess_correct?(guess)\n if guess == @secret_number.mynumber then return true end\n return false\n end",
"def question_and_answer(with_error, zero_or_one, mistery_num)\n message = \"Do you see your number here: (y)(n). To exit the game enter the letter e.\".colorize(:blue)\n if with_error == true\n puts \"\\nIncorrect Answer. \" + message\n else \n puts \"\\n#{message}\"\n end \n answer = gets.chomp.upcase\n case answer\n when \"Y\", \"YES\"\n if zero_or_one % 2 == 0\n mistery_num +=\"0\"\n else\n mistery_num +=\"1\"\n end\n return mistery_num\n when \"N\", \"NO\"\n if zero_or_one % 2 == 0\n mistery_num +=\"1\"\n else\n mistery_num +=\"0\"\n end\n return mistery_num\n when \"E\"\n return \"break\"\n else\n question_and_answer(true, zero_or_one, mistery_num)\n end \nend",
"def if_correct(ok_guess, number_guesses, secret_number) \n\tnumber_guesses = number_guesses - 1\t# STEP 6 - Subtracts one of the player's guesses\n\t\tif ok_guess == secret_number\n\t\t\tputs \"Congratulations! You got it right! You win!!!\"\n\t\telsif ok_guess < secret_number \n\t\t\tputs \"Good try, but guess a little higher.\"\n\t\t\tputs guesses_left(number_guesses) # STEP 7 - Tells the player how many guesses s/he has left\n\t\telse ok_guess > secret_number\n\t\t\tputs \"Good try, but guess a little lower.\"\n\t\t\tputs guesses_left(number_guesses) # STEP 7 - Tells the player how many guesses s/he has left\n\t\tend\nend",
"def is_right question_number, answer_number\n #puts \"is_right \" + question_number.to_s + \"-----\" + answer_number.to_s\n number_regexp = Regexp.new('^' + question_number.to_s)\n answer = @answer_file_lines.select {|el| el =~ number_regexp}.first.strip\n #puts \"#{answer_number} -- #{answer.split('-')[1].split(',')}\"\n answer.split('-')[1].split(',').include?(answer_number.to_s)\n end",
"def check_answer\n if guess.to_i != question.num1 + question.num2\n puts \"#{@current_player.name}: Nope! That's the wrong answer\"\n @current_player.lives -= 1\n if @current_player.lives == 0\n \n puts \"#{@other_player.name} wins with a score of #{@other_player.lives}/3!\"\n puts \"----- GAME OVER -----\"\n puts \"Good bye!\"\n exit(0)\n else\n puts \"P1: #{player1.lives}/3 vs P2: #{player2.lives}/3\"\n puts \"\"\n puts \"----- NEW TURN -----\"\n end\n else\n puts \"#{@current_player.name}: YES! You are correct\"\n puts \"P1: #{player1.lives}/3 vs P2: #{player2.lives}/3\"\n puts \"\"\n puts \"----- NEW TURN -----\"\n end\n end",
"def guess(number)\n unless number == @answer\n return false\n else\n return true\n end\n end",
"def correct?\n if !( /^[0-9]{4}$/ =~ @user_try) || @user_try.split(\"\").uniq!\n puts 'Please, enter different 4 numbers'\n return false\n end\n return true\n end",
"def test_correct_number_user_answer_1\n assert_equal @round.number_correct, 0\n result = @round.record_guess(\"Juneau\")\n assert_equal @round.number_correct, 1\n end",
"def run\n #handle invalid input\n guess = gets\n guess.strip!\n unless guess =~ /\\d/ and guess.length == 4\n puts 'Please retry with a valid combination of 4 digits, e.g. 1234'\n run\n end\n\n response = {correct_digits: 0, correct_place: 0}\n guess.each_char do |char|\n if @result.include? char.to_i\n response[:correct_digits] += 1\n end\n end\n\n guess.each_char.to_a.each_with_index do |char, index|\n if char == @result[index].to_s\n response[:correct_place] += 1\n end\n end\n\n if response[:correct_place] == 4 && response[:correct_digits] == 4\n puts \"You got it! The result is #{@result.join}\"\n else\n puts \"Your have #{response[:correct_digits]} digits correct, and #{response[:correct_place]} are in the right place.\"\n run\n end\nend",
"def set_incorrect_answer\r\n set_question_and_answer\r\n @answer.correct = 0\r\n save_answer_and_render\r\n end",
"def valid_num_prompt\n puts \"Type a number you would like to use for this operation.\"\n answer = gets.chomp\n\n if valid_num?(answer) == false # this part works, but only two times.\n puts \"Please type in a valid number.\" # I can't figure out how to make it recursively go back.\n answer = gets.chomp\n answer\n else\n answer.to_i\n end\nend",
"def number_validation (input)\n eval_num = nil \n until eval_num == \"Pass\" do\n # transforms a copy of the user input to check against the original value\n input_v = input.to_f*100\n input_v = input_v.to_i.to_s\n input_w = input.delete(\".\")\n if input == input.to_f.to_s\n eval_num = \"Pass\"\n elsif input == input.to_i.to_s\n eval_num = \"Pass\"\n elsif input_v == input_w \n eval_num = \"Pass\"\n else\n print \"Oh nos! You entered some non-number character. Enter a new one: \"\n input = gets.chomp\n end\n end \n return input\nend",
"def guess_number_2\n random_number = rand(10) # rand gives a random number between 0 and x-1\n puts \"Guess a number, any number!\"\n answer = gets.chomp.to_i\n while answer != random_number\n puts \"Please guess again\"\n answer = gets.chomp.to_i\n end\n puts \"You guessed correctly! The random number is #{random_number}.\"\nend",
"def wrong_ans\n puts \"What do you think it is ?\"\n @guess_no = gets.chomp.to_i\n\n if @guess_no > @rand_no\n puts \"go a little lower\"\n elsif @guess_no < @rand_no\n puts \"go a little higher\"\n end\n\n @chances += 1\nend",
"def knowTheGameTrick\n\tputs \"Do you wanna know the trick of this game?\"\n\tputs \"If YES then type 1 and if NO then type 2.\"\n\tuserAnswer = gets\n\n\tif userAnswer.to_i == 1\n\t\tputs \"This game is designed according to halving technique (can also be called as Binary Search) where you are given only certain chances.\"\n\t\tputs \"Since computer says you whether the guessed number was high or low, you have to always guess the middle number and go on guessing the middle number everytime the range changes.\"\n\telse\n\t\tputs \"I guess, you probably knew the trick of the game. Thanks for playing. Enjoy!\"\n\tend\n\nend",
"def change_one_digit_score_difference\n raise TheProgrammerIsStupidError unless memory[-2]\n\n memory[-1].correct - memory[-2].correct\n end",
"def initialize answer; @answer = answer\n@solved = false\n# Validate input\n raise \"Answer must be between 1 and 100\" unless VALID_Numbers.include? @answer\n end",
"def correct_guess(guess)\n end",
"def test_input(input, guessing_number)\n correct = []\n guessing_number = guessing_number.map { |value| value }\n correct_pos(guessing_number, input, correct)\n wrong_pos(guessing_number, input, correct)\n correct\n end",
"def correct_mcq(correct_choice_id, wrong_choice_id = nil, value = 1.0)\n if correct_choice_id.nil? || !correct_choice_id.is_a?(Integer)\n puts \"Invalid Choice ID\"\n return false\n end\n \n exercise_version_id = self.id\n correct_choice = Choice.find(correct_choice_id)\n wrong_choice = nil \n if wrong_choice_id.nil?\n all_choices = Choice.where(multiple_choice_prompt: correct_choice.multiple_choice_prompt)\n all_choices.each do |c|\n wrong_choice = c if c.value == 1.0 \n end\n binding.pry\n end \n wrong_choice ||= wrong_choice_id ? Choice.find(wrong_choice_id) : nil \n \n if correct_choice.multiple_choice_prompt_id != wrong_choice.multiple_choice_prompt_id\n puts \"Choices are not from the same question\"\n return false\n end\n correct_choice.reset_value(value)\n wrong_choice.reset_value(0.0) if wrong_choice\n \n attempts.each do |attempt|\n delta = 0.0\n if correct_choice_id == attempt.prompt_answers[0].specific.choices[0].id && attempt.score <= 0.0\n delta = value\n elsif wrong_choice && wrong_choice.id == attempt.prompt_answers[0].specific.choices[0].id && attempt.score > 0.0\n delta = -1.0 * value\n end\n binding.pry\n puts attempt.id,\"\\n DELTA: \\n\", delta\n if attempt.workout_score\n multiplier = ExerciseWorkout.find_by(exercise: exercise, workout: attempt.workout_score.workout).points\n if attempt.active_score\n attempt.active_score.rescore(delta * multiplier)\n end\n else\n multiplier = 10.0\n end\n attempt.rescore(delta * multiplier)\n end\n return true\n end",
"def eval_num(secret_num, guess, tries)\n\tif guess == secret_num\n\t\tcongrats(secret_num, tries)\n\telsif tries >= 3\n\t\tputs \"\\nSorry that was your last try. Better luck next time!\"\n\telse\n\t\tif guess > 10\n\t\t\tputs \"\\nWhoa whoa whoa.. your guess is way too large! Remember it's a number from 1-10.\"\n\t\telsif guess < 1\n\t\t\tputs \"\\nOkay.. let me jog your memory.. Remember it's a number from 1-10.\"\n\t\telse\n\t\t\tif guess > secret_num\n\t\t\t\tputs \"\\nA little lower.. Almost there.\"\n\t\t\telsif guess < secret_num\n\t\t\t\tputs \"\\nA little higher.. You got this.\"\n\t\t\tend\n\t\tend\n\t\ttry_again(secret_num, tries)\n\tend\nend",
"def guess\n puts 'Guess a number between 1-100, You only have 5 tries to get it right.'\n\n guess = gets.to_i\n\n if guess == @number\n puts 'WOW!! You guessed it on the first try!'\n else\n keep_guessing guess\n end\n end",
"def almostwin(my_number, winning_num)\n\n correct_numbers = 0\n\n z = 0\n\n \t winning_num.length.times do\n\n i = 0\n\n \t\twinning_num.length.times do\n\n \t\t\tif my_number[z] == winning_num[i]\n\n \t\t\t\tcorrect_numbers += 1\n\n \t\t \tend\n\n \t\t\t i += 1\n\n\t\tend\n\n\t\tz += 1\n\n\tend \n\n correct_numbers == winning_num.length - 1\n\n end",
"def guessgame\n prev_guess = 0\n comp_guess = ((rand * 100) + 1).floor\n attempts = 10\n while attempts >= 1\n print \"Guess the number : \"\n user_guess = gets.chomp.to_i\n if user_guess != prev_guess\n if user_guess > comp_guess\n puts 'Guess was higher'\n elsif user_guess < comp_guess\n puts \"Guess was lower\"\n else\n puts \"You are correct, the answer is #{comp_guess} indeed!\"\n break\n end\n attempts -= 1\n prev_guess = user_guess\n else\n puts \"Guess was same as last attempt, try a different number\"\n end\n puts \"You have #{attempts} attempts left\"\n end\nend",
"def correct?\n\n if @guess == @card.answer #returned false. Fixed it.\n p true\n elsif @guess != @card.answer\n p false\n end\n end",
"def guess_the_number(guess, num)\n if guess == num\n puts \"that's the number!\"\n else\n puts \"not the same number\"\n end\nend",
"def compare_codes(guess)\n #make a reference that won't destroy the original secret code\n secret = secret_code.clone\n\n exact = check_exact(guess, secret)\n if exact == 4\n #tell the caller we have a winner\n return true\n else\n partial = check_partial(guess, secret)\n puts \"Correct value and position: #{exact}\\nCorrect value, wrong position: #{partial}\\n\\n\"\n return false\n end\n end",
"def guess_number_3\n tries = 1\n random_number = rand(10) # rand gives a random number between 0 and x-1\n puts \"Guess a number, any number!\"\n answer = gets.chomp.to_i\n while answer != random_number\n puts \"Please guess again. You have had #{tries} tries so far.\"\n tries += 1\n answer = gets.chomp.to_i\n end\n puts \"You guessed correctly! The random number is #{random_number}.\"\n puts \"It took you #{tries} tries to guess the number correctly.\"\nend",
"def verify_answer(answer)\n if answer == @total.to_s\n puts \"Right!\".green\n @current_player.get_point\n else\n puts \"Wrong! The correct answer is #{@total}.\".red\n @current_player.lose_life\n end\n end",
"def check_answer(answer, real_answer)\n modified_real_answer = (real_answer.to_i != 0 && real_answer.to_s != '0') ? real_answer.to_i.to_words.downcase : real_answer\n modified_answer = (answer.to_i != 0 && answer.to_s != '0') ? answer.to_i.to_words.downcase : answer\n modified_real_answer.gsub!(/ and /,'')\n modified_real_answer.gsub!(/[ ,]*/,'')\n modified_answer.gsub!(/ and /,'')\n modified_answer.gsub!(/[ ,]*/,'')\n modified_answer == modified_real_answer ? true : false\n end",
"def correct?\n @correct ||= (answer == correct_answer)\n end",
"def guess(number)\n @number = number\n solved? ? :correct : @number > @answer ? :high : :low\n end",
"def number_correct\n number_correct = 0\n if current_card.answer == turns[turns.length - 1].guess\n number_correct + 1\n end\n end",
"def get_correct_answer(question_prompt, answers)\n question_prompt = question_prompt.downcase\n answer = nil\n case question_prompt\n when /which number goes with your street on/\n answer = answers[answers.index('3612') || answers.index('5555') || answers.index('None of the above')]\n when /which street have you lived on/\n answer = answers[answers.index('BEACH') || answers.index('None of the above') || 0]\n when /in which city is/\n answer = answers[answers.index('ATLANTA') || answers.index('None of the above')]\n when /in which county was your/\n answer = answers[answers.index('FULTON') || answers.index('None of the above')]\n when /what year is your/\n answer = answers[answers.index('2005')]\n when /which of the following people do you know/\n answer = answers[answers.index('ANTHONY BROWN') || answers.index('None of the above')]\n when /in wich year were you born/\n answer = answers[answers.index('1975')]\n when /what type of residence is/\n answer = answers[answers.index('Single Family Residence')]\n when /in which month month were you born/\n answer = answers[answers.index('FEBRUARY')]\n when /in which county have you lived/\n answer = answers[answers.index('FULTON') || answers.index('None of the above')]\n when /what are the last two digits of your social security number/\n answer = answers[answers.index('33')]\n when /at which of the following addresses have you lived/\n answer = answers[answers.index('None of the above')]\n when /which person is not a relative or someone that you know/\n answer = answers.grep(/SMITH/).first\n when /with which name are you associated/\n answer = answers[answers.index('None of the above')]\n when /what are the first two digits of your social security number/\n answer = answers[answers.index('11') || answers.index('None of the above')]\n when /which of the following phone numbers is related to you/\n answer = answers[answers.index('None of the above')]\n when /from whom did you purchase the property at/\n answer = answers[answers.index('JOE ANDERSON') || answers.index('None of the above')]\n when /how long have you been associated with the property at/\n answer = answers[answers.index('Over 5 years')]\n when /what is the approximate square footage of the property at/\n answer = answers[answers.index('Over 2,500')]\n when /when did you purchase the property at/\n answer = answers[answers.index('August 1999') || answers.index('None of the above')]\n when /between/ && /in which state did you live/\n answer = answers[answers.index('NEW YORK')]\n when /when did you purchase or lease your/\n answer = answers[answers.index('December 2006')]\n when /with which name are you associated/\n answer = answers[answers.index('None of the above')]\n end\n answer\n end",
"def guess_number_1\n random_number = rand(10) # rand gives a random number between 0 and x-1\n puts \"Guess a number, any number!\"\n answer = gets.chomp.to_i\n if answer == random_number\n puts \"You guessed right, the number is #{random_number}.\"\n else\n puts \"Unfortunately, that's not quite right. The number is #{random_number}.\"\n end\nend",
"def correct?\n person_id == guessed_person_id\n end",
"def check_correct_answer\n puts 'Answer was correct!!!!'\n @purses[@current_player] += 1\n current_purses = @purses[@current_player]\n puts \"#{@players[@current_player]} now has #{@purses[@current_player]} Gold Coins.\"\n check_current_player\n current_purses\n end",
"def try_again(secret_num, tries)\n\tguess = new_guess(tries).to_i\n\ttries = tries + 1 \t\t\t\t\t\n\teval_num(secret_num, guess, tries)\nend",
"def another_calculation?\n answer = ' '\n loop do\n prompt(MESSAGES['another_loan'])\n answer = Kernel.gets().chomp().downcase()\n if YES_ANSWERS.include?(answer)\n answer = 1\n break\n elsif NO_ANSWERS.include?(answer)\n answer = 2\n break\n else\n prompt(MESSAGES['exit_error'])\n end\n end\n answer\nend",
"def valid_guess(guess) \n\twhile guess < 1 || guess > 10 \n\t\tputs \"Oops! Invalid number. Please guess a number between 1 and 10. What's your guess?\"\n\t\tguess = gets.to_i\n\tend\n\tok_guess = guess\nend",
"def incorrect_guess(guess)\n end",
"def evaluate_guess\n\t\t# How many were right\n\t\tright_guesses = 0\n\t\t# How many were close\n\t\talmost_guesses = 0\n\t\t# Put answer and guess in a temporary array for modifying\n\t\ttemp_answer = []\n\t\ttemp_guess = []\n\t\[email protected] { |n| temp_answer << n }\n\t\t@board[-1].each { |n| temp_guess << n }\n\t\t# Go through each digit in answer to see how many were correct\n\t\ttemp_answer.each_with_index do |num, i|\n\t\t\t# If corresponding digit in guess is correct...\n\t\t\tif temp_guess[i] == num\n\t\t\t\t# Increase right variable\n\t\t\t\tright_guesses += 1\n\t\t\t\t# And change both numbers in temporary array to invalid numbers so they don't get counted in the next step\n\t\t\t\ttemp_guess[i] = 9\n\t\t\t\ttemp_answer[i] = 8\n\t\t\tend\n\t\tend\n\t\t# Go through each digit in answer to see how many were close\n\t\t# The arrays now have correct digits taken out so they don't get counted again\n\t\ttemp_answer.each_with_index do |num, i|\n\t\t\tnext_num = 0\n\t\t\t# Step through each digit in guess\n\t\t\t4.times do |x|\n\t\t\t\t# If guess is the same\n\t\t\t\tif temp_guess[x] == num && next_num == 0\n\t\t\t\t\t# Increase almost variable and take out digits\n\t\t\t\t\talmost_guesses += 1\n\t\t\t\t\ttemp_guess[x] = 9\n\t\t\t\t\ttemp_answer[i] = 8\n\t\t\t\t\t# Move on to next number in answer array so it doesn't get counted again\n\t\t\t\t\tnext_num = 1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t# Add how many were right and close to the evaluate array\n\t\t@evaluate << \"#{right_guesses} right, #{almost_guesses} close\"\n\t\t# Let user guess again\n\t\tif @master == \"comp\"\n\t\t\tguess_again\n\t\t# If computer is guessing, use feedback to narrow down its options\n\t\telsif @master == \"user\"\n\t\t\t# Nothing was right or close, so take all numbers in last guess out of options\n\t\t\tif almost_guesses == 0 && right_guesses == 0\n\t\t\t\t@board[-1].each do |num_to_delete|\n\t\t\t\t\t4.times do |pot_ans_index|\n\t\t\t\t\t\tarr = @potential_numbers[pot_ans_index]\n\t\t\t\t\t\tarr.delete(num_to_delete)\n\t\t\t\t\t\t@potential_numbers[pot_ans_index] = arr\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t# None were right but some were close, so take each number out of its options for JUST that index\n\t\t\telsif right_guesses == 0 && almost_guesses > 0\n\t\t\t\t@board[-1].each_with_index do |num_to_delete, i|\n\t\t\t\t\tarr = @potential_numbers[i]\n\t\t\t\t\tarr.delete(num_to_delete)\n\t\t\t\t\t@potential_numbers[i] = arr\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def test_number_correct_still_equals_1\n card_1 = Card.new(\"3\", \"Hearts\")\n card_2 = Card.new(\"4\", \"Clubs\")\n deck = Deck.new([card_1, card_2])\n round = Round.new(deck)\n new_guess_1 = round.record_guess({value: \"3\", suit: \"Hearts\"})\n new_guess_2 = round.record_guess({value: \"Jack\", suit: \"Diamonds\"})\n assert_equal 50.0, round.percent_correct\nend",
"def good_guess?(num1)\n\tnum1.to_i == 42? true:false\nend",
"def correct?\n @guess == @card.answer\n end",
"def correct?\n if self.guess == Card.find(self.card_id).response && !self.first_time_correct\n self.ever_correct = true\n else\n self.ever_correct = false\n end\n end",
"def correct_guess(i,guess,secret_number,name)\n case\t\n when i==1 \n \tputs \"I don't believe it! You got it on your first try! The number is #{secret_number}.\" \t\n when i==2\n \tputs \"I guess #{secret_number} is your lucky number. It won't be that easy next time.\" \t\n when i==3\n \tputs \"Yes you are right, the number is #{secret_number}. I guess you won, #{name}.\"\n else\n \tputs \"Okay you win. The number is #{secret_number}.\" \t\n end\n puts \"Today is your lucky day. Congrats!\"\n puts \"Want to try something harder? \\nType 'Yes' or 'No'.\"\n hardergame = gets.chomp.capitalize\n hardergame\nend",
"def input(answer, tried_again)\n\n\tputs \"\\nGuess a number between 1 and 100 correctly.\"\n\tguess = gets.chomp.to_i\n\n\tif guess < 101 && guess > 0 \n\t\tprompt(guess, answer, tried_again)\n\telse\n\t\tputs \"The cowboy with wise old eyes sighs.. you lost your chance for free admission.\" \n\t\treturn false\n\tend\n\n\nend",
"def guess_number guess\n number = 25\n puts \"Your guess is too high!\" unless guess < number+1\n puts \"Your guess is too low!\" unless guess > number-1\n puts \"You got it\" unless guess != number\nend",
"def ask_for_guess_number \n\tputs \"Please enter a number between 1 and 10:\"\n\t@guessed_number = gets.to_i\n\tif @guessed_number == @secret_number\n\t\tputs \"Congratulations! You won the game!\"\n\t\t#Player won the game, so return true\n\t\treturn true\n\telse\n\t\t#Determine if the number was too high or low\n\t\tif @guessed_number > @secret_number\n\t\t\tputs \"Your guess was too high\"\n\t\telse\n\t\t\tputs \"Your guess was too low\"\n\t\tend\n\t\t#Player lost the guess, so return false\n\t\treturn false\n\tend\nend",
"def correct\n @correct = params[:number]\n @correct = Question.find(@correct.to_i)\n\n if @correct != nil\n @allanswers = Question.find(:all, :conditions=>'parentid > 0')\n @parent = Question.find_by_parentid(@correct.parentid)\n if @parent.user_id != current_user.id && @correct.correct_flag != 1 # Checks for condition 1\n # Checks for condition 2\n for answer in @allanswers\n \n if answer.correct_flag == 1\n answer.correct_flag = 0\n answer.save\n # @correct.update(@correct.id,:correct_flag=>0)\n end\n end\n @correct.correct_flag = 1\n \n @correct.save\n @answer_user = User.find(@correct.user_id)\n\tscore(@answer_user,40)#40 points for getting the answer correct\n \n #send email to the answerer about the new comment type: 6\n @notified_user = get_user_to_be_notified(6,@answer_user)\n if(@notified_user != nil)\n if(@parent.parentid > 0)\n @parent = Question.find(@parent.parentid)\n end\n UserMailer.deliver_answer_correct(@answer_user, @parent)\n end\n #@correct.update(@correct.id,:correct_flag=>1)\n #flash[:notice] = 'Your selection of the correct answer was successful.'\n else\n for theanswer in @allanswers\n if theanswer.correct_flag == 1\n theanswer.correct_flag = 0\n theanswer.save\n # @correct.update(@correct.id,:correct_flag=>0)\n # flash[:notice] = 'Your selected correct answer was unselected.'\n \n end\n end\n end\n \n redirect_to(:back)\n else\n\n \n end\n end",
"def check_for_loss\n if @number_incorrect.to_i == 6\n puts \"Unfortuntately you are out of guesses. Please play again!\"\n exit\n end\n end",
"def input_validation(guess, password)\n if (@masked_password.include? guess) || (@wrong_letters.include? guess)\n puts 'You already tried that one!', ''\n else\n guess_letter(guess, password) ? right_letter(guess) : wrong_letter(guess)\n end\n end",
"def result\n user_number = params[:number1].to_i\n number = @@numbers\n if number < user_number\n @result = \"Make it less\"\n elsif number>user_number\n @result = \"Make it more\"\n else\n @result = \"Yes, The secret number is #{number}\"\n # if the player could guess the secret number, this will gonna change-\n # the number as player can play again\n # @@number_rand = rand 500\n @@numbers = rand params[:max]\n end\n end",
"def guess_again(message = nil)\n\t\t# As long as user hasn't run out of turns...\n\t\tif @turn < 12\n\t\t\t# If there was no error message and it isn't the first turn, show the board\n\t\t\tshow_board if (message == nil && @turn > 0)\n\t\t\tputs \n\t\t\tputs \"Enter your guess. You've used #{@turn} of 12 turns.\"\n\t\t\t# Get user's guess\n\t\t\tguess = gets.chomp\n\t\t\t# Put each digit into an array\n\t\t\tarr = []\n\t\t\tguess.split(\"\").each { |num| arr << num.to_i }\n\t\t\t# Make sure guess was correctly inputted\n\t\t\tsanitize_input(arr)\n\t\t# User ran out of turns, show answer\n\t\telse\n\t\t\tputs \n\t\t\tputs \"Whoops! You ran out of turns\"\n\t\t\tputs \"The correct answer was #{@answer.join}\"\n\t\tend\n\tend",
"def ask_question(player)\n number_1 = rand(1..20)\n number_2 = rand(1..20)\n\n puts \"#{@player.name}: What is #{number_1} + #{number_2}\"\n answer = gets.chomp.to_i\n answer == number_1 + number_2 ? correct_answer : wrong_answer(player)\nend",
"def test_guess_is_incorrect\n card = Card.new(\"Which planet is closest to the sun?\", \"Mercury\", :STEM)\n turn = Turn.new(\"Saturn\", card)\n\n refute turn.correct?\n end",
"def correct?\n @correct || false\n end",
"def check_num(num)\n@num_attempts+=1\n\nif num==@secret_num\n@game_over=true\np \"you win\"\nelsif num>=@secret_num\n p \"too big\"\nelse\n p \"too small\"\nend\n\nend",
"def correct?(guess)\n guess == @back\n end",
"def check_users_number\n tries_left = 3\n @random_number = rand(1..10)\n puts \"Your SECRET NUMBAH has been chosen - guess a numbah between 1 and 10!\"\n until tries_left == 0\n player_guess = gets.strip.to_i\n if player_guess == @random_number\n puts \"OH MY GAWD YOU GUESSED THE SECRET NUMBAH, #{@random_number}! YOU WIN!\"\n @did_they_win = true\n break\n elsif tries_left > 0\n tries_left -=1\n if player_guess > @random_number\n puts \"You guessed too high, silly! You have #{tries_left} guesses before the game is over enter a another number\" if tries_left > 0\n else\n puts \"You guessed too low, silly! You have #{tries_left} guesses before the game is over enter a another number\" if tries_left > 0\n end\n end\n if tries_left == 0\n @did_they_win = false\n print \"You didn't guess it was #{@random_number}. Better luck next time!\"\n end\n end\nend",
"def checker\n @correct_pos = 0\n @correct_num = 0\n x = 0\n @guess.each do |i|\n if (i == @solution[x])\n @correct_pos += 1\n elsif @solution.include?(i)\n @correct_num += 1\n end\n x += 1\n end\n end",
"def guess_the_number\n prog_num=rand(1..20)\ncounter=0\nwhile counter < 10\nnumber=user_guessing\ncounter+=1\nif number>prog_num\n if number-(prog_num)>5\n puts \"too large try no.#{counter}\"\n else number-(prog_num)>5\n puts \"bit large try no.#{counter}\"\n end\nelsif number<prog_num\n if (prog_num)-number>5\n puts \"too small try no.#{counter}\"\n else (prog_num)-number>5\n puts \"bit small try no.#{counter}\"\n end\nelsif number==prog_num\n return puts \"you win after #{counter} try(s).\"\nend\nend\nend",
"def guessing_game\n\tputs \"Guess a number between 1 and 100\"\n\tcorrect = Random.new.rand(1..100)\n\tnum_guesses = 1\n\tcurrent_guess = gets.chomp.to_i\n\n\twhile current_guess != correct\n\t\tif current_guess > correct \n\t\t\tputs \"The number is lower than #{current_guess}. Guess again\"\n\t\telsif current_guess < correct\n\t\t\tputs \"The number is higher than #{current_guess}. Guess again\"\n\t\tend\n\t\tcurrent_guess = gets.chomp.to_i\n\t\tnum_guesses = num_guesses + 1\n\tend\n\tputs \"You guessed #{correct} in #{num_guesses} tries!\"\nend",
"def check_num(input)\n @num_attempts += 1\n if input == @secret_num\n @game_over = true\n puts 'you win'\n elsif input > @secret_num\n puts 'too big'\n else\n puts 'too small'\n end\n end",
"def right_answer\n \t\tif !(answer.downcase == $answer.downcase) && \n !(answer.downcase == $word_answer.downcase)\n \t\t\terrors.add(:answer, \"\")\n \t\tend\n \tend",
"def game_mode\n puts \"Welcome to my version of Mastermind!\"\n puts \"You must try to guess the computer's 4 digit combination.\"\n puts \"The 4 digit combination consists of 4 number between 1 and 6.\"\n puts \"The number's do not repeat.\"\n puts \"You have #{@turns_left} tries!\"\n puts \"Can you succeed?\"\n puts \"But if you are feeling brave, you can challenge the computer to guess your combination.\"\n puts \"Enter 1 if you would like to guess or enter 2 if you would like for the computer to guess:\"\n @game_mode = gets.chomp.to_i\n valid = false\n until valid\n\t if (@game_mode> 2 || @game_mode < 1)\n\t\tputs \"Invalid game mode. Try again:\"\n\t\t@game_mode = gets.chomp.to_i\n else\n\t\tvalid = true\n\t end\n\tend\n end",
"def red_correct\n if @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 1\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 1\n total = 1\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 1\n total = 1\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 1\n total = 1\n elsif @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 1\n total = 1\n elsif @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 2\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 2\n total = 1\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 2\n total = 2\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 2\n total = 2\n elsif @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 2\n total = 2\n elsif @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 3\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 3\n total = 1\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 3\n total = 2\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 3\n total = 3\n elsif @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 3\n total = 3\n elsif @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 4\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 4\n total = 1\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 4\n total = 2\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 4\n total = 3\n else @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 4\n total = 4\n end\n end",
"def num_valid?\r\n number = ''\r\n # (1)need to split the number down first to handle it digit by digit\r\n # (2)because number length can change, better to reverse it and go front to back\r\n # (3)put through an each block to loop through the digits, adding with_index to help the modulo\r\n # (4)using a modulo to apply *2 if remainder is not 0 (i.e. every other number starting at position 1, using the index)\r\n # (5)building up the number string with << (could use += but no need to create a new object every time)\r\n @num.split('').reverse.each_with_index do |digit, index|\r\n number << digit if index%2 == 0\r\n number << (digit.to_i*2).to_s if index%2 != 0\r\n end\r\n\r\n # lastly have to check the result added together modulo's to zero\r\n # consulted http://blog.jayfields.com/2008/03/ruby-inject.html for inject syntax refresher\r\n # (1)need to split the number down into an array so inject() can turn them to_i and give us the sum\r\n # (2)using a modulo to ensure the final sum is a multiple of 10\r\n number.split('').inject { |r,e| r.to_i + e.to_i } % 10 == 0\r\n end",
"def guessing_game\n\tprint \"Hello, what should I call you? \"\n\tname = gets.chomp\n\tnumber = rand(100) + 1\n\tguesses_remaining = 10\n\tis_correct = false\n\tputs \"Welcome #{name}! It's time to play Guess My Number!\"\n\tputs \"I'm thinking of a number between 1 and 100, can you guess what it is?\"\n\twhile guesses_remaining > 0\n\t\tif guesses_remaining == 1\n\t\t\tputs \"You only have 1 guess remaining!!!\"\n\t\telse\n\t\t\tputs \"You have #{guesses_remaining} guesses remaining.\"\n\t\tend\n\t\tputs \"What do you guess?\"\n\t\tguess = gets.to_i\n\t\tguesses_remaining -= 1\n\t\tif guess == number\n\t\t\tif (10 - guesses_remaining) == 1\n\t\t\t\tputs \"Good job, #{name}! You guessed my number in only 1 guess!!!\"\n\t\t\telse\n\t\t\t\tputs \"Good job, #{name}! You guessed my number in #{10 - guesses_remaining} guesses!\"\n\t\t\tend\n\t\t\tis_correct = true\n\t\t\texit\n\t\telsif guess > number\n\t\t\tputs \"Oops, your guess was too HIGH!\"\n\t\telse\n\t\t\tputs \"Oops, your guess was too LOW!\"\n\t\tend\n\tend\n\n\tunless is_correct\n\t\tputs \"Sorry, you didn't get my number. It was #{number}!\"\n\t\tputs \"Better luck next time!\"\n\t\tplay_again?\n\tend\nend",
"def check_answer(question, answer_hash, user_input)\n #track points in game_session. store correctness?\n correctness = answer_hash[user_input.upcase] == question.correct || user_input.downcase == question.correct.downcase\n system \"clear\"\n bear_mode = correctness ? \"5\" : \"4\"\n print_question(question, bear_mode)\n print_colorized_answers(answer_hash, user_input.upcase, question.correct)\n puts\n\n correct_msg = [\n \"Pawesome!\",\n \"Beary good!\",\n \"More money for your honey!\"\n ]\n wrong_msg = [\n \"Bearly missed it.\",\n \"I hate to be the bearer of bad news...\",\n \"Not this time, Goldilocks.\",\n \"You can still claw your way back.\"\n ]\n\n if correctness\n print correct_msg.sample.colorize(:green)\n else\n print wrong_msg.sample.colorize(:red)\n end\n\n UserGuess.create(\n question_id: question.id,\n game_session_id: $game_session.id,\n correctness: correctness\n )\nend",
"def validate_checksum\n nums_a = number.to_s.chars.map(&:to_i)\n w_sum = nums_a[0..-2].reverse_each.map.with_index { |d, i|\n i.even? ? LUHN_MAPPING[d] : d\n }.reduce(&:+)\n -w_sum % 10 == nums_a[-1]\n end",
"def good_wrong?(num, input_array)\n\tif (multiple?(num, input_array) || duplicate?(num, input_array))\n\t\treturn false\n\telse\n\t\treturn true\n\tend\nend",
"def good_guess?(number_answer)\n # Your code goes here!\n if number_answer == 42\n return true\n else\n return false\n end\nend",
"def correct?\n @card.answer == @guess\n end",
"def one_off?(win_number,my_number)\n\tmatches = 0\n\tif win_number[0] == my_number[0]\n\t\tmatches +=1\n\tend\n\tif win_number[1] == my_number[1]\n\t\tmatches +=1\n\tend\n\tif win_number[2] == my_number[2]\n\t\tmatches +=1\n\tend\n\tif win_number[3] == my_number[3]\n\t\tmatches +=1\n\tend\n\tif matches == 3\n\t\ttrue\n\telse\n\t\tfalse\n\tend\n\t\t#compare each digit of my entry to winning entry\n\t\t#if item == my_number\nend",
"def verify_user_answer(user_answer)\n until user_answer == \"1\" || user_answer == \"2\" || user_answer == \"3\"\n puts \"That's not a valid answer. Please enter 1, 2, or 3\"\n user_answer = gets.chomp.to_s\n end\n return user_answer\n end",
"def challenge5 \n\tcounter = 1\n\tnumber = rand(1..100)\n\tputs \"Guess a number between 1 and 100\"\n\tguess = gets.chomp.to_i\n\n\twhile guess != number do\n\t\tif guess > 100 || guess < 0\n\t\t\tputs \"Please guess a number between 1 and 100. Guess again\"\n\t\t\tguess = gets.chomp.to_i\n\t\t\tcounter +=1\n\t\telsif guess < number\n\t\t\tputs \"the number is greater than #{guess}. Guess again.\"\n\t\t\tguess = gets.chomp.to_i\n\t\t\tcounter +=1\n\t\telsif guess > number\n\t\t\tputs \"the number is less than #{guess}. Guess again.\"\n\t\t\tguess = gets.chomp.to_i\n\t\t\tcounter +=1\n\t\tend\n\tend\n\tputs \"You got it in #{counter} attempt(s)!\"\nend",
"def check_answer(answer)\n result = @num_1 + @num_2\n if answer == result\n return true\n end\n return false\n end",
"def turn()\n\tguess = \"\"\n\tif @human_is_guessing == true\n\t\tputs \"Enter your guess for the secret code\"\n\t\tguess = gets.chomp\n\t\twhile guess.length != 4 || (guess =~ /[^0-5]/)\n\t\t\tputs \" Please enter guess again. Remember it must be 4 numbers and only consist of values 0-5.\"\n\t\t\tguess = gets.chomp\n\t\tend\n\telse #computer is guessing\n\t\t#random guess from array of viable solutions.\n\t\tguess = @solutions.delete_at(rand(@solutions.length)).join.to_s\n\t\t\tputs \" I guess \" + guess\n\t\tend\n\t\tset_guess(guess)\n\t\t@score = compare_guess(guess)\n\t\tputs \"You have correctly guessed \" + @colors_correct.to_s + \" out of 4 digits in the code\" + \" and have \" + @placed_correct.to_s + \" in the right place.\"\n\t\[email protected]_if {|x| compare_guess(x.join.to_s, @guess) != @score }\n\t\t@turns += 1\n\tend",
"def guessed_all_correct?\n end",
"def cache_correctness\n correct_answer = question.correct_answer\n self.correct = content == correct_answer if correct_answer\n end",
"def continue?\n @round <= 10 && @guess != @secret_code\n end",
"def check_guess(guess,answer,win)\n\tif win != true #If the player has not won yet\n\t@@answer = \"X\" \n\t\tif @@turns == 0\n\t\t\t@@answer = @@secret_number\n\t\t\t@@secret_number = rand(100)\n\t\t\t@@turns = 5\n\t\t\t@@color = \"white\"\n\t\t\treturn \"GAME OVER!\"\n\t\telsif @@turns != 0\n\t\t\tif guess > 100 or guess < 0\n\t\t\t\t@@turns -= 1\n\t\t\t\treturn \"Invalid input!\"\n\t\t\telsif (guess - answer).abs <= 5 and (guess - answer).abs != 0\n\t\t\t\t@@turns -= 1\n\t\t\t\t@@color = \"#ff9999\"\n\t\t\t\treturn \"You're very close!\"\n\t\t\telsif (guess - answer).abs == 0\n\t\t\t\twin = true\n\t\t\t\t@@color = \"#b2ffb2\"\n\t\t\t\t@@answer = @@secret_number\n\t\t\t\t@@turns = 5\n\t\t\t\t@@secret_number = rand(100)\n\t\t\t\treturn \"You Won! Congrats.\"\n\t\t\telsif (guess - answer).abs <= 10\n\t\t\t\t@@turns -= 1\n\t\t\t\t@@color = \"#ff7f7f\"\n\t\t\t\treturn \"You're close!\"\n\t\t\telsif (guess - answer).abs <= 15\n\t\t\t\t@@color = \"#ff4c4c\"\n\t\t\t\t@@turns -= 1\n\t\t\t\treturn \"Not very close!\"\n\t\t\telsif (guess - answer).abs > 15\n\t\t\t\t@@color = \"#ff0000\"\n\t\t\t\t@@turns -= 1\n\t\t\t\treturn \"You're hopeless!\"\n\t\t\tend\n\t\tend\t\n\telsif win == true\t#If the player won!\n\t\t@@answer = @@secret_number\n\t\t@@secret_number = rand(100)\n\t\t@@turns = 5\n\t\treturn \"You Won!\"\n\tend\nend",
"def dudeney_number?(numero)\r\n# hacemos paso por valor del argumento \r\ns = numero\t\r\n# convertimos integer a string para separar los digitos\r\nnewNumber = s.to_s\r\n# separamos los digitos del string\r\nnewNumber.split('')\r\n# tamanio del string \r\ntamanio = newNumber.length\r\n# si numero es iguala 1 se asigna a number\r\n\tif numero == 1\r\n\t\tnumber = 1\r\n# y si tamanio del argumento es de 3 cifras \t\t\r\n\telsif tamanio == 3\r\n# asignamos el valor por posicion\r\n\t\ta = newNumber[0]\r\n\t\tb = newNumber[1]\r\n\t\tc = newNumber[2]\r\n\t\t#convertimos de string a integer cada una de las asignaciones las sumamos y asi determinaremo el cubo perfecto\r\n\tnumber = a.to_i + b.to_i + c.to_i \r\n# si es de 4 cifras el argumento se hace lo mismo pero con 4 cifras \r\n\telsif tamanio == 4\r\n\t\ta = newNumber[0]\r\n\t\tb = newNumber[1]\r\n\t\tc = newNumber[2]\t\t\r\n\t\td = newNumber[3]\r\n\tnumber = a.to_i + b.to_i + c.to_i + d.to_i\r\n\tend\r\n# se eleva al cubo el numero base\r\n\tcubo =(number*number*number)\r\n# si cubo es igual valor del argumento regresa true diciendo que es un numero dudeney \r\n\tif cubo == numero\r\n\t\tr = true\r\n\telse\r\n\t\tr = false\r\n\tend\t\r\n# retorno\r\n\tr\r\nend",
"def check_answer(player, other_player)\n p_answer = gets.chomp.to_i\n # If the answer is correct, message and proceed\n if p_answer == @q_answer\n puts \" \"\n puts \"✅ #{player.name}: Yes! You are correct! ✅\"\n puts \" \"\n puts \"#{player.identifier}: #{player.lives}/3 vs #{other_player.identifier}: #{other_player.lives}/3\"\n # If answer is incorrect, player either loses a life and proceeds...\n else\n if player.lives > 1\n puts \" \"\n puts \"❌ #{player.name}: That's incorrect! ❌\"\n puts \" \"\n player.lose_life\n puts \"#{player.identifier}: #{player.lives}/3 vs #{other_player.identifier}: #{other_player.lives}/3\"\n # ...Or the lose the game entirely\n else\n player.lose_life\n puts \" \"\n puts \"🏆 #{other_player.name} wins with a score of #{other_player.lives}/3 🏆\"\n puts \" \"\n puts \" ----- GAME OVER ----- \"\n puts \" \"\n puts \"Good bye!\"\n puts \" \"\n end\n end\n end",
"def check_guess(guess, code)\n correct = [0, 0]\n non_matching_guess = []\n non_matching_code = []\n guess.length.times do |n|\n if guess[n] == code[n]\n correct[0] += 1\n else\n non_matching_guess.push guess[n]\n non_matching_code.push code[n]\n end\n end\n\n non_matching_guess.each do |num|\n non_matching_code.each_with_index do |n, index|\n if n == num\n correct[1] += 1\n non_matching_code[index] = \"none\"\n break\n end\n end\n end\n correct\n end",
"def check_guess (guess, secret_number, num_guesses)\n if guess == secret_number\n puts \"You WIN! It was #{guess}!\"\n exit\n elsif num_guesses == 3\n puts \"You LOSE! The secret number was #{secret_number}.\"\n puts \"Sucker.\"\n elsif guess > secret_number\n puts \"The secret number is LOWER than #{guess}.\"\n else\n puts \"The secret number is HIGHER than #{guess}.\"\n end\nend",
"def keep_guessing(guess)\n count = 0\n until guess == @number || count == 4\n if guess < @number\n puts 'Your guess was too low. Try Again.'\n else\n puts 'Your guess was too high. Try Again'\n end\n\n guess = gets.to_i\n count += 1\n end\n\n results guess\n end",
"def validate_answer(result, right_answer, status, start_time, time)\r\n case result\r\n when right_answer\r\n # Get the stop time stamp to calculate the score, the faster to get the answer, the more bounds score is earned.\r\n answer_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)\r\n time_used = (answer_time - start_time).round(1)\r\n # Basic socre for each corrent answer is 500\r\n total_score = 500 + (time - time_used) * 10\r\n # Update the score and pass back to the loop\r\n status[0] += total_score\r\n status[1] += 1\r\n puts \"\\n\\n Hooray!!! You got it!!\"\r\n\r\n else\r\n puts \"\\n\\nSorry, not correct answer or time expired!\\nIt's fine. Let's keep going\"\r\n status[2] += 1\r\n end\r\n enter_to_continue\r\n end",
"def validate(n)\n # reverse the number\n reversed = reverser(n)\n cleaned = cleaner(reversed)\n checker(cleaned)\n # reversed_number_string = n.to_s.reverse.chars\n # double every other number\n # doubler(reversed_number_string)\n # doubled = reversed_number_string.map.with_index do |number, index|\n # if index % 2 != 0\n # number.to_i * 2\n # else\n # number.to_i\n # end\n # end\n # check to see if each number is > 10\n # cleaned = doubler(reversed).map do |number|\n # if number / 10 >= 1\n # number - 9\n # else\n # number\n # end\n # end\n # # binding.pry\n # # if so, subtract 9\n # # if not, leave as is\n # # sum the numbers (reduce), check to see if divisbile by 10, return boolean\n # cleaned.reduce(:+) % 10 == 0\nend",
"def confirm_a_number (any_number)\n while any_number.to_i.to_s != any_number\n print \"Please enter an integer: \"\n any_number = gets.chomp\n end\n return any_number.to_i\nend",
"def wrong_answer\n @score -= 1\n end",
"def num_check(num_one,num_two)\n num_one.to_i.to_s == num_one &&num_two.to_i.to_s == num_two || num_one.to_f.to_s == num_one &&num_two.to_f.to_s == num_two\nend",
"def good_guess? (number)\n\tnumber.to_i\n\tif number == 42\n\t\tp true\n\telse \n\t\tp false\n\tend\nend",
"def grade_question(round_id, round_question_num, chosen_id)\n dump_round_vars \"Entering grade_question(#{round_id}, #{round_question_num}, #{chosen_id})\"\n round = Round.find(round_id)\n if (round_question_num > round.max_qo_index)\n round.update(max_qo_index: round_question_num)\n end\n\n correct_choice = get_question(round_id, round_question_num).correct_choice\n user = current_user\n diff_lvl = user.difficulty_level_id\n puts \"user_id: #{user.id}, round_question_num: #{round_question_num}, diff_lvl: #{diff_lvl}, chosen_id: #{chosen_id}\"\n\n result = Result.where(\"user_id = ?\", user.id).where(\"round_id = ?\", round_id).first\n if !result\n result = Result.new(user_id: user.id, round_id: round_id, round_complete: false)\n end\n\n if chosen_id == CHOICE_ID_SKIP # \n puts \"Q#{round_question_num} [diff {diff_lvl}]: skipped. #{correct_choice.id} (#{correct_choice.prompt}) is correct.\"\n outcome = POINTS_FOR_SKIP\n result.num_skipped += 1 \n elsif chosen_id.to_i == correct_choice.id\n puts \"Q#{round_question_num} [diff {diff_lvl}]: #{chosen_id} (#{correct_choice.prompt}). Correct!!\"\n outcome = POINTS_FOR_CORRECT\n result.num_correct += 1 \n else\n puts \"Q#{round_question_num} [diff {diff_lvl}]: #{chosen_id} (#{Choice.find(chosen_id).prompt}). Unfortunately #{correct_choice.id} (#{correct_choice.prompt}) is correct.\"\n outcome = POINTS_FOR_INCORRECT\n result.num_incorrect += 1 \n end\n result.points = [result.points + outcome, 0].max\n result.save\n dump_round_vars '', 'Exiting grade_question()'\n return {outcome: outcome, points: result.points, correct_id: correct_choice.id, correct_prompt: correct_choice.prompt}\n end"
] | [
"0.6851531",
"0.678858",
"0.67764306",
"0.6749121",
"0.662466",
"0.6441788",
"0.644089",
"0.64037716",
"0.63041025",
"0.63026345",
"0.62936467",
"0.62707734",
"0.6222373",
"0.62178457",
"0.61663383",
"0.6161383",
"0.6161072",
"0.6153368",
"0.61277115",
"0.6122439",
"0.61184984",
"0.6111228",
"0.608809",
"0.60593534",
"0.605625",
"0.60558784",
"0.60524386",
"0.60391605",
"0.6032808",
"0.6026728",
"0.60183513",
"0.6010594",
"0.59951967",
"0.5974662",
"0.59715414",
"0.59630966",
"0.59516484",
"0.5948022",
"0.5937646",
"0.5920101",
"0.5911801",
"0.5909049",
"0.5908943",
"0.59066594",
"0.59037036",
"0.59003294",
"0.58974016",
"0.5878134",
"0.58774894",
"0.5871404",
"0.5871076",
"0.58602446",
"0.58498746",
"0.5836542",
"0.5832952",
"0.5814996",
"0.5809279",
"0.5808834",
"0.5802859",
"0.5799874",
"0.579924",
"0.5793212",
"0.5789919",
"0.57859683",
"0.57841116",
"0.5779728",
"0.5775406",
"0.57674867",
"0.5763986",
"0.5750951",
"0.5748576",
"0.5742551",
"0.57331765",
"0.57319057",
"0.57279044",
"0.57206655",
"0.5713946",
"0.5712804",
"0.57058644",
"0.5703881",
"0.5697948",
"0.5694952",
"0.56938684",
"0.5685761",
"0.568106",
"0.567837",
"0.56775117",
"0.56696534",
"0.56679213",
"0.5665342",
"0.5663438",
"0.5656099",
"0.5641125",
"0.56407815",
"0.5637077",
"0.56358063",
"0.5631945",
"0.56295234",
"0.5625504",
"0.56236476",
"0.5620509"
] | 0.0 | -1 |
pega o tempo disposto: Min:seg.ms e torna em ms | def time_in_ms(time)
time_string = time.split(':')
milliseconds = time_string.last.split('.').last
totalmilliseconds = time_string.last.split('.').first.to_i * 1000 + milliseconds.to_i
minutes = time_string.first.to_i * 60000
return totalmilliseconds + minutes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tempo(beats_per_second)\n\t\tbeats_per_minute = beats_per_second * 60 \n\tend",
"def minutos(seg)\n return seg.to_f / 60\nend",
"def ms_to_min(ms)\n tempo = (ms.to_f / 1000) / 60\n return tempo\nend",
"def tRestante(concurso)\n return ((terminaC(concurso) - DateTime.now) / 60)\n end",
"def tRestante(concurso)\n return ((terminaC(concurso) - DateTime.now) / 60)\n end",
"def tRestante(concurso)\n return ((terminaC(concurso) - DateTime.now) / 60)\n end",
"def tempo_min\n @tempo_min ||= data[:tempo_min].to_i\n end",
"def tout_time(tout)\n current_time = Time.now.utc\n tout = Time.parse(tout)\n seconds = (current_time - tout).to_i\n if seconds >= 60\n minutes = seconds / 60\n if minutes >= 60\n hours = minutes / 60\n if hours >= 24\n days = hours / 24\n return days.to_s + \" days\"\n else\n return hours.to_s + \" hours\"\n end\n else\n return minutes.to_s + \" mins\"\n end\n else\n return seconds.to_s + \" seconds\"\n end\n end",
"def inizio_minuto\n Time.new(self.year, self.month, self.day, self.hour, self.min)\n end",
"def minutes() 60 * seconds end",
"def fine_minuto\n Time.new(self.year, self.month, self.day, self.hour, self.min, 59)\n end",
"def milliseconds() Float(self * (10 ** -3)) end",
"def time\n moment % 1\n end",
"def tiempointerv(ai,mei,di,hi,mii,af,mef,df,hf,mif)\n\t\tfechaini = DateTime.new(ai,mei,di,hi,mii) #fecha de inicio\n\t\tfechafin = DateTime.new(af,mef,df,hf,mif) #fecha de final\n\t\tdiferencia = fechafin - fechaini\n\t\thours,minutes,seconds,frac = Date.day_fraction_to_time(diferencia)\n\t\tif hours < 10\n\t\t\thoras = '0' + hours.to_s\n\t\telse\n\t\t\thoras = hours.to_s\n\t\tend\n\t\tif minutes < 10\n\t\t\tminutos = '0' + minutes.to_s\n\t\telse\n\t\t\tminutos = minutes.to_s\n\t\tend\n\t\ttiempo = horas + ':' + minutos\n\t\treturn tiempo\n\n\tend",
"def registro_inicio(vaca,num_horas)\n estim_reg = Time.now.advance(:hours => -num_horas.to_i).localtime\n estimate_time = estim_reg.change(:min => 0)\n return estimate_time \n end",
"def seconds ; return aseconds % SPM ; end",
"def tempo\n @tempo ||= data[:tempo].to_i\n end",
"def tv_sec() end",
"def fine_giorno\n Time.new(self.year, self.month, self.day, 23, 59, 59)\n end",
"def timescale\n put('l^')\n get.strip.to_i\n end",
"def mpm\n mph = self.mph\n return nil unless mph and mph.is_a?(Float)\n div = 60.0 / mph\n min = div.floor\n sec = ( ( div - min ) * 60.0 )\n \"#{ sprintf(\"%.2d\", min ) }:#{ sprintf(\"%.2d\", sec ) }\"\n end",
"def seconds() self end",
"def get_end_time(aluno_id)\n tempo = DateTime.now.to_i()\n\n data_inicio = self.get_data_inicio(aluno_id)\n\n if data_inicio != nil\n tempo = data_inicio.to_i() + self.duracao * 60\n end\n\n return tempo\n end",
"def time_unit\n return \"1sec\"\n end",
"def format_milis(miliseconds)\n return Time.at(miliseconds/1000).gmtime.strftime('%M:%S')\nend",
"def tempo(microsecs)\n\[email protected] << Tempo.new(microsecs, @curr_ticks)\n end",
"def read_time\n (number_of_words.to_f / WORDS_PER_MINUTE).ceil\n end",
"def seconds_in_minutes(num_min)\n\tnum_min * 60\nend",
"def time\n a=[1, 1000, 60000, 3600000]*2\n ms = duration\n \"%02d\" % (ms / a[3]).to_s << \":\" << \n \"%02d\" % (ms % a[3] / a[2]).to_s << \":\" << \n \"%02d\" % (ms % a[2] / a[1]).to_s #<< \".\" << \n #\"%03d\" % (ms % a[1]).to_s\n end",
"def delay\n val = (self['min-time']/1000.0/60.0)\n val < 1 ? val.round(1) : val.round\n end",
"def tick\n\t\tif @sec > 0\n\t\t\t@sec -= 1\n\t\telse\n\t\t\t@sec = 59\n\t\t\tif min > 0\n\t\t\t\t@min -= 1\n\t\t\telse\n\t\t\t\t@min = 59\n\t\t\t\tif @hr > 0\n\t\t\t\t\t@hr -= 1\n\t\t\t\telse\n\t\t\t\t\t@hr = 23\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def actualizar_duracion\n @trayecto = Trayecto.find(params[:id])\n puts @trayecto.id\n @reserva= Reserva.find(@trayecto.reserva_id)\n @hora_inicial= @reserva.fecha.strftime(\"%H\").to_f\n @hora_inicial1= @reserva.fecha.strftime(\"%M\").to_f\n @hora_inicial_um= @hora_inicial1/60\n @hora_inicial2= @hora_inicial_um+@hora_inicial\n\n @hora= DateTime.parse(params[:hora])\n @hora_final= @hora.strftime(\"%H\").to_f\n puts @hora_final\n @hora_final1= @hora.strftime(\"%M\").to_f\n @hora_final_um=@hora_final1/60\n puts @hora_final_um\n @hora_final2=@hora_final_um +@hora_final\n\n @duracion=@hora_final2- @hora_inicial2\n puts @duracion\n @trayecto.update_attributes(duracion: @duracion)\n\n\n @id= @reserva.mobibus_id\n @conductor= Conductor.where(\"mobibus_id = ?\",@id)\n @conductor_real= @conductor.first.id\n\n @distancia= @trayecto.distancia\n @duracion= @trayecto.duracion\n @velocidad=(@distancia/@duracion).to_f\n @puntaje=9,0\n\n puts @velocidad\n\n # TODO esto se puede escribir como un método aparte en un helper\n if @velocidad >= 35.0\n @puntaje=5.0\n else if @velocidad >=25.0 && @velocidad < 35.0\n @puntaje=4.0\n else if @velocidad >= 20.0 && @velocidad < 25.0\n @puntaje=3.0\n else if @velocidad >= 10.0 && @velocidad < 20.0\n @puntaje=4.0\n else\n @puntaje=1.0\n end\n end\n end\n\n end\n\n # noinspection RailsParamDefResolve\n redirect_to controller:'conductores' ,action:'calcular_puntaje', id:@conductor_real, puntaje:@puntaje\n end",
"def inizio_giorno\n Time.new(self.year, self.month, self.day)\n end",
"def time_min; Time.now.min; end",
"def min_to_formatted_time(mnt)\n\t\t(Time.now.midnight + mnt.minutes).to_s(:hr12)\n\tend",
"def hora_geracao\n Time.current.strftime('%H%M%S')\n end",
"def hora_geracao\n Time.current.strftime('%H%M%S')\n end",
"def seconds\n self * 60\n end",
"def mettrePause()\n @chrono.mettreEnPause()\n end",
"def ctime\n end",
"def calc_play_seconds\n @time_days.to_i * 86400 + @time_hours.to_i * 3600 + @time_minutes.to_i * 60\n end",
"def seconds\n (hour * 60 * 60) + (min * 60)\n end",
"def drive_time_in_minutes\n if @status != \"OK\"\n drive_time = 0\n else\n drive_time = @doc.css(\"duration value\").last.text\n convert_to_minutes(drive_time)\n end\n end",
"def time\n (1 + Time.now.to_i/10).ceil * 10\n end",
"def quantity_of_seconds(time)\n time.hour * 60 + time.minute * 60 + time.second + time.second_fraction\nend",
"def display_time_at\n gm = self.good_memories.count\n bm = self.bad_memories.count\n lifespan = (Time.now.to_i - self.created_at.to_i)\n unless gm == 0\n shift = (lifespan * (bm + 1)) / gm\n return (Time.now.to_i - shift)\n else\n shift = lifespan * (bm + 1)\n return (Time.now.to_i - shift)\n end\n end",
"def total_time; end",
"def getTimer\n return @chrono.getTime()\n #return @chrono.to_s()\n end",
"def minutes\n self * SECONDS_IN_MINUTES\n end",
"def ms\n ((duration * 1000.0) + 0.4999).to_i\n end",
"def cutime(*) end",
"def cstime=(*) end",
"def seconds\n _nudge[2]\n end",
"def in_ms(seconds)\n \"#{'%.2f' % (seconds * 1000).round(2)}ms\"\nend",
"def cstime(*) end",
"def time_sec; Time.now.sec; end",
"def time_conversion(minutes)\nend",
"def milliseconds_to_formatted_time( milliseconds, format = :short )\n if milliseconds >= 1000\n seconds = milliseconds / 1000\n ChronicDuration.output(seconds, :format => format)\n else\n 'less than 1 second'\n end\n end",
"def gmtoff() end",
"def durationInMinutes\n @duration/60.0 #Force floating pt.\n end",
"def microseconds() Float(self * (10 ** -6)) end",
"def proper_time_since start_time\n total_time = Time.now.to_f - start_time.to_f\n return \"#{total_time.round(2)} sec\" if total_time < 60\n return \"#{(total_time.to_f/60).round(2)} min\" if total_time < 3600\n return \"#{(total_time.to_f/3600).round(2)} h\"\nend",
"def sec_fraction() time[3] end",
"def timechunk(sec)\n fail \"sec = #{sec}\" if sec < 1\n 1.send(find_unit(sec)).round\n end",
"def hora_inicio\n if !read_attribute(:hora_inicio).nil?\n Time.parse(read_attribute(:hora_inicio).to_s[11..17].to_s).strftime(\"%I:%M %p\")\n end\n end",
"def minutes; self * MINUTE; end",
"def minutes; self * MINUTE; end",
"def end_of_minute\n change(sec: 59.999)\n end",
"def fmt_miltime(t)\n if t.present?\n ApplicationHelper.localtime(t).strftime(ApplicationHelper.time_fmt)\n end\n end",
"def beats_per_minute\n return DEFAULT_TEMPO if @tracks.nil? || @tracks.empty?\n event = @tracks.first.events.detect { |e| e.kind_of?(MIDI::Tempo) }\n return event ? (Tempo.mpq_to_bpm(event.tempo)) : DEFAULT_TEMPO\n end",
"def update_time\n delta = Gosu.milliseconds - @last_ms\n @last_ms = Gosu.milliseconds\n delta\n end",
"def time_duration\n t1 = Time.now.to_f\n Time.now.to_f - t1\nend",
"def timing_ms\n return nil if timing.nil?\n (timing * 1000).to_i\n end",
"def cutime=(*) end",
"def utime(*) end",
"def puttime\n if gameover?\n return\n end\n setpos(TIMELINE,0)\n addstr( (Time.now.to_i - @start).to_s + \" sec\")\n end",
"def process_time(player, start_time, end_time)\n t = time_duration(player.mytime, start_time, end_time)\n\n player.mytime += @fischer\n player.mytime -= t\n if (player.mytime < 0)\n player.mytime = 0\n end\n\n return t\n end",
"def sbv_time(t)\r\n i = t.to_i\r\n \"%d:%02d:%02d.%03d\" % [i/3600, i/60%60, i%60, (t*1000).to_i%1000]\r\nend",
"def refresh\n time = Time.new#(2015,01,01,0,0,0)\n h = ((time.hour + (time.min / 60.0)) / 12.0) * @size;\n m = ((time.min + (time.sec / 60.0))/ 60.0) * @size;\n s = ((time.sec + (time.nsec/1000000000.0) ) / 60.0) * @size;\n @hms={ :h => h, :m => m, :s => s }\n end",
"def refresh\n time = Time.new#(2015,01,01,0,0,0)\n h = ((time.hour + (time.min / 60.0)) / 12.0) * @size;\n m = ((time.min + (time.sec / 60.0))/ 60.0) * @size;\n s = ((time.sec + (time.nsec/1000000000.0) ) / 60.0) * @size;\n @hms={ :h => h, :m => m, :s => s }\n end",
"def ctime() end",
"def time(context)\n if @time.eval(context).is_a?(String)\n case @units\n when \"s\"\n @time.eval(context)\n else\n raise \"Invalid units\"\n end\n else\n (\"%.2f\" % case @units\n when \"s\"\n @time.eval(context)\n when \"ms\"\n @time.eval(context).to_f / 1000\n end).sub(/^0+/, \"\") + \"(sec)\"\n end\n end",
"def ctime() end",
"def ctime() end",
"def sec\n return @t_sec\n end",
"def end_of_minute\n change(\n sec: 59,\n usec: Rational(999999999, 1000)\n )\n end",
"def tempo_max\n @tempo_max ||= data[:tempo_max].to_i\n end",
"def sec() time[2] end",
"def dms ( d, m, s )\n return d + ( m + s/60.0 ) / 60.0\nend",
"def gametime\n \"#{self.gametime_maths/60} minutes\"\n end",
"def d_mins( v )\n TimeDelta.new( MIN_TO_MS * v )\n end",
"def get_time_required\n 0 # number of minutes\n end",
"def minutes\n (seconds % 3600) / 60\n end",
"def minutes\n _nudge[1]\n end",
"def period_in_secs\n if period_in_ns\n period_in_ns * (10**-9)\n end\n end",
"def cycle_time\n if completed_at && started_at\n completed_at - started_at\n else\n 0.0\n end\n end",
"def time_delta_string( seconds )\n\t\treturn 'less than a minute' if seconds < 1.minute \n\t\treturn (seconds / 1.minute).to_s + ' minute' + (seconds/60 == 1 ? '' : 's') if seconds < 50.minutes\n\t\treturn 'about one hour' if seconds < 90.minutes\n\t\treturn (seconds / 1.hour).to_s + ' hours' if seconds < 18.hours\n\t\treturn 'one day' if seconds < 1.day\n\t\treturn 'about one day' if seconds < 2.days\n\t\treturn (seconds / 1.day).to_s + ' days' if seconds < 1.week\n\t\treturn 'about one week' if seconds < 2.week\n\t\treturn (seconds / 1.week).to_s + ' weeks' if seconds < 3.months\n\t\treturn (seconds / 1.month).to_s + ' months' if seconds < 1.year\n\t\treturn (seconds / 1.year).to_s + ' years'\n\tend",
"def time_delta_string( seconds )\n\t\treturn 'less than a minute' if seconds < 1.minute \n\t\treturn (seconds / 1.minute).to_s + ' minute' + (seconds/60 == 1 ? '' : 's') if seconds < 50.minutes\n\t\treturn 'about one hour' if seconds < 90.minutes\n\t\treturn (seconds / 1.hour).to_s + ' hours' if seconds < 18.hours\n\t\treturn 'one day' if seconds < 1.day\n\t\treturn 'about one day' if seconds < 2.days\n\t\treturn (seconds / 1.day).to_s + ' days' if seconds < 1.week\n\t\treturn 'about one week' if seconds < 2.week\n\t\treturn (seconds / 1.week).to_s + ' weeks' if seconds < 3.months\n\t\treturn (seconds / 1.month).to_s + ' months' if seconds < 1.year\n\t\treturn (seconds / 1.year).to_s + ' years'\n\tend",
"def process_duration\n t1 = Process.times.utime\n Process.times.utime - t1\nend",
"def remaining_time\n t = date.to_time - Time.now\n \"%2d Tage %2d h %2d Min.\" % [t/86400, t/3600%24 , t/60%60]\nend"
] | [
"0.69392085",
"0.6896207",
"0.6660327",
"0.6538816",
"0.6538816",
"0.6461947",
"0.63786054",
"0.6353768",
"0.63272274",
"0.6305986",
"0.6270926",
"0.62687045",
"0.62443006",
"0.61832345",
"0.6163245",
"0.6155202",
"0.6105759",
"0.6087531",
"0.60696393",
"0.6065554",
"0.6065545",
"0.598687",
"0.5978614",
"0.5974351",
"0.5963357",
"0.5941845",
"0.5938329",
"0.5915083",
"0.5910749",
"0.58762723",
"0.58605486",
"0.5839452",
"0.5826853",
"0.58029157",
"0.577738",
"0.57746685",
"0.57746685",
"0.57717216",
"0.5764727",
"0.57567847",
"0.57538694",
"0.5753007",
"0.5748694",
"0.5743967",
"0.57337207",
"0.5733097",
"0.57298017",
"0.5723108",
"0.5718961",
"0.57124007",
"0.5710763",
"0.5708756",
"0.57046264",
"0.5703651",
"0.569148",
"0.56853026",
"0.56851786",
"0.567464",
"0.5662031",
"0.56551385",
"0.56460917",
"0.56457067",
"0.5642826",
"0.5636763",
"0.5636695",
"0.56323475",
"0.56323475",
"0.56321347",
"0.56312686",
"0.5629994",
"0.56299114",
"0.56238985",
"0.5623014",
"0.5620485",
"0.56196505",
"0.56134987",
"0.5608547",
"0.5608054",
"0.56027216",
"0.56027216",
"0.5588628",
"0.55878067",
"0.55863684",
"0.55863684",
"0.55805796",
"0.5578306",
"0.55742127",
"0.5572509",
"0.5570739",
"0.5569843",
"0.55697495",
"0.5566145",
"0.55595654",
"0.5557611",
"0.55574816",
"0.55493796",
"0.5543999",
"0.5543999",
"0.55423677",
"0.5542321"
] | 0.56591666 | 59 |
turns a amount of ms into minutes converte uma quantidade de ms em minutos | def ms_to_min(ms)
tempo = (ms.to_f / 1000) / 60
return tempo
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seconds_to_minutes(seconds)\n seconds / 60\nend",
"def minutes() 60 * seconds end",
"def seconds_in_minutes(num_min)\n\tnum_min * 60\nend",
"def to_minutes; Rational === @val ? @val/60 : @val/60.0 end",
"def time_in_ms(time)\n time_string = time.split(':')\n\n milliseconds = time_string.last.split('.').last\n totalmilliseconds = time_string.last.split('.').first.to_i * 1000 + milliseconds.to_i\n minutes = time_string.first.to_i * 60000\n return totalmilliseconds + minutes\nend",
"def minutes\n (seconds % 3600) / 60\n end",
"def in_minutes\n Duration::new(seconds: @seconds).to_minutes\n end",
"def seconds_to_minutes(seconds)\n seconds = seconds.to_i.round\n\n minutes = (seconds / 60).round\n seconds = seconds - (minutes * 60)\n\n minutes.to_s.rjust(2, '0') + \":\" + seconds.to_s.rjust(2, '0')\n end",
"def minutes\n (@seconds.abs / 60) % 60 * (@seconds < 0 ? -1 : 1)\n end",
"def minutos(seg)\n return seg.to_f / 60\nend",
"def minutes\n self * SECONDS_IN_MINUTES\n end",
"def time_to_minute(time)\n time.seconds_since_midnight / 60\n end",
"def time_conversion(minutes)\nend",
"def time_in_minutes(time_str)\n time_in_seconds(time_str) / 60\n end",
"def mpm\n mph = self.mph\n return nil unless mph and mph.is_a?(Float)\n div = 60.0 / mph\n min = div.floor\n sec = ( ( div - min ) * 60.0 )\n \"#{ sprintf(\"%.2d\", min ) }:#{ sprintf(\"%.2d\", sec ) }\"\n end",
"def minutes\n value_parts[1]\n end",
"def minutes\n value_parts[1]\n end",
"def time_conversion(minutes)\n hr = 0\n min = 0\n \n while minutes >= 0\n if minutes >= 60\n minutes = minutes - 60\n hr = hr + 1\n elsif minutes < 10\n min = 0.to_s + minutes.to_s\n return hr.to_s + ':' + min.to_s\n else\n min = minutes\n return hr.to_s + ':' + min.to_s\n end\n end\nend",
"def conv_to_ms(time)\n time.to_i * 1000\n end",
"def calc_mins_till\n (@difference.round(2) / 60.00).round(2)\n end",
"def get_minutes\n de = self.string_to_datetime(@from)\n a = self.string_to_datetime(@to)\n \n total = ((a.hour - de.hour) * 60) + (a.min - de.min)\n end",
"def convert_ft_per_min_to_m_per_sec(value)\n value = (value.to_f * 0.00508).round(2)\n return value\nend",
"def time_convert(num)\n hr, min = num.divmod(60)\n \"#{hr}:#{min}\"\nend",
"def minutes; self * MINUTE; end",
"def minutes; self * MINUTE; end",
"def duration_to_minutes(param_hash)\n param_hash = param_hash.symbolize_keys\n param_hash[:minutes] = WorkEntry.duration_as_minutes(param_hash[:minutes])\n param_hash\n end",
"def minutes\n _nudge[1]\n end",
"def time_conversion(mins)\r\n\r\n [mins /60, mins %60].map {|t| t.to_s.rjust(2, '0')}.join(':')\r\nend",
"def time_to_ms(time)\n (time.to_f * 1000).floor\n end",
"def time_to_ms(time)\n (time.to_f * 1000).floor\n end",
"def format_ms(in_seconds)\n ms = in_seconds * 1000.0\n whole_ms = ms.floor\n dec = ms - whole_ms\n \"#{'%3d' % whole_ms}#{('%.3f' % dec).gsub('0.', '.')}ms\"\n end",
"def in_ms(seconds)\n \"#{'%.2f' % (seconds * 1000).round(2)}ms\"\nend",
"def round_minutes(minutes)\n if minutes >= 60\n # Division will provide the number of hours\n @hour += (minutes / 60).floor\n # Mod will provide the number of minutes\n # TODO: Will this work?\n round_minutes(minutes % 60)\n else\n minutes\n end\n end",
"def durationInMinutes\n @duration/60.0 #Force floating pt.\n end",
"def time_conversion(minutes)\n hours = 0\n counter = 0\n Array(1..minutes).each do |i|\n counter += 1\n if counter == 60\n minutes -= 60\n hours += 1\n counter -= 60\n end\n end\n minutes = '0' + minutes.to_s if minutes < 10\n return hours.to_s + \":\" + minutes.to_s\nend",
"def mins\n @msecs / MIN_TO_MS_F\n end",
"def minutes\n self.to_i * 60\n end",
"def minutes(num)\n t = current_time + num * SECONDS_IN_MINUTE\n {\n type: :datetime,\n value: t.iso8601\n }\n end",
"def d_mins( v )\n TimeDelta.new( MIN_TO_MS * v )\n end",
"def time_conversion(minutes)\n hours = minutes / 60\n remaining_minutes = minutes % 60\n \"%s:%02d\" % [hours, remaining_minutes]\nend",
"def format_milis(miliseconds)\n return Time.at(miliseconds/1000).gmtime.strftime('%M:%S')\nend",
"def time_conversion(minutes)\n\t # hours = 0\n\n # while minutes >= 60 do\n # if minutes >=60\n # hours += 1\n # minutes -=60\n # end\n # end\n\n\n # new_hour = hours.to_s\n # new_minutes = minutes.to_s\n\n \tmin = minutes % 60\n hours = minutes / 60\n\n if min < 10\n \tmin = '0'+min.to_s\n end\n\n \treturn hours.to_s + ':' + min.to_s\n\nend",
"def time_conversion2(minutes)\n hours = 0\n\n while minutes >= 60 # keep substracting 60 untill leaving just minutes less than 60\n hours += 1\n minutes -= 60\n end\n\n if minutes < 10 # less than two digit minutes\n minutes_s = \"0\" + minutes.to_s\n else # more than 10\n minutes_s = minutes.to_s\n end\n\n return hours.to_s + \":\" + minutes_s\nend",
"def duration_as_minutes(length)\n t = length.match(/(\\d\\d):(\\d\\d):(\\d\\d)/)\n if t\n (hours,minutes,seconds) = [t[1].to_i, t[2].to_i, t[3].to_i]\n return sprintf(\"%d:%02d\",(hours * 60 + minutes), seconds)\n else\n return 0\n end \n end",
"def time_conversion(mins)\n hour = mins/60\n min = mins.modulo(60)\n return '%02d:%02d' %[hour,min]\nend",
"def TimeConvert(num)\n\nhour= num.div(60)\n min=num.remainder(60)\n \n return \"#{hour}\" + \":\" + \"#{min}\"\n \nend",
"def TimeConvert(num)\n\n hours = num / 60\n minutes = num - hours * 60\n return \"#{hours}:#{minutes}\"\n \nend",
"def dms ( d, m, s )\n return d + ( m + s/60.0 ) / 60.0\nend",
"def TimeConvert(num)\n hours = num/60\n minutes = num % 60\n \"#{hours}:#{minutes}\"\nend",
"def TimeConvert(num)\n hours = num / 60\n minutes = num % 60\n \n \"#{hours}:#{minutes}\"\nend",
"def total_minutes\n hours * 60 + minutes\n end",
"def time_conversion(minutes)\n hours = 0\n\n while minutes >= 60\n hours = hours + 1\n minutes = minutes - 60\n end \n \n if minutes < 10\n minutes_string = \"0\" + minutes.to_s \n else \n minutes_string = minutes.to_s\n end\n \n return hours.to_s + \":\" + minutes_string\n \nend",
"def time_conversion( minutes )\n\n# https://ruby-doc.org/stdlib-2.1.1/libdoc/time/rdoc/Time.html\n#\n# must require 'time' to work\n#\n# t = Time.now\n# puts(t.iso8601)\n# puts(t.rfc2822)\n# puts(t.httpdate)\n#\n# output:\n#\n# 2018-01-18T17:36:58-08:00\n# Thu, 18 Jan 2018 17:36:58 -0800\n# Fri, 19 Jan 2018 01:36:58 GMT\n\n if( minutes < 60 )\n time = minutes.to_s()\n time = \"0:\" + time\n #puts(time)\n return time\n else\n\n hours = minutes / 60\n minutes = minutes % 60 # to get remainning minutes\n\n # puts ( hours )\n # puts( minutes )\n\n time = hours.to_s()\n minutes = minutes.to_s()\n\n if( minutes.length() == 1 )\n minutes += \"0\"\n end\n\n time = time + \":\" + minutes\n\n return time\n end\n\nend",
"def time_conversion(minutes)\n\thours = minutes / 60\n\tmin = minutes % 60\n\t\tif min < 10\n\t\t\tmin_new = \"0\" + min.to_s\n\t\t\treturn \"#{hours}:#{min_new}\"\n\t\tend\n\tp \"#{hours}:#{min}\"\nend",
"def timeConvert(num)\n\t\n\treturn \"#{num/60}:#{num%60}\"\nend",
"def secs_to_hms\n frac = self % 1\n mins, secs = divmod(60)\n hrs, mins = mins.divmod(60)\n if frac.round(5) > 0.0\n format('%02<hrs>d:%02<mins>d:%02<secs>d.%<frac>d',\n { hrs: hrs,\n mins: mins, secs: secs,\n frac: frac.round(5) * 100 })\n else\n format('%02<hrs>d:%02<mins>d:%02<secs>d',\n { hrs: hrs, mins: mins, secs: secs })\n end\n end",
"def get_duration_integer_minutes\n\t\t((end_time - start_time) / 60).to_i\n\tend",
"def timechunk(sec)\n fail \"sec = #{sec}\" if sec < 1\n 1.send(find_unit(sec)).round\n end",
"def toMillis(time); (time.to_f * 1000).to_i end",
"def time_conversion(minutes)\n hours, minutes = minutes.divmod(60)\n minutes = ('0' + minutes.to_s)[-2, 2]\n \"#{hours}:#{minutes}\"\nend",
"def chronify_qty(qty)\n minutes = 0\n if qty.strip =~ /^(\\d+):(\\d\\d)$/\n minutes += $1.to_i * 60\n minutes += $2.to_i\n elsif qty.strip =~ /^(\\d+)([hmd])?$/\n amt = $1\n type = $2.nil? ? \"m\" : $2\n\n minutes = case type.downcase\n when 'm'\n amt.to_i\n when 'h'\n (amt.to_f * 60).round\n when 'd'\n (amt.to_f * 60 * 24).round\n else\n minutes\n end\n end\n minutes * 60\n end",
"def time_convert (num)\n hour = (num/60).to_s\n min = (num % 60).to_s\n puts hour + \":\"+ min\nend",
"def TimeConvert(num)\n\n # code goes here\n return (num/60).to_s + \":\" + (num%60).to_s\n \nend",
"def time_conversion(minutes)\n if minutes / 60 == 0\n if minutes < 10 \n return \"00:0#{minutes}\"\n \n else\n return \"00:#{minutes}\"\n end\n else\n hours = minutes / 60\n minutes2 = minutes % 60\n if minutes2 == 0\n return \"0#{hours}:00\"\n else\n return \"0#{hours}:#{minutes2}\"\n end\n end\nend",
"def minutes ; self * 60 ; end",
"def to_ms\n\t\t(to_f*1000).round\n\tend",
"def calculate_length(minutes, seconds)\n (minutes * 60) + seconds\nend",
"def TimeConvert(num)\n\thour = num / 60\n\tmin = num % 60\n\treturn \"#{hour}:#{min}\"\nend",
"def minute\n self.to_duration.to_units(:hour, :minute, :second).fetch(:minute)\n end",
"def minutes ; Duration[self * 60] ; end",
"def time_conversion(minutes)\n hours = 0\n if minutes < 10\n minutes = \"0\" + minutes.to_s\n elsif minutes % 60 == 0 \n hours = minutes / 60\n minutes = \"00\"\n else\n hours = minutes / 60\n minutes = minutes % 60\n end\n return hours.to_s + \":\" + minutes.to_s\nend",
"def melbCal(x)\n x = x / 60\n x = x / 60\n return x\n end",
"def minutes_as_duration\n WorkEntry.minutes_as_duration(self.minutes)\n end",
"def ReturnSeconds(value)\n result = value.split(/m|s/)\n result = result[0].to_i*60 + result[1].to_i\n return result\nend",
"def ms\n ((duration * 1000.0) + 0.4999).to_i\n end",
"def toMillis(time)\n (time.to_f * 1000).to_i\n end",
"def minutes_to_hours(minutes)\n minutes / 60\nend",
"def to_min(time)\n min = 0\n min += time.hour * 60\n min += time.min\n return min\n end",
"def convert_minutes_into_hours(minutes)\n hour = minutes / 60\n min = minutes % 60\nputs \" #{hour}:#{min}\"\nend",
"def TimeConvert(num)\n hour = num/60\n minute = num % 60\n puts (\"#{hour}:#{minute}\")\n\nend",
"def mpk\n kmh = self.kmh\n return nil unless kmh and kmh.is_a?(Float)\n div = 60.0 / kmh\n min = div.floor\n sec = ( ( div - min ) * 60.0 ).round \n \"#{ sprintf(\"%.2d\", min ) }:#{ sprintf(\"%.2d\", sec ) }\"\n end",
"def coerce_time_milli(value)\n case value\n when Integer then value * 1000\n when Float then (value * 1000).floor\n else\n if value.respond_to?(:to_f)\n coerce_time_milli(value.to_f)\n elsif value.respond_to?(:to_i)\n coerce_time_milli(value.to_i)\n else\n 0\n end\n end\n end",
"def convert_time_to_milliseconds(time)\n ((Time.strptime(time, '%H:%M:%S,%L') - Time.now.at_midnight) * 1000).to_i\n end",
"def convert_hours_to_minutes(hours = nil)\n return if hours.nil?\n (hours.to_f * 60.to_f).to_i\n end",
"def minute\n if self.in_play?\n return self.round.minute\n else\n if self.finished?\n return MINUTES\n else\n return 0\n end\n end\n end",
"def TimeConvert(str)\r\n\r\n inTime = str.to_i\r\n hrs = inTime / 60\r\n mins = inTime - (hrs * 60)\r\n \r\n return hrs.to_s + \":\" + mins.to_s\r\n \r\nend",
"def format_minutes_as_hrs_mins(minutes)\n hours = minutes / 60\n remainder_minutes = minutes % 60\n remainder_minutes == 0 ? \"#{hours}hrs\" : \"#{hours}hrs #{remainder_minutes}mins\"\n end",
"def add_mins(mins = 1)\n mins = mins.to_i\n cur_mins = @t_min\n next_min = cur_mins + mins\n \n if next_min >= 60\n @t_min = 0\n self.add_hours(1)\n mins_left = (mins - 1) - (60 - cur_mins)\n self.add_mins(mins_left) if mins_left > 0\n elsif next_min < 0\n @t_min = 59\n self.add_hours(-1)\n mins_left = mins + cur_mins + 1\n self.add_mins(mins_left) if mins_left > 0\n else\n @t_min = next_min\n end\n \n return self\n end",
"def convert(tm)\n pattern = tm.utc + minutes * 60\n # FIXME: usec are lost\n Time.new(\n pattern.year,\n pattern.month,\n pattern.day,\n pattern.hour,\n pattern.min,\n pattern.sec,\n to_s\n )\n end",
"def drive_time_in_minutes\n if @status != \"OK\"\n drive_time = 0\n else\n drive_time = @doc.css(\"duration value\").last.text\n convert_to_minutes(drive_time)\n end\n end",
"def humanize_time(seconds)\n\tminutes = seconds / 60\n \t[[60, :m], [24, :h], [100000, :d]].map{ |count, name|\n if minutes > 0\n minutes, n = minutes.divmod(count)\n \"#{n.to_i}#{name}\"\n end\n }.compact.reverse.join('')\nend",
"def englishTimeToMinutes(englishTime)\n\t\tminutes = 0\n\t\tif(englishTime[(englishTime.length - 2)..englishTime.length] == \"pm\")\n\t\t\tminutes = 720\n\t\tend\n\n\t\telements = englishTime[0..(englishTime.length - 3)].split(\":\")\n\n\t\tif(elements[0] != \"12\")\n\t\t\tminutes += 60 * (elements[0].to_i)\n\t\tend\n\n\t\tminutes += elements[1].to_i\n\n\t\treturn minutes\n\tend",
"def CountingMinutesI(str)\n parts = str.scan(/(\\d+):(\\d\\d)(..)-(\\d+):(\\d\\d)(..)/).flatten\n\n first_min = (parts[0].to_i * 60) + (parts[1].to_i) + (parts[2] == \"pm\" ? 720 : 0)\n second_min = (parts[3].to_i * 60) + (parts[4].to_i) + (parts[5] == \"pm\" ? 720 : 0)\n\n second_min += 1440 if first_min > second_min\n\n second_min - first_min\nend",
"def parse_minutes(time)\n minutes = time.strftime(\"%M\").to_i\n minutes == 0 ? [sound_path(\"oclock.ul\")] : sounds_for_number(minutes)\n end",
"def end_of_minute\n change(\n sec: 59,\n usec: Rational(999999999, 1000)\n )\n end",
"def time_conversion(minutes)\n hours = minutes/60\n min = minutes - (hours * 60)\n if min == 0\n min = '00'\n end\n if min > 0 && min < 10\n min = \"0\" + min.to_s\n end\n puts \" #{hours}:#{min}\"\nend",
"def minutes_flight\n stamp = @raw_data[:FlightDuration].split(\"PT\")[1]\n stamp.split(\"H\")[1].split(\"M\")[0].to_i\n rescue\n nil\n end",
"def humanized_minute(minutes)\n if minutes == 1\n ' ' << t('plugin_spent_time_in_issue.datetime.minutes.one')\n elsif minutes > 1\n ' ' << t('plugin_spent_time_in_issue.datetime.minutes.other', minutes: minutes)\n else\n ''\n end\n end",
"def secondstoHMS(sec)\n seconds = sec % 60\n minutes = (sec / 60) % 60\n hours = sec / 3600\n\n format(\"%02d:%02d:%02d\", hours, minutes, seconds) #=> \"01:00:00\"\nend",
"def getMin(mod = 60, unit = 1)\n return normalize(getSec(0,0)/60.0, mod, unit) ;\n end"
] | [
"0.79079336",
"0.74864364",
"0.74320793",
"0.7255307",
"0.7239944",
"0.7224875",
"0.72056425",
"0.7181202",
"0.7058388",
"0.6949478",
"0.693768",
"0.6899149",
"0.6868244",
"0.6825859",
"0.6792967",
"0.6787714",
"0.6787714",
"0.6710452",
"0.66967344",
"0.6662978",
"0.6651344",
"0.66450775",
"0.6644806",
"0.66389513",
"0.66389513",
"0.6629587",
"0.6609414",
"0.66049373",
"0.65816134",
"0.65816134",
"0.6569457",
"0.65582466",
"0.6513421",
"0.65101403",
"0.6495617",
"0.6484604",
"0.6483451",
"0.6478843",
"0.64726937",
"0.6469787",
"0.6463727",
"0.64626974",
"0.6454189",
"0.64501506",
"0.6447161",
"0.64186156",
"0.6416285",
"0.6411303",
"0.6396257",
"0.63570035",
"0.6346118",
"0.6342576",
"0.6330397",
"0.6330268",
"0.6329257",
"0.6327358",
"0.63255435",
"0.63219863",
"0.6316572",
"0.6310923",
"0.6302384",
"0.62821144",
"0.62806916",
"0.62715626",
"0.6261397",
"0.62568176",
"0.62547606",
"0.6231065",
"0.6218303",
"0.61940986",
"0.6184076",
"0.6174294",
"0.61734724",
"0.6158135",
"0.6105549",
"0.61008954",
"0.6092657",
"0.60884947",
"0.6082667",
"0.60822564",
"0.60635257",
"0.60259086",
"0.600533",
"0.5997045",
"0.59712034",
"0.5969903",
"0.59673256",
"0.59619474",
"0.59618896",
"0.5955868",
"0.5948494",
"0.5947909",
"0.59446067",
"0.5937116",
"0.592539",
"0.59240985",
"0.5910813",
"0.59094435",
"0.58951896",
"0.5889372"
] | 0.7840582 | 1 |
subrecords of ours include :address | def addresses
query(:address)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addresses; end",
"def address_results \n @address_results\n end",
"def addresses(aptArr)\n aptArr.each do |apt|\n #puts apt[:address]\n end\n end",
"def addresses\n collect { |a| a.address }\n end",
"def extract_addresses(address_list)\n addresses = []\n address_list.each do |address|\n addresses << address[:address] if ['ipv4', 'hostname'].include?(address[:type])\n end\n addresses\nend",
"def secondary_address; end",
"def addresses\n @addresses\n end",
"def email_addresses_with_details(only_validated = false)\n\t\t# {'email@address'=>{:name=>'member name'},...}\n\t\t{}\n\tend",
"def address_matches\n filtered_matches(ignore: [:first_name, :family_name], perfect: [:street, :city])\n end",
"def combine_address_fields\n %w[to cc bcc].map do |field|\n hash_addresses(@mail[field])\n end\n end",
"def address\n fields = %w[address_line_1 address_line_2 address_line_3 city state zip country]\n Hash[fields.collect { |field| [field.to_sym, send(field)] }]\n end",
"def address(first_recycle_bin)\n puts first_recycle_bin[\"address\"]\nend",
"def address_list_fetch(field_name)\n if values = fetch_all(field_name, nil)\n list = nil\n values.each { |value|\n if list\n list.concat(Address.parse(value))\n else\n list = Address.parse(value)\n end\n }\n if list and !list.empty?\n list\n end\n end or RMail::Address::List.new\n end",
"def populate_address_data\n @address_summary = AddressSummary.new(search_params)\n @address_detail = Address.new(address_params)\n end",
"def group_member_subset\n %i[\n address_line_1\n foreign_address_line_1\n address_city\n address_state\n address_line_2\n address_zip\n address_county\n monitored_address_line_1\n monitored_address_city\n monitored_address_state\n monitored_address_line_2\n monitored_address_zip\n monitored_address_county\n foreign_address_city\n foreign_address_country\n foreign_address_line_2\n foreign_address_zip\n foreign_address_line_3\n foreign_address_state\n foreign_monitored_address_line_1\n foreign_monitored_address_city\n foreign_monitored_address_state\n foreign_monitored_address_line_2\n foreign_monitored_address_zip\n foreign_monitored_address_county\n primary_telephone\n primary_telephone_type\n secondary_telephone\n secondary_telephone_type\n email\n preferred_contact_method\n preferred_contact_time\n port_of_origin\n source_of_report\n source_of_report_specify\n flight_or_vessel_number\n flight_or_vessel_carrier\n port_of_entry_into_usa\n travel_related_notes\n additional_planned_travel_type\n additional_planned_travel_destination\n additional_planned_travel_destination_state\n additional_planned_travel_destination_country\n additional_planned_travel_port_of_departure\n date_of_departure\n date_of_arrival\n additional_planned_travel_start_date\n additional_planned_travel_end_date\n additional_planned_travel_related_notes\n last_date_of_exposure\n potential_exposure_location\n potential_exposure_country\n contact_of_known_case\n contact_of_known_case_id\n travel_to_affected_country_or_area\n was_in_health_care_facility_with_known_cases\n was_in_health_care_facility_with_known_cases_facility_name\n laboratory_personnel\n laboratory_personnel_facility_name\n healthcare_personnel\n healthcare_personnel_facility_name\n exposure_notes\n crew_on_passenger_or_cargo_flight\n member_of_a_common_exposure_cohort\n member_of_a_common_exposure_cohort_type\n isolation\n jurisdiction_id\n assigned_user\n continuous_exposure\n ]\n end",
"def addresses\n # prevent original array from being changed\n @addresses.dup\n end",
"def parse_response\n @fields['address_components'].each do |field|\n parse_field(field)\n end\n define_address\n end",
"def addresses\n Array(@addresses)\n end",
"def vcard_address(data)\n address = data['address']\n address += \", #{data['address2']}\" if data['address2']\n {\n 'a' => ['vcard:Address','vcard:Work'],\n 'vcard:country' => data['country'] || 'United States',\n 'vcard:region' => data['state'],\n 'vcard:locality' => data['city'],\n 'vcard:postalCode' => data['zip'],\n 'vcard:streetAddress' => address\n }\n end",
"def hash_for_search\n return addresses.each.inject([]) do |memo, a|\n memo.push({\n search_customer: \"#{last_name} #{first_name} #{primary_phone} #{a.format_for_search}\",\n label: \"#{last_name}, #{first_name} #{number_to_phone(primary_phone)} #{a.label}\",\n customer_id: id,\n address_id: a.id\n })\n end\n end",
"def retrieveaddressnameskey(fileonedata)\n arr = Array.new\n fileonedata.each_line.with_index do |single_line, index|\n arr.push(single_line.split[0]) if (single_line.split[5] && index>20)\n end\n return arr\n end",
"def fake_address\n {\n first_name: 'Jack',\n last_name: 'Macdowall',\n company_name: 'Macdowalls',\n line_1: '1225 Invention Avenue',\n line_2: 'Birmingham',\n postcode: 'B21 9AF',\n county: 'West Midlands',\n country: 'UK'\n }\n end",
"def address\n {\n street: @data[:ulica].to_s,\n number: @data.values_at(:nr_domu, :nr_lokalu).compact.join('/'),\n code: @data[:pna].to_s,\n town: @data[:miejscowosc].to_s\n }\n end",
"def addresses_in field\n\t\tself.headers[field].scan(/[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+/).flatten.uniq rescue nil\n\tend",
"def add_address # rubocop:disable Metrics/AbcSize\n return unless @bib.place.any?\n\n reg = @bib.place[0].region[0].name if @bib.place[0].region.any?\n addr = [@bib.place[0].name, @bib.place[0].city, reg]\n @item.address = addr.compact.join(\", \")\n end",
"def addresses(tenantArr)\n tenantArr.each do |tenant|\n #puts tenant[:name]\n end\n end",
"def build_address(address)\n {\n route: address.address1,\n neighborhood: address.address2,\n locality: address.address3,\n postalCode: address.postal_code,\n subLocality: address.city,\n state: address.city,\n country: address.country.name\n }.\n # INFO: equivalent of .compact\n select { |_, value| !value.nil? }\n end",
"def find_address_details\n @address_summary = AddressSummary.new\n # Carry forward the default country otherwise it gets lost\n @address_detail = Address.find(find_params[:search_results], params[:address][:default_country])\n if @address_detail.nil?\n @address_summary.errors.add(:postcode, :no_address_find_results)\n else\n @address_summary.postcode = @address_detail.postcode\n @show_manual_address = true\n end\n @address_read_only = true\n [@address_detail, @address_summary, @address_read_only, @show_manual_address]\n end",
"def public_addresses\n details['addresses']['public'].map { |i| i[\"addr\"] }\n end",
"def postal_format_entire_address(co, person_name: nil)\n first_lines = person_name.nil? ? [co.name] : [co.name, person_name.to_s]\n\n address_lines = []\n # address_items = co.main_address.address_array(Address.max_visibility)\n address = co.main_address\n address_lines << address.street_address\n address_lines << \"#{address.post_code} #{address.city}\"\n\n first_lines + address_lines\n end",
"def ship_to_address\n all = {}\n for key_out in [:city, :last_name, :first_name, :country, :zip, :address]\n all[key_out] = unescape params['x_ship_to_' + key_out.to_s]\n end\n \n all\n end",
"def addresses\n h2 :addresses\n @record.addresses.empty? ? p('-') : addresses_table\n gap\n end",
"def addresses\n @client.request('getaddressesbyaccount', name)\n end",
"def address_fields\n \"\".tap do |result|\n fields_for(:address) do |f|\n result << f.text_field(:street_address_line_one)\n result << f.text_field(:street_address_line_two)\n result << f.text_field(:city)\n result << f.select(:state, IsoState.select_options,\n :include_blank => true)\n result << f.text_field(:postal_code)\n result << f.select(:iso_country_id, IsoCountry.select_options,\n :include_blank => true)\n end\n end\n end",
"def build_address(address)\n {\n receiver: address.full_name,\n email: order.email,\n phoneNumber: address.phone,\n route: address.address1,\n street_number: address.address1.scan(/\\d+/).first,\n internalNumber: address.address2.scan(/\\d+/).first,\n neighborhood: address.address2,\n locality: address.address3,\n postal_code: address.zipcode,\n subLocality: address.city,\n state: address.state.name,\n country: address.country.name,\n }\n end",
"def order_billing_address_lines\n order.bill_address.try(:full_address_array)\n end",
"def addresses\n @addresses ||= init_addresses\n end",
"def index\n @address_records = AddressRecord.all\n end",
"def build_params_for_address()\n\n end",
"def build_address(address)\n {\n id: address&.id,\n address_line1: address&.address_line1,\n address_line2: address&.address_line2,\n city: address&.city,\n state: address&.state,\n country: address&.country,\n }\n end",
"def full_address\n [self.address, \"Madrid\", \"Spain\"].compact.join(\", \") if self.address\n end",
"def records\n [gogovan_order, contact.try(:address), contact, schedule, self].compact\n end",
"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",
"def address\n [address_line_1, address_line_2, town_city, county, postcode].join(\", \")\n end",
"def addresses\n message = { nodes: { item: resource[:name]}}\n transport[wsdl].get(:get_address, message)\n end",
"def order_ship_address_lines\n order.ship_address.try(:full_address_array)\n end",
"def billing_address\n all = {}\n for key_out in [:fax, :city, :company, :last_name, :country, :zip, :first_name, :address, :email, :state]\n all[key_out] = unescape params['x_' + key_out.to_s]\n end\n all\n end",
"def _address_fields \n if(@addr_fields) \n return @addr_fields\n end\n \n _format_map( __dir__ + \"/manual_info/p_addr.fmt\" )\n end",
"def full_host_record(ip:)\n load_cnames\n \n @forward_host_record ||= {} # Global, as we want to do name lookups.\n return_record = []\n unless( (host_records = @infoblox.get_host_by_ip(ip_address: ip)).nil? )\n host_records.each do |hosts|\n hosts.each do |hn|\n # Assign an empty record, if we haven't seen this host before\n @forward_host_record[hn] ||= { hostname: hn, ip: '', aliases: [], cnames: [] }\n \n # Record the IP. There may be multiple IPs with one hostname.\n @forward_host_record[hn][:ip] = ip\n \n # The hostname might have CNAMES point to it\n unless @reverse_cnames[hn].nil?\n @reverse_cnames[hn].each do |cn| \n @forward_host_record[hn][:cnames] << cn \n end\n end\n \n # The hostname may have alternate hostname A records, stored in IPAM as ALIASES\n @infoblox.get_alias(hostname: hn) do |a| \n short_alias = a.split('.',2)[0]\n @forward_host_record[hn][:aliases] << short_alias\n \n # The ALIASes might have CNAME records pointing to it\n unless @reverse_cnames[a].nil?\n # Record the ALIAS CNAMES against the parent hostname.\n @reverse_cnames[a].each do |cn| \n @forward_host_record[hn][:cnames] << cn \n end\n end\n end\n return_record << @forward_host_record[hn]\n \n # Add forward lookup entries for each ALIAS\n host_domain = hn.split('.',2)[1]\n @forward_host_record[hn][:aliases].each do |a|\n @forward_host_record[\"#{a}.#{host_domain}\"] = @forward_host_record[hn]\n end\n \n # Add forward lookup entries for each CNAME\n @forward_host_record[hn][:cnames].each do |cn|\n @forward_host_record[cn] = @forward_host_record[hn]\n end\n \n end\n end\n end\n return return_record\nend",
"def full_address\n addr = []\n addr << country.try(:name) if show_country\n addr << (state.try(:name).presence || state_name) if show_state\n addr << address1\n addr.compact.join(', ')\n end",
"def full_address_array\n [name, address1, address2, city_state_zip].compact\n end",
"def full_address_array\n [name, address1, address2, city_state_zip].compact\n end",
"def secondary_address\n addresses.select{ |a| a.address_rank_code == 2 }.first\n end",
"def private_addresses\n details['addresses']['private'].map { |i| i[\"addr\"] }\n end",
"def full_address; end",
"def red_address_data(kind, address)\n data = {\n 'Name' => f.cut(29) { address.firstname.to_s.squish },\n 'Surname' => f.cut(29) { address.lastname.to_s.squish },\n 'Email' => f.cut(44) { email.to_s.squish },\n 'Address' => f.cut(29) { address.address1.to_s.squish },\n 'Address2' => f.cut(29) { address.address2.to_s.squish },\n 'City' => f.cut(19) { address.city.to_s.squish },\n # 'StateCode' => address.state_name.to_s.squish.cut(30),\n 'Country' => address.country.correct_iso3,\n 'PostalCode' => f.cut(8) { address.zipcode.to_s.squish },\n 'HomePhone' => f.cut(18) { f.digits { address.phone } },\n # 'MobilePhone' => nil,\n # 'FaxPhone' => nil,\n # 'TimeToDeparture => nil\n }\n\n data.map { |k, v| { [kind, k].join('_') => v } }.reduce(&:merge)\n end",
"def buildAddress(addrRaw)\n # Check if first address row contains P O Box substring\n isPoB = addrRaw['s'].include? \"P O Box\"\n location = Array.new\n\n fullLoc = (addrRaw['s'] == \"-\" || isPoB) ? \"\" : \"#{addrRaw['s']}, \"\n partialLoc = (addrRaw['s2'] == \"-\") ? \"\" : \"#{addrRaw['s2']},\" \n partialLoc += (addrRaw['l'] == \"-\") ? \"\" : \"#{addrRaw['l']}, \" \n partialLoc += (addrRaw['r'] == \"-\") ? \"\" : \"#{addrRaw['r']}, \" \n partialLoc += (addrRaw['z'] == \"-\") ? \"\" : \"#{addrRaw['z']}, \" \n partialLoc += (addrRaw['c'] == \"-\") ? \"\" : \"#{addrRaw['c']}\"\n\n fullLoc += partialLoc\n\n # If address does not contain an 'AU', it is added to the end of the address\n if fullLoc != \"\"\n if fullLoc.exclude? \"AU\"\n # Set fullLoc as well as partialLoc in case all address was contained in the first line\n fullLoc += \", AU\"\n partialLoc += \", AU\"\n end\n end\n \n location[0] = fullLoc\n location[1] = partialLoc\n \n return location\n end",
"def getaddressesbyaccount(account)\n coind.getaddressesbyaccount account\n end",
"def addresses(tenantArr)\n tenantArr.each do |tenant|\n if tenant[:apartment_id] == 1\n #puts tenant[:apartment_id]\n end\n end\n end",
"def pick_address_from_list\n params.each_key do |key|\n next unless key.start_with? 'pick_address'\n\n index = key.to_s.delete_prefix('pick_address_').to_i\n\n @show_manual_address = true\n @address_read_only = true\n @address_summary = AddressSummary.new\n @address_detail = @address_list[index]\n break\n end\n end",
"def populate_address_list_from_params\n @address_list = []\n params.each do |key, value|\n next unless key.start_with? 'address_list_'\n\n address = Address.new.from_json(value)\n @address_list << address\n end\n end",
"def main_address\n addresses.first\n end",
"def primary_address\n primary_contacts(addresses, :address_rank_code, &:first)\n end",
"def address_details\n @address_details ||= user.addresses.map { |address| AddressDetails.new user, address }\n end",
"def build_addresses(v)\n # only create on address\n if v.kind_of? Hash\n return [Address.new(v)]\n # create multiple addresses\n elsif v.kind_of? Array\n # todo: multiple addresses\n end\n end",
"def billing_address\n all = {}\n [:fax, :city, :company, :last_name, :country, :zip, :first_name, :address, :email, :state].each do |key_out|\n all[key_out] = unescape params['x_' + key_out.to_s]\n end\n all\n end",
"def full_address\n\t\t[\"#{self.street}\", self.city, self.country].compact.join(', ')\n\tend",
"def addresses_table\n data = []\n\n @record.addresses.each_slice(4) do |slice|\n data << slice.map do |address|\n \"#{address.address}\\n\\n#{address.country.try(:to_s)}\"\n end\n end\n\n table data do |table|\n table.row_colors = ['ffffff']\n table.columns(0..3).width = table.width / data.first.length\n table.cells.padding_bottom = 30\n end\n end",
"def from_addresses\n return @from_addresses\n end",
"def address_parts\n texts = @page.css('.claAngebot .claRight p').map(&:text)\n found_address = address_part(CITY_REGEXP, texts) || address_part(WEBSITE_REGEXP, texts) || ''\n found_address.split(\"\\n\").map { |line| clean_up_spaces(line) }\n end",
"def get_biz_names_addresses_coordinates\n @request_businesses.shift(2).map{|business|{name: business[\"name\"], address: business[\"vicinity\"], latitude: business[\"geometry\"][\"location\"][\"lat\"], longitude: business[\"geometry\"][\"location\"][\"lng\"]}}\n end",
"def property_display_address_street_comma_with_county\n dets = self['address_details']\n \"#{dets['address_line_1']}, #{dets['city']}, #{dets['county']} COUNTY, #{dets['state'][0..1]}, #{dets['zip_code']}\".upcase\n end",
"def build_address_details(xml, addressType, address)\n if not address.nil? then\n xml.tag!(addressType){\n xml.Location{\n xml.Address{\n xml.Firstname(address[:name]) \n xml.Street1(address[:address1]) unless address[:address1].nil?\n xml.Street2(address[:address2]) unless address[:address2].nil?\n xml.Street3(address[:address3]) unless address[:address3].nil?\n xml.City(address[:city]) unless address[:city].nil?\n xml.StateProv(address[:state]) unless address[:state].nil?\n xml.PostalCode(address[:zip]) unless address[:zip].nil?\n }\n }\n }\n end\n end",
"def parse_dns(dns_raw)\n dns_records = {}\n dns_raw.each do |line|\n arr = line.split(\", \")\n if(arr[0] == \"A\" || arr[0] == \"CNAME\")\n dns_records[arr[1]] = {:type => arr[0], :target => arr[2].strip}\n end\n end\n \n return dns_records\n end",
"def full_address\n return\"#{self.client},#{self.rep_address_one} #{self.rep_address_two},#{self.city},#{self.state},#{self.zipcode}\"\n end",
"def address_nodes # :nodoc:\n @address_nodes\n end",
"def listreceivedbyaddress(minconf = 1, includeempty = false)\n coind.listreceivedbyaddress minconf, includeempty\n end",
"def addresses\n IbmCloudRest.get \"#{@uri}/addresses\"\n end",
"def each_address(&blk) # :yields: url\n addresses.each(&blk)\n end",
"def add_address(addresses, address)\n address[:postcode] = postcode\n addresses.push(AddressSummary.new_from_search(address))\n end",
"def address\n @address\n end",
"def full(address)\n \"#{address[:type]} #{address[:description]}, #{address[:neighborhood]}, #{address[:city]}-#{address[:state]}, Brasil.\"\n end",
"def joinData(arr)\n return data = {\"rusr\" => arr[0][1..-1].split(\"!\")[0], \"raddress\" => arr[0].split(\"!\")[1], \"type\" => arr[1], \"where\" => arr[2][1..-1]}\n end",
"def address\n\t\t\taddress = [self.address_1, self.try(:address_2), \"#{self.city} #{self.try(:state)}\", \"#{self.try(:zip)}\"].compact\n\t\t\taddress.delete(\"\")\n\t\t\taddress.join(\"<br/>\")\n\t\tend",
"def get_address(tds)\n return clean_whitespace(tds[2].at('span').inner_text + \", NSW\")\nend",
"def get_address(tds)\n return clean_whitespace(tds[2].at('span').inner_text + \", NSW\")\nend",
"def each_address(name)\n getaddresses(name).each { |address| yield(address)}\n end",
"def get_addresses apts\n return apts.map { |apt| apt.address }\n end",
"def address_html(item)\n html = \"\"\n \thtml += \"#{item[:address1]}<br />\"\n \tif item[:address2].present?\n \t\thtml += \"#{item[:address2]}<br />\"\n \tend\n \tif item[:address3].present?\n \t\thtml += \"#{item[:address3]}<br />\"\n \tend\n \thtml += \"#{item[:city]} \"\n \tif item[:state].present?\n \t\thtml += \" #{item[:state]} \"\n \tend\n \thtml += \"#{item[:postal]}<br />\"\n \thtml += country_name(item[:country])\n end",
"def scrape_contacts; end",
"def dissect_to_record_hashes\n end",
"def address_list\n $tracer.trace(format_method(__method__))\n return ProfileAddressList.new(@tag.find.span.className(create_ats_regex_string(\"ats-addrpanel\")), format_method(__method__))\n end",
"def full_address\n \"#{region}, #{district}, #{street_type} #{street_name}, д. #{house_number} кв. #{apartment}\"\n end",
"def customer_address\n { :address1 => params['address1'], :address2 => params['address2'],\n :city => params['city'], :state => params['state'],\n :country => params['country'], :zipcode => params['zipcode'] }\n end",
"def address_params\n end",
"def records( quantity = 1 )\n addresses = []\n quantity.times do\n addresses.push( self.record() )\n end\n addresses\n end",
"def do_address_identifier_search\n @address_summary = AddressSummary.new(search_params)\n @search_results = @address_summary.search\n @show_manual_address = false\n # We need to carry the default country set up forward as the address currently\n @address_detail = Address.new(default_country: params[:address][:default_country])\n end",
"def address_array(visibility_limit = visibility)\n return [] if visibility_limit == self.class.no_visibility\n\n start_index = self.class.visibility_items.index { |viz_item| viz_item == visibility_limit }\n return [] unless start_index\n\n viz_items_length = self.class.visibility_items.length\n\n # Create the array with the actual values of the address.\n # Add in the kommun name if there is one for the address.\n if kommun\n ary = [street_address, post_code, city, kommun.name,\n sverige_if_nil][start_index..viz_items_length]\n else\n ary = [street_address, post_code, city,\n sverige_if_nil][start_index..(viz_items_length - 1)]\n end\n ary.delete_if { |f| f.blank? }\n end",
"def look_up_addresses\n if postcode.present?\n address_finder = AddressFinderService.new(postcode)\n self.temp_addresses = address_finder.search_by_postcode\n else\n self.temp_addresses = []\n end\n end",
"def index\n @microlocations = @address.microlocations\n end"
] | [
"0.6420966",
"0.6109762",
"0.6055216",
"0.5983212",
"0.59642756",
"0.59132963",
"0.59048325",
"0.58421206",
"0.57869",
"0.57858795",
"0.57798004",
"0.57555455",
"0.5729808",
"0.5708194",
"0.56929094",
"0.5688735",
"0.5642913",
"0.5623785",
"0.5608693",
"0.5600032",
"0.55943215",
"0.5585889",
"0.5584873",
"0.5581932",
"0.55791926",
"0.5565239",
"0.5554088",
"0.5547012",
"0.55465597",
"0.5543899",
"0.5531327",
"0.5527977",
"0.55226827",
"0.55116427",
"0.55107933",
"0.5506136",
"0.55048114",
"0.5504331",
"0.5497834",
"0.54833704",
"0.54716957",
"0.54699886",
"0.54697233",
"0.54690254",
"0.5447423",
"0.5445043",
"0.5438576",
"0.54227936",
"0.54211146",
"0.54209685",
"0.54204243",
"0.54204243",
"0.54153585",
"0.54147404",
"0.54140896",
"0.5411709",
"0.5410208",
"0.5409335",
"0.54031384",
"0.53796154",
"0.5371485",
"0.5368566",
"0.5354996",
"0.53543437",
"0.535241",
"0.53393334",
"0.5334371",
"0.53300095",
"0.53229713",
"0.5310185",
"0.5303609",
"0.5300496",
"0.52971834",
"0.5297017",
"0.52966815",
"0.52858514",
"0.52792704",
"0.5278739",
"0.5277632",
"0.5276166",
"0.5273485",
"0.5273254",
"0.5269227",
"0.5267011",
"0.52627766",
"0.52627766",
"0.5261738",
"0.52573407",
"0.525588",
"0.52528393",
"0.52527565",
"0.5252727",
"0.5249217",
"0.5245062",
"0.5243138",
"0.5225046",
"0.5224289",
"0.5217412",
"0.52163905",
"0.5211913"
] | 0.61726993 | 1 |
User inputs their string for coding or decoding Encryption initializes a counter for the index number, advances accross the string, and uses the .next function to increment the current letter, and adds it to a created empty string. The program checks for instances of "aa" then replaces them with the appropriate character, "z" decryption initializes a counter for the index number, and similarly advances accross the string Using the given alphabet string, the decryption function finds the given letters position on the alphabet, decrements the new index counter, finds the new letter at the new position, and pushes it to a new decrypted string The nested call should work since the argument is merely calling for the program to execute another function in order to provide the data required to finish the desired 'forwards backwards' function. | def intro()
puts "Greetings Agent. Encryption or decryption today? (e/d)"
confirm = gets.chomp
if confirm == "e"
puts "enter string for encryption"
input = gets.chomp
puts "#{input} encrypted: #{encryption(input)}"
elsif confirm == "d"
puts "enter string for decryption"
input = gets.chomp
puts "#{input} decrypted: #{decryption(input)}"
else
puts "confirmed for decryption decryption protocol, 'swordfish'"
puts "de-encrypt complete: #{decryption(encryption("swordfish"))}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt(string_to_encrypt) # Create a function accepting string variable as parameter\n\tcontrol = 0\t# Set control variable to 0 \n\twhile control < string_to_encrypt.length # check if the control variable is less than length of the passed string. If yes run the code in the while loop\n\t\tif string_to_encrypt[control] == \"z\" # Because .next that doesn't work well with beginning and ending letters of alphabet check if the current letter is \"z\" and if so change it to \"a\" manually\n\t\t\tstring_to_encrypt[control] = \"a\"\n\t\telsif string_to_encrypt[control] == \" \" # If the character is a space, we want to keep it as a space\n\t\t\tstring_to_encrypt[control] = \" \"\n\t\telse\n\t\t\tstring_to_encrypt[control] = string_to_encrypt[control].next # Retrieve letter from the string that is indexed by control variable, apply .next method to it and reasign to the same place in the string\n\t\tend\n\t\tcontrol = control + 1 # Upate control variable to move to the next letter\n\tend\n\treturn_string = string_to_encrypt\n\treturn return_string\nend",
"def Caesar_cipher(input_string,input_shift)\n\n alphabet = ('a'..'z').to_a\n alphabetUpCase = ('A'..'Z').to_a\n\n input_string.each_char {|letter| \n if letter =~ /[A-Z]/\n new_letter_index = alphabetUpCase.index(letter) + input_shift\n if new_letter_index > 25\n new_letter_index -= 26\n puts alphabetUpCase[new_letter_index]\n else\n puts alphabetUpCase[new_letter_index]\n end\n elsif letter =~ /[a-z]/\n new_letter_index = alphabet.index(letter) + input_shift\n if new_letter_index > 25\n new_letter_index -= 25\n puts alphabet[new_letter_index]\n else\n puts alphabet[new_letter_index]\n end\n else\n puts letter\n end\n }\nend",
"def decrypt(string_input)\n index = 0\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\n while index < string_input.length\n if string_input[index] == \"a\"\n string_input[index] = \"z\"\n elsif string_input[index] != \" \"\n index_of_previous = alphabet.index(string_input[index]) - 1\n string_input[index] = alphabet[index_of_previous]\n end\n index += 1\n end\n\n puts string_input\n return string_input\nend",
"def encrypt(string)\n\nindex_of_string = 0\n#postilion of the character within the string, the substring of the string in question \n\n\twhile index_of_string < string.length\n\t\t#the character position in the index has to be less than the actual length of if the string\n\t\tif string[index_of_string] == \"z\"\n\t\t\tstring[index_of_string] = \"a\"\t\n\t\telsif string[index_of_string] == \"\"\n\t\t\t\t\n\t\t# if the character is z, the program will automatically make the letter to be a so that it can be b when called next, and not aa\n\telse\t\t\n\tstring[index_of_string] = string[index_of_string].next\n\n\tend\n\t\tindex_of_string = index_of_string + 1\n\t\n\tend\n\treturn string\nend",
"def decrypt(string)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n current_index = 0\n while current_index <= (string.length - 1)\n previous_letter = alphabet.index(string[current_index]) - 1 ## b would give you the index of a, which is 0\n string[current_index] = alphabet[previous_letter]\n current_index += 1\n end\n return string #insure that the method returns a correct string, puts method did not work when encrypt was nested within decrypt\nend",
"def decrypt(string) #decrypt is a container, a string goes in\n\nalphabet = \"abcdefghijklmnopqrstuvwxyz\" #this is important for compairing w/ string\nindex = 0 #initialize while loops outside it\n\nwhile index < string.length # when index is less than the length of the string\n\t\tstring[index] = alphabet[alphabet.index(string[index]) - 1]\n\t\t\t\t\t\t\t\t\t\t\t\t#string[0] == \"b\"\n\t\t\t\t\t\t\t\t#alphabet.index(string[0]) == 1\n\t# string[index] =\t#alphabet[1 - 1] == alphabet[0] == a\n\t\tindex += 1 #index = 0 + 1 == 1 keep going until this number is >= string.length\nend\n\np string #prints out string, with quotes does not return nil\n\nend",
"def decrypt(string)\n #find out length of string\n length = string.length\n\n decrypt_string = \"\"\n count = 0\n\n until count >= length\n if string[count] == \"a\"\n decrypt_string = decrypt_string + \"z\"\n\n elsif string[count] == \"!\"\n new_letter = \" \"\n decrypt_string = decrypt_string + new_letter\n\n elsif string[count] == string[count].upcase\n upper_alphabet = \"abcdefghijklmnopqrstuvwxyz\".upcase\n index_val = upper_alphabet.index(string[count])\n new_letter = upper_alphabet[index_val - 1]\n decrypt_string = decrypt_string + new_letter\n\n else\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n index_val = alphabet.index(string[count])\n new_letter = alphabet[index_val - 1]\n decrypt_string = decrypt_string + new_letter\n end\n count += 1\n end\n p decrypt_string\nend",
"def encrypt (string) #encrypt is a container, a string goes in\n\t\nindex = 0 #initiate a variable for the while loop, this variable stands for the index\n\nwhile index < string.length #when the index is less than the length of the string\n\n\tif string[index] == \"z\" # if the string at that index is equal to \"z\"\n\t\tstring[index] = \"a\" # assign the string at that index to \"a\"\n\telse\t\t\t\t\t# if that isn't true\n\t\tstring[index] = string[index].next # assign string at that index to the next letter in the alphabet\n\tend\n\t\tindex = index + 1 #increment the index, you can increment here b/c still \nend\t\t\t\t\t\t #inside while loop\n\np string # print out each string[index] as a string, p will make it have quotes around it\n\nend",
"def decrypt(code)\r\n # Ruby doesn't have a built-in method to call previous letters so we make our own\r\n def previous(letter)\r\n # have alphabet for reference for the letter to know the index\r\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\r\n i= 0 \r\n until letter == alphabet[i]\r\n i+=1\r\n end\r\n # print the letter previous to it\r\n return alphabet [i-1]\r\n end\r\n \r\n #\r\n decrypted_code=\"\"\r\n i = 0\r\n while i < code.length\r\n decrypted_code = decrypted_code + previous(code[i])\r\n i+=1\r\n end\r\n return decrypted_code\r\nend",
"def decrypt(string_to_decrypt) # Create a function accepting string variable as parameter\n\talphabet_string = \"abcdefghijklmnoprstuvwxyz\" # Create a string variable that hold entire variable\n\tcontrol = 0\t# Create a control variable for the loop\n\twhile control < string_to_decrypt.length # while control variable is less than length of the string do the code in the loop\n\t\tif string_to_decrypt[control] == \" \" # if the character is a space keep it as a space\n\t\t\tstring_to_decrypt[control] = \" \"\n\t\telse\n\t\t\tposition_in_alphabet = alphabet_string.index(string_to_decrypt[control]) # Retrieve letter from string_to_decrypt indexed by value in the control variable, then find which position in the alhpabet this letter is in and assign to a variable to be used later\n\t\t\tstring_to_decrypt[control] = alphabet_string[(position_in_alphabet-1)] # Retrieve the letter from the alphabet inexe by position_in_alphabet-1, since we want to grab the previous letter in alphabet\n\t\tend\n\tcontrol = control +1 #Update control variable\n\tend\n\treturn_string = string_to_decrypt\n\treturn return_string\nend",
"def decrypt_method(arg, index)\n while index < arg.length\n if arg[index] == \"a\"\n arg[index] = \"z\"\n index += 1\n else\n arg[index] = (arg[index].ord - 1).chr\n index += 1\n end\n end\n puts arg\nend",
"def encrypt(string) #encryption method\nindex = 0 #initializes the loop to go through letters in the string \nwhile index < string.length #sets the condition of the loop\n if string[index] == \"z\"\n string[index] = \"a\"\n index += 1\n elsif string[index] == \"\"\n index += 1\n else\n string[index] = string[index].next\n index += 1\n end\n end\nstring #loop ends when method gets to the last letter in the string\nend",
"def encrypt(str)\n index = 0\n\n# For each letter by index advance by 1\n\n while index < str.length\n \n# Edge case conditional for z\n \tif str[index] == \"z\"\n \t\tstr[index] = \"a\"\n\telse\n\t\tstr[index] = str[index].next\n\tend\n index += 1\n end\n\n# Print new string\n\n p str\n return str\n \nend",
"def encrypt(string)\n\n# separate string into characters\n# advance characters one letter forward\n\n count = 0 # initialize count\n \n while count < string.length # run loop while count is less than string length (print every character)\n if string[count] == \" \" # preserve space character\n count += 1\n else\n if string[count] == \"z\" # edge case conditional\n string[count] = \"a\"\n else\n string[count] = string[count].next! # select character by index #, advance, and reassign\n end\n count += 1 # add to count so next character in string is called through method\n end\n end\n\n # reassemble string with advanced characters\n\n return string\n\nend",
"def decrypt(seq_string)\n alphabets = \"abcdefghijklmnopqrstuvwxyz\"\n index = 0\n seq_string3 = \"\"\n while index < seq_string.length\n post_desired_letter = alphabets.index(seq_string[index])\n desired_letter = post_desired_letter - 1\n seq_string3 = seq_string3 + alphabets[desired_letter]\n index += 1\n end\n puts seq_string3\n\nend",
"def decrypt (string)\n alphabet= \"abcdefghijklmnopqrstuvwxyz\"\n counter= 0\n while counter < string.length\n string[counter] = alphabet[alphabet.index(string[counter])-1]\n counter+=1\n end\n p string\nend",
"def encrypt(input)\n index = 0\n#loops through all the letters of the input string\nwhile index < input.length\n#declares if the input is a \"space\" then skip it\nif !(input[index] == \" \")\n#connects the end of the alphabet to the begin; full circle\n if input[index] == \"z\"\n input[index] = \"a\"\n #takes each letter from the input string moves to the next letter\n else input[index] = input[index].next!\n end\n end\n #moves to the next letter of the input string\n index += 1\nend\n\nputs input\nend",
"def decrypt(input)\n # 2. define the alphabet as a string\n abc = \"abcdefghijklmnopqrstuvwxyz\"\n # 3. iterate through the encrypted string\n i = 0\n while i < input.length\n # 4. for each character find the index in the abc string\n whereabc = abc.index(input[i])\n # 5. returen the character at the index-1 in the abc string\n input[i] = abc[whereabc - 1]\n i += 1\n end #while\n # 6. return the decrypted string\n input\nend",
"def decrypt(str)\n \n str.downcase!\n \n counter = 0\n length = str.length\n newString = \"\"\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n \n while counter < length\n \n currentLetter = str[counter]\n \n if currentLetter == \"a\"\n \n newString = newString + \"z\";\n \n elsif currentLetter == \" \"\n \n newString = newString + \" \";\n \n else\n \n place = \"abcdefghijklmnopqrstuvwxyz\".index(currentLetter) \n\n newPlace = place - 1\n\n nextLetter = \"abcdefghijklmnopqrstuvwxyz\"[newPlace]\n\n newString = newString + nextLetter;\n \n end\n \n counter += 1\n \n end\n \n return newString\n \nend",
"def decrypt(string)\n\n # build method to generate previous letter in alphabet\n\n def retreat(letter)\n\n alpha = \"abcdefghijklmnopqrstuvwxyz\" #this method takes care of edge cases, but the code breaks if character is not in this string\n value = alpha.index(letter) - 1\n return alpha[value]\n \n end\n\n# separate string into characters\n# call retreat method on each character of string\n\n count = 0\n\n while count < string.length\n if string[count] == \" \"\n count += 1\n else\n string[count] = retreat(string[count])\n count += 1\n end\n end\n\n# reassemble string with retreated characters\n\n return string\n\nend",
"def encrypt(string)\r\n\r\n\t\tlength = string.length - 1 \r\n\r\n\t\tuntil length == -1\r\n\t\t\tif \r\n\t\t\t\tstring[length] == \"z\"\r\n\t\t\tthen\r\n\t\t\t\tstring[length] = \"a\"\r\n\t\t\telse\r\n\t\t\t\tstring[length] = string[length].next\r\n\t\t\tend\r\n\t\t\tlength = length -1\t\r\n\t\tend\r\n\t\tstring\r\nend",
"def decrypt(str)\r\nalphabet = \"abcdefghijklmnopqrstuvwxyz\"\r\nindex = 0 \r\nwhile index < str.length\r\n str[index] = alphabet[alphabet.index(str[index])-1]\r\n index += 1 \r\nend\r\nputs \"#{str}\"\r\nreturn str \r\nend",
"def encrypt(str)\r\n\tindex = 0\r\n\twhile index < str.length\r\n\t\tif str[index] == \"z\"\r\n\t\t\tstr[index] = \"a\"\r\n\t\telse\t\r\n\t\tstr[index] = str[index].next!\r\n\t\tend\r\n\t\tindex += 1\r\n\t\t\r\n\tend\r\n\tputs \"the encrypttion is #{(str)}\"\r\n\t\r\nend",
"def encrypt(my_string)\n i = 0 # start with first letter of string\n new_string = \"\" # placeholder of new string since it will be generated after\n# increase it one letter\n until i == my_string.length # until i == the length of my_string aka 3 keep running loop\n if !(\"a\"..\"z\").include?(my_string[i]) # if there is an anti-alphabet in my_string\n new_string = new_string + my_string[i] # take whatever value in new string take current value in new string and add character we're on right now \"\" + \" \" p pr pry pryz; (\"+\" is tacking on next letter)\n elsif my_string[i] == \"z\" # or if my_string is a z\n new_string = new_string + \"a\" # take w/e value we have so far in new_string and add \"a\"\n else # otherwise\n new_string = new_string + my_string[i].next # take w/e value we have so far and tack on the next letter of string[i]\n end\n i += 1 # go onto the next character in the string / increment up 1 // iterate over string and position in array\n end\n new_string # show me the new string\nend",
"def encrypt(code)\r\n #declare empty string to add to\r\n encrypted_code=\"\"\r\n i = 0\r\n #loop the letters\r\n while i < code.length\r\n #z is an edge case make a special conditon for that\r\n if code[i] == \"z\"\r\n encrypted_code = encrypted_code + \"a\"\r\n \r\n # all the letters change to subsequent letters and add to encrypted code\r\n else\r\n encrypted_code = encrypted_code + code[i].next\r\n \r\n end\r\n i+=1\r\n end\r\n \r\n return encrypted_code\r\nend",
"def encrypt(string)\nindex = 0\n while index < string.length\n if string[index] == \"z\"\n \t\tstring[index] = \"a\"\n \telse\n string[index] = string[index].next!\n end\n index += 1\n end\np string \nend",
"def decrypt(string)\r\n idx = 0\r\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\r\n while idx < string.length\r\n string[idx] = alphabet[alphabet.index(string[idx]) - 1]\r\n idx += 1\r\nend\r\nstring\r\nend",
"def decrypt(n)\n\n # Save the alphabet into a variable.\n\n # Find the index number for the letter in the string eg (\"abc\"[0] => \"a\") and calling that letter on the alphabet to get the indexed number eg (alphabet.index(\"a\") => 0).\n\n # Then store it into a variable (abcs_index).\n\n # Then subtract 1 to get it to the prior letter in the alphabet.\n\n # Loop the operation so it will find the index for every character of the string.\n\n # Add each index of the string together into a variable so we can print it. \n\n str_index = 0\n\n decrypt_str = \"\"\n\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\n while str_index < n.length\n\n abcs_index = alphabet.index(n[str_index]) #\"alphabet\".index(\"a\") => 0\n\n abcs_index -= 1 #0 - 1 => 25\n\n decrypt_str = decrypt_str + alphabet[abcs_index]\n\n str_index += 1\n\n end\n\n p decrypt_str\n\nend",
"def decrypt(str)\n\toriginal_index = 0\n\treference = \"abcdefghijklmnopqrstuvwxyz\"\n\twhile original_index < str.length\n #this is the index, in the reference string, for the input letter \n old_letter_index = reference.index(str[original_index]) \n #reversing one letter in the reference string \n p reference[old_letter_index -=1] \n #advancing to the next letter in the original input \n original_index += 1\n\tend\nend",
"def encrypt(string)\n current_index = 0\n while current_index <= (string.length - 1)\n if string[current_index] == \"z\"\n string[current_index] = \"a\" #for edge cases\n else string[current_index] = string[current_index].next\n end\n current_index += 1\n end\n return string\nend",
"def decrypt(string)\n index = 0\n alphabet = (\"abcdefghijklmnopqrstuvwxyz\")\n while index < string.length\n #puts \"index = #{index}\"\n #puts \"string[index] - #{string[index]}\"\n #puts \"alphabet.index(string[index]) = #{alphabet.index(string[index])}\"\n #puts \"alphabet[alphabet.index(string[index])-1] - #{alphabet[alphabet.index(string[index])-1]}\"\n #puts\n if string[index] == \" \"\n string[index] = \" \"\n else\n string[index] = alphabet[alphabet.index(string[index].downcase)-1]\n end\n index += 1\n end\n #p string\nend",
"def encrypt(str)\n str_count = 0\n str_actual = \"\"\n until str_count == str.length\n if str[str_count] == \"z\"\n str_actual += \"a\"\n else\n str_actual += str[str_count].next\n end\n str_count += 1\n end\n encrypt = str_actual\nend",
"def decrypt(string)\nindex= 0\na_to_z = \"abcdefghijklmnopqrstuvwxyz\"\nempty_string = \"\"\n\twhile index < string.length\n\tnew_string = string[index]\n\tposition = a_to_z.index(new_string)\n\tsecond_index = position - 1\n\tempty_string = empty_string + a_to_z[second_index]\n\tend\np empty_string\nend",
"def decrypt(banana)\n ind = 0\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n while ind < banana.length\n litera = banana[ind]\n index_in_alphabet = alphabet.index(litera)\n if index_in_alphabet == 0\n puts \"z\"\n else\n puts alphabet[index_in_alphabet - 1]\n end\n ind += 1\n end\nend",
"def encrypt(string)\r\nnew_string=\"\"\r\nidx=0\r\nwhile idx < string.length\r\nnew_string << string[idx].next unless\r\nif string[idx] == \"z\"\r\nstring[idx] = \"a\"\r\nnew_string << string[idx]\r\nend\r\nidx+=1\r\nend\r\nnew_string\r\nend",
"def encrypt(str)\n\tcount = 0\n\talphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\tif str[count] == alphabet[0]\n\t\tuntil count == str.length\n\t\tstr[count] = str[count].next\n\t\tcount +=1\n\t\tend\n\t\t\n\tputs str\n\telsif str[count] == alphabet[25]\n\t\tstr[count] = alphabet[0]\n\t\tcount+=1\n\t\tuntil count == str.length\n\t\tstr[count] = str[count].next\n\t\tcount+=1\n\t\tend\n\t\t\n\telse\n\t until count == str.length\n\t\tstr[count] = str[count].next\n\t\tcount +=1\n\t\tend\n\t\t\n\t\t\n str\n\n\tend\n\t\t\nend",
"def decrypt(string)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n index = 0\n new_string = ''\n while index < string.length\n new_letter = alphabet[(alphabet.index(string[index])-1)] \n new_string += new_letter\n index += 1\nend\np new_string\nend",
"def decrypt(string)\n i=0\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"#alphabet variable\n while i<string.length\n #we need to tell the alphabet string what index the letter of the string letter is in the alphabet\n# num = hello[0]==>\"h\" alphabet.index(\"h\")==>7\n #num-1==> 6\n #alphabet[6]\nstring[i]= alphabet[alphabet.index(string[i])-1]\n #p string[alphabet.index(alphabet[i-1])]\n\ni+=1\n end\n p string\nend",
"def decrypt(encrypted_string)\n index = 0\n decrypt_password = encrypted_string\n while index < encrypted_string.length\n letter = decrypt_password[index]\n\n index_of_letter = \"abcdefghijklmnopqrstuvwxyz\".index(letter)\n\n #would now have index returned of where letter is in alphabet string\n # decrypt_password == '1at'\n #now could tke index of where each letter is in the alphabet and assign it the the index before it\n new_index_of_letter = index_of_letter - 1\n\n #have correct index of where in the alphabet the new letter should print out\n decrypt_password[index] = \"abcdefghijklmnopqrstuvwxyz\"[new_index_of_letter]\n\n index += 1\n end\n p decrypt_password\n end",
"def decrypt (str)\n\tindex = 0\n\twhile index < str.length\n\t\talphabet = \"abcdefghijklmnopqrstuvwxyz\"\n \treversed_alpha = alphabet.reverse!\n\t\t add_index = reversed_alpha.index(str[index]) \n add_index += 1\n str[index] = reversed_alpha[add_index]\n index += 1\n\tend\n\tstr\nend",
"def encrypt(string)\r\n\tindex = 0\r\n\twhile index < string.length\r\n\t\tif string[index] == \"z\"\r\n\t\t\tstring[index] = \"a\"\r\n\t\telsif string[index] != \" \"\r\n\t\t\tstring[index] = string[index].next\r\n\t\tend\r\n\t\tindex += 1\r\n\tend\r\n\tp string\r\nend",
"def encrypt_method(arg, index)\n while index < arg.length\n if arg[index] == \"z\"\n arg[index] = \"a\"\n index += 1\n else\n arg[index] = arg[index].next\n index += 1\n end\n end\n # return arg\n puts arg\nend",
"def encrypt(str)\r\nindex = 0 \r\nwhile index < str.length\r\n if str[index] == \"z\"\r\n str[index] = \"a\"\r\n else \r\n str[index] = str[index].next\r\n end \r\n index += 1 \r\nend\r\nputs \"#{str}\"\r\nreturn str \r\nend",
"def encrypt(string)\n length = string.length\n\n\n encrypt_string = \"\"\n count = 0\n until count >= length\n if string[count] == \"z\"\n encrypt_string = encrypt_string + \"a\"\n\n else\n encrypt_string = encrypt_string + string[count].next\n end\n count += 1\n end\n p encrypt_string\nend",
"def encrypt(encrypt_input)\r\n index_encrypt = 0\r\n encrypt_output = \"\"\r\n\r\n while index_encrypt < encrypt_input.length\r\n if encrypt_input[index_encrypt] == \"z\"\r\n encrypt_output[index_encrypt] = \"a\"\r\n elsif encrypt_input[index_encrypt] == \" \"\r\n encrypt_output[index_encrypt] = \" \"\r\n else\r\n encrypt_output[index_encrypt] = encrypt_input[index_encrypt].next\r\n end\r\n index_encrypt += 1\r\n end \r\n return encrypt_output\r\nend",
"def encrypt_text(secret_code)\n code_length = secret_code.length\n current_position = 0\n\n until current_position == code_length\n \n if secret_code[current_position] == \"z\"\n secret_code[current_position] = \"a\"\n\n else\n\n secret_code[current_position] = secret_code[current_position].next\n\n end\n current_position = current_position + 1\nend\n\n puts \"The encrypted code is: #{secret_code}.\"\nreturn secret_code\nend",
"def encrypt(str)\nindex = 0 \nwhile index < str.length\n if str[index] == \"z\"\n str[index] = \"a\"\n else \n str[index] = str[index].next\n end \n index += 1 \nend\nputs \"#{str}\"\nreturn str \nend",
"def decrypt(string)\n index = 0\n\n until index >= string.length\n if string[index] != \" \"\n if string[index] == \"a\"\n string[index] = \"z\"\n else\n string[index] = (string[index].chr.ord-1).chr\n end \n end\n index += 1\n end \n return string \nend",
"def encrypt(str)\n\n def name_swapper(str)\n str = str.split()\n str[0], str[1] = str[1], str[0]\n str.join(\" \")\n end\n\n # p name_swapper(\"Bob Henry\")\n # p name_swapper(\"Alexander Rowland\")\n\n\n def shift(str)\n cap_vowels = \"AEIOUA\"\n lower_vowels = \"aeioua\"\n cap_consonants = \"BCDFGHJKLMNPQRSTVWXYZB\"\n lower_consonants = \"bcdfghjklmnpqrstvwxyzb\"\n letter_array = []\n shifted_string = \"\"\n\n str = str.split\n letter_array += str[0].split(\"\")\n letter_array += [\" \"]\n letter_array += str[1].split(\"\")\n letter_array.each do |letter|\n if cap_vowels.include? letter\n shifted_string += cap_vowels[cap_vowels.index(letter) + 1]\n elsif lower_vowels.include? letter\n shifted_string += lower_vowels[lower_vowels.index(letter) + 1]\n elsif cap_consonants.include? letter\n shifted_string += cap_consonants[cap_consonants.index(letter) + 1]\n elsif lower_consonants.include? letter\n shifted_string += lower_consonants[lower_consonants.index(letter) + 1]\n elsif letter == \" \"\n shifted_string += \" \"\n end\n end\n shifted_string\n end\n shift(name_swapper(str))\nend",
"def encrypt(str)\n\tcounter = 0\n\tword = \"\"\n\tuntil counter == str.length\n\t\tif str[counter] == \"z\" #edge case\n\t\t\tword += \"a\"\n\t\t\tcounter +=1\n\t\telse\n\t\t\tword += str[counter].next\n\t\t\tcounter += 1\n\t\tend\n\tend\n\tputs word\nend",
"def decrypt(str)\nalpha = \"abcdefghijklmnopqrstuvwxyz\"\nindex = 0\n while index < str.length\n str[index] = alpha[(alpha.index(str[index])-1)]\n index += 1\n end\n p str\nend",
"def encrypt(str)\n index = 0\n while index < str.length\n str[index] = if str[index].include? 'z'\n 'a'\n else\n str[index].next\n end\n index += 1\n end\n str\nend",
"def encrypt(input_text, offset)\n # Error messages for: empty strings & offset == 0.\n raise ArgumentError, 'String must not be empty' if input_text == ''\n raise ArgumentError, 'Offset must not be zero' if offset == 0\n\n # Makes the input text uppercase letters only.\n input_text = input_text.upcase\n\n # Will hold all letters from input_text.\n text_list = []\n\n # Defines each letter with a number using index.\n letter_index = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']\n\n # The encrypted text goes here.\n encrypted_text = ''\n\n # Stopping infinite loops.\n counter = 0\n\n # Sends each character in the input text in to their own element in an array(text_list).\n while counter < input_text.length\n text_list << input_text[counter]\n counter += 1\n end\n\n # Resets the counter.\n counter = 0\n\n # Goes through each character in the list.\n while counter < text_list.size\n # Resets the new_letter.\n new_letter = ''\n\n # Goes through the alphabet for comparison reasons.\n letter_index.each { |x|\n\n # Error message for: current element in array == nil.\n raise ArgumentError, 'Element must not be nil' if text_list[counter] == nil\n\n # Checks if current element in text_list is = to currently selected letter in the alphabet.\n if text_list[counter] == x\n\n # Declares a temporary variable to hold the new offset.\n temp = letter_index.index(text_list[counter]) + offset\n\n # Makes sure that the offset for a new letter isn't a value that is bigger than the lenght of the alphabet.\n if temp > letter_index.size - 1\n temp = temp - letter_index.size\n end\n\n # Declares which new letter whom is to be added to the encrypted text.\n new_letter = letter_index[temp]\n end\n }\n\n # Makes sure to keep spaces so the text don't get messy.\n if new_letter == ''\n new_letter = text_list[counter]\n end\n\n # Adds the new letter to the end of the encrypted text.\n encrypted_text += new_letter\n\n # Increments the counter.\n counter += 1\n end\n\n # Returns the encrypted text.\n return encrypted_text\nend",
"def encrypt(string)\n counter = 0\n while counter < string.length\n if string[counter] == 'z'\n string[counter] = 'a'\n \n elsif string[counter] == \" \"\n string[counter] = string[counter]\n \n else\n string[counter] = string[counter].next\n end\n counter = counter + 1\n end\n return string\nend",
"def decrypt(decrypt_input)\r\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\r\n index_decrypt = 0\r\n decrypt_output = \"\"\r\n\r\n while index_decrypt < decrypt_input.length\r\n index_alphabet = 0\r\n index_alphabet = alphabet.index(decrypt_input[index_decrypt]) \r\n decrypt_output[index_decrypt] = alphabet[index_alphabet - 1]\r\n index_decrypt += 1\r\n end\r\n return decrypt_output\r\nend",
"def encrypt(string)\n index = 0\n while index < string.length\n if string[index] == \"z\"\n string[index] = \"a\"\n else\n string[index] = string[index].next\n end\n index = index + 1\n end\n return string\nend",
"def solve_cipher(string, n)\n\n#Split each element of the string to get and array and return an array where each element is x (to operate with each element)\n string.split('').map do |x|\n#Create a new variable that will be the new index for each element.\n new_index = x.ord + n\n \n#Define the new index value with if conditional statements.\n\n#The value for whitespace is its value -26 as it is not included in the alphanumerical rules defined above\nif x == ' '\n new_index = ' '.ord - 26\nend\n\n\n#Declare the values of the index where it is above z's\nif new_index > 'z'.ord\n new_index = 'a'.ord + new_index - 'z'.ord - 1\nend\n\n#Declare the values of the index where it is beyond a's\nif new_index < 'a'.ord\n new_index = 'z'.ord - ('a'.ord - new_index) + 1\nend\n \n #Make the function return the list of numbers converted into letters \n new_index.chr\n\nend.join\n\nend",
"def encryption(string)\n\tnew_string = \"\"\n\tx = 0\n\twhile x < string.length\n\t\t\n\t\tif string[x] == \"z\"\n\t\t\tnew_string = new_string + \"a\"\n\t\telsif string[x] == \" \"\n\t\t\tnew_string = new_string + \"_\"\n\t\telse\n\t\t\tnew_string = new_string + string[x].next\n\t\t\n\t\tend\n\t\t\t\n\tx += 1\nend\n\tp new_string\nend",
"def encrypt(string)\n\tcounter = 0\n\twhile counter < string.length\n\t\tif string[counter] == \"z\"\n\t\t\tstring[counter] = \"a\"\n\t\telse\n\t\tstring[counter] = string[counter].next\n\t\tend\n\t\tcounter += 1\n\tend\n\tstring\nend",
"def encrypt str\n index = 0\n return_str = \"\"\n until index >= str.length\n if str[index] != \" \" && str[index] != \"z\"\n x = str[index].next\n return_str = return_str + x\n elsif str[index] == \"z\"\n x = \"a\"\n return_str = return_str + x\n else\n x = str[index]\n return_str = return_str + x\n end\n index += 1\n end\n return return_str\nend",
"def decrypt(str)\n\talphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\tword = \"\"\n\tcounter = 0 \n\tuntil counter == str.length\n\t\tletter_number = alphabet.index(str[counter]) #matches each character with appropriate index value in alphabet\n\t\tword += alphabet[letter_number - 1]\n\t\tcounter += 1\n\tend\n\tputs word\nend",
"def decrypt(str)\n index = 0\n while index < str.length\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n str[index] = alphabet[alphabet.index(str[index]) - 1]\n index += 1\n end\n str\nend",
"def encrypt(string)\n index = 0\n while index < string.length\n if string[index] == \"z\"\n string[index] = \"a\"\n elsif string[index] == \" \"\n string[index] = \" \"\n else string[index] = string[index].next\n end\n index += 1\n end\n #p string\nend",
"def cipher(string, offset)\n\t#Splits the inputted string into an array of characters\n\tinput = string.split('') \n\t\n\t#This will store our output string\n\toutput = ''\n\t\n\t#First we define an array of letters to generate our hashes from\n\tletters = ('a'..'z').to_a \n\t\n\t#Generate the hash mapping numbers to letters\n\tnumToLetter = Hash.new()\n\tkey = 0\n\n\tloop do\n\t\tvalue = letters[key]\n\t\tnumToLetter[key] = value\n\t\tkey += 1\n\t\tbreak if key == 26\n\tend\n\t\n\t#BEGIN LOOP OF STRING\n\tposInString = 0 #i is a position tracker in the string\n\tloop do\n\t\tmakeUppercase = false #flag tracking case of letter\n\n\t\t#1) Determine if we are dealing with letter or punctuation\n\t\tif numToLetter.has_value?(input[posInString].downcase)\n\t\t\t#2) Determine case before we scramble the number.\n\t\t\tif !(numToLetter.has_value?(input[posInString]))\n\t\t\t\tmakeUppercase = true\n\t\t\tend\n\n\t\t\t#3) Determine the offsetted letter\n\t\t\thashKey = numToLetter.key(input[posInString].downcase)\n\t\t\tif (hashKey + offset) > 25\n\t\t\t\toffsetKey = (offset + hashKey) - 26\n\t\t\telsif (hashKey + offset) < 0\n\t\t\t\toffsetKey = 26 - (hashKey + offset)\n\t\t\telse\n\t\t\t\toffsetKey = hashKey + offset\n\t\t\tend\n\t\t\t\n\t\t\t#4)Set the value in the output!\n\t\t\tif makeUppercase\n\t\t\t\toutput[posInString] = numToLetter[offsetKey].upcase\n\t\t\telse\n\t\t\t\toutput[posInString] = numToLetter[offsetKey]\n\t\t\tend\n\n\t\telse #5) It wasn't a letter (aka inside our hash), just map the punctuation\n\t\t\toutput[posInString] = input[posInString]\n\t\tend\n\n\t\tposInString += 1\n\t\tbreak if posInString > (input.size - 1)\n\tend #END LOOP OF STRING\n\n\tputs \"You ciphered \\'\"+string+\"\\' into \\'\"+output+\"\\'\" \nend",
"def decrypt(str)\r\n alpha = \"abcdefghijklmnopqrstuvwxyz\"\r\n\ti = 0\r\n\toutput = \"\"\r\n\twhile i < str.length\r\n\t\tcount = alpha.index(str[i])\r\n\t char_output = count - 1\r\n\t output = output + alpha[char_output]\r\n i += 1\r\n end\r\noutput \r\nend",
"def encrypt(string_to_increment)\r\n\tencrypted_string = \"\"\r\n\tarray_to_increment = string_to_increment.split(\"\")\r\n\tfor x in array_to_increment\r\n\t\tif x==\"z\"\r\n\t\t\tencrypted_string += \"a\"\r\n\t\telse\r\n\t\t\tencrypted_string += x.next\r\n\t\tend\r\n\tend\r\n\treturn encrypted_string\r\nend",
"def encrypt(string)\n index = 0\n\n while index < string.length\n if string[index] != \" \"\n if string[index] == \"z\"\n string[index] = \"a\"\n else\n string[index] = string[index].next\n end\n end\n index += 1\n end \n return string\nend",
"def decrypt(str)\n str_count = 0\n str_actual = \"\"\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n until str_count ==str.length\n str_actual += alphabet[alphabet.index(str[str_count])-1]\n str_count += 1\n end\n decrypt = str_actual\nend",
"def encrypt (str)\r\n index = 0\r\n while index < str.length\r\n if str[index] == \" \"\r\n index += 1\r\n elsif str[index] == \"z\"\r\n str[index] = \"a\"\r\n index +=1\r\n else \r\n str[index] = str[index].next\r\n index += 1\r\n end\r\n end\r\n str\r\nend",
"def caesar_cipher(caesar_string, shift_factor) \n alphabet = (\"a\"..\"z\").to_a\n new_string = \"\"\n\n caesar_string.each_char do |input|\n if input == \" \"\n new_string += \" \"\n else \n old_index = alphabet.find_index(input)\n new_index = (old_index + shift_factor) % alphabet.count\n new_string += alphabet[new_index]\n end\n end\n\nputs new_string.chomp\n\nend",
"def encrypt(password_str)\n\t# puts \"Enter text for encryption\"\n\t# password_str = gets.chomp\n\tindex = 0\n\twhile index < password_str.length \n\t\tpassword_str[index] = password_str[index].next\n\t\tindex +=1\n\tend\n\tpassword_str\nend",
"def vigenere_cipher(string, key_sequence, alphabet)\r\n\r\nend",
"def vigenere_cipher(str, arr)\n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n str.each_char.with_index do |char, i|\n pos = alpha.index(char)\n key = arr[i % arr.length]\n new_pos = (pos + key) % alpha.length\n new_str += alpha[new_pos]\n end\n new_str\nend",
"def vigenere_cipher(str,keys)\n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n\n str.each_char.with_index do |char,idx|\n old_pos = alpha.index(char)\n new_pos = old_pos + keys[idx % keys.length]\n new_str += alpha[new_pos % alpha.length]\n end\n\n new_str\n\nend",
"def decryptor(user_decpt)\n counter = 0\n output = \"\"\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\n while counter < user_decpt.length\n\n if user_decpt[counter] == \" \"\n output += \" \"\n else\n# While\n temp = user_decpt[counter]\n # puts alphabet.index(temp)\n# Check alphabet index counter\n ind = alphabet.index(temp)\n output += alphabet[ind-1]\n # alphabet.index(temp)\n\n\n end\n\n counter += 1\n end\nreturn output\n\nend",
"def encrypt(input)\nindex = 0\nwhile index < input.length\n if input[index] == \"z\"\n input[index] = \"a\"\n index += 1\n elsif input[index] == \" \"\n index += 1\n else\n input[index] = input[index].next\n index += 1\nend\nend\ninput\nend",
"def decrypt(string)\n alphabet = (\"a\"..\"z\").to_a\n result = \"\"\n idx = string.length\n idx.times do |i|\n letter = string[i]\n\n if letter == \" \"\n result += \" \"\n else\n n = alphabet.index(letter)\n n_minus = (n - 1) % alphabet.length\n result += alphabet[n_minus]\n end\n end\n return result\nend",
"def caesar_cipher text, shift = 5 #shifts letters by 5 - by default\nletters = text.split(//)\nncrypted_string = \"\"\nletters.each do |x|\nif (x =~ /\\w/) && (x =~ /\\D/) && (x != \"_\") ##Checks with RegEx's whether the current array index' value is a word character + a non-digit character + not an underscore '_', so only a-z & A-Z letters pass the test and are affected by the following code.\nif x == x.upcase ##<-I do this so I can wrap back to A when Z's #ord index is exceeded. \"A\".ord == 65, \"Z\".ord == 90\nx = x.ord + shift\nif x > 90\nx -= 90\nx += 64\nend\nelsif x == x.downcase ##Same is done here for downcases as is done above for upcases. \"a\".ord == 97, \"z\".ord == 122\nx = x.ord + shift\nif x > 122\nx -= 122\nx += 96\nend\nend\nx.chr\nend\nncrypted_string << x\nend\nputs ncrypted_string\nend",
"def decrypt(codes)\n\ti = 0\n\t#declare empty string we will add to\n\toutput = \"\"\n\tstr = \"abcdefghijklmnopqrstuvwxyz\"\n\t#loop over the string's letters\n\twhile i < codes.to_s.length\n\t\tletter = str[str.index(codes[i])-1]\n\t\toutput = output + letter\n\t\ti += 1\t\n\tend\n\tputs output\nend",
"def encrypt(string)\n\tcounter = 0\n\twhile counter < string.length\n\t\tif string[counter] == \"z\"\n\t\t\tstring[counter] = \"a\"\n\t\telsif string[counter] == \" \"\n\t\telse \n\t\t\tstring[counter] = string[counter].next\n\t\tend\n\t\tcounter += 1\n\tend\n\treturn string\nend",
"def encrypt(string)\ncounter = 0 \n while counter < string.length \n string_enc = string[counter].next\n \tif string_enc == \"aa\" \n \t\tstring_enc = \"a\"\n \tend\n print string_enc\n counter += 1 \n end \nend",
"def decrypt(str)\r\n\tindex = 0\r\n\talphabet = \"abcdefghijklmnopqrstuvwxyz\"\r\n\tword = \"\"\r\n\twhile index < str.length\r\n\t\tdecrypt_letter = alphabet.index(str[index])\r\n\t\tword += alphabet[decrypt_letter - 1]\r\n\t\tindex += 1\r\n\tend\r\n\tputs word\r\nend",
"def decrypt(my_string)\n i = 0\n new_string = \"\"\n # chose to create a new string to return rather than modify the input\n # string by side effect\n \n until i == my_string.length\n if $alphabet.index(my_string[i]) == nil\n new_string += my_string[i]\n else\n new_string += $alphabet[$alphabet.index(my_string[i])-1]\n #wraps automatically from 0 to -1; don't need 3rd condition\n end\n i = i + 1\n end\n \n return new_string\nend",
"def caesar_guesser(encrypted_string, alphabet)\r\n\r\nend",
"def encrypt(code)\n\ti = 0\n\t#declare empty string we will add to\n\toutput = \"\"\n\t#loop over the string's letters\n\twhile i < code.length\n\t\t letter = code[i].next\n\t\t if letter == \"aa\" \n\t\t \tletter = \"a\"\n\t\t end\n\t\t output = output + letter\n\t\ti += 1\t\n\tend\n\tputs output\nend",
"def decrypt(str)\r\n i = 0\r\n alpha = \"abcdefghijklmnopqrstuvwxyz\"\r\n while i < str.length\r\n str[i] = alpha[alpha.index(str[i])-1]\r\n #str[i] retrieves letter, alpha.index retrieves index number of letter in alphabet\r\n # -1 moves index back one, and alpha calls previous letter in alphabet\r\n i += 1\r\n end\r\n return str\r\nend",
"def textDecryptor(encodedText, cryptoKey)\n decryptedText = \"\"\n\n #algorithm that uses key to un-shift letters in encoded word to return to human readable form (original word)\n encodedText.each_char do |value|\n \n formerPosition = $alphabet.find_index(value)\n newPosition = (formerPosition - cryptoKey) % $alphabet.count\n decryptedText += $alphabet[newPosition]\n \n end\n puts \"The cipher text decrypted is: #{decryptedText}\"\n\nend",
"def encrypt(str)\n len=str.length\n i = 0\n #declare empty string\n answer=\"\"\n #loop to go over each character in the string\n while i < len\n if str[i]==\"z\"\n answer=answer+\"a\"\n else\n answer= answer+str[i].next\n end\n i+=1\n end\n return answer\nend",
"def decrypt(encoded_phrase)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n loop_counter = 0\n decrypted_result = \"\" \n while loop_counter < encoded_phrase.length\n current_index = alphabet.index(encoded_phrase[loop_counter])\n current_letter = encoded_phrase[loop_counter]\n if current_letter == 'a'\n decrypted_result += 'z'\n elsif current_letter == \" \"\n decrypted_result += \" \"\n else\n previous_letter = alphabet[current_index - 1]\n decrypted_result += previous_letter\n end\n loop_counter += 1\n end\n decrypted_result\nend",
"def vigenere_cipher(string, key_sequence)\n alphabet = (\"a\"..\"z\").to_a\n alphabet.concat(alphabet) # double it to deal with wrapping\n \n chars = string.split('')\n count = 0\n \n for i in 0...chars.length\n # lookup the index of chars[i] in alphabet, then add to it using key sequence\n # and modulo to keep track of which step in the sequence you're at\n chars[i] = alphabet[alphabet.index(chars[i]) + key_sequence[count % key_sequence.length]]\n count += 1\n end\n chars.join('')\nend",
"def encrypt(string)\n index=0\n while index < string.length\n letter=string[index].next\n if letter==\"aa\"\n p \"a\"\n else\n p letter\n end\n index +=1\n end\n end",
"def vigenere_cipher(string, key_sequence, alphabet)\n #\n # your code goes here\n #\nend",
"def cypher(phrase = nil, offset = nil)\n if phrase == nil\n puts \"What phrase would you like to code?\"\n phrase = gets.chomp\n end\n if offset == nil \n puts \"How much would you like to offset it?\"\n offset = gets.chomp.to_i\n end\n #Sets up a container for the new phrase and splits the previous one\n new_phrase = []\n phrase = phrase.split(\"\")\n phrase.each do |letter|\n #checks if the current character is a letter. if not, it adds it to new_phrase without acting on it.\n if letter =~ /[A-Za-z]/\n #gets the ascii value of the letter then sets a new ascii value in offset_ascii for the cyphered letter.\n ascii = letter.ord\n offset_ascii = ascii + offset\n #This if statement takes the offset and checks to see if its outside the bounds of the upper or lowercase alphabet\n #it then corrects for the wraparound if necessary\n if letter.is_upper?\n if offset_ascii < 65\n offset_ascii += 26\n elsif offset_ascii > 90\n offset_ascii -= 26\n end\n elsif letter.is_lower?\n if offset_ascii < 97\n offset_ascii += 26\n elsif offset_ascii > 122\n offset_ascii -= 26\n end\n end\n #takes the ascii value and turns that into a letter, then pushes it to the new_phrase array\n new_letter = offset_ascii.chr\n new_phrase.push(new_letter) \n else\n new_phrase.push(letter)\n end\n end\n #joins new_phrase into a string and both prints it to the terminal and returns it so it can retain functionality if used in another program\n puts new_phrase.join(\"\")\n return new_phrase.join(\"\")\nend",
"def encrypt(str)\r\n\tcounter = 0\r\n\twhile counter < str.length\r\n\t\tif str[counter] != \" \"\r\n\t\t\tif str[counter] == \"z\" #added this for edge case based on release 3 test\r\n\t\t\t\tstr[counter] = \"a\"\r\n\t\t\telse\r\n\t\t\t\tstr[counter] = str[counter].next\r\n\t\t\tend\r\n\t\tend\r\n\t\tcounter += 1\r\n\tend\r\n\tstr\r\nend",
"def caesar_guesser(encrypted_string, alphabet)\nend",
"def decrypt(secret_password)\n index = 0\nwhile index < secret_password.length\nalphabet = \"abcdefghijklmnopqrstuvwxyz\"\n letter = secret_password[index]\nletter_before = (alphabet.index(letter)-1)\nsecret_password[index] = alphabet[letter_before]\nindex += 1\nend\nputs secret_password\nend",
"def encrypt(pass)\n counter = 0\n password = \"\"\n\n until counter == pass.length\n alphabet = \"abcdefghijklmnopqrstuvwxyza\"\n letter = alphabet.index(pass[counter]) + 1\n counter += 1\n password = alphabet[letter] + password\n\n end\n password.reverse\n end",
"def encrypt_letter alphabet, cipherbet, letter\n# default for things not found in alphabet is to just return as\n encrypted_letter = letter\n # look for letter using method from above, -1 means not found\n pos = get_position_in_list alphabet, letter\n if pos == -1\n return encrypted_letter\n else\n encrypted_letter = cipherbet[pos]\n if is_lowercase(letter) == true\n encrypted_letter = encrypted_letter.downcase\n end\n return encrypted_letter\n end\nend",
"def caesar_cipher(string, shift)\n\n while shift > 26 #prevents users from accessing a value beyond the letters of ASCII table\n puts 'Sorry choose a number equal to or lower than 26'\n shift.gets.chomp.to_i\n end \n \nstring.chars.map {|char| #.chars seperates each symbol of the string (including spaces) into an array; .map 'maps' each element in the block with |char| representing the variable being targeted\n if char =~ (/\\w/) && char == char.upcase #the =~ is a 'match operator' used to match current char with \\w (any alphanumeric character) AND checks to see if char is uppercase\n char = char.ord + shift # .ord gives the ASCII value of the char + given shift num \n if char > 90 #if char is greater than 90, substract the total letters of alphabet to link char with appropriately shifted posotion \n char = (char - 26).chr #use chr to return it back to letter form \n else\n char.chr #if not greater than 90 (all char greater than 90 fall into lowercase category), simply return the .chr \n end\n elsif char =~ (/\\w/) && char == char.downcase #elsif char matches alphanumeric character AND downcase....\n char = char.ord + shift #.ord value +shift \n if char > 122 #if greater than lowercase z in ASCII table...\n char = (char - 26).chr \n else\n char.chr\n end\n else #if its not a letter just char it up some \n char\n \n end}.join #rejoin the .chars array as shifted string \n \nend",
"def encode\n\n # create a variable to hold the encoded string\n output = \"\"\n # creating an array of the alphabet to find the indexs of the letters.\n alphabet = ( \"a\"..\"z\" ).to_a\n\n # changing the input string to downcase then splitting it into individual characters in an array then looping through the array to gain access to each letter.\n @input_string.downcase.split('').each do | letter |\n\n # finding the index of the letter within the alphabet array\n index = alphabet.index( letter )\n\n # using that index to find the corresponding letter in the reversed array.\n output << alphabet.reverse[ index ]\n\n end\n # return the output.\n p output\n end",
"def caesar_cipher(offset, string)\n\talph = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\ti = 0\n\tnew_string = \"\"\n\tind = 0\n\n\tputs string.length \n\n\twhile i < string.length\n\t\t\n\t\t\n\t\t\n\t\tif string[i] == \" \"\n\t\t\tnew_string = new_string + \" \"\n\t\t\t\n\t\telse \n\t\t\tind = alph.index(string[i])\n\t\t\t\n\t\t\tif (ind + offset) > 25\n\t\t\t\tind = (ind + offset) - 26 \n\t\t\t\t\n\t\t\t\tnew_string = new_string + alph[(ind)]\n\t\t\t\t\n\t\t\telse \n\t\t\t\tnew_string = new_string + alph[(ind + offset)]\n\t\t\t\t\n\t\t\tend\n\t\tend\n\t\ti +=1\n\tend\n\n\treturn new_string\n\nend"
] | [
"0.74536467",
"0.7354128",
"0.73444414",
"0.73321474",
"0.7313686",
"0.72016436",
"0.7200966",
"0.7185047",
"0.7172702",
"0.7162797",
"0.7138321",
"0.7051633",
"0.7038546",
"0.7037635",
"0.7032029",
"0.6973299",
"0.69443303",
"0.6922115",
"0.69184697",
"0.6909574",
"0.6895062",
"0.6878199",
"0.68592346",
"0.6855516",
"0.6846596",
"0.6839763",
"0.6838338",
"0.68371665",
"0.68346155",
"0.6834572",
"0.6823127",
"0.6819883",
"0.681465",
"0.67966306",
"0.67935497",
"0.67804796",
"0.6779207",
"0.6771131",
"0.6761636",
"0.6759823",
"0.6759491",
"0.67525285",
"0.675244",
"0.6749998",
"0.67495257",
"0.6748811",
"0.67441297",
"0.67429936",
"0.6736875",
"0.6727472",
"0.6721886",
"0.6719316",
"0.67148674",
"0.67099714",
"0.6698698",
"0.66934097",
"0.6692019",
"0.668513",
"0.66751355",
"0.66606796",
"0.6652148",
"0.66507983",
"0.66366065",
"0.66349196",
"0.6620493",
"0.6616002",
"0.66023254",
"0.65983486",
"0.6597673",
"0.6596553",
"0.6596017",
"0.6589082",
"0.65840423",
"0.6583747",
"0.6582429",
"0.65824056",
"0.6572987",
"0.65628767",
"0.6557148",
"0.65538657",
"0.6553523",
"0.65379006",
"0.6531492",
"0.6525116",
"0.6521904",
"0.65193754",
"0.65026367",
"0.65008485",
"0.6497528",
"0.6497445",
"0.64914775",
"0.6488669",
"0.6487985",
"0.64845765",
"0.6481983",
"0.64816344",
"0.6479247",
"0.64790833",
"0.64750826",
"0.64601564",
"0.6456563"
] | 0.0 | -1 |
Create a new task. If supplied, +interval+ and +proc+ correspond to their respective methods. | def initialize(interval=nil, proc=nil)
self.interval = interval
self.proc = proc
self.thread = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_task(interval, &block)\n tasks << Task.new(interval, block)\n end",
"def create_task name, url, cron, enabled = nil, timeout = nil, mail_when_success = false, mail_when_failure = false, timezone = nil\n connection.create_task(id, name, url, cron, enabled, timeout, mail_when_success, mail_when_failure, timezone)\n end",
"def initialize(cron_def, &block)\n @cron_def = cron_def\n @block = block\n @next_run = cron_parser && cron_parser.next(Time.now)\n PeriodicTask.tasks << self\n end",
"def initialize(interval, pool)\n @interval = interval\n @pool = pool\n end",
"def task_instance(name,*args,&ruby_block)\n HDLRuby::High::Std.task_instance(name,*args,&ruby_block)\n end",
"def new_task(params = {})\n raise ArgumentError if not params[:title] or params[\"title\"]\n\n params.keys.each do |key|\n raise ArgumentError if not Babar::Taskfields.include? key.to_sym\n end\n\n #Create a new Task object and push it onto the array of tasks to be added upon the next sync\n task = Babar::Task.new(@authenticator, params) \n @new_tasks.push(task)\n @tasks[task.id] = task\n end",
"def schedule_recurring_task_creation(task)\n recurring_scheduler = Scheduler.new\n @recurring_schedulers << recurring_scheduler\n\n recurring_scheduler.schedule.every \"#{Helpers.convert_frequency_to_seconds(task.frequency).to_s}s\" do\n new_task = Task.new\n new_task.description = task.description\n new_task.frequency = task.frequency\n new_task.creation_date = Time.now.getlocal\n new_task.target_date = Helpers.calculate_task_target_date(\n new_task.creation_date,\n new_task.frequency\n )\n new_task.recurring_scheduler_id = recurring_scheduler.id\n\n new_task.create_reminder_notification\n new_task.create_failed_notification\n\n add_task(new_task)\n end\n end",
"def create_task(options = {})\n request(:post, \"tasks\", options)\n end",
"def schedule(spec)\n @task.schedule = Cloud::Cycler::Schedule.parse(spec)\n end",
"def task_create(task, data=nil)\n if task_present? task\n task = task_get task\n elsif task.is_a? Deployment::Task\n task = task_add task\n else\n task = Deployment::Task.new task, node, data\n task = task_add task\n end\n task.data = data if data\n task\n end",
"def call(_obj, args, _ctx)\n Task.create!(\n name: args[:name],\n description: args[:description]\n )\n end",
"def task(&block) \n task = TaskRunnable.new\n task.proc = Proc.new(block)\n task\n end",
"def define_task\n desc @desc\n task @name do\n config.mode == 'shell' ? run_shell : run\n end\n end",
"def task(attributes, **keyword_args)\n append(Task.new(attributes, **keyword_args))\n end",
"def createSimpleTask _obj, _args\n \"_obj createSimpleTask _args;\" \n end",
"def task(*args, &block)\n args, cond = Rake::Task.strip_conditions(args)\n task = Rake::Task.define_task(*args, &block)\n task.add_conditions cond\n task\n end",
"def add_task task\n time, obj = task\n if time.is_a? Numeric\n time = Time.now + time\n elsif time.is_a? DateTime\n time = time.to_time\n end\n @schedule << [time, obj]\n sort_schedule\n write_schedule\n end",
"def initialize\n klass = self.class\n create_hourly_cronjob(klass.hourly_method) if klass.hourly_method\n create_daily_cronjob(klass.daily_method, klass.daily_trigger_time) if klass.daily_method\n create_weekly_cronjob(klass.weekly_method, klass.weekly_trigger_time) if klass.weekly_method\n end",
"def _task_( library, name, ¶ms )\n item = library.get(name)\n item.parent = self\n item.merge_instance_variables(self)\n item.instance_eval(¶ms) if block_given?\n item.generate\n end",
"def create_timer(interval, &block)\n Timer.new(self, interval, &block)\n end",
"def file_create(args, &block)\n Rake::FileCreationTask.define_task(args, &block)\nend",
"def create_task(options = {})\n task = Task.create({\n title: \"a\"*(Task::TITLE_MIN_LENGTH),\n difficult: Task::PERMITTED_FIBONACCI_VALUES.first,\n description: \"a\"*(Task::DESCRIPTION_MIN_LENGTH)\n }.merge(options))\n\n return task\n end",
"def initialize(created_at, interval)\n @created_at = created_at\n @interval = interval\n end",
"def add(task_name, *args, &block)\n raise \"Block required\" unless block_given?\n WorkerMethods.define_singleton_method task_name, block\n end",
"def add(id, *args)\n @tasks[id] = @task_factory.new(*args)\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new\n end",
"def new\n @task = Task.new(position: current_position)\n end",
"def task(name, &block)\n name = name.to_s\n\n unless task = @tasks.find{|t| t.name == name}\n task = Salticid::Task.new(name, :salticid => self)\n @tasks << task\n end\n \n if block_given?\n task.block = block\n end\n\n task \n end",
"def file_create(args, &block)\n Rake::FileCreationTask.define_task(args, &block)\n end",
"def createTask(project, target)\n task \"#{project}.#{target}\" do\n print \"#######################################################\\n\"\n invokeRake project, target\n end\nend",
"def createTask(project, target)\n task \"#{project}.#{target}\" do\n print \"#######################################################\\n\"\n invokeRake project, target\n end\nend",
"def enq name, schedule, options = {}, &block\n raise ArgumentError.new(\"Block not given\") unless block_given?\n\n new_task = nil\n @mutex.synchronize do\n @tasks << new_task = Task.send(:new,\n self, name, schedule,\n options[:exclusive], options[:timeout],\n &block)\n end\n return new_task\n end",
"def task name, options={}, &block\n task = Task.new name, options, &block\n TodoRunner.registry[name] = task\n end",
"def new\n @postit_task = PostitTask.new()\n end",
"def start_task(task)\n @tasks.synchronize {\n @tasks << Task.new(task)\n @timestamp.renew!\n }\n task\n end",
"def create_instance(name, tasks, priority = 1, comment = nil)\n instance = Instance.new\n instance.name = name\n instance.priority = priority\n instance.comment = comment if comment\n if tasks.instance_of? Array\n instance.tasks = tasks\n else\n instance.tasks = [tasks]\n end\n\n res = ODPS.conn.post do |req|\n req.url \"projects/#{ODPS.current_project}/instances\"\n req.headers['Content-Type'] = 'application/xml'\n req.body = instance.serialize [String, ['Job'], 'Name', name],\n [String, ['Job'], 'Comment', comment],\n [String, ['Job'], 'Priority', priority],\n [Array, ['Job'], 'Tasks', instance.tasks.map { |t| REXML::Document.new t.to_xml }]\n end\n\n if res.status == 201\n instance.location = res['Location']\n instance\n end\n end",
"def createTask(description) \n task = Task.new\n task.Description = description\n @Tasks.push task\n end",
"def schedule_task(proc, delay = 20)\n scheduler.schedule_async_delayed_task(plugin, proc, delay)\n end",
"def new(execution_context)\n Coordination::Task.new(execution_context, self)\n end",
"def initialize(task)\n @task = task\n end",
"def build_and_run_task(task_class, params = nil)\n task_run = TaskRun.new(task_class, params)\n @task_run_stack.last.runs << task_run\n\n @task_run_stack.push(task_run)\n task = super(task_class, params)\n @task_run_stack.pop\n task\n end",
"def prepare_interval(period, &block); end",
"def new\n\t\t@task= Task.new\n\tend",
"def work(interval = 5.0)\n end",
"def create_periodic_timer(interval, &block)\n Timer.new(self, interval, :periodic => true, &block)\n end",
"def initialize( options = {} )\n\t\t\t@interval = options[:interval] || 5\n\t\t\t@last_run = Time.at(0)\n\t\tend",
"def create\n @task = Task.create!(task_params)\n end",
"def initialize\n self.tasks = Array.new\n self.run_queue = Queue.new\n self.schedule\n end",
"def task(*args, &block)\n Util.task(*args, &block)\n end",
"def define_task(task_class, *args, &block)\n @ProjectFileLoader.CurrentlyLoadedProjectFile().define_task(task_class, *args, &block)\n end",
"def create\n # We'll see that in a moment.\n @task = task.new\n #@task = Task.create\n end",
"def delegate_new_task(block)\n block.call\n end",
"def initialize(t)\n @task = t\n @timestamp = Timestamp.new\n end",
"def initialize(task)\n super()\n @task= task \n end",
"def create(task)\n validate_type!(task)\n\n attributes = sanitize(task)\n _, _, root = @client.post(\"/tasks\", attributes)\n\n Task.new(root[:data])\n end",
"def task(name, &block)\n task = Wodan::Task.new(name)\n yield(task)\n wodan.tasks << task\n end",
"def add_task(*args)\n task = Util::get_task_from_args(*args)\n add_task_internal(task, true)\n end",
"def task_later(&block) \n task = TaskRunnableLater.new\n task.proc = Proc.new(block)\n task\n end",
"def execute\n new_task = Task.new(new_task_attributes)\n assign_location(new_task)\n new_task\n end",
"def define\r\n\t\t\ttask :foo do\r\n\t\t\t\tputs 'foo!'\r\n\t\t\tend\r\n\t\tend",
"def parse_task(tk)\n collect_tokens\n add_token tk\n\n token_listener self do\n skip_tkspace false\n\n tk = get_tk\n name = tk.text\n\n @task = @container.find_instance_method_named name\n\n unless @task then\n @task = RDoc::RakeTask.new tokens_to_s, name\n @container.add_method @task\n @stats.add_method @task\n end\n\n @task.comment += use_desc\n\n consume_task_arguments\n end\n\n @task.collect_tokens\n @task.add_tokens token_stream\n\n token_listener @task do\n consume_body\n end\n\n @task\n end",
"def to_task\n\t\tt = Rubyfocus::Task.new(nil)\n\t\tinstance_variables.each do |ivar|\n\t\t\tnext if ivar == :\"@document\"\n\t\t\tsetter = ivar.to_s.gsub(/^@/,\"\") + \"=\"\n\t\t\tt.send(setter, self.instance_variable_get(ivar))\tif t.respond_to?(setter)\n\t\tend\n\t\tt\n\tend",
"def create_task\n task = Task.create!(\n description: 'Test Task'\n )\nend",
"def initialize(task, options)\n @task = task\n end",
"def to_task\n task = Task.new(work_block: proc { run!(params_to_hash) })\n task.recreatable = true\n task.recreatable.freeze # Avoid further mutations on this.\n task.recreatable_class = self.class\n task.recreatable_class.freeze\n task.recreatable_params = params_to_hash\n task.recreatable_params.freeze\n task\n end",
"def new\n\t@task = Task.new\nend",
"def task(name, *dependencies, &block)\n if block.nil?\n Task.new(name, *dependencies)\n else\n Task.new(name, *dependencies) do |task|\n task.define(&block)\n end\n end\n end",
"def initialize(interval, callback=nil, &blk)\n fire = proc {\n (callback || blk).call\n trigger(:fired)\n }\n @timer = NSTimer.scheduledTimerWithTimeInterval(interval,target: fire, selector: 'call:', userInfo: nil, repeats: false)\n end",
"def initialize(start, finish, pri, name, assignment)\n parsed_start = start.split('/')\n parsed_end = finish.split('/')\n @date_start = Date.new(\n parsed_start[2].to_i,\n parsed_start[0].to_i,\n parsed_start[1].to_i\n )\n @date_end = Date.new(\n parsed_end[2].to_i,\n parsed_end[0].to_i,\n parsed_end[1].to_i\n )\n pri = pri.to_i\n if pri <= 0\n @priority = 0\n elsif pri >= 10\n @priority = 10\n else\n @priority = pri\n end\n @task_name = name\n @assigned_to = assignment\n end",
"def schedule(program, name, insertions, deletions)\n\t\[email protected] do\n\t\t\tif (program == \"runtime\") \n\t\t\t task = Driver::Task.new\n\t\t\t task.insertions = insertions\n\t\t\t task.deletions = deletions\n\t\t\t task.program = program\n\t\t\t task.name = name\n#\t\t puts \"XXX Tasking: #{name}, #{task.insertions.tups[0]}, #{task.deletions.tups[0]}\"\n \t\t\[email protected](task)\n\t\t\telse\n\t\t\t\ttuple = Tuple.new(clock.current + 1, program, name, insertions, deletions)\n\t\t print \"XXX Scheduling: #{name}, #{task.insertions.tups[0]}, #{task.deletions.tups[0]}\"\n\t\t\t\tschedule.force(tuple)\n\t\t\tend\n\t\t\t# XXXXXXXXXX\n\t\t\[email protected]_var.signal\n\t\tend\n\tend",
"def define\n\t\ttask :foo do\n\t\t\tputs 'foo!'\n\t\tend\n\tend",
"def add_periodic_timer(interval, callback=nil, &blk)\n @timers ||= {}\n timer = PeriodicTimer.new(interval,callback,&blk)\n timer.on(:cancelled) do\n @timers.delete(timer)\n end\n @timers[timer.object_id] = timer\n timer.object_id\n end",
"def cron_tasks\n end",
"def get_instance(payload)\n TaskInstance.new(@version, payload, workspace_sid: @solution[:workspace_sid], )\n end",
"def get_instance(payload)\n TaskInstance.new(@version, payload, workspace_sid: @solution[:workspace_sid])\n end",
"def build_job(start_time, end_time)\n Job.create(\n :start_time => start_time, \n :end_time => end_time, \n :running_time => (end_time-start_time), \n :name => action_name\n )\n end",
"def create_periodic_sync_points(entry_id, interval, duration)\n\t\t\tkparams = {}\n\t\t\t# Kaltura live-stream entry id\n\t\t\tclient.add_param(kparams, 'entryId', entry_id);\n\t\t\t# Events interval in seconds \n\t\t\tclient.add_param(kparams, 'interval', interval);\n\t\t\t# Duration in seconds\n\t\t\tclient.add_param(kparams, 'duration', duration);\n\t\t\tclient.queue_service_action_call('livestream', 'createPeriodicSyncPoints', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend",
"def initialize(name,&ruby_block)\n # Checks and sets the name.\n @name = name.to_sym\n # Sets the block for instantiating a task.\n @ruby_block = ruby_block\n # Sets the instantiation procedure if named.\n return if @name.empty?\n obj = self\n HDLRuby::High.space_reg(@name) do |*args|\n obj.instantiate(*args)\n end\n end",
"def enqueue_in(interval, klass, *args); end",
"def task(name, description=nil, &block)\n puts \"adding task :#{name}\"\n in_root(\"lib/tasks\") do |folder|\n File.open(\"#{folder}/application.rake\", \"a+\") do |f|\n if block_given?\n f.write(code_for(block))\n else\n f.write(data)\n end\n end\n end\n end",
"def find_or_create_task(opts)\n\t\treport_task(opts.merge({:wait => true}))\n\tend",
"def task(name, options = {}, &block)\n name = name.to_s.downcase.to_sym\n task_re = /\\A[a-z0-9.:-_]+\\z/\n raise \"Task already exists: #{name}\" if $bot[:tasks].include?(name)\n raise \"Task name does not match regexp #{task_re.to_s}\" unless name.to_s.match(task_re)\n\n opts = {\n desc: ''\n }.merge(options)\n\n $bot[:tasks][name] ||= {\n block: block,\n desc: opts[:desc]\n }\n end",
"def at(delay, options = {}, &task)\n options = { :delay => delay, :scheduler => self }.merge(options)\n @queue << Task.new(options, &task)\n end",
"def add_task(task, scheduled_time = \"5m\")\n if task.respond_to?(:execute)\n # Add scheduled tasks\n job_id = @scheduler.every(scheduled_time) do\n task.execute()\n end\n # Save the job ide with a reference to the invoking task (using the task as a key)\n if @job_ids_by_task[task].nil? then @job_ids_by_task[task] = [] end\n # Add the job id to this task and reversed\n @job_ids_by_task[task] << job_id\n @tasks_by_job_ids[job_id] = task\n end\n end",
"def periodically_trigger_task(task_name = nil, interval = 1, &block)\n periodically(interval) do\n trigger_task(task_name, &block)\n end\n end",
"def periodically_trigger_task(task_name = nil, interval = 1, &block)\n periodically(interval) do\n trigger_task(task_name, &block)\n end\n end",
"def create(*)\n super.tap do\n submission.set_simulation(__method__) if simulating\n end\n end",
"def create(id, klass, *args)\n plan = [klass.to_s, args]\n with_redis { |redis| redis.set(id, MultiJson.encode(plan)) }\n # Return the job\n job = new(id, klass, *args)\n job.clear\n job\n end"
] | [
"0.7326846",
"0.6050408",
"0.58623046",
"0.5852967",
"0.57322335",
"0.5720159",
"0.5690832",
"0.5681433",
"0.5648331",
"0.5570479",
"0.55599856",
"0.555268",
"0.5550335",
"0.55340755",
"0.5506508",
"0.5444165",
"0.54219663",
"0.54173684",
"0.5415679",
"0.53840053",
"0.53743595",
"0.5371995",
"0.53661126",
"0.5347021",
"0.5343087",
"0.5333375",
"0.5333375",
"0.5333375",
"0.5333375",
"0.5333375",
"0.5333375",
"0.5333375",
"0.5333375",
"0.5333375",
"0.5333375",
"0.5333375",
"0.5333375",
"0.5333375",
"0.53280383",
"0.5318548",
"0.53136605",
"0.53083277",
"0.53083277",
"0.5300384",
"0.52993894",
"0.52955383",
"0.5285627",
"0.5282297",
"0.5278707",
"0.5265658",
"0.52459335",
"0.52382374",
"0.52318054",
"0.5228991",
"0.52284455",
"0.52021533",
"0.51883",
"0.5175325",
"0.51490945",
"0.5147965",
"0.5138507",
"0.51373345",
"0.512497",
"0.5124161",
"0.51087785",
"0.51031685",
"0.50988066",
"0.5082916",
"0.50782424",
"0.5070829",
"0.50607944",
"0.50587857",
"0.50557595",
"0.5052592",
"0.50460345",
"0.50439125",
"0.5041798",
"0.5029338",
"0.50255257",
"0.5019892",
"0.49987254",
"0.49915087",
"0.49879375",
"0.49839845",
"0.49716803",
"0.49681285",
"0.4962966",
"0.49549094",
"0.49546155",
"0.49473968",
"0.49350017",
"0.49343586",
"0.49247274",
"0.49241543",
"0.4919786",
"0.49194053",
"0.49163195",
"0.49163195",
"0.49041787",
"0.49010053"
] | 0.67977387 | 1 |
Run the block or Proc associated with a task. | def run
self.proc.call
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(&block)\n task('run').tap do |t|\n t.enhance &block if block\n end\n end",
"def task_run(&block) \n task(&block).start\n end",
"def task(*args, &block)\n Util.task(*args, &block)\n end",
"def task(&block) \n task = TaskRunnable.new\n task.proc = Proc.new(block)\n task\n end",
"def my_run(options={},&block)\n run_task(Xprobe2::Task.new(options,&block))\n end",
"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\[email protected](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",
"def run\n block.call\n end",
"def run\n if @block.arity >= 1\n @block.call self\n else\n @block.call\n end\n end",
"def run(&block); end",
"def run_task(broker, targets, task, files, input: {}, metadata: nil, **kwargs, &block)\n params = { task: task, input: input, files: files }\n params[:metadata] = metadata if metadata\n do_module_action(broker, agent_identities(targets), 'task', 'run', params, **kwargs, &block)\nend",
"def run!\n logger.info(\"Running task #{self.class.to_s}\")\n @block.call\n @next_run = cron_parser && cron_parser.next(Time.now)\n end",
"def task(name,&ruby_block)\n HDLRuby::High::Std.task(name,&ruby_block)\n end",
"def execute_task(task)\n cur_sauce = Sauce.current\n begin\n self.serve\n self.cap_config.execute_task(task)\n ensure\n cur_sauce.serve if cur_sauce\n end\n end",
"def run(task)\n Rake::Task[task].invoke\nend",
"def run(task)\n Rake::Task[task].invoke\nend",
"def run(task)\n Rake::Task[task].invoke\nend",
"def run(task)\n Rake::Task[task].invoke\nend",
"def runblock\r\n\t\t\[email protected]\r\n\t\tend",
"def runblock\r\n\t\t\[email protected]\r\n\t\tend",
"def run(&blk)\n raise(\"A block is needed to run\") unless block_given?\n @run_logic = blk\n end",
"def run\n case self[:job]\n when Proc\n self[:job].call\n else\n self[:job]\n end\n end",
"def run(&block)\n @running_template = block\n end",
"def run(&block)\n end",
"def run_task(task)\n packaged = task.keys[0]\n package, name = Bee::Util::get_package_name(packaged)\n parameters = @build.context.evaluate_object(task[packaged])\n if not @packages[package]\n @packages[package] = Bee::Task::PackageManager.load_package(package, @build)\n end\n error \"Task '#{name}' not found in package '#{package}'\" if\n not @packages[package].respond_to?(name)\n @packages[package].send(name, parameters)\n end",
"def run_task(task_class, params = nil)\n check_run_once_and_build_and_run_task(task_class, params)\n end",
"def run_task(task_name)\n puts heading(\"Running #{task_name}\")\n @results[task_name] = Rake::Task[task_name].invoke\n end",
"def rake_tasks(&block); end",
"def rake_tasks(&block); end",
"def execute (task)\n\t\tif task['type'] === 'backend'\n\t\t\texec_vm_command(task)\n\t\telse\n\t\t\texec_sencha_command(task)\n\t\tend\n\tend",
"def run_serial\n @task = Fiber.new do\n begin\n self.instance_exec(*content_arguments, &content)\n rescue Exception => e\n origin.send(:raise, e)\n raise\n end\n end\n end",
"def run_block\n p = Proc.new\n p.call\nend",
"def process(_block = nil)\n EXEL::Job.run(@context[:job], @context)\n end",
"def perform_task\n # actually do the work\n end",
"def run\n puts 'running task...'\n resp = if @container_name\n @client.run_task(cluster: @cluster, task_definition: @task_def, overrides: {\n container_overrides: [{\n name: @container_name, command: @command\n }]\n })\n else\n @client.run_task(cluster: @cluster, task_definition: @task_def)\n end\n task_arn = resp[0][0]['task_arn']\n result =\n begin\n puts 'waiting for task to complete...'\n @client.wait_until(:tasks_stopped, cluster: @cluster, tasks: [task_arn])\n rescue Aws::Waiters::Errors::WaiterFailed => error\n puts \"failed waiting for task to run: #{error.message}\"\n end\n puts \"task ended with exit code #{result[0][0]['containers'][0]['exit_code']}\"\n # return exit code\n raise 'task appears to have failed, check container logs' if result[0][0]['containers'][0]['exit_code'] != 0\n end",
"def run(task_class, params = nil)\n check_run_once_and_build_and_run_task(task_class, params)\n end",
"def task(&block)\n mina_app.test_task(&block)\nend",
"def run_task(_task, _args)\n invoke(\"#{name}:upload\")\n end",
"def run_task\n begin\n run \n rescue Exception => e\n @task_run.add_error_text(e.class.name + \": \" + e.message)\n @task_run.add_error_text(e.backtrace.inspect)\n @task_run.success = false\n end \n\n finally\n\n @task_run.end_time = Time.now\n @task_run.save\n end",
"def perform(&block); end",
"def run(task)\n debug \"Run task: #{task}\"\n raise Deployment::NotImplemented, 'This method is abstract and should be implemented in a subclass'\n end",
"def exec\n @fiber_pool.exec { yield }\n end",
"def task options={}, &block\n worker([], options, &block)\n end",
"def execute_task\n self.result_details = nil\n task_type = task['task_type'].to_s\n\n unless supported_tasks.include?(task_type)\n raise \"Unsupported task type: #{task_type}, valid options: #{supported_tasks.inspect}\"\n end\n\n # call the method to execute the task based on task and job type\n task_method = \"#{task_type}_#{job_type}\"\n send(task_method)\n raise \"Task must set the result details (via completed_with): #{task_method}\" unless result_details\n end",
"def shell(&block)\n task('shell').tap do |t|\n t.enhance &block if block\n end\n end",
"def invoke\n @proc.call\n end",
"def run_local_task(task, params, options)\n # Make sure we're in a compiler to use the sensitive type\n with_a_compiler do |_comp|\n params = Bolt::Task::Run.wrap_sensitive(task, params)\n Bolt::Task::Run.run_task(\n task,\n empty_inventory.get_targets('localhost'),\n params,\n options,\n serial_executor\n )\n end\n end",
"def trigger_task(task_name = nil, &block)\n task_lock(task_name || block) do\n block_given? ? yield : send(task_name)\n end\n end",
"def trigger_task(task_name = nil, &block)\n task_lock(task_name || block) do\n block_given? ? yield : send(task_name)\n end\n end",
"def task_run_later(&block) \n task_later(&block).start\n end",
"def run\n @ctx.call(self,&@blk) if @blk\n end",
"def runner(&blk); end",
"def runner(&blk); end",
"def process(&block); end",
"def __execute\n Thread.new do\n tasks = flatten_task_tree\n pipe_reader, pipe_writer = IO.pipe\n @__pid = execute_in_process(tasks, pipe_reader, pipe_writer)\n pipe_writer.close\n\n tasks.each do |task|\n task.__pid = @__pid\n task.__status = TaskStatus::RUNNING\n\n begin\n task.__result = Marshal.load(pipe_reader)\n rescue EOFError\n # do nothing\n end\n\n if task.__result == '__TASK_FINISHED_WITH_EXCEPTION__'\n faulted_result(task, Marshal.load(pipe_reader))\n else\n task.__result = nil if task.__result == '__TASK_FINISHED_NO_RESULT__' || task.canceled?\n task.__status = TaskStatus::COMPLETED unless task.canceled?\n end\n\n yield if block_given?\n\n case task.__status\n when TaskStatus::COMPLETED\n task.oncomplete_block&.call(task)\n when TaskStatus::FAULTED\n task.onfault_block&.call(task)\n end\n end\n\n pipe_reader.close\n end\n end",
"def execute! &block\n task = block.call if block_given?\n return raise_no_workers if Server::workers.empty?\n task.service_id = id; self.tasks << task\n # Get worker and send task\n data = Task.send_with_worker(task)\n Logger.info 'Queued task ' + task.to_s + ' for worker: ' + data[:worker].to_s\n\n data\n end",
"def run\r\n\t\t\[email protected]\r\n\t\tend",
"def run_task(name)\n if @state.nil?\n @state = load_state\n end\n\n if @state[name.to_sym] && @state[name.to_sym][:state] == 'complete'\n logger.debug \"Not executing #{name} because it has already been run\"\n return\n end\n\n logger.debug \"Running #{name} task\"\n\n @current_state = @state[name.to_sym] ||= {}\n @current_state[:state] = 'running'\n @current_state.delete(:error)\n yield if block_given?\n rescue StandardError => e\n if @current_state\n @current_state[:state] = 'error'\n @current_state[:error] = { class: e.class.name, message: e.message }\n end\n raise\n ensure\n if @current_state && @current_state[:state] == 'running'\n @current_state[:state] = 'complete'\n end\n\n @current_state = nil\n save_state\n end",
"def execute\n [lambda, block].each do |aProc|\n next unless aProc\n aProc.call\n end\n end",
"def execute\n [lambda, block].each do |aProc|\n next unless aProc\n aProc.call\n end\n end",
"def run_block\n p = Proc.new # <1>\n p.call\nend",
"def proceed(*args)\n if(style == :serial)\n task.resume(*args)\n else\n task[:task_args] = args\n task.run\n task[:task_args]\n end\n end",
"def run &block\n worker = launch &block\n exit worker.wait\n end",
"def task(name, &block)\n task = Wodan::Task.new(name)\n yield(task)\n wodan.tasks << task\n end",
"def _run(context)\n return unless matches_context?(context)\n\n if @run_block\n puts \"[#{context.host}] Executing \\\"#{self.name}\\\"...\"\n @run_block.call(context)\n end\n end",
"def run\n yield\n end",
"def run(time)\n time = decode_time(time)\n tasks.each{|t| t.do(time) }\n end",
"def run\n if not @test then\n @dirs.each do |dir|\n if @local\n `cd #{dir}; ./local-run.sh #{File.basename(@executable)} #{@ranges['name']} #{@ranges['args']}`\n puts \"task run: #{dir}\"\n else\n `cd #{dir}; ./pbs-run.sh #{File.basename(@executable)} #{@ranges['name']} #{@ranges['args']}`\n puts \"task queued: #{dir}\"\n end\n end\n end\n end",
"def call(vm)\r\n @block.call(self, vm)\r\n end",
"def ruby_rake_task(task)\n Rake::Task[task].invoke\nend",
"def run_block_proc\n yield\nend",
"def _exec block, *args\n instance_exec(*args, &block)\n end",
"def call(*args)\n block.call(*args)\n end",
"def perform_blocks\n execute_with_block do | thread_id, task |\n task.call(thread_id)\n end\n end",
"def invoke_task_local(task, instance, options, args)\n cb = {\n :class_name => task.class.to_s,\n :instance_id => task.id,\n :method_name => :queue_callback,\n :args => [\"Finished\"]\n } if task\n\n q_hash = {\n :class_name => name,\n :instance_id => instance.id,\n :method_name => options[:task],\n :args => args,\n :miq_task_id => task&.id,\n :miq_callback => cb\n }\n user = User.current_user\n q_hash.merge!(:user_id => user.id, :group_id => user.current_group.id, :tenant_id => user.current_tenant.id) if user\n MiqQueue.submit_job(q_hash)\n end",
"def call(*args)\n block.call(*args) if block\n end",
"def task\n end",
"def invoke(task)\n fn = task.fn.to_s\n i = fn.rindex('.')\n if i\n obj = fn[0, i]\n method = fn[i + 1, fn.length - (i + 1)]\n eval(obj).send(method, *task.args)\n else\n TOPLEVEL.send(fn, *task.args)\n end\n end",
"def execute!\n @context.backend.schedule { run }\n end",
"def work(&block)\n Celluloid::Logger.info \"Preparing work...\"\n self.working_code = block if block_given?\n end",
"def task(name, &block)\n name = name.to_s\n\n unless task = @tasks.find{|t| t.name == name}\n task = Salticid::Task.new(name, :salticid => self)\n @tasks << task\n end\n \n if block_given?\n task.block = block\n end\n\n task \n end",
"def invoke(task)\n invoked_tasks << task\n end",
"def run(argv)\n load_tasks\n\n if argv.empty?\n print_help\n else\n build_task(argv).run\n end\n end",
"def perform(**task)\n raise \"No work defined! for this task: #{task[:body]}. Define #perform private method in your class\"\n end",
"def run(block)\n case block\n when Proc\n controller.instance_eval(&block)\n else\n controller.send(block)\n end\n end",
"def execute(&block)\n\tblock.call\nend",
"def execute(&block)\n\tblock.call\nend",
"def execute(&block)\n\tblock.call\nend",
"def execute(&block)\n\tblock.call\nend",
"def find_and_execute_task(task, hooks={})\n cur_sauce = Sauce.current\n begin\n self.serve\n self.cap_config.find_and_execute_task(task, hooks)\n ensure\n cur_sauce.serve if cur_sauce\n end\n end",
"def task_run(task_name, params)\n config_data = { 'modulepath' => File.join(Dir.pwd, 'spec', 'fixtures', 'modules') }\n inventory_hash = inventory_hash_from_inventory_file\n target_node_name = ENV['TARGET_HOST'] if target_node_name.nil?\n\n result = run_task(task_name, target_node_name, params, config: config_data, inventory: inventory_hash)\n\n raise \"task failed\\n`#{task_name}`\\n======\\n#{result}\" if result.first['status'] != 'success'\n\n result\n end",
"def task_instance(name,*args,&ruby_block)\n HDLRuby::High::Std.task_instance(name,*args,&ruby_block)\n end",
"def run_block\n if @block\n _block = @block\n @block = nil\n instance_eval &_block\n true\n end\n end",
"def call\n process\n end",
"def run(node)\n process(node)\n end",
"def task(name, *args, &block)\n task_once(name, block) do\n super\n end\n end",
"def runTask task\n while !task.finished && task.status < 16 do\n task.run\n\n if task.status == 8 && task.wait > 0\n sleep task.wait\n end\n end\n end",
"def run_stored_block\n self.run_in_context @stored_block if @stored_block\n end",
"def do_trigger\n\n @block.call @job_id, @cron_line, @params\n end",
"def run!\n # Have to evalute/execute the block on the instance\n instance_eval &@block\n summary_at_exit\n end",
"def exec(command, &block); end"
] | [
"0.7680454",
"0.76485217",
"0.7135619",
"0.70722413",
"0.7040703",
"0.6762098",
"0.6761985",
"0.65786314",
"0.65717775",
"0.6527718",
"0.6523105",
"0.6516295",
"0.6513155",
"0.6485164",
"0.6485164",
"0.6485164",
"0.6485164",
"0.64822865",
"0.64822865",
"0.64738846",
"0.64466095",
"0.6371673",
"0.63323313",
"0.6259775",
"0.6250235",
"0.62224317",
"0.62190306",
"0.62190306",
"0.6216587",
"0.6213204",
"0.62011063",
"0.61988443",
"0.6182192",
"0.61770386",
"0.61684823",
"0.61371267",
"0.6126687",
"0.60856706",
"0.60776544",
"0.60709155",
"0.6064451",
"0.6044661",
"0.6034471",
"0.60256016",
"0.6009585",
"0.59996474",
"0.5997638",
"0.5997638",
"0.5989762",
"0.5989154",
"0.59883565",
"0.59883565",
"0.5975881",
"0.59715265",
"0.5971012",
"0.59699136",
"0.5967271",
"0.5962017",
"0.5962017",
"0.5961427",
"0.5948402",
"0.59476143",
"0.5946617",
"0.5940784",
"0.5935406",
"0.5918886",
"0.59150606",
"0.5911277",
"0.5903863",
"0.59007436",
"0.5898565",
"0.5888023",
"0.5883864",
"0.58805126",
"0.5862779",
"0.5862626",
"0.58490205",
"0.58444965",
"0.5837916",
"0.58212703",
"0.5818197",
"0.5794664",
"0.5784029",
"0.5766863",
"0.5751241",
"0.5750473",
"0.5750473",
"0.5750473",
"0.5749722",
"0.574883",
"0.5740176",
"0.5739434",
"0.57360876",
"0.57267094",
"0.5724132",
"0.57183504",
"0.57161164",
"0.57130516",
"0.5708394",
"0.57081294"
] | 0.6829398 | 5 |
Schedule the task. This actually starts a thread that waits until the specified time interval has passed, then adds the task to a run queue that the main +Scheduler+ object waits on. | def schedule(scheduler)
case self.interval
when :startup, :shutdown
# ignore it
else
self.thread = Thread.new do
loop do
sleep self.interval
scheduler.run_queue << self
end
end
self.thread.abort_on_exception = true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def periodically_trigger_task(task_name = nil, interval = 1, &block)\n periodically(interval) do\n trigger_task(task_name, &block)\n end\n end",
"def periodically_trigger_task(task_name = nil, interval = 1, &block)\n periodically(interval) do\n trigger_task(task_name, &block)\n end\n end",
"def at(delay, options = {}, &task)\n options = { :delay => delay, :scheduler => self }.merge(options)\n @queue << Task.new(options, &task)\n end",
"def schedule(parent: @parent || Task.current)\n @scheduler_task ||=\n parent.async { |task|\n task.annotate(\"scheduling tasks for #{self.class}.\")\n\n while @waiting.any? && !limit_blocking?\n delay = [next_acquire_time - Async::Clock.now, 0].max\n task.sleep(delay) if delay.positive?\n resume_waiting\n end\n\n @scheduler_task = nil\n }\n end",
"def work(interval = 5.0)\n interval = Float(interval)\n $0 = \"resque-delayed: harvesting\"\n startup\n\n loop do\n break if shutdown?\n\n # harvest delayed jobs while they are available\n while job = Resque::Delayed.next do\n log \"got: #{job.inspect}\"\n queue, klass, *args = job\n Resque::Job.create(queue, klass, *args)\n end\n\n break if interval.zero?\n log! \"Sleeping for #{interval} seconds\"\n sleep interval\n end\n end",
"def schedule(job, interval, queue=:default)\n Metriks.timer(\"handler.job.schedule\").time do\n job.schedule(queue, interval, payload, params)\n end\n end",
"def schedule\n run_callbacks :schedule do\n perform_async\n end\n end",
"def schedule_task(proc, delay = 20)\n scheduler.schedule_async_delayed_task(plugin, proc, delay)\n end",
"def run\n while true\n if task = next_task\n task.handle\n else\n sleep @wait_period\n end\n end\n end",
"def schedule!(options = {})\n return unless ::Delayed::Worker.delay_jobs\n unschedule(options)\n new(options).schedule!(options)\n end",
"def queue(delay = 0, &block)\n queue_time = Process.clock_gettime(Process::CLOCK_MONOTONIC) + delay\n job = [queue_time, block]\n\n @mutex.synchronize do\n i = @jobs.length\n while i > 0\n i -= 1\n current, _ = @jobs[i]\n if current < queue_time\n i += 1\n break\n end\n end\n @jobs.insert(i, job)\n @next = queue_time if i == 0\n end\n\n unless @thread.alive?\n @mutex.synchronize do\n @thread = Thread.new { do_work } unless @thread.alive?\n end\n end\n\n if @thread.status == \"sleep\"\n @thread.wakeup\n end\n\n Cancelable.new(job)\n end",
"def start_timer_thread\n @timer_thread = Thread.new do\n begin\n while !@stopped\n @worker_configs.each do |worker_config|\n worker_config.periodic_call(@poll_time)\n end\n sleep @poll_time\n end\n rescue Exception => e\n Qwirk.logger.error \"Timer thread failed with exception: #{e.message}\\n\\t#{e.backtrace.join(\"\\n\\t\")}\"\n end\n end\n end",
"def start(period=nil)\n # Run any startup tasks.\n self.startup_tasks.each { |t| t.run }\n \n # If caller only wants to run for a while, start a thread that will\n # sleep that long, then kill off all the threads. +nil+ is posted to\n # the queue as a signal that the scheduler should stop running.\n if period\n Thread.new do\n Thread.abort_on_exception = true\n sleep period\n self.scheduled_tasks.each {\n |t| t.thread.exit if t.thread && t.thread.alive? }\n self.run_queue << nil\n end\n end\n \n # Schedule all the tasks.\n self.scheduled_tasks.each { |t| t.schedule(self) }\n \n # Run any tasks whose threads have placed the task onto the run \n # queue, until +nil+ is received.\n while (task = self.run_queue.pop) do\n task.run\n end\n \n # Run any shutdown tasks.\n self.shutdown_tasks.each { |t| t.run }\n end",
"def work(interval = 5.0, &block)\n interval = Float(interval)\n $0 = \"resque: Starting\"\n startup\n\n loop do\n break if shutdown?\n\n if not paused? and job = reserve\n log \"got: #{job.inspect}\"\n job.worker = self\n run_hook :before_fork, job\n working_on job\n\n perform(job, &block)\n\n done_working\n @child = nil\n else\n break if interval.zero?\n log! \"Sleeping for #{interval} seconds\"\n procline paused? ? \"Paused\" : \"Waiting for #{@queues.join(',')}\"\n sleep interval\n end\n end\n\n ensure\n unregister_worker\n end",
"def schedule_timer(timeout)\n @scheduler.schedule_timer(timeout)\n end",
"def initialize interval, timeout\n @interval = interval\n @cancelled = false\n\n @timeout = EM.add_periodic_timer timeout, method(:timeout_fired)\n\n schedule\n end",
"def add_task(interval, &block)\n tasks << Task.new(interval, block)\n end",
"def start_scheduler\n @rufus = Rufus::Scheduler.new\n schedule_shutdown_job if !self.timeout.blank?\n schedule_job_specs(JobSpec.where(enabled: true))\n end",
"def queue_future_jobs\n tasks.each do |task|\n # Schedule the new run times using the future job wrapper.\n new_run_times = task.future_run_times - task.existing_run_times\n new_run_times.each do |time|\n SimpleScheduler::FutureJob.set(queue: @queue_name, wait_until: time)\n .perform_later(task.params, time.to_i)\n end\n end\n end",
"def work(interval = 5)\n register_signal_handlers\n \n Monque.logger.info \"*** Worker #{self} is going to work.\\n\"\n \n loop do\n break if @shutdown\n queues.each do |queue|\n while job = Monque.reserve(queue)\n Monque.logger.info \"\\n*** Performing job #{job.inspect}.\\n\"\n job.perform\n Monque.logger.info \"\\n*** Performed job #{job.inspect} successfully.\\n\"\n exit if @shutdown\n end\n end\n break if interval.to_i == 0\n sleep interval.to_i\n end\n end",
"def schedule(time, callback); end",
"def schedule(*args, &blk)\n @queue ||= ::Dispatch::Queue.concurrent(\"#{NSBundle.mainBundle.bundleIdentifier}.reactor\")\n\n cb = proc do\n blk.call(*args)\n end\n @queue.async &cb\n nil\n end",
"def schedule(job)\n \n # If we can't get a lock on the @workforce then the Coordinator is most likely shutting down.\n # We want to skip creating new workers in this case.\n if @job_queue.num_waiting == 0 && @workforce.size < QueueToTheFuture.maximum_workers && @workforce.mu_try_lock\n @workforce.push Thread.new() { while job = @job_queue.shift; job.__execute__; end }\n @workforce.mu_unlock\n end\n \n @job_queue.push(job)\n \n nil\n end",
"def schedule_recurring_task_creation(task)\n recurring_scheduler = Scheduler.new\n @recurring_schedulers << recurring_scheduler\n\n recurring_scheduler.schedule.every \"#{Helpers.convert_frequency_to_seconds(task.frequency).to_s}s\" do\n new_task = Task.new\n new_task.description = task.description\n new_task.frequency = task.frequency\n new_task.creation_date = Time.now.getlocal\n new_task.target_date = Helpers.calculate_task_target_date(\n new_task.creation_date,\n new_task.frequency\n )\n new_task.recurring_scheduler_id = recurring_scheduler.id\n\n new_task.create_reminder_notification\n new_task.create_failed_notification\n\n add_task(new_task)\n end\n end",
"def schedule_every(n, &block)\r\n\r\n while true do\r\n before = Time.now\r\n\r\n block.call\r\n \r\n elapsed = Time.now - before\r\n interval = n - elapsed\r\n \r\n @logger.debug \"orders processing/delivery take #{elapsed} seconds.\"\r\n \r\n sleep(interval) if interval > 0\r\n end\r\n\r\nend",
"def work(interval = 5, &block)\n $0 = \"resque: Starting\"\n startup\n\n loop do\n break if @shutdown || Thread.current[:shutdown]\n\n if not @paused and job = reserve\n log \"got: #{job.inspect}\"\n run_hook :before_fork\n working_on job\n\n if @child = fork\n rand # Reseeding\n procline \"Forked #{@child} at #{Time.now.to_i}\"\n Process.wait\n else\n procline \"Processing #{job.queue} since #{Time.now.to_i}\"\n perform(job, &block)\n exit! unless @cant_fork\n end\n\n done_working\n @child = nil\n else\n break if interval.to_i == 0\n log! \"Sleeping for #{interval.to_i}\"\n procline @paused ? \"Paused\" : \"Waiting for #{@queues.join(',')}\"\n sleep interval.to_i\n end\n end\n unregister_worker rescue nil\n loop do\n #hang onto the process until all threads are done\n break if all_workers_in_pid_working.blank?\n sleep interval.to_i\n end\n ensure\n unregister_worker\n end",
"def schedule(time_at: nil)\n # Generate task payload\n task = task_payload.merge(schedule_time: time_at).compact\n\n # Create and return remote task\n CloudTask.create(task)\n end",
"def start\n Thread.new(interval, pool) do |i, p|\n while (true)\n sleep(i)\n p.reap\n end\n end\n end",
"def add_to_scheduler\n name = \"for_survey_#{@schedulable.company_survey.id}\"\n config = {}\n config[:every] = [\"#{@schedulable.repeat_every}#{@schedulable.repeat_mode}\",\n { first_at: calculate_next_delivery }]\n config[:class] = 'SendEmailsJob'\n config[:queue] = 'send_emails'\n config[:persist] = true\n config[:args] = @schedulable.company_survey.id\n Resque.set_schedule(name, config)\n end",
"def trigger\n @timed_out = false\n @expires = Time.now + @period\n unless @thread\n @thread = Thread.new do\n begin\n begin\n sleepytime = @expires - Time.now\n while sleepytime > 0.0\n sleep(sleepytime)\n sleepytime = @expires - Time.now\n end\n @timed_out = true\n @expires += @period if @repeats\n @block.call if @block\n end while @repeats\n rescue StopTimerException\n @expires=nil\n ensure\n @thread = nil\n end\n end\n end\n end",
"def trigger\n\n Thread.new do\n\n @trigger_thread = Thread.current\n # keeping track of the thread\n\n begin\n\n do_trigger\n\n rescue Exception => e\n\n @scheduler.send(:log_exception, e)\n end\n\n #@trigger_thread = nil if @trigger_thread = Thread.current\n @trigger_thread = nil\n # overlapping executions, what to do ?\n end\n\n if trigger_thread_alive? and (to = @params[:timeout])\n @scheduler.in(to, :tags => 'timeout') do\n @trigger_thread.raise(Rufus::TimeOutError) if trigger_thread_alive?\n end\n end\n end",
"def schedule\n if reactor_thread?\n yield\n else\n @run_queue << Proc.new\n @process_queue.call\n end\n self\n end",
"def distribute_periodically(interval)\n Thread.new{\n loop do\n perform_distribution\n # Sleep for \"interval\" seconds.\n # If awaken isn't signaled, timeout and attempt distribution\n @mutex.synchronize do\n @awaken.wait(@mutex, interval)\n end\n end\n }\n end",
"def run_once(timeout = nil)\n\t\t\tKernel::raise \"Running scheduler on non-blocking fiber!\" unless Fiber.blocking?\n\t\t\t\n\t\t\t# If we are finished, we stop the task tree and exit:\n\t\t\tif self.finished?\n\t\t\t\treturn false\n\t\t\tend\n\t\t\t\n\t\t\tinterval = @timers.wait_interval\n\t\t\t\n\t\t\t# If there is no interval to wait (thus no timers), and no tasks, we could be done:\n\t\t\tif interval.nil?\n\t\t\t\t# Allow the user to specify a maximum interval if we would otherwise be sleeping indefinitely:\n\t\t\t\tinterval = timeout\n\t\t\telsif interval < 0\n\t\t\t\t# We have timers ready to fire, don't sleep in the selctor:\n\t\t\t\tinterval = 0\n\t\t\telsif timeout and interval > timeout\n\t\t\t\tinterval = timeout\n\t\t\tend\n\t\t\t\n\t\t\tbegin\n\t\t\t\[email protected](interval)\n\t\t\trescue Errno::EINTR\n\t\t\t\t# Ignore.\n\t\t\tend\n\t\t\t\n\t\t\[email protected]\n\t\t\t\n\t\t\t# The reactor still has work to do:\n\t\t\treturn true\n\t\tend",
"def schedule(spec)\n @task.schedule = Cloud::Cycler::Schedule.parse(spec)\n end",
"def start\n TaskScheduler.add_task(self)\n end",
"def create_periodic_timer(interval, &block)\n Timer.new(self, interval, :periodic => true, &block)\n end",
"def schedule(&block)\n fiber = pool_fiber\n EM.next_tick { fiber.resume(block) }\n end",
"def schedule(&blk)\n @reactor.next_tick(blk)\n end",
"def schedule(*args, &block)\n @jobs << [block, args]\n end",
"def schedule_every (freq, params={}, &block)\n\n params = prepare_params(params)\n params[:every] = freq\n\n first_at = params[:first_at]\n first_in = params[:first_in]\n\n #params[:delayed] = true if first_at or first_in\n\n first_at = if first_at\n at_to_f(first_at)\n elsif first_in\n Time.now.to_f + Rufus.duration_to_f(first_in)\n else\n Time.now.to_f + Rufus.duration_to_f(freq) # not triggering immediately\n end\n\n do_schedule_at(first_at, params, &block)\n end",
"def schedule_firing_time\n if @exact_time\n @fire_time = @exact_time.to_f * 1_000\n else\n @initiated = Timers.now\n\n @fire_time = @initiated + @delay\n end\n end",
"def run(execution_interval=15)\n self.workers.each do |worker|\n require 'byebug'; debugger\n $i = 0\n $num = 3\n\n while $i < $num do\n # polling_timer = Concurrent::TimerTask.new(execution_interval: execution_interval) do\n puts(\"Conductor::Coordinator : Worker (#{worker.task_type}) polling...\") if Conductor.config.verbose\n poll_for_task(worker)\n sleep 5\n end\n\n self.polling_timers << polling_timer\n polling_timer.execute\n end\n end",
"def schedule(*args, &block)\n @jobs << [block, args]\n end",
"def schedule(*args, &block)\n @jobs << [block, args]\n end",
"def enq name, schedule, options = {}, &block\n raise ArgumentError.new(\"Block not given\") unless block_given?\n\n new_task = nil\n @mutex.synchronize do\n @tasks << new_task = Task.send(:new,\n self, name, schedule,\n options[:exclusive], options[:timeout],\n &block)\n end\n return new_task\n end",
"def start\n @schedule_thread = Thread.new do\n begin\n # Continuously loop through the heap for the next scheduled job\n job = nil\n loop do\n unless @heap.empty?\n @mutex.synchronize do\n job = @heap.pop\n @job_set.delete(Digest::SHA1.hexdigest(job.json))\n execute_n_reschedule(job) unless job.nil?\n end\n end\n sleep 0.1\n end\n rescue Exception => e\n STDERR.puts e.message\n STDERR.puts e.backtrace\n end\n end\n end",
"def work(interval = 5)\n RockQueue.logger.info \"=> Worker ready. Hold your horses!\"\n stop = false\n loop do\n sleep(interval)\n \n ActiveRecord::Base.verify_active_connections!\n queues.each do |qname|\n obj, args = RockQueue.pop(qname)\n if obj\n queue = QueueObject.new(obj, args)\n begin\n # code that actually performs the action\n args = queue.args.first\n RockQueue.logger.info \"=> Processing class #{queue.object.name} with params: #{args.inspect}\"\n args.empty? ? queue.object.perform : queue.object.perform(args)\n rescue Object => e\n # Add failed processing and retry\n if queue.add_fail(e)\n sleep(queue.get_sleep_time)\n RockQueue.logger.error \"=> Processing fail! Retrying #{queue.fails.length}\"\n RockQueue.logger.error \" Message: #{e.message}\"\n retry\n end\n end\n stop = false\n else\n stop = true if interval == 0\n end\n end\n break if stop\n end\n end",
"def schedule_in (duration, params={}, &block)\n\n do_schedule_at(\n Time.new.to_f + Rufus.duration_to_f(duration),\n prepare_params(params),\n &block)\n end",
"def do_trigger\n\n hit_exception = false\n\n begin\n\n @block.call @job_id, @at, @params\n\n rescue Exception => e\n\n @scheduler.send(:log_exception, e)\n\n hit_exception = true\n end\n\n if \\\n @scheduler.instance_variable_get(:@exit_when_no_more_jobs) or\n (@params[:dont_reschedule] == true) or\n (hit_exception and @params[:try_again] == false)\n\n @scheduler.instance_variable_get(:@non_cron_jobs).delete(job_id)\n # maybe it'd be better to wipe that reference from here anyway...\n\n return\n end\n\n #\n # ok, reschedule ...\n\n\n params[:job] = self\n\n @at = @at + Rufus.duration_to_f(params[:every])\n\n @scheduler.send(:do_schedule_at, @at, params)\n end",
"def onTimeout(interval, &block)\n \n raise ArgumentError unless interval.kind_of? Numeric\n \n ref = {:interval => interval.to_i, :block => block}\n \n with_mutex do \n if @queue.empty?\n @queue << ref\n else \n @queue.each.with_index do |v, i|\n if v[:interval] >= interval\n v[:interval] -= interval\n @queue.insert(i, ref) \n break\n else\n ref[:interval] -= v[:interval] \n if @queue.last == v\n @queue << ref\n break\n end\n end\n end\n end \n @update.push ref \n end\n \n ref\n end",
"def queue_task\n task_class.perform_later(id, variables)\n end",
"def schedule(interval: CronSwanson.default_interval, roles: [], &block)\n @in_schedule_method = true\n @whenever_jobs = []\n\n raise ArgumentError, \"provide a block containing jobs to schedule.\" if !block_given?\n\n # execute the block in the context of CronSwanson::Whenever (rather than in the context\n # of the Whenever::JobList where it will be invoked) so that we can intercept\n # calls to `rake` and similar (via method_missing below).\n instance_eval(&block)\n\n # make a schedule based on the contents of the jobs which were defined in the block\n schedule_seed = @whenever_jobs.map do |job_config|\n m, args, _block = *job_config\n \"#{m} #{args.join}\"\n end\n schedule = CronSwanson.build_schedule(@seed + schedule_seed.join, interval: interval)\n\n # now that we know when to schedule the jobs, actually pass the block to Whenever\n if roles.size > 0\n @whenever_job_list.every(schedule, roles: roles, &block)\n else\n @whenever_job_list.every(schedule, &block)\n end\n\n @in_schedule_method = false\n end",
"def perform_after(time, block=nil)\n task = Concurrent::ScheduledTask.new(time) do\n block = ->(){ yield } unless block\n self.async.perform_now block\n end\n task.execute\n task\n end",
"def runTask task\n while !task.finished && task.status < 16 do\n task.run\n\n if task.status == 8 && task.wait > 0\n sleep task.wait\n end\n end\n end",
"def periodically(interval, &block)\n EventMachine::PeriodicTimer.new(interval, &block)\n end",
"def periodically(interval, &block)\n EventMachine::PeriodicTimer.new(interval, &block)\n end",
"def run!\n logger.info(\"Running task #{self.class.to_s}\")\n @block.call\n @next_run = cron_parser && cron_parser.next(Time.now)\n end",
"def schedule(*args, &block)\n @jobs << [block, args]\n end",
"def wait(interval)\n wq = Queue.new\n onTimeout(interval) do\n wq.push nil\n end\n wq.pop\n end",
"def start_wait_thread\n @wait_thread = Thread.new do\n @wait_thread.abort_on_exception = true\n\n loop do\n if self.empty?\n CFSM.logger.debug 'Main loop of DelayedQueue: infinite sleep'\n sleep 5\n elsif self.first.expiry <= Time.now then\n event = nil\n @queue_mutex.synchronize { event = self.shift }\n CFSM.logger.info \"Retrieved delayed event #{event.inspect}\"\n # Note, for reasons I don't understand, we need to yield first, and then reset expiry.\n @expiry_handler.yield( event )\n CFSM.logger.debug 'Main loop of DelayedQueue: Back from yield'\n event.reset_expiry\n else\n delay = self.first.expiry - Time.now\n CFSM.logger.debug \"Main loop of DelayedQueue: Sleep for #{self.first.expiry - Time.now}\"\n sleep( self.first.expiry - Time.now ) if delay > 0\n end\n end\n end\n end",
"def join()\n @scheduler.join\n end",
"def reschedule(time)\r\n \"missing time\" if time.nil?\r\n\r\n time_rufus = Rufus.to_datetime time\r\n\r\n @job.unschedule unless (self.time == :forever)\r\n\r\n @job = @scheduler.at time_rufus.to_s do\r\n @timed_out = true\r\n @subscribers.each { |object| object.timed_out }\r\n end\r\n\r\n @time = time\r\n end",
"def every(name, interval = 60, initial = nil, &block)\n Thread.new(initial) { |context|\n while true\n Kernel.sleep(interval)\n MObject.debug(\"every(#{name}): fires - #{context}\")\n begin\n if ((context = block.call(context)) == nil)\n break\n end\n rescue Exception => ex\n bt = ex.backtrace.join(\"\\n\\t\")\n MObject.error(\"every(#{name})\",\n \"Exception: #{ex} (#{ex.class})\\n\\t#{bt}\")\n end\n end\n MObject.debug(\"every(#{name}): finishes\")\n }\n end",
"def wait\n return if @timers.empty?\n\n interval = wait_interval\n sleep interval if interval >= Timer::QUANTUM\n fire\n end",
"def run\n log.trace (\"run triggered\")\n while thread_current_running?\n current_time = Time.now.to_i\n\n emit() if thread_current_running?\n while thread_current_running? && Time.now.to_i <= current_time\n sleep @run_interval\n end\n end\n end",
"def start\n Ghosty::Logger.info 'Started'\n\n # Handle Control-C signals that may occur while sleeping\n trap(\"SIGINT\") do\n Ghosty::Logger.info 'Stopped'\n return\n end\n\n loop do\n frequency = Ghosty::Settings.minimum_frequency\n wait_time = (frequency + rand(frequency * 4)) * 60\n\n Ghosty::Logger.info \"Scheduling for #{Time.now + wait_time}\"\n\n sleep(wait_time)\n\n if Ghosty::Settings.valid_hours.include?(Time.now.hour)\n trigger\n else\n Ghosty::Logger.info 'Skipping - time is out of bounds'\n end\n end\n end",
"def Clockwork\n puts \"testing clockwork!\"\n every(30.seconds, 'Send Messages') {\n rake 'scheduler:send_messages'\n mail(:to => \"[email protected]\", subject: 'hello')\n }\n \nend",
"def start debug=false,method=:every_minute,*args\n @stopped = false\n @suspended = false\n @dead = Queue.new\n @thread = CronR::Utils.send(method,debug,*args) {\n time = self.time\n @mutex.synchronize {\n if @stopped then\n # It's important we put something on this queue ONLY AFTER\n # we've acquired the mutex...\n @dead.enq(true)\n true\n elsif @suspended then\n else\n self.run(time)\n end\n }\n }\n end",
"def perform args={each_minute: RUN_EVERY}\n # call an other job\n CowsayJob.perform_later # topic: 'ru'\n \n self.class.perform_later wait: args[:each_minute].minute # re-queue\n end",
"def create_timer_async(delay_seconds, &block)\n task { self.decision_context.workflow_clock.create_timer(delay_seconds, block) }\n end",
"def schedule(time, callback)\n\t\t\tflush!\n\t\t\t\n\t\t\thandle = Handle.new(time.to_f, callback)\n\t\t\t\n\t\t\t@queue << handle\n\t\t\t\n\t\t\treturn handle\n\t\tend",
"def schedule(&block)\n pool_fiber.resume(block)\n end",
"def schedule\n run_callbacks :schedule do\n inline_mode ? perform_inline : perform_async\n end\n end",
"def task_run_later(&block) \n task_later(&block).start\n end",
"def schedule(restart = true, &new_block)\n @queue << Task.new(new_block, restart) if new_block\n\n return self if @scheduled || !connection # block until connection is obtained\n\n if task = @queue.shift\n @scheduled = task.block\n @need_update = task.restart\n schedule_block task.restart do\n begin\n task.block.call\n ensure\n @scheduled = nil\n schedule\n end\n end\n elsif not @need_update.nil?\n @scheduled = :update!\n schedule_block @need_update do\n begin\n update!\n ensure\n @scheduled = nil\n @need_update = nil\n schedule\n end\n end\n end\n self\n end",
"def schedule_shutdown_job(timeout_interval = self.timeout)\n puts \"Scheduling the shutdown job\"\n @rufus.in timeout_interval, SchedulerTimeoutHandler.new, :blocking => true, :overlap => false\n end",
"def calc_next_run\n RunAtPeriodicJob.new(:name => self.name, :job => self.job, :run_at_minutes => self.run_at_minutes)\n end",
"def run\n super\n cron_poller.start\n end",
"def cb_schedule(async: true, **opt)\n async = false # TODO: remove when implementing async jobs\n opt[:callback] = callback if callback.present?\n async ? cb_perform_later(**opt) : cb_perform_now(**opt)\n end",
"def run_periodic_tasks!\n logger.info(\"Running periodic tasks...\")\n PeriodicTask.run_all_due!\n end",
"def reschedule(time)\n assert_kind_of(Time, time)\n fail \"Time should not be in past\" if time < Time.now\n\n time = Rufus.to_datetime time\n\n self.job.unschedule\n\n self.job = self.scheduler.at time.to_s do\n self.timed_out = true\n self.subscribers.each { |object| object.timed_out }\n end\n end",
"def initialize\n self.tasks = Array.new\n self.run_queue = Queue.new\n self.schedule\n end",
"def start\n\n @stopped = false\n\n @scheduler_thread = Thread.new do\n\n Thread.current[:name] = @thread_name\n\n if defined?(JRUBY_VERSION)\n require 'java'\n java.lang.Thread.current_thread.name = @thread_name\n end\n\n loop do\n\n break if @stopped\n\n t0 = Time.now.to_f\n\n step\n\n d = Time.now.to_f - t0 # + @correction\n\n next if d > @precision\n\n sleep(@precision - d)\n end\n end\n end",
"def enqueue(job)\n build_worker(job).schedule\n end",
"def schedule(program, name, insertions, deletions)\n\t\[email protected] do\n\t\t\tif (program == \"runtime\") \n\t\t\t task = Driver::Task.new\n\t\t\t task.insertions = insertions\n\t\t\t task.deletions = deletions\n\t\t\t task.program = program\n\t\t\t task.name = name\n#\t\t puts \"XXX Tasking: #{name}, #{task.insertions.tups[0]}, #{task.deletions.tups[0]}\"\n \t\t\[email protected](task)\n\t\t\telse\n\t\t\t\ttuple = Tuple.new(clock.current + 1, program, name, insertions, deletions)\n\t\t print \"XXX Scheduling: #{name}, #{task.insertions.tups[0]}, #{task.deletions.tups[0]}\"\n\t\t\t\tschedule.force(tuple)\n\t\t\tend\n\t\t\t# XXXXXXXXXX\n\t\t\[email protected]_var.signal\n\t\tend\n\tend",
"def run\n Thread.new(interval, server) do |i, s|\n loop do\n s.refresh!\n sleep(i)\n end\n end\n end",
"def join\n\n @scheduler_thread.join\n end",
"def start(id)\n # TODO: check for atomic\n yield if block_given?\n Concurrent::ScheduledTask.execute(TASK_TIMEOUT) { @tasks.delete(id)&.reject(:timeout) }\n @tasks.fetch_or_store(id, resolvable_future)\n end",
"def sleep(seconds)\n task = start(Tasks::Timeout.new(delay: seconds), explicit_start: true)\n wait task.stop_event\n end",
"def schedule_tweet(text, datetime)\n scheduler = Rufus::Scheduler.new\n\n job = scheduler.schedule datetime do\n puts \"beep\"\n send_tweet(text)\n end\n\n puts \"Job trigger time: #{job.time}\\n\"\n puts \"Running Jobs: #{scheduler.running_jobs}\\n\"\n end",
"def enqueue_to_in(queue, interval, klass, *args); end",
"def execute_continuous_task\n Rake::Task['cron_task:continuous:execute_task'].reenable\n Rake::Task['cron_task:continuous:execute_task'].invoke\n @lock_file_handle.close\n end",
"def schedule cron\n Resque.set_schedule(\"myreplicator_transporter\", {\n :cron => cron,\n :class => \"Myreplicator::Transporter\",\n :queue => \"myreplicator_transporter\"\n })\n end",
"def starter\n @starter = Thread.new do\n sleep_interval(60)\n yield # starter proc in :start \n end\n end",
"def schedule(job_count, *args, &block)\n job_count.times.each do\n @queue << [block, args]\n end\n end",
"def regularly(time, &block)\n Thread.new do\n while true\n sleep time\n synchronize &block\n end\n end\n end",
"def spawn_thread\n Thread.new do\n while true\n x = @queue.shift\n if x == Directive::SUICIDE_PILL\n \t@worker_threads_count.decrement\n \tThread.current.terminate\n end\n Thread.pass\n begin\n x.job.call(x)\n rescue StandardError => e\n $stderr.puts \"Threadz: Error in thread, but restarting with next job: #{e.inspect}\\n#{e.backtrace.join(\"\\n\")}\"\n end\n end\n end\n @worker_threads_count.increment\n end",
"def periodically(timing, event_callback)\n callback = proc { self.dispatch event_callback.to_sym }\n EventMachine::add_periodic_timer(timing, &callback)\n end",
"def start_task(task)\n @tasks.synchronize {\n @tasks << Task.new(task)\n @timestamp.renew!\n }\n task\n end"
] | [
"0.6735218",
"0.6735218",
"0.6190001",
"0.60922134",
"0.60785",
"0.6013649",
"0.6009647",
"0.5894305",
"0.58761656",
"0.5788226",
"0.5784376",
"0.568933",
"0.5682004",
"0.56805176",
"0.5656025",
"0.5606173",
"0.56012076",
"0.556172",
"0.5534466",
"0.5522611",
"0.5458805",
"0.54345536",
"0.5403993",
"0.5355574",
"0.53403383",
"0.5332377",
"0.5325918",
"0.5299999",
"0.5295386",
"0.5282848",
"0.5275595",
"0.5254778",
"0.52420264",
"0.5197326",
"0.51972836",
"0.5183594",
"0.5155896",
"0.5150082",
"0.5147252",
"0.5141335",
"0.51322085",
"0.51281",
"0.5122512",
"0.51224154",
"0.51224154",
"0.51217926",
"0.5119931",
"0.5112461",
"0.5111372",
"0.5094773",
"0.509043",
"0.5090121",
"0.5070556",
"0.50621474",
"0.5054802",
"0.50499535",
"0.50499535",
"0.5042371",
"0.50334567",
"0.50235987",
"0.5017042",
"0.50054455",
"0.49910617",
"0.4984573",
"0.49705338",
"0.4969936",
"0.4960854",
"0.49484748",
"0.49430186",
"0.49341887",
"0.4931091",
"0.49304488",
"0.49203023",
"0.49144337",
"0.49122876",
"0.4904406",
"0.49014467",
"0.4886557",
"0.48581764",
"0.48496702",
"0.4848614",
"0.48257804",
"0.482538",
"0.48028162",
"0.4791866",
"0.47855023",
"0.4778768",
"0.47739258",
"0.4763153",
"0.47571635",
"0.4749263",
"0.47296858",
"0.47224",
"0.4712907",
"0.47056076",
"0.47046027",
"0.47014025",
"0.46949738",
"0.46890023",
"0.46779042"
] | 0.6921817 | 0 |
Create a new schedule. The object's +schedule+ method, if any, will be called to create the schedule. Note that the schedule's +run+ method must be called to get actually start the schedule. | def initialize
self.tasks = Array.new
self.run_queue = Queue.new
self.schedule
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_schedule(body, opts = {})\n data, _status_code, _headers = create_schedule_with_http_info(body, opts)\n return data\n end",
"def schedule\n # implemented by subclass\n end",
"def schedule\n @schedule || Schedule.new\n end",
"def initialize\n @tag_name = self.class.to_s.split(\"::\").last.downcase\n @schedule = IceCube::Schedule.new(1.month.ago.beginning_of_day)\n @schedule.add_recurrence_rule IceCube::Rule.daily\n # For example, add these if your schedule doesn't occur on weekends\n #@schedule.add_exception_rule IceCube::Rule.weekly.day(:saturday)\n #@schedule.add_exception_rule IceCube::Rule.weekly.day(:sunday)\n end",
"def schedule\n return if self.id.nil?\n schedule_class = ModelFabric.get_class(SocialFramework.schedule_class)\n schedule_class.find_or_create_by(user: self)\n end",
"def initialize\n @id = SecureRandom.uuid\n @schedule = Rufus::Scheduler.new\n end",
"def schedule=(value)\n @schedule = value\n end",
"def schedule=(value)\n @schedule = value\n end",
"def schedule=(value)\n @schedule = value\n end",
"def initialize(args={})\n @schedule = args[:schedule] || Schedule.new\n # ...\n end",
"def schedule\n Reggora::Resources::SchedulePayment.new(config)\n end",
"def schedule\n @schedule ||= all_schedules\n @schedule || {}\n end",
"def schedule(spec)\n @task.schedule = Cloud::Cycler::Schedule.parse(spec)\n end",
"def create\n @schedule = Schedule.new(schedule_params)\n @schedule.save\n end",
"def initialize(args = {})\n @schedule = args[:schedule] || Schedule.new\n # ...\n end",
"def define_schedule_method(name)\n return if respond_to?(name.to_sym)\n logger.debug(\"Defining schedule method: #{name}\")\n self.class.send(:define_method, name.to_sym) do |*args, &block|\n scheduler.send(name.to_sym, *args, &block)\n end\n end",
"def custom_schedule(schedule)\n schedules << schedule.create_custom\n save\n end",
"def create_schedule(authorization, \n create_schedule_body = nil)\n\n # prepare query url\n _query_builder = Configuration.get_base_uri()\n _query_builder << '/schedules/new'\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 'Authorization' => Configuration.authorization,\n 'Authorization' => authorization\n }\n\n # prepare and execute HttpRequest\n _request = @http_client.post _query_url, headers: _headers, parameters: create_schedule_body.to_json\n CustomAuth.apply(_request)\n _context = execute_request(_request)\n\n # validate response against endpoint and global error codes\n if _context.response.status_code == 400\n raise EntitiesErrorErrorException.new 'Bad Request', _context\n elsif _context.response.status_code == 401\n raise EntitiesErrorErrorException.new 'Unauthorized/Missing Token', _context\n elsif _context.response.status_code == 403\n raise EntitiesErrorErrorException.new 'Forbidden', _context\n elsif _context.response.status_code == 404\n raise EntitiesErrorErrorException.new 'Not Found', _context\n elsif _context.response.status_code == 422\n raise EntitiesErrorErrorException.new 'Unprocessable Entity', _context\n elsif !_context.response.status_code.between?(200, 208)\n raise APIException.new 'Unexpected error', _context\n end\n validate_response(_context)\n\n # return appropriate response type\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\n return CreateScheduleResponse.from_hash(decoded)\n end",
"def create\n schedule = Schedule.new(schedule_params)\n\n if schedule.save\n # valid schedule\n render json: SchedulePresenter.new(schedule).as_json, status: 201\n else\n # invalid schedule\n render json: schedule.errors, status: 404\n end\n end",
"def schedule()\n return MicrosoftGraph::Me::JoinedTeams::Item::Schedule::ScheduleRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def schedule(time_at: nil)\n # Generate task payload\n task = task_payload.merge(schedule_time: time_at).compact\n\n # Create and return remote task\n CloudTask.create(task)\n end",
"def schedule_recurring_task_creation(task)\n recurring_scheduler = Scheduler.new\n @recurring_schedulers << recurring_scheduler\n\n recurring_scheduler.schedule.every \"#{Helpers.convert_frequency_to_seconds(task.frequency).to_s}s\" do\n new_task = Task.new\n new_task.description = task.description\n new_task.frequency = task.frequency\n new_task.creation_date = Time.now.getlocal\n new_task.target_date = Helpers.calculate_task_target_date(\n new_task.creation_date,\n new_task.frequency\n )\n new_task.recurring_scheduler_id = recurring_scheduler.id\n\n new_task.create_reminder_notification\n new_task.create_failed_notification\n\n add_task(new_task)\n end\n end",
"def schedule\n @schedule ||= ProjectSet::Schedule.new do |schedule|\n\n # Using the project's start and end dates, add the dates to the schedule\n @projects.each do |project|\n (project[:start]..project[:end]).each do |date|\n schedule.add_day(date: date, city: project[:city])\n end\n end\n end\n end",
"def create_schedule 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_schedule_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::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def schedule(opts)\n opts = check_params(opts,[:schedule])\n super(opts)\n end",
"def create_new_schedule()\n wait_until_schedules_page_new_schedule_button_visible\n schedules_page_new_schedule_button.click\n self.wait_for_no_spinner\n wait_until_schedules_page_new_schedule_button_visible\n wait_until_schedules_page_active_schedule_title_visible\n self.wait_for_no_spinner\n MIST::AsyncHelper.wait_until{(schedules_page_active_schedule_title.text =~ /Schedule\\s*\\d+/i) == 0}\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def addSchedule(schedule)\n\t\[email protected](schedule)\n\tend",
"def initialize\n klass = self.class\n create_hourly_cronjob(klass.hourly_method) if klass.hourly_method\n create_daily_cronjob(klass.daily_method, klass.daily_trigger_time) if klass.daily_method\n create_weekly_cronjob(klass.weekly_method, klass.weekly_trigger_time) if klass.weekly_method\n end",
"def create\n @schedule = Schedule.new(schedule_params)\n auth! :action => :update, :object => @schedule.screen\n respond_to do |format|\n if @schedule.save\n process_notification(@schedule, {:screen_id => @schedule.screen_id, :screen_name => @schedule.screen.name,\n :template_id => @schedule.template.id, :template_name => @schedule.template.name }, \n :key => 'concerto_template_scheduling.schedule.create', :owner => current_user, :action => 'create')\n\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",
"def schedule\n run_callbacks :schedule do\n inline_mode ? perform_inline : perform_async\n end\n end",
"def create_or_update_schedule(repo_id, type, schedule)\n schedules = Runcible::Resources::RepositorySchedule.new(self.config).list(repo_id, type)\n if schedules.empty?\n Runcible::Resources::RepositorySchedule.new(self.config).create(repo_id, type, schedule)\n else\n Runcible::Resources::RepositorySchedule.new(self.config).update(repo_id, type,\n schedules[0]['_id'], :schedule => schedule)\n end\n end",
"def createschedule(uid,rname,scparams,stparams)\r\n scrbslog(\"======Begin to create a new schedule======\")\r\n @user = User.find(uid)\r\n scrbslog(\"Author:\" + @user.name)\r\n @room = Room.find_by_room_name(rname) \r\n @schedule = Schedule.create(scparams)\r\n @user.schedules << @schedule\r\n @room.schedules << @schedule\r\n stparams[\"scheduleid\"][email protected]\r\n @status = Status.create(stparams)\r\n scrbslog(scparams)\r\n scrbslog(\"======End to create a new schedule======\")\r\n end",
"def schedule\n run_callbacks :schedule do\n perform_async\n end\n end",
"def setSchedule(schedule)\n\t\t@schedule = schedule\n\tend",
"def initialize(schedule)\n @result, @min, @hour, @day, @month, @wday = *schedule.match(CRON_REGEXP)\n validate\n end",
"def schedule(schedule)\n set_global_attributes\n upload_if_needed\n\n response = SimpleWorker.service.schedule(self.class.name, sw_get_data, schedule)\n# puts 'schedule response=' + response.inspect\n @schedule_id = response[\"schedule_id\"]\n response\n end",
"def create_scheduled_push\n Push::ScheduledPush.new(self)\n end",
"def create\n\n # Get schedule json object from parameters\n schedule_params = params[:schedule] ||= {}\n\n # Find if schedule has been created already\n # find by name and group\n @schedule = Schedule.find_by_name_and_group(schedule_params[:name], schedule_params[:group])\n\n if @schedule\n\n # Check to see if the schedule is registered with Quartz (after restart or removal, etc)\n key = JobKey.new(@schedule.name, @schedule.group)\n unless RemoteJobScheduler.instance.scheduler.check_exists(key)\n RemoteJobScheduler.instance.build_schedule(@schedule)\n end\n\n render :json => {:schedule_id => @schedule.id, :msg => 'schedule already exists'}\n else\n begin\n @schedule = Schedule.new(schedule_params)\n rescue => e\n Rails.logger.error \"Could not create schedule : #{e.message}\"\n render :json => {:error => e.message}\n return\n end\n\n if @schedule.save\n begin\n RemoteJobScheduler.instance.build_schedule(@schedule)\n render :json => {:schedule_id => @schedule.id}\n rescue => e\n Rails.logger.error \"Could not create schedule : #{e.message}\"\n render :json => {:error => e.message}\n end\n\n else\n # TODO : We need error codes for this\n render :json => {:error => \"Error : #{@schedule.errors.first[0]} #{@schedule.errors.first[1]}\",\n :content_type => 'text/plain',\n :status => :unprocessable_entity}\n\n end # end (if @schedule.save)\n\n end # end (if @schedule)\n\n end",
"def initialize\n @schedule = []\n\n # pass self to the construction block and let the project load it's days\n # into the schedule\n yield(self)\n\n deduplicate\n sort\n assign_types\n end",
"def schedule(cron)\n if !cron.is_a?(String) || cron.blank?\n raise InvalidArgumentError,\n \"The cron passed to 'schedule' must be a non empty string\"\n end\n\n Engine.instance.schedule([self], cron)\n end",
"def initialize(cron_def, &block)\n @cron_def = cron_def\n @block = block\n @next_run = cron_parser && cron_parser.next(Time.now)\n PeriodicTask.tasks << self\n end",
"def initialize_group_schedule(creator_schedule)\n # clear current schedule if one exists\n self.schedule.destroy if self.schedule != nil\n \n # create schedule\n schedule = Schedule.create(:group_id => self.id)\n \n # copy creator's schedule as group's schedule\n creator_schedule.days.each do |creator_day|\n day = Day.create(:name => creator_day.name, :schedule_id => schedule.id)\n creator_day.time_blocks.each do |creator_time_block|\n TimeBlock.create(:chunk_of_time => creator_time_block.chunk_of_time, :day_id => day.id)\n end\n end\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def create_scheduling_object(principal_uri, object_uri, object_data)\n end",
"def initialize(with_time=true)\n @with_time\n @day = Day.new # the time schedule for the mechanic\n end",
"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",
"def schedule\n schedule = start_time > Time.current ? UPCOMING_MATCH : PLAYED_MATCH\n\n schedule\n end",
"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",
"def initialize (number, schedule)\n # TODO: add exception checking for invalid (null) values\n\n @number = number\n @schedule = schedule\n end",
"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",
"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",
"def create\n @person_schedule = PersonSchedule.new(person_schedule_params)\n respond_to do |format|\n if @person_schedule.save\n format.json { render :show, status: :created, object: @person_schedule }\n else\n format.json { render json: @person_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add(*args)\n new_item = args.first\n new_item = (TimeSchedulerItem.new *args) \\\n unless new_item.is_a? TimeSchedulerItem\n \n new_item.schedulers << self\n schedule_update new_item\n new_item\n end",
"def create\n @schedule = Schedule.new(schedule_params)\n respond_to do |format|\n @schedule.target ||= 0\n @schedule.achievement ||= 0\n if @schedule.save\n format.html { redirect_to @schedule,\n notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created,\n location: @schedule }\n else\n format.html { render :new }\n format.json { render json: @schedule.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"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",
"def rufus_add_schedule(options = {})\n return if options.blank?\n unless @user_scheduler.respond_to?(options[:method])\n raise _(\"invalid method: %{options}\") % {:options => options[:method]}\n end\n\n Array.wrap(options[:tags]) << CLASS_TAG\n @schedules[:scheduler] ||= []\n if options[:months]\n rufus_add_monthly_schedule(options)\n else\n rufus_add_normal_schedule(options)\n end\n end",
"def converted_schedule\n if !self.read_attribute(:schedule).empty?\n the_schedule = IceCube::Schedule.new( self.created_at )\n the_rule = RecurringSelect.dirty_hash_to_rule( self.read_attribute(:schedule) )\n if RecurringSelect.is_valid_rule?(the_rule)\n the_schedule.add_recurrence_rule(the_rule)\n end\n the_schedule\n end\n end",
"def create\n @my_schedule = MySchedule.new(my_schedule_params)\n\n respond_to do |format|\n if @my_schedule.save\n format.html { redirect_to @my_schedule, notice: 'My schedule was successfully created.' }\n format.json { render :show, status: :created, location: @my_schedule }\n else\n format.html { render :new }\n format.json { render json: @my_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_schedule_for_assessment assessment_id, schedule_detail\n params = init_params\n params[:sc] = schedule_detail.to_json\n request_url = UrlGenerator.url_for(\"assessments\", \"#{assessment_id}/schedules\")\n asgn = SignatureGenerator.signature_for(http_verb: 'POST', url: request_url, params: params)\n\n res = self.post(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n return res\n else\n return error_response_for(res)\n end\n end",
"def create\n @manage_schedule = Schedule.new(params[:manage_schedule])\n\n respond_to do |format|\n if @manage_schedule.save\n format.html { redirect_to @manage_schedule, notice: 'Schedule was successfully created.' }\n format.json { render json: @manage_schedule, status: :created, location: @manage_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @manage_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"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, status: :unprocessable_entity }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def converted_schedule\n if !self.read_attribute(:recurring_schedule).empty?\n the_schedule = IceCube::Schedule.new( self.created_at )\n the_rule = RecurringSelect.dirty_hash_to_rule( self.read_attribute(:recurring_schedule) )\n if RecurringSelect.is_valid_rule?(the_rule)\n the_schedule.add_recurrence_rule(the_rule)\n end\n the_schedule\n end\n end",
"def create\n @schedule = Schedule.new(params[:schedule])\n authorize! :create, @schedule\n \n # Verify user can view this schedule. Must be in his product\n authorize_product!(@schedule.product)\n\n respond_to do |format|\n if @schedule.save\n @schedule.start_time = convert_to_utc_time(@schedule.start_time)\n @schedule.save\n format.html { redirect_to(@schedule, :notice => 'Schedule was successfully created.') }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"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",
"def create\n @schedule = Schedule.new(params[:schedule])\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",
"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 ha sido creado.' }\n format.json { render :index, 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",
"def create\n @schedule = Schedule.create(format(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",
"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",
"def schedule_play(params)\n path = @version + '/Call/Play/Schedule/'\n method = 'POST'\n return request(path, method, params)\n end",
"def create\r\n @route_schedule = RouteSchedule.new(params[:route_schedule])\r\n\r\n respond_to do |format|\r\n if @route_schedule.save\r\n format.html { redirect_to @route_schedule, notice: 'Route schedule was successfully created.' }\r\n format.json { render json: @route_schedule, status: :created, location: @route_schedule }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @route_schedule.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def add_schedule(schedule_name)\n return nil if schedule_name == nil or schedule_name == \"\"\n # First check model and return schedule if it already exists\n self.getSchedules.each do |schedule|\n if schedule.name.get.to_s == schedule_name\n OpenStudio::logFree(OpenStudio::Debug, 'openstudio.standards.Model', \"Already added schedule: #{schedule_name}\")\n return schedule\n end\n end\n \n require 'date'\n\n #OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', \"Adding schedule: #{schedule_name}\") \n \n # Find all the schedule rules that match the name\n rules = self.find_objects(self.standards['schedules'], {'name'=>schedule_name})\n if rules.size == 0\n OpenStudio::logFree(OpenStudio::Warn, 'openstudio.standards.Model', \"Cannot find data for schedule: #{schedule_name}, will not be created.\")\n return false #TODO change to return empty optional schedule:ruleset?\n end\n \n # Helper method to fill in hourly values\n def add_vals_to_sch(day_sch, sch_type, values)\n if sch_type == \"Constant\"\n day_sch.addValue(OpenStudio::Time.new(0, 24, 0, 0), values[0])\n elsif sch_type == \"Hourly\"\n for i in 0..23\n next if values[i] == values[i + 1]\n day_sch.addValue(OpenStudio::Time.new(0, i + 1, 0, 0), values[i]) \n end \n else\n #OpenStudio::logFree(OpenStudio::Info, \"Adding space type: #{template}-#{clim}-#{building_type}-#{spc_type}\")\n end\n end\n \n # Make a schedule ruleset\n sch_ruleset = OpenStudio::Model::ScheduleRuleset.new(self)\n sch_ruleset.setName(\"#{schedule_name}\") \n\n # Loop through the rules, making one for each row in the spreadsheet\n rules.each do |rule|\n day_types = rule['day_types']\n start_date = DateTime.parse(rule['start_date'])\n end_date = DateTime.parse(rule['end_date'])\n sch_type = rule['type']\n values = rule['values']\n \n #Day Type choices: Wkdy, Wknd, Mon, Tue, Wed, Thu, Fri, Sat, Sun, WntrDsn, SmrDsn, Hol\n \n # Default\n if day_types.include?('Default')\n day_sch = sch_ruleset.defaultDaySchedule\n day_sch.setName(\"#{schedule_name} Default\")\n add_vals_to_sch(day_sch, sch_type, values)\n end\n\n # Winter Design Day\n if day_types.include?('WntrDsn')\n day_sch = OpenStudio::Model::ScheduleDay.new(self)\n sch_ruleset.setWinterDesignDaySchedule(day_sch)\n day_sch = sch_ruleset.winterDesignDaySchedule\n day_sch.setName(\"#{schedule_name} Winter Design Day\")\n add_vals_to_sch(day_sch, sch_type, values)\n end \n\n # Summer Design Day\n if day_types.include?('SmrDsn')\n day_sch = OpenStudio::Model::ScheduleDay.new(self)\n sch_ruleset.setSummerDesignDaySchedule(day_sch)\n day_sch = sch_ruleset.summerDesignDaySchedule\n day_sch.setName(\"#{schedule_name} Summer Design Day\")\n add_vals_to_sch(day_sch, sch_type, values)\n end\n \n # Other days (weekdays, weekends, etc)\n if day_types.include?('Wknd') ||\n day_types.include?('Wkdy') ||\n day_types.include?('Sat') ||\n day_types.include?('Sun') ||\n day_types.include?('Mon') ||\n day_types.include?('Tue') ||\n day_types.include?('Wed') ||\n day_types.include?('Thu') ||\n day_types.include?('Fri')\n \n # Make the Rule\n sch_rule = OpenStudio::Model::ScheduleRule.new(sch_ruleset)\n day_sch = sch_rule.daySchedule\n day_sch.setName(\"#{schedule_name} #{day_types} Day\")\n add_vals_to_sch(day_sch, sch_type, values)\n \n # Set the dates when the rule applies\n sch_rule.setStartDate(OpenStudio::Date.new(OpenStudio::MonthOfYear.new(start_date.month.to_i), start_date.day.to_i))\n sch_rule.setEndDate(OpenStudio::Date.new(OpenStudio::MonthOfYear.new(end_date.month.to_i), end_date.day.to_i))\n \n # Set the days when the rule applies\n # Weekends\n if day_types.include?('Wknd')\n sch_rule.setApplySaturday(true)\n sch_rule.setApplySunday(true)\n end\n # Weekdays\n if day_types.include?('Wkdy')\n sch_rule.setApplyMonday(true)\n sch_rule.setApplyTuesday(true)\n sch_rule.setApplyWednesday(true)\n sch_rule.setApplyThursday(true)\n sch_rule.setApplyFriday(true)\n end\n # Individual Days\n sch_rule.setApplyMonday(true) if day_types.include?('Mon')\n sch_rule.setApplyTuesday(true) if day_types.include?('Tue')\n sch_rule.setApplyWednesday(true) if day_types.include?('Wed')\n sch_rule.setApplyThursday(true) if day_types.include?('Thu')\n sch_rule.setApplyFriday(true) if day_types.include?('Fri')\n sch_rule.setApplySaturday(true) if day_types.include?('Sat')\n sch_rule.setApplySunday(true) if day_types.include?('Sun')\n\n end\n \n end # Next rule \n \n return sch_ruleset\n \n end",
"def schedule\n return @schedule\n end",
"def schedule\n return @schedule\n end",
"def schedule\n return @schedule\n end",
"def initialize(args={})\n\n @schedule = args[:schedule] || Schedule.new\n\n @size = args[:size] \n @chain = args[:chain] || default_chain\n\n post_initialize(args)\n end",
"def new_schedule(*args)\n if !args.all? { |e| e.is_a?(Integer) && e >= 0 && e <= 6 }\n return \"Please enter a number from 0-6 where each number represents a day of the week. 0 represents Sunday, 1 represents Monday, etc.\"\n end\n schedule1 = Schedule.new(self.first_event, duration: self.duration_mins.minutes )\n schedule1.add_recurrence_rule Rule.weekly.day(args)\n self.schedule = schedule1\n self.save!\n end"
] | [
"0.67916685",
"0.6557806",
"0.6494572",
"0.6469423",
"0.642208",
"0.6297236",
"0.6263814",
"0.6263814",
"0.6263814",
"0.62406576",
"0.62113905",
"0.6180685",
"0.61663043",
"0.61582005",
"0.6135242",
"0.61184967",
"0.60495806",
"0.60320395",
"0.60247713",
"0.60214955",
"0.6018628",
"0.60156125",
"0.6010276",
"0.59927654",
"0.5945011",
"0.59378266",
"0.59302026",
"0.59164286",
"0.5901871",
"0.58935404",
"0.5892953",
"0.58809984",
"0.58792865",
"0.58679515",
"0.5861988",
"0.5803476",
"0.5790556",
"0.57847404",
"0.5782781",
"0.5769441",
"0.5755027",
"0.5729309",
"0.57094073",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699423",
"0.5699142",
"0.56869733",
"0.5686032",
"0.5677159",
"0.56770676",
"0.5676661",
"0.56583315",
"0.5658274",
"0.56508636",
"0.5649642",
"0.56455296",
"0.56421477",
"0.5630032",
"0.56293213",
"0.5628232",
"0.5597149",
"0.5582485",
"0.5580677",
"0.55738974",
"0.55714595",
"0.5571054",
"0.55637896",
"0.5544527",
"0.5543369",
"0.55225027",
"0.5514452",
"0.5505855",
"0.55001104",
"0.5491616",
"0.5491616",
"0.5491616",
"0.548859",
"0.54878205"
] | 0.6274072 | 6 |
Add a task to the schedule. If +interval+ is a number (Fixnum or Float), it represents the number of seconds to wait between successive runs of the task. If +interval+ is a Time or Date object, the task will be run once at the specified time | def add_task(interval, &block)
tasks << Task.new(interval, block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def periodically_trigger_task(task_name = nil, interval = 1, &block)\n periodically(interval) do\n trigger_task(task_name, &block)\n end\n end",
"def periodically_trigger_task(task_name = nil, interval = 1, &block)\n periodically(interval) do\n trigger_task(task_name, &block)\n end\n end",
"def add_task task\n time, obj = task\n if time.is_a? Numeric\n time = Time.now + time\n elsif time.is_a? DateTime\n time = time.to_time\n end\n @schedule << [time, obj]\n sort_schedule\n write_schedule\n end",
"def every(interval, unit = :minutes, options = {}, &block)\n raise \"Not a Integer: #{interval}\" unless interval.is_a? Integer\n raise \"Interval less than 1\" if interval < 1\n\n opts = {\n run_at_start: true\n }.merge(options)\n\n case unit\n when :min, :mins, :minute, :minutes\n when :hr, :hrs, :hour, :hours, :horse\n interval *= 60\n else\n raise \"Unknown unit: #{unit}\"\n end\n $bot[:periodic] << {\n interval: interval,\n remaining: opts[:run_at_start] ? 0 : interval,\n block: block\n }\n end",
"def every(interval, &block)\n action = Action.new({\n :interval => interval,\n :recur => true\n },\n &block\n )\n to_run.push(action)\n reset\n action\n end",
"def schedule(job, interval, queue=:default)\n Metriks.timer(\"handler.job.schedule\").time do\n job.schedule(queue, interval, payload, params)\n end\n end",
"def initialize interval, timeout\n @interval = interval\n @cancelled = false\n\n @timeout = EM.add_periodic_timer timeout, method(:timeout_fired)\n\n schedule\n end",
"def periodically(interval, &block)\n EventMachine::PeriodicTimer.new(interval, &block)\n end",
"def periodically(interval, &block)\n EventMachine::PeriodicTimer.new(interval, &block)\n end",
"def add_timeout(interval, &block)\n @timer.add(interval, &block)\n end",
"def every(interval, &block)\n Timer.new(self, interval, true, block)\n end",
"def create_periodic_timer(interval, &block)\n Timer.new(self, interval, :periodic => true, &block)\n end",
"def add_periodic_timer(interval, callback=nil, &blk)\n @timers ||= {}\n timer = PeriodicTimer.new(interval,callback,&blk)\n timer.on(:cancelled) do\n @timers.delete(timer)\n end\n @timers[timer.object_id] = timer\n timer.object_id\n end",
"def perform_in(interval, *args)\n int = interval.to_f\n now = Time.now.to_f\n ts = (int < 1_000_000_000 ? now + int : int)\n\n item = { 'class' => self, 'args' => args, 'at' => ts }\n\n # Optimization to enqueue something now that is scheduled to go out now or in the past\n item.delete('at'.freeze) if ts <= now\n\n client_push(item)\n end",
"def after(interval, &block)\n action = Action.new(\n {:interval => interval},\n &block\n )\n to_run.push(action)\n reset\n action\n end",
"def schedule_recurring_task_creation(task)\n recurring_scheduler = Scheduler.new\n @recurring_schedulers << recurring_scheduler\n\n recurring_scheduler.schedule.every \"#{Helpers.convert_frequency_to_seconds(task.frequency).to_s}s\" do\n new_task = Task.new\n new_task.description = task.description\n new_task.frequency = task.frequency\n new_task.creation_date = Time.now.getlocal\n new_task.target_date = Helpers.calculate_task_target_date(\n new_task.creation_date,\n new_task.frequency\n )\n new_task.recurring_scheduler_id = recurring_scheduler.id\n\n new_task.create_reminder_notification\n new_task.create_failed_notification\n\n add_task(new_task)\n end\n end",
"def at(delay, options = {}, &task)\n options = { :delay => delay, :scheduler => self }.merge(options)\n @queue << Task.new(options, &task)\n end",
"def schedule(interval: CronSwanson.default_interval, roles: [], &block)\n @in_schedule_method = true\n @whenever_jobs = []\n\n raise ArgumentError, \"provide a block containing jobs to schedule.\" if !block_given?\n\n # execute the block in the context of CronSwanson::Whenever (rather than in the context\n # of the Whenever::JobList where it will be invoked) so that we can intercept\n # calls to `rake` and similar (via method_missing below).\n instance_eval(&block)\n\n # make a schedule based on the contents of the jobs which were defined in the block\n schedule_seed = @whenever_jobs.map do |job_config|\n m, args, _block = *job_config\n \"#{m} #{args.join}\"\n end\n schedule = CronSwanson.build_schedule(@seed + schedule_seed.join, interval: interval)\n\n # now that we know when to schedule the jobs, actually pass the block to Whenever\n if roles.size > 0\n @whenever_job_list.every(schedule, roles: roles, &block)\n else\n @whenever_job_list.every(schedule, &block)\n end\n\n @in_schedule_method = false\n end",
"def add_timer(name, interval_ms, recurring = true, &block)\n raise \"timer [#{name}] already exists\" if @timers[name]\n @timers[name] = {\n count: 0, recurring: recurring,\n interval_ms: interval_ms, callback: block}\n end",
"def work(interval = 5.0)\n end",
"def every(interval_sec, &block)\n # to allow canceling the periodic timer we need to\n # hand back a reference to it which responds to 'cancel'\n # As this is getting rather complex when allowing for\n # registration before the EM is up and running, we simply throw\n # and exception at this time.\n raise \"Can't handle 'every' registration before the EM is up\" unless EM.reactor_running?\n # if EM.reactor_running?\n # EM.add_periodic_timer(interval_sec, &block)\n # else\n # @deferred << lambda do\n # EM.add_periodic_timer(interval_sec, &block)\n # end\n # end\n t = EM.add_periodic_timer(interval_sec) do\n begin\n block.call(t)\n rescue => ex\n error \"Exception '#{ex}'\"\n debug \"#{ex}\\n\\t#{ex.backtrace.join(\"\\n\\t\")}\"\n end\n end\n t\n end",
"def schedule_every (freq, params={}, &block)\n\n params = prepare_params(params)\n params[:every] = freq\n\n first_at = params[:first_at]\n first_in = params[:first_in]\n\n #params[:delayed] = true if first_at or first_in\n\n first_at = if first_at\n at_to_f(first_at)\n elsif first_in\n Time.now.to_f + Rufus.duration_to_f(first_in)\n else\n Time.now.to_f + Rufus.duration_to_f(freq) # not triggering immediately\n end\n\n do_schedule_at(first_at, params, &block)\n end",
"def add_task(task, scheduled_time = \"5m\")\n if task.respond_to?(:execute)\n # Add scheduled tasks\n job_id = @scheduler.every(scheduled_time) do\n task.execute()\n end\n # Save the job ide with a reference to the invoking task (using the task as a key)\n if @job_ids_by_task[task].nil? then @job_ids_by_task[task] = [] end\n # Add the job id to this task and reversed\n @job_ids_by_task[task] << job_id\n @tasks_by_job_ids[job_id] = task\n end\n end",
"def schedule(scheduler)\n case self.interval\n when :startup, :shutdown\n # ignore it\n else\n self.thread = Thread.new do\n loop do\n sleep self.interval\n scheduler.run_queue << self\n end\n end\n self.thread.abort_on_exception = true\n end\n end",
"def create_timer(interval, &block)\n Timer.new(self, interval, &block)\n end",
"def onTimeout(interval, &block)\n \n raise ArgumentError unless interval.kind_of? Numeric\n \n ref = {:interval => interval.to_i, :block => block}\n \n with_mutex do \n if @queue.empty?\n @queue << ref\n else \n @queue.each.with_index do |v, i|\n if v[:interval] >= interval\n v[:interval] -= interval\n @queue.insert(i, ref) \n break\n else\n ref[:interval] -= v[:interval] \n if @queue.last == v\n @queue << ref\n break\n end\n end\n end\n end \n @update.push ref \n end\n \n ref\n end",
"def schedule_in (duration, params={}, &block)\n\n do_schedule_at(\n Time.new.to_f + Rufus.duration_to_f(duration),\n prepare_params(params),\n &block)\n end",
"def periodically(period = 0.5, maximum = nil, &block)\n @timers << hq.periodic_action(period, maximum, &block)\n end",
"def add_timer(interval, callback=nil, &blk)\n @timers ||= {}\n timer = Timer.new(interval,callback,&blk)\n timer.on(:fired) do\n @timers.delete(timer.object_id)\n end\n timer.on(:cancelled) do\n @timers.delete(timer.object_id)\n end\n @timers[timer.object_id] = timer\n timer.object_id\n end",
"def perform_in_helper(item, interval, *args)\n int = interval.to_f\n now = Time.now.to_f\n ts = (int < 1_000_000_000 ? now + int : int)\n\n item.merge!('class' => self, 'args' => args, 'at' => ts)\n\n # Optimization to enqueue something now that is scheduled to go out now or in the past\n item.delete('at') if ts <= now\n\n client_push(item)\n end",
"def work(interval = 5.0)\n interval = Float(interval)\n $0 = \"resque-delayed: harvesting\"\n startup\n\n loop do\n break if shutdown?\n\n # harvest delayed jobs while they are available\n while job = Resque::Delayed.next do\n log \"got: #{job.inspect}\"\n queue, klass, *args = job\n Resque::Job.create(queue, klass, *args)\n end\n\n break if interval.zero?\n log! \"Sleeping for #{interval} seconds\"\n sleep interval\n end\n end",
"def _setup_declarative_notifcation_timer(notification, interval)\n return if _stubbed_connection? ||\n @_declarative_notifications_timers.include?(notification)\n\n callback = proc do\n synchronize_entrypoint! do\n _handle_declarative_notifcation(notification)\n end\n end\n\n timer = start_periodic_timer(callback, every: interval)\n\n @_declarative_notifications_timers[notification] = timer\n active_periodic_timers << timer\n end",
"def schedule(time, callback); end",
"def now_and_every(interval, recur = T.unsafe(nil), &block); end",
"def schedule(time_at: nil)\n # Generate task payload\n task = task_payload.merge(schedule_time: time_at).compact\n\n # Create and return remote task\n CloudTask.create(task)\n end",
"def every(name, interval = 60, initial = nil, &block)\n Thread.new(initial) { |context|\n while true\n Kernel.sleep(interval)\n MObject.debug(\"every(#{name}): fires - #{context}\")\n begin\n if ((context = block.call(context)) == nil)\n break\n end\n rescue Exception => ex\n bt = ex.backtrace.join(\"\\n\\t\")\n MObject.error(\"every(#{name})\",\n \"Exception: #{ex} (#{ex.class})\\n\\t#{bt}\")\n end\n end\n MObject.debug(\"every(#{name}): finishes\")\n }\n end",
"def after(interval, &block)\n Timer.new(self, interval, false, block)\n end",
"def schedule(spec)\n @task.schedule = Cloud::Cycler::Schedule.parse(spec)\n end",
"def add_eval_task(ev_task)\n self.all_tasks << ev_task\n end",
"def schedule(*args, &block)\n @jobs << [block, args]\n end",
"def schedule(*args, &block)\n @jobs << [block, args]\n end",
"def schedule(*args, &block)\n @jobs << [block, args]\n end",
"def schedule(*args, &block)\n @jobs << [block, args]\n end",
"def interval duration, &block\n `setInterval(function() { #{block.call} }, duration * 1000)`\n end",
"def periodically(timing, event_callback)\n callback = proc { self.dispatch event_callback.to_sym }\n EventMachine::add_periodic_timer(timing, &callback)\n end",
"def run(execution_interval=15)\n self.workers.each do |worker|\n require 'byebug'; debugger\n $i = 0\n $num = 3\n\n while $i < $num do\n # polling_timer = Concurrent::TimerTask.new(execution_interval: execution_interval) do\n puts(\"Conductor::Coordinator : Worker (#{worker.task_type}) polling...\") if Conductor.config.verbose\n poll_for_task(worker)\n sleep 5\n end\n\n self.polling_timers << polling_timer\n polling_timer.execute\n end\n end",
"def create_periodic_sync_points(entry_id, interval, duration)\n\t\t\tkparams = {}\n\t\t\t# Kaltura live-stream entry id\n\t\t\tclient.add_param(kparams, 'entryId', entry_id);\n\t\t\t# Events interval in seconds \n\t\t\tclient.add_param(kparams, 'interval', interval);\n\t\t\t# Duration in seconds\n\t\t\tclient.add_param(kparams, 'duration', duration);\n\t\t\tclient.queue_service_action_call('livestream', 'createPeriodicSyncPoints', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend",
"def add_repeating_request(url, interval, content)\n @nodes << RepeatingRequest.new(page_config, url, interval, content)\n end",
"def schedule_every(n, &block)\r\n\r\n while true do\r\n before = Time.now\r\n\r\n block.call\r\n \r\n elapsed = Time.now - before\r\n interval = n - elapsed\r\n \r\n @logger.debug \"orders processing/delivery take #{elapsed} seconds.\"\r\n \r\n sleep(interval) if interval > 0\r\n end\r\n\r\nend",
"def start_task(task)\n @tasks.synchronize {\n @tasks << Task.new(task)\n @timestamp.renew!\n }\n task\n end",
"def after interval, options = {}, &block\n callback = TodoCallback.new interval, options, &block\n TodoRunner.add_after_callback callback\n end",
"def periodically(timing, event_callback)\n EventMachine.add_periodic_timer(timing) do\n dispatch(event_callback.to_sym)\n end\n end",
"def retry_later(interval, opts = {})\n is_error = opts.to_h.fetch(:is_error, true)\n\n redis.write(\n gid,\n retries: is_error ? retries + 1 : retries,\n http_request: http_request,\n schedule_time: (Time.now + interval).to_i,\n queue: queue,\n dispatch_deadline: dispatch_deadline\n )\n redis.sadd(self.class.key, [id])\n end",
"def time_intervals(program,insert_repeat_interval = true)\n intervals = map{|d|d.time_intervals}.flatten.uniq.find_all{|i|program.interval === i.tstart}\n if program.repeat_first_interval and insert_repeat_interval\n firstinterval = intervals.min.copy\n firstinterval.shift!(-program.resolution*60)\n intervals << firstinterval\n end\n intervals\n end",
"def interval_param\n \"interval:auto\"\n end",
"def add_task(task)\n @tasks << task\n end",
"def enq name, schedule, options = {}, &block\n raise ArgumentError.new(\"Block not given\") unless block_given?\n\n new_task = nil\n @mutex.synchronize do\n @tasks << new_task = Task.send(:new,\n self, name, schedule,\n options[:exclusive], options[:timeout],\n &block)\n end\n return new_task\n end",
"def add_task(*args)\n task = Util::get_task_from_args(*args)\n add_task_internal(task, true)\n end",
"def schedule_shutdown_job(timeout_interval = self.timeout)\n puts \"Scheduling the shutdown job\"\n @rufus.in timeout_interval, SchedulerTimeoutHandler.new, :blocking => true, :overlap => false\n end",
"def next_time(*args)\n cron_schedule.next_time(*args)\n end",
"def distribute_periodically(interval)\n Thread.new{\n loop do\n perform_distribution\n # Sleep for \"interval\" seconds.\n # If awaken isn't signaled, timeout and attempt distribution\n @mutex.synchronize do\n @awaken.wait(@mutex, interval)\n end\n end\n }\n end",
"def add_task(task)\n\t\t@tasks << task\n\tend",
"def add_interval(xml, options)\n interval = options[:interval]\n return unless interval\n\n xml.tag!('interval') do\n # The measurement of time, in association with the Interval Unit,\n # that is used to define the frequency of the billing occurrences\n xml.tag!('length', interval[:length])\n # The unit of time, in association with the Interval Length,\n # between each billing occurrence\n xml.tag!('unit', interval[:unit].to_s)\n end\n end",
"def every(interval_sec, &block)\n raise \"Missing implementation 'every'\"\n end",
"def initialize(interval=nil, proc=nil)\n self.interval = interval\n self.proc = proc\n self.thread = nil\n end",
"def perform_in(interval, job_class, *args)\n int = interval.to_f\n now = SidekiqBulkJob.time_now\n ts = (int < 1_000_000_000 ? now + int : int).to_f\n\n # Optimization to enqueue something now that is scheduled to go out now or in the past\n if ts > now.to_f\n options = SidekiqBulkJob::Utils.symbolize_keys(@opts)\n payload = {\n job_class_name: job_class.to_s,\n at: ts,\n perfrom_args: args,\n queue: options[:queue] || SidekiqBulkJob.queue\n }.select { |_, value| !value.nil? }\n SidekiqBulkJob.process payload\n else\n perform_async(job_class, *args)\n end\n end",
"def add_to_scheduler\n name = \"for_survey_#{@schedulable.company_survey.id}\"\n config = {}\n config[:every] = [\"#{@schedulable.repeat_every}#{@schedulable.repeat_mode}\",\n { first_at: calculate_next_delivery }]\n config[:class] = 'SendEmailsJob'\n config[:queue] = 'send_emails'\n config[:persist] = true\n config[:args] = @schedulable.company_survey.id\n Resque.set_schedule(name, config)\n end",
"def schedule\n run_callbacks :schedule do\n perform_async\n end\n end",
"def enqueue_in(interval, klass, *args); end",
"def interval=(interval)\n if interval.nil?\n fail ArgumentError, 'invalid value for \"interval\", interval cannot be nil.'\n end\n @interval = interval\n end",
"def ticker(interval)\n loop do\n sleep(interval)\n @q.push(:nudge)\n end\n end",
"def add(task)\n @tasks << task\n end",
"def add task\n @tasks << task\n end",
"def add_check(check)\n min = config[:min_interval]\n check[:interval] = min if check[:interval] < min\n EM.add_periodic_timer(check[:interval]) do\n self.send(\"#{@os}_ping\", check)\n end\n end",
"def update_interval\n self.interval =\n case repetitions\n when 1 then 1\n when 2 then 6\n else\n (repetitions - 1) * easiness_factor\n end\n end",
"def initialize( options = {} )\n\t\t\t@interval = options[:interval] || 5\n\t\t\t@last_run = Time.at(0)\n\t\tend",
"def add(task)\n @all_tasks << task\n end",
"def set_interval\n @interval = Interval.find(params[:id])\n end",
"def calc_next_run\n RunAtPeriodicJob.new(:name => self.name, :job => self.job, :run_at_minutes => self.run_at_minutes)\n end",
"def add(*args)\n new_item = args.first\n new_item = (TimeSchedulerItem.new *args) \\\n unless new_item.is_a? TimeSchedulerItem\n \n new_item.schedulers << self\n schedule_update new_item\n new_item\n end",
"def schedule_task(proc, delay = 20)\n scheduler.schedule_async_delayed_task(plugin, proc, delay)\n end",
"def timer_task_options\n { run_now: true, execution_interval: reaper_interval }\n end",
"def initialize(cron_def, &block)\n @cron_def = cron_def\n @block = block\n @next_run = cron_parser && cron_parser.next(Time.now)\n PeriodicTask.tasks << self\n end",
"def run_periodic_tasks!\n logger.info(\"Running periodic tasks...\")\n PeriodicTask.run_all_due!\n end",
"def reload_interval=(interval)\n raise ArgumentError, 'Argument must be Integer.' unless interval.kind_of?(Integer)\n self.enable_reload = false if interval == 0 # Sett\n self.reload_interval = interval\n end",
"def Clockwork\n puts \"testing clockwork!\"\n every(30.seconds, 'Send Messages') {\n rake 'scheduler:send_messages'\n mail(:to => \"[email protected]\", subject: 'hello')\n }\n \nend",
"def worker_check_interval(interval); end",
"def work(interval = 5)\n register_signal_handlers\n \n Monque.logger.info \"*** Worker #{self} is going to work.\\n\"\n \n loop do\n break if @shutdown\n queues.each do |queue|\n while job = Monque.reserve(queue)\n Monque.logger.info \"\\n*** Performing job #{job.inspect}.\\n\"\n job.perform\n Monque.logger.info \"\\n*** Performed job #{job.inspect} successfully.\\n\"\n exit if @shutdown\n end\n end\n break if interval.to_i == 0\n sleep interval.to_i\n end\n end",
"def add_periodical delay, timer_proc\n\n return nil unless timer_proc\n\n timer = Timer.new :timers => self, :delay => delay, :periodical => true, :timer_proc => timer_proc\n add timer\n timer\n end",
"def enqueue_to_in(queue, interval, klass, *args); end",
"def <<(task)\n enqueue_task(task)\n end",
"def subscribe interval=1\n\t\t\treturn if @update_timer\n\n\t\t\tupdate_proc = proc {\n\t\t\t\tupdate do |status, result|\n\t\t\t\t\t@update_timer = EM::Timer.new(interval, update_proc) if @update_timer\n\t\t\t\tend\n\t\t\t}\n\n\t\t\t@update_timer = EM::Timer.new(interval, update_proc)\n\t\tend",
"def next_execute_time\n if (@count > 0 && @count <= @job.run_time) || @interval <= 0\n return nil\n end\n @next_time += @interval\n end",
"def add task\n\t\t\t@count+=1\n\t\t\t@tasks[@count] = task\n\t\t\tputs \"Added task #{task}.\"\n\t\t\tupdate\n\t\tend",
"def rocket_job_cron_next_time(time = Time.now)\n RocketJob::Plugins::Rufus::CronLine.new(cron_schedule).next_time(time)\n end",
"def rocket_job_cron_next_time(time = Time.now)\n RocketJob::Plugins::Rufus::CronLine.new(cron_schedule).next_time(time)\n end",
"def perform_in(interval, *args); end",
"def perform_in(interval, *args); end",
"def <<(task)\n raise ArgumentError, \"Task expected, got #{task.class}.\" unless task.is_a?(Task)\n\n @tasks << task unless @tasks.map(&:to_s).include?(task.to_s)\n end",
"def reschedule_at(time, attempts)\n case attempts\n when (0..4)\n interval = 1.minute\n when (5..6)\n interval = 5.minutes\n else\n interval = 10.minutes\n end\n time + interval\n end"
] | [
"0.6807595",
"0.6807595",
"0.64148045",
"0.63466895",
"0.6201277",
"0.616886",
"0.6147301",
"0.60302144",
"0.60302144",
"0.596489",
"0.59231305",
"0.5899942",
"0.5818921",
"0.5806204",
"0.5791733",
"0.57586944",
"0.562693",
"0.56242144",
"0.5621583",
"0.5581693",
"0.55715626",
"0.5542128",
"0.55352014",
"0.5500129",
"0.54947346",
"0.54888445",
"0.5473703",
"0.54703283",
"0.54589915",
"0.54191184",
"0.5404635",
"0.5381017",
"0.5360738",
"0.53303766",
"0.5324012",
"0.53057563",
"0.529153",
"0.52905285",
"0.5239845",
"0.5233946",
"0.5227171",
"0.5227171",
"0.52111584",
"0.52092564",
"0.5198403",
"0.51970345",
"0.5177241",
"0.515909",
"0.51485705",
"0.5130243",
"0.5129387",
"0.51223534",
"0.5090783",
"0.5084747",
"0.5078601",
"0.5052725",
"0.5050764",
"0.5050232",
"0.50502044",
"0.5041396",
"0.50350595",
"0.50254834",
"0.5021365",
"0.5020027",
"0.50181025",
"0.5014918",
"0.50081825",
"0.49848682",
"0.4982807",
"0.49812758",
"0.4977135",
"0.4964217",
"0.4954879",
"0.4944495",
"0.49375337",
"0.49322093",
"0.49261388",
"0.49257964",
"0.492575",
"0.49234754",
"0.491695",
"0.49139902",
"0.48892358",
"0.4872877",
"0.48679453",
"0.48562905",
"0.48554647",
"0.48551446",
"0.48533526",
"0.4838071",
"0.48338398",
"0.48274702",
"0.48221174",
"0.48202434",
"0.48125082",
"0.48125082",
"0.48045257",
"0.48045257",
"0.4795553",
"0.47873303"
] | 0.7794959 | 0 |
Return all tasks that should be run at startup. | def startup_tasks
self.tasks.select { |t| t.interval == :startup }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_tasks\n @top_level_tasks = []\n ARGV.each do |arg|\n if arg =~ /^(\\w+)=(.*)$/\n ENV[$1] = $2\n else\n @top_level_tasks << arg unless arg =~ /^-/\n end\n end\n @top_level_tasks.push(\"default\") if @top_level_tasks.size == 0\n end",
"def all_tasks\n @all_tasks ||= []\n end",
"def tasks\n config[:tasks]\n end",
"def tasks\n @tasks ||= Evoke.tasks\n end",
"def tasks\n TapirLogger.instance.log \"Getting tasks for #{self}\"\n tasks = TaskManager.instance.get_tasks_for(self)\n tasks.sort_by{ |t| t.name.downcase }\n end",
"def tasks\n TapirLogger.instance.log \"Getting tasks for #{self}\"\n tasks = TaskManager.instance.get_tasks_for(self)\n tasks.sort_by{ |t| t.name.downcase }\n end",
"def collect_tasks\n tasks = []\n $sake_op = {}\n ARGV.each do |arg|\n if arg =~ /^(\\w+)=(.*)$/\n ENV[$1] = $2\n $sake_op[$1.to_sym] = $2\n else\n tasks << arg\n end\n end\n tasks.push(\"default\") if tasks.size == 0\n tasks\n end",
"def scheduled_tasks\n self.tasks.select { \n |t| t.interval != :startup && t.interval != :shutdown\n }\n end",
"def tasks\n tasks = []\n @ProjectFileLoader.LoadedProjectFiles().each do |projectFile|\n tasks.concat(projectFile.tasks)\n end\n return tasks\n end",
"def tasks\n EarLogger.instance.log \"Getting tasks for #{self}\"\n TaskManager.instance.get_tasks_for(self)\n end",
"def load_tasks\n end",
"def tasks\n @task_manager.tasks_in_scope(@scope)\n end",
"def list_tasks\n config = instantiate_configuration\n config.load 'deploy'\n \n set_up_config(config)\n \n config.task_list(:all)\n end",
"def get_available_tasks\n tasks_to_return = []\n @tasks_names.each{ |t_name|\n tasks_to_return.push(@tasks[t_name])\n } \n return tasks_to_return\n end",
"def tasks\n @db[:tasks].keys.compact.uniq || []\n end",
"def custom_configure_tasks_for(a=nil)\n []\n end",
"def custom_configure_tasks_for(a=nil)\n []\n end",
"def registered_tasks\n # Get the task folder that contains the tasks.\n taskCollection = root_folder.GetTasks(0)\n array = []\n taskCollection.each do |registeredTask|\n array.push(registeredTask)\n end\n array\n end",
"def available_tasks\n gather_tasks = Proc.new do |tasks|\n Dir[File.join(Rooster::TASKS_DIR, \"*.rb\")].each do |filename|\n tasks << task_from_filename(filename) || next\n end\n end\n \n @@available_tasks ||= if Rails::VERSION::MAJOR == 2\n returning([]) {|tasks| gather_tasks.call(tasks) }\n elsif Rails::VERSION::MAJOR == 3\n [].tap {|tasks| gather_tasks.call(tasks)}\n else\n raise raise RuntimeError,\n \"Unknown Rails major version: '#{Rails::VERSION::MAJOR}'\"\n end\n end",
"def load_tasks\n RakeLoader.new.load_tasks\n end",
"def tasks\n @tasks ||= {}\n end",
"def all_tasks\n @task = Task.get_all_tasks_user_can_see(current_user)\n end",
"def all\n return @tasks\n end",
"def tasks\n @config.map do |task_name, options|\n task_params = options.symbolize_keys\n task_params[:queue_ahead] ||= @queue_ahead\n task_params[:name] = task_name\n task_params[:tz] ||= @time_zone\n Task.new(task_params)\n end\n end",
"def list_bare_tasks\n load_tasks\n\n Thor::Base.subclasses.each do |klass|\n unless klass == Thor\n klass.tasks.each do |t|\n puts \"#{klass.namespace}:#{t[0]}\"\n end\n end\n end\n end",
"def task_list\n return @task_list if @task_list\n @task_list = []\n spec_file_names.each do |file_name_spec|\n next if spec_is_disabled? file_name_spec\n next if skip_globals? file_name_spec\n next unless spec_included? file_name_spec\n get_spec_runs(file_name_spec).each do |run|\n next unless run[:hiera] and run[:facts]\n next unless facts_included? run[:facts]\n next unless hiera_included? run[:hiera]\n task = Noop::Task.new file_name_spec, run[:hiera], run[:facts]\n task.parallel = true if parallel_run?\n @task_list << task\n end\n end\n @task_list\n end",
"def tasks\n @task_manager.tasks_in_scope(@scope)\n end",
"def tasks\n if @tasks.nil?\n @tasks = tasks_by_filters\n @tasks = filter_by_tags(@tasks)\n @tasks += unread_tasks if session[:show_all_unread].to_i > 0\n @tasks = sort_tasks(@tasks)\n end\n\n return @tasks\n end",
"def tasks() []; end",
"def tasks_for_all_configurations\n @configurations.keys.collect{ |name| \"#{@project_name}:#{name}\"}\n end",
"def custom_install_tasks_for(a=nil)\n []\n end",
"def custom_install_tasks_for(a=nil)\n []\n end",
"def configure_tasks\n end",
"def tasks\n return @tasks\n end",
"def tasks\n return @tasks\n end",
"def tasks\n return @tasks\n end",
"def tasks\n if @tasks.nil?\n @tasks ||= (filtering_by_tags? ? tasks_by_tags : tasks_by_filters)\n @tasks = filter_by_properties(@tasks)\n @tasks = sort_tasks(@tasks)\n end\n\n return @tasks\n end",
"def load_tasks\n return if @loaded\n\n # By convention, the '*_helper.rb' files are helpers and need to be loaded first. Load\n # them into the Thor::Sandbox namespace\n Dir.glob( File.join(File.dirname(__FILE__), '**', '*.rb') ).each do |task|\n if task.match(/_helper\\.rb$/)\n #logger.debug \"load_thorfile helper: #{task}\"\n ::Thor::Util.load_thorfile task\n end\n end\n\n # Now load the thor files\n Dir.glob( File.join(File.dirname(__FILE__), '**', '*.rb') ).each do |task|\n unless task.match(/_helper\\.rb$/)\n #logger.debug \"load_thorfile: #{task}\"\n ::Thor::Util.load_thorfile task\n end\n end\n\n # load user tasks\n if user_tasks_folder\n Dir.glob( File.join([user_tasks_folder, '**', '*.{rb,thor}']) ).each { |task| ::Thor::Util.load_thorfile task if task.match(/_helper\\.rb$/) }\n Dir.glob( File.join([user_tasks_folder, '**', '*.{rb,thor}']) ).each { |task| ::Thor::Util.load_thorfile task unless task.match(/_helper\\.rb$/) }\n end\n\n @loaded = true\n end",
"def initialize\r\n load_tasks\r\n end",
"def onetime_rake_files\n tasks_dir = self.tasks_directory\n return [] unless Dir.exist?(tasks_dir) && !Dir.empty?(tasks_dir)\n\n Dir.glob(File.join('**', '*.rake'), base: tasks_dir)\n end",
"def all_tasks_to_run\n self.all_tasks - all_tasks_previously_run - all_tasks_duplicates\n end",
"def tasks\n @client.list_tasks(cluster: @cluster, service_name: @name)[0]\n end",
"def get_tasks_from_rakefiles\n\n # ensure we're starting out with no tasks or rakefiles\n clear_all_tasks_and_rakefiles\n\n rakefiles_to_read = onetime_rake_files\n\n return [] if rakefiles_to_read.empty?\n\n rakefiles_to_read.each(&method(:get_tasks_in_rakefile))\n\n self.all_tasks\n end",
"def tasks\n task_list.tasks\n end",
"def fetch_tasks\n tasks = BgTask.all\n tasks = load_tasks if tasks.nil? || tasks.empty?\n tasks\n end",
"def registered_tasks\n @task_register_lock.synchronize do\n @registered_tasks.values\n end\n end",
"def registered_tasks\n @task_register_lock.synchronize do\n @registered_tasks.values\n end\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def tasks\n @tasks ||= Harvest::API::Tasks.new(credentials)\n end",
"def tasks\n @tasks ||= Task.find(self.task_ids)\n end",
"def tasks\n ProjectConfiguration.templates[template]::TASKS\n end",
"def tasks\n ProjectConfiguration.templates[template]::TASKS\n end",
"def determine_visible_tasks\n [root_task] + determine_visible_subtasks(root_task)\n end",
"def all_rakefiles\n @all_rakefiles ||= new_hash_of_eval_rakefiles\n end",
"def tasks(wspace=workspace)\n\t\twspace.tasks\n\tend",
"def load_special_tasks\n $bot[:tasks][:list] = {\n block: -> do\n list_tasks\n end,\n desc: 'List all available tasks'\n }\n end",
"def actionable_tasks\n\t\tnext_tasks.select{ |t| !t.deferred? }\n\tend",
"def define_tasks\r\n define_repeat_task\r\n define_clobber_task\r\n define_build_task\r\n end",
"def invoked_tasks\n @invoked_tasks\n end",
"def own_tasks\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:task, RDF.type, Ruta::Class.task],\n [:task, Ruta::Property.has_creator, uri]\n )\n tasks = []\n query.each_solution { |sol| tasks.push(sol.task.as(Task)) }\n tasks\n end",
"def build_default_tasks\n @rake_task << self.step_template # get General Configuration information\n end",
"def capable_tasks() @capable_tasks ||= Task.children; end",
"def all_tasks\n self.stories.collect { |s| s.tasks }.flatten\n end",
"def define_tasks\n # Run the command on the local system\n def run(cmd)\n Kernel.system(cmd.runnable)\n end\n # Basic setup action\n def setup_application\n @options ||= PoolParty.options(ARGV.dup)\n end\n \n # Require the poolparty specific tasks\n compiled_rakefile\n \n desc \"Reload the static variables\"\n task :reload do\n reload!\n end\n true\n end",
"def active_tasks\n @tasks.select { | task | task.active }\n end",
"def list_tasks\n load_tasks\n\n # set '$thor_runner' to true to display full namespace\n $thor_runner = true\n\n list = [] #Thor.printable_tasks(all = true, subcommand = true)\n Thor::Base.subclasses.each do |klass|\n list += klass.printable_tasks(false) unless klass == Thor\n end\n list.sort!{ |a,b| a[0] <=> b[0] }\n\n title = \"repo_manager tasks\"\n shell.say shell.set_color(title, :blue, bold=true)\n shell.say \"-\" * title.size\n shell.print_table(list, :ident => 2, :truncate => true)\n end",
"def starting_tasks\n each_task.reject do |task|\n task.dependency_backward_any?\n end\n end",
"def work_tasks\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:task, RDF.type, Ruta::Class.task],\n [:task, Ruta::Property.has_worker, uri]\n )\n tasks = []\n query.each_solution { |sol| tasks.push(sol.task.as(Task)) }\n tasks\n end",
"def build_tasks\n all_output.split(\"\\n\").map do |task|\n next unless task.start_with? 'rake'\n task.split(\"#\").map{|t| t.strip.sub(/^rake /, '')}\n end.compact\n end",
"def tasks\n return @tasks.values\n end",
"def shutdown_tasks\n self.tasks.select { |t| t.interval == :shutdown }\n end",
"def tasks\n return self.class.get('/tasks').parsed_response.map do |task|\n Task.new(\n task['task_id'],\n task['template_id'],\n task['status'],\n task['started_at']\n )\n end\n end",
"def get_tasks_targets\n @test_pack.get_active_tests\n end",
"def task_lists\n\t\t@task_lists ||= fetch_latest_task_lists\n\tend",
"def tasks\n @tasks.values.sort_by { |t| t.name }\n end",
"def list_available_build_tasks\n cd 'cookbooks/example'\n unset_bundler_env_vars\n run_simple 'bundle exec rake -T'\n end",
"def define_tasks\r\n define_clobber_task\r\n define_build_task\r\n end",
"def rake_tasks(&block); end",
"def rake_tasks(&block); end",
"def task_files\r\n Dir.chdir(Rails.root.join('lib', 'tasks')) do |dir|\r\n @task_files = Dir[\"*.rake\"]\r\n end\r\n @task_files = @task_files.reject{|task|\r\n task !~ /\\Abg_worker_/}.map{|task|\r\n task.sub('bg_worker_', '')\r\n }\r\n end",
"def default_tasks\n\t\t@default_tasks ||= Product.where(job_type: self.job_type.to_s)\n\tend",
"def rakefiles_with_tasks_to_run\n\n rakefiles_with_tasks = new_hash_of_eval_rakefiles\n\n # This isn't efficient, but it's clear:\n all_tasks_to_run.each do |task_to_run|\n rakefilename = task_to_run.filename\n ev_rakefile_to_run = self.all_rakefiles[rakefilename]\n ev_rakefile_to_run.tasks_to_run << task_to_run\n rakefiles_with_tasks[rakefilename] = ev_rakefile_to_run\n end\n\n rakefiles_with_tasks\n end",
"def create_tasks\n Application.features[self].each{ |f|\n extend Rake::DSL\n taskname = \"#{f.to_s.split('::').last}\"\n desc \"Feature\"\n task taskname => [\"#{taskname}:install\"] do\n end\n namespace taskname do\n desc \"install #{taskname}\"\n task :install do\n puts \"----> installing #{taskname}\"\n puts \"#{self} | #{f}\"\n Application.install[f.name].each{ |c|\n puts \"#{c}\"\n }\n end\n end \n } if Application.features[self]\n end",
"def task_names\n @task_names ||= tasks.map { |task| task.name.underscore }\n end",
"def task_triggers\n return @task_triggers\n end",
"def get_tasks\n\n\ttasks = Task.all.shuffle\n\n\treturned_tasks = []\n\trand(10..18).times do\n\t\treturned_tasks << tasks.pop\n\tend\n\n\treturned_tasks\nend",
"def make_tasks\n make_clean_task\n make_wix_folder_task\n make_copy_file_tasks\n make_sourcery_wxs_file_task\n make_sourcery_wixobj_file_task\n make_product_wxs_file_task\n make_product_wixobj_file_task\n make_msi_file_task\n make_msi_task\n make_test_task\n end",
"def list_user_tasks\n\t\t@tasks = current_user.get_developer_tasks\n\tend",
"def _wait_tasks\n @wait_tasks\n end",
"def launch_tasks\n config.prepare_task.run if config.prepare_task\n\n # level = 1\n Parallel.map(root.children, config.parallel => root.children.size) do |node|\n logger.info(\"Run locally. localhost => #{node.host}\")\n config.local_task.run(root.host, node.host)\n end\n # level in (2..depth)\n fork_remote_tasks(root.children)\n\n config.finish_task.run if config.finish_task\n end",
"def list_all_tasks\n task = Task.all\nend",
"def get_tasks(param_map, *args)\n #Strip off the first element, since it is not a Task\n get(\"tasks\", param_map, Babar::Task, true, *args)\n end",
"def upgrade_tasks\n if ENV['UPGRADE'].present?\n ENV['UPGRADE'].split(',')\n else\n all_upgrade_tasks\n end\n end",
"def tasks\n\t\t@tasks ||= if self.id.nil?\n\t\t\t[]\n\t\telse\n\t\t\tt_arr = document.tasks.select(container_id: self.id)\n\t\t\ti = 0\n\t\t\twhile i < t_arr.size\n\t\t\t\ttask = t_arr[i]\n\t\t\t\tif task.has_subtasks?\n\t\t\t\t\tt_arr += t_arr.delete_at(i).tasks\n\t\t\t\telse\n\t\t\t\t\ti += 1\n\t\t\t\tend\n\t\t\tend\n\t\t\tt_arr\n\t\tend\n\tend",
"def tasks_all(parameters={ })\n parameters[:conditions]=conditions(parameters[:conditions])\n parameters[:include]= to_include + (parameters[:include]||[])\n return user.company.tasks.all(parameters)\n end",
"def immediate_tasks\n\t\tdocument.tasks.select(container_id: self.id)\n\tend",
"def initialize # Initialize method that is similar to a Constructor in Java\n @all_tasks = [] # Method includes an array that stores all tasks\n end",
"def rakefiles\n @rakefiles ||= []\n end",
"def tasks_list\n (self.tasks || EMPTY_STRING).scan(/\\d+/).map{|x| x.to_i}.sort.uniq\n end",
"def registeredTasks _args\n \"registeredTasks _args;\" \n end"
] | [
"0.74070156",
"0.7296949",
"0.72532713",
"0.7242283",
"0.7216893",
"0.7216893",
"0.7200142",
"0.71659696",
"0.71349317",
"0.70957625",
"0.70800424",
"0.70732987",
"0.70547897",
"0.6996462",
"0.6990743",
"0.6955508",
"0.6951715",
"0.6935978",
"0.6923637",
"0.6914516",
"0.691395",
"0.69089144",
"0.6888084",
"0.68797904",
"0.68433446",
"0.68395084",
"0.68343526",
"0.68126935",
"0.68051165",
"0.67995894",
"0.6777407",
"0.6755546",
"0.6735296",
"0.6715562",
"0.6715562",
"0.6715562",
"0.6694481",
"0.6666921",
"0.66123545",
"0.6605799",
"0.65877026",
"0.655488",
"0.6553602",
"0.654522",
"0.6535019",
"0.651391",
"0.6513526",
"0.65050566",
"0.6497298",
"0.6463004",
"0.6461424",
"0.6461424",
"0.6450599",
"0.64407206",
"0.6420849",
"0.6414285",
"0.64031947",
"0.6399538",
"0.6387564",
"0.63728213",
"0.63693714",
"0.63575715",
"0.6343669",
"0.63402236",
"0.6315799",
"0.6315303",
"0.6298226",
"0.6279313",
"0.62651104",
"0.6257589",
"0.62507355",
"0.6206976",
"0.62034243",
"0.62031585",
"0.6201943",
"0.61980695",
"0.6195231",
"0.61942446",
"0.61942446",
"0.6162202",
"0.615712",
"0.61287534",
"0.61257917",
"0.6116679",
"0.6105128",
"0.6104993",
"0.60893553",
"0.6087942",
"0.6070045",
"0.6059658",
"0.60534066",
"0.603045",
"0.59996563",
"0.59956825",
"0.5993473",
"0.5991044",
"0.598994",
"0.5985596",
"0.597994",
"0.59419906"
] | 0.83647007 | 0 |
Return all tasks that should be run at shutdown. | def shutdown_tasks
self.tasks.select { |t| t.interval == :shutdown }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scheduled_tasks\n self.tasks.select { \n |t| t.interval != :startup && t.interval != :shutdown\n }\n end",
"def startup_tasks\n self.tasks.select { |t| t.interval == :startup }\n end",
"def all_tasks\n @all_tasks ||= []\n end",
"def all_tasks_to_run\n self.all_tasks - all_tasks_previously_run - all_tasks_duplicates\n end",
"def tasks\n @db[:tasks].keys.compact.uniq || []\n end",
"def shutdown_all\n # TODO: implement\n shutdown\n end",
"def tasks() []; end",
"def run_exit_tasks!; end",
"def tasks\n @tasks ||= Evoke.tasks\n end",
"def get_available_tasks\n tasks_to_return = []\n @tasks_names.each{ |t_name|\n tasks_to_return.push(@tasks[t_name])\n } \n return tasks_to_return\n end",
"def actionable_tasks\n\t\tnext_tasks.select{ |t| !t.deferred? }\n\tend",
"def tasks\n TapirLogger.instance.log \"Getting tasks for #{self}\"\n tasks = TaskManager.instance.get_tasks_for(self)\n tasks.sort_by{ |t| t.name.downcase }\n end",
"def tasks\n TapirLogger.instance.log \"Getting tasks for #{self}\"\n tasks = TaskManager.instance.get_tasks_for(self)\n tasks.sort_by{ |t| t.name.downcase }\n end",
"def registered_tasks\n @task_register_lock.synchronize do\n @registered_tasks.values\n end\n end",
"def registered_tasks\n @task_register_lock.synchronize do\n @registered_tasks.values\n end\n end",
"def ending_tasks\n each_task.reject do |task|\n task.dependency_forward_any?\n end\n end",
"def all\n return @tasks\n end",
"def tasks\n @task_manager.tasks_in_scope(@scope)\n end",
"def tasks\n return @tasks\n end",
"def tasks\n return @tasks\n end",
"def tasks\n return @tasks\n end",
"def tasks\n EarLogger.instance.log \"Getting tasks for #{self}\"\n TaskManager.instance.get_tasks_for(self)\n end",
"def list_tasks\n config = instantiate_configuration\n config.load 'deploy'\n \n set_up_config(config)\n \n config.task_list(:all)\n end",
"def clear()\n shutdown()\n @tasks = {}\n _clear()\n end",
"def tasks\n @tasks ||= {}\n end",
"def tasks\n if @tasks.nil?\n @tasks = tasks_by_filters\n @tasks = filter_by_tags(@tasks)\n @tasks += unread_tasks if session[:show_all_unread].to_i > 0\n @tasks = sort_tasks(@tasks)\n end\n\n return @tasks\n end",
"def registered_tasks\n # Get the task folder that contains the tasks.\n taskCollection = root_folder.GetTasks(0)\n array = []\n taskCollection.each do |registeredTask|\n array.push(registeredTask)\n end\n array\n end",
"def tasks\n @task_manager.tasks_in_scope(@scope)\n end",
"def inactive_tasks\n @tasks.select { | task | ! task.active }\n end",
"def tasks\n return @tasks.values\n end",
"def shutdown\n @size.times do\n schedule { throw :exit }\n end\n\n @pool.map(&:join)\n end",
"def starting_tasks\n each_task.reject do |task|\n task.dependency_backward_any?\n end\n end",
"def _wait_tasks\n @wait_tasks\n end",
"def shutdown\n @size.times do\n schedule { throw :exit }\n end\n @pool.map(&:join)\n end",
"def shutdown!\n @pool.each(&:shutdown!)\n end",
"def wakeup()\n @tasks.each_value { |t| t.wakeup() }\n end",
"def tasks\n config[:tasks]\n end",
"def stop_tasks\n logger.info(\"STOP TASKS!\")\n if @async_type != :sync\n ExecutorsPool.stop('TaskRunnableLater')\n ExecutorsPool.stop('TaskRunnable')\n else\n logger.info(\"RunningCode in sync mode\")\n end\n end",
"def collect_tasks\n @top_level_tasks = []\n ARGV.each do |arg|\n if arg =~ /^(\\w+)=(.*)$/\n ENV[$1] = $2\n else\n @top_level_tasks << arg unless arg =~ /^-/\n end\n end\n @top_level_tasks.push(\"default\") if @top_level_tasks.size == 0\n end",
"def shutdown_workers\n # Each worker thread will receive this exactly once!\n @worker_threads.each do |t|\n @logger.debug(\"Pushing shutdown\", :thread => t.inspect)\n @signal_queue.push(SHUTDOWN)\n end\n\n @worker_threads.each do |t|\n @logger.debug(\"Shutdown waiting for worker thread #{t}\")\n t.join\n end\n\n @filters.each(&:do_close)\n @outputs.each(&:do_close)\n end",
"def stop_all\n checklist = registry.checked_workers( policy )\n checklist.live.each { |key| reap(key) }\n checklist.late.each { |key| reap(key) }\n checklist.hung.each { |key| reap(key) }\n checklist.dead.each { |key| reap(key) }\n end",
"def task_files\r\n Dir.chdir(Rails.root.join('lib', 'tasks')) do |dir|\r\n @task_files = Dir[\"*.rake\"]\r\n end\r\n @task_files = @task_files.reject{|task|\r\n task !~ /\\Abg_worker_/}.map{|task|\r\n task.sub('bg_worker_', '')\r\n }\r\n end",
"def tasks_for_all_configurations\n @configurations.keys.collect{ |name| \"#{@project_name}:#{name}\"}\n end",
"def all_tasks\n @task = Task.get_all_tasks_user_can_see(current_user)\n end",
"def work_tasks\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:task, RDF.type, Ruta::Class.task],\n [:task, Ruta::Property.has_worker, uri]\n )\n tasks = []\n query.each_solution { |sol| tasks.push(sol.task.as(Task)) }\n tasks\n end",
"def tasks\n task_list.tasks\n end",
"def fetch_tasks\n tasks = BgTask.all\n tasks = load_tasks if tasks.nil? || tasks.empty?\n tasks\n end",
"def onetime_rake_files\n tasks_dir = self.tasks_directory\n return [] unless Dir.exist?(tasks_dir) && !Dir.empty?(tasks_dir)\n\n Dir.glob(File.join('**', '*.rake'), base: tasks_dir)\n end",
"def shutdown\n @size.times do\n schedule { throw :exit }\n end\n\n @pool.map(&:join)\n\n true\n end",
"def tasks\n if @tasks.nil?\n @tasks ||= (filtering_by_tags? ? tasks_by_tags : tasks_by_filters)\n @tasks = filter_by_properties(@tasks)\n @tasks = sort_tasks(@tasks)\n end\n\n return @tasks\n end",
"def shutdown\n @@servers.values.each do |server|\n server.disconnect\n server.scheduler.remove_all\n end\n end",
"def tasks\n @client.list_tasks(cluster: @cluster, service_name: @name)[0]\n end",
"def tasks\n tasks = []\n @ProjectFileLoader.LoadedProjectFiles().each do |projectFile|\n tasks.concat(projectFile.tasks)\n end\n return tasks\n end",
"def shutdown(flush_first=false)\n # block all tasks first so threads can empty queues\n @tasks.each_value do |task|\n task.state = Task::BLOCKED\n end\n # shutdown and wait for queues to empty if necessary\n @tasks.each_value do |task|\n task.shutdown(flush_first)\n end\n @tasks = {}\n end",
"def tasks(wspace=workspace)\n\t\twspace.tasks\n\tend",
"def shutdown\n executor.shutdown\n end",
"def task_list\n return @task_list if @task_list\n @task_list = []\n spec_file_names.each do |file_name_spec|\n next if spec_is_disabled? file_name_spec\n next if skip_globals? file_name_spec\n next unless spec_included? file_name_spec\n get_spec_runs(file_name_spec).each do |run|\n next unless run[:hiera] and run[:facts]\n next unless facts_included? run[:facts]\n next unless hiera_included? run[:hiera]\n task = Noop::Task.new file_name_spec, run[:hiera], run[:facts]\n task.parallel = true if parallel_run?\n @task_list << task\n end\n end\n @task_list\n end",
"def shutdown_all( url, &block )\n dispatchers.connect( url ).stats {\n |stats|\n log.dispatcher_global_shutdown( env, url )\n\n stats['running_jobs'].each {\n |instance|\n\n next if instance['helpers']['rank'] == 'slave'\n\n save_and_shutdown( instance['url'] ){\n log.instance_shutdown( env, instance['url'] )\n }\n }\n block.call\n }\n end",
"def collect_tasks\n tasks = []\n $sake_op = {}\n ARGV.each do |arg|\n if arg =~ /^(\\w+)=(.*)$/\n ENV[$1] = $2\n $sake_op[$1.to_sym] = $2\n else\n tasks << arg\n end\n end\n tasks.push(\"default\") if tasks.size == 0\n tasks\n end",
"def available_tasks\n gather_tasks = Proc.new do |tasks|\n Dir[File.join(Rooster::TASKS_DIR, \"*.rb\")].each do |filename|\n tasks << task_from_filename(filename) || next\n end\n end\n \n @@available_tasks ||= if Rails::VERSION::MAJOR == 2\n returning([]) {|tasks| gather_tasks.call(tasks) }\n elsif Rails::VERSION::MAJOR == 3\n [].tap {|tasks| gather_tasks.call(tasks)}\n else\n raise raise RuntimeError,\n \"Unknown Rails major version: '#{Rails::VERSION::MAJOR}'\"\n end\n end",
"def invoked_tasks\n @invoked_tasks\n end",
"def custom_configure_tasks_for(a=nil)\n []\n end",
"def custom_configure_tasks_for(a=nil)\n []\n end",
"def tasks\n @tasks.values.sort_by { |t| t.name }\n end",
"def active_tasks\n @tasks.select { | task | task.active }\n end",
"def clean\n # Each the tasks\n @tasks.each do |task|\n # Clean all of them\n task.clean\n end\n end",
"def shutdown\n\n get_list['list'].each do |re, (kl, op)|\n\n kl = (Ruote.constantize(kl) rescue nil)\n\n if (kl.instance_method(:shutdown) rescue false)\n initialize_participant(kl, op).shutdown\n end\n end\n end",
"def get_tasks\n\n\ttasks = Task.all.shuffle\n\n\treturned_tasks = []\n\trand(10..18).times do\n\t\treturned_tasks << tasks.pop\n\tend\n\n\treturned_tasks\nend",
"def at_exit_procs\n @at_exit_procs ||= []\n end",
"def shutdown\n @threads.each { |thread| thread.kill if thread.respond_to?(:kill) }\n @threads.map! { nil }\n end",
"def done\n done_ids = @tasks.keys.find_all do |id|\n @tasks[id].done?\n end\n done_tasks = done_ids.inject({}) do |map, id|\n map[id] = @tasks[id]\n map\n end\n done_ids.each do |id|\n @tasks.delete(id)\n end\n return done_tasks\n end",
"def get_tasks_from_rakefiles\n\n # ensure we're starting out with no tasks or rakefiles\n clear_all_tasks_and_rakefiles\n\n rakefiles_to_read = onetime_rake_files\n\n return [] if rakefiles_to_read.empty?\n\n rakefiles_to_read.each(&method(:get_tasks_in_rakefile))\n\n self.all_tasks\n end",
"def shutdown\n\n ([ @storage ] + @services.values).each do |s|\n s.shutdown if s.respond_to?(:shutdown)\n end\n end",
"def schtasks_query_ievms\n out, _, _ = guestcontrol_exec \"schtasks.exe\", \"schtasks.exe /query /tn ievms\"\n out\n end",
"def run_ready\n items = to_run.find_all(&:ready?)\n to_run.delete_if do |item|\n items.include?(item)\n end\n items.map do |item|\n begin\n item.run! unless item.cancelled?\n rescue DeadException\n item.cancel\n rescue => e\n Zoidberg.logger.error \"<#{self}> Timed action generated an error: #{e.class.name} - #{e}\"\n end\n item if item.recur\n end.compact.each do |item|\n to_run << item\n end\n current_self\n end",
"def shutdown\n shutdown_message\n @actions.each(&:shutdown)\n @threads.each(&:exit)\n end",
"def failed_tasks\n return @failed_tasks\n end",
"def failed_tasks\n return @failed_tasks\n end",
"def list_bare_tasks\n load_tasks\n\n Thor::Base.subclasses.each do |klass|\n unless klass == Thor\n klass.tasks.each do |t|\n puts \"#{klass.namespace}:#{t[0]}\"\n end\n end\n end\n end",
"def all_tasks\n self.stories.collect { |s| s.tasks }.flatten\n end",
"def all_rakefiles\n @all_rakefiles ||= new_hash_of_eval_rakefiles\n end",
"def stop()\n @tasks.each_value { |task| task.stop() }\n end",
"def shutdown_pending?\n @shutdown ||= false\n end",
"def custom_install_tasks_for(a=nil)\n []\n end",
"def getSubtasks\r\n\t\t\t\t\treturn @tasks\r\n\t\t\t\tend",
"def custom_install_tasks_for(a=nil)\n []\n end",
"def upgrade_tasks\n if ENV['UPGRADE'].present?\n ENV['UPGRADE'].split(',')\n else\n all_upgrade_tasks\n end\n end",
"def with_force_shutdown; end",
"def tasks\n @config.map do |task_name, options|\n task_params = options.symbolize_keys\n task_params[:queue_ahead] ||= @queue_ahead\n task_params[:name] = task_name\n task_params[:tz] ||= @time_zone\n Task.new(task_params)\n end\n end",
"def tasks\n @tasks ||= Task.find(self.task_ids)\n end",
"def execution_error_tasks\n @execution_error_tasks ||= failed_tasks.select(&:execution_error?)\n end",
"def index\n @shutdown_requests = {\n completed: ShutdownRequest.completed.order(sort_column + \" \" + sort_direction),\n waiting: ShutdownRequest.waiting.order(sort_column + \" \" + sort_direction),\n all: ShutdownRequest.all.order(sort_column + \" \" + sort_direction),\n }\n end",
"def shutdown\n thread_pool.shutdown\n wait\n end",
"def unassigned_tasks\n output = []\n @@task_types.each do |association_symbol|\n output = output + self.send(association_symbol).unassigned\n end\n output\n end",
"def shutdown\n @thread_pool.shutdown\n end",
"def shutdown\n @executor.shutdown\n nil\n end",
"def task_lists\n\t\t@task_lists ||= fetch_latest_task_lists\n\tend",
"def task_triggers\n return @task_triggers\n end",
"def own_tasks\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:task, RDF.type, Ruta::Class.task],\n [:task, Ruta::Property.has_creator, uri]\n )\n tasks = []\n query.each_solution { |sol| tasks.push(sol.task.as(Task)) }\n tasks\n end",
"def capable_tasks() @capable_tasks ||= Task.children; end"
] | [
"0.74999547",
"0.6925326",
"0.67300475",
"0.6700755",
"0.6670325",
"0.6650546",
"0.6626348",
"0.65551203",
"0.6524475",
"0.64689064",
"0.64141977",
"0.6407539",
"0.6407539",
"0.63943416",
"0.6394324",
"0.6362615",
"0.6319951",
"0.63094974",
"0.62779015",
"0.62779015",
"0.62779015",
"0.62707144",
"0.6215029",
"0.61922455",
"0.617639",
"0.61575603",
"0.6143873",
"0.6140531",
"0.6127497",
"0.61169237",
"0.6114857",
"0.6111039",
"0.6078333",
"0.60662377",
"0.60616934",
"0.60591567",
"0.60449517",
"0.59925425",
"0.5979935",
"0.5963829",
"0.596271",
"0.5942728",
"0.5924624",
"0.59081835",
"0.59027475",
"0.59016216",
"0.5882113",
"0.5857044",
"0.58485",
"0.58460987",
"0.5844438",
"0.5828547",
"0.5827737",
"0.5825084",
"0.5821757",
"0.5809418",
"0.58051664",
"0.58035517",
"0.58028156",
"0.58025074",
"0.57602245",
"0.5753688",
"0.5753416",
"0.5749584",
"0.5738376",
"0.5726149",
"0.5723705",
"0.57201713",
"0.57188433",
"0.5706662",
"0.5696397",
"0.5683226",
"0.56826997",
"0.5674646",
"0.56668305",
"0.5656186",
"0.5642897",
"0.5642897",
"0.5639361",
"0.56371933",
"0.56303036",
"0.5628907",
"0.56253195",
"0.5613303",
"0.5605408",
"0.5602205",
"0.55988616",
"0.55980533",
"0.557731",
"0.5574324",
"0.5564245",
"0.55564606",
"0.5533527",
"0.55312645",
"0.55267704",
"0.5516315",
"0.5508432",
"0.5506363",
"0.5499532",
"0.5492125"
] | 0.8636883 | 0 |
Return all tasks that should be scheduled. | def scheduled_tasks
self.tasks.select {
|t| t.interval != :startup && t.interval != :shutdown
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all\n return @tasks\n end",
"def all_tasks\n @all_tasks ||= []\n end",
"def actionable_tasks\n\t\tnext_tasks.select{ |t| !t.deferred? }\n\tend",
"def get_available_tasks\n tasks_to_return = []\n @tasks_names.each{ |t_name|\n tasks_to_return.push(@tasks[t_name])\n } \n return tasks_to_return\n end",
"def all_tasks\n @task = Task.get_all_tasks_user_can_see(current_user)\n end",
"def tasks\n if @tasks.nil?\n @tasks = tasks_by_filters\n @tasks = filter_by_tags(@tasks)\n @tasks += unread_tasks if session[:show_all_unread].to_i > 0\n @tasks = sort_tasks(@tasks)\n end\n\n return @tasks\n end",
"def tasks\n @db[:tasks].keys.compact.uniq || []\n end",
"def all_tasks_to_run\n self.all_tasks - all_tasks_previously_run - all_tasks_duplicates\n end",
"def tasks\n TapirLogger.instance.log \"Getting tasks for #{self}\"\n tasks = TaskManager.instance.get_tasks_for(self)\n tasks.sort_by{ |t| t.name.downcase }\n end",
"def tasks\n TapirLogger.instance.log \"Getting tasks for #{self}\"\n tasks = TaskManager.instance.get_tasks_for(self)\n tasks.sort_by{ |t| t.name.downcase }\n end",
"def startup_tasks\n self.tasks.select { |t| t.interval == :startup }\n end",
"def tasks\n if @tasks.nil?\n @tasks ||= (filtering_by_tags? ? tasks_by_tags : tasks_by_filters)\n @tasks = filter_by_properties(@tasks)\n @tasks = sort_tasks(@tasks)\n end\n\n return @tasks\n end",
"def tasks\n @task_manager.tasks_in_scope(@scope)\n end",
"def tasks\n EarLogger.instance.log \"Getting tasks for #{self}\"\n TaskManager.instance.get_tasks_for(self)\n end",
"def all_tasks\n self.stories.collect { |s| s.tasks }.flatten\n end",
"def tasks\n return @tasks\n end",
"def tasks\n return @tasks\n end",
"def tasks\n return @tasks\n end",
"def tasks_all(parameters={ })\n parameters[:conditions]=conditions(parameters[:conditions])\n parameters[:include]= to_include + (parameters[:include]||[])\n return user.company.tasks.all(parameters)\n end",
"def tasks\n task_list.tasks\n end",
"def tasks\n return @tasks.values\n end",
"def tasks\n @task_manager.tasks_in_scope(@scope)\n end",
"def registered_tasks\n # Get the task folder that contains the tasks.\n taskCollection = root_folder.GetTasks(0)\n array = []\n taskCollection.each do |registeredTask|\n array.push(registeredTask)\n end\n array\n end",
"def tasks\n @config.map do |task_name, options|\n task_params = options.symbolize_keys\n task_params[:queue_ahead] ||= @queue_ahead\n task_params[:name] = task_name\n task_params[:tz] ||= @time_zone\n Task.new(task_params)\n end\n end",
"def list_tasks\n config = instantiate_configuration\n config.load 'deploy'\n \n set_up_config(config)\n \n config.task_list(:all)\n end",
"def schedules\n workers.map(&:schedule)\n end",
"def work_tasks\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:task, RDF.type, Ruta::Class.task],\n [:task, Ruta::Property.has_worker, uri]\n )\n tasks = []\n query.each_solution { |sol| tasks.push(sol.task.as(Task)) }\n tasks\n end",
"def tasks\n @tasks.values.sort_by { |t| t.name }\n end",
"def own_tasks\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:task, RDF.type, Ruta::Class.task],\n [:task, Ruta::Property.has_creator, uri]\n )\n tasks = []\n query.each_solution { |sol| tasks.push(sol.task.as(Task)) }\n tasks\n end",
"def tasks\n\t\t@tasks ||= if self.id.nil?\n\t\t\t[]\n\t\telse\n\t\t\tt_arr = document.tasks.select(container_id: self.id)\n\t\t\ti = 0\n\t\t\twhile i < t_arr.size\n\t\t\t\ttask = t_arr[i]\n\t\t\t\tif task.has_subtasks?\n\t\t\t\t\tt_arr += t_arr.delete_at(i).tasks\n\t\t\t\telse\n\t\t\t\t\ti += 1\n\t\t\t\tend\n\t\t\tend\n\t\t\tt_arr\n\t\tend\n\tend",
"def tasks\n @tasks ||= Evoke.tasks\n end",
"def tasks\n @tasks ||= {}\n end",
"def task_list\n return @task_list if @task_list\n @task_list = []\n spec_file_names.each do |file_name_spec|\n next if spec_is_disabled? file_name_spec\n next if skip_globals? file_name_spec\n next unless spec_included? file_name_spec\n get_spec_runs(file_name_spec).each do |run|\n next unless run[:hiera] and run[:facts]\n next unless facts_included? run[:facts]\n next unless hiera_included? run[:hiera]\n task = Noop::Task.new file_name_spec, run[:hiera], run[:facts]\n task.parallel = true if parallel_run?\n @task_list << task\n end\n end\n @task_list\n end",
"def tasks\n return self.class.get('/tasks').parsed_response.map do |task|\n Task.new(\n task['task_id'],\n task['template_id'],\n task['status'],\n task['started_at']\n )\n end\n end",
"def tasks\n tasks = []\n @ProjectFileLoader.LoadedProjectFiles().each do |projectFile|\n tasks.concat(projectFile.tasks)\n end\n return tasks\n end",
"def registered_tasks\n @task_register_lock.synchronize do\n @registered_tasks.values\n end\n end",
"def registered_tasks\n @task_register_lock.synchronize do\n @registered_tasks.values\n end\n end",
"def active_tasks\n @tasks.select { | task | task.active }\n end",
"def all\n Array(@@job_scheduler_instance)\n end",
"def tasks\n @tasks ||= Task.find(self.task_ids)\n end",
"def tasks\n @client.list_tasks(cluster: @cluster, service_name: @name)[0]\n end",
"def schedules\n\t\t@schedules = Schedule.includes(:schedulable).all\n\tend",
"def active_tasks\n output = []\n @@task_types.each do |association_symbol|\n output = output + self.send(association_symbol).active\n end\n output\n end",
"def list_all_tasks\n task = Task.all\nend",
"def shutdown_tasks\n self.tasks.select { |t| t.interval == :shutdown }\n end",
"def all_schedules\n non_persistent_schedules.merge(persistent_schedules)\n end",
"def list_bare_tasks\n load_tasks\n\n Thor::Base.subclasses.each do |klass|\n unless klass == Thor\n klass.tasks.each do |t|\n puts \"#{klass.namespace}:#{t[0]}\"\n end\n end\n end\n end",
"def immediate_tasks\n\t\tdocument.tasks.select(container_id: self.id)\n\tend",
"def get_tasks_for_organisation(_organisation)\n Task.all\n end",
"def get_tasks\n\n\ttasks = Task.all.shuffle\n\n\treturned_tasks = []\n\trand(10..18).times do\n\t\treturned_tasks << tasks.pop\n\tend\n\n\treturned_tasks\nend",
"def determine_visible_tasks\n [root_task] + determine_visible_subtasks(root_task)\n end",
"def fetch_tasks\n tasks = BgTask.all\n tasks = load_tasks if tasks.nil? || tasks.empty?\n tasks\n end",
"def get_tasks(param_map, *args)\n #Strip off the first element, since it is not a Task\n get(\"tasks\", param_map, Babar::Task, true, *args)\n end",
"def tasks\n config[:tasks]\n end",
"def get_sorted_list_of_tasks\r\n tasks = @current_user.tasks.find(:all, :conditions => {:is_finished => false, :active_task => true})\r\n unstarted_tasks = @current_user.tasks.find(:all, :conditions => {:is_finished => false, :started_at => nil}).sort_by {|t| t.created_at}\r\n finished_tasks = @current_user.tasks.find(:all, :conditions => {:is_finished => true}).sort_by {|t| t.created_at}\r\n\r\n tasks.concat(unstarted_tasks).concat(finished_tasks)\r\n return tasks\r\n end",
"def active_tasks(tasks)\n tasks.select { |task| task.completed_at.nil? }\n end",
"def custom_configure_tasks_for(a=nil)\n []\n end",
"def get_tasks_from_rakefiles\n\n # ensure we're starting out with no tasks or rakefiles\n clear_all_tasks_and_rakefiles\n\n rakefiles_to_read = onetime_rake_files\n\n return [] if rakefiles_to_read.empty?\n\n rakefiles_to_read.each(&method(:get_tasks_in_rakefile))\n\n self.all_tasks\n end",
"def tasks_list\n (self.tasks || EMPTY_STRING).scan(/\\d+/).map{|x| x.to_i}.sort.uniq\n end",
"def get_all_tasks(child_name)\n command_o_tasks, identifier_o_tasks = [], []\n command_o_tasks = (self[:all][child_name]||[]) + (self[:command_only][child_name]||[])\n identifier_o_tasks = (self[:all][child_name]||[]) + (self[:identifier_only][child_name]||[])\n return command_o_tasks, identifier_o_tasks\n end",
"def scheduled\n response = get 'scheduled'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def custom_configure_tasks_for(a=nil)\n []\n end",
"def tasks\n colocated_tasks_grouped = ColocatedTask.where(assigned_by: user).group_by(&:appeal_id)\n on_hold_legacy_tasks = colocated_tasks_grouped.each_with_object([]) do |(_k, value), result|\n # Attorneys can assign multiple admin actions per appeal, we assume a case is still on hold\n # if not all admin actions are completed\n next if value.map(&:status).uniq == [Constants.TASK_STATUSES.completed]\n result << value.each do |record|\n record.placed_on_hold_at = record.assigned_at\n record.status = Constants.TASK_STATUSES.on_hold\n end\n result\n end\n ama_tasks = Task.incomplete_or_recently_completed\n .where(assigned_to: user, type: [AttorneyTask.name, QualityReviewTask.name])\n (on_hold_legacy_tasks + ama_tasks).flatten\n end",
"def tasks(extra_conditions = nil, limit_tasks = true)\n limit = (limit_tasks ? 500 : nil)\n return user.company.tasks.all(:conditions => conditions(extra_conditions),\n :include => to_include,\n :limit => limit)\n end",
"def tasks(wspace=workspace)\n\t\twspace.tasks\n\tend",
"def capable_tasks() @capable_tasks ||= Task.children; end",
"def due_tasks\n tasks = []\n\n all_tasks.each do |task|\n due = task.due_date.get\n\n if due.is_a?(Time) && due > Time.new\n tasks << Task.new(task.name.get, due)\n end\n end\n\n # Sorts the array of tasks by due_date\n tasks.sort! { |a,b| a.due_date <=> b.due_date }\n end",
"def all_subtasks task\n [task] + task.tasks.get.flatten.map{|t| all_subtasks(t) }\n end",
"def task_list\n self.tasks.map do |task|\n task.text\n end\n end",
"def task_schedule\n user = User.find(2)\n name = user.name\n tasks = user.tasks.where(scheduled_date: Date.today).where.not(status: 2).where(send_mail: true)\n UserMailer.task_schedule(user, name, tasks)\n end",
"def getSubtasks\r\n\t\t\t\t\treturn @tasks\r\n\t\t\t\tend",
"def tasks() []; end",
"def tasks_for_all_configurations\n @configurations.keys.collect{ |name| \"#{@project_name}:#{name}\"}\n end",
"def invoked_tasks\n @invoked_tasks\n end",
"def incoming_task_runs\n TapirLogger.instance.log \"Finding task runs for #{self}\"\n incoming_task_runs = []\n\n self.entity_mappings.each do |mapping|\n incoming_task_runs << mapping.get_task_run if mapping.get_child == self\n end\n incoming_task_runs\n end",
"def inactive_tasks\n @tasks.select { | task | ! task.active }\n end",
"def task_triggers\n return @task_triggers\n end",
"def available_tasks\n gather_tasks = Proc.new do |tasks|\n Dir[File.join(Rooster::TASKS_DIR, \"*.rb\")].each do |filename|\n tasks << task_from_filename(filename) || next\n end\n end\n \n @@available_tasks ||= if Rails::VERSION::MAJOR == 2\n returning([]) {|tasks| gather_tasks.call(tasks) }\n elsif Rails::VERSION::MAJOR == 3\n [].tap {|tasks| gather_tasks.call(tasks)}\n else\n raise raise RuntimeError,\n \"Unknown Rails major version: '#{Rails::VERSION::MAJOR}'\"\n end\n end",
"def task_names\n map do |task|\n task.name\n end\n end",
"def tasks_for_timeline\n tasks.where(status: Constants.TASK_STATUSES.completed).order(\"completed_at DESC\")\n .reject { |t| t.assigned_to.is_a?(Organization) && t.children.pluck(:assigned_to_type).include?(User.name) }\n end",
"def cron_tasks\n end",
"def _wait_tasks\n @wait_tasks\n end",
"def tasks(options={})\n ret = Task.where(options.merge(:aspect_id => self.id)).order(\"importance DESC\").all\n if self.has_children?\n self.children.order(\"weight DESC\").each do |aspect|\n ret << aspect.tasks(options)\n end\n end\n return ret.flatten\n end",
"def get_tasks_for(object)\n tasks_for_type = []\n\n @tasks.each do |task|\n if task.allowed_types.include?(object.class)\n tasks_for_type << task\n end\n end\n\n tasks_for_type\n end",
"def tasks\n @tasks ||= @dom.css(\"BusinessObject[@Name=Task]\").map do |element|\n Task.new(element.to_xml)\n end\n end",
"def list_tasks\n load_tasks\n\n # set '$thor_runner' to true to display full namespace\n $thor_runner = true\n\n list = [] #Thor.printable_tasks(all = true, subcommand = true)\n Thor::Base.subclasses.each do |klass|\n list += klass.printable_tasks(false) unless klass == Thor\n end\n list.sort!{ |a,b| a[0] <=> b[0] }\n\n title = \"repo_manager tasks\"\n shell.say shell.set_color(title, :blue, bold=true)\n shell.say \"-\" * title.size\n shell.print_table(list, :ident => 2, :truncate => true)\n end",
"def unassigned_tasks\n output = []\n @@task_types.each do |association_symbol|\n output = output + self.send(association_symbol).unassigned\n end\n output\n end",
"def tasks order = nil\n connection.tasks(id, order)\n end",
"def list; @schedule_lock.synchronize { @schedule.dup } end",
"def scheduled_action_configurations\n return @scheduled_action_configurations\n end",
"def scheduled\n jobs_index(Job.scheduled)\n end",
"def next_tasks\n\t\tincomplete_tasks.select{ |t| !t.blocked? }\n\tend",
"def completed_tasks\n self.tasks.where('is_completed =?', is_completed = true)\n end",
"def onetime_rake_files\n tasks_dir = self.tasks_directory\n return [] unless Dir.exist?(tasks_dir) && !Dir.empty?(tasks_dir)\n\n Dir.glob(File.join('**', '*.rake'), base: tasks_dir)\n end",
"def client_tasks\n self.all(:conditions => {:client_task => true})\n end",
"def tasks\n Easybill::Api::Tasks\n end",
"def task_names\n @task_names ||= tasks.map { |task| task.name.underscore }\n end",
"def all_permitted_tasks\n ( self.restricted? ) ? self.tasks.scoped : Task.scoped\n end",
"def task_lists\n\t\t@task_lists ||= fetch_latest_task_lists\n\tend",
"def task_definitions\n return @task_definitions\n end"
] | [
"0.755841",
"0.7515138",
"0.7395462",
"0.7377336",
"0.7280098",
"0.7211653",
"0.7194062",
"0.7185912",
"0.7148841",
"0.7148841",
"0.7096222",
"0.70657027",
"0.7065685",
"0.706109",
"0.7060252",
"0.70578",
"0.70578",
"0.70578",
"0.70457184",
"0.6986516",
"0.6980086",
"0.6947268",
"0.6941063",
"0.68712646",
"0.6864029",
"0.6857968",
"0.68118024",
"0.6806403",
"0.6804147",
"0.6788894",
"0.6783618",
"0.67721486",
"0.6740254",
"0.6724397",
"0.67136616",
"0.67063504",
"0.6706338",
"0.67029065",
"0.6678389",
"0.66736513",
"0.66535175",
"0.6652344",
"0.66250896",
"0.6573227",
"0.656723",
"0.65598774",
"0.6549029",
"0.6544023",
"0.6535634",
"0.6520444",
"0.65113914",
"0.65077007",
"0.6502868",
"0.6501376",
"0.64824677",
"0.6479478",
"0.64739466",
"0.64737815",
"0.6471183",
"0.6464127",
"0.6456965",
"0.6434897",
"0.6424622",
"0.64189184",
"0.6413949",
"0.6400629",
"0.63879234",
"0.6384613",
"0.6380939",
"0.63653874",
"0.63486236",
"0.6344404",
"0.6342796",
"0.63392496",
"0.6331394",
"0.6299677",
"0.6289176",
"0.6269128",
"0.622624",
"0.62208056",
"0.62167424",
"0.621257",
"0.6212159",
"0.61968523",
"0.61834073",
"0.6167503",
"0.6160463",
"0.61558217",
"0.6154365",
"0.6143515",
"0.61364603",
"0.613353",
"0.6129987",
"0.61118346",
"0.61077464",
"0.6090619",
"0.60888684",
"0.60859996",
"0.60839677",
"0.60815036"
] | 0.84459335 | 0 |
Various helpful aliases that encourage readable schedules. | def second; 1.second; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aliases; end",
"def aliases; end",
"def aliases; end",
"def aliases\n end",
"def aliases\n short ? [name, short] : [name]\n end",
"def aliases\n\n end",
"def alias_names; end",
"def aliases\n myAliases = \"\"\n if ['Mount ',' Mountain',' Peak'].any? {|word| self.name.include?(word)}\n short = shortname\n myAliases = \"#{short} Mountain, Mount #{short}, Mt. #{short}, Mt #{short}, #{shortname} mt, #{shortname} mtn, #{short} mtn., #{short} Peak\" \n end\n myAliases\n end",
"def print_alias(*) end",
"def aliased_name; end",
"def aliases=(_arg0); end",
"def aliases=(_arg0); end",
"def aliases\n @aliases ||= default_aliases\n end",
"def add_alias as\n @display.print_alias as\n end",
"def aliases generic_alias_too\n result, is_special = [], special_method?\n name = is_special ? cleaned_name : @name\n if generic_alias_too and (file = existing_rd_file) and\n not file =~ /#{cleaned_s4_class}/\n result << \"\\\\alias{#{name}-methods}\"\n end\n result << \"\\\\alias{#{name},#{@s4_class}-method}\"\n if is_special\n result << \"\\\\alias{#{@name.gsub(/%/, \"\\\\%\")},#{@s4_class}-method}\"\n end\n result.join \"\\n\"\n end",
"def alias_of; end",
"def aliases\n SideJob.redis.smembers \"#{redis_key}:aliases\"\n end",
"def alias_name\n name.to_s.pluralize\n end",
"def alias_task(aliases)\n aliases.each do |alias_name,task_name|\n t = Rake::Task[task_name]\n task alias_name, *t.arg_names do |_, args|\n args = t.arg_names.map { |a| args[a] }\n t.invoke(args)\n end\n end\nend",
"def aliases\n @aliases ||= []\n end",
"def as(alias_name)\n \"#{self} as #{alias_name}\".to_sym\n end",
"def as(alias_name)\n \"#{self} as #{alias_name}\".to_sym\n end",
"def script_aliases\n end",
"def description\n I18n.t(\"date.abbr_day_names\")[wday] + I18n.l(start_time, :format => :only_time) + \"-\" + I18n.l(end_time, :format => :only_time)\n end",
"def is_alias?; end",
"def aliases\n @opt_aliases.keys.map {|e| undasherize e }\n end",
"def aliases\n alias_of.aliases\n end",
"def aliases\n [[@aliases], @name, @display_name].flatten.compact.uniq\n end",
"def aliases(s)\n command.aliases(s)\n end",
"def to_alias\n \"-#{@alias}\"\n end",
"def aliases\n [canonical.downcase]\n end",
"def calendars_shortcut\n (config_params||DEFAULT_CONFIG_PARAMS)[\"Calendars Shortcut\"]\n end",
"def names\n [name] + @aliases\n end",
"def names\n [name] + @aliases\n end",
"def aliases\n @context.aliases.sort{|a,b| a.old_name<=>b.old_name}.collect{|al| {:old_name=>al.old_name, :new_name=>al.new_name, :description=>markup(al.comment, true)}}\n end",
"def aliases!\n @schema.aliases!\n end",
"def available_time_link(day)\n schedule = worker.schedules_on(day)\n if schedule.blank?\n 'ー'\n else\n h.link_to schedule.available_time_range_text, mng_worker_schedule_arrange_path(object, schedule)\n end\n end",
"def display_schedules\n puts label\n puts scheduled_meetings\n end",
"def aliases(media_type)\n registered_aliases.map { |a| media_type.type(a).to_s }\n end",
"def half_wind_abbreviation; end",
"def description\n str = \"alias :#{old_method_name}\"\n\n str << \" as #{new_method_name.inspect}\" if new_method_name\n\n str\n end",
"def alias(name)\n @aliases << convert(name)\n end",
"def alias(name)\n @aliases << convert(name)\n end",
"def aliases(other)\n common_names(other).each_with_object({}) { |name, aliases|\n left, right = fetch(name), other.fetch(name)\n aliases[name] = :\"#{name}_#{right}\" if left != right\n }\n end",
"def names\n [@name] + @aliases\n end",
"def get_short_name\n \"(#{get_scheduled_date}, #{event_order}) #{event_type.i18n_short} #{get_category_type_code} #{gender_type.i18n_short}\"\n end",
"def scheduled_meetings\n return [] if schedule.start_with?('TBA') # sometimes there's trailing whitespace\n\n abbreviations, start_time, end_time = schedule.match(MEETING_SCHEDULE_REGEX).captures\n # For each abbreviation, create a ScheduledMeeting for that day\n abbreviations.scan(/[A-Z][a-z]?/) # MTuWThFSaSu\n .map { |day_abbreviation| ScheduledMeeting.new day_abbreviation, start_time, end_time, self }\n end",
"def register_alias(type, shortcut); end",
"def path_for_url_alias(node)\n \"#{start_time.year}/#{start_time.month}/#{start_time.day}/#{title}\"\n end",
"def switch(name,aliases,desc,long_desc,negatable)\n if negatable\n name = \"[no-]#{name}\" if name.to_s.length > 1\n aliases = aliases.map { |_| _.to_s.length > 1 ? \"[no-]#{_}\" : _ } \n end\n invocations = ([name] + aliases).map { |_| add_dashes(_) }.join('|')\n @io.puts \"#{@nest}=== #{invocations}\"\n @io.puts String(desc).strip\n @io.puts\n @io.puts String(long_desc).strip\n @io.puts\n end",
"def alias_method(sym1,sym2) end",
"def aliases(options = { :include_institution_name => true })\n aliases = []\n aliases << self[:name] if options[:include_institution_name]\n aliases << self[:ialias].split(\",\").split(\"|\").flatten.collect(&:strip)\n aliases.flatten.compact\n end",
"def alias_decls; end",
"def hardcore_alias(klass, *args)\n \"__#{klass.name}#{args}\"\n end",
"def aliases(cmd)\n COMMAND_ALIASES.each { |k,v| return k if v.include?(cmd) }\n nil\n end",
"def linked_timezone_identifiers; end",
"def linked_timezone_identifiers; end",
"def linked_timezone_identifiers; end",
"def linked_timezone_identifiers; end",
"def get_full_name\n \"#{get_scheduled_date} #{get_event_type}: #{rank}) #{athlete_name}, #{get_timing}\"\n end",
"def alias_maker(fullname)\n\tname_arr = fullname.split(' ')\n\tname_arr.reverse! \n\tfullname = name_arr.join\n\talias_name = fullname.gsub(/[aeiou]/, \n\t\t'a' => 'e'\n\t\t'e' => 'i'\n\t\t'i' => 'o'\n\t\t'o' => 'u'\n\t\t'u' => 'a'\n\t\t)\nalias_name.gsub!(/[bcdfghjklmnpqrstvwxyz]/,\n'b' => 'c', 'c' => 'd', 'd' => 'f', 'f' => 'g',\n'g' => 'h', 'h' => 'j', 'j' => 'k', 'k' => 'l',\n'l' => 'm', 'm' => 'n', 'n' =>'p', 'p' => 'q',\n'q' => 'r','r' => 's', 's' => 't', 't' => 'u',\n'u' => 'v', 'v' => 'w', 'w' => 'x', 'x' => 'y',\n'y' => 'z', 'z' => 'b'\n)\nend",
"def command_schedule(m, show)\n upcoming_events = @calendar.upcoming_events\n\n if upcoming_events.length > 0\n m.user.send \"#{upcoming_events.length} upcoming show#{upcoming_events.length > 1 ? \"s\" : \"\"}\"\n upcoming_events.sort{|e1, e2| e1.start_time <=> e2.start_time}.each do |event|\n date_string = event.start_time.strftime(\"%-m/%-d/%Y\")\n time_string = event.start_time.strftime(\"%-I:%M%P\")\n m.user.send \" #{event.summary} on #{date_string} at #{time_string}\"\n end\n end\n\n end",
"def method_missing_with_timestamp_aliases(method,*args,&block)\n if method == :created_on && respond_to?(:created_at)\n self.class.send(:alias_method,:created_on,:created_at)\n created_at\n elsif method == :created_on= && respond_to?(:created_at=)\n self.class.send(:alias_method,:created_on=,:created_at=)\n self.created_at = args.first\n elsif method == :created_at && respond_to?(:created_on)\n self.class.send(:alias_method,:created_at,:created_on)\n created_on\n elsif method == :created_at= && respond_to?(:created_on=)\n self.class.send(:alias_method,:created_at=,:created_on=)\n self.created_on = args.first\n elsif method == :updated_at && respond_to?(:updated_on)\n self.class.send(:alias_method,:updated_at,:updated_on)\n updated_on\n elsif method == :updated_at= && respond_to?(:updated_on=)\n self.class.send(:alias_method,:updated_at=,:updated_on=)\n self.updated_on = args.first\n elsif method == :updated_on && respond_to?(:updated_at)\n self.class.send(:alias_method,:updated_on,:updated_at)\n updated_at\n elsif method == :updated_on= && respond_to?(:updated_at=)\n self.class.send(:alias_method,:updated_on=,:updated_at=)\n self.updated_at = args.first\n else\n method_missing_without_timestamp_aliases(method,*args,&block)\n end\n end",
"def get_full_name\n \"#{get_scheduled_date} #{get_event_type}: #{start_list_number}) #{swimmer.get_full_name}, #{get_timing}\"\n end",
"def aliases\n return @aliases\n end",
"def aliasing_hash_aliases\n @aliases ||= {}\n end",
"def showAlias\n puts \"showAlias.\"\nend",
"def join_schedules(schedule, member_alias = nil)\n @conflict_matrix.each do |key,value|\n (6..20).each do |n|\n input = schedule[key][\"#{n}:30 - #{n+1}:30\"]\n if !(input.empty? || input.nil? || input.eql?(\"\")) and !input.eql?(\"0\") ##schedule[key][\"#{n}:30 - #{n+1}:30\"].eql?(\"1\") or \n if member_alias.nil?\n @conflict_matrix[key][\"#{n}:30 - #{n+1}:30\"] = \"#{@conflict_matrix[key][\"#{n}:30 - #{n+1}:30\"]} #{input}\" \n else\n # @conflict_matrix[key][\"#{n}:30 - #{n+1}:30\"] = \"#{@conflict_matrix[key][\"#{n}:30 - #{n+1}:30\"]} -#{member_alias}-\"\n @conflict_matrix[key][\"#{n}:30 - #{n+1}:30\"] = \"#{@conflict_matrix[key][\"#{n}:30 - #{n+1}:30\"]} #{member_alias.split.join(\"_\")}\" \n end\n end\n end\n end\n end",
"def short_description\n \"#{self.meeting_start_time.to_s} to #{self.meeting_end_time.to_s}\"\n end",
"def test_deprecated_aliases\n\t\tassert_equal '#<Ole::Types::Clsid:{00020329-0880-4007-c001-123456789046}>',\n\t\t\t\t\t\t\t\t Ole::Types.load_guid(\"\\x29\\x03\\x02\\x00\\x80\\x08\\x07\\x40\\xc0\\x01\\x12\\x34\\x56\\x78\\x90\\x46\").inspect\n\t\tassert_equal '2006-12-31T19:00:00+00:00', Ole::Types.load_time(\"\\000\\370\\331\\336\\r-\\307\\001\").to_s\n\tend",
"def abbr; end",
"def abbr; end",
"def abbr; end",
"def abbr; end",
"def mailbox_aliases\n return @mailbox_aliases if @mailbox_aliases\n aliases = {\"sent\" => \"Sent Mail\",\n \"all\" => \"All Mail\",\n \"starred\" => \"Starred\",\n \"important\" => \"Important\",\n \"drafts\" => \"Drafts\",\n \"spam\" => \"Spam\",\n \"trash\" => \"Trash\"}\n @mailbox_aliases = {}\n aliases.each do |shortname, fullname|\n [ \"[Gmail]\", \"[Google Mail\" ].each do |prefix|\n if self.mailboxes.include?( \"#{prefix}/#{fullname}\" )\n @mailbox_aliases[shortname] = \"#{prefix}/#{fullname}\"\n end\n end\n end\n log \"Setting aliases to #{@mailbox_aliases.inspect}\"\n @mailbox_aliases\n end",
"def do_aliases\n @content.scan(/rb_define_alias\\s*\\(\n \\s*(\\w+),\n \\s*\"(.+?)\",\n \\s*\"(.+?)\"\n \\s*\\)/xm) do |var_name, new_name, old_name|\n class_name = @known_classes[var_name]\n\n unless class_name then\n @options.warn \"Enclosing class or module %p for alias %s %s is not known\" % [\n var_name, new_name, old_name]\n next\n end\n\n class_obj = find_class var_name, class_name\n comment = find_alias_comment var_name, new_name, old_name\n comment.normalize\n if comment.to_s.empty? and existing_method = class_obj.method_list.find { |m| m.name == old_name}\n comment = existing_method.comment\n end\n add_alias(var_name, class_obj, old_name, new_name, comment)\n end\n end",
"def name\n 'always_be_scheduling'\n end",
"def name\n 'always_be_scheduling'\n end",
"def define_alias_methods(member_name, options); end",
"def alias_maker(fullname)\r\n\tfullname= fullname.downcase\r\n\treverse_name = fullname.split(' ').reverse!.join(' ')\r\n\tletter_array = reverse_name.split('') \r\n\tletter_array.map! do |char|\r\n\t\tif char == \"a\"\r\n\t\t\tchar = \"e\"\r\n\t\telsif char == \"e\"\r\n\t\t\tchar = \"i\"\r\n\t\telsif char == \"i\"\r\n\t\t\tchar = \"o\"\r\n\t\telsif char == \"o\"\r\n\t\t\tchar = \"u\"\r\n\t\telsif char == \"u\"\r\n\t\t\tchar =\"a\"\r\n\t\telsif char == \" \"\r\n\t\t\tchar = \" \"\r\n\t\telse\r\n\t\t\tif char.next == \"a\"\r\n\t\t\tchar = char.next!.next!\r\n\t\t\telsif char.next == \"e\"\r\n\t\t\tchar = char.next!.next!\r\n\t\t\telsif char.next == \"i\"\r\n\t\t\tchar = char.next!.next!\r\n\t\t\telsif char.next == \"o\"\r\n\t\t\tchar = char.next!.next!\r\n\t\t\telsif char.next == \"u\"\r\n\t\t\tchar = char.next!.next!\r\n\t\t\telse\t\r\n\t\t\t\tchar = char.next!\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\tnew_name = letter_array.join\r\n\tfull_alias = new_name.split.map(&:capitalize).join(\" \")\r\nend",
"def schedule_name(user)\n Rails.cache.fetch(\"#{__method__}/ver2/#{user.schedule_id}\") do\n name = user.schedule.name.gsub('schedule', 'Schedule') # fix for NTC custom schedule\n name.include?(\"Schedule\") ? name : name + \" \" + \"Schedule\"\n end\n end",
"def friendly_slot\n scheduled_slot.strftime('%A - %B %e, %l:%M %p')\n end",
"def alias_processing\n self.alias = Russian.translit(self.alias.strip.gsub(' ', '_').gsub(/[\\W\\d]/, '')).downcase\n end",
"def spy_alias(real_name)\r\n\treal_name.gsub!(/[aeiou]/, \"a\" => \"e\", \"e\" => \"i\", \"i\" => \"o\", \"o\" => \"u\", \"u\" => \"a\") \r\n\treal_name.gsub!(/[bcdfghjklm]/, \"b\" => \"c\", \"c\" => \"d\", \"d\" => \"f\", \"f\" => \"g\", \"g\" => \"h\", \"h\" => \"j\", \"j\" => \"l\", \"l\" => \"m\", \"m\" => \"n\") \r\n\treal_name.gsub!(/[npqrstvwxyz]/, \"n\" => \"p\", \"p\" => \"r\", \"r\" => \"s\", \"s\" => \"t\", \"t\" => \"v\", \"v\" => \"w\", \"w\" => \"x\", \"x\" => \"y\", \"y\" => \"z\", \"z\" => \"b\")\r\nend",
"def alias_creator(name)\n puts \"Your name backwards is #{name.split(' ').rotate!.join(' ')}.\"\nend",
"def alias(a)\n Registry.alias_command(self, a)\n end",
"def realname\n alias? ? aliasof.name : name\n end",
"def alias_manager(covert_spy_name)\n\n spy_name = covert_spy_name.downcase.split(' ')\n reversed_spy_name = spy_name.reverse\n first_name = reversed_spy_name.first.to_s\n last_name = reversed_spy_name.last.to_s\n full_name = first_name + \" \" + last_name\n full_name_id = full_name.gsub(/[abcdefghijklmnopqrstuvwxyz]/, 'a' => 'e', 'b' => 'c', 'c' => 'd', 'd' => 'f', 'e' => 'i', 'f' => 'g', 'g' => 'h', 'h' => 'j', 'i' => 'o', 'j' => 'k', 'k' => 'l', 'l' => 'm', 'm' => 'n', 'n' => 'p', 'o' => 'u', 'p' => 'q', 'q' => 'r', 'r' => 's', 's' => 't', 't' => 'v', 'u' => 'a', 'v' => 'w', 'w' => 'x', 'x' => 'y', 'y' => 'z', 'z' => 'b')\n full_name_idx = full_name_id.split.map {|x| x.capitalize}.join(' ')\nend",
"def gen_type_aliases(type_aliases)\n type_aliases.map {|from, to| gen_type_alias(from, to) }.join(\"\\n\")\n end",
"def getMeetingScheduleObjName\r\n\t\t\treturn \"mfiforce__Meeting_Schedule__c\"\r\n\t\tend",
"def label\n # eg. \"Monday 1:30 pm to 2:00 pm\"\n \"#{start.strftime('%A')} #{pretty_start} to #{pretty_end}\"\n end",
"def get_full_name\n \"#{get_scheduled_date}, #{get_event_type}: #{rank}) #{get_team_name}, #{get_timing}\"\n end",
"def help\n [['remind (me|<person>) [in] <time string> to <message>', \"set up a reminder\"],\n ['remind (me|<person>) to <message> (in|on|at|next|this) <time string>', \"set up a reminder\"],\n [\"[list|show] [person]['s] reminders\", \"display current reminders for yourself or person\"],\n [\"delete reminder <n>\", \"delete your reminder #n\"],\n ]\n end",
"def schedule_name\n name = \"#{source_schema}_#{destination_schema}_#{table_name}\"\n end",
"def spy_alias2 full_name\n alphabet = {\n vowels: ['a','e','i','o','u'],\n consonants: ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n }\n alias_name = full_name.downcase.split(' ').reverse!.join(' ').split(//)\n alias_name.map! do |letter|\n next_letter=letter\n if alphabet[:vowels].include?(letter)\n index=alphabet[:vowels].index(letter)\n if letter==alphabet[:vowels][-1]\n next_letter=alphabet[:vowels][0]\n else\n next_letter=alphabet[:vowels][index+1]\n end\n elsif alphabet[:consonants].include?(letter)\n index = alphabet[:consonants].index(letter)\n if letter==alphabet[:consonants][-1]\n next_letter=alphabet[:consonants][0]\n else\n next_letter=alphabet[:consonants][index+1]\n end\n end\n next_letter\n end\n alias_name=alias_name.join('').split(' ').map! {|name| name.capitalize}.join(' ')\nend",
"def create_alias(new_name, old_name)\n alias_method new_name.to_sym, old_name.to_sym #getter\n alias_method \"#{new_name}=\".to_sym, \"#{old_name}=\".to_sym #setter\n end",
"def define_preformatted_aliases(klass, attr)\n PREFORMATTED_METHODS.keys.each do |scope|\n klass.class_eval do\n self.send(:alias_method, :\"#{attr}_#{scope}=\", :\"#{attr}=\")\n end\n end\n end",
"def aliases_for attributes\n attributes.each do |attr, nicks|\n [nicks].flatten.each do |nick|\n self.class_eval(\"alias #{nick} #{attr}\n alias #{nick}= #{attr}=\")\n end\n end\n end",
"def rename(aliases)\n new(map { |direction| direction.rename(aliases) })\n end",
"def abbr_day_name; Date::ABBR_DAYNAMES[wday] end",
"def build_table_aliases(from)\n # for the targets\n returning({}) do |aliases|\n from.map(&:to_s).sort.map(&:to_sym).each_with_index do |plural, t_index|\n table = plural._as_class.table_name\n plural._as_class.columns.map(&:name).each_with_index do |field, f_index|\n aliases[\"#{table}.#{field}\"] = \"t#{t_index}_r#{f_index}\"\n end\n end\n end\n end"
] | [
"0.682253",
"0.682253",
"0.682253",
"0.6611162",
"0.64962786",
"0.649542",
"0.63009393",
"0.6281305",
"0.6066121",
"0.60516256",
"0.60121065",
"0.60121065",
"0.58852744",
"0.58202267",
"0.58199185",
"0.58092713",
"0.57157034",
"0.5689937",
"0.5660003",
"0.56409025",
"0.5635772",
"0.5635772",
"0.5614599",
"0.56134266",
"0.5613216",
"0.5560873",
"0.55492586",
"0.55393755",
"0.5486122",
"0.5463367",
"0.5463168",
"0.5421264",
"0.5417153",
"0.5417153",
"0.53974354",
"0.53810066",
"0.5375101",
"0.5350774",
"0.5335088",
"0.53331953",
"0.5330502",
"0.53171074",
"0.53171074",
"0.5308852",
"0.53072315",
"0.5293523",
"0.52821636",
"0.52814156",
"0.5269819",
"0.52600104",
"0.5252914",
"0.5249913",
"0.5249098",
"0.5231122",
"0.5209064",
"0.5202607",
"0.5202607",
"0.5202607",
"0.5202607",
"0.5202476",
"0.5198995",
"0.51941335",
"0.51886827",
"0.51851714",
"0.5183513",
"0.51655614",
"0.5155023",
"0.5122667",
"0.5119978",
"0.51162124",
"0.5112043",
"0.5112043",
"0.5112043",
"0.5112043",
"0.5106723",
"0.50861406",
"0.5082496",
"0.5082496",
"0.5081805",
"0.5075152",
"0.50583225",
"0.5052014",
"0.50463814",
"0.50421387",
"0.50391746",
"0.50387126",
"0.5032495",
"0.5031075",
"0.5023148",
"0.5020358",
"0.5019082",
"0.5011883",
"0.50105995",
"0.5009288",
"0.50048184",
"0.49992186",
"0.49873042",
"0.4986332",
"0.49819598",
"0.4963038",
"0.4951075"
] | 0.0 | -1 |
Set up schedules. This method should be implemented by a subclass of Scheduler. | def schedule
# implemented by subclass
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_schedule!\n @schedule ||= load_default_schedule\n\n fail 'You should setup a schedule or place it in config/schedule.yml' unless schedule\n\n schedule.each do |name, config|\n # If rails_env is set in the config, enforce ENV['RAILS_ENV'] as\n # required for the jobs to be scheduled. If rails_env is missing, the\n # job should be scheduled regardless of what ENV['RAILS_ENV'] is set\n # to.\n if config['rails_env'].nil? || rails_env_matches?(config)\n setup_job_schedule(name, config)\n end\n end\n end",
"def initialize\n self.tasks = Array.new\n self.run_queue = Queue.new\n self.schedule\n end",
"def setSchedule(schedule)\n\t\t@schedule = schedule\n\tend",
"def schedules\n workers.map(&:schedule)\n end",
"def setup(server)\n server.on('schedule', method(:schedule), 120)\n end",
"def initialize(scheduler)\n @scheduler = scheduler\n @scheduler.post_initialize(self)\n end",
"def setup\n logger.info 'setup workers'\n\n setup_refresh_timer\n setup_analyze_timer\n end",
"def schedule\n @schedule ||= all_schedules\n @schedule || {}\n end",
"def schedule=(value)\n @schedule = value\n end",
"def schedule=(value)\n @schedule = value\n end",
"def schedule=(value)\n @schedule = value\n end",
"def initialize\n @schedule = []\n\n # pass self to the construction block and let the project load it's days\n # into the schedule\n yield(self)\n\n deduplicate\n sort\n assign_types\n end",
"def initialize(testing_frequency = \"60m\")\n # Set up the tasks\n @job_ids_by_task = {}\n @tasks_by_job_ids = {}\n # Start the scheduler\n @scheduler = Rufus::Scheduler.start_new\n # Create a logger\n @logger = Logger.new( 'scheduler.log', 'monthly' )\n @task_test_results_logger = Logger.new( 'task_test_results.log', 'monthly' )\n puts \"Schedule tests\"\n # Add the test runninng scheduler method\n @scheduler.every(testing_frequency) do\n test_results = execute_task_tests()\n test_results.each {|test_result|\n # the test is not nil then we have an error (print this error to the log)\n if(!test_result.nil?)\n @task_test_results_logger.error(test_result.inspect)\n end\n }\n end\n end",
"def initialize\n @tag_name = self.class.to_s.split(\"::\").last.downcase\n @schedule = IceCube::Schedule.new(1.month.ago.beginning_of_day)\n @schedule.add_recurrence_rule IceCube::Rule.daily\n # For example, add these if your schedule doesn't occur on weekends\n #@schedule.add_exception_rule IceCube::Rule.weekly.day(:saturday)\n #@schedule.add_exception_rule IceCube::Rule.weekly.day(:sunday)\n end",
"def schedule\n @schedule ||= ProjectSet::Schedule.new do |schedule|\n\n # Using the project's start and end dates, add the dates to the schedule\n @projects.each do |project|\n (project[:start]..project[:end]).each do |date|\n schedule.add_day(date: date, city: project[:city])\n end\n end\n end\n end",
"def initialize skip_schedule_load = false\n @contacts = {}\n @matchers = []\n @schedules = []\n run_config_in_context unless skip_schedule_load\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def schedule_workshops\n\t\t@workshops = Workshop.all\n\t\t@schedule = Schedule.new\n\tend",
"def schedule_workshops\n\t\t@workshops = Workshop.all\n\t\t@schedule = Schedule.new\n\tend",
"def scheduler\n raise NoSchedulerError, \"Scheduler isn't initialized. Call Secondhand.start before scheduling jobs.\" unless @scheduler \n @scheduler\n end",
"def reload_schedule!\n @schedule = all_schedules\n end",
"def run\n schedule_managers\n end",
"def schedules\n\t\t@schedules = Schedule.includes(:schedulable).all\n\tend",
"def schedules\n\t\t@schedules = Schedule.all\n\tend",
"def schedule(opts)\n opts = check_params(opts,[:schedule])\n super(opts)\n end",
"def populate_scheduled(actions)\n @scheduled = actions.map do |action|\n config = ScheduledConfig.new()\n config.populate(action)\n config\n end\n end",
"def check_schedule()\n create_daily_tests()\n create_weekly_tests()\n end",
"def schedules\n @doc.at_xpath('/a:akomaNtoso/a:components/a:component/a:doc[@name=\"schedules\"]/a:mainBody', a: NS)\n end",
"def set_scheduled_times_option\n @scheduled_times = ScheduledTime.all\n end",
"def load_schedule_from_args\n @my_schedule = worker_options[:schedule]\n new_load_schedule if @my_schedule\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def initialize\n @id = SecureRandom.uuid\n @schedule = Rufus::Scheduler.new\n end",
"def setup\n setup_requeue_queue\n consume_requeue\n setup_retry_queues\n end",
"def set_schedule\n @schedule = Schedule.where(:schedule_id => params[:id])\n end",
"def setup\n # Create a standard project (30 days)\n @Project1 = Project.new(Date.new(2000, 1, 1), Date.new(2000, 1, 10))\n # Create a standard calendar (30 days, 1 hour per day)\n @Calendar1 = {}\n 10.times do |iIdx|\n @Calendar1[Date.new(2000, 1, iIdx+1)] = 1\n end\n # Create standard resources\n @Resource1 = Resource.new('R1', @Calendar1)\n end",
"def start_scheduler\n @rufus = Rufus::Scheduler.new\n schedule_shutdown_job if !self.timeout.blank?\n schedule_job_specs(JobSpec.where(enabled: true))\n end",
"def schedule_managers\n @managers.each do |name, manager|\n # Perform one update immediately so that all information is initialized\n # before the first scheduled update cycle occurs. This avoids issues\n # where updates for routes (usually daily) may not have occurred before\n # updates for vehicles (usually every few seconds) need their\n # information.\n manager.update\n @scheduler.every(manager.update_frequency){ manager.update }\n end\n\n @managers.values.map(&:update)\n end",
"def setup\n\t\tall_movies = Movie.all\n\t\tall_movies = all_movies.sort { |a, b| a.title <=> b.title }\n\n\t\t#create arrays for current movies and upcoming movies\n\t\t@upcoming_movies = Array.new\n\t\t@current_movies = Array.new\n\n\t\t#sort movies into current and upcoming release arrays\n\t\tall_movies.each do |movie|\n\t\t\tif movie.release_date > Time.now\n\t\t\t\t@upcoming_movies << movie\n\t\t\telse\n\t\t\t\t@current_movies << movie\n\t\t\tend\n\t\tend\n\n\tend",
"def initialize\n klass = self.class\n create_hourly_cronjob(klass.hourly_method) if klass.hourly_method\n create_daily_cronjob(klass.daily_method, klass.daily_trigger_time) if klass.daily_method\n create_weekly_cronjob(klass.weekly_method, klass.weekly_trigger_time) if klass.weekly_method\n end",
"def set_scheduler\n @scheduler = Scheduler.find(params[:id])\n end",
"def set_scheduler\n @scheduler = Scheduler.find(params[:id])\n end",
"def set_scheduler\n @scheduler = Scheduler.find(params[:id])\n end",
"def initialize(args={})\n @schedule = args[:schedule] || Schedule.new\n # ...\n end",
"def setup_retry_queues\n retry_delay_times.each_with_index.map do |delay, index|\n setup_retry_queue(delay, index)\n end\n end",
"def set_schedule\n @schedule = current_user.schedules.find(params[:id])\n end",
"def set_schedule\n @schedule = current_user.schedules.find(params[:id])\n end",
"def start\n events.map(&:schedule)\n end",
"def schedule\n unless (@schedule)\n schedule = []\n emails = @emails\n emails << 'n/a' if @emails.size.odd?\n\n top_row = emails[0...(emails.size/2)]\n (0...top_row.size).each do |shifts|\n weekly_pairs = []\n second_row = emails[(emails.size/2)...emails.size]\n\n shifts.times {second_row << second_row.shift}\n top_row.each_with_index do |top_row_email, index|\n weekly_pairs << [top_row_email, second_row[index]]\n end\n\n schedule << weekly_pairs\n end\n\n @schedule = schedule\n\n end\n\n @schedule\n end",
"def initialize\n super\n @update_to_call = []\n Scheduler.start(:on_init, self.class)\n end",
"def initialize_group_schedule(creator_schedule)\n # clear current schedule if one exists\n self.schedule.destroy if self.schedule != nil\n \n # create schedule\n schedule = Schedule.create(:group_id => self.id)\n \n # copy creator's schedule as group's schedule\n creator_schedule.days.each do |creator_day|\n day = Day.create(:name => creator_day.name, :schedule_id => schedule.id)\n creator_day.time_blocks.each do |creator_time_block|\n TimeBlock.create(:chunk_of_time => creator_time_block.chunk_of_time, :day_id => day.id)\n end\n end\n end",
"def index\n # expiring the schedules if needed, whenever the results are displayed to the user. This is a backup to the whenever cron job\n # TODO - check in case the user had the session open since a long time.\n # Commented mark_as_expired since it is makeing this action slow and added this in cron.\n # TeacherSchedule.mark_as_expired\n @teacher = Teacher.find(params[:teacher_id])\n @teacher.current_user = current_user\n\n center_scheduler_center_ids = current_user.accessible_center_ids(:center_scheduler)\n zao_zone_ids = current_user.accessible_zone_ids(:zao)\n\n teacher_schedules = []\n # get the schedules for part-time teachers, from centers for which current_user is center_scheduler (or above)\n unless center_scheduler_center_ids.empty?\n teacher_schedules += @teacher.teacher_schedules.joins(\"JOIN centers_teacher_schedules ON centers_teacher_schedules.teacher_schedule_id = teacher_schedules.id\").joins(\"JOIN teachers ON teachers.id = teacher_schedules.teacher_id\").where(\"teacher_schedules.end_date >= ? AND centers_teacher_schedules.center_id IN (?) AND teachers.full_time = ?\", (Time.zone.now.to_date - 1.month.from_now.to_date), center_scheduler_center_ids, false).group(\"role\", \"coalesce(teacher_schedules.program_id, teacher_schedules.created_at *10 +teacher_schedules.id)\").order(\"teacher_schedules.start_date DESC\")\n end\n\n # get the schedules for full-time teachers attached to zones, for which current_user is zao (or above)\n unless zao_zone_ids.empty?\n # primary zones\n teacher_schedules += @teacher.teacher_schedules.joins(\"JOIN teachers ON teachers.id = teacher_schedules.teacher_id\").\n joins(\"JOIN zones_teachers on teachers.id = zones_teachers.teacher_id\").\n where(\"teacher_schedules.end_date >= ? AND zones_teachers.zone_id IN (?) AND teachers.full_time = ?\", (Time.zone.now.to_date - 1.month.from_now.to_date), zao_zone_ids, true).\n group(\"role\",\"coalesce(teacher_schedules.program_id, teacher_schedules.created_at *10 +teacher_schedules.id)\").\n order(\"teacher_schedules.start_date DESC\")\n # secondary zones\n teacher_schedules += @teacher.teacher_schedules.joins(\"JOIN teachers ON teachers.id = teacher_schedules.teacher_id\").\n joins(\"JOIN secondary_zones_teachers on teachers.id = secondary_zones_teachers.teacher_id\").\n where(\"teacher_schedules.end_date >= ? AND secondary_zones_teachers.zone_id IN (?) AND teachers.full_time = ?\", (Time.zone.now.to_date - 1.month.from_now.to_date), zao_zone_ids, true).\n group(\"role\",\"coalesce(teacher_schedules.program_id, teacher_schedules.created_at *10 +teacher_schedules.id)\").\n order(\"teacher_schedules.start_date DESC\")\n end\n # get the schedules for self, i.e. current user is the teacher\n if User.current_user == @teacher.user\n if @teacher.full_time?\n # filter out block-requested for full-time teachers\n @teacher.teacher_schedules.each{ |ts|\n teacher_schedules << ts unless ts.state == ::ProgramTeacherSchedule::STATE_BLOCK_REQUESTED\n }\n else\n teacher_schedules += @teacher.teacher_schedules\n end\n end\n\n @teacher_schedules = teacher_schedules.uniq\n\n respond_to do |format|\n if @teacher.can_view_schedule?\n format.html\n format.json { render json: @teacher_schedules }\n else\n format.html { redirect_to teacher_path(@teacher), :alert => \"[ ACCESS DENIED ] Cannot perform the requested action. Please contact your coordinator for access.\" }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def schedule(spec)\n @task.schedule = Cloud::Cycler::Schedule.parse(spec)\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id])\n end",
"def new_load_schedule\n @worker_method_triggers = { }\n @my_schedule.each do |key,value|\n case value[:trigger_args]\n when String\n cron_args = value[:trigger_args] || \"0 0 0 0 0\"\n trigger = BackgrounDRb::CronTrigger.new(cron_args)\n @worker_method_triggers[key] = { :trigger => trigger,:data => value[:data],:runtime => trigger.fire_after_time(Time.now).to_i }\n when Hash\n trigger = BackgrounDRb::Trigger.new(value[:trigger_args])\n @worker_method_triggers[key] = { :trigger => trigger,:data => value[:trigger_args][:data],:runtime => trigger.fire_after_time(Time.now).to_i }\n end\n end\n end",
"def run_replications\n # Add fresh schedule\n old_shedule = @schedule\n @schedule = {}\n @active = false\n\n old_shedule.each_value do |conn|\n conn.start\n end\n end",
"def initialize(scheduler)\n super\n opts = scheduler.options\n @subauthorities = opts[:central_broker][:subauthorities]\n @@sfa_namespaces = {}\n @@sfa_namespaces[:omf] = 'http://schema.mytestbed.net/sfa/rspec/1'\n @@sfa_namespaces[:ol] = 'http://nitlab.inf.uth.gr/schema/sfa/rspec/1'\n @@sfa_namespaces[:flex] = 'http://nitlab.inf.uth.gr/schema/sfa/rspec/lte/1'\n end",
"def schedule\n @schedule || Schedule.new\n end",
"def configure_tasks\n end",
"def initialize(schedule)\n @result, @min, @hour, @day, @month, @wday = *schedule.match(CRON_REGEXP)\n validate\n end",
"def schedule(scheduler)\n case self.interval\n when :startup, :shutdown\n # ignore it\n else\n self.thread = Thread.new do\n loop do\n sleep self.interval\n scheduler.run_queue << self\n end\n end\n self.thread.abort_on_exception = true\n end\n end",
"def initialize(args = {})\n @schedule = args[:schedule] || Schedule.new\n # ...\n end",
"def initialize\n super\n @startup_times = []\n end",
"def schedule(start_date, end_date, options = {})\n\t\t\tdates = (Date.parse(start_date)...Date.parse(end_date)).to_a\n\t\t\tif options[:exclude_weekends]\n\t\t\t\tdates.delete_if do |d|\n\t\t\t\t\td.wday == 0 || d.wday == 6\n\t\t\t\tend\n\t\t\tend\n\t\t\tif excludes = options[:exclude_dates]\n\t\t\t\tdates -= excludes.map {|d| Date.parse(d)}\t\n\t\t\tend\n\t\t\[email protected] = dates\n\t\tend",
"def set_schedule\n @schedule = Schedule.where(id: params[:id].to_i, organization_id: current_organization.id).take!\n end",
"def set_runschedule\n @runschedule = Runschedule.find(params[:id])\n end",
"def setup!(scheduler = Scheduler)\n self.master_models ||= DEFAULT_MASTER_MODELS\n self.environment ||= (defined?(RAILS_ENV) ? RAILS_ENV : 'development')\n self.sticky_slave ||= false\n \n master = ActiveRecord::Base\n slaves = init_slaves\n raise \"No slaves databases defined for environment: #{self.environment}\" if slaves.empty?\n master.send :include, MultiDb::ActiveRecordExtensions\n ActiveRecord::Observer.send :include, MultiDb::ObserverExtensions\n master.connection_proxy = new(master, slaves, scheduler)\n master.logger.info(\"** multi_db with master and #{slaves.length} slave#{\"s\" if slaves.length > 1} loaded.\")\n end",
"def reload_schedule!\n @schedule = SidekiqScheduler::ScheduleStore.get_all_schedules\n end",
"def schedules\n params = init_params\n request_url = UrlGenerator.url_for(\"schedules\")\n asgn = SignatureGenerator.signature_for(http_verb: 'GET', url: request_url, params: params)\n\n res = self.get(request_url, query: params.merge!({asgn: asgn}))\n if res[\"status\"] == \"SUCCESS\"\n return res\n else\n return error_response_for(res)\n end\n end",
"def set_default_times\n if !self.start\n return\n end\n\n if self.start.hour == 0 # hour set to 0 if not otherwise defined...\n self.start = self.start + 9.hours\n end\n\n if !self.end\n if self.online?\n self.end = self.start + 1.hour\n else\n diff = 17 - self.start.hour\n self.end = self.start + diff.hours\n end\n end\n # TODO: Set timezone for online events. Where to get it from, though?\n # TODO: Check events form to add timezone autocomplete.\n # Get timezones from: https://timezonedb.com/download\n\n end",
"def initialize(args={})\n\n @schedule = args[:schedule] || Schedule.new\n\n @size = args[:size] \n @chain = args[:chain] || default_chain\n\n post_initialize(args)\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def set_schedule\n @schedule = Schedule.find(params[:id]) unless params[:id] == 'destroy_multiple' || params[:id].to_i.zero?\n end",
"def custom_schedule(schedule)\n schedules << schedule.create_custom\n save\n end"
] | [
"0.7221451",
"0.65280867",
"0.641248",
"0.6391269",
"0.63749164",
"0.63611025",
"0.6322785",
"0.6266604",
"0.62494344",
"0.62494344",
"0.62494344",
"0.6182044",
"0.61681676",
"0.6110153",
"0.61048746",
"0.60518914",
"0.6046614",
"0.6042762",
"0.6042762",
"0.6037323",
"0.6033162",
"0.60130435",
"0.60048074",
"0.6001603",
"0.6000608",
"0.5987634",
"0.5987479",
"0.5972379",
"0.5958816",
"0.5955286",
"0.59000415",
"0.59000415",
"0.59000415",
"0.59000415",
"0.59000415",
"0.59000415",
"0.59000415",
"0.59000415",
"0.59000415",
"0.59000415",
"0.59000415",
"0.59000415",
"0.59000415",
"0.59000415",
"0.59000415",
"0.59000415",
"0.59000415",
"0.59000415",
"0.59000415",
"0.59000415",
"0.59000415",
"0.59000415",
"0.59000415",
"0.59000415",
"0.5805954",
"0.57999676",
"0.57938224",
"0.5786751",
"0.5786034",
"0.57558763",
"0.57128024",
"0.5705",
"0.57018566",
"0.57018566",
"0.57018566",
"0.56896544",
"0.5678959",
"0.564073",
"0.564073",
"0.5639478",
"0.5636612",
"0.56275547",
"0.5623896",
"0.5614832",
"0.5611989",
"0.56089294",
"0.56089294",
"0.56089294",
"0.56089294",
"0.56089294",
"0.55805963",
"0.55803645",
"0.55766815",
"0.557553",
"0.55673414",
"0.5559223",
"0.5556493",
"0.55547327",
"0.5553759",
"0.55537254",
"0.5551984",
"0.5545825",
"0.55386287",
"0.55280435",
"0.5526374",
"0.5515206",
"0.5508832",
"0.55052745",
"0.5504733",
"0.54949826"
] | 0.6573526 | 1 |
Start a schedule. If +period+ is supplied, the schedule will only run for that many seconds. Otherwise, it will run forever, or until there are no tasks to run. | def start(period=nil)
# Run any startup tasks.
self.startup_tasks.each { |t| t.run }
# If caller only wants to run for a while, start a thread that will
# sleep that long, then kill off all the threads. +nil+ is posted to
# the queue as a signal that the scheduler should stop running.
if period
Thread.new do
Thread.abort_on_exception = true
sleep period
self.scheduled_tasks.each {
|t| t.thread.exit if t.thread && t.thread.alive? }
self.run_queue << nil
end
end
# Schedule all the tasks.
self.scheduled_tasks.each { |t| t.schedule(self) }
# Run any tasks whose threads have placed the task onto the run
# queue, until +nil+ is received.
while (task = self.run_queue.pop) do
task.run
end
# Run any shutdown tasks.
self.shutdown_tasks.each { |t| t.run }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def periodic period, options={}, &block\n worker([], options.merge({:with_period => period}), &block)\n end",
"def schedule_every (freq, params={}, &block)\n\n params = prepare_params(params)\n params[:every] = freq\n\n first_at = params[:first_at]\n first_in = params[:first_in]\n\n #params[:delayed] = true if first_at or first_in\n\n first_at = if first_at\n at_to_f(first_at)\n elsif first_in\n Time.now.to_f + Rufus.duration_to_f(first_in)\n else\n Time.now.to_f + Rufus.duration_to_f(freq) # not triggering immediately\n end\n\n do_schedule_at(first_at, params, &block)\n end",
"def initialize(period = 1)\n @period = period\n restart\n end",
"def periodically(period = 0.5, maximum = nil, &block)\n @timers << hq.periodic_action(period, maximum, &block)\n end",
"def run_periodic_tasks!\n logger.info(\"Running periodic tasks...\")\n PeriodicTask.run_all_due!\n end",
"def schedule(scheduler)\n case self.interval\n when :startup, :shutdown\n # ignore it\n else\n self.thread = Thread.new do\n loop do\n sleep self.interval\n scheduler.run_queue << self\n end\n end\n self.thread.abort_on_exception = true\n end\n end",
"def start_recurring_payment\n return unless recurring_period.present?\n run_at = nil\n if recurring_period.to_s.is_i? # each custom days\n run_at = recurring_period.to_i.days.from_now\n # run_at = recurring_period.to_i.minutes.from_now\n else\n case recurring_period\n when 'daily'\n run_at = 1.day.from_now\n when 'weekly'\n run_at = 7.days.from_now\n when 'monthly'\n run_at = 1.month.from_now\n when 'quarterly'\n run_at = 3.months.from_now\n when 'biannually'\n run_at = 6.months.from_now\n when 'yearly'\n run_at = 1.year.from_now\n end\n end\n Delayed::Job.enqueue(LongTasks::RecurringPaymentNotification.new(id), run_at: run_at - 1.day) if run_at && ['tithe', 'partnership'].include?(goal)\n Delayed::Job.enqueue(LongTasks::RecurringPayment.new(id), run_at: run_at) if run_at\n end",
"def periodically_trigger_task(task_name = nil, interval = 1, &block)\n periodically(interval) do\n trigger_task(task_name, &block)\n end\n end",
"def periodically_trigger_task(task_name = nil, interval = 1, &block)\n periodically(interval) do\n trigger_task(task_name, &block)\n end\n end",
"def every(interval, unit = :minutes, options = {}, &block)\n raise \"Not a Integer: #{interval}\" unless interval.is_a? Integer\n raise \"Interval less than 1\" if interval < 1\n\n opts = {\n run_at_start: true\n }.merge(options)\n\n case unit\n when :min, :mins, :minute, :minutes\n when :hr, :hrs, :hour, :hours, :horse\n interval *= 60\n else\n raise \"Unknown unit: #{unit}\"\n end\n $bot[:periodic] << {\n interval: interval,\n remaining: opts[:run_at_start] ? 0 : interval,\n block: block\n }\n end",
"def schedule!(options = {})\n return unless ::Delayed::Worker.delay_jobs\n unschedule(options)\n new(options).schedule!(options)\n end",
"def start\n Ghosty::Logger.info 'Started'\n\n # Handle Control-C signals that may occur while sleeping\n trap(\"SIGINT\") do\n Ghosty::Logger.info 'Stopped'\n return\n end\n\n loop do\n frequency = Ghosty::Settings.minimum_frequency\n wait_time = (frequency + rand(frequency * 4)) * 60\n\n Ghosty::Logger.info \"Scheduling for #{Time.now + wait_time}\"\n\n sleep(wait_time)\n\n if Ghosty::Settings.valid_hours.include?(Time.now.hour)\n trigger\n else\n Ghosty::Logger.info 'Skipping - time is out of bounds'\n end\n end\n end",
"def schedule(interval: CronSwanson.default_interval, roles: [], &block)\n @in_schedule_method = true\n @whenever_jobs = []\n\n raise ArgumentError, \"provide a block containing jobs to schedule.\" if !block_given?\n\n # execute the block in the context of CronSwanson::Whenever (rather than in the context\n # of the Whenever::JobList where it will be invoked) so that we can intercept\n # calls to `rake` and similar (via method_missing below).\n instance_eval(&block)\n\n # make a schedule based on the contents of the jobs which were defined in the block\n schedule_seed = @whenever_jobs.map do |job_config|\n m, args, _block = *job_config\n \"#{m} #{args.join}\"\n end\n schedule = CronSwanson.build_schedule(@seed + schedule_seed.join, interval: interval)\n\n # now that we know when to schedule the jobs, actually pass the block to Whenever\n if roles.size > 0\n @whenever_job_list.every(schedule, roles: roles, &block)\n else\n @whenever_job_list.every(schedule, &block)\n end\n\n @in_schedule_method = false\n end",
"def periodic(name, period=1)\n define_collection(name)\n raise Bud::Error if @periodics.has_key? [name]\n @periodics << [name, period]\n @tables[name] = Bud::BudPeriodic.new(name, self)\n end",
"def start_scheduler\n @rufus = Rufus::Scheduler.new\n schedule_shutdown_job if !self.timeout.blank?\n schedule_job_specs(JobSpec.where(enabled: true))\n end",
"def auto_flushing=( period )\n @auto_flushing =\n case period\n when true; 1\n when false, nil, 0; DEFAULT_BUFFER_SIZE\n when Integer; period\n when String; Integer(period)\n else\n raise ArgumentError,\n \"unrecognized auto_flushing period: #{period.inspect}\"\n end\n\n if @auto_flushing < 0\n raise ArgumentError,\n \"auto_flushing period cannot be negative: #{period.inspect}\"\n end\n end",
"def auto_flushing=(period)\n @auto_flushing =\n case period\n when true; 1\n when false, nil, 0; MAX_BUFFER_SIZE\n when Integer; period\n else raise ArgumentError, \"Unrecognized auto_flushing period: #{period.inspect}\"\n end\n end",
"def period=(val)\n if Timely.periods.include?(val.to_s)\n @period = val.to_sym\n else\n raise Timely::ConfigurationError, \"period must be in the list: #{Timely.periods.join(\", \")} (provided #{val})\"\n end\n\n reset\n end",
"def auto_flushing=(period)\r\n @auto_flushing =\r\n case period\r\n when true; 1\r\n when false, nil, 0; MAX_BUFFER_SIZE\r\n when Integer; period\r\n else raise ArgumentError, \"Unrecognized auto_flushing period: #{period.inspect}\"\r\n end\r\n end",
"def starts_at=(val)\n raise Timely::ConfigurationError, \"period must be set before setting starts_at\" unless period\n\n if val == :hour\n @starts_at = val.change(min: 0, sec: 0)\n else\n @starts_at = val.send(\"beginning_of_#{period}\")\n end\n\n reset\n end",
"def period=(period)\n if !period.nil? && period > 2147483647\n fail ArgumentError, 'invalid value for \"period\", must be smaller than or equal to 2147483647.'\n end\n @period = period\n end",
"def periodic_action(period = 0.5, maximum = nil, &action)\n count = 0\n timer = EventMachine::PeriodicTimer.new(period, &(action_wrapper = proc do\n if maximum.nil? or (count += 1) <= maximum\n action.call\n else\n timer.cancel\n end\n end))\n # Do it immediately\n action_wrapper.call\n timer\n end",
"def period_start(group, period)\n period.utc.send(\"beginning_of_#{config.group(group).reporting_interval}\")\n end",
"def schedule_in (duration, params={}, &block)\n\n do_schedule_at(\n Time.new.to_f + Rufus.duration_to_f(duration),\n prepare_params(params),\n &block)\n end",
"def initialize(cron_def, &block)\n @cron_def = cron_def\n @block = block\n @next_run = cron_parser && cron_parser.next(Time.now)\n PeriodicTask.tasks << self\n end",
"def periodic\n SND.log.debug 'Periodic actions start'\n SND::Game.game_operations\n SND::Game.start_games\n SND.log.debug 'Periodic actions end'\n end",
"def schedule_periods\n\t\t@periods = Period.all\n\tend",
"def schedule(spec)\n @task.schedule = Cloud::Cycler::Schedule.parse(spec)\n end",
"def set_request_period(period)\n\t\t@object_builder.set_request_period(period)\n\tend",
"def schedule(cron)\n if !cron.is_a?(String) || cron.blank?\n raise InvalidArgumentError,\n \"The cron passed to 'schedule' must be a non empty string\"\n end\n\n Engine.instance.schedule([self], cron)\n end",
"def fire\n schedule_firing_time if @periodical\n @timer_proc.call\n end",
"def periodically(interval, &block)\n EventMachine::PeriodicTimer.new(interval, &block)\n end",
"def periodically(interval, &block)\n EventMachine::PeriodicTimer.new(interval, &block)\n end",
"def with_period_of(seconds)\n raise ArgumentError, \"No block given!\" unless block_given?\n seconds = seconds.to_i\n\n # Main loop, does not stop until the loop enters the shutdown mode\n loop do\n # Run user's code\n yield\n\n # Stop if we're in shutdown mode\n if shutdown?\n debug(\"Shutdown: stopping the loop\")\n break\n end\n\n # Sleep before the next iteration\n sleep_with_shutdown_support(seconds)\n end\n end",
"def every(duration, options = Hash.new, &block)\n handler = PollBlockDefinition.new(\"periodic handler #{block}\", block, options)\n\n once do\n if handler.call(self, plan)\n process_every << [handler, cycle_start, duration]\n end\n end\n handler.id\n end",
"def set_period\n @period = Period.find(params[:id])\n end",
"def set_period\n @period = Period.find(params[:id])\n end",
"def set_period\n @period = Period.find(params[:id])\n end",
"def schedule(program, name, insertions, deletions)\n\t\[email protected] do\n\t\t\tif (program == \"runtime\") \n\t\t\t task = Driver::Task.new\n\t\t\t task.insertions = insertions\n\t\t\t task.deletions = deletions\n\t\t\t task.program = program\n\t\t\t task.name = name\n#\t\t puts \"XXX Tasking: #{name}, #{task.insertions.tups[0]}, #{task.deletions.tups[0]}\"\n \t\t\[email protected](task)\n\t\t\telse\n\t\t\t\ttuple = Tuple.new(clock.current + 1, program, name, insertions, deletions)\n\t\t print \"XXX Scheduling: #{name}, #{task.insertions.tups[0]}, #{task.deletions.tups[0]}\"\n\t\t\t\tschedule.force(tuple)\n\t\t\tend\n\t\t\t# XXXXXXXXXX\n\t\t\[email protected]_var.signal\n\t\tend\n\tend",
"def initialize opts\n @timers = opts[:timers]\n @delay = opts[:delay].to_i\n @periodical = opts[:periodical]\n @timer_proc = opts[:timer_proc]\n @exact_time = opts[:exact_time]\n schedule_firing_time\n end",
"def every(delay, options = {}, &block)\n if options[:name]\n return if timer_exists?(options[:name]) && options[:preserve]\n stop_timer(options[:name])\n end\n \n ms = $window.frame # Gosu::milliseconds()\n @_repeating_timers << [options[:name], ms + delay, delay, options[:during] ? ms + options[:during] : nil, block]\n if options[:during]\n @_last_timer = [options[:name], nil, ms + options[:during]]\n return self\n end\n end",
"def set_periodic(delay=nil)\n if delay.class == Fixnum && block_given?\n return @j_del.java_method(:setPeriodic, [Java::long.java_class,Java::IoVertxCore::Handler.java_class]).call(delay,(Proc.new { |event| yield(event) }))\n end\n raise ArgumentError, \"Invalid arguments when calling set_periodic(delay)\"\n end",
"def prepare_interval(period, &block); end",
"def schedule\n run_callbacks :schedule do\n perform_async\n end\n end",
"def add_periodical delay, timer_proc\n\n return nil unless timer_proc\n\n timer = Timer.new :timers => self, :delay => delay, :periodical => true, :timer_proc => timer_proc\n add timer\n timer\n end",
"def sleep_time_series(resource: nil, start_date: nil, end_date: nil, period: nil)\n raise FitgemOauth2::InvalidArgumentError, 'Start date not provided.' unless start_date\n\n unless resource && SLEEP_RESOURCES.include?(resource)\n raise FitgemOauth2::InvalidArgumentError, \"Invalid resource: #{resource}. Valid resources are #{SLEEP_RESOURCES}.\"\n end\n\n if period && end_date\n raise FitgemOauth2::InvalidArgumentError, 'Both end_date and period specified. Specify only one.'\n end\n\n if period && !SLEEP_PERIODS.include?(period)\n raise FitgemOauth2::InvalidArgumentError, \"Invalid period: #{period}. Valid periods are #{SLEEP_PERIODS}.\"\n end\n\n second = period || format_date(end_date)\n\n url = ['user', user_id, 'sleep', resource, 'date', format_date(start_date), second].join('/')\n\n get_call(url + '.json')\n end",
"def schedule_task(proc, delay = 20)\n scheduler.schedule_async_delayed_task(plugin, proc, delay)\n end",
"def schedule_recurring_task_creation(task)\n recurring_scheduler = Scheduler.new\n @recurring_schedulers << recurring_scheduler\n\n recurring_scheduler.schedule.every \"#{Helpers.convert_frequency_to_seconds(task.frequency).to_s}s\" do\n new_task = Task.new\n new_task.description = task.description\n new_task.frequency = task.frequency\n new_task.creation_date = Time.now.getlocal\n new_task.target_date = Helpers.calculate_task_target_date(\n new_task.creation_date,\n new_task.frequency\n )\n new_task.recurring_scheduler_id = recurring_scheduler.id\n\n new_task.create_reminder_notification\n new_task.create_failed_notification\n\n add_task(new_task)\n end\n end",
"def every (seconds)\n\t\t@every = seconds\n\n\t\trestart\n\tend",
"def start_periodic_timers; end",
"def start_periodic_timers; end",
"def every(interval, &block)\n action = Action.new({\n :interval => interval,\n :recur => true\n },\n &block\n )\n to_run.push(action)\n reset\n action\n end",
"def create_periodic_timer(interval, &block)\n Timer.new(self, interval, :periodic => true, &block)\n end",
"def period=(value)\n @period = value\n end",
"def schedule_every(n, &block)\r\n\r\n while true do\r\n before = Time.now\r\n\r\n block.call\r\n \r\n elapsed = Time.now - before\r\n interval = n - elapsed\r\n \r\n @logger.debug \"orders processing/delivery take #{elapsed} seconds.\"\r\n \r\n sleep(interval) if interval > 0\r\n end\r\n\r\nend",
"def start_periodic_status_check(duration: 600)\n check_status_on_schedule(duration: duration)\n end",
"def goals(period)\n unless period && [:daily, :weekly].include?(period)\n raise FitgemOauth2::InvalidArgumentError, \"Goal period should either be 'daily' or 'weekly'\"\n end\n end",
"def initialize(testing_frequency = \"60m\")\n # Set up the tasks\n @job_ids_by_task = {}\n @tasks_by_job_ids = {}\n # Start the scheduler\n @scheduler = Rufus::Scheduler.start_new\n # Create a logger\n @logger = Logger.new( 'scheduler.log', 'monthly' )\n @task_test_results_logger = Logger.new( 'task_test_results.log', 'monthly' )\n puts \"Schedule tests\"\n # Add the test runninng scheduler method\n @scheduler.every(testing_frequency) do\n test_results = execute_task_tests()\n test_results.each {|test_result|\n # the test is not nil then we have an error (print this error to the log)\n if(!test_result.nil?)\n @task_test_results_logger.error(test_result.inspect)\n end\n }\n end\n end",
"def schedule(time, callback); end",
"def at(delay, options = {}, &task)\n options = { :delay => delay, :scheduler => self }.merge(options)\n @queue << Task.new(options, &task)\n end",
"def start_stream_loop(period, block)\n @streaming = true\n if block.call(self)\n EventMachine::add_timer(period) {start_stream_loop(period, block)}\n else\n set_state(:state_done)\n end\n end",
"def set_temperature_callback_period(period)\n send_request(FUNCTION_SET_TEMPERATURE_CALLBACK_PERIOD, [period], 'L', 0, '')\n end",
"def trigger (params)\n\n return if paused?\n\n ldebug { \"trigger() cron : #{@fei.to_debug_s}\" }\n\n #@raw_child.application_context = @application_context\n # done in expool.tlaunch_child()\n\n begin\n\n @counter += 1\n store_itself\n #\n # note : one variant would be to give Time.now.to_f as a sub_id...\n # then no need to store...\n #\n # but it's good to have a counter to keep track of the number of\n # executions\n\n child_fei = get_expression_pool.tlaunch_child(\n self,\n first_expression_child,\n @counter,\n @applied_workitem.dup,\n :register_child => false)\n #\n # register_child is set to false, cron doesn't keep\n # track of its spawned children\n\n rescue\n\n lerror do\n \"trigger() cron caught exception\\n#{OpenWFE::exception_to_s($!)}\"\n end\n end\n end",
"def trigger\n @timed_out = false\n @expires = Time.now + @period\n unless @thread\n @thread = Thread.new do\n begin\n begin\n sleepytime = @expires - Time.now\n while sleepytime > 0.0\n sleep(sleepytime)\n sleepytime = @expires - Time.now\n end\n @timed_out = true\n @expires += @period if @repeats\n @block.call if @block\n end while @repeats\n rescue StopTimerException\n @expires=nil\n ensure\n @thread = nil\n end\n end\n end\n end",
"def beginning_of(period)\n case period\n when :eternity then change(:year => 1970, :month => 1, :day => 1, :hour => 00, :min => 00, :sec => 00)\n when :day, :week, :month, :year, :hour, :minute then send(\"beginning_of_#{period}\")\n else raise_invalid_period(period)\n end\n end",
"def submitForApproval(period=nil, comment='', name=@username)\n if period.nil? then\n # First day of work week\n cur = currentApprovalStatus(nil, name)\n period = cur.access 'period.dateFrom'\n end\n verbose \"Submitting timesheet for #{period}\"\n post('timesheet-approval/', {\n :user=>{\n :name=>name,\n },\n :period=>{\n :dateFrom=>period,\n },\n :action=>{\n :name=>:submit,\n :comment=>comment,\n }\n }) unless $cfg['tool.dry']\n end",
"def initialize(period, length = nil)\n name = period.to_sym\n if AVAILABLE_PERIODS.include?(name)\n @name = name\n elsif AVAILABLE_TIME_UNITS.include?(name)\n @name = PERIOD_MAPPING.invert[name]\n else\n raise ArgumentError, \"`#{period}' is not a valid period\"\n end\n @length = length\n @format = Von.config.send(:\"#{@name}_format\")\n end",
"def load_schedule!\n @schedule ||= load_default_schedule\n\n fail 'You should setup a schedule or place it in config/schedule.yml' unless schedule\n\n schedule.each do |name, config|\n # If rails_env is set in the config, enforce ENV['RAILS_ENV'] as\n # required for the jobs to be scheduled. If rails_env is missing, the\n # job should be scheduled regardless of what ENV['RAILS_ENV'] is set\n # to.\n if config['rails_env'].nil? || rails_env_matches?(config)\n setup_job_schedule(name, config)\n end\n end\n end",
"def schedule_firing_time\n if @exact_time\n @fire_time = @exact_time.to_f * 1_000\n else\n @initiated = Timers.now\n\n @fire_time = @initiated + @delay\n end\n end",
"def run!\n logger.info(\"Running task #{self.class.to_s}\")\n @block.call\n @next_run = cron_parser && cron_parser.next(Time.now)\n end",
"def work(interval = 5.0)\n interval = Float(interval)\n $0 = \"resque-delayed: harvesting\"\n startup\n\n loop do\n break if shutdown?\n\n # harvest delayed jobs while they are available\n while job = Resque::Delayed.next do\n log \"got: #{job.inspect}\"\n queue, klass, *args = job\n Resque::Job.create(queue, klass, *args)\n end\n\n break if interval.zero?\n log! \"Sleeping for #{interval} seconds\"\n sleep interval\n end\n end",
"def schedule_at (at, params={}, &block)\n\n do_schedule_at(\n at,\n prepare_params(params),\n &block)\n end",
"def start\n Thread.new(interval, pool) do |i, p|\n while (true)\n sleep(i)\n p.reap\n end\n end\n end",
"def initialize interval, timeout\n @interval = interval\n @cancelled = false\n\n @timeout = EM.add_periodic_timer timeout, method(:timeout_fired)\n\n schedule\n end",
"def is_in_period(period, timeStep)\n\t\t\n\t\tmrts_l = convertHour2Ts(@inputs.morning_rush_time_slot_L)\n\t\tmrts_u = convertHour2Ts(@inputs.morning_rush_time_slot_U)\n\t\terts_l = convertHour2Ts(@inputs.evening_rush_time_slot_L)\n\t\terts_u = convertHour2Ts(@inputs.evening_rush_time_slot_U)\n\t\t\n\t\tcase period\n\t\twhen 'morning'\n\t\t\treturn (mrts_l <= timeStep) && (timeStep <= mrts_u)\n\t\twhen 'evening'\n\t\t\treturn (erts_l <= timeStep) && (timeStep <= erts_u)\n\t\twhen 'outsideRushPeriods'\n\t\t\treturn \t(timeStep >= 0 && timeStep < mrts_l) || # before morning rush\n\t\t\t\t\t(timeStep > mrts_u && timeStep < erts_l) || # between morning and evening rushes\n\t\t\t\t\t(timeStep > erts_u && timeStep < @nbTSInOneDay) # after evening rush\n\t\tend\n\tend",
"def set_period\n @period = Period.joins(:budget).where(user: current_user).find(params[:period_id] || params[:id])\n end",
"def schedule(opts)\n opts = check_params(opts,[:schedule])\n super(opts)\n end",
"def generate_schedule\n \tschedule = Array.new\n \tqueue = Array.new\n \tcurrent_job = nil\n \tcurrent_job_execution_time = 0\n\n \tfor time in 0...hyper_period\n \t\t# add released tasks to queue\n \t\tqueue += get_released_jobs time\n\n \t\t# give the current job credit for execution in last step\n \t\tcurrent_job_execution_time += 1 unless current_job.nil?\n\n \t\t#check if current task is finished\n \t\tif !!current_job and current_job[:task].worst_case_execution_time == current_job_execution_time\n \t\t\t#task is finished\n \t\t\tcurrent_job = nil\n \t\t\tcurrent_job_execution_time = 0\n \t\tend\n\n \t\t#find a task to execute\n \t\tif current_job.nil?\n \t\t\tcurrent_job = get_highest_priorty_task(queue)\n \t\t\tqueue.delete(current_job)\n \t\tend\n\n \t\t# if we are missing a deadline task set is not schedulable\n \t\tif !!current_job and time >= current_job[:deadline]\n \t\t\treturn nil\n \t\tend\n\n \t\t# add current job to schedule\n \t\tschedule.push(current_job.nil? ? 0 : current_job[:task].id)\n\n \t\t#log whats executing in this slot\n \t\t#puts \"Slot #{time + 1} \" + (current_job.nil? ? \"Idle\" : current_job[:task].name)\n \tend\n\n \t# if queue isn't empty, then return nil\n \treturn nil unless queue.empty?\n\n \t#return schedule\n \tschedule\n end",
"def set_and_authorize_period\n @period = Period.find(params[:id])\n authorize @period, \"#{action_name}?\".to_sym\n end",
"def day_period(time = now, type: :default) = day_periods(time, type: type).min_by(&:length)",
"def schedule(parent: @parent || Task.current)\n @scheduler_task ||=\n parent.async { |task|\n task.annotate(\"scheduling tasks for #{self.class}.\")\n\n while @waiting.any? && !limit_blocking?\n delay = [next_acquire_time - Async::Clock.now, 0].max\n task.sleep(delay) if delay.positive?\n resume_waiting\n end\n\n @scheduler_task = nil\n }\n end",
"def start()\n raise ValidateError.new(\"#{full_name} not validated.\") unless @prepared\n @tasks.each_value { |task| task.start() }\n end",
"def run\n super\n cron_poller.start\n end",
"def schedule\n run_callbacks :schedule do\n inline_mode ? perform_inline : perform_async\n end\n end",
"def schedule_repetition\n self.due = Date.today + interval\n self.studied_at = Date.today\n end",
"def start(delay: nil, between: nil)\n Rails.logger.info \"\\n***** Processing request queue for user_type '#{queue.user_type}'\\n\"\n @delay = delay; @between = between\n if @delay or @between\n schedule_requests(@delay)\n # sending requests by schedule makes a copy of the sender and queue objects for\n # asynchronous execution, so we have to manually clear out the original queue.\n queue.clear\n else\n send_all_requests\n end\n end",
"def period_start\n period.begin\n end",
"def calc_next_run\n RunAtPeriodicJob.new(:name => self.name, :job => self.job, :run_at_minutes => self.run_at_minutes)\n end",
"def every(name, interval = 60, initial = nil, &block)\n Thread.new(initial) { |context|\n while true\n Kernel.sleep(interval)\n MObject.debug(\"every(#{name}): fires - #{context}\")\n begin\n if ((context = block.call(context)) == nil)\n break\n end\n rescue Exception => ex\n bt = ex.backtrace.join(\"\\n\\t\")\n MObject.error(\"every(#{name})\",\n \"Exception: #{ex} (#{ex.class})\\n\\t#{bt}\")\n end\n end\n MObject.debug(\"every(#{name}): finishes\")\n }\n end",
"def current_timeset_period=(val)\n @current_timeset_period = val\n end",
"def period(period, options = {})\n get(\"periods/#{period}\", options).pop\n end",
"def start\n @runner = Runner.new @options\n if @runner.nil?\n @raise [:task_has_failed]\n end\n notify_start\n run_all if @options[:all_on_start]\n end",
"def define(pid_path: nil)\n raise ArgumentError, 'must provide a scheduler builder block' unless block_given?\n\n @pid_path = Scheduler::DaemonWorking.normalize_pid pid_path\n\n namespace :procrastinator do\n desc 'Start the Procrastinator daemon'\n task :start do\n start(yield)\n end\n\n desc 'Show Procrastinator daemon status'\n task :status do\n status\n end\n\n desc 'Stop the Procrastinator daemon'\n task stop: [:status] do\n stop\n end\n\n desc 'Restart Procrastinator daemon'\n task restart: [:stop, :start]\n end\n end",
"def run_once(timeout = nil)\n\t\t\tKernel::raise \"Running scheduler on non-blocking fiber!\" unless Fiber.blocking?\n\t\t\t\n\t\t\t# If we are finished, we stop the task tree and exit:\n\t\t\tif self.finished?\n\t\t\t\treturn false\n\t\t\tend\n\t\t\t\n\t\t\tinterval = @timers.wait_interval\n\t\t\t\n\t\t\t# If there is no interval to wait (thus no timers), and no tasks, we could be done:\n\t\t\tif interval.nil?\n\t\t\t\t# Allow the user to specify a maximum interval if we would otherwise be sleeping indefinitely:\n\t\t\t\tinterval = timeout\n\t\t\telsif interval < 0\n\t\t\t\t# We have timers ready to fire, don't sleep in the selctor:\n\t\t\t\tinterval = 0\n\t\t\telsif timeout and interval > timeout\n\t\t\t\tinterval = timeout\n\t\t\tend\n\t\t\t\n\t\t\tbegin\n\t\t\t\[email protected](interval)\n\t\t\trescue Errno::EINTR\n\t\t\t\t# Ignore.\n\t\t\tend\n\t\t\t\n\t\t\[email protected]\n\t\t\t\n\t\t\t# The reactor still has work to do:\n\t\t\treturn true\n\t\tend",
"def every(interval, &block)\n Timer.new(self, interval, true, block)\n end",
"def start\n events.map(&:schedule)\n end",
"def scheduled_tasks\n self.tasks.select { \n |t| t.interval != :startup && t.interval != :shutdown\n }\n end",
"def run_replications\n # Add fresh schedule\n old_shedule = @schedule\n @schedule = {}\n @active = false\n\n old_shedule.each_value do |conn|\n conn.start\n end\n end",
"def periodic_stream(delay=nil)\n if delay.class == Fixnum && !block_given?\n return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:periodicStream, [Java::long.java_class]).call(delay),::Vertx::TimeoutStream)\n end\n raise ArgumentError, \"Invalid arguments when calling periodic_stream(delay)\"\n end",
"def wait(per = nil)\n @target += per || @period\n error = @target - Time.now\n sleep error if error > 0\n true\n end"
] | [
"0.6499388",
"0.6206337",
"0.5930672",
"0.57904136",
"0.5744161",
"0.5512998",
"0.54905796",
"0.5474985",
"0.5474985",
"0.53982836",
"0.53610456",
"0.5318919",
"0.529568",
"0.52906144",
"0.5283434",
"0.52251387",
"0.5196062",
"0.519141",
"0.5170202",
"0.5167955",
"0.5111225",
"0.51087487",
"0.5108138",
"0.5042123",
"0.5040744",
"0.5036445",
"0.50255716",
"0.5025371",
"0.5006852",
"0.49965635",
"0.49918374",
"0.49869293",
"0.49869293",
"0.49638003",
"0.4926531",
"0.49231043",
"0.49231043",
"0.49231043",
"0.49179646",
"0.49136657",
"0.48802963",
"0.48752117",
"0.48616973",
"0.48500165",
"0.4835787",
"0.4831034",
"0.48067656",
"0.47776982",
"0.47768304",
"0.47686756",
"0.47686756",
"0.4766531",
"0.47576055",
"0.47566074",
"0.4754618",
"0.47411892",
"0.46934432",
"0.4670244",
"0.4648131",
"0.4640292",
"0.46295777",
"0.46198362",
"0.46172363",
"0.4606154",
"0.46059284",
"0.46002695",
"0.45956802",
"0.4594777",
"0.45942396",
"0.45935106",
"0.45893183",
"0.458513",
"0.4581218",
"0.4574927",
"0.4567152",
"0.45627055",
"0.45538077",
"0.4553096",
"0.45453683",
"0.45398185",
"0.45299977",
"0.4524939",
"0.45223966",
"0.45007157",
"0.44877684",
"0.44823572",
"0.44807398",
"0.44787973",
"0.44678",
"0.4464933",
"0.44635415",
"0.4461112",
"0.44573966",
"0.4456887",
"0.44545728",
"0.4452938",
"0.44521797",
"0.44346717",
"0.44250727",
"0.44191402"
] | 0.8104139 | 0 |
GET /notifications GET /notifications.json | def index
@notifications = Notification.with_deleted.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notifications\n query_api_object Notification, \"/rest/notifications\", nil, \"GET\", \"notifications\"\n end",
"def get_notifications\n begin\n response = notifications_api.get\n [parse_json(response), nil]\n rescue RestClient::Unauthorized\n [{}, Unauthorized]\n end\n end",
"def notifications(params={})\n Endpoints::Notifications.new(self).get(params)\n end",
"def notifications\n response = query_api(\"/rest/notifications\")\n return response[\"notifications\"].map {|notification| Notification.new(self, notification)}\n end",
"def index\n @notifications = Notification.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notifications }\n end\n end",
"def notifications\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n @client = Octokit::Client.new(:access_token => @current_user.token)\n\n # get first 50 notifications (github paginates at 50)\n notifications = @client.notifications({all: true, per_page: 50})\n\n # if there are more pages, get page 2\n more_pages = @client.last_response.rels[:next]\n if more_pages\n notifications.concat more_pages.get.data\n end\n\n # Consider how to get more pages...\n # page_count = 0\n # while more_pages and page_count < 10\n # notifications.concat more_pages.get.data\n # page_count++\n # more_pages = @client.last_response.rels[:next]\n # end\n\n # iterate over notifications to:\n # add score value\n # add notification_url value\n @json = notifications.map do |notification|\n add_score_url_to_notification(notification, {favRepos: @current_user.UserPreference.repos})\n end\n\n respond_to do |format|\n format.json {\n render json: @json.to_json, status: 200\n }\n end\n end",
"def index\n notifications = params[:unread].nil? || params[:unread] == 0 ? current_user.notifications : Notification.where(user: current_user, status: :unread).all\n\n render json: {\n status: 'Success',\n message: '',\n notifications: notifications.as_json(except: [\n :created_at,\n :updated_at\n ])\n }, status: 200\n end",
"def list_notifications\n BrickFTP::API::Notification.all\n end",
"def list_notifications\n BrickFTP::API::Notification.all\n end",
"def notifications\n @user = current_user\n @notifications.update_all(updated_at: Time.zone.now)\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def index\n # @notifications = current_user.notifications\n @notifications = @notifications.order(\"id desc\")\n\n if !params[:search].blank?\n @notifications = @notifications&.search(params[:search])\n end\n\n total = @notifications&.count\n\n @notifications = @notifications&.paginate(per_page: params[:per_page], page: params[:page])\n\n render json: {\n data: @notifications.collect{|n| NotificationSerializer.new(n).attributes},\n meta: {\n current_page: params[:page],\n per_page: params[:per_page],\n total: total\n }\n }\n end",
"def index\n @notifications = current_user.notifications.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @notifications }\n end\n end",
"def index\n authorize(Notification)\n render(:index, locals: { notifications: @notifications.page(1) })\n end",
"def index\n\t\t@notifications = Notification.all\n\tend",
"def index\n respond_with @notifications = Notification.latest.paginate(:page => params[:page], :per_page => 100)\n end",
"def notifications(page = 1)\n\t\t\toptions = {\"page\" => page}\n\t\t\tdata = oauth_request(\"/notifications.xml\", options)\n\t\t\tHashie::Mash.new(data)\n\t\tend",
"def index\n @notifications = Notification.all\n end",
"def index\n @notifications = Notification.all\n end",
"def index\n @notifications = Notification.all\n end",
"def index\n @notifications = Notification.all\n end",
"def index\n @notifications = Notification.all\n end",
"def index\n @notifications = Notification.all\n end",
"def notifications\n response = self.class.get('/notifications.xml')\n notifications_array = []\n response['notifications'].each do |note|\n new_note = Notification.new(:body => note[\"body\"],\n :subject => note[\"subject\"],\n :send_at => note[\"send_at\"],\n :id => note[\"id\"],\n :escalation => note[\"escalation\"])\n note[\"recipients\"].each do |rcpt|\n new_note.add_recipient(Recipient.new(:id => rcpt[\"id\"],\n :channel => rcpt[\"channel\"],\n :address => rcpt[\"address\"],\n :status => rcpt[\"status\"],\n :send_at => rcpt[\"send_at\"]))\n end\n notifications_array << new_note \n end\n notifications_array\n end",
"def index\n @notifications = Notification.includes(:contextable).where(notifiable: @context)\n render json: paginated_json(@notifications) { |notifications| notifications_json(notifications) }\n end",
"def get_notifications\n \t\n \t@notifs = []\n\n \tif current_user\n @notifs = Notification.where(:user_id => current_user.id, :seen => false)\n \tend\n end",
"def index\n @notifications = Notification.all\n @notifications = @notifications.select { |x| x.user_id == params[:user_id].to_i }\n render json: { items: @notifications }\n end",
"def list_notifications # :norobots:\n @notifications = Notification.find_all_by_user_id(@user.id, order: :flavor)\n end",
"def index\n @notifications = Notification.where(user: current_user)\n end",
"def show\n @notification = Notification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notification }\n end\n end",
"def notifications(blog_name, options = {})\n validate_options([:before, :types], options)\n get(blog_path(blog_name, 'notifications'), options)\n end",
"def index\n @notifications = current_user.notifications.unread.page(params[:page]).per(20)\n end",
"def show\n render json: @notification\n end",
"def index\n puts \"==========================\"\n puts \"INDEX\"\n @notifications = Notification.where({user: current_user})\n end",
"def index\n\t\t@notifications = Notification.where(recipient_id: current_user.id).unread\n\tend",
"def message_notifications\n notifications = Message.where(receiver_id: @current_user.id, read_status: 0)\n if notifications\n render json: {\n status: 'success',\n message: 'Your notifications',\n data: notifications.length()\n },\n status: :ok\n end\n end",
"def check\n\n\t\t@unseenNotifications = {notifications: current_user.notifications.unseen.count}\n\t\trespond_to do |format|\n\n\t\t\tformat.json { render json: @unseenNotifications }\n\n\t\tend\n\n\tend",
"def show_notifications # :norobots:\n pass_query_params\n data = []\n @observation = find_or_goto_index(Observation, params[:id].to_s)\n return unless @observation\n name_tracking_emails(@user.id).each do |q|\n fields = [:naming, :notification, :shown]\n naming_id, notification_id, shown = q.get_integers(fields)\n next unless shown.nil?\n notification = Notification.find(notification_id)\n if notification.note_template\n data.push([notification, Naming.find(naming_id)])\n end\n q.add_integer(:shown, 1)\n end\n @data = data.sort_by { rand }\n end",
"def get_notifications notifiable_type\n n = Notification.where(user_id:current_user, notifiable_type: notifiable_type)\n events_id = Array.new\n n.each do |v|\n events_id << v.notifiable_id\n end\n events = Event.where(id:events_id)\n\n end",
"def index\n\n if @notification\n json_response(@notification.user_subscriptions)\n end\n if request.path_parameters.has_key?(:user_id)\n json_response(@user.user_subscriptions)\n end\n end",
"def index\n @notifications = current_user ? current_user.user_notifications.unopened : []\n\n respond_to do |format|\n format.js { render :partial => \"shared/notifications_list\", locals: { :notifications => @notifications } }\n end\n\n end",
"def show\n # Title of the webpage\n @title = 'Notifications'\n\n # Getting all of the user's notifications, then those that are unread\n @all_notifications = Notification.where([\"user_id = :id\", { id: current_user.id }]).order(created_at: :desc)\n @notification_content = {}\n @unread_notification_ids = []\n\n @all_notifications.each do |notification|\n if notification.unread?\n # Mark all of the unread notifications as read, since they have now been opened\n @unread_notification_ids << notification.id\n notification.unread = false\n notification.save\n end\n\n # Get the pieces of the body of the notification\n if notification.body\n @notification_content[notification.id] = notification.body.split(/\\n/)\n end\n\n end\n\n # Clear the number of unread notifications for the user\n current_user.update_attribute(:unread_notifications, 0)\n end",
"def api_payment_get_notification\n\n raise \"No notification ID\" unless @payment_notification_id\n\n url = \"#{@config['api_host']}/1/payments/notifications/#{@payment_notification_id}?access_token=#{@oauth_token}\"\n\n puts \"Finding notification info...\"\n log_error \"Request: #{url}\" if @debug >= AttApiReporter::DEBUG_INFO\n\n begin\n page = @agent.get(url)\n notificationStatus = JSON.parse(page.body)\n log_error JSON.pretty_generate(notificationStatus)\n rescue Exception => e\n log_error e.backtrace\n log_error e.page.body\n end\n end",
"def index\n #@notifications = Notification.all\n @notifications = Notification.order('updated_at').page(params[:page]).per_page(10)\n end",
"def index\n @payment_notifications = PaymentNotification.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @payment_notifications }\n end\n end",
"def notifications\n @other_user = @login_user\n @notifications = DiscussionGroupUser.where(['user_id =? AND is_member=?', @login_user.id, false])\n @disc_notifications = NonSiteUser.where([\"email=? AND invitable_type=? and invitation_type=?\",@login_user.email,\"Discussion\",\"Invited\"])\n respond_to do |format|\n format.html\n end\n end",
"def show\n @emails = JSON.parse(@notification.fetch_emails)\n end",
"def notifications\n end",
"def get_notifications\n @notifications = Broadcast.joins(:feeds).where(feeds: {name: \"notification\"}).order(created_at: :desc).limit(20)\n end",
"def all\n for_user_id = @authenticated_user.id\n notifications = Notification.where(for_user_id: for_user_id, notification_type: [0,1,2,3,4])\n .order(created_at: :desc)\n notifications.each do |n|\n if (n.sent_at == nil)\n n.sent_at = Time.now\n n.save\n end\n end\n render json: Notification.render_json_full(notifications)\n end",
"def index\n @page_title = @menu_title = 'Message Board'\n\n @user = auth_user\n\n if params[:list_type].to_s == 'archive'\n @notifications = ::Users::Notification.sent_to(@user.id).already_viewed.includes(:sender)\n elsif params[:list_type].to_s == 'waiting'\n @notifications = ::Users::Notification.sent_to(@user.id).in_wait.includes(:sender)\n else\n @notifications = ::Users::Notification.sent_to(@user.id).not_deleted.includes(:sender).order('status DESC, id DESC')\n end\n # Web-only\n @notifications = @notifications.parent_required if auth_user.is_a?(Parent) && request.format == 'text/html'\n @notifications = @notifications.paginate(page: [1, params[:page].to_i].max, per_page: ::Users::Notification.per_page)\n\n if (order = normalized_order).present?\n @notifications = @notifications.order(order == 'ASC' ? 'id ASC' : 'id DESC')\n end\n\n #puts request.headers['X-App-Name'].eql? 'kidstrade-ios'\n\n @sorted_notifications = @notifications.to_a.sort do|x, y|\n x.compares_with(y)\n end\n ::Users::Notification.set_related_models( @sorted_notifications )\n\n respond_to do |format|\n format.html { render layout:'landing_25' }\n format.json do\n result = reject_notes(@sorted_notifications);\n render json: (result.collect{|n| n.as_json(relationship_to_user: @user) } )\n end\n end\n end",
"def notifications\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Notifications::Base)\n end",
"def unread_notifications\n notifications_received.where('activities.created_at > ?', notifications_checked_at)\n end",
"def show\n @notifications = current_user.notifications.limit(3)\n end",
"def all_notifications\n self.notifications.all\n end",
"def index\n #@notifications = Notification.all\n\t\t@notifications = Notification.paginate :order => \"created_at DESC\",\n\t\t\t:page => params[:page], :per_page => 15\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @notifications }\n end\n end",
"def show\n respond_with @notification = Notification.find(params[:id])\n end",
"def index\n @notifies = Notify.where(:course_id => @course.id).order('created_at DESC').page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @course.notifies }\n end\n end",
"def index\n @notifications = Notification.where(recipient: current_user).limit(10).order(created_at: :desc)\n end",
"def index\n add_breadcrumb \"Index\"\n\n @alerts = AlarmNotification.not_archieved.order(\"created_at DESC\").page(params[:page])\n\n respond_with(@alerts)\n end",
"def index\n @email_notifications = EmailNotification.all\n end",
"def index\n @payment_notifications = []\n if current_user.role? :admin \n @payment_notifications = PaymentNotification.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @payment_notifications }\n end\n end",
"def index\n @kpi_notifications = KpiNotification.all\n end",
"def index\n @notifications = current_user.notifications.reverse\n\n @notifications = Kaminari.paginate_array(@notifications).page(params[:page]).per(10)\n respond_to do |format|\n format.html\n end\n end",
"def notifications(options = {})\n #:type => nil is a hack not to give Messages as Notifications\n notifs = Mailboxer::Notification.recipient(messageable).where(:type => nil).order(\"mailboxer_notifications.created_at DESC\")\n if options[:read] == false || options[:unread]\n notifs = notifs.unread\n end\n\n notifs\n end",
"def show\n @notification = current_user.find_client(params[:client_id]).notifications.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def index\n @notification_contents = current_account.notification_contents.all\n end",
"def notification(id)\n response = self.class.get(\"/notifications/\" + id.to_s + \".xml\")\n note = response[\"notification\"]\n new_note = Notification.new( :body => note[\"body\"],\n :subject => note[\"subject\"],\n :id => note[\"id\"],\n :send_at => note[\"send_at\"],\n :escalation => note[\"escalation\"])\n note[\"recipients\"].each do |rcpt|\n new_note.add_recipient(Recipient.new(:id => rcpt[\"id\"],\n :channel => rcpt[\"channel\"],\n :address => rcpt[\"address\"],\n :status => rcpt[\"status\"],\n :send_at => rcpt[\"send_at\"]))\n end\n new_note \n end",
"def show\n @notification = Notification.find(params[:id])\n end",
"def unread\n @notifications = Notification.where(user_id: current_user.uid).where(is_read: false).page(params[:page]).order(created_at: :desc)\n end",
"def index\n @notifications = Notification.all.order(:id)\n end",
"def unread\n @notifications = current_user.notifications.unread.page(params[:page]).per(5)\n end",
"def show\n @alarm_notification = AlarmNotification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @alarm_notification }\n end\n end",
"def show\n @breadcrumb = 'read'\n @office = Office.find(params[:id])\n @notifications = @office.office_notifications.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @office }\n end\n end",
"def show\n respond_to do |format|\n if @notification==nil\n format.json { render json: {error: \"Esta notificacion ya no existe\"}, status: :not_found }\n format.html {\n redirect_to root_path, notice: \"Esta notificacion ya no existe\"\n }\n else\n format.json { render json: {notification: @notification}, status: :ok }\n format.html {\n @notification.update(readed: true)\n }\n end\n end\n end",
"def notifications\n return notification_data_source.notifications\n end",
"def index\n @users = User.all\n @notifications = Notification.where(recipient: current_user).unread\n end",
"def index\n if current_user.status == \"admin\" || current_user.status == \"staff\"\n @notifications = Notification.all.sort_by { |obj| obj.created_at }.reverse\n elsif current_user.student\n @notifications = []\n Notification.all.each do |notification|\n @notifications << notification if notification.target == \"all\" || notification.target == \"students\"\n end\n @notifications = @notifications.sort_by { |obj| obj.created_at }.reverse\n elsif current_user.company\n @notifications = []\n Notification.all.each do |notification|\n @notifications << notification if notification.target == \"all\" || notification.target == \"companies\"\n end\n @notifications = @notifications.sort_by { |obj| obj.created_at }.reverse \n end\n # @notifications = unreaded_notifications\n respond_to do |format|\n format.html {render template: \"/notifications/index\"}\n format.js\n end\n end",
"def notifications\n @campus_id = current_user.campus_users.first.campus_id\n invi_status=CRUD::Utility::Invitations.new(@campus_id)\n data = invi_status.get_request_sent\n render :json=>{:data=>data}\n end",
"def show\n @eve_notification = EveNotification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @eve_notification }\n end\n end",
"def show\n @push_notification = PushNotification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @push_notification }\n end\n end",
"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",
"def index\n\t\tnotification_categories = NotificationCategory.have_templates\n\t\trender json: notification_categories, status: :ok\n\tend",
"def show\n if @notification.waiting?\n if @notification.should_be_deleted_after_view?\n @notification.update_attribute(:status, ::Users::Notification::Status::DELETED)\n\n elsif @notification.should_flag_viewed?\n @notification.update_attribute(:status, ::Users::Notification::Status::VIEWED)\n end\n set_referer_as_redirect_back\n end\n respond_to do |format|\n format.html { redirect_to @notification.uri }\n format.json { render json: @notification.as_json(relationship_to_user: auth_user)\n }\n end\n end",
"def load_notifications\n if user_signed_in?\n @all_notifications = current_user.get_notifications\n @notifications = @all_notifications.first(10)\n @count = current_user.unread_notifications_count\n end\n end",
"def index\n @notification_counts = NotificationCount.all\n\n render json: @notification_counts\n end",
"def set_notifications\n\t\t@notifications = Notification.where(reciever_id: current_user).order(\"created_at DESC\")\n\tend",
"def index\n @notification_restrictions = NotificationRestriction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notification_restrictions }\n end\n end",
"def show\n client = Client.find(params[:id])\n notifications = Notification.all\n client_notifications = notifications\n .select { |notification| client.companies.include? notification.company }\n render json: client_notifications\n end",
"def index\n @notify_messages = NotifyMessage.all\n end",
"def index\n @title += \" | #{t('activerecord.models.notification')}\"\n if params[:notification]\n @notifications = Notification.joins(:car).where([\"cars.name LIKE ? OR text LIKE ?\",\n \"%#{params[:notification][:text]}%\",\n \"%#{params[:notification][:text]}%\"\n ]).order(\"created_at DESC\")\n else\n @notifications = Notification.where([\"user_id = ?\", current_user.id]).order(\"created_at DESC\").page params[:page]\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.js # index.js.erb\n format.json { render json: @notification }\n end\n end",
"def show\n @notification = current_user.notifications.find(params[:id])\n @receipients = @notification.receipients.paginate(:page => params[:page] || 1, :per_page => 10) \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @notification }\n end\n end",
"def generate_notifications\n\t\t@notifications = Notification.find(:all, :order => \"created_at DESC\")\n\tend",
"def get_notification_count(params = {})\n get('notifications/count', params)\n end",
"def received\n @notifications = Notification.where('receiver_id = ? ' +\n 'OR receiver_id IS NULL ' +\n 'OR topic IN (?)',\n @current_user.id, @current_user.get_subscribed_topic_ids)\n .order({created_at: :desc})\n .page(page_params[:page])\n .per(page_params[:page_size])\n render_multiple\n end",
"def show\n @notification = Notification.find_by(id: params[:id])\n end",
"def show\n render json: @notification_count\n end",
"def notifications_update\n @notifications = current_user.sk.followed_submissions.includes(:user, :problem).where(\"status > 0\").order(\"lastcomment DESC\").paginate(page: params[:page]).to_a\n @new = false\n render :notifications\n end",
"def notifications(options = {})\n scope = MessageCenter::Notification.recipient(messageable).order(:created_at => :desc)\n if options[:read] == false || options[:unread]\n scope = scope.unread\n end\n\n scope\n end",
"def index\n @page_header = \"通知\"\n unless params[:include_read]\n @notifications = Notification.where(read: false, user: current_user).page(params[:page]).per(10).order(\"id desc\")\n else\n @notifications = Notification.where(user: current_user).page(params[:page]).per(10).order(\"id desc\")\n end\n\n respond_to do |format|\n format.html\n format.js\n end\n\n end",
"def index\n @front_page_notifications = FrontPageNotification.all\n end"
] | [
"0.8339561",
"0.8280543",
"0.80831534",
"0.76445353",
"0.7561788",
"0.7450535",
"0.7411313",
"0.7227688",
"0.7227688",
"0.72002643",
"0.7156145",
"0.71267486",
"0.71203446",
"0.71198344",
"0.7106039",
"0.7098343",
"0.70976835",
"0.70976835",
"0.70976835",
"0.70976835",
"0.70976835",
"0.70976835",
"0.70912254",
"0.7079419",
"0.7072337",
"0.7018717",
"0.69956356",
"0.69002146",
"0.6881883",
"0.6869292",
"0.6816158",
"0.6805222",
"0.67910016",
"0.6775031",
"0.6762317",
"0.6748656",
"0.6735708",
"0.6735363",
"0.67099255",
"0.6703737",
"0.6699224",
"0.6665206",
"0.6609806",
"0.6595987",
"0.65815306",
"0.6573",
"0.6566333",
"0.6557476",
"0.6542688",
"0.6520084",
"0.64915603",
"0.64702797",
"0.6466733",
"0.6441565",
"0.64277214",
"0.6405226",
"0.6403471",
"0.63996863",
"0.63587254",
"0.6358445",
"0.63552815",
"0.63432837",
"0.63265747",
"0.63249826",
"0.63241464",
"0.6320674",
"0.6308989",
"0.6303756",
"0.63023394",
"0.6301699",
"0.6292597",
"0.62892085",
"0.6282428",
"0.6270338",
"0.6268974",
"0.62569946",
"0.6256704",
"0.62562746",
"0.625316",
"0.62527734",
"0.624947",
"0.62422985",
"0.6241176",
"0.62341136",
"0.6227372",
"0.62210274",
"0.6206786",
"0.61907786",
"0.61818165",
"0.61714685",
"0.61700606",
"0.61623555",
"0.6154173",
"0.6144401",
"0.6125313",
"0.6117835",
"0.6098525",
"0.6074086",
"0.6058674",
"0.60439986"
] | 0.6322093 | 65 |
GET /notifications/1 GET /notifications/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notifications\n query_api_object Notification, \"/rest/notifications\", nil, \"GET\", \"notifications\"\n end",
"def get_notifications\n begin\n response = notifications_api.get\n [parse_json(response), nil]\n rescue RestClient::Unauthorized\n [{}, Unauthorized]\n end\n end",
"def notifications(params={})\n Endpoints::Notifications.new(self).get(params)\n end",
"def index\n @notifications = Notification.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notifications }\n end\n end",
"def show\n @notification = Notification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notification }\n end\n end",
"def index\n notifications = params[:unread].nil? || params[:unread] == 0 ? current_user.notifications : Notification.where(user: current_user, status: :unread).all\n\n render json: {\n status: 'Success',\n message: '',\n notifications: notifications.as_json(except: [\n :created_at,\n :updated_at\n ])\n }, status: 200\n end",
"def index\n @notifications = Notification.all\n @notifications = @notifications.select { |x| x.user_id == params[:user_id].to_i }\n render json: { items: @notifications }\n end",
"def index\n respond_with @notifications = Notification.latest.paginate(:page => params[:page], :per_page => 100)\n end",
"def notifications\n response = query_api(\"/rest/notifications\")\n return response[\"notifications\"].map {|notification| Notification.new(self, notification)}\n end",
"def notifications\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n @client = Octokit::Client.new(:access_token => @current_user.token)\n\n # get first 50 notifications (github paginates at 50)\n notifications = @client.notifications({all: true, per_page: 50})\n\n # if there are more pages, get page 2\n more_pages = @client.last_response.rels[:next]\n if more_pages\n notifications.concat more_pages.get.data\n end\n\n # Consider how to get more pages...\n # page_count = 0\n # while more_pages and page_count < 10\n # notifications.concat more_pages.get.data\n # page_count++\n # more_pages = @client.last_response.rels[:next]\n # end\n\n # iterate over notifications to:\n # add score value\n # add notification_url value\n @json = notifications.map do |notification|\n add_score_url_to_notification(notification, {favRepos: @current_user.UserPreference.repos})\n end\n\n respond_to do |format|\n format.json {\n render json: @json.to_json, status: 200\n }\n end\n end",
"def show\n render json: @notification\n end",
"def index\n @notifications = Notification.all\n end",
"def index\n @notifications = Notification.all\n end",
"def index\n @notifications = Notification.all\n end",
"def index\n @notifications = Notification.all\n end",
"def index\n @notifications = Notification.all\n end",
"def index\n @notifications = Notification.all\n end",
"def index\n\t\t@notifications = Notification.all\n\tend",
"def index\n authorize(Notification)\n render(:index, locals: { notifications: @notifications.page(1) })\n end",
"def api_payment_get_notification\n\n raise \"No notification ID\" unless @payment_notification_id\n\n url = \"#{@config['api_host']}/1/payments/notifications/#{@payment_notification_id}?access_token=#{@oauth_token}\"\n\n puts \"Finding notification info...\"\n log_error \"Request: #{url}\" if @debug >= AttApiReporter::DEBUG_INFO\n\n begin\n page = @agent.get(url)\n notificationStatus = JSON.parse(page.body)\n log_error JSON.pretty_generate(notificationStatus)\n rescue Exception => e\n log_error e.backtrace\n log_error e.page.body\n end\n end",
"def show\n @notification = Notification.find(params[:id])\n end",
"def index\n @notifications = current_user.notifications.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @notifications }\n end\n end",
"def show\n @notification = current_user.find_client(params[:client_id]).notifications.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def show\n respond_with @notification = Notification.find(params[:id])\n end",
"def index\n\n if @notification\n json_response(@notification.user_subscriptions)\n end\n if request.path_parameters.has_key?(:user_id)\n json_response(@user.user_subscriptions)\n end\n end",
"def notifications(page = 1)\n\t\t\toptions = {\"page\" => page}\n\t\t\tdata = oauth_request(\"/notifications.xml\", options)\n\t\t\tHashie::Mash.new(data)\n\t\tend",
"def notifications\n @user = current_user\n @notifications.update_all(updated_at: Time.zone.now)\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def show\n @notification = Notification.find_by(id: params[:id])\n end",
"def list_notifications\n BrickFTP::API::Notification.all\n end",
"def list_notifications\n BrickFTP::API::Notification.all\n end",
"def index\n @notifications = Notification.includes(:contextable).where(notifiable: @context)\n render json: paginated_json(@notifications) { |notifications| notifications_json(notifications) }\n end",
"def show\n @push_notification = PushNotification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @push_notification }\n end\n end",
"def index\n # @notifications = current_user.notifications\n @notifications = @notifications.order(\"id desc\")\n\n if !params[:search].blank?\n @notifications = @notifications&.search(params[:search])\n end\n\n total = @notifications&.count\n\n @notifications = @notifications&.paginate(per_page: params[:per_page], page: params[:page])\n\n render json: {\n data: @notifications.collect{|n| NotificationSerializer.new(n).attributes},\n meta: {\n current_page: params[:page],\n per_page: params[:per_page],\n total: total\n }\n }\n end",
"def notification(id)\n response = self.class.get(\"/notifications/\" + id.to_s + \".xml\")\n note = response[\"notification\"]\n new_note = Notification.new( :body => note[\"body\"],\n :subject => note[\"subject\"],\n :id => note[\"id\"],\n :send_at => note[\"send_at\"],\n :escalation => note[\"escalation\"])\n note[\"recipients\"].each do |rcpt|\n new_note.add_recipient(Recipient.new(:id => rcpt[\"id\"],\n :channel => rcpt[\"channel\"],\n :address => rcpt[\"address\"],\n :status => rcpt[\"status\"],\n :send_at => rcpt[\"send_at\"]))\n end\n new_note \n end",
"def show\n @eve_notification = EveNotification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @eve_notification }\n end\n end",
"def show\n @alarm_notification = AlarmNotification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @alarm_notification }\n end\n end",
"def notifications\n response = self.class.get('/notifications.xml')\n notifications_array = []\n response['notifications'].each do |note|\n new_note = Notification.new(:body => note[\"body\"],\n :subject => note[\"subject\"],\n :send_at => note[\"send_at\"],\n :id => note[\"id\"],\n :escalation => note[\"escalation\"])\n note[\"recipients\"].each do |rcpt|\n new_note.add_recipient(Recipient.new(:id => rcpt[\"id\"],\n :channel => rcpt[\"channel\"],\n :address => rcpt[\"address\"],\n :status => rcpt[\"status\"],\n :send_at => rcpt[\"send_at\"]))\n end\n notifications_array << new_note \n end\n notifications_array\n end",
"def show_notifications # :norobots:\n pass_query_params\n data = []\n @observation = find_or_goto_index(Observation, params[:id].to_s)\n return unless @observation\n name_tracking_emails(@user.id).each do |q|\n fields = [:naming, :notification, :shown]\n naming_id, notification_id, shown = q.get_integers(fields)\n next unless shown.nil?\n notification = Notification.find(notification_id)\n if notification.note_template\n data.push([notification, Naming.find(naming_id)])\n end\n q.add_integer(:shown, 1)\n end\n @data = data.sort_by { rand }\n end",
"def show\n respond_to do |format|\n if @notification==nil\n format.json { render json: {error: \"Esta notificacion ya no existe\"}, status: :not_found }\n format.html {\n redirect_to root_path, notice: \"Esta notificacion ya no existe\"\n }\n else\n format.json { render json: {notification: @notification}, status: :ok }\n format.html {\n @notification.update(readed: true)\n }\n end\n end\n end",
"def notifications(blog_name, options = {})\n validate_options([:before, :types], options)\n get(blog_path(blog_name, 'notifications'), options)\n end",
"def index\n @notifications = Notification.where(user: current_user)\n end",
"def list_notifications # :norobots:\n @notifications = Notification.find_all_by_user_id(@user.id, order: :flavor)\n end",
"def index\n puts \"==========================\"\n puts \"INDEX\"\n @notifications = Notification.where({user: current_user})\n end",
"def show\n @notifications = current_user.notifications.limit(3)\n end",
"def show\n @emails = JSON.parse(@notification.fetch_emails)\n end",
"def message_notifications\n notifications = Message.where(receiver_id: @current_user.id, read_status: 0)\n if notifications\n render json: {\n status: 'success',\n message: 'Your notifications',\n data: notifications.length()\n },\n status: :ok\n end\n end",
"def index\n\t\t@notifications = Notification.where(recipient_id: current_user.id).unread\n\tend",
"def index\n @notifications = current_user.notifications.unread.page(params[:page]).per(20)\n end",
"def index\n #@notifications = Notification.all\n @notifications = Notification.order('updated_at').page(params[:page]).per_page(10)\n end",
"def notifications\n end",
"def get_notifications notifiable_type\n n = Notification.where(user_id:current_user, notifiable_type: notifiable_type)\n events_id = Array.new\n n.each do |v|\n events_id << v.notifiable_id\n end\n events = Event.where(id:events_id)\n\n end",
"def get_notifications\n \t\n \t@notifs = []\n\n \tif current_user\n @notifs = Notification.where(:user_id => current_user.id, :seen => false)\n \tend\n end",
"def show\n # Title of the webpage\n @title = 'Notifications'\n\n # Getting all of the user's notifications, then those that are unread\n @all_notifications = Notification.where([\"user_id = :id\", { id: current_user.id }]).order(created_at: :desc)\n @notification_content = {}\n @unread_notification_ids = []\n\n @all_notifications.each do |notification|\n if notification.unread?\n # Mark all of the unread notifications as read, since they have now been opened\n @unread_notification_ids << notification.id\n notification.unread = false\n notification.save\n end\n\n # Get the pieces of the body of the notification\n if notification.body\n @notification_content[notification.id] = notification.body.split(/\\n/)\n end\n\n end\n\n # Clear the number of unread notifications for the user\n current_user.update_attribute(:unread_notifications, 0)\n end",
"def check\n\n\t\t@unseenNotifications = {notifications: current_user.notifications.unseen.count}\n\t\trespond_to do |format|\n\n\t\t\tformat.json { render json: @unseenNotifications }\n\n\t\tend\n\n\tend",
"def index\n @payment_notifications = PaymentNotification.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @payment_notifications }\n end\n end",
"def index\n @notifications = Notification.all.order(:id)\n end",
"def show\n @notification = current_user.notifications.find(params[:id])\n @receipients = @notification.receipients.paginate(:page => params[:page] || 1, :per_page => 10) \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @notification }\n end\n end",
"def show\n render json: @notification_count\n end",
"def index\n @page_title = @menu_title = 'Message Board'\n\n @user = auth_user\n\n if params[:list_type].to_s == 'archive'\n @notifications = ::Users::Notification.sent_to(@user.id).already_viewed.includes(:sender)\n elsif params[:list_type].to_s == 'waiting'\n @notifications = ::Users::Notification.sent_to(@user.id).in_wait.includes(:sender)\n else\n @notifications = ::Users::Notification.sent_to(@user.id).not_deleted.includes(:sender).order('status DESC, id DESC')\n end\n # Web-only\n @notifications = @notifications.parent_required if auth_user.is_a?(Parent) && request.format == 'text/html'\n @notifications = @notifications.paginate(page: [1, params[:page].to_i].max, per_page: ::Users::Notification.per_page)\n\n if (order = normalized_order).present?\n @notifications = @notifications.order(order == 'ASC' ? 'id ASC' : 'id DESC')\n end\n\n #puts request.headers['X-App-Name'].eql? 'kidstrade-ios'\n\n @sorted_notifications = @notifications.to_a.sort do|x, y|\n x.compares_with(y)\n end\n ::Users::Notification.set_related_models( @sorted_notifications )\n\n respond_to do |format|\n format.html { render layout:'landing_25' }\n format.json do\n result = reject_notes(@sorted_notifications);\n render json: (result.collect{|n| n.as_json(relationship_to_user: @user) } )\n end\n end\n end",
"def show\n @notify_observer = NotifyObserver.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @notify_observer }\n end\n end",
"def show\n @job_notification = JobNotification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @job_notification }\n end\n end",
"def index\n @notifications = Notification.where(recipient: current_user).limit(10).order(created_at: :desc)\n end",
"def show\n @notification = Notification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @notification }\n end\n end",
"def show\n @notify_config = NotifyConfig.find(params[:id])\n\n add_breadcrumb('Notification Configuration')\n\n if stale?(:last_modified => @notify_config.updated_at.utc, :etag => @notify_config)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notify_config }\n end\n end\n end",
"def show\n @notice = @person.notices.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notice }\n end\n end",
"def show\n if @notification.waiting?\n if @notification.should_be_deleted_after_view?\n @notification.update_attribute(:status, ::Users::Notification::Status::DELETED)\n\n elsif @notification.should_flag_viewed?\n @notification.update_attribute(:status, ::Users::Notification::Status::VIEWED)\n end\n set_referer_as_redirect_back\n end\n respond_to do |format|\n format.html { redirect_to @notification.uri }\n format.json { render json: @notification.as_json(relationship_to_user: auth_user)\n }\n end\n end",
"def index\n @notifies = Notify.where(:course_id => @course.id).order('created_at DESC').page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @course.notifies }\n end\n end",
"def index\n @kpi_notifications = KpiNotification.all\n end",
"def index\n @notify_messages = NotifyMessage.all\n end",
"def index\n @notifications = current_user ? current_user.user_notifications.unopened : []\n\n respond_to do |format|\n format.js { render :partial => \"shared/notifications_list\", locals: { :notifications => @notifications } }\n end\n\n end",
"def show\n @payment_notification = PaymentNotification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment_notification }\n end\n end",
"def index\n #@notifications = Notification.all\n\t\t@notifications = Notification.paginate :order => \"created_at DESC\",\n\t\t\t:page => params[:page], :per_page => 15\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @notifications }\n end\n end",
"def get_notifications\n @notifications = Broadcast.joins(:feeds).where(feeds: {name: \"notification\"}).order(created_at: :desc).limit(20)\n end",
"def get_email_notification\n service_response = ClientManagement::GetEmailNotificationSetting.new(params).perform\n render_api_response(service_response)\n end",
"def show\n @breadcrumb = 'read'\n @office = Office.find(params[:id])\n @notifications = @office.office_notifications.paginate(:page => params[:page], :per_page => per_page).order('id')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @office }\n end\n end",
"def index\n @notification_contents = current_account.notification_contents.all\n end",
"def get_status(notification_id)\n request = {\n headers: HEADERS,\n endpoint: GET_STATUS_ENDPOINT + notification_id, method: :get\n }\n send_va_notify_request(request)\n end",
"def show\n client = Client.find(params[:id])\n notifications = Notification.all\n client_notifications = notifications\n .select { |notification| client.companies.include? notification.company }\n render json: client_notifications\n end",
"def call(id)\n client.delete(\"/api/rest/v1/notifications/#{id}.json\")\n true\n end",
"def all\n for_user_id = @authenticated_user.id\n notifications = Notification.where(for_user_id: for_user_id, notification_type: [0,1,2,3,4])\n .order(created_at: :desc)\n notifications.each do |n|\n if (n.sent_at == nil)\n n.sent_at = Time.now\n n.save\n end\n end\n render json: Notification.render_json_full(notifications)\n end",
"def notifications\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Notifications::Base)\n end",
"def notifications\n @campus_id = current_user.campus_users.first.campus_id\n invi_status=CRUD::Utility::Invitations.new(@campus_id)\n data = invi_status.get_request_sent\n render :json=>{:data=>data}\n end",
"def new\n @notify = Notify.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notify }\n end\n end",
"def new\n respond_with @notification = @application.notifications.new\n end",
"def show\n @apn_notification = APN::Notification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @apn_notification }\n end\n end",
"def index\n @notification_counts = NotificationCount.all\n\n render json: @notification_counts\n end",
"def new\n\n @notification = Notification.new\n @current_user = current_user\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notification }\n end\n end",
"def index\n @email_notifications = EmailNotification.all\n end",
"def unread_notifications\n notifications_received.where('activities.created_at > ?', notifications_checked_at)\n end",
"def all_notifications\n self.notifications.all\n end",
"def show\n @notification_restriction = NotificationRestriction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notification_restriction }\n end\n end",
"def get_notification_count(params = {})\n get('notifications/count', params)\n end",
"def notifications\n @other_user = @login_user\n @notifications = DiscussionGroupUser.where(['user_id =? AND is_member=?', @login_user.id, false])\n @disc_notifications = NonSiteUser.where([\"email=? AND invitable_type=? and invitation_type=?\",@login_user.email,\"Discussion\",\"Invited\"])\n respond_to do |format|\n format.html\n end\n end",
"def index\n @notifications = current_user.notifications.reverse\n\n @notifications = Kaminari.paginate_array(@notifications).page(params[:page]).per(10)\n respond_to do |format|\n format.html\n end\n end",
"def index\n add_breadcrumb \"Index\"\n\n @alerts = AlarmNotification.not_archieved.order(\"created_at DESC\").page(params[:page])\n\n respond_with(@alerts)\n end",
"def notification_badge\n if current_user.notifications.any?\n mi.notifications\n else\n mi.notifications_none\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pushup_reminders }\n end\n end",
"def unread\n @notifications = current_user.notifications.unread.page(params[:page]).per(5)\n end",
"def show\n render json: @notification_category\n end",
"def refreshnotify\n @title = \"\"\n\n puts '====================== refreshnotify'\n\n current_user.update_attributes!(:notify => \"NO\")\n @user = current_user\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> { \n :user=>@user.as_json(:only => [:id, :name, :email, :invitation_token, :notify, :buddy, :gender, :displayname], :methods => [:photo_url]) \n } }\n end\n end",
"def destroy\n @notification = @application.notifications.find(params[:id])\n @notification.destroy\n\n respond_with @notification\n end"
] | [
"0.76366484",
"0.7468357",
"0.74621856",
"0.7194608",
"0.70602906",
"0.6947561",
"0.68801",
"0.6859424",
"0.6850998",
"0.6815374",
"0.6815356",
"0.6802459",
"0.6802459",
"0.6802459",
"0.6802459",
"0.6802459",
"0.6802459",
"0.67795664",
"0.6767779",
"0.6733075",
"0.6710404",
"0.6672974",
"0.66560745",
"0.66487217",
"0.6635279",
"0.6634416",
"0.6608187",
"0.65764064",
"0.6566336",
"0.6566336",
"0.65512973",
"0.6542166",
"0.6541282",
"0.6509346",
"0.6506911",
"0.65007365",
"0.64924383",
"0.64742434",
"0.647416",
"0.64729613",
"0.6464894",
"0.64452535",
"0.64427316",
"0.64377177",
"0.6424477",
"0.64093024",
"0.638428",
"0.63833255",
"0.6377388",
"0.6367458",
"0.6334643",
"0.63322496",
"0.632344",
"0.63024217",
"0.62603724",
"0.6249368",
"0.6247088",
"0.6244338",
"0.6240017",
"0.6227811",
"0.6215515",
"0.620764",
"0.6189005",
"0.61830133",
"0.61773247",
"0.6176605",
"0.6168167",
"0.6162473",
"0.61456496",
"0.6141017",
"0.6137913",
"0.6117414",
"0.61163235",
"0.61148846",
"0.6110413",
"0.6098846",
"0.6098319",
"0.6097546",
"0.6096113",
"0.6090146",
"0.6086586",
"0.6086028",
"0.6079862",
"0.60593134",
"0.60546434",
"0.60522515",
"0.6042888",
"0.6031816",
"0.6030124",
"0.60294247",
"0.60240453",
"0.6013717",
"0.600067",
"0.5991014",
"0.5951737",
"0.5935499",
"0.59322995",
"0.5917476",
"0.5906326",
"0.59028167",
"0.5902259"
] | 0.0 | -1 |
POST /notifications POST /notifications.json | def create
session.delete(:return_to)
session[:return_to] ||= request.referer
device_ids = []
if notification_params[:notification_type] === 'division_wise'
@division = Division.find(notification_params[:type_data])
@division.students.each do |student|
@notification = Notification.new(title: notification_params[:title],
message: notification_params[:message],
from: notification_params[:from], student_id: student.id)
@user = User.where(username: student.father_mobile).last
unless device_ids.include?(@user.device_id)
device_ids << @user.device_id
end
@notification.save
if notification_params[:by_mail] == '1'
unless @notification.student.student_email.blank?
NotificationMailer.notify_student(@notification.student, @notification).deliver
end
end
if notification_params[:by_sms] == '1'
send_sms_to_parent(@notification.student, @notification)
end
end
if notification_params[:by_app] == '1'
puts device_ids
require 'fcm'
fcm = FCM.new(ENV['FCM_SERVER_KEY'])
# fcm = init_fcm
# @student = Student.find(notification_params[:student_id])
# @user = User.where(username: @student.father_mobile).last
# device_id = @user.device_id
# registration_ids= [device_id] # an array of one or more client registration tokens
options = {
priority: "high",
collapse_key: "updated_score",
notification: {
title: @notification.title,
body: @notification.message
}
}
response = fcm.send(device_ids, options)
puts response
end
respond_to do |format|
format.html { redirect_to session.delete(:return_to), notice: "Notification was sent successfully to All from division #{@division.name}." }
format.json { render :show, status: :created, location: @notification }
end
elsif notification_params[:notification_type] === 'standard_wise'
counter = 0
device_ids = []
@standard = Standard.find(notification_params[:type_data])
@standard.divisions.each do |division|
division.students.each do |student|
@notification = Notification.new(title: notification_params[:title],
message: notification_params[:message],
from: notification_params[:from], student_id: student.id)
@user = User.where(username: student.father_mobile).last
unless device_ids.include?(@user.device_id)
device_ids << @user.device_id
end
@notification.save
if notification_params[:by_mail] == '1'
unless @notification.student.student_email.blank?
NotificationMailer.notify_student(@notification.student, @notification).deliver
end
end
if notification_params[:by_sms] == '1'
send_sms_to_parent(@notification.student, @notification)
end
end
end
if notification_params[:by_app] == '1'
puts device_ids
require 'fcm'
fcm = FCM.new(ENV['FCM_SERVER_KEY'])
# fcm = init_fcm
# @student = Student.find(notification_params[:student_id])
# @user = User.where(username: @student.father_mobile).last
# device_id = @user.device_id
# registration_ids= [device_id] # an array of one or more client registration tokens
options = {
priority: "high",
collapse_key: "updated_score",
notification: {
title: @notification.title,
body: @notification.message
}
}
response = fcm.send(device_ids, options)
puts response
end
respond_to do |format|
format.html { redirect_to session.delete(:return_to), notice: "Notification was sent successfully to All from standard #{@standard.name}." }
format.json { render :show, status: :created, location: @notification }
end
elsif notification_params[:notification_type] === 'to_all'
device_ids = []
Student.all.each do |student|
@notification = Notification.new(title: notification_params[:title],
message: notification_params[:message],
from: notification_params[:from], student_id: student.id)
@user = User.where(username: student.father_mobile).last
unless device_ids.include?(@user.device_id)
device_ids << @user.device_id
end
@notification.save
if notification_params[:by_mail] == '1'
unless @notification.student.student_email.blank?
NotificationMailer.notify_student(@notification.student, @notification).deliver
end
end
if notification_params[:by_sms] == '1'
send_sms_to_parent(@notification.student, @notification)
end
end
if notification_params[:by_app] == '1'
puts device_ids
require 'fcm'
fcm = FCM.new(ENV['FCM_SERVER_KEY'])
# fcm = init_fcm
# @student = Student.find(notification_params[:student_id])
# @user = User.where(username: @student.father_mobile).last
# device_id = @user.device_id
# registration_ids= [device_id] # an array of one or more client registration tokens
options = {
priority: "high",
collapse_key: "updated_score",
notification: {
title: @notification.title,
body: @notification.message
}
}
response = fcm.send(device_ids, options)
puts response
end
respond_to do |format|
format.html { redirect_to session.delete(:return_to), notice: "Notification was sent successfully to All." }
format.json { render :show, status: :created, location: @notification }
end
elsif notification_params[:notification_type] === 'student_wise'
@notification = Notification.new(notification_params)
@notification.save
if notification_params[:by_mail] == '1'
unless @notification.student.student_email.blank?
NotificationMailer.notify_student(@notification.student, @notification).deliver
end
end
if notification_params[:by_sms] == '1'
send_sms_to_parent(@notification.student, @notification)
end
if notification_params[:by_app] == '1'
require 'fcm'
fcm = FCM.new(ENV['FCM_SERVER_KEY'])
# fcm = init_fcm
@student = Student.find(notification_params[:student_id])
@user = User.where(username: @student.father_mobile).last
device_id = @user.device_id
registration_ids= [device_id] # an array of one or more client registration tokens
options = {
priority: "high",
collapse_key: "updated_score",
notification: {
title: @notification.title,
body: @notification.message,
icon: "http://myschoolcon.com/images/schoolcon_logo.jpeg"
}
}
response = fcm.send(registration_ids, options)
puts response
end
respond_to do |format|
format.html { redirect_to session.delete(:return_to), notice: "Notification was sent successfully." }
format.json { render :show, status: :created, location: @notification }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_notification(attributes)\n begin\n response = notifications_api.post(encode_json(attributes))\n [parse_json(response), nil]\n rescue RestClient::UnprocessableEntity => e\n [parse_json(e.response), InvalidNotification]\n rescue RestClient::Unauthorized\n [{}, Unauthorized]\n end\n end",
"def create\n @notification = Notification.new(notification_params)\n\n if @notification.save\n render json: @notification\n else\n render json: @notification.errors, status: :unprocessable_entity\n end\n end",
"def create\n @notification = Notification.new(notification_params)\n if @notification.save\n Notifier.send_notification(@notification)\n render json: \"Created succesfully\", status: :ok\n else\n render json: @notification.errors, status: :unprocessable_entity\n end\n end",
"def create\n @notification = Notification.new(params[:notification])\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to @notification, notice: 'Notification was successfully created.' }\n format.json { render json: @notification, status: :created, location: @notification }\n else\n format.html { render action: \"new\" }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @notification = Notification.new(notification_params)\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to @notification, notice: 'Notification was successfully created.' }\n format.json { render :show, status: :created, location: @notification }\n else\n format.html { render :new }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def notifications\n @user = current_user\n @notifications.update_all(updated_at: Time.zone.now)\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def create\n @notification = Notification.new(notification_params)\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to @notification, notice: 'Notification was successfully created.' }\n format.json { render action: 'show', status: :created, location: @notification }\n else\n format.html { render action: 'new' }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @notification = Notification.new(notification_params)\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to @notification, notice: 'Notification was successfully created.' }\n format.json { render action: 'show', status: :created, location: @notification }\n else\n format.html { render action: 'new' }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_notification = AdminNotification.new(admin_notification_params)\n\n if @admin_notification.save\n render json: @admin_notification, status: :created, location: @admin_notification\n else\n render json: @admin_notification.errors, status: :unprocessable_entity\n end\n end",
"def createNotification(user_id,subject, content, notification_key)\n parameters={id_user: (user_id).to_i, subject: subject.to_s, content: content.to_s, notification_key: notification_key.to_s, delivered: false, read: false}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.post(\"http://192.168.99.101:4052/notifications\", options)\n return results\n end",
"def notify(interests, data = {})\n Request.new(\n @pusher_client,\n :post,\n url(\"/notifications\"),\n {},\n payload(interests, data)\n ).send_sync\n end",
"def push(notifications)\n notifications.each do |notif|\n notif.results = WNSConnection.post notif, @access_token, @options\n end\n end",
"def add_notification(notification)\n query_api_object Model::Notification, '/rest/notifications', notification.to_hash, 'POST'\n end",
"def notify(params)\n client.post('/notify', params)\n end",
"def notifications\n end",
"def send_notifications\n end",
"def notify(interests, data = {})\n Request.new(\n @eventflit_client,\n :post,\n url(\"/publishes\"),\n {},\n payload(interests, data)\n ).send_sync\n end",
"def create\n @notify = Notify.new(params[:notify])\n\n respond_to do |format|\n if @notify.save\n format.html { redirect_to @notify, notice: 'Notify was successfully created.' }\n format.json { render json: @notify, status: :created, location: @notify }\n else\n format.html { render action: \"new\" }\n format.json { render json: @notify.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @notification = Notification.new(notification_params)\n @notification.user_id = current_user.id\n @notification.read = false\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to notifications_path }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @email_notification = EmailNotification.new(email_notification_params)\n\n respond_to do |format|\n if @email_notification.save\n format.html { redirect_to @email_notification, notice: 'Email notification was successfully created.' }\n format.json { render :show, status: :created, location: @email_notification }\n else\n format.html { render :new }\n format.json { render json: @email_notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_notification(notification)\n query_api_object Notification, \"/rest/notifications\", notification.dump(), \"POST\"\n end",
"def notifications\n query_api_object Notification, \"/rest/notifications\", nil, \"GET\", \"notifications\"\n end",
"def post_notification( notification_type, from = nil, options={})\n attributes = {\n :info => options,\n :source_id => from.id,\n :target_id => id,\n :typenum => notification_type,\n :accepted => false\n }\n attributes[:source_id] = from.id if from\n notification = Notification.create( attributes )\n self.notifications_received << notification\n notification\n end",
"def notify(data={})\n RestClient::Request.execute(:method => :post, :url => notify_path, :payload => data, :timeout => TIMEOUT, :open_timeout => TIMEOUT)\n rescue\n nil\n end",
"def create\n @notification = Notification.new(params[:notification])\n\n respond_to do |format|\n if @notification.save\n flash[:notice] = 'Notification was successfully created.'\n format.html { redirect_to(@notification) }\n format.xml { render :xml => @notification, :status => :created, :location => @notification }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @notification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def notifications_params\n params.require(:notification).permit(:requests, :invites, :users, :timeline, :notifier, :message, :queue)\n end",
"def new\n respond_with @notification = @application.notifications.new\n end",
"def create\n @notification = Notification.new(params[:notification])\n @notification.user_id = current_user.id\n\n respond_to do |format|\n if @notification.save\n push_notification(@notification.id, @notification.car.device_token, @notification.text) if @notification.car.device_token\n format.html { redirect_to notifications_path, notice: t(\"activerecord.models.notification\") + t(\"message.created\") }\n format.json { render json: @notification, status: :created, location: @notification }\n else\n format.html { render action: \"new\" }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @notification = Notification.new(notification_params)\n\n respond_to do |format|\n if @notification.save\n create_checkings(@notification)\n # Checking.create(user: current_user, notification: @notification)\n format.html { redirect_to @notification, notice: 'notification was successfully created.' }\n format.js\n format.json { render :show, status: :created, location: @notification }\n else\n format.html { render :new }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n notification_params = params.slice(:to, :title, :body).merge(data: params[:data])\n\n @notification = Notification.find_or_create_by(pr_id: notification_params[:data][:ghprbPullId]) do |notification|\n notification.github_login = notification_params[:to]\n notification.title = notification_params[:title]\n notification.body = notification_params[:body]\n end\n\n data = []\n data = JSON.parse(@notification.data) if @notification.data\n @notification.data = process_notification_data(data, notification_params[:data]).to_json\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to @notification, notice: 'Notification was successfully created.' }\n format.json { render :show, status: :created, location: @notification }\n else\n format.html { render :new }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n\t\t@notification = Notification.new(notification_params)\r\n\t\tif @notification.save\r\n\t\t\tAction.create(info: current_user.username + ' was sent this notification: (' + @notification.info + ').', user_email: current_user.email)\r\n\t\tend\r\n\tend",
"def notifications(params={})\n Endpoints::Notifications.new(self).get(params)\n end",
"def create\n @notification = Notification.new(notification_params)\n\n respond_to do |format|\n if @notification.save\n NotificationMailer.create(@notification.id).deliver_now\n format.html { redirect_to @notification, notice: \"Success! We will notify you at #{@notification.email} as new jobs are posted.\" }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @project = Project.find(@_params[:notification][:project_id].to_i)\n @notification = @project.notifications.build(notification_params)\n #@notification = Notification.new(notification_params)\n\n respond_to do |format|\n if @notification.save\n # Tell the NotificationMailer to send a notification email after save\n NotificationMailer.new_notification_email(@project).deliver_now\n\n format.html { redirect_to @notification, notice: 'Notification was successfully created.' }\n format.json { render :show, status: :created, location: @notification }\n else\n format.html { render :new }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @notification.update(notification_params)\n render json: @notification\n else\n render json: @notification.errors, status: :unprocessable_entity\n end\n end",
"def create\n @notify_me = current_app.notify_mes.new(params[:notify_me])\n if @notify_me.save\n render json: 'ok', status: 201\n else\n render json: {errors: @notify_me.errors }, status: 422\n end\n end",
"def create!(note)\n self.class.post('/notifications.xml', :body => note.to_xml)\n end",
"def create\n @push_notification = PushNotification.new(params[:push_notification])\n\n respond_to do |format|\n if @push_notification.save\n format.html { redirect_to @push_notification, notice: 'Push notification was successfully created.' }\n format.json { render json: @push_notification, status: :created, location: @push_notification }\n else\n format.html { render action: \"new\" }\n format.json { render json: @push_notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @notification = Notification.new(notification_params)\n @notification.app = @app\n\n if params[:send] == 'now'\n @notification.update(scheduled_for: Time.now)\n else\n @notification.update(scheduled_for: Time.parse(notification_params['scheduled_for']).utc)\n end\n\n @notification.user = current_user\n @notification.rpush_app = @notification_app\n @notification.save\n\n respond_modal_with @notification, location: app_notifications_url\n end",
"def all\n for_user_id = @authenticated_user.id\n notifications = Notification.where(for_user_id: for_user_id, notification_type: [0,1,2,3,4])\n .order(created_at: :desc)\n notifications.each do |n|\n if (n.sent_at == nil)\n n.sent_at = Time.now\n n.save\n end\n end\n render json: Notification.render_json_full(notifications)\n end",
"def index\n notifications = params[:unread].nil? || params[:unread] == 0 ? current_user.notifications : Notification.where(user: current_user, status: :unread).all\n\n render json: {\n status: 'Success',\n message: '',\n notifications: notifications.as_json(except: [\n :created_at,\n :updated_at\n ])\n }, status: 200\n end",
"def create\n puts \"==========================\"\n puts \"CREATE\"\n JSON[params[\"updates\"].read].each do |notification|\n user = User.find(notification[\"subscriptionId\"])\n if user\n case notification[\"collectionType\"]\n when \"sleep\"\n user.fitbit.client.sleep_on_date(notification[\"date\"])[\"sleep\"].each do |data|\n sleep_event = { user_id: notification[\"subscriptionId\"], provider: params[:app_id], body: data }\n sleep_logger.info sleep_event\n end\n end\n end\n end\n render text: \"\", status: 204\n end",
"def create\n @notification_count = NotificationCount.new(notification_count_params)\n\n if @notification_count.save\n render json: @notification_count, status: :created, location: @notification_count\n else\n render json: @notification_count.errors, status: :unprocessable_entity\n end\n end",
"def index\n @notifications = Notification.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notifications }\n end\n end",
"def create\n @notification = Notification.new(params[:notification])\n # @notification.applicationd_id = @application.id\n @notification.save\n\n respond_with @notification\n end",
"def create\n authorize(Notification)\n @notification = Notification.new(notification_params)\n # Will eventually need to be removed if we introduce new notification types\n @notification.notification_type = 'global'\n if @notification.save\n flash.now[:notice] = success_message(@notification, _('created'))\n redirect_to edit_super_admin_notification_path(@notification)\n else\n flash.now[:alert] = failure_message(@notification, _('create'))\n render :new\n end\n end",
"def notification_params\n params.require(:notification).permit(\n :title,\n :body,\n :url,\n :send,\n :scheduled_for\n )\n end",
"def create\n @Notification = Notification.new(params[:note])\n @Notification.state = \"new\";\n \n respond_to do |format| \n format.html { render :action => \"new\" }\n format.xml { render :xml => @Notification.errors, :status => :created }\n end\n end",
"def create\n @eve_notification = EveNotification.new(params[:eve_notification])\n\n respond_to do |format|\n if @eve_notification.save\n format.html { redirect_to @eve_notification, notice: 'Eve notification was successfully created.' }\n format.json { render json: @eve_notification, status: :created, location: @eve_notification }\n else\n format.html { render action: \"new\" }\n format.json { render json: @eve_notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def notifications\n response = self.class.get('/notifications.xml')\n notifications_array = []\n response['notifications'].each do |note|\n new_note = Notification.new(:body => note[\"body\"],\n :subject => note[\"subject\"],\n :send_at => note[\"send_at\"],\n :id => note[\"id\"],\n :escalation => note[\"escalation\"])\n note[\"recipients\"].each do |rcpt|\n new_note.add_recipient(Recipient.new(:id => rcpt[\"id\"],\n :channel => rcpt[\"channel\"],\n :address => rcpt[\"address\"],\n :status => rcpt[\"status\"],\n :send_at => rcpt[\"send_at\"]))\n end\n notifications_array << new_note \n end\n notifications_array\n end",
"def send_notifications\n send_new_post_to(:person) if self.person.notify_on_response_posted\n send_new_post_to(:receiver) if self.receiver && self.receiver.notify_on_response_received\n end",
"def notification_params\n params.require(:notification).permit(:title, :level, :body, :dismissable, :enabled,\n :starts_at, :expires_at)\n end",
"def create\n begin\n @notification = Notification.find_or_initialize_by(email: notification_params['email'])\n @notification.send_email_notification(notification_params) if @notification.valid?\n\n respond_to do |format|\n if @notification.save\n format.html { redirect_to @notification, notice: 'Mail has been sent successfully.' }\n format.json { render :show, status: :created, location: @notification }\n else\n format.html { render :new }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n rescue Exception => e\n @notification.errors.add(:base, JSON.parse(e.response)['message'])\n respond_to do |format|\n format.html { render :new }\n end\n end\n\n end",
"def create\n # @recived = {nombre: params[:nombre], email: params[:mail], mensaje: params[:mensaje] }\n user = User.find_by_email(params[:mail])\n if user\n @notification = Notification.new(from_type: \"contact\", from_id: user.id, message:\"#{params[:nombre]}:#{params[:mensaje]}\")\n respond_to do |format|\n if @notification.save\n format.json { render json: {created: @notification}}\n format.html { redirect_to @notification, notice: 'Email enviado correctamente' }\n else\n format.json { render json: {error: \"El email no pudo ser enviado: #{@notification.errors}\"}, status: :unprocessable_entity }\n format.html { redirect_to root_path, notice: \"El email no pudo ser enviado: #{@notification.errors}\" }\n end\n end\n else\n respond_to do |format|\n format.json { render json: {error: \"El email que nos has dado no esta registrado en nuestra aplicacion, por favor registrese y vuelva a intentarlo\"}, status: 401 }\n format.html { redirect_to root_path, notice: 'El email que nos has dado no esta registrado en nuestra aplicacion, por favor registrese y vuelva a intentarlo' }\n end\n end\n end",
"def create_notification(attributes)\n BrickFTP::API::Notification.create(attributes)\n end",
"def create_notification(attributes)\n BrickFTP::API::Notification.create(attributes)\n end",
"def notification_params\n params.require(:notification).permit( :title, :detail, :notification_type, :notification_data, :date, :remind_at, :location, :location_url, :created_by, :recurrence_data, :default_data, :form_name)\n end",
"def push(notifications)\n notifications.each do |notif|\n notif.results = GCMConnection.post notif.as_gcm_json, @key, @options\n end\n end",
"def create\n @notifier = Notifier.new(notifier_params)\n\n respond_to do |format|\n if @notifier.save\n format.html { redirect_to @notifier, notice: 'Notifier was successfully created.' }\n format.json { render :show, status: :created, location: @notifier }\n else\n format.html { render :new }\n format.json { render json: @notifier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def notification_params\n params.require(:notification).permit(:creator_id, :receiver_id, :post_id, :type, :title, :message, :read)\n end",
"def push_notifications\n # post \"/push\" do\n Webpush.payload_send(\n message: params[:message],\n endpoint: params[:subscription][:endpoint],\n p256dh: params[:subscription][:keys][:p256dh],\n auth: params[:subscription][:keys][:auth],\n vapid: {\n subject: \"mailto:[email protected]\",\n public_key: ENV['VAPID_PUBLIC_KEY'],\n private_key: ENV['VAPID_PRIVATE_KEY']\n }\n )\n end",
"def create\n @notification_category = NotificationCategory.new(notification_category_params)\n\n if @notification_category.save\n render json: @notification_category, status: :created\n else\n render json: @notification_category.errors, status: :unprocessable_entity\n end\n end",
"def post_notification(notification)\n\t\tself.update_attribute(:notification_list, self.notification_list << notification.get_hash)\n\tend",
"def notification_params\n params.require(:notification).permit(:title, :message)\n end",
"def notification_params\n params.require(:notification).permit(:title, :message)\n end",
"def notification_params\n params.require(:notification).permit(:status)\n end",
"def create\n @apn_notification = APN::Notification.new(params[:apn_notification])\n\n respond_to do |format|\n if @apn_notification.save\n format.html { redirect_to(@apn_notification, :notice => 'Notification was successfully created.') }\n format.xml { render :xml => @apn_notification, :status => :created, :location => @apn_notification }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @apn_notification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def push(notif)\n\n end",
"def create_notification; end",
"def get_notifications\n begin\n response = notifications_api.get\n [parse_json(response), nil]\n rescue RestClient::Unauthorized\n [{}, Unauthorized]\n end\n end",
"def notification_params\n params.require(:notification).permit(:title, :description, :reference_date, :tipo, :seen, :de_usuario_id, :para_usuario_id, :id_item)\n end",
"def create\n @notification_type = NotificationType.new(notification_type_params)\n\n respond_to do |format|\n if @notification_type.save\n format.html { redirect_to @notification_type, notice: 'Notification type was successfully created.' }\n format.json { render :show, status: :created, location: @notification_type }\n else\n format.html { render :new }\n format.json { render json: @notification_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def notification_params\n params.require(:notification).permit(:title, :text, :level, :expires_at, :in_app, :email, :sms)\n end",
"def notification_params\n params.require(:notification).permit(:title, :ndesc)\n end",
"def create\n @notification = current_user.notifications.new(params[:notification])\n @event = Event.find_by_id(params[:event_id]) if params[:event_id]\n @notification.event = @event if @event\n if @notification.save\n if @event\n redirect_to @event \n else\n redirect_to(@notification, :notice => 'Notification was successfully created.')\n end \n end\n end",
"def notification_params\r\n\t\tparams.require(:notification).permit(:info, :seen, :user_id)\r\n\tend",
"def update\n if @notification.update(notification_params)\n render json: \"Successfully updated\", status: :ok\n else\n render json: @notification.errors, status: :unprocessable_entity\n end\n end",
"def notification_params\n params.require(:notification).permit(:message, :kind, :read)\n end",
"def notification_params\n params.require(:notification).permit(:user_id, :content)\n end",
"def notification_params\n params.require(:notification).permit(:email)\n end",
"def updateNotification\n read = convertToBoolean(read)\n delivered = convertToBoolean(delivered)\n\n parameters={id_user: params[:id_user].to_i, subject: params[:subject].to_s, content: params[:content].to_s, read: params[:read], delivered: params[:delivered] }\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n url = \"http://192.168.99.101:4052/notifications/\"+params[:id].to_s\n results = HTTParty.put(url.to_s, options)\n render json: results.parsed_response, status: results.code\n end",
"def create\n @email_reminder = EmailReminder.create_notice(email_reminder_params)\n respond_with @email_reminder\n end",
"def set_notifications\n\t\t@notifications = Notification.where(reciever_id: current_user).order(\"created_at DESC\")\n\tend",
"def notification_params\n params.require(:notification).permit(:owner, :title, :message)\n end",
"def create\n\t\tsite = Site.find_by(hostname: params[:hostname], user_id: current_user.id)\n\t\tdata = params.permit(:time, :sent, :span)\n\t\tdata[:site_id] = site.id\n\t\tdata[:sent] = Time.now.to_i\n\t\tdata[:time] = data[:time].to_i * 3600\n\t\tNotification.create(data)\n\t\tredirect_to request.referer\n\tend",
"def notification_params\n params.require(:notification).permit(:project_id, :title, :date, :message, :user_id)\n end",
"def create\n @notification = Notification.find_or_create_by!(notification_params)\n\n respond_to do |format|\n if @notification.action == 'Nominate' && current_user.admin?\n horserace = Horserace.find_or_create_by!(:race_id => @notification.send_id, :horse_id => @notification.recv_id)\n horserace.status = 'Interested'\n horserace.save\n format.html { redirect_to :back, notice: 'Notification Sent' }\n elsif @notification.save\n format.html { redirect_to :back, notice: 'Notification Sent' }\n else\n format.html { render :back }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n PaymentNotification.create(payment_notification_params)\n render :nothing => true\n end",
"def notification_params\n params.require(:notification).permit(:message, :sent_at, :user_cpf, :entry_id)\n end",
"def notification_params\n params.require(:notification).permit(:user_id, :title, :desc, :sender_id)\n end",
"def create\n @kpi_notification = KpiNotification.new(kpi_notification_params)\n\n respond_to do |format|\n if @kpi_notification.save\n format.html { redirect_to @kpi_notification, notice: 'Kpi notification was successfully created.' }\n format.json { render :show, status: :created, location: @kpi_notification }\n else\n format.html { render :new }\n format.json { render json: @kpi_notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n render json: @notification\n end",
"def create_notifications\n notifications = []\n User.find_each do |u|\n notifications << Notification.new(recipient: u,\n notifiable_id: @lecture.id,\n notifiable_type: 'Lecture',\n action: 'create')\n end\n Notification.import notifications\n end",
"def send_notification\n\n\n end",
"def create\n @sms_notification = SmsNotification.new(sms_notification_params)\n\n respond_to do |format|\n if @sms_notification.save\n format.html { redirect_to @sms_notification, notice: 'Sms notification was successfully created.' }\n format.json { render :show, status: :created, location: @sms_notification }\n else\n format.html { render :new }\n format.json { render json: @sms_notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_notify\n gcm_response = send_notification(params[:test_payload_to_send], params[:test_gcm_ids])\n\n render json: get_v1_formatted_response({}, true, [gcm_response[:response]]).to_json\n end",
"def notifications(blog_name, options = {})\n validate_options([:before, :types], options)\n get(blog_path(blog_name, 'notifications'), options)\n end",
"def notifications\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n @client = Octokit::Client.new(:access_token => @current_user.token)\n\n # get first 50 notifications (github paginates at 50)\n notifications = @client.notifications({all: true, per_page: 50})\n\n # if there are more pages, get page 2\n more_pages = @client.last_response.rels[:next]\n if more_pages\n notifications.concat more_pages.get.data\n end\n\n # Consider how to get more pages...\n # page_count = 0\n # while more_pages and page_count < 10\n # notifications.concat more_pages.get.data\n # page_count++\n # more_pages = @client.last_response.rels[:next]\n # end\n\n # iterate over notifications to:\n # add score value\n # add notification_url value\n @json = notifications.map do |notification|\n add_score_url_to_notification(notification, {favRepos: @current_user.UserPreference.repos})\n end\n\n respond_to do |format|\n format.json {\n render json: @json.to_json, status: 200\n }\n end\n end",
"def notification_params\n params[:notification].permit(:send_id, :recv_id, :action)\n end",
"def create\n @notification2 = Notification2.new(notification2_params)\n\n respond_to do |format|\n if @notification2.save\n format.html { redirect_to @notification2, notice: 'Notification2 was successfully created.' }\n format.json { render :show, status: :created, location: @notification2 }\n else\n format.html { render :new }\n format.json { render json: @notification2.errors, status: :unprocessable_entity }\n end\n end\n end",
"def message_notifications\n notifications = Message.where(receiver_id: @current_user.id, read_status: 0)\n if notifications\n render json: {\n status: 'success',\n message: 'Your notifications',\n data: notifications.length()\n },\n status: :ok\n end\n end"
] | [
"0.7593524",
"0.73412955",
"0.7305329",
"0.6963764",
"0.6929839",
"0.6868717",
"0.6850269",
"0.6850269",
"0.6805122",
"0.6787712",
"0.6780248",
"0.67769974",
"0.6639654",
"0.6622584",
"0.65698683",
"0.65131927",
"0.65050566",
"0.64740777",
"0.64697534",
"0.6467012",
"0.6453251",
"0.64278406",
"0.64263546",
"0.6388371",
"0.6386479",
"0.6375611",
"0.63697606",
"0.63672537",
"0.6359683",
"0.63456523",
"0.6336448",
"0.6332603",
"0.6325663",
"0.6305638",
"0.63047886",
"0.63045454",
"0.6282204",
"0.6258101",
"0.6252627",
"0.6241575",
"0.6214718",
"0.62102026",
"0.62011576",
"0.6200735",
"0.61980253",
"0.61787695",
"0.6164841",
"0.61517674",
"0.6151009",
"0.61475956",
"0.6146514",
"0.613423",
"0.6134135",
"0.6128625",
"0.61274105",
"0.61274105",
"0.61010927",
"0.60962063",
"0.60959214",
"0.6091158",
"0.6084833",
"0.60756767",
"0.60753495",
"0.6074471",
"0.6074471",
"0.6074027",
"0.60665756",
"0.60599935",
"0.6057281",
"0.605419",
"0.6048082",
"0.60422736",
"0.6032982",
"0.6010783",
"0.60105217",
"0.6008363",
"0.59929395",
"0.59832436",
"0.5982329",
"0.5966514",
"0.5954447",
"0.5953681",
"0.5950365",
"0.5949006",
"0.5943325",
"0.5941302",
"0.59378433",
"0.59311396",
"0.5927299",
"0.59199685",
"0.59072477",
"0.59029424",
"0.59023",
"0.58902705",
"0.5884704",
"0.58803225",
"0.5877364",
"0.58750194",
"0.5864033",
"0.5862173",
"0.5861398"
] | 0.0 | -1 |
PATCH/PUT /notifications/1 PATCH/PUT /notifications/1.json | def update
respond_to do |format|
if @notification.update(notification_params)
format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }
format.json { render :show, status: :ok, location: @notification }
else
format.html { render :edit }
format.json { render json: @notification.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateNotification\n read = convertToBoolean(read)\n delivered = convertToBoolean(delivered)\n\n parameters={id_user: params[:id_user].to_i, subject: params[:subject].to_s, content: params[:content].to_s, read: params[:read], delivered: params[:delivered] }\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n url = \"http://192.168.99.101:4052/notifications/\"+params[:id].to_s\n results = HTTParty.put(url.to_s, options)\n render json: results.parsed_response, status: results.code\n end",
"def update\n if @notification.update(notification_params)\n render json: @notification\n else\n render json: @notification.errors, status: :unprocessable_entity\n end\n end",
"def update\n puts \"==========================\"\n puts \"UPDATE\"\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @notification.update(notification_params)\n render json: \"Successfully updated\", status: :ok\n else\n render json: @notification.errors, status: :unprocessable_entity\n end\n end",
"def update\n @notification = Notification.find(params[:id])\n\n respond_to do |format|\n if @notification.update_attributes(params[:notification])\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @notification = Notification.find(params[:id])\n\n respond_to do |format|\n if @notification.update_attributes(params[:notification])\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @notification.update(params.fetch(:notification, {}))\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @notification }\n else\n format.html { render :edit }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def notifications\n @user = current_user\n @notifications.update_all(updated_at: Time.zone.now)\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.json { render :show, status: :ok, location: @notification }\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n else\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n format.html { render :edit }\n end\n end\n end",
"def update\n notification = Notification.find(params[:id])\n notification.update(\n params.permit(:title, :description)\n )\n notification.active = false\n notification.save\n render json: notification\n end",
"def update\n @notification = current_user.notifications.find(params[:id])\n\n respond_to do |format|\n if @notification.update_attributes(params[:notification])\n format.html { redirect_to(@notification, :notice => 'Notification was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @notification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_notification = AdminNotification.find(params[:id])\n\n if @admin_notification.update(admin_notification_params)\n head :no_content\n else\n render json: @admin_notification.errors, status: :unprocessable_entity\n end\n end",
"def update\n @notification = current_user.notifications.where(id: params[:id]).first\n authorize @notification\n if @notification.update_attributes(notification_params)\n render 'show'\n else\n render(json: {errors: @notification.errors.messages}, status: 400)\n end\n end",
"def update\n @notify = Notify.find(params[:id])\n\n respond_to do |format|\n if @notify.update_attributes(params[:notify])\n format.html { redirect_to @notify, notice: 'Notify was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notify.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @email_notification.update(email_notification_params)\n format.html { redirect_to @email_notification, notice: 'Email notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @email_notification }\n else\n format.html { render :edit }\n format.json { render json: @email_notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @notification = Notification.find(params[:id])\n respond_to do |format|\n if @notification.update_attributes(params[:notification])\n format.html { redirect_to notifications_path, notice: t(\"activerecord.models.notification\") + t(\"message.updated\") }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n push_notification(@notification.id, @notification.car.device_token, @notification.text)\n end",
"def update\n @eve_notification = EveNotification.find(params[:id])\n\n respond_to do |format|\n if @eve_notification.update_attributes(params[:eve_notification])\n format.html { redirect_to @eve_notification, notice: 'Eve notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @eve_notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @notification = Notification.find(params[:id])\n\n respond_to do |format|\n if @notification.update_attributes(params[:notification])\n flash[:notice] = 'Notification was successfully updated.'\n format.html { redirect_to(@notification) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @notification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @notification2.update(notification2_params)\n format.html { redirect_to @notification2, notice: 'Notification2 was successfully updated.' }\n format.json { render :show, status: :ok, location: @notification2 }\n else\n format.html { render :edit }\n format.json { render json: @notification2.errors, status: :unprocessable_entity }\n end\n end\n end",
"def updateNotifications\r\n\t\tdataHash = {\r\n\t\t\tuser_id: params[:user].id,\r\n experience_p_status: params[:experience_p_status],\r\n experience_status: params[:experience_status],\r\n\t\t\tfeelike_status: params[:feelike_status],\r\n\t\t\tfollows_status: params[:follows_status],\r\n comment_status: 0\r\n\t\t}\r\n UsersSettings.byUser(params[:user].id).first.updateNotifications(dataHash)\r\n self.default_response\r\n\tend",
"def update_many\n if @admin_notifications.update_all(admin_notification_params)\n render json: @admin_notifications, status: :ok, location: admin_notifications_url\n else\n render json: @admin_notifications.errors, status: :unprocessable_entity\n end\n end",
"def update\n @push_notification = PushNotification.find(params[:id])\n\n respond_to do |format|\n if @push_notification.update_attributes(params[:push_notification])\n format.html { redirect_to @push_notification, notice: 'Push notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @push_notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def updated\n @notification = Notification.find(params[:id])\n\n # dispatches call to private method (if implemented)\n send(@notification.event) if respond_to?(@notification.event, true)\n\n @notification.destroy\n render json: {}, status: :ok\n end",
"def update\n respond_to do |format|\n if @notifier.update(notifier_params)\n format.html { redirect_to @notifier, notice: 'Notifier was successfully updated.' }\n format.json { render :show, status: :ok, location: @notifier }\n else\n format.html { render :edit }\n format.json { render json: @notifier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def incident_update(statuspage_id, incident_id, incident_details, current_status, current_state, notifications = 0, message_subject = \"Status Notification\")\n data = get_notify(notifications)\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n data['incident_details'] = incident_details\n data['current_status'] = current_status\n data['current_state'] = current_state\n data['message_subject'] = message_subject\n\n request :method => :post,\n :url => @url + 'incident/update',\n :payload => data\n end",
"def update\n authorize! :edit, @notification_template\n\n @supported_events = Notifier.supported_events\n @supported_formats = Notifier.supported_formats\n respond_to do |format|\n if @notification_template.update_attributes(params[:notification_template])\n format.html { redirect_to(@notification_template, :notice => I18n.t(:'notification_template.notices.updated')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @notification_template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @alarm_notification = AlarmNotification.find(params[:id])\n\n respond_to do |format|\n if @alarm_notification.update_attributes(params[:alarm_notification])\n format.html { redirect_to @alarm_notification, notice: 'Alarm notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @alarm_notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kpi_notification.update(kpi_notification_params)\n format.html { redirect_to @kpi_notification, notice: 'Kpi notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @kpi_notification }\n else\n format.html { render :edit }\n format.json { render json: @kpi_notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @apn_notification = APN::Notification.find(params[:id])\n\n respond_to do |format|\n if @apn_notification.update_attributes(params[:apn_notification])\n format.html { redirect_to(@apn_notification, :notice => 'Notification was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @apn_notification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @job_notification = JobNotification.find(params[:id])\n\n respond_to do |format|\n if @job_notification.update_attributes(params[:job_notification])\n format.html { redirect_to @job_notification, notice: 'Job notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to :back, notice: 'Notification was successfully updated.' }\n format.js { \n @notifications = Notification.where(read: false, user: current_user).page(params[:page]).per(10).order(:id)\n }\n else\n format.html { redirect_to :back, alert: 'Failure.' }\n end\n end\n end",
"def update\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to root_path, notice: 'Mon notification a bien été mis à jour.' }\n format.json { render :show, status: :ok, location: @notification }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @notify_message.update(notify_message_params)\n format.html { redirect_to @notify_message, notice: \"Notify message was successfully updated.\" }\n format.json { render :show, status: :ok, location: @notify_message }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @notify_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @notify_config = NotifyConfig.find(params[:id])\n\n respond_to do |format|\n if @notify_config.update_attributes(params[:notify_config])\n format.html { redirect_to @notify_config, notice: 'Notify config was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notify_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_email_notification\n service_response = ClientManagement::UpdateEmailNotificationSetting.new(params).perform\n render_api_response(service_response)\n end",
"def update\n @compromise = Compromise.find(params[:id])\n\n if @compromise.update(compromise_params)\n Notification.delete_all([\"compromise_id = ?\", @compromise.id])\n create_for_each_notification_type(@compromise)\n head :no_content\n else\n render json: @compromise.errors, status: :unprocessable_entity\n end\n end",
"def update(params = {})\n params ||= {}\n params[:id] = @attributes[:id]\n raise MissingParameterError.new(\"Current object doesn't have a id\") unless @attributes[:id]\n raise InvalidParameterError.new(\"Bad parameter: id must be an Integer\") if params.dig(:id) and !params.dig(:id).is_a?(Integer)\n raise InvalidParameterError.new(\"Bad parameter: send_interval must be an String\") if params.dig(:send_interval) and !params.dig(:send_interval).is_a?(String)\n raise MissingParameterError.new(\"Parameter missing: id\") unless params.dig(:id)\n\n Api.send_request(\"/notifications/#{@attributes[:id]}\", :patch, params, @options)\n end",
"def update\n @email_reminder.update(email_reminder_params)\n respond_with @email_reminder\n end",
"def update\n respond_to do |format|\n format.html do\n # TODO(KARLA): REFACTOR THIS CODE\n if @notification_settings.update(notifications_settings_params)\n flash[:notice] = t('flashes.notification_settings.update.notice')\n if current_user.agent?\n redirect_to customer_dashboard_path\n else\n redirect_to co_borrower_dashboard_path\n end\n else\n flash[:alert] = t('flashes.notification_settings.update.alert')\n render 'edit'\n end\n end\n\n format.json do\n @notification_settings.update(notifications_settings_params)\n render json: {}, status: 200\n end\n end\n end",
"def update\n respond_to do |format|\n if @notification_type.update(notification_type_params)\n format.html { redirect_to @notification_type, notice: 'Notification type was successfully updated.' }\n format.json { render :show, status: :ok, location: @notification_type }\n else\n format.html { render :edit }\n format.json { render json: @notification_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n note = Note.find(params[\"id\"])\n note.update_attributes(note_params)\n respond_with note, json: note\n end",
"def toggle_notification\n if params[:status].present?\n @user.update(notification_status: params[:status])\n if @user.errors.any?\n render json: user.errors.messages, status: 400\n else\n render json: { message: 'Notification status updated successfully!' }, status: 200\n end\n else\n render json: { message: 'Please set status' }, status: 400\n end\n end",
"def update\n=begin\n @notification_log = NotificationLog.find(params[:id])\n\n respond_to do |format|\n if @notification_log.update_attributes(params[:notification_log])\n format.html { redirect_to @notification_log, notice: 'Notification log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notification_log.errors, status: :unprocessable_entity }\n end\n end\n=end\n end",
"def patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\n end",
"def update\n @notify_observer = NotifyObserver.find(params[:id])\n\n respond_to do |format|\n if @notify_observer.update_attributes(params[:notify_observer])\n format.html { redirect_to @notify_observer, notice: 'Notify observer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notify_observer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, **args); end",
"def update\n @payment_notification = PaymentNotification.find(params[:id])\n\n respond_to do |format|\n if @payment_notification.update_attributes(params[:payment_notification])\n format.html { redirect_to @payment_notification, notice: 'Payment notification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @payment_notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @notifier.update_attributes(params[:notifier])\n format.html { redirect_to(@notifier, :notice => 'Kennisgever is succesvol aangepast.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @notifier.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @notice.update(notice_params)\n respond_to do |format|\n format.json { render action: 'show' }\n end\n end",
"def update\n @notification.update(notification_params)\n\n if params[:send] == 'now'\n @notification.update(scheduled_for: Time.now)\n else\n @notification.update(scheduled_for: Time.parse(notification_params['scheduled_for']).utc)\n end\n\n respond_modal_with @notification, location: app_notifications_url\n end",
"def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"def maintenance_update(statuspage_id, maintenance_id, maintenance_details, notifications = 0, message_subject = \"Maintenance Notification\")\n data = get_notify(notifications)\n data['statuspage_id'] = statuspage_id\n data['maintenance_id'] = maintenance_id\n data['maintenance_details'] = maintenance_details\n data['message_subject'] = message_subject\n\n request :method => :post,\n :url => @url + 'maintenance/update',\n :payload => data\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update\n if params[:dismiss]\n @notification.dismissed_on = Time.zone.now\n if @notification.save\n send_success_json(@notification.id, {:msg => \"dismissed\"})\n else\n send_error_json(@notification.id, \"dismiss_error\", 400)\n end\n return\n end\n respond_to do |format|\n if @notification.update(notification_params)\n format.html { redirect_to @notification, notice: 'Notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @notification }\n else\n format.html { render :edit }\n format.json { render json: @notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if update = @incident.add_update(change: incident_params, comment: params[:comment])\n notified_channels.each do |ch|\n ch.notify(update)\n end\n\n format.html { redirect_to @incident, notice: 'Incident was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident }\n else\n format.html { render :edit }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @notice = @person.notices.find(params[:id])\n\n respond_to do |format|\n if @notice.update_attributes(params[:notice])\n format.html { redirect_to person_notices_path( @person), notice: 'notice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n respond_to do |format|\n if @eventnotifier.update(eventnotifier_params)\n format.html { redirect_to @eventnotifier, notice: 'Eventnotifier was successfully updated.' }\n format.json { render :show, status: :ok, location: @eventnotifier }\n else\n format.html { render :edit }\n format.json { render json: @eventnotifier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def updateNotifications(data)\r\n self.comment_status = data[:comment_status].to_i\r\n self.experience_status = data[:experience_status].to_i\r\n self.experience_p_status = data[:experience_p_status].to_i\r\n self.feelike_status = data[:feelike_status].to_i\r\n self.follows_status = data[:follows_status].to_i\r\n save\r\n end",
"def update\n respond_to do |format|\n if @sms_notification.update(sms_notification_params)\n format.html { redirect_to @sms_notification, notice: 'Sms notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @sms_notification }\n else\n format.html { render :edit }\n format.json { render json: @sms_notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @parent_to_teacher_notification.update(parent_to_teacher_notification_params)\n format.html { redirect_to @parent_to_teacher_notification, notice: 'Parent to teacher notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @parent_to_teacher_notification }\n else\n format.html { render :edit }\n format.json { render json: @parent_to_teacher_notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_notifications\n user = current_user\n user.notify_on_private = params[:notify_on_private]\n user.notify_on_public = params[:notify_on_public]\n user.notify_on_reply = params[:notify_on_reply]\n user.save!\n redirect_to admin_settings_path\n end",
"def update\n respond_to do |format|\n if @notificationtype.update(notificationtype_params)\n format.html { redirect_to moderator_notificationtypes_path, notice: 'Notificationtype was successfully updated.' }\n format.json { render :show, status: :ok, location: @notificationtype }\n else\n format.html { render :edit }\n format.json { render json: @notificationtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n\t\tif @notification.update(notification_params)\r\n\t\t\tAction.create(info: current_user.username + ' has seen this notification: (' + @notification.info + ').', user_email: current_user.email)\r\n\t\tend\r\n\tend",
"def update\n authorize(Notification)\n if @notification.update(notification_params)\n flash.now[:notice] = success_message(@notification, _('updated'))\n return redirect_to edit_super_admin_notification_path(@notification)\n else\n flash.now[:alert] = failure_message(@notification, _('update'))\n end\n render :edit\n end",
"def patch\n end",
"def call(id)\n client.delete(\"/api/rest/v1/notifications/#{id}.json\")\n true\n end",
"def update\n @notification_type = NotificationType.find(params[:id])\n\n respond_to do |format|\n if @notification_type.update_attributes(params[:notification_type])\n flash[:notice] = 'NotificationType was successfully updated.'\n format.html { redirect_to(@notification_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @notification_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch(action, **args); end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end",
"def update\n respond_to do |format|\n if @pushup_reminder.update_attributes(params[:pushup_reminder])\n format.html { redirect_to [@user, @pushup_reminder], notice: 'Pushup reminder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pushup_reminder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_resource(payload)\n execute(resource_path, method: :patch, payload: payload.to_json)\n end",
"def update!(**args)\n @conflict_notification_email = args[:conflict_notification_email] if args.key?(:conflict_notification_email)\n @display_name = args[:display_name] if args.key?(:display_name)\n @dispute_notification_emails = args[:dispute_notification_emails] if args.key?(:dispute_notification_emails)\n @fingerprint_report_notification_emails = args[:fingerprint_report_notification_emails] if args.key?(:fingerprint_report_notification_emails)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @primary_notification_emails = args[:primary_notification_emails] if args.key?(:primary_notification_emails)\n end",
"def notifications\n end",
"def notification_status\n consumer = User.find_by_id(params[:user_id])\n if consumer.update_attributes(:notification_status => params[:status],\n :call_time => params[:call_time])\n render :json=> {:success=>true}, :status=>200\n else\n render :json=> {:success=>false, :message=>\"Something wrong\"}, :status=>401\n end\n end",
"def update\n respond_to do |format|\n if @notification_rule.update(notification_rule_params)\n format.html { redirect_to notification_rules_path, notice: 'Notification rule was successfully updated.' }\n format.json { render :show, status: :ok, location: @notification_rule }\n else\n format.html { render :edit }\n format.json { render json: @notification_rule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @notification_category = NotificationCategory.find(params[:id])\n\n if @notification_category.update(notification_category_params)\n head :no_content\n else\n render json: @notification_category.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @note.update(note_params)\n render json: @note\n else\n render json: @note.errors, status: :unprocessable_entity\n end\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\r\n @reminder = Reminder.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @reminder.update_attributes(params[:reminder])\r\n format.html { redirect_to @reminder, notice: 'Reminder was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @reminder.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @notification_count = NotificationCount.find(params[:id])\n\n if @notification_count.update(notification_count_params)\n head :no_content\n else\n render json: @notification_count.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_with []\n end",
"def update\n @task = Task.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n $redis.publish('tasks.update', TaskSerializer.new(Task.last).to_json)\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.70702535",
"0.70515186",
"0.6883182",
"0.6862723",
"0.6791934",
"0.6791934",
"0.67503804",
"0.67503804",
"0.67503804",
"0.6740188",
"0.6713271",
"0.6710817",
"0.6663978",
"0.65771335",
"0.65405804",
"0.6520096",
"0.6475701",
"0.6432363",
"0.6419112",
"0.63468456",
"0.6311584",
"0.6309898",
"0.6305325",
"0.6287177",
"0.62549824",
"0.62421536",
"0.62219775",
"0.62167853",
"0.6211963",
"0.6204782",
"0.61930317",
"0.6170828",
"0.6168375",
"0.61383474",
"0.61349636",
"0.61302805",
"0.61163",
"0.61124843",
"0.61078364",
"0.6091981",
"0.6080553",
"0.6073406",
"0.6053409",
"0.60369825",
"0.6025592",
"0.6021477",
"0.60198",
"0.6009829",
"0.5975271",
"0.5972964",
"0.59724116",
"0.5970884",
"0.5963761",
"0.595379",
"0.5911671",
"0.5907617",
"0.59075356",
"0.5904632",
"0.58918744",
"0.58787477",
"0.5878636",
"0.5878636",
"0.5866816",
"0.5862389",
"0.5860615",
"0.5858269",
"0.58536863",
"0.584941",
"0.5848497",
"0.5839432",
"0.58374596",
"0.5822269",
"0.5810601",
"0.5800909",
"0.5792315",
"0.57914346",
"0.57784814",
"0.575481",
"0.57536155",
"0.57535136",
"0.57498765",
"0.57488173",
"0.5745695",
"0.5713616",
"0.57101923",
"0.5708203",
"0.5704907",
"0.5699577",
"0.5699393",
"0.5699393",
"0.5691365",
"0.56764114",
"0.5671914",
"0.5671825",
"0.56607354"
] | 0.6625986 | 18 |
DELETE /notifications/1 DELETE /notifications/1.json | def destroy
@notification.destroy
respond_to do |format|
format.html { redirect_to notifications_url, notice: 'Notification was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(id)\n client.delete(\"/api/rest/v1/notifications/#{id}.json\")\n true\n end",
"def destroy\n @notification = Notification.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end",
"def delete\n @notification = Users::Notification.find_by_id(params[:id])\n @notification.set_status_deleted\n\n respond_to do |format|\n format.html { redirect_to notification_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@notification = Notification.find(params[:id])\n #@notification.destroy\n\n respond_to do |format|\n format.html { redirect_to notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification = @application.notifications.find(params[:id])\n @notification.destroy\n\n respond_with @notification\n end",
"def destroy\n @notification = current_user.notifications.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to(notifications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to app_notifications_url, notice: 'Notifiation was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n client = current_user.find_client(params[:client_id])\n @notification = client.notifications.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to client_notifications_url(client) }\n end\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'Notification was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n head :no_content \n end",
"def destroy\n @notify = Notify.find(params[:id])\n @notify.destroy\n\n respond_to do |format|\n format.html { redirect_to notifies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification = Notification.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to(notifications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @notification = Notification.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to notifications_url }\n end\n end",
"def delete_Notification\n dest = Notification.where(id: params[:idNotification]).first\n if (dest) \n Notification.where(id: params[:idNotification]).destroy_all\n render json: { status: 'SUCCESS', message: 'ELIMINACION EXITOSA'}, status: :ok\n else\n render json: { status: 'INVALID', message: 'NOTIFICACION NO ENCONTRADA'}, status: :unauthorized\n end\n end",
"def destroy\n @eve_notification = EveNotification.find(params[:id])\n @eve_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to eve_notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_back fallback_location: notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to notifications_url, notice: 'notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @notification.destroy\n send_success_json(@notification.id, {:msg => \"deleted\"})\n else\n send_error_json(@notification.id, \"delete_error\", 400)\n end\n end",
"def destroy\n @alarm_notification = AlarmNotification.find(params[:id])\n @alarm_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to alarm_notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @push_notification = PushNotification.find(params[:id])\n @push_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to push_notifications_url }\n format.json { head :no_content }\n end\n end",
"def test_add_and_remove_notification\n notification = {\n \"title\" => \"Test subject soon to be removed\",\n \"message\" => \"Hopefully deleted message!!\",\n \"email_address\" => \"Hopefully deleted e-mail address\"\n }\n\n # Make a new notification and then delete it\n notification_id = make_a_notification(notification)\n delete '/notification/' + notification_id\n assert_equal 204, last_response.status\n\n # Double check that it's gone\n get '/notification/' + notification_id\n assert_equal 404, last_response.status\n end",
"def destroy\n @notification.destroy\n respond_to do |format|\n format.html { redirect_to project_notifications_url, notice: 'Notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_notification.destroy\n\n head :no_content\n end",
"def destroy\n @notification_count.destroy\n\n head :no_content\n end",
"def destroy\n @apn_notification = APN::Notification.find(params[:id])\n @apn_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to(apn_notifications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @notify_observer = NotifyObserver.find(params[:id])\n @notify_observer.destroy\n\n respond_to do |format|\n format.html { redirect_to notify_observers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @email_notification.destroy\n respond_to do |format|\n format.html { redirect_to email_notifications_url, notice: 'Email notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification2.destroy\n respond_to do |format|\n format.html { redirect_to notification2s_url, notice: 'Notification2 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment_notification = PaymentNotification.find(params[:id])\n @payment_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to payment_notifications_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @notification_type = NotificationType.find(params[:id])\n @notification_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(notification_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @detour = Detour.find(params[:id])\n @detour.notifications.each do |n|\n logger.info(\"Deleteing notification \" + n.id.to_s + \" for detour \" + @detour.id.to_s + \"\\n\")\n n.destroy\n end\n @detour.destroy\n\n respond_to do |format|\n format.html { redirect_to(detours_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @notify_config = NotifyConfig.find(params[:id])\n @notify_config.destroy\n\n respond_to do |format|\n format.html { redirect_to notify_configs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification.destroy\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @notifier.destroy\n respond_to do |format|\n format.html { redirect_to notifiers_url, notice: 'Notifier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sms_notification.destroy\n respond_to do |format|\n format.html { redirect_to sms_notifications_url, notice: 'Sms notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notify_message.destroy\n respond_to do |format|\n format.html { redirect_to notify_messages_url, notice: \"Notify message was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification_type.destroy\n respond_to do |format|\n format.html { redirect_to notification_types_url, notice: 'Notification type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kpi_notification.destroy\n respond_to do |format|\n format.html { redirect_to kpi_notifications_url, notice: 'Kpi notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dormer_notification.destroy\n respond_to do |format|\n format.html { redirect_to dormer_notifications_url, notice: 'Dormer notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@event_event.destroy\n @event_event.deleted = true\n dest = @event_event.id\n type = 7 #event_notifications_code\n Notification.clear_notifications(type,dest)\n @event_event.save\n @event_event.user.remove_event\n respond_to do |format|\n format.html { redirect_to admin_event_events_url, notice: 'Event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pic.destroy\n\n notifications = Notification.find(:all, :conditions => ['notification_type = ? and object_id = ?', \"comment\", @pic.id])\n notifications.each do |n|\n n.destroy\n end\n respond_to do |format|\n format.html { redirect_to(root_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @alarm_notification.destroy\n\n respond_with(@alarm_notification, location: alarm_notifications_url, notice: 'Alarm notification was successfully destroyed.')\n end",
"def destroy\n @pushup_reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to pushup_reminders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notificationtype.destroy\n respond_to do |format|\n format.html { redirect_to moderator_notificationtypes_url, notice: 'Notificationtype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification_category.destroy\n\n head :no_content\n end",
"def destroy\n @job_notification = JobNotification.find(params[:id])\n @job_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to job_notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @heartbeat = Heartbeat.find(params[:id])\n @heartbeat.destroy\n\n respond_to do |format|\n format.html { redirect_to heartbeats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n \n #remove notification \n #remove plots \n\n\n if [email protected]_id\n notifications = Journal.where(notification_type: \"StoryCreate\", notification_id: @tale.id)\n notifications.each do|notification|\n notification.delete\n end \n\n\n @tale.destroy\n\n\n\n\n\n\n respond_to do |format|\n #format.html { redirect_to tales_url }\n format.html { redirect_to profiles_index_path(current_user.id) }\n format.json { head :no_content }\n end\n end\n\n\n end",
"def destroy\n @notifier.destroy\n\n respond_to do |format|\n format.html { redirect_to(notifiers_url, :notice => 'Kennisgever is succesvol ontkoppeld.') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @notification.destroy\n return_back_or_ajax\n end",
"def delete_notification(principal_uri, notification)\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @doctor_notification.destroy\n respond_to do |format|\n format.html { redirect_to doctor_notifications_url, notice: 'Doctor notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reminder = Reminder.find(params[:id])\n @reminder.destroy\n\n \n\n respond_to do |format|\n format.html { redirect_to reminders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notice = Notice.find(params[:id])\n @notice.destroy\n\n respond_to do |format|\n format.html { redirect_to person_notices_path( @person) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end",
"def destroy\n @notification_restriction = NotificationRestriction.find(params[:id])\n @notification_restriction.destroy\n\n respond_to do |format|\n format.html { redirect_to notification_restrictions_url }\n format.json { head :ok }\n end\n end",
"def delete_message_by_restaurant\n root_id = @parsed_json[\"message_id\"] if @parsed_json[\"message_id\"]\n check = Notifications.where(\"id=?\", root_id.to_i).first\n if check.nil?\n render :status=>412, :json=>{:status=>:failed, :error=>\"Not exist this message\"}\n else\n sql =\"notifications.alert_type != 'Publish Menu Notification' AND notifications.id=? OR notifications.reply=?\"\n notifications = Notifications.where(sql, root_id.to_i,root_id.to_i)\n for i in notifications\n i.update_attributes(:is_show=>0, :is_show_detail=>0)\n end\n render :status=>200, :json=>{:status=>:success}\n end\n end",
"def destroy\n @reminder = Reminder.find(params[:id])\n @reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to reminders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reminder = Reminder.find(params[:id])\n @reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to reminders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @eventnotifier.destroy\n respond_to do |format|\n format.html { redirect_to eventnotifiers_url, notice: 'Eventnotifier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity_notice.destroy\n respond_to do |format|\n format.html { redirect_to activity_notices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @notifications = Notification.where(item_id: @vacante_aplicada.id).unviewed #destrir todas las notificaciones que sean de esta vacante\n if(@notifications)\n @notifications.destroy_all #destruye todas las notificaciones que tengan que ver con esta vacante\n end\n\n @vacante_aplicada.destroy\n respond_to do |format|\n format.html { redirect_to vacante_aplicadas_url, notice: 'Vacante aplicada was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification_rule.destroy\n respond_to do |format|\n format.html { redirect_to notification_rules_url, notice: 'Notification rule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notice.destroy\n respond_to do |format|\n format.html { redirect_to notices_url, notice: 'Notice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notice.destroy\n respond_to do |format|\n format.html { redirect_to notices_url, notice: 'Notice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def delete_notifications\n Notification.where(origin_type: 'Message', origin_id: @message.id).destroy_all\n end",
"def destroy\n result = access_token.delete(\"/api/v1/emails/#{params[:id]}\")\n display_api_response( result )\n respond_with(\"\",:location => :back)\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @parent_to_teacher_notification.destroy\n respond_to do |format|\n format.html { redirect_to parent_to_teacher_notifications_url, notice: 'Parent to teacher notification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @mail.destroy\n respond_to do |format|\n format.html { redirect_to mails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inform_mail.destroy\n respond_to do |format|\n format.html { redirect_to inform_mails_url }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @new_city_notification = NewCityNotification.find(params[:id])\n @new_city_notification.destroy\n\n respond_to do |format|\n format.html { redirect_to new_city_notifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # delete a specific message\n end",
"def delete(id)\n Mailgun.submit :delete, webhook_url(id)\n end",
"def destroy\n @notice_message.destroy\n respond_to do |format|\n format.html { redirect_to notice_messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @note1.destroy\n respond_to do |format|\n format.html { redirect_to note1s_url, notice: \"Note1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n @notice = Notice.get(params[:id])\n @notice.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_notices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n \n @notice = Notice.get(params[:id])\n @notice.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_notices_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end",
"def destroy\n @reminder.destroy\n respond_to do |format|\n format.html { redirect_to reminders_url, notice: \"Reminder was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end"
] | [
"0.76316833",
"0.7612126",
"0.7582967",
"0.7582967",
"0.7582967",
"0.7582967",
"0.75271237",
"0.7509277",
"0.7415778",
"0.7409959",
"0.7405695",
"0.7383919",
"0.7381154",
"0.73799336",
"0.7351029",
"0.73404694",
"0.7332287",
"0.73111224",
"0.7302633",
"0.7300147",
"0.72997034",
"0.7295081",
"0.7206847",
"0.7143968",
"0.7123488",
"0.7101756",
"0.707799",
"0.699951",
"0.6995547",
"0.69921577",
"0.6987112",
"0.6985994",
"0.69078934",
"0.6870134",
"0.68503314",
"0.6815936",
"0.6801814",
"0.6792929",
"0.67878896",
"0.6779796",
"0.67759275",
"0.67593336",
"0.6752056",
"0.6733671",
"0.6706143",
"0.66934115",
"0.668509",
"0.6684285",
"0.66842395",
"0.6680936",
"0.6676978",
"0.6657471",
"0.6647053",
"0.66317147",
"0.66315943",
"0.6614906",
"0.6609098",
"0.6606562",
"0.660473",
"0.6602272",
"0.65731436",
"0.6563542",
"0.65625095",
"0.6548924",
"0.6546958",
"0.6546958",
"0.65378946",
"0.653225",
"0.6530779",
"0.65288204",
"0.6519087",
"0.6488629",
"0.6488629",
"0.6467157",
"0.6466395",
"0.6460575",
"0.6456311",
"0.6452691",
"0.6435214",
"0.64318",
"0.64318",
"0.6425258",
"0.64144087",
"0.64129394",
"0.64129394",
"0.64129394",
"0.64129394",
"0.64046586",
"0.6396521",
"0.6394817",
"0.6388125",
"0.63843477",
"0.6379589",
"0.6379589",
"0.6379039",
"0.6376297"
] | 0.72660834 | 26 |
Use callbacks to share common setup or constraints between actions. | def set_notification
@notification = Notification.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def notification_params
params.require(:notification).permit(:title, :message, :from, :student_id, :notification_type, :type_data, :by_sms, :by_mail, :by_app)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def valid_params_request?; end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end"
] | [
"0.69811666",
"0.6782836",
"0.6747644",
"0.6742015",
"0.6735273",
"0.6593917",
"0.65037674",
"0.6498627",
"0.6482372",
"0.64795715",
"0.64566946",
"0.6439213",
"0.6380714",
"0.6378147",
"0.63657266",
"0.63206697",
"0.6300169",
"0.62992156",
"0.6295538",
"0.62943023",
"0.62915146",
"0.6290595",
"0.62824667",
"0.62420255",
"0.62403506",
"0.6217174",
"0.6213706",
"0.62112075",
"0.6194868",
"0.6178784",
"0.6174678",
"0.6172499",
"0.61630744",
"0.61544263",
"0.615248",
"0.6147727",
"0.61221075",
"0.6119646",
"0.61076134",
"0.6106584",
"0.6094013",
"0.6081423",
"0.6071337",
"0.6063637",
"0.6021453",
"0.6018253",
"0.60161054",
"0.60112554",
"0.60071784",
"0.60071784",
"0.60004836",
"0.6000254",
"0.5999255",
"0.59930664",
"0.59919107",
"0.5991741",
"0.5980763",
"0.59663844",
"0.59605104",
"0.5960486",
"0.5959414",
"0.5957901",
"0.59538954",
"0.5953327",
"0.59450173",
"0.59391475",
"0.59391475",
"0.59386194",
"0.59351885",
"0.593139",
"0.5926316",
"0.5925927",
"0.59176016",
"0.59119296",
"0.5909275",
"0.5908221",
"0.59053046",
"0.58983994",
"0.58980995",
"0.58964473",
"0.5895902",
"0.5893993",
"0.58927304",
"0.5887752",
"0.58841616",
"0.5880381",
"0.58752084",
"0.586956",
"0.5868584",
"0.58679324",
"0.5867004",
"0.58667004",
"0.58642864",
"0.5863347",
"0.58626384",
"0.58615845",
"0.58594906",
"0.5854959",
"0.5854423",
"0.58506453",
"0.5850135"
] | 0.0 | -1 |
character graphic index Start | def start
DataManager.create_game_objects
$game_party.setup_starting_members
$game_map.setup(Config::Starting_Map_ID)
$game_player.moveto(Config::X_Pos, Config::Y_Pos)
$game_player.followers.visible = false
$game_player.refresh
$game_player.make_encounter_count
@character_name = $game_player.character_name
@character_index = $game_player.character_index
$game_player.set_graphic('', 0)
$game_system.menu_disabled = true
Graphics.frame_count = 0
super
create_foreground
create_background
create_command_window
play_title_music
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def range_start\n @character_range[0]\n end",
"def zero_start\n @chr_start - 1\n end",
"def start_character\n attributes.fetch(:startCharacter)\n end",
"def class_character_index(d)\n cur_graph = class_graphics\n return nil if cur_graph.nil?\n index = cur_graph[:character_index]\n is_regular = cur_graph[:is_regular]\n has_diagonal = cur_graph[:has_diagonal]\n $imported[\"CXJ-AnimEx\"] && is_regular && has_diagonal && d % 2 != 0 ? index + 1 : index\n end",
"def char_at(index)\n self.to_array[index.to_i]\n #@word = TILE_VALUES[index]\n end",
"def first_char_idx\n dewey? ? 3 : 0\n end",
"def starting_position; end",
"def line_char_to_offset(text, line, character); end",
"def line_index()\n end",
"def character_location\n ((@cr[5] ^ 0x08) & 0x08) << 12 | (@cr[5] & 0x07) << 10\n end",
"def begin_pos; end",
"def set_selection_for_char char\n @oldrow = @current_index\n ix = next_match char\n @current_index = ix if ix && ix != -1\n bounds_check\n return ix\n end",
"def index_from_start(index); end",
"def get_start(processed_maze)\n # start_horizontal; start_vertical = nil\n processed_maze.each_with_index do |row, vertical_index|\n row.each_with_index do |item, horizontal_index|\n if item == 'o'\n @start_vertical = vertical_index\n @start_horizontal = horizontal_index\n end\n end\n end\n end",
"def pos() end",
"def pos() end",
"def pos() end",
"def pos() end",
"def set_selection_for_char char\n ix = next_match char\n @prow = ix if ix != -1\n return ix\n end",
"def getCharImgLoc(char)\n \"#{font_path}/cm_#{char}.png\"\n\t\tend",
"def pos_x\n @font.text_width(text[0...caret_pos])\n end",
"def line_from_char(index = -1)\n send_message(:LINEFROMCHAR, index.to_i)\n end",
"def character(index = nil)\n return '' if line && line.empty?\n return line[-1] unless index\n\n Vedeu::Editor::Item.by_index(line, index)\n end",
"def normal_data_start(text)\n text.index(\"\\1\\n\", 2) + 2\n end",
"def position_for(char)\n return ''.freeze if char.position.y == @y\n\n @y = char.position.y\n char.position.to_s\n end",
"def getXYIndex(s)\n return s.y * @width + s.x;\n end",
"def get_char at\n index = range_correct_index(at)\n return internal_object_get(index + 1)\n end",
"def glyph i, j\n unless (1..@rows).cover?(i) && (1..@cols).cover?(j)\n raise Exception \"Row #{i} is out of range (max #{@rows})\"\n end\n @contents[i - 1][j - 1]\n end",
"def get_char\n @look = @expression[@number]\n @number +=1\nend",
"def draw_segment(character, offset)\n puts \"#{' ' * offset}#{character}\"\nend",
"def start_of_word(word, num_chars)\n word[0, num_chars]\nend",
"def text_position\n end",
"def start_of_word(word, idx)\n\tword[0..idx-1]\nend",
"def startpos(nr)\n case @art\n when 0:\n case nr\n when 0:\n return @x/4,@y/2,0\n when 1:\n return 3*@x/4,@y/2,2\n when 2:\n return @x/2,@y/4,1\n when 3:\n return @x/2,3*@y/4,3\n else\n raise \"Für dieses Feld sind nur 4 Positionen definiert!\"\n end\n else\n raise \"Art #{art} ist noch nicht definiert!\"\n end\n end",
"def start_of_word(text,n)\n\treturn text[0,n]\nend",
"def index(p0) end",
"def index(p0) end",
"def c0_index\n c0_r(0, 0)\n end",
"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",
"def pos() @current end",
"def text_coordinate\n return 39, 5, 222, 16\n end",
"def NextChar\r\n\t\[email protected]!(0, 1)\r\n\tend",
"def current_char\n @current_char\n end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def get_start_p()\n frame_start\n label(:a) do\n puts \"Zadaj pociatocny bod: X(0-#{@width-1}) Y(0-#{@height-1})\"\n begin\n @start_p = convert_s_array_to_i_array(gets.split(\" \"))\n raise(ArgumentError) if @start_p[0] < 0 or @start_p[0] >= @width or @start_p[1] < 0 or @start_p[1] >= @height\n rescue ArgumentError\n puts \"Chybný vstup. Skús znova.\\n\"\n\n # znovu nacitanie vstupu\n goto :a\n end\n end\n frame_end\n end",
"def draw_horizontal(line, start_char, end_char)\n start_char.upto(end_char) { |char_idx| @lines[line][char_idx] = PATH_CHAR } \n end",
"def set_graphic(character_name, character_index)\r\n @tile_id = 0\r\n @character_name = character_name\r\n @character_index = character_index\r\n @original_pattern = 1\r\n end",
"def x_offset; end",
"def text_x(pos)\n unless @text_pos\n @text_pos = []\n 0.upto(13) do |i|\n @text_pos[i] = x + i * char_spacing * xdim + (i >= 7 ? 6 : (i >= 1 ? 2 : 0))*xdim\n end\n end\n @text_pos[pos]\n end",
"def text_selection_start__position(text_input_handle)\n end",
"def begin_pos=(_); end",
"def pos_to_index(position)\n position[1] * 8 + position[0]\n end",
"def index(x, y)\n (y - 1) * width + (x - 1)\n end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def character; end",
"def get\n @source_index += 1\n\n # Maintain line count.\n prev_char = @source_text[@source_index - 1]\n if @source_index.positive? && prev_char == \"\\n\"\n @line_index += 1\n @col_index = -1\n end\n\n @col_index += 1\n char = if @source_index > @last_index\n # Read past the end of source text.\n END_MARK\n else\n @source_text[@source_index]\n end\n Character.new(char, @line_index, @col_index, @source_index, @source_text)\n end",
"def find_start\n find_cell(START)\n end",
"def start_of_word (str, num)\n\n str[0, num]\n\nend",
"def line_num_to_coord(n)\n\t\t(n + 1) * font_metrics.height\n\tend",
"def char_at(column)\n line[column, 1]\n end",
"def next_match char\n data = get_content\n row = focussed_index\n currval = data[row].chomp\n row.upto(data.length-1) do |ix|\n val = data[ix].chomp\n if val[0,1] == char and val != currval\n return ix\n end\n end\n 0.upto(row) do |ix|\n val = data[ix].chomp\n if val[0,1] == char and val != currval\n return ix\n end\n end\n return -1\n end",
"def span_start; end",
"def alphabet_position(text)\n \nend",
"def start_line_number; end",
"def start_line_number; end",
"def start_num\n return @start_num\n end",
"def line_at(start_x, str)\n x = start_x\n move_to_x(start_x) if start_x > 1\n str.length.times do |i|\n $stdout.putc str[i] if x > 0 && x < @width\n x += 1\n end\n $stdout.putc \"\\n\"\n end",
"def closest_character_index(position)\n\t\t\t# Move caret into position\n\t\t\t# Try to get as close to the position of the cursor as possible\n\t\t\twidth = @font.width(@string, @height)\n\t\t\tx = @position.x\n\t\t\tmouse_x = $window.mouse.position_in_world.x\n\t\t\t\n\t\t\t# Figure out where mouse_x is along the continuum from x to x+width\n\t\t\t# Use that to guess what the closest letter is\n\t\t\t# * basically, this algorithm is assuming fixed width, but it works pretty well\n\t\t\tpercent = (mouse_x - x)/width.to_f\n\t\t\ti = (percent * (@string.length)).to_i\n\t\t\t\n\t\t\ti = 0 if i < 0\n\t\t\ti = @string.length if i > @string.length\n\t\t\t\n\t\t\treturn i\n\t\tend",
"def next_char\n self.cursor += 1\n end",
"def start_of_word(word, nbr)\n\treturn \"#{word}\".slice(0, nbr )####renvoie une sous-chaine de caractère (position, nbr caractere recupérés)\nend",
"def start_of_word(word,nb)\n\tword[0...nb]\nend",
"def idx(x, y)\n tx = x % @width\n ty = y % @height\n idx = tx + ty * @width\n end",
"def start_symbol\n @start_symbol\n end",
"def line_for_position(position); end",
"def line_for_position(position); end",
"def line_for_position(position); end",
"def get_char_position_in_line\n raise NotImplementedError\n end",
"def first_offset; end",
"def first_offset; end"
] | [
"0.69694406",
"0.68426895",
"0.68343174",
"0.6538088",
"0.6373407",
"0.6368403",
"0.63429683",
"0.63263583",
"0.6319428",
"0.6306296",
"0.6260088",
"0.61901706",
"0.6186515",
"0.6176402",
"0.61725277",
"0.61725277",
"0.61725277",
"0.61725277",
"0.61654586",
"0.6128893",
"0.6126334",
"0.6115353",
"0.6105691",
"0.60931975",
"0.60868055",
"0.6080102",
"0.60704356",
"0.6056834",
"0.6028655",
"0.60277975",
"0.602669",
"0.5998077",
"0.5983333",
"0.59777975",
"0.59685826",
"0.59648764",
"0.59648764",
"0.5947965",
"0.5946691",
"0.5945108",
"0.58863866",
"0.58855",
"0.5877181",
"0.58719873",
"0.58719873",
"0.58719873",
"0.58719873",
"0.58719873",
"0.58719873",
"0.5870574",
"0.5852596",
"0.58363646",
"0.58349556",
"0.5829904",
"0.5821706",
"0.5818909",
"0.5816766",
"0.58124244",
"0.58113545",
"0.58113545",
"0.58113545",
"0.58113545",
"0.58113545",
"0.58113545",
"0.58113545",
"0.58113545",
"0.58113545",
"0.58113074",
"0.58113074",
"0.58113074",
"0.58113074",
"0.58113074",
"0.58113074",
"0.58113074",
"0.58113074",
"0.58113074",
"0.58113074",
"0.5808267",
"0.5806902",
"0.5790427",
"0.57858586",
"0.57831347",
"0.5780494",
"0.5771815",
"0.5756397",
"0.57413626",
"0.57413626",
"0.5737939",
"0.57282495",
"0.5719241",
"0.57168376",
"0.57104164",
"0.5705899",
"0.5705229",
"0.5700393",
"0.5696188",
"0.5696188",
"0.5696188",
"0.56955665",
"0.5685882",
"0.5685882"
] | 0.0 | -1 |
Determine if Debug Call by F9 key | def update_call_debug
# do nothing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_call_debug\r\n # If debug mode is ON and F9 key was pressed\r\n if $DEBUG and Input.press?(Input::F9)\r\n # Set debug calling flag\r\n $game_temp.debug_calling = true\r\n end\r\n end",
"def key_pressed?\n @declared_fields['keyPressed'].value(java_self)\n end",
"def key_pressed?(key)\n key_const = Gosu.const_get(:\"Kb#{key.to_s.gsub(/\\b\\w/){$&.upcase}}\")\n button_down?(key_const)\n end",
"def onKeyDown(key, repeat, flags, view)\r\n if key == VK_END # toggle zig direction\r\n toggle_direc_flag()\r\n end\r\n if key == VK_HOME # toggle use of flood fill\r\n @flood = !@flood\r\n if (@flood)\r\n @statusmsg = @statusmsgBase2 + \"FLOOD #{@stepover_percent}%\"\r\n else\r\n @statusmsg = @statusmsgBase + \"StepOver #{@stepover_percent}%\"\r\n end\r\n Sketchup::set_status_text(@statusmsg, SB_PROMPT)\r\n end\r\n\r\n if (key == VK_SHIFT)\r\n @keyflag = 1\r\n else\r\n if (key == VK_CONTROL)\r\n @keyflag = 2\r\n else\r\n super #process other keys for depth selection\r\n end\r\n end\r\n end",
"def debug?\n puts \"Debug mode is #{@shell_debug ? 'ON' : 'OFF'}\\n\\n\"\n nil\nend",
"def breakpoint?\n type == :breakpoint\n end",
"def isKeyActive _args\n \"isKeyActive _args;\" \n end",
"def dbgprint? bit\n ($debug & bit) > 0 if $debug\nend",
"def dbgprint? bit\n ($debug & bit) > 0 if $debug\nend",
"def startkeylogger(session)\n\tbegin\n\t\t#print_status(\"Grabbing Desktop Keyboard Input...\")\n\t\t#session.ui.grab_desktop\n\t\tprint_status(\"Starting the keystroke sniffer...\") \n\t\tsession.ui.keyscan_start\n\t\treturn true\n\trescue\n\t\tprint_status(\"Failed to start Keylogging!\")\n\t\treturn false\n\tend\nend",
"def click?(key)\n return false if key.is_a?(Symbol)\n\n key.is_a?(Vedeu::Cursors::Cursor) || key.start_with?(\"\\e[M\")\n end",
"def debug it\n PryByebug::BreakCommand.new.send :add_breakpoint, \"Testo::Test#run\", nil\n # How to \"next next step\" automatically when the breakpoint is hit?\n\n begin\n run it\n raise \"Cannot reproduce. It might be a heisebug.\"\n rescue\n $!\n end\nend",
"def key_press?\n $gtk.args.keyboard.key_down.raw_key\nend",
"def keypress\n return false unless key\n\n return true if key_defined? && keymap.use(key)\n\n return true if global_key? && keymap('_global_').use(key)\n\n Vedeu.log(type: :input, message: \"Key detected: #{key.inspect}\".freeze)\n\n false\n end",
"def debug_through?\r\n return false\r\n end",
"def debugging?\n ENV['DEBUG'] && ENV['DEBUG'] != ''\nend",
"def debug? ; $DEBUG ; end",
"def gui_open?\n names = buffers.values\n %w[DebuggerStack DebuggerStatus DebuggerWatch].all? { |b|\n names.include? b\n }\n end",
"def key_pressed?(key)\r\n\t\tif (GetKeyState.call(VALUES[key]).abs & 0x8000 == 0x8000)\r\n\t\t\tKeyRepeatCounter[key] = 0\r\n\t\t\treturn true\r\n\t\tend\r\n\t\treturn false\r\n\tend",
"def debug_flag_active?(name)\n if debug_flags.has_key?(name)\n debug_flags[name]\n else\n ColorDebugMessages.global_debug_flags[name]\n end\n end",
"def debug_mode\n @@debug_mode == 1\n end",
"def breakpoint()\n #This is a stub, used for indexing\n end",
"def debug?\n true\n end",
"def debug?\n true\n end",
"def debugging?\n\t\t(datastore['DEBUG'] || '') =~ /^(1|t|y)/i\n\tend",
"def rp5_key_press?(key)\n if $sketch.key_pressed?\n if $sketch.key == $sketch.class::CODED\n return $sketch.key_code == key\n else\n return $sketch.key == key.chr\n end\n end\n return false\n end",
"def debug()\n # =========================================\n # DEBUG CODE FOR STEPPING\n # =========================================\n puts \"Curr char is: #{@curr_char}\"\n puts \"PC direction is: #{@curr_direction}\"\n puts \"Stack contents are: #{@stack}\"\n puts \"Skip is: #{@skip}\"\n puts \"Ascii_Mode is: #{@ascii_mode}\"\n prompt()\n STDIN.gets\n\n # =========================================\n # END DEBUG CODE\n # =========================================\n\n end",
"def press_any_key\n # TODO: Print footer.\n get_wch\n end",
"def x?\n# ^^^ fg=#fb4934 fs=\n# ^^ fg=#b8bb26 fs=\n\n end",
"def show\n# byebug\n end",
"def show\n #hh = 'show'\n # byebug\n end",
"def show_command?\n ENV['DEBUG'] || ENV['SHOW_COMMAND']\n end",
"def debug?\n false\n end",
"def debug?; end",
"def debug?; end",
"def debug?; run_options[:debug]; end",
"def debugger_address=(_arg0); end",
"def breakpoint binding; IRB.start_with_binding binding end",
"def show_single_key\n c = read_char\n\n case c\n when \" \"\n pickUpItem()\n when \"i\"\n showInventory\n when \"m\"\n showMap\n when \"v\"\n inspectSurroundings\n puts \"working\"\n when \"q\"\n system ('clear && printf \"\\e[3J\"') or system (\"cls\")\n exit 0\n when \"k\"\n gameOver\n when \"\\e[A\"\n move(c)\n when \"\\e[B\"\n move(c)\n when \"\\e[C\"\n move(c)\n when \"\\e[D\"\n move(c)\n when \"\\u0003\"\n puts \"CONTROL-C\"\n exit 0\n end\nend",
"def key_pressed?(key)\n SDL::Key.press?(key)\n end",
"def show_single_key\nc = read_char\ncase c\nwhen \" \"\nreturn \"SPACE\"\nwhen \"\\t\"\nreturn \"TAB\"\nwhen \"\\r\"\nreturn \"RETURN\"\nwhen \"\\n\"\nreturn \"LINE FEED\"\nwhen \"\\e\"\nreturn \"ESCAPE\"\nwhen \"\\e[A\"\nreturn \"UP ARROW\"\nwhen \"\\e[B\"\nreturn \"DOWN ARROW\"\nwhen \"\\e[C\"\nreturn \"RIGHT ARROW\"\nwhen \"\\e[D\"\nreturn \"LEFT ARROW\"\nwhen \"\\177\"\nreturn \"BACKSPACE\"\nwhen \"\\004\"\nreturn \"DELETE\"\nwhen \"\\e[3~\"\nreturn \"ALTERNATE DELETE\"\nwhen \"\\u0003\"\nreturn \"CONTROL-C\"\nexit 0\nwhen /^.$/\nreturn \"SINGLE CHAR HIT: #{c.inspect}\"\nelse\nreturn \"SOMETHING ELSE: #{c.inspect}\"\nend\nend",
"def debug_Step()\n\tputs \"type and enter on CMD to continue\"\n\ttemp = gets\nend",
"def key_pressed?(key)\n @prev_down.index(key).nil? and @down.index(key)\n end",
"def read_postition()\n start_command('F82', false, @status_debug_msg)\n end",
"def debug?\n\t\t!!@debuggable_status\n\tend",
"def enable_advanced_debugging_tools=(_arg0); end",
"def trigger_breakpoint\n local_var = 6 * 7\n local_var\n end",
"def debug?\n !!@debug\n end",
"def debugger_address; end",
"def keyboard_shown?\n @bridge.is_keyboard_shown\n end",
"def keyboard_shown?\n @bridge.is_keyboard_shown\n end",
"def dash?\n return false if @run_points == 0 && StandWalkRun::Use_run\n return true if Input.press?(Input::A) && StandWalkRun::Use_run\n end",
"def call_debug\n call_idle($game_player.old_character_name, false)\n syn_map_debug\n end",
"def ask_hint deflt=nil\n f = nil\n key = get_char\n return deflt if key == 'ENTER'\n\n ix = get_index(key, @vps)\n f = @viewport[ix] if ix\n f\nend",
"def is_breakpoint_deferred(ip)\r\n if !ip.kind_of? String\r\n return false\r\n end\r\n\r\n m,f = ip.split('!')\r\n\r\n if f.nil? or m.nil?\r\n return true\r\n end\r\n\r\n modules.each do |d|\r\n if d.szModule.to_s.match(/#{m}/)\r\n return false\r\n end\r\n end\r\n\r\n return true\r\n end",
"def debug?\n self[:debug] == 'true'\n end",
"def debug?\n @debug || ENV['HATCHET_DEBUG'] || false\n end",
"def show_single_key\n c = read_char\n \n case c\n when \" \"\n puts \"SPACE\"\n when \"\\t\"\n puts \"TAB\"\n when \"\\r\"\n puts @cursor_pos\n when \"\\n\"\n puts \"LINE FEED\"\n when \"\\e\"\n puts \"ESCAPE\"\n \n\n when \"\\e[A\" ##up\n print \"\\033[1A\\033\"\n @cursor_pos[1] -= 1\n when \"\\e[B\" ##down\n print \"\\033[1B\\033\"\n @cursor_pos[1] += 1\n when \"\\e[C\" ##right\n print \"\\033[1C\\033\"\n @cursor_pos[0] += 1\n when \"\\e[D\" ##left\n print \"\\033[1D\\033\"\n @cursor_pos[0] -= 1\n \n\n when \"\\177\"\n puts \"BACKSPACE\"\n when \"\\004\"\n puts \"DELETE\"\n when \"\\e[3~\"\n puts \"ALTERNATE DELETE\"\n when \"\\u0003\"\n puts \"CONTROL-C\"\n exit 0\n when \"f\"\n puts \"flag\"\n puts \"SINGLE CHAR HIT: #{c.inspect}\"\n else\n puts \"SOMETHING ELSE: #{c.inspect}\"\n end\n\n #p @cursor_pos\nend",
"def canBecomeKeyWindow\n true\n end",
"def canBecomeKeyWindow\n true\n end",
"def show_single_key\n c = read_char\n\n case c\n when \" \"\n puts \"SPACE\"\n when \"\\t\"\n puts \"TAB\"\n when \"\\r\"\n puts \"RETURN\"\n when \"\\n\"\n puts \"LINE FEED\"\n when \"\\e\"\n puts \"ESCAPE\"\n when \"\\e[A\"\n puts \"UP ARROW\"\n when \"\\e[B\"\n puts \"DOWN ARROW\"\n when \"\\e[C\"\n puts \"RIGHT ARROW\"\n when \"\\e[D\"\n puts \"LEFT ARROW\"\n when \"\\177\"\n puts \"BACKSPACE\"\n when \"\\004\"\n puts \"DELETE\"\n when \"\\e[3~\"\n puts \"ALTERNATE DELETE\"\n when \"\\u0003\"\n puts \"CONTROL-C\"\n exit 0\n when /^.$/\n puts \"SINGLE CHAR HIT: #{c.inspect}\"\n else\n puts \"SOMETHING ELSE: #{c.inspect}\"\n end\n end",
"def keyctrl_d(*)\n @stop = true\n end",
"def debug (what)\n ap what\n exit 2\nend",
"def getch\n\n end",
"def checkdebug\n begin\n if ENV['FACTER_DEBUG'] == 'true'\n Facter.debugging(true)\n end\n rescue\n end\nend",
"def checkdebug\n begin\n if ENV['FACTER_DEBUG'] == 'true'\n Facter.debugging(true)\n end\n rescue\n end\nend",
"def enable_advanced_debugging_tools; end",
"def press?(key)\n return @press[ key.is_a?(Symbol) ? KEY.get(key) : key ]\n end",
"def fle?\n %w(1 true yes helper).include?(ENV['FLE']&.downcase)\n end",
"def trigger?(key)\r\n\t\treturn ow_dt_i_trigger(key) if !VALUES.has_key?(key)\r\n\t\tcount = KeyRepeatCounter[key]\r\n\t\treturn ((count == 0) or (count.nil? ? key_pressed?(key) : false))\r\n\tend",
"def debug?\n @level <= 0\n end",
"def print_debug(s)\n config = BeEF::Core::Configuration.instance\n if config.get('beef.debug') || BeEF::Core::Console::CommandLine.parse[:verbose]\n puts Time.now.localtime.strftime(\"[%k:%M:%S]\")+'[>]'.yellow+' '+s.to_s\n end\nend",
"def breakpoint?(ip)\n Rubinius.primitive :compiledmethod_is_breakpoint\n raise ArgumentError, \"Unable to retrieve breakpoint status on #{inspect} at bytecode address #{ip}\"\n end",
"def click?(keys)\n return false if keys.nil? || symbol?(keys)\n\n keys.is_a?(Vedeu::Cursors::Cursor) || keys.start_with?(\"\\e[M\")\n end",
"def hotkey\n @link.HotKey\n end",
"def cmd_keyscan_start(*args)\n\t\tprint_line(\"Starting the keystroke sniffer...\")\t\n\t\tclient.ui.keyscan_start\n\t\treturn true\n\tend",
"def debug_program\n error = Byebug.debug_load(program, stop)\n puts \"#{error}\\n#{error.backtrace}\" if error\n end",
"def show\n # byebug\n end",
"def show_return_option\n puts \"\\n000 - Return to main Screen\"\n print \":>\"\n end",
"def debug=(_arg0); end",
"def debug=(_arg0); end",
"def debug\n usb_set_indicator_as_debug_light wValue: 1\n self\n end",
"def resolve_key key\n clear_message\n\n # hint mode, pick file based on shortcut\n return select_hint(@viewport, key) if key.match?(/^[a-pr-zZ]$/)\n\n if '0123456789'.include?(key)\n resolve_numeric_key(key)\n elsif key == 'BACKSPACE'\n @patt = @patt[0..-2] if @patt && [email protected]?\n @message = @patt = nil if @patt == ''\n @title = nil unless @patt\n else\n resolve_binding key\n end\n true\nend",
"def boot_interrupted?()\n Evdev.keys_held(KEYS)\n end",
"def debug; end",
"def debug; end",
"def debug; end",
"def debug; end",
"def keys_down? *key_symbols\n key_symbols.each do |key_symbol|\n return false unless key_down? key_symbol\n end\n return nil if key_symbols.empty?\n return true\n end",
"def prompt\n \"(byebug:ctrl) \"\n end",
"def cmd_keyscan_start(*args)\n\t\tprint_line(\"Starting the keystroke sniffer...\")\n\t\tclient.ui.keyscan_start\n\t\treturn true\n\tend",
"def any_key_down? *key_symbols\n key_symbols.each do |key_symbol|\n return true if key_down? key_symbol\n end\n return nil if key_symbols.empty?\n return false\n end",
"def start_keylogger\n session.ui.keyscan_stop rescue nil #Stop keyscan if it was already running for some reason.\n begin\n print_status(\"Starting the keylog recorder...\")\n session.ui.keyscan_start\n return true\n rescue\n print_error(\"Failed to start the keylog recorder: #{$!}\")\n return false\n end\n end",
"def break?\n @break\n end",
"def key?(p0) end",
"def debug?\n !!self.debug\n end",
"def on_key_pressed(event)\n\n # Enter key\n if (event.keyval == Gdk::Keyval::GDK_Return)\n catch_text()\n\n # Backspace key\n elsif (event.keyval == Gdk::Keyval::GDK_BackSpace)\n iter = @buffer.end_iter\n if iter.offset == @@offset\n return true\n else\n return false\n end\n\n # Delete key\n elsif (event.keyval == Gdk::Keyval::GDK_Delete)\n iter = @buffer.end_iter\n if iter.offset == @@offset\n return true\n else\n return false\n end\n\n # Previous command\n elsif (event.keyval == Gdk::Keyval::GDK_Up)\n cmd = @historic.prev(current_line())\n replace(cmd)\n return true\n\n # Next command\n elsif (event.keyval == Gdk::Keyval::GDK_Down)\n cmd = @historic.next(current_line())\n replace(cmd)\n return true\n end\n\n end",
"def show_single_key\n c = read_char\n\n case c\n when \" \"\n RTermGame.println \"SPACE\"\n when \"\\t\"\n RTermGame.println \"TAB\"\n when \"\\r\"\n RTermGame.println \"RETURN\"\n when \"\\n\"\n RTermGame.println \"LINE FEED\"\n when \"\\e\"\n RTermGame.println \"ESCAPE\"\n when \"\\e[A\"\n RTermGame.println \"UP ARROW\"\n when \"\\e[B\"\n RTermGame.println \"DOWN ARROW\"\n when \"\\e[C\"\n RTermGame.println \"RIGHT ARROW\"\n when \"\\e[D\"\n RTermGame.println \"LEFT ARROW\"\n when \"\\177\"\n RTermGame.println \"BACKSPACE\"\n when \"\\004\"\n RTermGame.println \"DELETE\"\n when \"\\e[3~\"\n RTermGame.println \"ALTERNATE DELETE\"\n when \"\\u0003\"\n RTermGame.println \"CONTROL-C\"\n exit 0\n when /^.$/\n RTermGame.println \"SINGLE CHAR HIT: #{c.inspect}\"\n else\n RTermGame.println \"SOMETHING ELSE: #{c.inspect}\"\n end\nend",
"def debug_mode?\n @@debug_mode\n end",
"def win?\n\t\t!(@progress_key.include?(\"_\"))\n\tend",
"def testCommandLineDebugShort\n # Make sure we don't break debug\n lDebugMode = debug_activated?\n begin\n executeSlave( [ '-d' ] )\n rescue Exception\n activate_log_debug(lDebugMode)\n raise\n end\n activate_log_debug(lDebugMode)\n end"
] | [
"0.715639",
"0.595154",
"0.55854803",
"0.5574925",
"0.5574216",
"0.5574095",
"0.55705386",
"0.5516987",
"0.5516987",
"0.5495007",
"0.547738",
"0.5474451",
"0.5454143",
"0.5453563",
"0.54231745",
"0.5416089",
"0.54038405",
"0.5390203",
"0.5356487",
"0.5340475",
"0.5337784",
"0.5329946",
"0.53247535",
"0.53247535",
"0.5324083",
"0.5324065",
"0.5321911",
"0.5316922",
"0.5303021",
"0.5301563",
"0.53007126",
"0.5295348",
"0.5277376",
"0.5277186",
"0.5277186",
"0.5276406",
"0.5261857",
"0.52405125",
"0.5239147",
"0.5218441",
"0.5216009",
"0.5213529",
"0.5206791",
"0.5200724",
"0.51846373",
"0.51838344",
"0.51733786",
"0.5169432",
"0.51682436",
"0.51506984",
"0.51506984",
"0.51382226",
"0.5127067",
"0.5117263",
"0.5105869",
"0.51055276",
"0.510104",
"0.51010346",
"0.51000947",
"0.51000947",
"0.50976825",
"0.5091104",
"0.5090567",
"0.50885886",
"0.50875187",
"0.50875187",
"0.50824016",
"0.507674",
"0.5073693",
"0.5069468",
"0.5063054",
"0.50587124",
"0.50508356",
"0.5044013",
"0.50329316",
"0.5020342",
"0.5020117",
"0.50165343",
"0.50162244",
"0.500196",
"0.500196",
"0.5001033",
"0.4999409",
"0.4983301",
"0.49753305",
"0.49753305",
"0.49753305",
"0.49753305",
"0.49711272",
"0.49699703",
"0.49699396",
"0.49658886",
"0.4962188",
"0.49545768",
"0.49534184",
"0.49534154",
"0.49495837",
"0.49489114",
"0.4946608",
"0.493759",
"0.49361494"
] | 0.0 | -1 |
Move Sprite to Screen Center | def center_sprite(sprite)
sprite.ox = sprite.bitmap.width / 2
sprite.oy = sprite.bitmap.height / 2
sprite.x = Graphics.width / 2
sprite.y = Graphics.height / 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center(sprite)\n sprite.ox = sprite.width / 2\n sprite.oy = sprite.height / 2\n end",
"def center_sprite(sprite)\r\n \tsprite.ox = sprite.bitmap.width / 2\r\n \tsprite.oy = sprite.bitmap.height / 2\r\n \tsprite.x = Graphics.width / 2\r\n \tsprite.y = Graphics.height / 2\r\n end",
"def center_splashscreen(sprite)\r\n sprite.x = Graphics.width / 2\r\n sprite.y = Graphics.height / 2\r\n sprite.ox = sprite.bitmap.width / 2\r\n sprite.oy = sprite.bitmap.height / 2\r\n end",
"def center_sprite(sprite)\r\n\r\nsprite.ox = sprite.bitmap.width / 2\r\n\r\nsprite.oy = sprite.bitmap.height / 2\r\n\r\nsprite.x = Graphics.width / 2\r\n\r\nsprite.y = Graphics.height / 2\r\n\r\nend",
"def center_im(sprite)\n sprite.ox = sprite.width / 2\n sprite.oy = sprite.height / 2\n end",
"def action_target_center\n @target_x = $scene.spriteset.battleback_width / 2\n @target_y = $scene.spriteset.battleback_height / 2\n end",
"def center(x, y)\n $game_map.set_display_pos(x - center_x, y - center_y)\n end",
"def center(x, y)\n $game_map.set_display_pos(x - center_x, y - center_y)\n end",
"def start_center\n if @place_loc.size > 0\n x, y = @place_loc.first\n @spriteset.cursor.center(x, y) \n elsif @actor_loc.keys.size > 0\n coord = @actor_loc.values.first\n @spriteset.cursor.center(coord.x, coord.y) \n elsif @neu_loc.keys.size > 0\n coord = @neu_loc.values.first\n @spriteset.cursor.center(coord.x, coord.y)\n end\n @spriteset.update\n end",
"def center(x, y)\n # Recalculate the screen center based on the new resolution.\n max_x = ($game_map.width - $game_map.tile_size[0]) * 128\n max_y = ($game_map.height - $game_map.tile_size[1]) * 128\n $game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max\n $game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max\n end",
"def center\n move(90)\n end",
"def set_position_center\n self.set_position(0.5*(@screen_width-@window_width), 0.5*(@screen_height-@window_height))\n return self\nend",
"def center(x, y)\n\n # Get screen coordinates\n screen_x = (x - y) * TILE_WIDTH_HALF + (Graphics.width / 2)\n screen_y = (x + y) * TILE_HEIGHT_HALF + (Graphics.height / 2)\n\n # Calculate distance from center screen\n distance_from_center_x = screen_x - center_screen_x\n distance_from_center_y = screen_y - center_screen_y\n\n # Calculate parallax origin tile with new screen coordinates\n parallax_x = (distance_from_center_x / TILE_WIDTH_HALF + distance_from_center_y / TILE_HEIGHT_HALF) / 2\n parallax_y = (distance_from_center_y / TILE_HEIGHT_HALF - distance_from_center_x / TILE_WIDTH_HALF) / 2\n\n $game_map.set_display_pos(parallax_x, parallax_y)\n end",
"def center(x, y)\n return unless $game_map.target_camera == self\n if $game_map.camera_x_locked?\n $game_map.set_display_pos($game_map.display_x, y - center_y)\n elsif $game_map.camera_y_locked?\n $game_map.set_display_pos(x - center_x, $game_map.display_x)\n else\n rme_center(x, y)\n end\n end",
"def center(x, y)\n max_x = ($game_map.width - 20) * 128\n max_y = ($game_map.height - 15) * 128\n $game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max\n $game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max\n end",
"def moveto(x, y)\n #@ox = x; @oy = y\n @x = x % $game_map.width\n @y = y % $game_map.height\n #kk20\n @real_x = @x * 128 + 64\n @real_y = @y * 128 + 64\n end",
"def center_window\n self.x = (Graphics.width - self.width)/2\n self.y = (Graphics.height - self.height)/2\n end",
"def center_window\n self.x = (Graphics.width - self.width) / 2\n self.y = (Graphics.height - self.height) / 2\n refresh_cursor_position\n end",
"def update_screen\n unless self.disposed?\n self.x = screen_x \n self.y = screen_y\n self.z = self.y + 64 + (@is_moving ? 1 : 0)\n end\n end",
"def center_x\n\t\t\t@x = @@screen.width/2-@width/2\n\t\tend",
"def moveto(x, y)\r\n @x = x % $game_map.width\r\n @y = y % $game_map.height\r\n @real_x = @x\r\n @real_y = @y\r\n @prelock_direction = 0\r\n straighten\r\n update_bush_depth\r\n end",
"def moveto(x, y)\r\r\n @x = x % $game_map.width\r\r\n @y = y % $game_map.height\r\r\n @real_x = @x\r\r\n @real_y = @y\r\r\n @prelock_direction = 0\r\r\n straighten\r\r\n update_bush_depth\r\r\n end",
"def moveto(x, y)\n super\n # Centering\n center(x, y)\n # Make encounter count\n make_encounter_count\n end",
"def center= (point)\n self.frameOrigin = [point.x-(self.frame.size.width/2), point.y-(self.frame.size.height/2)]\n self.needsDisplay = true\n end",
"def setCenter(center)\n # center.x -> bounds.size.width, center.y -> bounds.size.height\n @target.bounds = CGRectMake(0, 0, center.x, center.y)\n end",
"def center\n CGPointMake(@target.bounds.size.width, @target.bounds.size.height)\n end",
"def update_placement\n self.x = (Graphics.width - self.width) / 2\n self.y = (Graphics.height - self.height) / 2\n end",
"def update_pos( dt )\n x = @rect.centerx\n y = @rect.centery\n\n x += @velocity.x * dt\n y += @velocity.y * dt\n\n # Wrap the screen\n screen = @game.screen\n x = 0 if x > screen.w\n x = screen.w if x < 0\n y = 0 if y > screen.h\n y = screen.h if y < 0\n\n @rect.center = [x, y]\n end",
"def set_screen_postion(start_pos, reset = false)\n position = reset ? [$game_player.x,$game_player.y] : start_pos \n pos = set_screen_move_postion(position)\n set_screen(pos[0], $game_map.display_x, true)\n set_screen(pos[1], $game_map.display_y, false)\n end",
"def update_move\n self.x = screen_x\n self.y = screen_y\n update_move_arch if @type == Arched\n end",
"def setCenter aPoint\n self.setFrameOrigin [aPoint.x-(self.frame.size.width/2), aPoint.y-(self.frame.size.height/2)]\n self.setNeedsDisplay true\n end",
"def center_y\n\t\t\t@y = @@screen.height/2-@height/2\n\t\tend",
"def update_position\n self.x = @battler.screen_x\n self.y = @battler.screen_y - (oy * zoom_y)\n self.z = @battler.screen_z\n end",
"def target(sprite)\n return if !sprite || !sprite.is_a?(Sprite)\n self.render(Rect.new(0, 0, sprite.width, sprite.height))\n self.anchor = sprite\n end",
"def move\n @x = (@x + @x_velocity) % Window.width\n @y = (@y + @y_velocity) % Window.height\nend",
"def update_screen\n self.x = screen_x unless self.disposed?\n self.y = screen_y unless self.disposed?\n end",
"def update_screen\n self.x = screen_x unless self.disposed?\n self.y = screen_y unless self.disposed?\n end",
"def update\n @position = @mouse.getMousePos\n if [email protected]?\n @x = @position[0]\n @y = @position[1]\n end\n @sprite.visible = @visible\n @sprite.x = @x\n @sprite.y = @y\n end",
"def moveto(x, y)\n @x = x \n @y = y \n @real_x = @x * 128\n @real_y = @y * 128\n @prelock_direction = 0\n end",
"def setCenter( c)\n w2, h2 = width/2, height/2\n x0, y0 = c[0] - w2, c[1] - h2\n x1, y1 = x0 + width, y0 + height\n self.coords( x0, y0, x1, y1)\n end",
"def place_center renderer, texture\n tw,th = texture.w, texture.h\n x = (w-tw)/2\n y = (h-th)/2\n place renderer, texture, x,y\n @texture\n end",
"def set_at(x, y)\n self.x = x\n self.x = 0 if x < 0\n self.y = y\n if x + self.width > 640\n self.x -= (x + self.width - 640)\n end\n if y + self.height > 480\n self.y -= (y + self.height - 480)\n end\n end",
"def create_target_position\n @target = Sprite.new\n return if no_target\n @target.bitmap = Cache.picture(TARGET_PICTURE)\n center_im(@target)\n @target.x = @target_x\n @target.y = @target_y\n @target.z = 14\n end",
"def set_screen_move_postion(pos)\n max_x = ($game_map.width - 20) * 128\n max_y = ($game_map.height - 15) * 128\n pos_x = [0, [pos[0] * 128 - $game_player.center_x, max_x].min].max\n pos_y = [0, [pos[1] * 128 - $game_player.center_y, max_y].min].max\n return [pos_x, pos_y]\n end",
"def set_display_pos(x, y)\n @display_x = (x + @map.width * 256) % (@map.width * 256)\n @display_y = (y + @map.height * 256) % (@map.height * 256)\n @parallax_x = x\n @parallax_y = y\n end",
"def center\n end",
"def update_position(battler)\n sprite = battler.sprite\n self.x = sprite.x\n self.y = sprite.y - sprite.oy\n end",
"def move\r\n @x += @x_direction\r\n @y += @y_direction\r\n # Preventing the Alien moving out of the screen\r\n if @x > (SCREEN_WIDTH - GAME_PRESET[\"alien_reach\"]) || @x < 0\r\n @x_direction= -@x_direction\r\n elsif @y > (SCREEN_HEIGHT * @height_limit)\r\n @y_direction = 0\r\n end\r\n end",
"def reset_sprites_position(background_sprite, button_down_sprite, button_up_sprite, button_slider_sprite, position, target, size, offset, viewport)\n # Set the x for each sprite\n x = (position == :left ? target.rect.x - background_sprite.width : target.rect.x + target.rect.width)\n x -= viewport.rect.x\n background_sprite.x =\n button_down_sprite.x =\n button_up_sprite.x =\n button_slider_sprite.x = x\n\n # Set y for each sprite\n base_y = offset + target.rect.y + (target.rect.height - size) / 2 - viewport.rect.y\n background_sprite.y = base_y + button_up_sprite.height\n button_up_sprite.y = base_y\n button_down_sprite.y = base_y + button_up_sprite.height + background_sprite.height\n button_slider_sprite.y = base_y + button_up_sprite.height\n\n # Rotate each sprite\n background_sprite.angle =\n button_up_sprite.angle =\n button_down_sprite.angle =\n button_slider_sprite.angle = 0\n end",
"def test_alignMiddleCenter\n [@window, @sprite, @bitmap].each{|container|\n uc = UCIcon.new(container, Rect.new(0, 48, @window.contents.width, 72), 1, 1, 255, 1)\n uc.draw()\n }\n return true\n end",
"def test_alignMiddleCenter\n [@window, @sprite, @bitmap].each{|container|\n uc = UCCharacterGraphic.new(container, Rect.new(0, 80, @window.contents.width, 120), $data_actors[1], 1, 255, 1)\n uc.draw()\n }\n return true\n end",
"def update_location\n self.x = screen_x unless self.disposed?\n self.y = screen_y unless self.disposed?\n end",
"def moveto(x, y)\n @ox = @x = x\n @oy = @y = y \n @real_x = @x * 128\n @real_y = @y * 128 \n end",
"def centre\n @centre ||= world.point(x_min + width/2.0, y_min + height/2.0)\n end",
"def move_animation_camera_relative_static\n if @animation.position != 3\n last_screen_x = @ani_ox\n last_screen_y = @ani_oy\n update_anim_origin_reference\n dx = (@ani_ox - last_screen_x).round\n dy = (@ani_oy - last_screen_y).round\n @ani_sprites.each do |sprite|\n sprite.x += dx\n sprite.y += dy\n end\n end\n end",
"def center=(arg)\n x, y = *(arg.is_a?(Vector) ? arg.getInternal__.to_a : arg)\n self.pos = [x - w / 2, y - h / 2, z]\n self.center\n end",
"def update_position\r\n set_position(@character.screen_x / @zoom, @character.screen_y / @zoom)\r\n self.z = @character.screen_z(@ch) + @add_z\r\n return true\r\n end",
"def reset_sprites_position(background_sprite, button_down_sprite, button_up_sprite, button_slider_sprite, position, target, size, offset, viewport)\n # Set the y for each sprite\n y = (position == :top ? target.rect.y : target.rect.y + target.rect.height + background_sprite.width)\n y -= viewport.rect.y\n background_sprite.y =\n button_down_sprite.y =\n button_up_sprite.y =\n button_slider_sprite.y = y\n\n # Set x for each sprite\n base_x = offset + target.rect.x + (target.rect.width - size) / 2 - viewport.rect.x\n background_sprite.x = base_x + button_up_sprite.height\n button_up_sprite.x = base_x\n button_down_sprite.x = base_x + button_up_sprite.height + background_sprite.height\n button_slider_sprite.x = base_x + button_up_sprite.height\n\n # Rotate each sprite\n background_sprite.angle =\n button_up_sprite.angle =\n button_down_sprite.angle =\n button_slider_sprite.angle = 90\n\n # Correct origin to match the display\n background_sprite.ox =\n button_up_sprite.ox =\n button_down_sprite.ox =\n button_slider_sprite.ox = background_sprite.width\n end",
"def move_home_all\n @target_x = 0\n @target_y = 0\n @target_z = 0\n start_command('G28', true, false)\n end",
"def set_actors_screen_postion(pos)\n base_pos = [pos[0] - $game_player.x, pos[1] - $game_player.y]\n pos_x = $game_player.screen_x + (base_pos[0] * 32)\n pos_y = $game_player.screen_y + (base_pos[1] * 32)\n return [pos_x, pos_y]\n end",
"def update\n return if disposed?\n return dispose if @map_id != $game_map.map_id\n\n dx = $game_map.display_x / 8\n dy = $game_map.display_y / 8\n @sprite.x = (@x - dx)\n @sprite.y = (@y - dy)\n @sprite.z = (@real_y - $game_map.display_y + 4) / 4 + 94\n end",
"def center\n\t\t\tcenter_x\n\t\t\tcenter_y\n\t\tend",
"def moveto(x, y)\n @ox = @x = x\n @oy = @y = y\n @real_x = @x * 128\n @real_y = @y * 128\n end",
"def create_object_position\n @location = Sprite.new\n @location.bitmap = Cache.picture(LOCATION_PICTURE)\n center_im(@location)\n @location.z = 16\n @circlel = Sprite.new\n @circlel.tone.set(255, 0, 0)\n @circlel.blend_type = 1\n @circlel.bitmap = Cache.picture(CIRCLE_PICTURE)\n center_im(@circlel)\n @circlel.z = 16\n place_object\n end",
"def moveto(x, y)\n super\n center(x, y)\n make_encounter_count\n vehicle.refresh if vehicle\n @followers.synchronize(x, y, direction)\n end",
"def test_alignTopCenter\n [@window, @sprite, @bitmap].each{|container|\n uc = UCCharacterGraphic.new(container, Rect.new(0, 80, @window.contents.width, 120), $data_actors[1], 1)\n uc.draw()\n }\n return true\n end",
"def move_animation_camera_relative_static\n if @animation && @animation.position != 3\n last_screen_x = @ani_ox\n last_screen_y = @ani_oy\n update_anim_origin_reference\n dx = (@ani_ox - last_screen_x).round\n dy = (@ani_oy - last_screen_y).round\n @ani_sprites.each do |sprite|\n sprite.x += dx\n sprite.y += dy\n end\n end\n end",
"def centro\n @control_url = \"#{@control_url}camctrl.cgi\"\n send_command(\"PanTiltSingleMove\" => 4)\n end",
"def sprite w, h\n new_screen = SDL::Surface.new SDL::SWSURFACE, w, h, screen\n old_screen = screen\n\n self.screen = new_screen\n yield if block_given?\n\n new_screen.set_color_key SDL::SRCCOLORKEY, 0\n\n new_screen\n ensure\n self.screen = old_screen\n end",
"def initial_pos_sprites\n return SPRITE_X_RIGHT, SPRITE_Y\n end",
"def moveto(x, y)\n # center screen upon player\n center(x, y)\n # for each actor\n ($BlizzABS.battlers - [player]).each {|actor|\n # return to caterpillar if not in caterpillar\n actor.return_to_caterpillar if actor.cindex == nil}\n # empty movement command buffer\n update_buffer(nil)\n # move each actor to the same position\n ($BlizzABS.battlers - [player]).each {|actor| actor.moveto(x, y)}\n # create battle-encounter countdown\n player.make_encounter_count\n end",
"def move_home_x\n @target_x = 0\n start_command('F11', true, false)\n end",
"def move_to(x, y)\n object.x = x\n object.y = y\n end",
"def test_alignTopCenter\n [@window, @sprite, @bitmap].each{|container|\n uc = UCIcon.new(container, Rect.new(0, 48, @window.contents.width, 72), 1, 1)\n uc.draw()\n }\n return true\n end",
"def center(x, y, flag = false)\n # set pix value\n pix = flag ? $BlizzABS.pixel : 1\n # resize coordinates\n x, y = x * 128 / pix, y * 128 / pix\n # get maximum coordinates of map\n m_x, m_y = ($game_map.width - 20) * 128, ($game_map.height - 15) * 128\n ox, oy = x - CX, y - CY\n # set new display coordinates\n if ox > m_x\n $game_map.display_x = m_x\n elsif ox < 0\n $game_map.display_x = 0\n else\n $game_map.display_x = ox\n end\n if oy > m_y\n $game_map.display_y = m_y\n elsif oy < 0\n $game_map.display_y = 0\n else\n $game_map.display_y = oy\n end\n end",
"def center!\n @ob.center\n self\n end",
"def update_position\n case @picture.info[:map_mode]\n when 1\n self.x = -$game_map.display_x * 32 + @picture.xo\n self.y = -$game_map.display_y * 32 + @picture.yo\n when 2\n self.x = -$game_map.display_x * 32\n self.y = -$game_map.display_y * 32\n else\n self.x = self.y = 0\n end\n self.z = @picture.info[:z] ? @picture.info[:z] : 100\n end",
"def move_to(x, y); end",
"def move\n check_placed\n new_position = case facing\n when :north then @position.inc_y\n when :south then @position.dec_y\n when :east then @position.inc_x\n when :west then @position.dec_y\n end\n check_position(new_position)\n @position = new_position\n end",
"def move_home_y\n @target_y = 0\n start_command('F12', true, false)\n end",
"def center_x\n (Graphics.width / TILE_WIDTH_HALF - 1) / 2\n end",
"def sprite w, h\n new_screen = SDL::Surface.new SDL::SWSURFACE, w, h, screen\n old_screen = screen\n old_w, old_h = self.w, self.h\n self.w, self.h = w, h\n\n self.screen = new_screen\n yield if block_given?\n\n new_screen.set_color_key SDL::SRCCOLORKEY, 0\n\n new_screen\n ensure\n self.screen = old_screen\n self.w, self.h = old_w, old_h\n end",
"def move_to(pos)\n if (@current_pos != nil && @current_pos == pos)\n return\n end\n if pos == 5\n self.x = (Graphics.width - self.width) / 2\n self.y = (Graphics.height - self.height) / 2\n end\n if [1, 2, 3].include?(pos)#bottom\n self.y = Graphics.height - self.height\n if @win_help != nil\n self.y -= @win_help.height\n end\n end\n if [1, 4, 7].include?(pos)#left\n self.x = 0\n end\n if [7, 8, 9].include?(pos)#top\n self.y = 0\n end\n if [3, 6, 9].include?(pos)#right\n self.x = Graphics.width - self.width\n end\n @current_pos = pos\n end",
"def main_sprite ; end",
"def move_home_z\n @target_z = 0\n start_command('F13', true, false)\n end",
"def center_camera_tb(last_real_x, last_real_y)\n scene = SceneManager.scene\n return if !scene.is_a?(Scene_Map)\n \n scmap_evw = scene.instance_eval('@event_waiting_for')\n update_scroll(last_real_x, last_real_y) if scmap_evw && scmap_evw == @id\n end",
"def moveTo x, y\n\n\tend",
"def center_x\n (Graphics.width / 32 - 1) / 2.0\n end",
"def center_x\n (Graphics.width / 32 - 1) / 2.0\n end",
"def center_x\n (Graphics.width / 32 - 1) / 2.0\n end",
"def move_west\n @x -= 1\n end",
"def movePlayer(x, y)\n # makes sure you dont move it while the game\n # is in a pause state\n if (!paused && !resuming)\n # makes sure the player doesn't move past the game window\n # both horizontally and vertically\n x = 0 if x < 0\n x = SCREEN_W - playerWidth if x > SCREEN_W - playerWidth\n\n y = 0 if y < 0\n y = SCREEN_H - playerHeight if y > SCREEN_H - playerHeight\n\n # updates the x and y coordinates for the sprite\n @playerX = x\n @playerY = y\n # updates the player plane position in the internal game\n player.updatePlayer(playerX, playerY)\n end\n end",
"def move_to!(x, y, z)\n @origin_x = x\n @origin_y = y\n @origin_z = z\n end",
"def move\n @leading_x = coordinate_array[0]\n @leading_y = coordinate_array[1]\n end",
"def move\n \n end",
"def move\n \n end",
"def move_home_x\n $status.info_target_x = 0\n execute_command('F11', true, false)\n end",
"def move\n if me\n turn_left if window.button_down? Gosu::KbLeft\n turn_right if window.button_down? Gosu::KbRight\n run if window.button_down? Gosu::KbUp\n run_with_ball\n end\n end",
"def center()\n Vector.new(x + w / 2, y + h / 2, z)\n end"
] | [
"0.76465803",
"0.7566719",
"0.7472258",
"0.7459323",
"0.735465",
"0.7037949",
"0.68760663",
"0.68760663",
"0.68496203",
"0.68047416",
"0.663678",
"0.65815073",
"0.65475744",
"0.64811736",
"0.6470186",
"0.645956",
"0.63862336",
"0.631137",
"0.62863344",
"0.62577796",
"0.62159634",
"0.6128618",
"0.60919166",
"0.6056433",
"0.6040808",
"0.6030876",
"0.6014563",
"0.6007087",
"0.59902054",
"0.59670365",
"0.5930656",
"0.59097093",
"0.59046984",
"0.58822864",
"0.5858851",
"0.58505094",
"0.58505094",
"0.5849715",
"0.58470094",
"0.584662",
"0.58448863",
"0.58436847",
"0.58330244",
"0.58328676",
"0.58324593",
"0.57968247",
"0.57940584",
"0.57932526",
"0.5785652",
"0.5783027",
"0.57620656",
"0.5744972",
"0.5740568",
"0.5736964",
"0.5735782",
"0.57118106",
"0.56953204",
"0.56802326",
"0.5676358",
"0.56672263",
"0.56630015",
"0.56591064",
"0.5654173",
"0.5626435",
"0.5613432",
"0.5610047",
"0.5607479",
"0.5593757",
"0.5592608",
"0.5584073",
"0.5576959",
"0.55765986",
"0.55535215",
"0.5541466",
"0.55343246",
"0.552679",
"0.5513189",
"0.55075055",
"0.54937094",
"0.5493168",
"0.54808754",
"0.5477536",
"0.5461648",
"0.54561925",
"0.5432586",
"0.5419427",
"0.54181814",
"0.5406491",
"0.5406491",
"0.5406491",
"0.5396319",
"0.53911525",
"0.5388232",
"0.5384874",
"0.5380861",
"0.5380861",
"0.5375522",
"0.5368009",
"0.53678316"
] | 0.7697529 | 1 |
Play Title Screen Music | def play_title_music
$data_system.title_bgm.play
RPG::BGS.stop
RPG::ME.stop
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play\n\t\t\"playing #{title}\"\n\tend",
"def play_title_music\r\n\r\n$data_system.title_bgm.play\r\n\r\nRPG::BGS.stop\r\n\r\nRPG::ME.stop\r\n\r\nend",
"def our_songs\r\n\t@title = \"Our Songs\"\r\n end",
"def play_song(song_title)\n\t\tmsg = \"\"\n\t\[email protected] do |song|\n\t\t\tif (song_title == song.title)\n\t\t\t\tmsg = \"Playing #{song}\"\n\t\t\telsif (msg == \"\")\n\t\t\t\tmsg = \"No music for you!\"\n\t\t\tend\n\n\t\tend\n\t\treturn msg\n\tend",
"def speak(title)\n\n a = KjReading.verses title\n\n a.each do |x|\n\n filename = download_ogg(x.title)\n command = @audio_player + ' ' + filename\n system command\n\n end\n\n end",
"def show\n @music = Music.friendly.find(URI.unescape(params[:id]))\n # select random genre from all the music\n # create a client object with your app credentials\n client = Soundcloud.new(:client_id => 'd99d78670c7f1d537d0ae3d67a7be95c')\n @embed_info = client.get('/oembed', :url => @music.song_api,:auto_play => true)\n end",
"def main_audio\r\n super\r\n # Play title BGM\r\n $game_system.bgm_play($data_system.title_bgm)\r\n # Stop playing ME and BGS\r\n Audio.me_stop\r\n Audio.bgs_stop\r\n end",
"def play(song)\n # artist = Artist.find_by(id: song.artist_id)\n puts \"Playing #{song}\"\n end",
"def titleScreen()\n if $enableMusic\n titleMusic = fork{ exec 'afplay', \"./music/title.mp3\" }\n end\n puts `clear`\n puts drawTitle().colorize(:red)\n prompt = TTY::Prompt.new\n menuChoice = prompt.select(\"What would you like to do?\", [\"Play Hangman\", \"Credits\", \"Toggle Music\", \"Quit\"])\n if menuChoice == \"Play Hangman\"\n cancelMusic()\n puts `clear`\n doSpinner()\n puts `clear`\n playGame()\n elsif menuChoice == \"Credits\"\n puts `clear`\n credits()\n elsif menuChoice == \"Toggle Music\"\n if $enableMusic\n stopMusic = fork{exec 'killall', 'afplay'}\n $enableMusic = false\n elsif !$enableMusic\n $enableMusic = true\n end\n titleScreen()\n elsif menuChoice == \"Quit\"\n cancelMusic()\n puts `clear`\n exit!\n end\nend",
"def command_to_title\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Fade out BGM, BGS, and ME\r\n Audio.bgm_fade(800)\r\n Audio.bgs_fade(800)\r\n Audio.me_fade(800)\r\n # Switch to title screen\r\n $scene = Scene_Title.new\r\n end",
"def load_song\n location = File.expand_path(\"..\", Dir.pwd) + \"/res/five.mid\"\n\t#location = location.gsub('/', '\\\\')\n\t#puts location\n\t@btn_play.enable\n\t@btn_pause.enable\n\t@btn_stop.enable\n\t\n @mc.load(location)\n\t\n\t#play_song\n end",
"def play_song\n puts \"Choose a song to play\"\n song_number = gets.strip.to_i-1\n song = Song.all[song_number]\n puts \"Playing #{song.artist.name} - #{song.name} - #{song.genre.name}\"\n end",
"def play\n end",
"def play(song_name,options={})\n draw song_name, options.merge(model: \"metro::audio::song\")\n end",
"def play\n \n end",
"def play_music\n $game_system.bgm_memorize2\n Audio.bgm_stop\n Audio.bgm_play(Evolve::EVOLVE_MUSIC)\n end",
"def play\n end",
"def play\n end",
"def play\n end",
"def play\n end",
"def play_songs\n MusicImporter.new(path).play_song\n end",
"def play; end",
"def play_sound(index)\n Audio.me_play(ME_TO_PLAY) if index == 0\n end",
"def play \n end",
"def play\n puts 'Playing'\n end",
"def main\n puts \"Welcome to the music player\"\n\talbum = read_album()\n\tprint_album(album)\nend",
"def playSound _args\n \"playSound _args;\" \n end",
"def pause_music\n #pause itunes - yanked from https://github.com/sunny/anyplayer/blob/master/lib/anyplayer/players/itunes_mac.rb\n %x(osascript -e 'tell app \"iTunes\" to pause').rstrip\n #pause Spotify\n %x(osascript -e 'tell app \"Spotify\" to pause').rstrip\nend",
"def startPlayback\n end",
"def play\n\tend",
"def play_song(song_name)\n\n return @instrument.make_sound() + \" I'm playing #{song_name}\"\n\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def set_music\n @music = Music.find(params[:id])\n end",
"def plays(h)\n\th.each do |bros, inst|\n\t\tputs \"#{bros.capitalize} Marx plays the #{inst}\"\n\tend\nend",
"def sound; end",
"def play\n \"We're rockiinnggg\"\n end",
"def show\n youtube\n soundcloud\n end",
"def plays(h)\n\th.each do |bros, inst|\n\t\tputs \"#{bros.to_s.capitalize} Marx plays the #{inst}\"\n\tend\nend",
"def play(playlist)\n playlist.run\n @music_pid = fork do\n exec \"mplayer\", \"-cache\", \"1024\", \"-really-quiet\", \"-noconsolecontrols\", \n \"-ao\", \"alsa:device=hw=#{@number}.0\", playlist.url \n end\n end",
"def song; end",
"def song; end",
"def song; end",
"def song; end",
"def song; end",
"def song; end",
"def song; end",
"def song; end",
"def background_music(song1, song2)\n puts \"The song, #{song1}, makes me want to work continuously.\"\n puts \"The song, #{song2}, makes me sleepy.\"\n puts \"I wsih every song made me feel like I could conqueor the world!\"\nend",
"def test_play_song()\n result = @musician1.play_song(\"All Along the Watchtower\")\n assert_equal(\"Twing Twang... I'm playing All Along the Watchtower\", result)\n end",
"def run\n @music.play(:repeats => -1)\n\thook_run()\n\thook_quit()\n\t# Handling input\n\tloop do\n\t @queue.each do |event|\n\t\thandle(event)\n end\n\t# Draw the image to screen\n\t@intro_screen.blit(@screen,[0,0])\n\[email protected]()\n end\n end",
"def show\n redirect_to music_path\n end",
"def play_first_track()\n @ole.PlayFirstTrack()\n end",
"def play_first_track()\n @ole.PlayFirstTrack()\n end",
"def get_play() \n # \n end",
"def set_music\n @music = Music.random_select\n end",
"def play_album albums\n\tid = read_integer('Album ID: ')\n\tvalid, index = validate_id(id ,albums)\n\tif valid\n\t\talbum = albums[index]\n\t\tprint_track_list(album)\n\t\tplay_track(album)\n\telse\n\t\tsystem \"clear\" or system \"cls\"\n\tend\nend",
"def play()\n @ole.Play()\n end",
"def play()\n @ole.Play()\n end",
"def display_songs\n puts \"Your Discography\"\n songs.each do |song|\n puts \"* Artist: #{song.artist} - Song Name: #{song.title}\"\n end\n end",
"def display_song\n return \"Title: #{song_title}, Duration: #{duration}, Genre: #{genre}\"\n end",
"def display_song\n return \"Title: #{song_title}, Duration: #{duration}, Genre: #{genre}\"\n end",
"def play\n self\n end",
"def on\n loop do\n while @count < @playlist.size\n self.play_music\n self.wait\n end\n if (@repeat) # If @repeat is true, resets playlist and loops through again\n @count = 0\n else\n break\n end\n end\n @count = 0\n end",
"def command_to_title\n Sound.play_decision\n RPG::BGM.fade(800)\n RPG::BGS.fade(800)\n RPG::ME.fade(800)\n $scene = Scene_Title.new\n close_command_window\n Graphics.fadeout(60)\n end",
"def play_music\n pid = fork{ exec 'afplay', \"app/models/coffee_music.mp3\" }\nend",
"def quick_title(song)\n File.basename(song, File.extname(song)).gsub(/^[^A-Za-z]+\\s+(\\w)/, \"\\\\1\")\n end",
"def lyrics\n if @file && @mp3\n self.play\n \n @file.each {|line| charPrint(line)}\n end\n end",
"def set_top_music\n @top_music = TopMusic.find(params[:id])\n end",
"def view_album_songs(album)\n album_title = album\n album_id = Album.find_by(title: album_title).id\n songs = Song.where(album_id: album_id).map{|song| song.name}\n puts \"**************************\"\n puts \"**************************\"\n prompt(\"#{album_title}'s songs\", songs)\n end",
"def nameSound _args\n \"nameSound _args;\" \n end",
"def display_track(title)\n \t@track_font.draw(title, Xposition, Yposition, ZOrder::UI, 1.0, 1.0, Gosu::Color::BLACK)\n end",
"def play_sound \n system\"play #{@sound_file}\"\n end",
"def show\n # FIXME: render 404 page\n unless @music\n render status: 404\n end\n end",
"def play_track(path)\r\n @song = Gosu::Song.new(path)\r\n @song.play(false)\r\n end",
"def on_play(track)\n end",
"def play_song(sender)\n clicked_pos = self.songs_view.clickedRow\n if clicked_pos == -1 # first song or same song\n if @current_song.try(:song).try(:playing?) # same song\n clicked_pos = @current_song.position\n else\n clicked_pos = 0\n end\n end\n @current_song.song.stop if @current_song\n\n filename = @display_filenames[clicked_pos]\n @current_song = Song.new(filename, clicked_pos, self)\n @current_song.song.play\n end",
"def buz; Sound.play_buzzer; end",
"def play\n @sound += 1\n @sound %= @overlap\n `#{@sounds[@sound]}.play()`\n end",
"def play_sound\n system 'afplay ./app/sounds/test_sound.mp3 &'\n end",
"def set_title \n write_attribute(:title, File.basename(file_name, '.mp4')) if title.blank?\n end",
"def audio\n \t@playlist = Playlist.last\n send_glued_audio('list', :playlist => @playlist)\n end",
"def sing_me_a_song()\n @lyrics.each { |line| puts line }\n end",
"def check_title\n if title.to_s == '' && audio_file.present?\n str = File.basename(audio_file_url).gsub(/[_]/, ' ') \n self.title = str.gsub(/[.mp3]/, '')\n self.save\n end\n end",
"def play_track(track, album)\n @song = Gosu::Song.new(album.tracks[track].location.chomp)\n @song.play(false) \n end",
"def play_sound(soundName)\r\n\t\texec(\"playback\", soundName)\r\n\tend",
"def song\n fetch('cowboy_bebop.song')\n end",
"def play_all\n\t\[email protected] do | song |\n\t\t\tputs \"#{@name} are playing: #{song}\"\n\t\t\tputs \" \"\n\t\t\tmembers_play\n\t\t\tputs \" \"\n\t\t\tsleep(1)\n\t\tend\n\tend",
"def setup_sound\n return unless PONY::ERRNO::check_sequence(current_act)\n name = @acts[1]\n vol = @acts[2] || 100\n pitch = @acts[3] || 100\n RPG::SE.new(name,vol,pitch).play\n end",
"def play\r\n\t\t[FOLD]\r\n\tend",
"def process_ok\n Sound.play_ok\n super\n end",
"def fadeMusic _obj, _args\n \"_obj fadeMusic _args;\" \n end",
"def main\r\n puts \"Welcome to the music player\"\r\n\talbums = read_albums()\r\n\tprint_albums(albums)\r\nend",
"def main_audio\r\n super\r\n # Stop BGM and BGS\r\n $game_system.bgm_play(nil)\r\n $game_system.bgs_play(nil)\r\n # Play game over ME\r\n $game_system.me_play($data_system.gameover_me)\r\n end",
"def play_sound\n case @type\n when 1; Sound.play_forge_item\n when 2; Sound.play_forge_weapon\n when 3; Sound.play_forge_armor\n else; Sound.play_use_item\n end\n end",
"def play\n render layout: 'player'\n end",
"def draw_song_panel\n margin = 10\n titles = [\"NAME\", \"ARTIST\", \"GENRE\", \"RELEASE\"] # Array contains space out titles\n add_element(ELEMENT,0,0,WIDTH,HEIGHT,SECONDARY,BACK,\"rect_song_background\")\n add_element(FONT,200 + margin,margin,PLAYBAR,1,HIGHLIGHT,\"txt_songs\",\"SONGS\")\n\n shift = 0\n for title in titles\n add_element(FONT,200 + margin + shift,@info_font.height + margin,PLAYBAR,0.7,TEXT,\"txt_title\",title)\n shift += 200 #Controls Spacing between each title\n end\n draw_songs()\nend"
] | [
"0.7865728",
"0.7579568",
"0.7333883",
"0.7111176",
"0.70193666",
"0.675885",
"0.6692385",
"0.6677047",
"0.66751117",
"0.6640734",
"0.6599654",
"0.6581105",
"0.65691805",
"0.6532044",
"0.6520902",
"0.64782697",
"0.64590585",
"0.64590585",
"0.64590585",
"0.64590585",
"0.64565355",
"0.64081997",
"0.64005566",
"0.63967925",
"0.63804173",
"0.6326176",
"0.631234",
"0.6305",
"0.6276136",
"0.62749755",
"0.62330055",
"0.6227012",
"0.6227012",
"0.6227012",
"0.6227012",
"0.6227012",
"0.6218625",
"0.62141144",
"0.621356",
"0.6207845",
"0.61786133",
"0.6176398",
"0.61761177",
"0.61761177",
"0.61761177",
"0.61761177",
"0.61761177",
"0.61761177",
"0.61761177",
"0.61761177",
"0.6172936",
"0.61661273",
"0.61652553",
"0.61587536",
"0.61584246",
"0.61584246",
"0.6142562",
"0.61266464",
"0.61260486",
"0.61108595",
"0.61108595",
"0.60881513",
"0.60775656",
"0.60775656",
"0.60747993",
"0.6073309",
"0.60664433",
"0.60657054",
"0.6058509",
"0.60542816",
"0.60268867",
"0.6020713",
"0.60147566",
"0.6012035",
"0.59958583",
"0.59942245",
"0.59924966",
"0.5982584",
"0.59801465",
"0.5979431",
"0.5958653",
"0.5958551",
"0.5953408",
"0.5951805",
"0.5948697",
"0.5946749",
"0.5925835",
"0.59225965",
"0.59088916",
"0.5907361",
"0.58957994",
"0.5884593",
"0.58577484",
"0.5854656",
"0.5851632",
"0.58467925",
"0.58307177",
"0.5812783",
"0.5808751"
] | 0.83133274 | 1 |
this method came with us from LockedLdpObject, and it'll keep this name until it gets refactored rubocop:disable Naming/AccessorMethodName | def set_thumbnail(attachment)
self.logo_id = attachment.id
save!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_locked?; end",
"def private; end",
"def if_access_locked; end",
"def locked; end",
"def lock_expired?; end",
"def lock_timeout; end",
"def read_blocked\n end",
"def lock_timeout_retry_delay; end",
"def lock; end",
"def lock; end",
"def lock; end",
"def udp_timeout\n super\n end",
"def peer; end",
"def private_method\n end",
"def poll_next_packet; end",
"def lock_timeout_retries; end",
"def lock_timeout_retry_delay=(_arg0); end",
"def locked\n end",
"def connection_status_crypt_wait_response; end",
"def peerip=(_arg0); end",
"def resident_key?; end",
"def ndp_reserved; self[:ndp_reserved].to_i; end",
"def peer_ip; end",
"def private_net_checker; end",
"def pending_write?; end",
"def connection_status_crypt_response; end",
"def last_good\n @listener_proxies[last_good_pid]\n end",
"def password_require_to_unlock_from_idle\n return @password_require_to_unlock_from_idle\n end",
"def warn_packet_overtime packet_id; end",
"def _nydp_get a ; self ; end",
"def unlock_and_fetch_ldp_object\n self.ldp_object = self.class.send(:derived_af_class).find(self.id) unless @ldp_object.present?\n yield @ldp_object\n self\n end",
"def lock_timeout_limit=(_arg0); end",
"def pausable; end",
"def unlock_access!; end",
"def connection_status_crypt_request; end",
"def lock_list\n super\n end",
"def send_unlock_instructions; end",
"def lock_timeout_retries=(_arg0); end",
"def msrdp_without_session_directory_state\n super\n end",
"def retry_change_requests; end",
"def retry_change_requests; end",
"def lock!; end",
"def remaining; end",
"def pending?; end",
"def is_locked\n return @is_locked\n end",
"def enter_pending; end",
"def reserved_net_checker; end",
"def lock_timeout=(_arg0); end",
"def android_device_blocked_on_missing_partner_data\n return @android_device_blocked_on_missing_partner_data\n end",
"def send_pending; end",
"def locked_out\n return @locked_out\n end",
"def locked?\n end",
"def jid; end",
"def stale_state\n end",
"def lockdiscovery\n []\n end",
"def try_lock\n end",
"def process_err(err)\n # In case of permissions violation then dispatch the error callback\n # while holding the lock.\n e = synchronize do\n current = server_pool.first\n case\n when err =~ /'Stale Connection'/\n @last_err = NATS::IO::StaleConnectionError.new(err)\n when current && current[:auth_required]\n # We cannot recover from auth errors so mark it to avoid\n # retrying to unecessarily next time.\n current[:error_received] = true\n @last_err = NATS::IO::AuthError.new(err)\n else\n @last_err = NATS::IO::ServerError.new(err)\n end\n end\n process_op_error(e)\n end",
"def inactive_message\n access_locked? ? :locked : super\n end",
"def peeraddr(*) end",
"def peeraddr(*) end",
"def backing_off_for\n @pid ? nil : @backoff.how_long?\n end",
"def disabled_rx?; @disabled_rx > 0 end",
"def across_pool_state\n super\n end",
"def lock\n\t\t\tself.instance_eval do \n\t\t\t\tundef :same_piece_count=\n\t\t\t\tundef :difference_ids=\n\t\t\tend\n\t\tend",
"def non_blocking=(p1)\n #This is a stub, used for indexing\n end",
"def udp_statistics\n super\n end",
"def disable_rx; @disabled_rx += 1 end",
"def get_private()\n res = super(self)\n return res\n end",
"def old_sync; end",
"def resident_credential?; end",
"def is_locked?\n locked\n end",
"def connection_status_mcnet_login; end",
"def windows_device_blocked_on_missing_partner_data\n return @windows_device_blocked_on_missing_partner_data\n end",
"def prepareForReuse; end",
"def communicates?; !disconnected? end",
"def available; end",
"def available; end",
"def available_for_read?; end",
"def ignore_disconnect; end",
"def recover_from_timeout(pid, name)\n with_dedicated_connection do |con|\n lock = select_one(<<~SQL, pid, name, connection: con)\n SELECT locktype, objid, pid, granted FROM pg_locks \\\n WHERE pid = ? AND locktype = 'advisory' AND objid = hashtext(?)\n SQL\n return false unless lock\n\n if lock['granted']\n logger&.info 'DBLock: Lock was acquired after all'\n true\n else\n res = select_value 'SELECT pg_cancel_backend(?)', pid, connection: con\n logger&.warn 'DBLock: Failed to cancel ungranted lock query' unless res == true\n false\n end\n end\n end",
"def blocklisted_responder=(_arg0); end",
"def rtsp_over_http_persistence_state\n super\n end",
"def throttled_responder; end",
"def locked?\n self.is_locked\n end",
"def update_polling_pool(key, thread); end",
"def lock\n end",
"def sync=(p0) end",
"def sync=(p0) end",
"def sync=(p0) end",
"def lock\n @can_get_cards = false\n end",
"def reset_udp_statistics\n super\n end",
"def reason; end",
"def reason; end",
"def connection_status_mcnet_request; end",
"def connect_base\n if @contact.prohibited?\n # after the first denied message, we just slam the channel shut: no more nice guy\n LOG.warn(@mail[:mail_id]) {\"Slammed connection shut. No more nice guy with #{@mail[:remote_ip]}\"}\n raise Quit\n end\n\n if @contact.warning?\n # this is the first denied message\n @warning_given = true\n expires_at = @contact.violation.strftime('%Y-%m-%d %H:%M:%S %Z') # to kick it up to prohibited\n LOG.warn(@mail[:mail_id]) {\"Access TEMPORARILY denied to #{@mail[:remote_ip]} (#{@mail[:remote_hostname]}) until #{expires_at}\"}\n return \"454 4.7.1 Access TEMPORARILY denied to #{@mail[:remote_ip]}: you may try again after #{expires_at}\"\n end\n\n if respond_to?(:connect)\n msg = connect(value)\n return msg if !msg.nil?\n end\n\n # 8 bells and all is well\n @level = 1\n return \"220 2.0.0 #{@mail[:local_hostname]} ESMTP RubyMTA 0.01 #{Time.new.strftime(\"%^a, %d %^b %Y %H:%M:%S %z\")}\"\n end",
"def blocklisted_response; end",
"def locked?\n raise NotImplementedError\n end",
"def bit_locker_disable_warning_for_other_disk_encryption\n return @bit_locker_disable_warning_for_other_disk_encryption\n end",
"def wait_writable_or_timeout; end",
"def firewall_packet_queueing_method\n return @firewall_packet_queueing_method\n end",
"def can_be_replied_to?\n !locked?\n end"
] | [
"0.5918262",
"0.56497496",
"0.5636865",
"0.5472901",
"0.5436317",
"0.52554923",
"0.5246845",
"0.51128983",
"0.50601196",
"0.50601196",
"0.50601196",
"0.5056158",
"0.50503653",
"0.5046929",
"0.50455475",
"0.50179315",
"0.49837768",
"0.49739203",
"0.49383724",
"0.49364188",
"0.4935177",
"0.4921919",
"0.49201265",
"0.49154797",
"0.4910566",
"0.49043748",
"0.48984745",
"0.48982364",
"0.48956537",
"0.48940742",
"0.487437",
"0.48540258",
"0.48371086",
"0.4835352",
"0.47996327",
"0.479301",
"0.47891194",
"0.47570685",
"0.47417298",
"0.473375",
"0.473375",
"0.47281477",
"0.47083914",
"0.46940398",
"0.46842316",
"0.46826294",
"0.4680349",
"0.46762863",
"0.46588296",
"0.46551174",
"0.4646252",
"0.4645972",
"0.46455052",
"0.46432033",
"0.46416646",
"0.4633761",
"0.4624518",
"0.462176",
"0.4620738",
"0.4620738",
"0.46072266",
"0.46045902",
"0.45922107",
"0.4575793",
"0.45750284",
"0.4565325",
"0.45620343",
"0.45619813",
"0.45596358",
"0.45589045",
"0.45551607",
"0.45547277",
"0.4552576",
"0.4551246",
"0.4551131",
"0.4549926",
"0.4549926",
"0.45441726",
"0.45400882",
"0.45397162",
"0.45393288",
"0.453677",
"0.45307142",
"0.4530577",
"0.45284075",
"0.45272902",
"0.45269826",
"0.45269826",
"0.45269826",
"0.45229962",
"0.4518216",
"0.45122522",
"0.45122522",
"0.45066425",
"0.45024052",
"0.4501333",
"0.4500819",
"0.4493232",
"0.4490211",
"0.44891092",
"0.44845015"
] | 0.0 | -1 |
utility methods for checking for certain visibility transitions | def transitioned_to_private?
return true if changes['visibility'].present? &&
(changes['visibility'][0] != JupiterCore::VISIBILITY_PRIVATE) &&
(changes['visibility'][1] == JupiterCore::VISIBILITY_PRIVATE)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_visible?\n visibility && ( visibility > 0 )\n end",
"def visibility_changed?\n !(@old_visible_value == visible)\n end",
"def visible?\n end",
"def visible?\n @style.display != 'none'\n end",
"def visible?\n el.displayed?\n end",
"def can_walk_to?(transition); end",
"def visibility?\n @visibility || true\n end",
"def on_visibility_change(&block)\n event = if `typeof #{@native}.hidden !== \"undefined\"`\n 'visibilitychange'\n elsif `typeof #{@native}.mozHidden !== \"undefined\"`\n 'mozvisibilitychange'\n elsif `typeof #{@native}.msHidden !== \"undefined\"`\n 'msvisibilitychange'\n elsif `typeof #{@native}.webkitHidden !== \"undefined\"`\n 'webkitvisibilitychange'\n end\n # trace __FILE__, __LINE__, self, __method__, \" : event=#{event}\"\n if event\n `window.addEventListener(event, block, false)`\n end\n end",
"def visa_check?\n schengen_overstay? == false && visa_overstay? == false\n end",
"def visible?\n true\n end",
"def visible?\n Waiter.wait_for do\n inst = presence\n !! inst && inst.visible?\n end\n end",
"def isVisible\n DOM.isVisible(@element)\n end",
"def visibility; end",
"def visibility; end",
"def visibility; end",
"def visibility; end",
"def visibility; end",
"def visible?\n assert_exists\n @element.displayed?\n end",
"def visible?\n assert_exists\n @element.displayed?\n end",
"def element_is_visible(name, tag, container, yes = true)\n elem = wait_visibility(name, tag, container, yes)\n elem ? true : false\n end",
"def check_visible(obj)\n return obj.gr_is_visible?\n end",
"def visible?\n @visible\n end",
"def visible?\n @visible\n end",
"def switch_visibility(params = {})\n @visible = params[:visible] || !@visible\n reset_visiblility_counters\n end",
"def recently_walked?(transition); end",
"def visible?\n if ta_visible || peer_visible\n true\n else\n errors.add(:base, I18n.t('activerecord.errors.models.criterion.visibility_error'))\n false\n end\n end",
"def parse_visibility(container, single, tk)\n vis_type, vis, singleton = get_visibility_information tk, single\n\n skip_tkspace_comment false\n\n ptk = peek_tk\n # Ryan Davis suggested the extension to ignore modifiers, because he\n # often writes\n #\n # protected unless $TESTING\n #\n if [:on_nl, :on_semicolon].include?(ptk[:kind]) || (:on_kw == ptk[:kind] && (['if', 'unless'].include?(ptk[:text]))) then\n container.ongoing_visibility = vis\n elsif :on_kw == ptk[:kind] && 'def' == ptk[:text]\n container.current_line_visibility = vis\n else\n update_visibility container, vis_type, vis, singleton\n end\n end",
"def isInTransition()\n\t\t\treturn @_state == nil\n\t\tend",
"def is_visible?\n setup.show_all? || Date.today >= start_at\n end",
"def element_visible\n assert_exists(element.visible?(\"failed\"))\n end",
"def visibility\n @cache[:visibility] ||= begin\n require_valid\n\n if @inspector.match /private/\n :private\n elsif @inspector.match /protected/\n :protected\n else\n :public\n end\n end\n end",
"def can_change_visibility?(new_visibility,user=nil)\n case new_visibility\n when Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC\n return open_access? || (user && user.admin?)\n when 'open-pending'\n return !open_access? || (user && user.admin?)\n when Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED\n return !open_access? || (user && user.admin?)\n when Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE\n return !open_access? || (user && user.admin?)\n else\n return false\n end\n end",
"def third_screen_visible?\n @third_screen_title.visible?\n end",
"def check_visibility\n if @check_visibility_of.respond_to?(:restricted) && @check_visibility_of.restricted && User.current_user == :false\n redirect_to new_session_path(:restricted => true)\n else\n is_hidden = @check_visibility_of.respond_to?(:visible) ? !@check_visibility_of.visible : @check_visibility_of.hidden_by_admin?\n can_view_hidden = logged_in_as_admin? || current_user_owns?(@check_visibility_of)\n access_denied if (is_hidden && !can_view_hidden)\n end\n end",
"def test_visibility(beverage, viewer)\n return false if (beverage.visibility < Enums::Visibility::PUBLIC) && viewer.nil?\n return true if !viewer.nil? && viewer.is?(:admin)\n return true if(viewer == beverage.owner ||\n beverage.visibility == Enums::Visibility::PUBLIC)\n return true if(beverage.visibility == Enums::Visibility::FRIENDS &&\n viewer.friends.include?(beverage.owner))\n false\n end",
"def st_vis\n Visibility.new(header.st_other & 0x7)\n end",
"def computed_visibility\n return \"embargoed\" if @embargoed\n return \"suppressed_workflow\" unless @public_readable_state\n @visibility\n end",
"def visible?\n @a.nonzero?\n end",
"def visible?\n wd_element.displayed?\n end",
"def visibilities; end",
"def assert_visible\n raise('Cannot use ControlChainMethods#assert_visible on control with no #visible? method') unless respond_to?(:visible?)\n\n expect(visible?).to be_truthy\n\n self\n end",
"def hidden?()\n not visible?()\n end",
"def visible?\n\t\t\t@visible\n\t\tend",
"def visibility\n return nil if @visibility.nil?\n @visibility ? '1' : '0'\n end",
"def check_popup_state(id, visible, timeout=nil)\r\n if visible\r\n find_by_id_and_class(id, \"ss-DialogBox\", timeout);\r\n else\r\n find_by_id_and_class_fail(id, \"ss-DialogBox\", timeout);\r\n end\r\n end",
"def valid_visibility?(value)\n # If template doesn't specify a visiblity (i.e. is \"varies\"), then any visibility is valid\n return true if visibility.blank?\n\n # Validate that passed in value matches visibility requirement exactly\n visibility == value\n end",
"def visa_overstay?\n visa_date_overstay? || visa_entry_overstay?\n end",
"def hidden?\n hidden_at?\n end",
"def hidden?\n hidden_at?\n end",
"def hidden?\n hidden_at?\n end",
"def check_visibility\n set_problem\n viewable = begin\n unless @problem.hide\n true\n else\n if logged_in? && current_user.is_admin?\n true\n else\n false\n end\n end\n end\n\n unless viewable\n render status: :forbidden, nothing: true\n return\n end\n end",
"def check_if_all_pop_ups_are_displayed\n\n your_league_pop_up_should_not_be_displayed\n make_your_predictions_pop_up_should_not_be_displayed\n join_private_league_pop_up_should_not_be_displayed\n join_public_league_pop_up_should_not_be_displayed\n create_your_own_league_pop_up_should_not_be_displayed\n\n end",
"def validate_visibility(env, attributes, template)\n # Added this to allow saving of overridden visibility settings in admin set\n return true if env.current_ability.admin? || env.current_ability.can?(:edit, env.curation_concern.id)\n original_validate_visibility(env, attributes, template)\n end",
"def with_visibility(visibility)\n visibilities = @@visibilities\n\n visibility_condition = lambda do |obj, opts|\n if visibilities.is_a? Array\n max = visibilities.index(opts[:visibility])\n if max.nil?\n return false\n else\n return visibilities[0..max].include? visibility\n end\n else\n return opts[:visibility] == visibility\n end\n end\n\n with_options if: visibility_condition do\n yield\n end\n end",
"def element_visible?(how, what)\n @driver.find_element(how, what).displayed?\n rescue Selenium::WebDriver::Error::ElementNotVisibleError\n false\n rescue Selenium::WebDriver::Error::NoSuchElementError\n false\n rescue Selenium::WebDriver::Error::StaleElementReferenceError\n false\n end",
"def hidden?\n not visible\n end",
"def check_collapse\n if !self.effect? and @character.death_state? and (@character.damage == nil)# or !@character_anim)\n if @character.death_animation?\n check_animations\n end \n pose_hash = POSE_HASH\n \n #Ensure that current pose is not pain or death\n if @character_anim && !(pose_hash[\"Pain\"]+pose_hash[\"Dead\"]).include?(@character.pose?+1)\n if [email protected]_collapse?\n @character.set_pose(\"collapse\")\n else\n #start_effect(:collapse) collapse is performed by the log display class now\n end\n end\n end\n end",
"def visiblity_changed\n if visibility_to_private?\n mark_as_set_to_private\n elsif visibility_to_public?\n mark_as_set_to_public\n end\n end",
"def visiblity_changed\n if visibility_to_private?\n mark_as_set_to_private\n elsif visibility_to_public?\n mark_as_set_to_public\n end\n end",
"def visible\n return @stack[1].visible\n end",
"def hidden?\n return true if @state == STATE_HIDDEN\n ext = extent\n case(@anchor)\n when ANCHOR_TOP\n return @slide_offset <= -ext\n when ANCHOR_LEFT\n return @slide_offset <= -ext\n when ANCHOR_BOTTOM\n return @slide_offset >= 0\n when ANCHOR_RIGHT\n return @slide_offset >= 0\n end\n end",
"def visible?\n !(self.created? || self.suspended? || self.deleted?)\n end",
"def visible?\n !(self.created? || self.suspended? || self.deleted?)\n end",
"def visible?\n !(self.created? || self.suspended? || self.deleted?)\n end",
"def is_transitioning?\n @is_transitioning\n end",
"def from_place_to_transition?\n net.places.any? {|p| p.id == source_id} and net.transitions.any? {|t| t.id == target_id}\n end",
"def check_visibility\n if not @organisation.active?\n hidden = false\n if not current_user == @organisation\n hidden = true\n end\n\n current_user.is_a?(User) and current_user.has_role?(:admin) ? hidden = false : nil\n if hidden\n raise Helpedia::ItemNotVisible\n end\n end\n end",
"def init_visibility\n return if actor? && [email protected]_battler.dead_key.empty?\n @battler_visible = [email protected]? && (@battler.enemy? ? \n [email protected] : true)\n self.opacity = 0 unless @battler_visible\n end",
"def visible?\n visible = browser.has_css?(component_locator, :visible)\n unless visible\n detect_server_error!\n end\n visible\n end",
"def visible?() \n if @visible.nil?\n visible = parent.nil? ? true : parent.visible?\n else\n visible = @visible\n end\n visible = instance_eval &visible if visible.kind_of?(Proc)\n visible\n end",
"def refresh_view?\n visible? && (ox >= bordered_width || oy >= bordered_height)\n end",
"def transition?\n current.transition?\n end",
"def check_closing_visibility(meeting)\n return unless meeting.minutes_visible.nil?\n return if minutes_data?(meeting) || meeting.closed_at.blank?\n\n meeting.minutes_visible = true\nend",
"def hidden?\n classes.include?('hidden')\n end",
"def computed_visibility\n return \"suppressed_workflow\" unless @public_readable_state\n @visibility\n end",
"def is_able_to_transition(jira_issue, update_to, available_transitions)\n able_to_transition = false\n issue_data = JSON.parse( RestClient.get( JIRA_URL + jira_issue, JIRA_HEADERS ) )\n\n i = 0\n while (i < available_transitions[\"transitions\"].length ) do\n available_transition = available_transitions[\"transitions\"][i]\n if available_transition[\"id\"] == update_to && issue_data[\"fields\"][\"status\"][\"name\"] != available_transition[\"name\"]\n able_to_transition = true\n i += available_transitions[\"transitions\"].length\n end\n i += 1\n end\n\n return able_to_transition\nend",
"def visibility(name)\n Tk.execute_only(:tkwait, :visibility, name)\n end",
"def displayed?(locator)\n find_element(locator).displayed?\n end",
"def invisible?\n false\n end",
"def visible?(sx,sy)\n (sx + @width > 0 && sx < Common::SCREEN_X && sy + @height > 0 &&\n sy < Common::SCREEN_Y)\n end",
"def transitions_loaded?(state_class)\n state_loaded?(state_class) && @transitions.key?(state_class)\n end",
"def visible?\n visible = browser.has_css?(component_locator, visible: true)\n unless visible\n detect_server_error!\n end\n visible\n end",
"def visible\n\t@visible = @selenium.is_visible(@locator)\n\treturn @visible\n end",
"def visible?; \n\t\t@visible = true if @visible == nil\n\t\t@visible\n\tend",
"def visible?(sx,sy)\n (sx + @width / 2 > 0 && sx - @width / 2 < Common::SCREEN_X && sy + @height / 2 > 0 &&\n sy - @height / 2 < Common::SCREEN_Y)\n end",
"def second_screen_visible?\n @second_screen_title.visible?\n end",
"def element_should_be_visible(loc)\n raise(Exception::ElementVisibilityError, \"The element described by #{parse_location(loc)} is not visible.\") unless\n @browser.element(parse_location(loc)).visible?\n end",
"def hideable?\n @hideable ||= [\"Task deferred\", \"Project deferred\", \"Waiting on\", \"Hanging\"].include?(status)\n end",
"def visibility\n @visibility ||= begin\n visibility = resource_decorator.model.visibility.first\n visibility if valid_visibilities.include? visibility\n end\n end",
"def universal_visibility?\n self.visibility == :universal\n end",
"def should_appear_on_map?\n data['visibility'] == 'PUBLIC' && timeslots.any?\n end",
"def visibility\n 'open'\n end",
"def visible? component\n r, c = component.rowcol\n return false if c+@cols_panned < @orig_left\n return false if c+@cols_panned > @orig_left + @display_w\n # XXX TODO for rows UNTESTED for rows\n return false if r + @rows_panned < @orig_top\n return false if r + @rows_panned > @orig_top + @display_h - 2\n\n return true\n end",
"def wait_for_visible(locator)\n wait_for { find_element(locator).displayed? }\n end",
"def transitions; end",
"def victory?\n self.grid.flatten.select {|space| !space.mine }.\n all? {|space| space.visible }\n end",
"def visible? component\n r, c = component.rowcol\n return false if c+@cols_panned < @orig_left\n return false if c+@cols_panned > @orig_left + @display_w\n # XXX TODO for rows UNTESTED for rows\n return false if r + @rows_panned < @orig_top\n return false if r + @rows_panned > @orig_top + @display_h\n\n return true\n end",
"def visible?\n @dialog ? true : false\n end",
"def validate_visibility(env, attributes, template)\n # NOTE: For embargo/lease, attributes[:visibility] will be nil (see sanitize_params), so visibility will be validated as part of embargo/lease\n return true if attributes[:visibility].blank?\n\n # Validate against template's visibility requirements\n return true if validate_template_visibility(attributes[:visibility], template)\n\n env.curation_concern.errors.add(:visibility, 'Visibility specified does not match permission template visibility requirement for selected AdminSet.')\n false\n end",
"def is_visible?(path)\n File.basename(path)[0] != '.'\n end"
] | [
"0.70364994",
"0.65650594",
"0.6287702",
"0.6253134",
"0.6212421",
"0.61628485",
"0.6145518",
"0.6119876",
"0.610125",
"0.60669124",
"0.60590637",
"0.59794986",
"0.5853262",
"0.5853262",
"0.5853262",
"0.5853262",
"0.5853262",
"0.5831426",
"0.5831426",
"0.58149695",
"0.5812127",
"0.5808142",
"0.5808142",
"0.5789185",
"0.5754629",
"0.57376546",
"0.57372046",
"0.5736902",
"0.5735109",
"0.56816334",
"0.5680127",
"0.5675848",
"0.5670334",
"0.5653577",
"0.565234",
"0.5635273",
"0.5634829",
"0.5633271",
"0.5632811",
"0.5624188",
"0.56212074",
"0.56115115",
"0.5611045",
"0.5607124",
"0.55991054",
"0.55934983",
"0.55667675",
"0.5564917",
"0.5564917",
"0.5564917",
"0.5547753",
"0.5534438",
"0.5520995",
"0.55157685",
"0.55149716",
"0.5514644",
"0.5508629",
"0.55084735",
"0.55084735",
"0.54867",
"0.5484058",
"0.54784715",
"0.54784715",
"0.54784715",
"0.5475974",
"0.54607224",
"0.5446123",
"0.5423001",
"0.5421958",
"0.5420266",
"0.5415216",
"0.54122585",
"0.5397799",
"0.53950846",
"0.5391883",
"0.5388208",
"0.5382051",
"0.53593105",
"0.53559893",
"0.5352768",
"0.53472763",
"0.53470266",
"0.5342647",
"0.5335378",
"0.53261775",
"0.53188",
"0.5308431",
"0.53029084",
"0.5302358",
"0.53002024",
"0.529939",
"0.5291768",
"0.5284431",
"0.5283944",
"0.52805465",
"0.52781206",
"0.5272919",
"0.52659255",
"0.5264401",
"0.52612"
] | 0.59373504 | 12 |
Create a function that takes an array as an argument and returns true or false depending on whether the average of all elements in the array is a whole number or not. | def is_avg_whole?(arr)
arr.reduce(&:+) % arr.length == 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_avg_whole?(arr)\n\tsum = arr.sum\n\tavg_i = sum / arr.count \n\tavg_f = sum / arr.count.to_f\n\tavg_i == avg_f\nend",
"def is_avg_whole?(arr)\n sum_of_arr = arr.inject(0) {|sum,x| sum + x }\n\treturn (sum_of_arr / arr.length.to_f)%1==0 ? true : false\nend",
"def average_array(array)\n array.each do |ele|\n raise \"All member must be numbers\" if !(ele.instance_of?(Integer))\n end\n\n array.sum / array.length.to_f\nend",
"def multiple?(num, input_array)\n\tbad = false\n\t# check to be sure that num * [an array element] != [an array element]\n\tinput_array.each do |i|\n\t\tres = i * num\n\t\tinput_array.each do |j|\n\t\t\tif (res == j)\n\t\t\t\tbad = true\n\t\t\tend\n\t\tend\n\tend\n\t# check that num / [an array element] != [an array element]\n\t# order numbers so that a smaller number by a larger number\n\tinput_array.each do |i|\n\t\tif (i > num)\n\t\t\tres = i.to_f / num.to_f\n\t\telse\n\t\t\tres = num.to_f / i.to_f\n\t\tend\n\t\tif (res == res.to_i) # is it a whole number?\n\t\t\tinput_array.each do |j|\n\t\t\t\tif (res == j.to_f)\n\t\t\t\t\tbad = true \n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\treturn bad\nend",
"def average(array)\n if !array.is_a?(Array)\n return nil\n else \n sum = 0\n array.each do |i|\n sum += i\n end\n return sum / (array.length * 1.0)\n end\nend",
"def is_int_array(arr)\n if arr == nil || arr == ''\n return false\n elsif arr.empty?\n return true\n end\n\narr.each do |i|\n if i.class == Integer || i.class == Float && i%1==0\n else\n return false\n end\n end\ntrue\nend",
"def average_of_array(array)\n (array.sum).to_f / (array.length)\nend",
"def average(array)\n sum = 0\n\n if array.empty? || array.index {|x| x > 0} == 1\n puts \"Your array may be empty or contain negative intergers\"\n else\n array.each do |int|\n sum +=int\n end\n sum /= array.size\n end\nend",
"def average_of_array(array)\n\tn = [10, 15, 25]\n\taverage = n.inject(0.0) { | total, num | total + num } / n.count\n\taverage.round\nend",
"def find_average(array)\n array.sum / array.size.to_f\nend",
"def average_of_array(array)\n (1.0*array.inject{|sum, ele| sum + ele}/array.length).round(0)\nend",
"def average(array)\n average = array.sum / array.count\nend",
"def average_of_array(array)\n sum = 0\n array.each {|x|\n sum += x\n }\n (sum.round(2) / array.size).round\nend",
"def average(array)\n sum = 0\n array.each { |value| sum += value }\n sum / array.length\nend",
"def MeanMode(arr)\n arr.select {|i| arr.count(i) > 1}[0] == arr.inject(:+) / arr.length ? 1 : 0\nend",
"def average(array)\n sum = 0\n array.each do |int|\n sum += int\n end\n sum / array.length\nend",
"def average(array)\n array.sum / array.size.to_f\nend",
"def mean(array)\n total = 0.0\n array.each do |value|\n total += value\n end\n total / array.size\nend",
"def average(array)\n total = 0\n array.each do |num|\n total += num\n end\n total.to_f / array.size\nend",
"def better_than_average(arr, points)\n\n a = arr.count\n b = arr.inject(:+)\n median = b/a\n\n if median < points\n return true\n else\n return false\n end\nend",
"def average(array)\n sum = 0\n array.each { |x| sum += x }\n (sum / array.count).to_f\nend",
"def average(array)\n array.sum / array.length\nend",
"def average(array)\n total = 0\n array.each { |num| total += num }\n total / array.length\nend",
"def average(anArray)\n avg = 0\n sum = sum(anArray)\n if (anArray.length > 0) then\n avg = sum / anArray.length\n else\n return 0\n end\nend",
"def valid?(array)\n array.include?(0) || array.sum != 180\nend",
"def average (anArray)\n if (anArray.length <= 0)\n return 0.0;\n else\n return sum(anArray) / anArray.length;\n end\nend",
"def average(array)\n total = 0\n array.each do |number|\n total += number\n end\n total / array.length\nend",
"def average(array)\n array.inject(&:+) / array.length\n end",
"def average(num_array)\n sum = 0\n num_array.each { |num| sum += num }\n sum / num_array.length\nend",
"def average(array)\n (array.reduce(&:+) / array.length.to_f).round(2)\nend",
"def average(array)\n sum = array.reduce(:+)\n sum.to_f / array.size.to_f\nend",
"def find_average \n result = array.sum(0.0)/array.size\n return result\n end",
"def average(arr)\n (arr.sum.to_f / arr.size).round(2)\nend",
"def average(array_of_numeric_grades)\n sum = 0\n array_of_numeric_grades.each do |grade|\n sum += grade\n end\n average = sum / array_of_numeric_grades.length\nend",
"def average(array)\n return 0 if array.empty?\n array.sum / array.size\nend",
"def average(array)\n sum = 0\n array.each { |n| sum += n }\n average = sum / array.count\nend",
"def average(array)\n total = 0\n array.each do |number|\n total = total + number\n end\n total / array.size\nend",
"def average(array)\n puts array.sum.to_f / array.length\nend",
"def average(array)\n return sum(array)/array.length \nend",
"def divide(*number)\r\n\r\n test_array = []\r\n\r\n product = 1\r\n\r\n if number.length == 0\r\n\r\n test_array.push(false)\r\n\r\n end\r\n\r\n number.each do |n|\r\n\r\n if (n.class != Fixnum) && (n.class != Float)\r\n\r\n test_array.push(false)\r\n\r\n end\r\n\r\n end\r\n\r\n if test_array.length > 0\r\n\r\n return false\r\n\r\n else\r\n\r\n number.inject do |dividend, divisor|\r\n\r\n if divisor != 0\r\n\r\n (dividend.to_f / divisor.to_f).round(5)\r\n\r\n else\r\n\r\n return false\r\n\r\n end\r\n\r\n end\r\n\r\n end\r\n\r\nend",
"def all_else_equal(arr)\n\n sum = 0\n arr.each do |n|\n sum += n \n end \n \n if arr.include?(sum/2.0) # /2.0, not /2\n return sum/2.0\n # else \n # return nil \n end \n return nil\n\nend",
"def averagefloat(array)\n totalval = 0\n array.each { |x| totalval += x }\n totalval / array.length.to_f\nend",
"def average_of_array(array)\n (array.inject(:+) / array.size.to_f).round\nend",
"def better_than_average(arr, points)\n # Your code here\n class_avg = arr.reduce(:+) / arr.length\n points > class_avg\nend",
"def average(array)\n result = array.inject(:+)\n result / array.count\nend",
"def mean( array )\n sum( array ) / array.size\nend",
"def average(array)\n if array.size <= 0\n return 0.0\n end\n return sum(array) / array.size\nend",
"def average(array)\n array.reduce(:+) / array.size\nend",
"def average(array)\n array.reduce(:+) / array.size\nend",
"def average(arr)\n arr.sum / arr.size\nend",
"def average(arr)\n arr.sum / arr.length\nend",
"def average(arr)\n arr.sum / arr.length\nend",
"def average(arr)\n arr.sum / arr.length\nend",
"def average(array)\n i = 0\n sum = 0\n while i < array.length\n sum += array[i].to_int\n i += 1\n end\n return (sum.to_f / array.length.to_f)\nend",
"def average(array)\n array.inject(:+).to_f / array.size\nend",
"def average\n check_numeric_array!\n a = numerify\n a.sum / length.to_f\n end",
"def mean(array)\n array.sum(0.0) / array.size\nend",
"def all_else_equal(arr)\n result = sum(arr) / 2.0\n if arr.include?(result)\n return result\n end\n \n return nil\nend",
"def average(arr)\n (arr.sum / arr.length.to_f).round(2)\nend",
"def average(array)\n array.reduce(:+) / array.length\nend",
"def mean(array)\n\ttotal = 0\n\tarray.each do |x|\n\t\ttotal = total + x\n\tend\n\tmean = total.to_f / array.count\n\tputs mean\nend",
"def average_of_array(array)\n sum_of_array = array.inject{ |x, y| x + y }.to_f\n (sum_of_array.to_f/array.length).round\nend",
"def average(input_array)\n sum = 0\n \n input_array.each {|num| sum += num}\n \n average = sum.to_f/input_array.length\nend",
"def average_float(arr)\n sum = arr.reduce { |sum, x| sum + x }\n avg = sum.to_f / arr.length\n avg.round(2)\nend",
"def average(anArray)\n if anArray.empty? then\n return 0.0\n else\n return sum(anArray) / anArray.size\n end \nend",
"def array_average arr\n arr_sum = 0.0\n\n arr.each do |num|\n arr_sum += num\n end\n\n arr_avg = arr_sum / arr.size\nend",
"def mean(array)\n total = array.inject(0) {|sum, x| sum += x}\n # use to_f to avoid get integer result\n return total.to_f / array.length\nend",
"def calc_mean(ary)\n if !ary.is_a?(Array)\n 0\n elsif ary.empty?\n 0\n else\n # Your code goes here \n\n #add the numbers \n #divide by the amount of numbers in array\n temp = 0\n ary.each do |index|\n temp = temp + index\n\n end\n\n mean = temp / ary.size\n\n return mean\n end\nend",
"def average(arr)\n arr.reduce(:+).to_f / arr.size\nend",
"def average(integer_array)\n sum = integer_array.sum\n average = sum / integer_array.size\nend",
"def mean(array)\n array.inject(:+).to_f / array.size\nend",
"def mean(arr)\n return 0 if arr.empty?\n sum = 0\n\n arr.each do |num|\n sum = sum + num\n end\n \n sum / arr.count\nend",
"def double_number?(num)\narr = num.to_s.split('')\n\tif arr.size.even?\n\t\tavg = arr.size / 2\n\t\tarr[0, avg] == arr[avg, avg]\n\telse\n\t\tfalse\nend\nend",
"def averages(array)\n return [] if !array.is_a? Array\n averages_array = []\n array.each_index do |index|\n unless array[index + 1].nil?\n sum = (array[index] + array[index + 1])\n sum % 2 == 0 ? averages_array << sum / 2 : averages_array << sum / 2.0\n end\n end\n averages_array\nend",
"def mean array\n length = array.length\n sum = 0 \n array.each do |x|\n sum += x\n end\n sum / length\nend",
"def mean\n\t\treturn false if !self.numeric?\n\t\treturn self.element_sum.to_f/self.length\n\tend",
"def mean array\n array.inject(:+).to_f / array.length.to_f\n end",
"def all_else_equal(arr)\n sum = sum_array(arr)\n \n arr.each do |ele|\n if ele == sum / 2.0\n return ele\n end\n end\n \n return nil\nend",
"def average(num_arr)\n (num_arr.sum/num_arr.length).to_f\nend",
"def average(arr)\n sum = arr.reduce(:+).to_f \n sum / arr.size\nend",
"def all_else_equal(arr)\n sum = sum_array(arr)\n\n arr.each do |ele|\n if ele == sum / 2.0\n return ele\n end\n end\n\n return nil\nend",
"def mean(array)\n total = 0\n array.each { |i| total+= i.to_f }\n total / array.count\n puts total\nend",
"def is_square(arr)\n return nil if arr.empty?\n arr.flatten.all? { |num| Math.sqrt(num) % 1 == 0 }\nend",
"def average(arr)\n sum = arr.reduce(:+)\n sum / arr.size\nend",
"def average(ary)\n ary.sum / ary.length\nend",
"def all_odd?(array)\n\t\n\tif array.all? {|i| i % 2 != 0} \n\t puts \"true\"\n else\n \tputs \"false\"\n end\nend",
"def good_wrong?(num, input_array)\n\tif (multiple?(num, input_array) || duplicate?(num, input_array))\n\t\treturn false\n\telse\n\t\treturn true\n\tend\nend",
"def average(numbers)\n numbers.inject(&:+) / numbers.size.to_f # denominator here doesn't need to also be a float. appears that ruby will do a float operation as long as one of the numbers is a float\nend",
"def all_else_equal(arr)\n sum = sum_array(arr)\n \n arr.each do |ele|\n if ele == sum / 2.0\n\t return ele\n\t end\n\t end\n\t \n\t return nil\nend",
"def average (array)\n if array.empty? then\n 0\n else\n (sum(array)/array.size)\n end\nend",
"def averages(grades_array)\n total_grade = grades_array.reduce do |total, grade|\n total += grade\n end\n total_grade / grades_array.length\nend",
"def average (anArray)\n\n\t#if the array is empty...\n\tif anArray.empty?\n\t\treturn 0.0\n\n\t# otherwise, return the sum divided by the number of values\n\telse\n\t\treturn sum(anArray) / anArray.size\n\tend\nend",
"def checkAllEven(arr)\n return arr.all?{|num| num.even?}\nend",
"def average(arr)\n int = 0\n arr.each { |num| int += num }\n int / arr.length.to_f\nend",
"def array_of_fixnums?(array)\n array.all? { |x| x.is_a? Integer } \nend",
"def average(array)\n result = array.inject { |sum, n| sum + n }\n result / array.size\nend",
"def all_else_equal(arr)\n sum = arr.reduce { |sum, ele| sum += ele}\n # sum = arr.reduce do |sum, element|\n # sum += element\n # end\n\n half = sum / 2\n\n if arr.include?(half)\n return half\n end\n\n return nil\nend",
"def sum_only_numbers(an_array)\n sum = 0\n an_array.each do |item|\n item.is_a?(Integer) || item.is_a?(Float) ? sum += item : sum\n end\n return sum\nend",
"def all_else_equal(arr)\n\tsum = 0\n \t\n \tarr.each do |num|\n \tsum += num\n end\n \n \thalfSum = sum/2\n \n \tif arr.include?(halfSum)\n \treturn halfSum\n else\n \treturn nil\n end\nend",
"def average(input_array)\n n = input_array.length\n sum = 0 \n\n input_array.each do |num|\n sum = sum + num\n end\n average_of_array = sum.to_f / n\nend"
] | [
"0.83071",
"0.82768464",
"0.7145569",
"0.6849234",
"0.67085767",
"0.6641965",
"0.65922004",
"0.65213394",
"0.6506971",
"0.64956963",
"0.64939934",
"0.64450246",
"0.63976735",
"0.6393489",
"0.63912326",
"0.6367124",
"0.6365417",
"0.6363632",
"0.63605213",
"0.63585126",
"0.6343153",
"0.6341057",
"0.6335668",
"0.6334015",
"0.6328178",
"0.6326391",
"0.63218254",
"0.6317742",
"0.63172764",
"0.6310389",
"0.62847936",
"0.62802094",
"0.62785417",
"0.62736",
"0.627108",
"0.62701744",
"0.6265282",
"0.6260276",
"0.6260039",
"0.62496334",
"0.6240351",
"0.62329954",
"0.62034905",
"0.61982006",
"0.61920106",
"0.61862063",
"0.61796516",
"0.6178996",
"0.6178996",
"0.61786604",
"0.6178118",
"0.6178118",
"0.6178118",
"0.6175048",
"0.6173443",
"0.61660296",
"0.6164476",
"0.616438",
"0.61584073",
"0.6156427",
"0.6155587",
"0.6154795",
"0.6149649",
"0.61488587",
"0.6145501",
"0.6145131",
"0.6143769",
"0.61408603",
"0.6126707",
"0.61261266",
"0.6125026",
"0.6109056",
"0.61070985",
"0.610614",
"0.61061203",
"0.609729",
"0.60877675",
"0.60868335",
"0.6083789",
"0.60820824",
"0.6080392",
"0.6072983",
"0.60584694",
"0.6054832",
"0.60524964",
"0.60346127",
"0.6021359",
"0.6019484",
"0.60192364",
"0.6016372",
"0.60062236",
"0.59990495",
"0.5989241",
"0.5986211",
"0.5978654",
"0.5965941",
"0.5963041",
"0.59612423",
"0.59608185",
"0.5951925"
] | 0.80225235 | 2 |
Create a function that searches for the index of a given item in an array. If the item is present, it should return the index, otherwise, it should return 1. | def search(arr, item)
arr.index(item) || -1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_array (array, integer)\n array.each_with_index do |item, index|\n if item == integer\n return index\n end\n end\nend",
"def search(arr, x)\n (0..arr.count).each do |i|\n return i if arr[i] == x\n end\n -1\nend",
"def find(arr, item)\n i = 0\n item_index = nil\n while item_index.nil? && i < arr.length\n if arr[i] == item\n item_index = i\n end\n\n i += 1\n end\n\n item_index\nend",
"def search_array(arr, value)\n index = 0\n arr.each do |item|\n if item == value\n return index\n end\n index += 1\n end\n nil\nend",
"def find_element_index(array, value_to_find)\n # Add your solution here\n array.index(value_to_find)\nend",
"def find_element_index(array, value_to_find)\n array.find_index(value_to_find)\nend",
"def find_element_index(array, value_to_find)\n array.index(value_to_find)\nend",
"def find_element_index(array, value_to_find) #<-- this is a shorter solution with .find_index\n # Add your solution here\n array.find_index(value_to_find)\nend",
"def index_of( item )\n max = self.get_length\n counter = 1\n while( counter <= max )\n if( get(counter) == item)\n return counter\n end\n counter = counter + 1\n end\n return nil\n end",
"def search_array(array, item)\n\tcounter = 0\n\tarray.each do |element|\t\n\t\tif item == element\n\t\t\t counter\n\t\t\t break\n\t\telse\n\t\t\t counter += 1\n\t\tend\n\tend\n\t#If item is not in the array return nil\n\tif counter >= array.length\n\t\t\treturn nil\n\t\telse\n\t\t\tcounter\n\t\tend\t\t\t\nend",
"def find(array, target)\n array.each_with_index do |element,index|\n return index if (element == target)\n end\n nil\nend",
"def search_array(array, int)\n\ti = 0\n\twhile i < array.length\n\t\tif array[i] == int\n\t\t\treturn i\n\t\tend\n\t\ti += 1\n\tend\n\n\treturn nil\nend",
"def find_element_index(array, value_to_find)\n array.length.times do |index|\n if array[index] == value_to_find\n return index\n end\n end\n nil\nend",
"def my_index(arg)\n self.each_with_index do |ele,idx|\n if ele == arg\n return idx\n end\n end\n return nil\n end",
"def search_array(arr, x)\r\n index = 0 \r\n default = nil\r\n arr.each do if x == arr[index]\r\n return index\r\n # default = index\r\n end\r\n index += 1\r\n end\r\n return default \r\nend",
"def search_array (array, integer)\n\tarray.length.times do |index|\n\t if array[index] == integer\n\t return index\n\t end\n\tend\n\tnil\nend",
"def search_array(arr, int)\n\ti = 0\n\twhile i < arr.length\n\t\tif arr[i] == int\n\t\t\treturn i \n\t\tend\n\ti += 1\n\tend\nend",
"def find_magic_index(array)\n array.each_with_index do |element, index|\n if element == index \n return element\n end \n end \n -1 \nend",
"def index_match(array)\n # write your code here\n array.each_with_index do |num, index|\n if num == index \n return num\n end\n end\n -1\nend",
"def search_array(input_array, searched_elt)\n # Examples \n # arr = [42, 89, 23, 1]\n #p search_array(arr, 1)\n #=> 3\n #p search_array(arr, 24)\n #=> nil\n #= end \n \n # loop on the array 'array_of_integers'\n # if 'searched_integer' is found, take the index \n result = 0\n tab_index = 0 \n input_array.each do |i|\n if (i == searched_elt)\n result = tab_index\n end \n tab_index += 1\n end\n\n if result == 0 \n puts \"Element not found\"\n else\n return (result)\n end \n\nend",
"def magic_index(array)\n array.each_with_index do |val, index|\n return index if val == index\n end\n \"no magic index\"\nend",
"def index_for_item(item)\n for x in INVENTORY\n if x.has_value?(item)\n return index = INVENTORY.index(x)\n end\n end\n return index\nend",
"def array_search(array, integer)\n count = 0\n stored_index_matches = []\n integer_index = nil\n while count < array.length\n if array[count] == integer\n integer_index = count\n stored_index_matches << integer_index\n count += 1\n else\n count += 1\n end\n end\n if integer_index == nil #<--determines what the method's\n integer_index #<--return value should be, either\n else #<--nil or an array containing index\n stored_index_matches #<--numbers for matching integers\n end\nend",
"def find_element_index(array, value_to_find)\n array.length.times do |count|\n if array[count] == value_to_find\n return count\n end\n end\n nil\nend",
"def find_element_index(array, value_to_find)\n counter = 0 \n \n while counter < array.length do\n if array[counter] == value_to_find\n return counter\n end \n counter += 1 \n end \nend",
"def search_array(array, integer)\r\n # Search array for given integer\r\n array.each_with_index do |item, index|\r\n\r\n if item.eql? integer\r\n p index\r\n elsif !item.eql? integer\r\n nil\r\n else puts \"nil\"\r\n end\r\n \r\n end\r\nend",
"def array_search(array, value)\n array.find(value)\nend",
"def search_array(array, x)\n i = 0\n\n array.each do | y |\n if y == x\n return i\n end\n i += 1\n end\n return nil\nend",
"def find_pos(val, arr)\n result = false\n arr.each_with_index do |item, index|\n if item == val\n result = index\n break\n end\n end\n result\nend",
"def find_element_index(array, value_to_find)\n array.length.times do |count|\n if array[count] == value_to_find \n return count\nend\nend\nnil\nend",
"def linear_search(sorted_array, desired_item)\n index = 0\n sorted_array.length.times do \n if desired_item == sorted_array[index]\n break \n else \n index += 1\n end\n if index > sorted_array.length - 1\n index = nil \n end\n end\n return index \nend",
"def search_array(array, integer)\n index = 0\n while index < array.length\n if array[index] == integer\n return index\n else \n nil\n index += 1\n end\n end\nend",
"def find_element_index(array, value_to_find)\n count = 0\n value_index = nil\n while count < array.length do\n if array[count] == value_to_find\n value_index = count\n end\n count += 1\n end\n value_index\nend",
"def search_array(array_to_search,int_to_find) \n # initialize position in array variable\n position = 0 \n # for each element in the array, look for integer\n array_to_search.each do |i|\n # if this integer = what we are trying to find, return the position in the array\n if i == int_to_find\n return position \n else\n # integer not found, increment position and try again\n position += 1 \n end\n end\n # if we reached this part of the code, the integer was not found after the entire array was searched; return nil\n nil\nend",
"def search(nums, target)\n nums.each_with_index do |num, index|\n return index if num == target\n end\n -1\nend",
"def find_index_of_value_in_array(value, array)\n index = 0\n while index < array.length do \n if array[index] == value\n return index\n end\n index += 1\n end\n nil\nend",
"def find_element_index(array, value_to_find)\n count = 0\n while count < array.length do \n if array[count] == value_to_find\n return count\n end \n count += 1 \n end\n nil \nend",
"def search(array, index_target)\r\n\tindex = 0 \r\n\t\r\nwhile index < array.length \r\n\tif array[index] == index_target\r\n\t\treturn index \r\n\telse \r\n\t\tnil \r\n\tend\r\n\tindex += 1 \r\nend \r\nend",
"def find_index array, item\n\tl,r = 0, array.length-1\n\n\twhile l <= r\n\t\tm = (r+l) / 2\n\t\tcomp = yield item, array[m]\n\t\tif comp == false\n\t\t\t# Items compare the same\n\t\t\treturn false\n\t\telsif comp == -1 \n\t\t\tr = m - 1\n\t\telse\n\t\t\tl = m + 1\n\t\tend\n\tend\n\n\tl\nend",
"def search_array(arr, num)\n\tindex = 0\n\tarr.each do |value|\n\t\tif value == num\n\t\t\treturn index\n\t\tend\n\tindex +=1\n\tend\n\treturn nil\nend",
"def first_index(arr, &blck)\n #arr.find_index { |el| blck.call(el) }\n arr.each_with_index do |el, i|\n if blck.call(el)\n return i\n end\n end\n return nil\nend",
"def find_item(array, target)\n array.select do |elem| elem== target\n return array.index(target)+1\n end\n\n\n\n\nend",
"def linear_search(array, target)\n for i in 0...array.length\n if array[i] == target\n return i\n end\n end\n\n return -1\nend",
"def find_index(array, target)\n index = 0\n found_index = nil\n\n array.each do |element|\n if element == target\n found_index = index\n end\n index += 1\n end\n\n found_index\nend",
"def linear_search(a, v)\n\ta.each_with_index do |e, i|\n\t\tif e == v\n\t\t\treturn i\n\t\tend\n\tend\n\tnil\nend",
"def find_element_index(array, value_to_find)\n i=0 \n k = value_to_find\n while i<array.length do\n if array[i]==k\n number=i \n i+=1 \n else \n i+=1 \n end\n end\n return number\nend",
"def search_array(array, int)\n \n return_value = nil\n x = 0\n while x < array.length\n \n if array[x] == int\n return return_value = x\n else \n x += 1\n end\n end\n return return_value\nend",
"def simple_search(arr, number)\n\tmatching_index = nil\n\tcurrent_index = 0\n\tarr.each do |num|\n\t\tif num == number\n\t\t\tmatching_index = current_index\n\t\tend\n\t\tcurrent_index += 1\n\tend \n\tmatching_index\nend",
"def linear_search(array, target)\n for i in 0..(array.length - 1)\n if array[i] == target\n return i\n end\n end\n return -1\nend",
"def search_array(array, integer)\r\n counter = 0 # Our own INDEX!\r\n array.each do |value| # We iterate through array, checking each \"value\"\r\n if value == integer; return counter; end # return the index of the \"integer\" we searched for\r\n counter += 1\r\n if counter >= array.length ; return nil ;end # return nil if \"integer\" is not present in the array\r\n end\r\nend",
"def search_array(array, integer)\n index = 0\n result = nil # variable to store result\n\n array.each do |number| # for each item in the array, check whether it is equal to the integer.\n if number == integer\n result = index # save current index as result when integer is found in array.\n break\n end\n index += 1 # each time the number does not match, increment the index.\n end\n return result\nend",
"def linear_search(object, array)\n i = 0\n until array[i] == object || array[i] == nil\n i += 1\n end\n array[i] == object ? i : nil\n end",
"def linear_search(object, array)\n i = 0\n while i < array.length\n if /(#{object})/ =~ array[i]\n return i\n end\n i += 1\n end\nend",
"def search(array, value)\n\ti = 0\n\treturn search_helper(array, value, i)\nend",
"def linear_search(array, n, x)\n answer_index = 'NOT-FOUND'\n array.each_with_index do |a, i|\n if a == x\n answer_index = i\n end\n end\n answer_index\nend",
"def search(array, value)\n # input validation\n return false if array.nil?\n # base case\n i = 0\n return search_helper(array, i, value)\nend",
"def search_array(array, value)\n idx = 0\n array.each do\n if array[idx] == value \n return idx\n end\n idx += 1\n if idx == array.length\n print \"nil\"\n return nil\n end\n end\nend",
"def linear_search_simple(a, v)\n\ta.find_index(v)\nend",
"def first_index(arr, &prc)\n arr.each.with_index do |ele, idx| \n return idx if prc.call(ele)\n end\n nil\nend",
"def global_linear_search(item, array)\n\n result = []\n\n\n \tfor i in 0...array.length\n\t \tif array[i] == item\n\t \t\tresult << i\n\t \tend\n\t \t\n\t \ti += 1\n\n end\n result\nend",
"def find_item(word, array)\n iter = 0\n while iter < array.length\n # is \"this\" same as \"the\"?\n if word == array[iter]\n return iter + 1 #in this case, iter +1 will add 1 to the position number\n end\n\n iter += 1\n end\n puts \"#{word} doesn't exist\"\nend",
"def search_integers(array, x)\n result = nil\n index = 0\n \tarray.each do |integer|\n \t#does the argument i pass in equal any of the items in the array\n \tif integer == x \n \t\tputs index \n \telse\n \tend\n \tindex += 1\n \tend\n result\nend",
"def first_index(arr, &proc)\r\n arr.each_with_index { |el, i| return i if proc.call(el) }\r\n nil\r\nend",
"def magic_slow(arr)\n arr.each_with_index do |val, index|\n if val === index\n return index\n end\n end\nend",
"def first_index(arr, &prc)\n\n arr.each_with_index do |ele, i|\n return i if prc.call(ele)\n end\n return nil\nend",
"def index(list, item, &block)\r\n\t\ti = bisect_left(list, item, &block)\r\n\t\treturn list[i] == item ? i : nil\r\n\tend",
"def search_array(arr, x)\n index_count = 0\n index_result = 0\n until index_count == arr.length\n if arr[index_count] == x\n index_result = index_count\n end\n index_count += 1\n end\n search_array = index_result\nend",
"def search_array(arr, int)\r\n i = 0\r\n while i < arr.length\r\n if arr[i] == int\r\n return i\r\n else\r\n puts NIL\r\n end\r\n i += 1\r\nend\r\nend",
"def find_item(idx, list)\n list.find { |item| item[:idx] == idx }\n end",
"def search_array(array, integer)\n index = 0\n array.each do |int|\n if int == integer\n puts \"#{integer} was found in the array! It's index is #{index}.\"\n else\n nil\n end\n index += 1\n end\nend",
"def search_array(array, num)\n answer = nil\n (array.length+1).times do | index |\n if array[index] == num\n answer = index\n end\n end\n answer\nend",
"def search_array(array, integer)\nindex = 0\n\twhile index < array.length \n\t\tif array[index] == integer \n\t\t\treturn index\n\t\tend \n\t\tindex += 1\n\tend\n\tputs \"This integer is not included.\" \nend",
"def get_index_of_position(target_position, ary)\n ary.each_index do |i|\n current_position = ary[i][1]\n if current_position == target_position\n return i\n end\n end\n end",
"def search_array(integers, target)\n idx = 0\n\n while idx < integers.length\n if integers[idx] == target\n return idx\n elsif idx == integers.length\n nil\n else\n idx += 1\n end\n end\nend",
"def linear_search(array, search_value)\n array.each_with_index do |element, index|\n if element == search_value\n return index\n elsif element > search_value\n break\n end\n end\n\n return nil\nend",
"def index_of element\n # Can search for nil values\n if element == nil\n each_with_index do |node, index|\n return index if node.data == nil\n end\n # searching for non-nil values\n else\n each_with_index do |node, index|\n return index if node.data == element\n end\n end\n\n return -1\n end",
"def index_of element\n # Can search for nil values\n if element == nil\n each_with_index do |node, index|\n return index if node.data == nil\n end\n # searching for non-nil values\n else\n each_with_index do |node, index|\n return index if node.data == element\n end\n end\n\n return -1\n end",
"def magic_slow(arr)\n arr.each_with_index do |val, index|\n return index if val === index\n end\nend",
"def find_first_instance(array, key)\n i = 0\n while i < array.length do \n if array[i] == key\n return i \n end \n i = i + array[i] - key\n end \n -1\nend",
"def linear_search(object, array)\n\t\tputs \"nil\" if array.empty? == true\n\t\tputs \"nil\" if array.include?(object) == false\n\t\n\t\t\ti = 0\n\t\tuntil array[i] == object\n\t\t\ti +=1\n\t\tend\n\t\nreturn i if array[i] = object\n\t\nend",
"def nameri arr, query \n len = arr.length\n for idx in 0 .. len - 1 do\n if query == arr[idx]\n return idx \n else \n end\n end\nend",
"def search_index(games, search_term)\n search_index = games.find_index(search_term)\n search_index || \"Not Found\"\nend",
"def search_array2(ary, target)\n i = 0\n match = nil\n ary.each do |x|\n case\n when x == target then match = i\n else i += 1\n end\n end\n p match\nend",
"def search_array(array, search_int)\n # have an empty array to store the index array numbers\n index_array = []\n\n length_of_array = array.length - 1\n\n # convert array and index to string\n array_string = array.map {|x| x.to_s}\n index_string = search_int.to_s\n\n # make a counter for 0 to array lenght numbers\n for x in 0..length_of_array\n index_array << x.to_s\n end\n\n # make the two arrays into a hash\n p array_index = Hash[index_array.zip(array_string.map {|i| i.split})]\n\n # convert back to an integer\n\n if array_index[index_string] == nil\n p nil\n else\n p array_index[index_string].map {|i| i.to_i}\n end\n\n\nend",
"def has_item_by_object(item)\n inventory.each_with_index do |couple, index|\n if (couple.first == item)\n return index\n end\n end\n return -1\n end",
"def has_item_by_object(item)\n inventory.each_with_index do |couple, index|\n if (couple.first == item)\n return index\n end\n end\n return -1\n end",
"def search(array, value, index=0)\n return false if index >= array.length\n return true if array[index] == value\n\n return search(array, value, index+1)\nend",
"def search(array, value)\n if array == []\n return false\n else\n return search_helper(array, value, i)\n end \nend",
"def index(element)\n each_with_index { |e, index| return index if e == element }\n nil\n end",
"def search_array(favorite_nums,num)\n # loop containing a conditional statement\n iteration = 0\n while iteration < favorite_nums.length\n if num == favorite_nums[iteration]\n return iteration\n end\n iteration += 1\n end\nend",
"def get_index_of_id(target_id, ary)\n ary.each_index do |i|\n current_id = ary[i][0]\n if current_id == target_id\n return i\n end\n end\n end",
"def search(array, value, index = 0)\n return false if index >= array.length\n return true if array[index] == value\n return search(array, value, index + 1)\nend",
"def is_it_in(array, string)\n array.include?(string) ? array.index(string) : nil\nend",
"def find_item(list, itemname)\n\t# input: list, name of item(string)\n\t# output: index of matching element from list (integer) or nil\n\n\tfound = false\n\tcounter = 0\n\t# iterate through items looking for match\n\tfor item, qty in list\n\t\t# remove matching item from list\n\t\tif item.downcase.strip == itemname.downcase.strip\n\t\t\treturn counter\n\t\tend\n\t\tcounter += 1\n\tend\n\treturn nil\nend",
"def find_index_by_path(*path)\n if item = find_item_by_path(*path)\n item.index\n end\n end",
"def index(value)\n each.with_index do |v, i|\n return i if v == value\n end\n return nil\n end",
"def binary_search(array,item,min,max) #We want this to return the array index of item\n midpoint = min + ( (max - min) / 2 )\n return midpoint if array[midpoint] == item\n\n if max - min == 1 || max - min == 0\n if array[midpoint] == item\n return midpoint\n elsif array[midpoint +1] == item\n return midpoint + 1\n else\n return nil\n end\n end\n\n if array[midpoint] > item\n binary_search(array,item,min,midpoint)\n else array[midpoint] < item\n binary_search(array,item,midpoint,max)\n end\n\nend",
"def binary_search(ary, value); end",
"def simple_search (search_array, search_number)\n counter = 0\n search_array.each do |number|\n if number == search_number \n return counter \n else \n counter +=1 \n end \nend\n nil \nend",
"def linearSearch(array,value)\n array.each do |element|\n if element == value\n return value\n end \n end\n return \"not found\"\nend"
] | [
"0.80245537",
"0.7731764",
"0.76851076",
"0.76829517",
"0.76363814",
"0.76272833",
"0.76201665",
"0.76108813",
"0.754299",
"0.75330526",
"0.75125885",
"0.74808735",
"0.74796146",
"0.7457277",
"0.7453161",
"0.73716724",
"0.735374",
"0.7337712",
"0.73192644",
"0.73133796",
"0.73121154",
"0.7273861",
"0.7259428",
"0.72430813",
"0.72057825",
"0.7158618",
"0.71509475",
"0.7150643",
"0.71272933",
"0.7121665",
"0.71216",
"0.70959145",
"0.7091905",
"0.7084978",
"0.7074845",
"0.7050631",
"0.70270985",
"0.70219874",
"0.7015897",
"0.7011681",
"0.6999898",
"0.6988218",
"0.69743925",
"0.69624436",
"0.6919091",
"0.69180936",
"0.6905651",
"0.68932873",
"0.6892457",
"0.68884706",
"0.6863509",
"0.68623626",
"0.6858681",
"0.68483686",
"0.6827872",
"0.6826721",
"0.6825573",
"0.682463",
"0.68163836",
"0.6814406",
"0.6779627",
"0.67769593",
"0.67731786",
"0.67567927",
"0.6742392",
"0.6739342",
"0.6729775",
"0.66994816",
"0.6691823",
"0.6683983",
"0.66824746",
"0.6678611",
"0.66727376",
"0.6636688",
"0.66222394",
"0.66194487",
"0.66194487",
"0.66116047",
"0.66025275",
"0.6589574",
"0.6577518",
"0.6561119",
"0.65547246",
"0.653924",
"0.65282595",
"0.65282595",
"0.64819556",
"0.6479443",
"0.6465711",
"0.6450365",
"0.64393485",
"0.6434787",
"0.64341193",
"0.64308727",
"0.6429731",
"0.6422122",
"0.64204764",
"0.6418795",
"0.64148986",
"0.64010274"
] | 0.8381486 | 0 |
Create access token, it provides basic access authentication for HTTP protocol, returns token contain username and password, they are separated by a colon. | def create_access_token(id:, type: nil)
params = {
id: id,
type: type
}
client.make_request('/create-access-token', 'post', params: params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_access_token\n token_string = \"#{@username}:#{@password}\"\n return Base64.strict_encode64(token_string)\n end",
"def get_access_token\n uri = URI.parse(@token_url)\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.request_uri)\n auth = Base64.encode64(@login + ':' + @password).gsub(\"\\n\", \"\")\n req['Authorization'] = \"Basic #{auth}\"\n send = 'grant_type=client_credentials'\n req.body = send\n res = http.request(req)\n if res.code == \"200\"\n data = res.body\n result = JSON.parse(data)\n @access_token = result['access_token']\n else\n puts \"Invalid getting access token\"\n exit\n end\n end",
"def token\n uri = URI.parse('https://anypoint.mulesoft.com/accounts/login')\n\n client = Net::HTTP.new(uri.host, uri.port)\n client.use_ssl = true\n\n request = Net::HTTP::Post.new(uri.request_uri)\n request.body = URI.encode_www_form({\n \"username\" => @username,\n \"password\" => @password\n })\n\n response = client.request(request)\n access_token = JSON.parse(response.body)['access_token']\n @logger.info('Access token: ' + access_token)\n return access_token\n end",
"def basic_auth\n \"#{username}:#{access_token}\"\n end",
"def get_access_token()\n url = URI.parse(TOKEN_ENDPOINT)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n req = Net::HTTP::Post.new(url.path)\n req.basic_auth(@clientId, @clientSecret)\n req.set_form_data({'grant_type' => 'client_credentials'})\n res = http.request(req)\n JSON.parse(res.body)['access_token']\n end",
"def get_access_token(username, password)\n response = @oauth_connection.post do |req|\n req.url '/oauth/token', :grant_type => 'password', :client_id => api_key, :client_secret => api_secret, :username => username, :password => password\n end\n\n @oauth_token = OAuthToken.new(response.body)\n configure_oauth\n @oauth_token\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def get_access_token\n\n\t\t\thost = get_host 'gateway'\n\t\t\tusername = get_credential 'username'\n\t\t\tpassword = get_credential 'password'\n\t\t\t\n\t\t\turl = host + 'partner/authorize'\n\t\t\t#return url\n\t\t\tdata = {username: username, password: password}\n\t\t\tresponse = RestClient.post url,data\n\t\t\tif response.code != 201\n\t\t\t\treturn {success: false, error: JSON[response.body]}\n\t\t\tend\n\t\t\tJSON[response.body][\"access_token\"]\n\t\tend",
"def retrieve_auth_token\n http = Net::HTTP.new(auth_endpoint.host, auth_endpoint.port)\n\n request = Net::HTTP::Post.new(auth_endpoint.request_uri)\n\n request.basic_auth(\n TodoableApi.configuration.username,\n TodoableApi.configuration.password\n )\n\n handle_auth_response(http.request(request))\n end",
"def bearer_token\n # Put the url together\n url = \"#{API_HOST}#{TOKEN_PATH}\"\n\n # Build our params hash\n params = {\n client_id: @client_id,\n client_secret: @client_secret,\n grant_type: GRANT_TYPE\n }\n\n response = HTTP.post(url, params: params)\n parsed = response.parse\n\n \"#{parsed['token_type']} #{parsed['access_token']}\"\n end",
"def build_token(access_token)\n return OAuth2::AccessToken.new CLIENT, access_token\n end",
"def api_token\n if @token.nil?\n raise ArgumentError, 'username is missing' if username.blank?\n raise ArgumentError, 'password is missing' if password.blank?\n response = connection.post do |req|\n req.url '/Authentication/V2.0'\n req.headers['x-dnb-user'] = username\n req.headers['x-dnb-pwd'] = password\n end\n @token = response.headers['Authorization']\n end\n @token\n end",
"def bearer_token\n # Put the url together\n url = \"#{API_HOST}#{TOKEN_PATH}\"\n\n raise \"Please set your CLIENT_ID\" if CLIENT_ID.nil?\n raise \"Please set your CLIENT_SECRET\" if CLIENT_SECRET.nil?\n\n # Build our params hash\n params = {\n client_id: CLIENT_ID,\n client_secret: CLIENT_SECRET,\n grant_type: GRANT_TYPE\n }\n\n response = HTTP.post(url, params: params)\n parsed = response.parse\n\n \"#{parsed['token_type']} #{parsed['access_token']}\"\nend",
"def bearer_token\n # Put the url together\n url = \"#{API_HOST}#{TOKEN_PATH}\"\n\n raise \"Please set your CLIENT_ID\" if CLIENT_ID.nil?\n raise \"Please set your CLIENT_SECRET\" if CLIENT_SECRET.nil?\n\n # Build our params hash\n params = {\n client_id: CLIENT_ID,\n client_secret: CLIENT_SECRET,\n grant_type: GRANT_TYPE\n }\n\n response = HTTP.post(url, params: params)\n parsed = response.parse\n\n \"#{parsed['token_type']} #{parsed['access_token']}\"\nend",
"def bearer_token\n # Put the url together\n url = \"#{API_HOST}#{TOKEN_PATH}\"\n\n raise \"Please set your CLIENT_ID\" if CLIENT_ID.nil?\n raise \"Please set your CLIENT_SECRET\" if CLIENT_SECRET.nil?\n\n # Build our params hash\n params = {\n client_id: CLIENT_ID,\n client_secret: CLIENT_SECRET,\n grant_type: GRANT_TYPE\n }\n\n response = HTTP.post(url, params: params)\n parsed = response.parse\n\n \"#{parsed['token_type']} #{parsed['access_token']}\"\nend",
"def generate_authorization_token\n \t# create the token that contains the necessary elements to authorize the user\t\n \t# using a nested array because the alphabetical order must be maintained\n \ttoken = [['credentials', self.user.to_credential_string,], ['identity', self.user.to_identity_string], ['time', Time.now.to_i.to_s]]\n \tencoded_parms = token.collect {|pair| pair[1] = CGI.escape(pair[1]); pair.join('=')}.join('&')\n\n digest = Digest::SHA2.new\n digest.update(encoded_parms)\n\n hmac = HMAC::SHA256.new(self.options[:shared_secret])\n hmac.update(encoded_parms)\n\n # add the hashed digital signature to the end of the query parameters\n encoded_parms += \"&signature=#{hmac.hexdigest}\"\n end",
"def generate_token\n token_hash = SecureRandom.hex\n token_hash.force_encoding('utf-8')\n access_tokens.create(token: token_hash, token_expire: Time.now + DEFAULT_TOKEN_EXPIRE)\n end",
"def generate_token\n token_hash = SecureRandom.hex\n token_hash.force_encoding('utf-8')\n access_tokens.create(token: token_hash, token_expire: Time.now + DEFAULT_TOKEN_EXPIRE)\n end",
"def http_auth_token\n @http_auth_token ||= if request.headers['Authorization'].present?\n request.headers['Authorization'].split(' ').last\n end\n end",
"def build_access_token\n options.token_params.merge!(\n headers: { 'Authorization' => basic_auth_header },\n )\n super\n end",
"def get_token(username, password, opts={})\n opts[:params] ||= {}\n opts[:params].merge!({\n :grant_type => grant_type,\n :username => username,\n :password => password\n })\n opts[:authenticate] ||= :headers\n method = opts.delete(:method) || :post\n make_request(method, @token_path, opts)\n end",
"def get_new_access_token\n now = Time.now\n params = {\n body: {\n grant_type: 'urn:ietf:params:oauth:grant-type:uma-ticket',\n ticket: retrieve_ticket,\n client_id: key_info['oxtrust_client_id'],\n client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',\n client_assertion: generate_json_web_token(now),\n scope: 'oxtrust-api-read oxtrust-api-write'\n }\n }\n req = HTTParty.post('https://localhost/oxauth/restv1/token', params)\n if req.code == 200\n token = req['access_token']\n save_access_token(token, now.to_i + 86_400)\n token\n else\n Puppet.err(\n \"Gluu API HTTP #{req.code}: #{req['error_description']}\",\n )\n end\n end",
"def build_access_token\n access_token = super\n access_token.options[:header_format] = \"OAuth %s\"\n access_token\n end",
"def xauth_token\n consumer = oauth_consumer\n request_token = consumer.get_request_token\n consumer.get_access_token(\n request_token, {},\n {\n :x_auth_mode => 'client_auth',\n :x_auth_username => cred['username'],\n :x_auth_password => cred['password']\n }\n )\n end",
"def build_access_token\n verifier = request.params[\"code\"]\n client.auth_code.get_token(verifier, token_params.to_hash(:symbolize_keys => true), deep_symbolize(options.auth_token_params))\n end",
"def create_access_token\n hash = nil\n Songkick::OAuth2.generate_id do |token|\n hash = Songkick::OAuth2.hashify(token) \n end\n return hash\n end",
"def auth\n build_response(\"token\") do\n connection.post do |req|\n req.headers.delete(\"Authorization\")\n req.url \"auth/\"\n req.body = { username: username, password: password }.to_json\n end\n end\n end",
"def http_auth_token\n @http_auth_token ||= if request.headers['Authorization'].present?\n request.headers['Authorization'].split(' ').last\n end\n end",
"def get_token\n token_data = vault_read('littlered.stanford.edu', 'netdb-token')\n credentials = JSON.parse(token_data)\n encoded = Base64.urlsafe_encode64(\"#{credentials['client_id']}:#{credentials['client_secret']}\")\n headers = { Authorization: \"Basic #{encoded}\" }\n query = { grant_type: credentials['grant_type'] }\n response = HTTParty.post(credentials['token_endpoint'],\n :headers => headers,\n :query => query\n )\n raise \"Bad response to getting token: #{response.body}\" if response.code != 200\n\n response_json = JSON.parse(response.body)\n response_json['access_token']\nend",
"def acquire_token\n token_acquire_url = TOKEN_ACQUIRE_URL.dup\n token_acquire_url['{authentication_endpoint}'] = @settings.authentication_endpoint\n token_acquire_url['{tenant_id}'] = @tenant_id\n\n url = URI.parse(token_acquire_url)\n\n connection = Faraday.new(:url => url, :ssl => MsRest.ssl_options) do |builder|\n builder.adapter Faraday.default_adapter\n end\n\n request_body = REQUEST_BODY_PATTERN.dup\n request_body['{resource_uri}'] = ERB::Util.url_encode(@settings.token_audience)\n request_body['{client_id}'] = ERB::Util.url_encode(@client_id)\n request_body['{username}'] = ERB::Util.url_encode(@username)\n request_body['{password}'] = ERB::Util.url_encode(@password)\n\n response = connection.get do |request|\n request.headers['content-type'] = 'application/x-www-form-urlencoded'\n request.body = request_body\n end\n\n fail AzureOperationError,\n 'Couldn\\'t login to Azure, please verify your tenant id, client id and username/password' unless response.status == 200\n\n response_body = JSON.load(response.body)\n @token = response_body['access_token']\n @token_expires_on = Time.at(Integer(response_body['expires_on']))\n @token_type = response_body['token_type']\n end",
"def get_access_token\n\t\treturn @credentials.get_access_token\n\tend",
"def generate_access_token\n self.access_token = SecureRandom.hex(64)\n end",
"def access_token\n @access_token ||= AccessToken.new(caller_service: caller_service, authorizator_service: authorizator_service)\n end",
"def token_generate\n res = call('auth.token_generate')\n\n return unless res || res['token']\n\n res['token']\n end",
"def prepare_access_token\n consumer = OAuth::Consumer.new(@consumer_key, @consumer_secret,\n { :site => @hostname,\n :scheme => :header,\n :access_token_path=>\"/v1/oauth/token/access\",\n :authorize_path => \"/v1/oauth/authorize\",\n :request_token_path => \"/v1/oauth/token/request\"\n })\n\n access_token = OAuth::AccessToken.from_hash(consumer, :oauth_token => @access_token, :oauth_token_secret => @access_token_secret) \n return access_token\n end",
"def fetch_access_token\n uri = URI.parse Sendible::API::URL + \"/v1/auth?app_id=#{CGI.escape(Sendible.application_id)}&access_key=#{CGI.escape(access_key)}\"\n get = Net::HTTP::Get.new(uri.request_uri)\n response = Net::HTTP.start(uri.host, uri.port) do |http|\n http.request(get)\n end\n response.body\n end",
"def get_token\n begin\n @response = RestClient.post(\n @consumer[:token_request_url],\n client_id: @consumer[:client_id],\n client_secret: @consumer[:client_secret],\n grant_type: @consumer[:grant_type],\n resource: @consumer[:resource]\n )\n\n @consumer[:token] = 'Bearer ' + JSON.parse(@response)['access_token']\n @consumer[:token_expiry] = JSON.parse(@response)['expires_on']\n rescue => error\n puts(\"ERROR - Token Request Failed - #{error}\")\n end\n @consumer[:token]\n end",
"def token(auth_code = T.unsafe(nil), headers = T.unsafe(nil)); end",
"def token\n authenticate_with_http_basic do |username, password|\n\n user = User.find_by(username: username)\n if user && user.password == password\n render json: { token: user.token }\n else\n render json: { error: 'Incorrect credentials' }, status: 401\n end\n\n end\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def get_access_token\n raise HyvesException, 'You need an request token to make get an access token' if request_token.nil?\n @access_token = request_token.get_access_token\n\n @userid = request_token.response[\"userid\"]\n @expiredate = Time.at(request_token.response[\"expiredate\"].to_i) if not request_token.response[\"expiredate\"].nil?\n\n @access_token\n end",
"def get_token(username, password, params = {}, opts = {})\n params = {'grant_type' => 'password',\n 'username' => username,\n 'password' => password}.merge(params)\n @client.get_token(params, opts)\n end",
"def post_access_token_with_http_info(opts = {})\r\n if @api_client.config.debugging\r\n @api_client.config.logger.debug \"Calling API: LoginApi.post_access_token ...\"\r\n end\r\n if opts[:'grant_type'] && !['password', 'authorization_code', 'client_credentials'].include?(opts[:'grant_type'])\r\n fail ArgumentError, 'invalid value for \"grant_type\", must be one of password, authorization_code, client_credentials'\r\n end\r\n # resource path\r\n local_var_path = \"/oauth/token\".sub('{format}','json')\r\n\r\n # query parameters\r\n query_params = {}\r\n\r\n # header parameters\r\n header_params = {}\r\n # HTTP header 'Content-Type'\r\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\r\n header_params[:'Authorization'] = opts[:'authorization'] if !opts[:'authorization'].nil?\r\n\r\n # form parameters\r\n form_params = {}\r\n form_params[\"grant_type\"] = opts[:'grant_type'] if !opts[:'grant_type'].nil?\r\n form_params[\"username\"] = opts[:'username'] if !opts[:'username'].nil?\r\n form_params[\"password\"] = opts[:'password'] if !opts[:'password'].nil?\r\n\r\n # http body (model)\r\n post_body = nil\r\n auth_names = []\r\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\r\n :header_params => header_params,\r\n :query_params => query_params,\r\n :form_params => form_params,\r\n :body => post_body,\r\n :auth_names => auth_names,\r\n :return_type => 'OAuthResponse')\r\n if @api_client.config.debugging\r\n @api_client.config.logger.debug \"API called: LoginApi#post_access_token\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\r\n end\r\n return data, status_code, headers\r\n end",
"def generate_token_with_http_info(grant_type, username, password, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AuthenticationApi.generate_token ...'\n end\n # verify the required parameter 'grant_type' is set\n if @api_client.config.client_side_validation && grant_type.nil?\n fail ArgumentError, \"Missing the required parameter 'grant_type' when calling AuthenticationApi.generate_token\"\n end\n # verify the required parameter 'username' is set\n if @api_client.config.client_side_validation && username.nil?\n fail ArgumentError, \"Missing the required parameter 'username' when calling AuthenticationApi.generate_token\"\n end\n # verify the required parameter 'password' is set\n if @api_client.config.client_side_validation && password.nil?\n fail ArgumentError, \"Missing the required parameter 'password' when calling AuthenticationApi.generate_token\"\n end\n # resource path\n local_var_path = '/1.0.0/auth/generatetoken'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n form_params['grant_type'] = grant_type\n form_params['username'] = username\n form_params['password'] = password\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'InlineResponse20015')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuthenticationApi#generate_token\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def http_auth_token\n request.headers['Authorization']&.split(' ')&.last\n end",
"def auth_token\n curtime = Time.now.utc.strftime '%Y%m%d%H' # yyyymmddhh. hh is 24 hour 0 padded\n token = \"#{@user}-#{@pass}-#{curtime}-#{@service_tag}\"\n puts \"----> Generated auth token: #{token}\"\n Digest::MD5.hexdigest(token).upcase\n end",
"def acquire_token()\n response_body = JSON.load(`#{cli_path} account get-access-token -o json --resource #{@settings.token_audience}`)\n \n @token_expires_on = Time.parse(response_body['expiresOn'])\n @token_type = response_body['tokenType']\n @token = response_body['accessToken']\n rescue\n raise AzureCliError, 'Error acquiring token from the Azure CLI'\n end",
"def access_token\n OAuth::AccessToken.new(consumer, oauth_token, oauth_token_secret)\n end",
"def auth(tenant)\n\t\t\n\t\tauth = {\"auth\" => {\"passwordCredentials\" => {\"username\" => @user_name, \"password\" => @password}, \"tenantName\" => tenant}}\n\t\t\n\t\tjson_string = JSON.generate(auth)\n\t\t\n\t\tpost_call = Curl::Easy.http_post(\"#{@ip_address}:#{@port_1}/v2.0/tokens\", json_string\n\t\t)do |curl| curl.headers['Content-Type'] = 'application/json' end\n\t\t\n\t\tparsed_json = JSON.parse(post_call.body_str)\n\t\t@token = parsed_json[\"access\"][\"token\"][\"id\"]\n\t\t\n\t\treturn @token\n\tend",
"def get_access_token_json\n HTTParty.post(get_request_access_token_url)\n end",
"def http_token\n @http_token ||= if request.headers['Authorization'].present?\n request.headers['Authorization'].split(' ').last\n end\n end",
"def generate_access_token\n self.access_token ||= self.create_access_token\n save && access_token\n end",
"def generate_token(grant_type, username, password, opts = {})\n data, _status_code, _headers = generate_token_with_http_info(grant_type, username, password, opts)\n data\n end",
"def create_token(token_request, opts = {})\n data, _status_code, _headers = create_token_with_http_info(token_request, opts)\n data\n end",
"def create_token\n client_requested_expires_in = server.jwt['exp'].to_i - server.jwt['iat'].to_i\n server_expires_in = Authorization::Token.access_token_expires_in(configuration, client)\n if server_expires_in\n expires_in = (client_requested_expires_in > 0 && client_requested_expires_in <= server_expires_in) ? client_requested_expires_in : server_expires_in\n else\n expires_in = nil\n end\n @access_token = AccessToken.find_or_create_for(application: client.application, resource_owner: resource_owner, scopes: scopes, expires_in: expires_in, use_refresh_token: configuration.refresh_token_enabled?)\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def fetch_access_token\n client.unauthenticated_request(:POST, '/v1/security/oauth2/token',\n grant_type: 'client_credentials',\n client_id: client.client_id,\n client_secret: client.client_secret)\n end",
"def create_user_token(username, password)\n body = {\n grant_type: 'password',\n username: username,\n password: password\n }\n @client.post('/auth/oauth2/token', body, {}, {'Content-Type' => 'application/x-www-form-urlencoded'})\n end",
"def create\n require 'digest/sha1'\n \n @access_token = AccessToken.new\n @access_token.user_id = current_user.id\n @access_token.last_access = Time.now\n @access_token.token = Digest::SHA1.hexdigest Time.now.to_s\n @access_token.active = true\n \n respond_to do |format|\n if @access_token.save\n format.html { redirect_to(@access_token, :notice => 'Access token was successfully created.') }\n format.xml { render :xml => @access_token, :status => :created, :location => @access_token }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @access_token.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def access_token\n @access_token ||= begin\n if oauth_options[:oauth_verifier]\n request_token.get_access_token(:oauth_verifier => oauth_options[:oauth_verifier])\n else\n request_token.get_access_token\n end\n end\n end",
"def create_session\n raw_token, enc_token = account.create_session(ip, meta_info)\n set_account_cache(account, raw_token)\n set_auth_token_cache(enc_token, raw_token)\n return raw_token\n end",
"def authentication_token\n generate_token(:authentication_token)\n end",
"def get_access_token(options={})\n response=consumer.token_request(consumer.http_method,(consumer.access_token_url? ? consumer.access_token_url : consumer.access_token_path),self,options)\n OAuth::AccessToken.new(consumer,response[:oauth_token],response[:oauth_token_secret])\n end",
"def authenticate\n Access.new(\n 'access_token' => access_token,\n 'token_type' => token_type,\n 'expires_in' => 1 << (1.size * 8 - 2) - 1 # Max int value\n )\n end",
"def access_token\n User.create_access_token(self)\n end",
"def grab_token(username, password)\n cmd = `curl -X POST -H \"Content-Type: application/json\" -d '{\"email\":\"#{username}\",\"password\":\"#{password}\"}' #{ENV[\"FDA_REST_ENDPOINT\"]}/login --insecure -s`\n return cmd\n end",
"def authenticate\n # if valid_access_token?\n # fetch_access_token\n # else\n get_new_access_token\n # end\n end",
"def create\n client.authorization_code = params[:code]\n access_token = client.access_token!\n puts access_token\n end",
"def get_access_token\n response = RestClient.post(\"#{API_URL}/authentication/v1/authenticate\",\n { client_id: Rails.application.secrets.FORGE_CLIENT_ID,\n client_secret: Rails.application.secrets.FORGE_CLIENT_SECRET,\n grant_type:'client_credentials',scope:'data:read data:write bucket:create'\n \n })\n return JSON.parse(response.body)['access_token']\n end",
"def authenticate\n response = post('login')\n @access_token = response['access-token']\n @client_id = response['client-id']\n end",
"def authorize_token(attribs={})\n params = parse_request_params(attribs)\n parsed, creds = request(:post, resource_path+'/authorize', params)\n self.class.factory(parsed, creds)\n end",
"def access_token\n return nil unless (temp_access_token = read_attribute(:access_token))\n # logger.debug2 \"temp_access_token = #{temp_access_token}\"\n encrypt_remove_pre_and_postfix(temp_access_token, 'access_token', 43)\n end",
"def access_token\n return nil unless (temp_access_token = read_attribute(:access_token))\n # logger.debug2 \"temp_access_token = #{temp_access_token}\"\n encrypt_remove_pre_and_postfix(temp_access_token, 'access_token', 43)\n end",
"def personal_access_token # :yields: String\n @@token\n end",
"def token_auth(*args, &block); end",
"def request_oauth_token\n request_token_hash = {\n \"oauth_consumer_key\" => \"#{@consumer_key}\",\n \"oauth_signature_method\" => \"HMAC-SHA1\",\n \"oauth_timestamp\" => timestamp,\n \"oauth_nonce\" => nonce,\n \"oauth_version\" => \"1.0\",\n \"oauth_callback\" => \"oob\",\n }\n\n # set signature\n request_token_hash[\"oauth_signature\"] = generate_oauth_signature(generate_signature_base_string(\"POST\", @request_token_url, request_token_hash))\n\n # post with auth header\n result = MyHttp.post(@request_token_url, nil, {\n \"Authorization\" => \"OAuth #{generate_auth_header(request_token_hash)}\",\n })\n\n auth_token_string = result.body.strip\n if result.is_a? Net::HTTPSuccess\n return string_param_to_hash(auth_token_string)\n else\n status = result.code\n return nil\n end\n end",
"def create_token_with_http_info(token_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApplicationManagementApi.create_token ...'\n end\n # verify the required parameter 'token_request' is set\n if @api_client.config.client_side_validation && token_request.nil?\n fail ArgumentError, \"Missing the required parameter 'token_request' when calling ApplicationManagementApi.create_token\"\n end\n # resource path\n local_var_path = '/appManagement/token'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(token_request)\n auth_names = ['APP_NORMAL']\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 => 'StringResultSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ApplicationManagementApi#create_token\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def authenticate\n\t\tusername = \"[email protected]\" \n\t\tpassword = \"1234\"\n\t\t\n\t\toauth = 'http://localhost:9001/rest/oauth/token?client_id=mobile_android&client_secret=secret&grant_type=password&username=' + username + '&password=' + password\n\t\tclient = RestClient::Resource.new(oauth,:verify_ssl => OpenSSL::SSL::VERIFY_NONE)\n\t\tresponse = client.get();\n\t\t@doc = Nokogiri::XML(response)\n\t\ttoken = \"Bearer \" + @doc.at_css(\"access__token\").content\n\n\tend",
"def create_token\n return api_call('request-token',{\"apiKey\"=> @@_api_key });\n end",
"def get_authorization()\n data = {\n api_secret: @apiSecret,\n device_secret: @deviceSecret\n }\n response = @httpHelper.post_data( 'token', data )\n response[:device_secret] ||= '';\n @applicationToken = response[:application_token]\n return response\n end",
"def http_auth_token\n\n @http_auth_token ||= if request.headers.present?\n request.headers[\"HTTP_AUTH_TOKEN\"]\n end\n end",
"def access_token\n end",
"def auth_token(opts = {})\n get_config_auth_token() || create_authorization(opts)\n end",
"def get_access_token\n\t\t\tif @access_token.nil?\n\t\t\t\t# do we have it cached on disk?\n\t\t\t\ttmp_file = get_access_token_file\n\n\t\t\t\tif File.exist? tmp_file\n\t\t\t\t\[email protected] 'Fetching cached auth token from disk'\n\t\t\t\t\tset_access_token(File.read(tmp_file).strip)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# try again, get a fresh token\n\t\t\tif @access_token.nil?\n\t\t\t\turi = URI(\"https://#{@club_name}.tidyclub.com/oauth/token\")\n\t\t\t\[email protected] \"Fetching a fresh token from #{uri}\"\n\t\t\t\thttps = Net::HTTP.new(uri.host, uri.port)\n\t\t\t\thttps.use_ssl = true\n\t\t\t\tpayload = {\n\t\t\t\t\t\tclient_id: client_id,\n\t\t\t\t\t\tclient_secret: client_secret,\n\t\t\t\t\t\tusername: user_name,\n\t\t\t\t\t\tpassword: password,\n\t\t\t\t\t\tgrant_type: 'password'\n\t\t\t\t}\n\t\t\t\trequest = Net::HTTP::Post.new(uri.path)\n\n\t\t\t\trequest.set_form_data payload\n\t\t\t\tresponse = https.request(request)\n\n\t\t\t\tif response.content_type != 'application/json'\n\t\t\t\t\tmsg = \"Expecting a JSON response, got a response type of '#{response.content_type}' instead\"\n\t\t\t\t\[email protected] msg\n\t\t\t\t\traise TidyClub::ApiCallBad, msg\n\t\t\t\tend\n\n\t\t\t\tif response.code.to_i == 200\n\t\t\t\t\tr = JSON.parse response.body\n\t\t\t\t\tset_access_token r['access_token']\n\t\t\t\telse\n\t\t\t\t\tmsg = \"Authentication Failed - response code was: #{response.code} - #{response.message}\"\n\t\t\t\t\[email protected] msg\n\t\t\t\t\traise TidyClub::ApiCallBad, msg\n\t\t\t\tend\n\t\t\tend\n\t\t\t@access_token = nil if @access_token == ''\n\n\t\t\tif @access_token.nil?\n\t\t\t\tmsg = 'There is no valid access token'\n\t\t\t\[email protected] msg\n\t\t\t\traise AuthenticationError, msg\n\t\t\tend\n\n\t\t\t@access_token\n\t\tend"
] | [
"0.75740784",
"0.74791986",
"0.7260952",
"0.7062508",
"0.70146096",
"0.70033944",
"0.69514394",
"0.69514394",
"0.69514394",
"0.69514394",
"0.69514394",
"0.69514394",
"0.69514394",
"0.69514394",
"0.69514394",
"0.69514394",
"0.69514394",
"0.69514394",
"0.69514394",
"0.69514394",
"0.69510967",
"0.69135576",
"0.68732226",
"0.67969185",
"0.6765464",
"0.67485076",
"0.6736877",
"0.6736448",
"0.67301005",
"0.66532165",
"0.6647403",
"0.6647403",
"0.66125697",
"0.6604985",
"0.65803415",
"0.655096",
"0.65270114",
"0.65198874",
"0.64939356",
"0.64930606",
"0.6493029",
"0.64848745",
"0.6477467",
"0.64515525",
"0.6428406",
"0.6397689",
"0.6379905",
"0.6377565",
"0.63758487",
"0.63731325",
"0.6364812",
"0.6359303",
"0.6348047",
"0.63358617",
"0.63358617",
"0.63358617",
"0.6334718",
"0.6334587",
"0.6333597",
"0.6328289",
"0.6321459",
"0.63185906",
"0.6317431",
"0.6296087",
"0.62794703",
"0.62749445",
"0.626244",
"0.62601423",
"0.6259772",
"0.6254021",
"0.6251844",
"0.6241001",
"0.6241001",
"0.62320405",
"0.62262136",
"0.62154657",
"0.6209497",
"0.62030417",
"0.61975914",
"0.6184919",
"0.61789435",
"0.6176362",
"0.61754024",
"0.6164861",
"0.615824",
"0.615144",
"0.6150607",
"0.61493075",
"0.6148218",
"0.6148218",
"0.6145499",
"0.61364937",
"0.6134484",
"0.61296237",
"0.6129028",
"0.61286384",
"0.61274743",
"0.6119763",
"0.6104217",
"0.6102779",
"0.6099086"
] | 0.0 | -1 |
Returns the list of all available access tokens. | def list_access_tokens
client.make_request('/list-access-tokens', 'post', params: {})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @access_tokens = page(access_token_list)\n end",
"def valid_tokens\n clear_expired_tokens\n access_tokens.pluck(:token)\n end",
"def get_tokens\n\t\tresource = \"/oauth/access_token\"\n\t\t\n\t\tbegin\n\t\t\tresponse = @connection.post resource do |request|\n\t\t\t\trequest.params['client_id'] = @api_key\n\t\t\t\trequest.params['client_secret'] = @secret_key\n\t\t\t\trequest.params['grant_type'] = @grant_type\n\t\t\t\trequest.params['scope'] = @scope\n\t\t\tend\n\t\t\t\n\t\t\tresult = process_response(response)\n\t\t\t\n\t\t\tif result[:access_token].nil? || result[:refresh_token].nil?\n\t\t\t\traise RuntimeError, \"Unable to complete oauth: #{response[:error]}\"\n\t\t\telse \n\t\t\t\t@access_token = result[:access_token]\n\t\t\t\t@refresh_token = result[:refresh_token]\n\t\t\tend\n\t\trescue => e\n\t\t\traise RuntimeError, e.to_s\n\t\tend\n\tend",
"def api_tokens\n ApiToken.all(self)\n end",
"def get_tokens\n resource = \"/oauth/access_token\"\n\n begin\n response = @connection.post resource do |request|\n request.params['client_id'] = @api_key\n request.params['client_secret'] = @secret_key\n request.params['grant_type'] = @grant_type\n request.params['scope'] = 'SPEECH,STTC,TTS'\n end\n\n result = process_response(response)\n\n if result[:access_token].nil? || result[:refresh_token].nil?\n raise RuntimeError, \"Unable to complete oauth: #{response[:error]}\"\n else\n @access_token = result[:access_token]\n @refresh_token = result[:refresh_token]\n end\n rescue => e\n raise RuntimeError, e.to_s\n end\n end",
"def fetchTokens\n self.class.request.get \"#{id}/tokens\" \n end",
"def listtokens(session)\n\tbegin\n\t\tprint_status(\"Getting Tokens...\")\n\t\tdt = ''\n\t\tsession.core.use(\"incognito\")\n\t\ti = 0\n\t\tdt << \"****************************\\n\"\n\t\tdt << \" List of Available Tokens\\n\"\n\t\tdt << \"****************************\\n\\n\"\n\t\twhile i < 2\n\t\t\ttokens = session.incognito.incognito_list_tokens(i)\n\t\t\tif i == 0\n\t\t\t\ttType = \"User\"\n\t\t\telse\n\t\t\t\ttType = \"Group\"\n\t\t\tend\n\t\t\tdt << \"#{tType} Delegation Tokens Available \\n\"\n\t\t\tdt << \"======================================== \\n\"\n\n\t\t\ttokens['delegation'].each_line{ |string|\n\t\t\t\tdt << string + \"\\n\"\n\t\t\t}\n\n\t\t\tdt << \"\\n\"\n\t\t\tdt << \"#{tType} Impersonation Tokens Available \\n\"\n\t\t\tdt << \"======================================== \\n\"\n\n\t\t\ttokens['impersonation'].each_line{ |string|\n\t\t\t\tdt << string + \"\\n\"\n\t\t\t}\n\t \t\ti += 1\n\t \t\tbreak if i == 2\n\t\tend\n\t\tprint_status(\"All tokens have been processed\")\n\trescue ::Exception => e\n\t\tprint_status(\"Error Getting Tokens: #{e.class} #{e}\")\n\tend\n\tdt\n\nend",
"def access_tokens(app_ids)\n endpoint = '/user/accessTokens'\n app_ids = app_ids.join(',') if app_ids.is_a?(Array)\n\n response = Client.execute(:get, endpoint, session, appIds: app_ids)\n response.dig(:user, :access_tokens).map do |access_token|\n OpenStruct.new(access_token)\n end\n end",
"def all_tokens\n token_array = []\n self.data.each do |token, count|\n\ttoken_array.push( token )\n end\n return token_array\n end",
"def index\n @access_tokens = AccessToken.all\n\n @oauth = oauth\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @access_tokens }\n end\n end",
"def get_list_acc\n JSON.parse(curl_get(\"accounts\").body_str)\n end",
"def list_of_accounts_online\n Stripe.api_key = Rails.application.credentials.stripe[Rails.env.to_sym][:secret_key]\n return Stripe::Account.list\n end",
"def index\n @globus_tokens = GlobusToken.all\n end",
"def get_tokens\n\t\treturn @tokens\n\tend",
"def list_access_list\n response = @connection.lbreq(\"GET\",@lbmgmthost,\"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@id.to_s)}/accesslist\",@lbmgmtport,@lbmgmtscheme,{})\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n JSON.parse(response.body)[\"accessList\"]\n end",
"def index\n @oauth_remote_access_tokens = User.current.oauth_remote_access_tokens.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @oauth_remote_access_tokens }\n end\n end",
"def list_tokens(login)\n raise ArgumentError, 'Missing required parameters' if login.nil?\n\n get('/api/user_tokens/search', query: { login: login })\n end",
"def index\n authorize TokenPermissionType\n @user = current_user\n @token_types = @user.org.token_permission_types\n end",
"def retrieve_tokens\n return false unless oauth_credentials_valid?(@current_user)\n\n tokens = OpenStruct.new(get_tokens(@current_user, 'watch'))\n @watch_token = tokens.action_token\n @access_token = tokens.access_token\n\n !(@watch_token.nil? || @access_token.nil?)\n end",
"def inactive_tokens\n client.get('/inactive_tokens')\n end",
"def get_all_tokens()\n return self.corpus.all_tokens\n end",
"def fetch_access_token\n uri = URI.parse Sendible::API::URL + \"/v1/auth?app_id=#{CGI.escape(Sendible.application_id)}&access_key=#{CGI.escape(access_key)}\"\n get = Net::HTTP::Get.new(uri.request_uri)\n response = Net::HTTP.start(uri.host, uri.port) do |http|\n http.request(get)\n end\n response.body\n end",
"def list\n response = Tiptaplab.api.make_call(\"users/authorizations\")\n response.keys\n end",
"def for_client(client_id, offset = 0, limit = 100)\n if client = Client.find_by_id(client_id)\n client.access_tokens.offset(offset).limit(limit)\n else\n []\n end\n end",
"def tokens\n @tokens ||= []\n end",
"def get_access_token\n\t\treturn @credentials.get_access_token\n\tend",
"def tokens\n (@token.is_a? OAuth2::AccessToken) ? @token.to_hash : @token\n end",
"def access_token\n @access_token\n end",
"def index\n @apn_tokens = ApnToken.all.order(\"created_at desc\")\n end",
"def token\n @access_token.token\n end",
"def apps_permissions_scopes_list\n return {} unless is_app_token?\n semaphore.synchronize {\n @apps_permissions_scopes_list ||= (\n r = get('/api/apps.permissions.scopes.list').parsed\n r['scopes'] || {}\n )\n }\n end",
"def gen_tokens\n self.access_token = SecureRandom.hex(16)\n end",
"def refresh_tokens\n response = get(path: 'tokens')[\"data\"]\n token_array = response || {}\n tokens = {}\n token_array.each do |t|\n tokens[t.keys.first] = t.values.first\n end\n @tokens = tokens\n return tokens\n end",
"def get_all_valid_tokens(opts={})\n @token_types.map { |type| { type => get_valid_tokens(type, opts) } }\nend",
"def tokens\n return @tokens\n end",
"def index\n @connection_tokens = ConnectionToken.all\n end",
"def access_token\n @auth.access_token\n end",
"def list_tenants\n url = self.os_compute_url + '/' + 'tenants'\n res = self.rest_run(url, \"GET\", {}, self.os_token)\n return res[:parsed]\n end",
"def tokens\n @tokens ||= Array(grpc.tokens).map { |g| Token.from_grpc g }\n end",
"def index\n @oauth_accounts = OauthAccount.all\n end",
"def get_auth_tkt_token_list\n cookie_decoded = Base64.decode64(cookies[:auth_tkt])\n return cookie_decoded.split('!')[1]\n end",
"def get_access_tokens(account_number, page = 1, limit = 10)\r\n # the base uri for api requests\r\n query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n query_builder << '/accounts/{account_number}/access-tokens'\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n 'account_number' => account_number\r\n }\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\r\n 'page' => if page.nil? then 1 else page end,\r\n 'limit' => if limit.nil? then 10 else limit end\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'X-Auth-Token' => Configuration.x_auth_token\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.get query_url, headers: headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new 'You are not authenticated', 401, response.raw_body\r\n elsif response.code == 403\r\n raise APIException.new 'This action needs a valid WSSE header', 403, response.raw_body\r\n elsif response.code == 404\r\n raise APIException.new 'Resource not found', 404, response.raw_body\r\n elsif response.code == 400\r\n raise APIException.new 'Http bad request', 400, response.raw_body\r\n elsif !response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end",
"def accessible_scopes\n [uid, shared_space.try(:uid)].compact\n end",
"def access_token\n end",
"def index\n @access_controls = AccessControl.all\n end",
"def get_access_token! name = nil\n oauth_instance(name).get_access_token!(oauth_request_env)\n end",
"def index\n @users = User.all\n @tokens = Token.all\n end",
"def access_token\n @connection.access_token\n end",
"def index\n @guest_chat_tokens = GuestChatToken.all\n end",
"def obtain_tokens(fqdn, client_id, client_secret, scope, tokens_file)\n read_tokens(tokens_file)\n \n response = RestClient.post \"#{fqdn}/oauth/access_token\", :grant_type => 'client_credentials', :client_id => client_id, :client_secret => client_secret, :scope => scope\n\t\n from_json = JSON.parse(response.to_str)\n @access_token = from_json['access_token']\n @refresh_token = from_json['refresh_token']\n write_tokens(tokens_file)\nend",
"def get_access_tokens(authorization_grant_code)\n # headers = { 'Content-Type': 'application/x-www-form-urlencoded' } # turns out didn't need this\n params = {\n 'grant_type': 'authorization_code',\n 'access_type': 'offline',\n 'code': authorization_grant_code,\n 'client_id': client_id,\n 'redirect_uri': redirect_uri\n }\n response = HTTParty.post(\n 'https://api.tdameritrade.com/v1/oauth2/token',\n body: params\n )\n\n if response.status == 200\n @access_token = response[\"access_token\"]\n @refresh_token = response[\"refresh_token\"]\n end\n\n response\n end",
"def find_oauth_access_token\n end",
"def index\n @accesses = Access.all\n end",
"def index\n @accesses = Access.all\n end",
"def index\n @accesses = Access.all\n end",
"def index\n @accesses = Access.all\n end",
"def get_access_token_json\n HTTParty.post(get_request_access_token_url)\n end",
"def access_token\n @access_token ||= nil\n end",
"def get_access_token name = nil\n oauth_instance(name).get_access_token(oauth_request_env)\n end",
"def access_types\n @access_types ||= [ALL_ACCESS].tap do |types|\n types << PUBLIC_ACCESS if public?\n types << PROTECTED_ACCESS if protected?\n types << PRIVATE_ACCESS if private?\n types << DIGITIZED_ACCESS if digitized? && !private?\n end\n end",
"def fetch_access_token\n client.unauthenticated_request(:POST, '/v1/security/oauth2/token',\n grant_type: 'client_credentials',\n client_id: client.client_id,\n client_secret: client.client_secret)\n end",
"def refresh_tokens\n @token = @token.refresh!\n tokens\n end",
"def all\n @dealing_platform.gather 'accounts', :accounts, Account\n end",
"def personal_access_token # :yields: String\n @@token\n end",
"def list(options = {})\n @raw = send_get_request(@conn_no_err, ['/v1/acl/list'], options)\n parse_body\n end",
"def request_tokens\n code, session_state = request_code\n params = build_token_credentials(code, session_state)\n send_token_request(params)\n end",
"def ransackable_scopes(auth_object = nil)\n []\n end",
"def get_tokens(options = {})\n submit GetTokens.new(options)\n end",
"def list_access_keys(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'ListAccessKeys'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :user_name\n\t\t\targs[:query]['UserName'] = optional[:user_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def index\n @oauth_tokens = OauthToken.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @oauth_tokens }\n end\n end",
"def scopes_for(token)\n token = token.github_oauth_token if token.respond_to? :github_oauth_token\n scopes = GH.with(token: token.to_s) { GH.head('user') }.headers['x-oauth-scopes'] if token.present?\n scopes &&= scopes.gsub(/\\s/,'').split(',')\n Array(scopes).sort\n rescue GH::Error\n []\n end",
"def index\n @early_access_requests = EarlyAccessRequest.all\n end",
"def list_accounts\n HTTP.headers(:accept => @@accept).basic_auth(:user => ENV[\"API_USERNAME\"], :pass => ENV[\"API_PASSWORD\"])\n .get(\"#{@@base_url}/users/#{self.guid}/accounts\").parse[\"accounts\"]\n end",
"def get_access_token\n raise HyvesException, 'You need an request token to make get an access token' if request_token.nil?\n @access_token = request_token.get_access_token\n\n @userid = request_token.response[\"userid\"]\n @expiredate = Time.at(request_token.response[\"expiredate\"].to_i) if not request_token.response[\"expiredate\"].nil?\n\n @access_token\n end",
"def keys\n authorized_keys = []\n if team.present?\n log \"Got Github Team '#{team.name}' for Org '#{@org}'\"\n\n members = team_members(team.id)\n\n members.each do |member|\n log(\"Getting Member...#{member.login}\")\n\n keys = keys_for(member.login)\n\n # Can't get the real email address without logging in as that user\n email = \"#{member.login}@github.com\"\n\n keys.each do |key|\n authorized_keys << [key[:key], email]\n end\n end\n else\n log(\"No '#{@team_name}' team for '#{@org}' found\")\n log(teams.inspect)\n end\n authorized_keys\n end",
"def access_token\n refresh! if access_token_expires_at&.<= Time.now + 60 # time drift margin\n @access_token\n end",
"def get_access_token(request_tken=nil,params={})\n if @request_token != nil\n request_tken=@request_token\n end\n @myspacecontext.get_access_token(request_tken,params)\n end",
"def session_tokens\n @data[:session_tokens]\n end",
"def tenant_list\n\t\t\n\t\tget_call = Curl::Easy.http_get(\"#{@ip_address}:#{@port_2}/v2.0/tenants\"\n\t\t) do |curl| curl.headers['x-auth-token'] = @token end\n\t\t\n\t\tputs \"invoking tenant-list...\"\n\t\t\n\t\tparsed_json = JSON.parse(get_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend",
"def access_token\n @data[:access_token]\n end",
"def access_token\n @config[\"token\"]\n end",
"def index\n @scopes = Scope.all\n end",
"def get_access_token\n return @access_token if authorized?\n\n if @request_token.nil?\n raise DropboxAuthError.new(\"No request token. You must set this or get an authorize url first.\")\n end\n\n @access_token = get_token(\"/access_token\", @request_token, \"Couldn't get access token.\")\n end",
"def index\n @scopes = Scope.all.page(params[:page]).per(20)\n end",
"def index\n @access_codes = AccessCode.all\n end",
"def getToken\n @tokens\n end",
"def generate_authentication_tokens\n self.client = Devise.friendly_token\n self.access_token = Devise.friendly_token\n end",
"def available_projects_list\n uri = \"#{@api_url}?access_token=#{@access_token}\"\n get uri\n end",
"def tokens\n self.entries\n end",
"def page access tokens_connections\n end",
"def access_token\n @rubytter.instance_variable_get(:@access_token)\n end",
"def generate_access_token\n begin\n self.access_token = User.new_token\n end while ApiKey.exists?(access_token: access_token)\n end",
"def index\n @authorizedusers = Authorizeduser.all\n end",
"def get_authorization_list(local_id=nil)\n soap_response = client.request :get_authorization_list do\n soap.header = soap_header\n soap.body = {\"localID\" => local_id} if local_id\n end\n\n @last_request = client.http\n @last_response = soap_response\n end",
"def index \n @tokens = @user.tokens\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tokens }\n end\n end",
"def access_token; self; end",
"def index\n\t @authentications = current_user.authentications.order('provider asc')\n\t end",
"def available_scopes\n (default_scopes << Doorkeeper.config.optional_scopes.to_a).flatten.uniq\n end",
"def get_account_quotas()\n session_url = '/sessions?page=0&pageSize=1'\n response = self.class.get(session_url, @options)\n response.headers.select { |k, _v| k.to_s.start_with? 'nexosis-account' }\n end",
"def auth_bearer\n response = HTTParty.get(\"https://login.microsoftonline.com\" + \"/#{MyAzure.get_tenant_id}/oauth2/token\", {\n body: \"grant_type=client_credentials&client_id=#{MyAzure.get_client_id}\"+\n \"&client_secret=#{MyAzure.get_client_secret}\"+\n \"&resource=https%3A%2F%2Fmanagement.azure.com%2F\"+\n \"&Content-Type=application/x-www-form-urlencoded\"\n })\n\n parsed_json = JSON.parse response.read_body\n return parsed_json[\"access_token\"]\n end"
] | [
"0.7392675",
"0.6893904",
"0.6773382",
"0.669384",
"0.6585153",
"0.65119535",
"0.6448822",
"0.6425449",
"0.63602126",
"0.6318597",
"0.6135279",
"0.6128645",
"0.6058802",
"0.60582036",
"0.6054884",
"0.60374075",
"0.60346556",
"0.5980881",
"0.5964618",
"0.5947014",
"0.59435785",
"0.593903",
"0.5938312",
"0.591913",
"0.5879262",
"0.5854002",
"0.58518136",
"0.5818975",
"0.58169955",
"0.57968175",
"0.578286",
"0.57494694",
"0.574159",
"0.57398796",
"0.57336015",
"0.5732212",
"0.57253784",
"0.57227176",
"0.57155895",
"0.5696111",
"0.5689985",
"0.567608",
"0.5662064",
"0.5655221",
"0.5652441",
"0.56322587",
"0.5631601",
"0.56308776",
"0.56247383",
"0.56242913",
"0.56167996",
"0.56125516",
"0.5599468",
"0.5599468",
"0.5599468",
"0.5599468",
"0.55904",
"0.5569153",
"0.55673486",
"0.55581206",
"0.554996",
"0.5543445",
"0.5539535",
"0.5536865",
"0.55333817",
"0.5518026",
"0.5516408",
"0.5515537",
"0.5496378",
"0.5496241",
"0.5480067",
"0.5478593",
"0.54596937",
"0.5451436",
"0.5432561",
"0.54321736",
"0.5426257",
"0.54160696",
"0.541471",
"0.5412723",
"0.54065764",
"0.5393181",
"0.5390699",
"0.53884506",
"0.53730464",
"0.53663087",
"0.53543544",
"0.53523856",
"0.5344649",
"0.5343074",
"0.53400135",
"0.533977",
"0.5336375",
"0.5331037",
"0.53304696",
"0.53297216",
"0.5326161",
"0.53208256",
"0.5318155",
"0.53180385"
] | 0.838271 | 0 |
Delete existed access token. | def delete_access_token(id:)
client.make_request('/delete-access-token', 'post', params: {id: id})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy_current_access_token\n AccessToken.find(current_access_token_id).destroy\n end",
"def delete_access_token(access_token_id)\n @redis.del(auth_domain_key(access_token_id))\n end",
"def destroy\n @access_token = AccessToken.find(params[:id])\n @access_token.destroy\n\n respond_to do |format|\n format.html { redirect_to(access_tokens_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @access_token = AccessToken.find(params[:id])\n @access_token.destroy\n\n respond_to do |format|\n format.html { redirect_to access_tokens_url }\n format.json { head :no_content }\n end\n end",
"def delete_existing_access_token_if_exists\n if existing_token = OauthRemoteAccessToken.find(:first, :conditions => ['oauth_remote_service_provider_id = ? AND user_id = ?',\n self.oauth_remote_service_provider_id, \n self.user_id])\n existing_token.destroy\n end\n return true\n end",
"def revoke\n oauth_access_token.revoke\n head :ok\n end",
"def delete_access_token(account_number, token)\r\n # the base uri for api requests\r\n query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n query_builder << '/accounts/{account_number}/access-tokens/{token}'\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n 'account_number' => account_number,\r\n 'token' => token\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'X-Auth-Token' => Configuration.x_auth_token\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.delete query_url, headers: headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new 'You are not authenticated', 401, response.raw_body\r\n elsif response.code == 403\r\n raise APIException.new 'This action needs a valid WSSE header', 403, response.raw_body\r\n elsif response.code == 404\r\n raise APIException.new 'Resource not found', 404, response.raw_body\r\n elsif response.code == 400\r\n raise APIException.new 'Http bad request', 400, response.raw_body\r\n elsif !response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end",
"def delete\n client.delete_access_key(resource_options)\n nil\n end",
"def delete_apn_token\n if params[:id] == current_user.id.to_s\n # A user can delete tokens for themself\n @user = current_user\n return render_error(500, \"must specify a token to remove\") unless token = params.delete(:token)\n\n # remove the token from the user's collection\n @user.pull(:bh => token)\n\n @status = 200\n else\n @status = 401\n end\n end",
"def nuke_auth_token\n\t\t\tfile = get_access_token_file\n\t\t\[email protected] \"Removing persisted access token: #{file}\"\n\t\t\tFile.delete file\n\t\t\tset_access_token(nil)\n\t\t\tset_auth_header ''\n\t\tend",
"def delete_token(token)\n delete token_path(token)\n end",
"def destroy\n @model.destroy\n respond_to do |format|\n format.html { redirect_to access_tokens_url, notice: 'Access token was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_token(token = nil)\n token = token || settings.token\n delete \"authToken/#{token.to_s}\"\n end",
"def destroy\n # Delete the user access tokens on logout\n User.find(session[:user_id]).delete\n # Delete the session as well\n session = {}\n \n redirect_to root_path\n end",
"def destroy\n @oauth_token = OauthToken.find(params[:id])\n @oauth_token.destroy\n\n respond_to do |format|\n format.html { redirect_to(scaffold_oauth_tokens_url) }\n format.xml { head :ok }\n end\n end",
"def clear_expired_tokens\n access_tokens.where(\"token_expire < ?\", Time.now).destroy_all\n end",
"def clear_expired_tokens\n access_tokens.where(\"token_expire < ?\", Time.now).destroy_all\n end",
"def destroy\n\n api_key = ApiKey.where(access_token: token).first\n\n api_key.access_token = ''\n api_key.expires_at = Time.now\n\n if api_key.save\n render json: {}, status: 200\n else\n render json: {}, status: 422\n end\n end",
"def teardown\n client.item.remove(access_token) if access_token\n end",
"def destroy\n @token.destroy\n\n head :no_content\n end",
"def delete_item(access_token)\n @client.item.remove(access_token)\n end",
"def delete\n decoded_access_token = JWT.decode(params[:accessToken], 's3cr3t', true, algorithm: 'HS256')\n decoded_refresh_token = JWT.decode(params[:refreshToken], 's3cr3t', true, algorithm: 'HS256')\n # Check if token was decoded\n if decoded_access_token && decoded_refresh_token\n @user = User.find_by(id: decoded_access_token[0]['user_id'])\n if @user # user exists\n Blacklist.find_by(jwt: params[:accessToken]).delete\n Blacklist.find_by(jwt: params[:refreshToken]).delete\n User.find_by(id: @user.id).delete\n render json: {status: \"User was succesfully deleted\"}\n else\n render json: {error: \"Invalid User\"}\n end\n else # token is null\n render json: {error: \"Invalid Tokens\"}\n end\n end",
"def destroy\n @oauth_remote_access_token = OauthRemoteAccessToken.find(params[:id])\n @oauth_remote_access_token.destroy\n\n respond_to do |format|\n format.html { redirect_to(oauth_remote_access_tokens_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @token = @user.tokens.find(params[:id])\n @user.tokens.delete(@token)\n @user.save\n\n respond_to do |format|\n format.html { redirect_to user_tokens_url }\n format.json { head :no_content }\n end\n end",
"def delete(url, params)\n params = convert_hash_keys(params)\n @access_token = params.delete('access_token') if params['access_token']\n return connection.delete(url)\n end",
"def destroy\n @apn_token.destroy\n respond_to do |format|\n format.html { redirect_to apn_tokens_url, notice: 'Apn token was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_token = ApiToken.find(params[:id])\n \n @api_token.destroy unless @api_token.user_id != current_user.id\n\n respond_to do |format|\n format.html { redirect_to(api_tokens_url) }\n format.xml { head :ok }\n end\n end",
"def revoke_oauth_token\n current_user.revoke_token\n end",
"def destroy\n delete(\"/2.0/oauth_providers/#@consumer_key\")['success']\n end",
"def destroy\n @token = Token.find(params[:id])\n @token.destroy\n\n head :no_content\n end",
"def delete\n response = client.access_token.delete(\"#{client.base_uri}/projects/#{@project_id}/todos/#{id}.json\")\n true\n rescue OAuth2::Error => ex\n Basecamp::Error.new(ex.message).raise_exception\n end",
"def delete\n self.class.delete_payment_token_by_id(self.id)\n end",
"def destroy\n @facebook_token.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete(path, data = {})\n self.class.delete path, :body => data.merge(:u => access_token)\n end",
"def fb_access_token_expired\n self.access_token = nil\n save!\n end",
"def delete\n request('delete').auth_required!\n end",
"def revoke(access)\n token =\n if access.is_a?(String)\n access\n elsif access.respond_to?(:refresh_token)\n access.refresh_token\n else\n access.access_token\n end\n post('/api/v1/revoke_token', token: token)\n end",
"def destroy\n @token = Token.find(params[:id])\n @token.destroy\n \n respond_to do |format|\n format.html { redirect_to tokens_url }\n format.json { head :ok }\n end\n end",
"def renew_access_token!\n @access_token = nil\n true\n end",
"def delete(token)\n @store.delete(key_for(token))\n end",
"def destroy\n @token.destroy\n respond_to do |format|\n format.html { redirect_to admin_tokens_url, notice: 'Token was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_credit_card_token token\n request :delete, \"/merchant/#{merchant_id}/token/#{token}\"\n end",
"def flush_namespaced_access_tokens\n return 0 unless namespace\n tokens = RefreshToken.all(namespace, store)\n tokens.each do |token|\n AccessToken.destroy(token.access_uid, store)\n # unlink refresh token from the current access token\n token.update(0, 0, token.csrf)\n end.count\n end",
"def revoke_access!(remove_refresh_token = false)\n token_type = remove_refresh_token ? :refresh_token : :access_token\n token = access.send(token_type)\n @access = nil\n reset_connection!\n auth_connection.post(\n \"/api/v1/revoke_token\",\n token: token,\n token_type_hint: token_type\n )\n end",
"def delete operation, *args\n request(args) do |attrs, headers|\n @oauth_access_token.send(:delete, \"/#{API_VERSION}/#{operation}.#{API_FORMAT}\", headers)\n end\n end",
"def destroy\n @access.destroy\n end",
"def revoke_access_token\n\t\t\tif session[:token]\n\t\t\t\t# Use either the refresh or access token to revoke if present.\n\t\t\t\ttoken = session[:token].to_hash[:refresh_token]\n\t\t\t\ttoken = session[:token].to_hash[:access_token] unless token\n\n\t\t\t\t# You could reset the state at this point, but as-is it will still stay unique\n\t\t\t\t# to this user and we're avoiding resetting the client state.\n\t\t\t\tsession.delete(:state)\n\t\t\t\tsession.delete(:token)\n\n\t\t\t\t# Send the revocation request and return the result.\n\t\t\t\trevokePath = 'https://accounts.google.com/o/oauth2/revoke?token=' + token\n\t\t\t\turi = URI.parse revokePath\n\t\t\t\trequest = Net::HTTP.new uri.host, uri.port\n\t\t\t\trequest.use_ssl = true\n\t\t\t\trequest.get uri.request_uri\n\t\t\tend\n\t\tend",
"def destroy\n current_user.remove_token\n render json: { status: :success, data: 'Successfully signed out' }\n end",
"def delete_token(filename)\n begin\n File.delete(File.join(@token_folder, filename))\n rescue => e\n @logger.error \"Error deleting token file for VM #{vm_id}\"\n @logger.error e.message\n end\n end",
"def destroy\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n @resource.destroy\n head :no_content\n end",
"def delete_cookie\n cookies.delete :auth_token\n end",
"def delete_token(filename)\n begin\n File.delete(File.join(@token_folder, filename))\n rescue StandardError => e\n @logger.error \"Error deleting token file for VM #{vm_id}\"\n @logger.error e.message\n end\n end",
"def destroy\n @access = Access.find(params[:id])\n @access.destroy\n redirect_to accesses_url\n end",
"def delete_by_id(id)\n delete_payment_token_by_id(id)\n end",
"def destroy\n @access.destroy\n respond_to do |format|\n format.html { redirect_to accesses_url }\n format.json { head :no_content }\n end\n end",
"def delete\n user = getUserByAuthToken(request)\n user.soft_delete\n head :no_content\n end",
"def destroy\n destroy = REDIS_LOGIN.del(\"token:#{headers[\"Access-Token\"]}\")\n if destroy == 1\n render json: { status: \"Logged out\" }, status: 200\n else\n render json: { error: \"Trouble logging out. Make sure the user isn't already logged out\" }, status: 200\n end\n end",
"def destroy\n\t\tcookies.delete(:auth_token)\n\t\tredirect_to root_url\n\tend",
"def destroy\n @user_token = UserToken.find(params[:id])\n @user_token.destroy\n\n respond_to do |format|\n format.html { redirect_to user_tokens_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @access_code.destroy\n respond_to do |format|\n format.html { redirect_to access_codes_url, notice: 'Access code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n token = existing_payload[:token]\n\n checkin_params = { token: token, return_to: cdl_checkin_success_iiif_auth_api_url(params[:id]) }\n redirect_to \"#{Settings.cdl.url}/checkin?#{checkin_params.to_param}\"\n end",
"def revoke_token\n raise 'To be implemented in child classes'\n end",
"def destroy_omniauth\n organization = Maestrano::Connector::Rails::Organization.find_by_id(params[:organization_id])\n if organization && is_admin?(current_user, organization)\n organization.oauth_uid = nil\n organization.oauth_token = nil\n organization.refresh_token = nil\n organization.sync_enabled = false\n organization.save\n end\n\n redirect_to root_url\n end",
"def destroy\n @valid_access.destroy\n respond_to do |format|\n format.html { redirect_to valid_accesses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t\t\tcurrent_user.reset_authentication_token!\n\t\t\t\trender_success\n\t\t\tend",
"def remove_token\n update(token: nil)\n end",
"def destroy\n @access.destroy\n respond_to do |format|\n format.html { redirect_to accesses_url, notice: 'Access was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @access.destroy\n respond_to do |format|\n format.html { redirect_to accesses_url, notice: \"Access was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def refresh_access_token()\n\n\t\tif(Time.now - @start_time) >=3000\n\t\t\tputs \"Access Token Expired .......Creating a new one\"\n\t\t\t@access_token = @new_token.get_access_token\n\t\t\t@start_time = Time.now\n\t\tend\n\tend",
"def delete\n resp = if token.present?\n chip_client.delete(token:)\n else\n Faraday::Response.new(body: check_in.unauthorized_message.to_json, status: 401)\n end\n response.build(response: resp).handle\n end",
"def revoke_token(refresh_token_or_access_token)\n data = { \"token\" => refresh_token_or_access_token }\n query_api(\"/auth/revoke?\" + URI.encode_www_form(data))\n return nil\n end",
"def revoke_token(refresh_token_or_access_token)\n data = { \"token\" => refresh_token_or_access_token }\n query_api(\"/auth/revoke?\" + URI.encode_www_form(data))\n return nil\n end",
"def refresh_access_token!\n @access_token = access_token.refresh!\n end",
"def remove_ebay_auth_token(user_id,ebay_uid)\n begin\n ebay_token=EbayAuthToken.find_by_user_id_and_ebay_uid(user_id,ebay_uid)\n ebay_token.destroy\n rescue Exception => e\n loggr.info e.message\n end\n end",
"def purge_old_tokens\n auth_tokens.desc(:last_used_at).offset(20).destroy_all\n end",
"def sign_out\n token = AccessToken.find_by(access_token: @token)\n token.destroy unless token.nil?\n msg = { status: STATUS_SUCCESS, message: SUCCESS_MESSAGE }\n\n render json: msg\n end",
"def destroy\n result = access_token.delete(\"/api/v1/emails/#{params[:id]}\")\n display_api_response( result )\n respond_with(\"\",:location => :back)\n end",
"def destroy_access_check\n permission_check('destroy')\n end",
"def destroy_access_check\n permission_check('destroy')\n end",
"def destroy_access_check\n permission_check('destroy')\n end",
"def destroy\n @user=User.where(:authentication_token=>params[:api_key]).first\n @user.reset_authentication_token!\n render :json => { :message => [\"Session deleted.\"] }, :success => true, :status => :ok\n end",
"def delete_cookie(cookies)\n cookies.delete('token')\n @user.update(token: '')\n end",
"def delete_authorization(id)\n boolean_request :delete, \"/authorizations/#{id}\"\n end",
"def logout\n decoded_access_token = JWT.decode(params[:accessToken], 's3cr3t', true, algorithm: 'HS256')\n # Check if token was decoded\n if decoded_access_token\n @user = User.find_by(id: decoded_access_token[0]['user_id'])\n if @user # user exists\n # Invalidate their access token\n # Next time they try to access resources with their access token they will be denied\n Blacklist.find_by(jwt: params[:accessToken]).delete\n render json: {status: \"User was succesfully logged out\"}\n else\n render json: {error: \"Invalid User\"}\n end\n else # token is null\n render json: {error: \"Invalid Token\"}\n end\n end",
"def destroy\n # expire auth token \n\t @user=User.where(:authentication_token=>params[:api_key]).first\n\t if @user.present?\n\t #@user.reset_authentication_token!\n token = Devise.friendly_token[0,20]\n unless @user.authentication_token == token\n @user.update_attributes(:authentication_token => token)\n end\n\t render :json => { :message => [\"Session deleted.\"], :success => true, :status => :ok}\n\t else\n\t\t respond_to do |format|\n format.json{ render :json => { :error => \"Api key is invalid.\" }}\n end\n\t end\n end",
"def delete(path, params={}, args={})\n inject_token_auth_headers!(args)\n response = self.class.delete(request_url(path, params), args)\n update_token_auth_headers(response)\n return response\n end",
"def deletebookmark\n\t\t\t\tbookmark = Bookmark.find_by_id(params[:id])\n\t\t\t\tif bookmark.user_id == doorkeeper_token.resource_owner_id\n\t\t\t\t\tbookmark.destroy\n\t\t\t\t\thead :ok\n\t\t\t\telse\n\t\t\t\t\trender :status => 504\n\t\t\t\tend\n\t\t\tend",
"def reset\n session.delete(:access_token)\n session.delete(:refresh_token)\n redirect('/auth/gowalla')\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def revoke(access_token)\n option = {\n url: \"#{api_origin}/api/revoke\",\n header: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n Authorization: \"Bearer #{access_token}\",\n }\n }\n response = post(option)\n JSON.parse(response.body)\n end",
"def destroy\n @oauth_account.destroy\n respond_to do |format|\n format.html { redirect_to oauth_accounts_url, notice: 'Oauth account was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n current_user.deauthorize!\n head :ok\n end",
"def delete_account\n @connection.request({\n :method => 'DELETE'\n })\n end",
"def revoke_token\n request @google + '/accounts/AuthSubRevokeToken'\n\n @session_token = false\n end",
"def remove(access_token)\n post_with_auth 'item/remove',\n RemoveResponse,\n access_token: access_token\n end",
"def remove(access_token)\n post_with_auth 'item/remove',\n RemoveResponse,\n access_token: access_token\n end",
"def delete_account\n @connection.request({\n :method => 'DELETE'\n }) \n end"
] | [
"0.80021304",
"0.7944134",
"0.77474403",
"0.7735231",
"0.71775585",
"0.7082591",
"0.703241",
"0.7012576",
"0.6998853",
"0.69616264",
"0.6957224",
"0.6914664",
"0.6908975",
"0.68696594",
"0.6838973",
"0.68295693",
"0.68295693",
"0.680112",
"0.6782523",
"0.6763248",
"0.6686812",
"0.6634322",
"0.6620942",
"0.65386677",
"0.6521628",
"0.65155715",
"0.6475326",
"0.6464234",
"0.6452084",
"0.64409864",
"0.64053357",
"0.63929003",
"0.6374251",
"0.6371899",
"0.63329244",
"0.62871426",
"0.62851685",
"0.6265434",
"0.62627107",
"0.62510335",
"0.624203",
"0.62303996",
"0.6226653",
"0.6173594",
"0.6173018",
"0.61715883",
"0.61585075",
"0.6146702",
"0.6140133",
"0.61299604",
"0.6126298",
"0.61244565",
"0.6114059",
"0.6103619",
"0.60957474",
"0.6091711",
"0.6082205",
"0.60635287",
"0.6038127",
"0.6020678",
"0.6015383",
"0.6014134",
"0.6011024",
"0.6008751",
"0.6002034",
"0.5981076",
"0.59804535",
"0.5968714",
"0.5953382",
"0.5952508",
"0.59512424",
"0.59512424",
"0.5946366",
"0.593216",
"0.5913895",
"0.5904362",
"0.5894699",
"0.5874605",
"0.5874605",
"0.5874605",
"0.5856059",
"0.5854359",
"0.58510375",
"0.58456874",
"0.5837265",
"0.58361816",
"0.5829744",
"0.58272743",
"0.5825543",
"0.5825543",
"0.5825543",
"0.5825543",
"0.5825277",
"0.5819692",
"0.5814841",
"0.58043534",
"0.5799237",
"0.57874644",
"0.57874644",
"0.57802963"
] | 0.7877221 | 2 |
Check access token is valid. | def check_access_token(id: , secret:)
params = {
id: id,
secret: secret
}
client.make_request('/check-access-token', 'post', params: params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_access_token\r\n\t\t\t\ttoken = request.headers[\"X-Access-Token\"] || nil\r\n\t\t\t\t\r\n\t\t\t\tif token\r\n\t\t\t\t\tfind_token = ApiKey.find_by_access_token(token)\r\n\r\n\t\t\t\t\tif find_token.nil?\r\n\t\t\t\t\t\tinvalid_access_token\r\n\t\t\t\t\tend\r\n\t\t\t\telse\r\n\t\t\t\t\tinvalid_access_token\r\n\t\t\t\tend\r\n\t\t\tend",
"def valid_access_token?\n token_file = '/opt/gluu-server/etc/certs/api_token.json'\n return false unless File.exist? token_file\n\n token_config = JSON.parse(File.read(token_file))\n expired = token_config['exp'] < Time.now.to_i\n return false if expired\n\n return false unless token_config['token']\n\n true\n end",
"def valid_token\n return access_token if access_token && !expiring?\n return access_token if request_access_token\n raise 'No valid access token.'\n end",
"def valid_access_token\n self.access_token_expired? ? self.refresh_access_token! : self.access_token\n end",
"def valid_access_token\n self.access_token_expired? ? self.refresh_access_token : self.access_token\n end",
"def check_access_token(access_token)\n client = Octokit::Client.new(client_id: CLIENT_ID, client_secret: CLIENT_SECRET)\n begin\n client.check_application_authorization access_token\n true\n rescue\n false\n end\n end",
"def verify_access_token\n if bypass_auth?\n true\n else\n authenticate_or_request_with_http_token do |token, opts|\n current_user && token && current_user.access_token.token == token\n end\n end\n end",
"def fb_access_token_valid?\n if self.access_token.present? \n begin\n valid = self.fb_permissions.include?(:publish_actions)\n self.fb_access_token_expired unless valid\n\n valid\n rescue FbGraph::InvalidToken => ex\n self.fb_access_token_expired\n false\n end\n else \n false\n end\n end",
"def is_access_token_valid?\n response = @client.get(\"#{@base_url}/v1/users/self\", access_token: get_user_access_token )\n code_status = JSON.parse(response.body)[\"meta\"][\"code\"]\n code_status == 200 ? true : false\n end",
"def valid_app_access_token?\n token = request.headers['X-App-Access-Token']\n\n token.present? && token == Rails.application.secrets.app_access_token\n end",
"def valid_access_token\n\t\t\t\t# The token we have stored is expired - fetch a new one using the refresh token\n\t\t\t\tself.refresh_access_token if self.access_token_expired?\n\n\t\t\t\tself.access_token\n\t\t\tend",
"def valid_app_access_token?\n app_access_token = request.headers['X-App-Access-Token']\n\n app_access_token.present? &&\n app_access_token == Rails.application.secrets.app_access_token\n end",
"def require_access_token\n # make sure the request has been signed correctly\n verify_signature\n \n # NOTE make sure you define Controller#find_token which\n # returns an object that responds to the access_token? message\n # access_token? should return true if the token object is an AccessToken\n # it should return false if the token object is a RequestToken\n if !current_token.access_token?\n throw :halt, render(invalid_access_token_message, :status => 401, :layout => false)\n end\n end",
"def validate_access\n if !validate_token\n error_msg(ErrorCodes::UNAUTHORIZED, \"User not valid\")\n render_json\n end\n end",
"def verify_access_token\n \tuser = User.find_by(auth_token: params[:session][:auth_token])\n\n \tif user\n \t\trender text: \"verified\", status: 200\n \telse\n \t\trender text: \"Invalid token\", status: 422\n \tend\n end",
"def valid?\n return false if @access_token_url.nil?\n return false if @client_id.nil?\n return false if @client_secret.nil?\n return false if @token_api_authentication.nil?\n true\n end",
"def valid_for?(access_token)\n scopes.empty? || present_in?(access_token.scopes)\n end",
"def valid_token\n access_token = find_or_create_doorkeeper_access_token\n create_doorkeeper_access_token if access_token.expired? || access_token.revoked?\n access_token\n end",
"def client_has_valid_token?\n request.headers[\"Authorization\"] == Rails.application.credentials.guessing_access_token\n end",
"def validate_token(provided_token)\n clear_expired_tokens\n token_object = access_tokens.find_by_token(provided_token)\n return false if !token_object\n token_object.update_attribute(:token_expire, Time.now + DEFAULT_TOKEN_EXPIRE)\n true\n end",
"def authorization_token_valid?\n id = authorization_token_content.id\n\n return false if id.nil?\n\n user = User.find_by_id id\n\n !user.nil? && user.auth_token == authorization_token\n end",
"def is_valid?\n !(consumer_key.nil? || consumer_secret.nil? || access_token.nil? || access_token_secret.nil?)\n end",
"def valid_access_token(channel)\n Microsoft::RefreshOauthTokenService.new(channel: channel).access_token\n end",
"def valid_token?\n\t\tif self.moves_token.presence\n\t\t\tresponse = HTTParty.get('https://api.moves-app.com/oauth/v1/tokeninfo?access_token='+\n\t\t\t\tself.moves_token)\n\t\t\tputs \"response.code: #{response.code}\"\n\t\t\tresponse.code == 200\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def is_auth_valid?(user_id, access_token)\n user = User.find user_id\n\n return BCrypt::Password.new(user.access_token_hash).is_password?(access_token) &&\n user.access_token_expiry > Time.now.utc\n end",
"def check_validity\n if @expires_at == nil\n raise OAuthSessionError, \"Expiration not properly initialized.\"\n end\n if @expires_at < Time.new\n if not do_refresh\n raise OAuthSessionError, \"Token could not be refreshed.\"\n end\n end\n return true\n end",
"def verify_access_token(code, access_token)\n response = self.class.get('/debug_token', verify_query(code, access_token))\n # Something went wrong either wrong configuration or connection\n unless response.success?\n Rails.logger.error 'Omniauth::Facebook.get_access_token Failed'\n fail Omniauth::ResponseError, 'errors.auth.facebook.access_token'\n end\n response.parsed_response['data']['expires_at']\n end",
"def verify_access_token\n debugger\n @user = User.find_by(access_token: params[:session][:access_token])\n if @user\n render text: \"verified\", status: 200\n else\n render text: \"Token failed verification\", status: 422\n end\n end",
"def check_access_token\n @access_token = session[:access_token]\n\n begin\n @client = Octokit::Client.new :access_token => @access_token\n @user = @client.user\n rescue => e\n # The token has been revoked, so invalidate the token in the session.\n session[:access_token] = nil\n authenticate!\n end\nend",
"def invalid_access_token_response?(resp)\n AUTHORIZATOR_SERVICE_INVALID_ACCESS_TOKEN_ERROR_CODES.each do |code|\n return code if resp.headers['www-authenticate'] =~ Regexp.new(code)\n end if resp.respond_to?(:headers)\n return false unless (resp.respond_to?(:error) and resp.error)\n return resp.error.code if AUTHORIZATOR_SERVICE_INVALID_ACCESS_TOKEN_ERROR_CODES.include?(resp.error.code)\n false\n end",
"def validate_access_token obj\n if obj[\"access_token\"] == request_details[:access_token]\n User.new(obj)\n else\n false\n end\n end",
"def valid_token\n StatsManager::StatsD.time(Settings::StatsConstants.api['user']['valid_token']) do\n if ![\"facebook\"].include?(params[:provider]) # using include? allows us to do this for twitter/tumblr in the future\n return render_error(404, \"this route only currently supports facebook as a provider.\")\n end\n\n if auth = current_user.first_provider(params[:provider]) and auth.is_a? Authentication\n @token_valid = GT::UserFacebookManager.verify_auth(auth.oauth_token)\n @status = 200\n else\n return render_error(404, \"This user does not have a #{params[:provider]} authentication to check on\")\n end\n end\n end",
"def validate_token_hash\n if @token_request_at and\n @token_hash and @token_hash['expires_in'] and\n (Time.now - @token_request_at) > @token_hash['expires_in'].to_i\n @token_hash = nil\n elsif @token_request_at and\n @token_hash and @token_hash['expires_in']\n @token_hash['access_token']\n else\n puts \"start get token ...\"\n end\n end",
"def invalid_token?\n @code == 401\n end",
"def valid_token?\r\n token = ::AuthToken.where(user_id: decoded_auth_token[:user_id]).newer.first\r\n token&.token == auth_token && token.expire_at >= Time.now if token.present?\r\n end",
"def authenticated?\n !expired? && respond_to?(:access_token) && access_token.present?\n end",
"def verify_access_token\n user = User.find_by(access_token: params[:session][:access_token])\n if user\n render json: user, status: :ok\n else\n render json: 'Token failed verification', status: :unprocessable_entity\n end\n end",
"def validate_access_token(access_token_validation_request, opts = {})\n data, _status_code, _headers = validate_access_token_with_http_info(access_token_validation_request, opts)\n data\n end",
"def access_token?\n payload.typ == 'access'\n end",
"def check_auth_token\n token = decoded_auth_token\n render json: { error: 'Not Authorized' }, status: :unauthorized unless token\n end",
"def is_token_valid?(token, options={})\n response = els_http_request(\"/isTokenValid\",\"tokenid=#{token}\",options)\n if response.code.eql? \"200\"\n true\n else\n false\n end\n end",
"def verify_access_token\n Rails.logger.debug \"====== request.headers['Authorization'] = #{request.headers['Authorization']} ======\"\n\n server = AuthorizationServer.new(Application.authorization_server,\n Application.resource_server)\n\n result, @authorized_user = server.authorize_request(request)\n Rails.logger.debug \"------ authorized_user = #{@authorized_user.inspect} ------\"\n\n # If the result is OK, proceed with the operation\n head result unless result == :ok\n end",
"def valid?\n return false if !@authorization_code_grant_access_token_lifespan.nil? && @authorization_code_grant_access_token_lifespan !~ Regexp.new(/^[0-9]+(ns|us|ms|s|m|h)$/)\n return false if !@authorization_code_grant_id_token_lifespan.nil? && @authorization_code_grant_id_token_lifespan !~ Regexp.new(/^[0-9]+(ns|us|ms|s|m|h)$/)\n return false if !@authorization_code_grant_refresh_token_lifespan.nil? && @authorization_code_grant_refresh_token_lifespan !~ Regexp.new(/^[0-9]+(ns|us|ms|s|m|h)$/)\n return false if !@client_credentials_grant_access_token_lifespan.nil? && @client_credentials_grant_access_token_lifespan !~ Regexp.new(/^[0-9]+(ns|us|ms|s|m|h)$/)\n return false if !@implicit_grant_access_token_lifespan.nil? && @implicit_grant_access_token_lifespan !~ Regexp.new(/^[0-9]+(ns|us|ms|s|m|h)$/)\n return false if !@implicit_grant_id_token_lifespan.nil? && @implicit_grant_id_token_lifespan !~ Regexp.new(/^[0-9]+(ns|us|ms|s|m|h)$/)\n return false if !@jwt_bearer_grant_access_token_lifespan.nil? && @jwt_bearer_grant_access_token_lifespan !~ Regexp.new(/^[0-9]+(ns|us|ms|s|m|h)$/)\n return false if !@refresh_token_grant_access_token_lifespan.nil? && @refresh_token_grant_access_token_lifespan !~ Regexp.new(/^[0-9]+(ns|us|ms|s|m|h)$/)\n return false if !@refresh_token_grant_id_token_lifespan.nil? && @refresh_token_grant_id_token_lifespan !~ Regexp.new(/^[0-9]+(ns|us|ms|s|m|h)$/)\n return false if !@refresh_token_grant_refresh_token_lifespan.nil? && @refresh_token_grant_refresh_token_lifespan !~ Regexp.new(/^[0-9]+(ns|us|ms|s|m|h)$/)\n true\n end",
"def valid_wepay_access_token?\n return false if no_access_token?\n response = Wefarm::Application::WEPAY.call('/user', wepay_access_token)\n response && response['user_id'] ? true : false\n end",
"def valid_token?\n return false unless token\n begin\n # We use rate limit as its a fast and free way to\n # test the GitHub token.\n octokit.rate_limit\n rescue Octokit::ClientError\n return false\n end\n true\n end",
"def verify_auth_token\n halt 401 unless valid_user?(extracted_token)\n end",
"def access_token_expired?\n Time.zone.now >= self.expires_at\n end",
"def access_token_expired?\n Time.zone.now >= self.expires_at\n end",
"def validate_bearer_token(bearer_token)\n end",
"def token_authenticated?\n !!(@access_token && (@access_token_expires_at.nil? || @access_token_expires_at > Time.now))\n end",
"def authorized?\n !!@access_token\n end",
"def has_valid_login_token?\n return false if login_token.blank? || login_token_expires_at.nil?\n login_token_expires_at.future?\n end",
"def isTokenExpired\n if Time.now.to_i - @access_token_timestamp >= access_token_expires\n puts \"had to reauthenticate\"\n self.authenticate\n end\n end",
"def access_token_expired?\n\t\taccess_token_expires_at && access_token_expires_at < Time.zone.now\n\tend",
"def authenticated?\n @access_token != nil and @access_token.length > 0\n end",
"def check_access_token\n @access_token = session[:access_token]\n\n begin\n @client = Octokit::Client.new :access_token => @access_token\n @user = @client.find_user_installations\n rescue => e\n # The token has been revoked, so invalidate the token in the session.\n session[:access_token] = nil\n authenticate!\n end\nend",
"def validate_token(provided_token, extend_expire = true)\n clear_expired_tokens\n token_object = access_tokens.find_by_token(provided_token)\n return false if !token_object\n if extend_expire\n token_object.update_attribute(:token_expire, Time.now + DEFAULT_TOKEN_EXPIRE)\n end\n true\n end",
"def valid_tokens\n clear_expired_tokens\n access_tokens.pluck(:token)\n end",
"def valid?\n return false if @grant_type.nil?\n return false if @code.nil?\n return false if @code.to_s.length > 128\n return false if @code.to_s.length < 1\n return false if !@refresh_token.nil? && @refresh_token.to_s.length > 128\n return false if !@refresh_token.nil? && @refresh_token.to_s.length < 1\n return false if !@redirect_uri.nil? && @redirect_uri.to_s.length > 256\n return false if !@redirect_uri.nil? && @redirect_uri.to_s.length < 1\n return false if !@client_id.nil? && @client_id.to_s.length > 128\n return false if !@client_id.nil? && @client_id.to_s.length < 1\n return false if !@client_secret.nil? && @client_secret.to_s.length > 128\n return false if !@client_secret.nil? && @client_secret.to_s.length < 1\n true\n end",
"def valid_token?\n env['HTTP_TOKEN']\n end",
"def valid_for_token_auth?\n token_authenticatable? && auth_token.present? && with_authentication_hash(:token_auth, token_auth_hash)\n end",
"def valid?(assertions = {})\n validate!(assertions)\n rescue OpenIDTokenProxy::Error\n false\n end",
"def valid?\n @token.valid?\n end",
"def api_auth_success?\n token, token_options = get_token\n\n resource = nil\n resource = User.find_by_authentication_token(token) unless token.blank?\n\n comparison = valid_token_login?(resource, token)\n\n # token, resource, and comparison must all be valid\n !token.blank? && !resource.blank? && comparison\n end",
"def valid_auth_token?(request_auth_token)\n Devise.secure_compare(auth_token, request_auth_token) && !auth_token_expired?\n end",
"def is_authorized?\n !!token && !token.expired?\n end",
"def is_authorized?\n !!token && !token.expired?\n end",
"def validate_token\n token = params[:token]\n return false if token.nil?\n \n user = User.validate_token(token)\n return false if user.nil?\n \n login_user(user)\n return true\n end",
"def authenticated?\n !!@access_token\n end",
"def current_token_still_valid?\n begin\n drive = @client.discovered_api('drive', 'v2')\n result = @client.execute(:api_method => drive.about.get)\n rescue\n return false\n end\n \n if result.status == 200\n true\n else\n false\n end\n end",
"def token_authenticated?\n !!@access_token\n end",
"def token_authenticated?\n !!@access_token\n end",
"def valid_token?(token)\n return false unless !token.nil? && token_looks_safe?(token)\n result = ApiToken.find_by(token: token)\n !result.nil? && result[:active]\n end",
"def valid_to_proceed?\r\n decoded_auth_token.present? && decoded_auth_token[:user_id].present? && valid_token?\r\n end",
"def authorized?\n @user_id = nil\n @token = extract_token\n begin\n payload, header = JWT.decode(@token, settings.verify_key, true)\n\n @exp = header[\"exp\"]\n\n # check to see if the exp is set (we don't accept forever tokens)\n if @exp.nil?\n puts \"Access token doesn't have exp set\"\n return false\n end\n\n @exp = Time.at(@exp.to_i)\n\n # make sure the token hasn't expired\n if Time.now > @exp\n puts \"Access token expired\"\n return false\n end\n\n @user_id = payload[0]\n\n rescue JWT::DecodeError => e\n return false\n end\n true\n end",
"def has_valid_wepay_access_token?\n\t if self.wepay_access_token.nil?\n\t return false\n\t end\n\t response = WEPAY.call(\"/user\", self.wepay_access_token)\n\t response && response[\"user_id\"] ? true : false\n\tend",
"def token_authenticated?\n !!access_token\n end",
"def valid?\n\n auth_params = params[scope]\n return false if !auth_params\n\n (nimbus_auth(auth_params)&.code == 200) ? true : false\n end",
"def test_that_authentication_fails_with_wrong_parameters\n response = MercadoPago::Authentication.access_token('fake_client_id', 'fake_client_secret')\n\n assert_nil response['access_token']\n assert_equal \"Invalid client_id\", response['message']\n assert_equal 400, response['status']\n end",
"def valid_token\n unless !value_changed? || token_data(refresh: true).is_valid\n errors.add(\n :value,\n I18n.translate(\n 'fbsync.activerecord.errors.token.invalid_token',\n expires_at: I18n.localize(token_data.expires_at)\n )\n )\n end\n end",
"def check_weixin_token_valid?\n if token_string.blank?\n if token_model_instance.blank?\n render text: \"Forbidden\", status: 403\n return false\n end\n else\n if current_weixin_token != token_string\n render text: \"Forbidden\", status: 403\n return false\n end\n end\n true\n end",
"def verify_auth_token(authToken)\n if authToken.nil? || !authToken.instance_of?(CopyleaksAuthToken)\n raise 'authToken is Invalid, must be instance of CopyleaksAuthToken'\n end\n\n _time = DateTime.now\n _expiresTime = DateTime.parse(authToken.expires)\n\n if _expiresTime <= _time\n raise AuthExipredException.new.reason # expired\n end\n end",
"def has_valid_token?\n !Slack::Config.token.nil? && Slack::Config.token == \"authorized\"\n end",
"def has_valid_wepay_access_token?\n\t\tif self.wepay_access_token.nil?\n\t\t\treturn false\n\t\tend\n\t\tresponse = Wefarm::Application::WEPAY.call(\"/user\", self.wepay_access_token)\n\t\tresponse && response[\"user_id\"] ? true : false\n\tend",
"def authentication_required!\n @access_token.nil?\n end",
"def authorized?\n return if session[:access_token]\n end",
"def validate_token(token)\n object_from_response(Code42::TokenValidation, :get, \"authToken/#{token.to_s}\")\n end",
"def valid?\n authorization_header.present? && authorization_header.match(BEARER_PATTERN) && authentication_token.present?\n end",
"def has_valid_wepay_access_token?\n if self.wepay_access_token.nil?\n return false\n end\n response = WEPAY.call(\"/user\", self.wepay_access_token)\n response && response[\"user_id\"] ? true : false\nend",
"def has_valid_wepay_access_token?\n if self.wepay_access_token.nil?\n return false\n end\n response = WEPAY.call(\"/user\", self.wepay_access_token)\n response && response[\"user_id\"] ? true : false\nend",
"def authenticate\n # if valid_access_token?\n # fetch_access_token\n # else\n get_new_access_token\n # end\n end",
"def check_token\n input_token = request.headers['X-Auth-Token'] || params[:token]\n return unless input_token\n\n token = AuthenticationToken.find_by(token: input_token)\n return unless token\n\n # Count token usage\n token.inc(number_of_use: 1)\n # Update the updated_at because inc doesn't do it\n token.set(updated_at: Time.now.getlocal)\n\n # Sign in\n sign_in token.user\n end",
"def valid_token?\n five_minutes_ago = DateTime.now - 5.minutes\n params[:timestamp].to_i > five_minutes_ago.to_i &&\n params[:token] == Scalingo::SsoController.generate_authentication_token(params[:id], params[:timestamp])\n end",
"def validate_token\n token = params[:token]\n return false if token.nil?\n \n user = User.validate_token(token)\n return false if user.nil?\n \n login_user(user)\n return true\n end",
"def oauth_required\n invalid_oauth_response and return false unless current_token\n end",
"def authorized?\n @token = extract_token\n begin\n payload, header = JWT.decode(@token, nil, false)\n @exp = header[\"exp\"]\n # check to see if the exp is set (we don't accept forever tokens)\n if @exp.nil?\n logger.debug \"Access token doesn't have exp set\"\n return false\n end\n @exp = Time.at(@exp.to_i)\n # make sure the token hasn't expired\n if Time.now > @exp\n logger.debug \"Access token expired\"\n return false\n end\n @user_id = payload[\"user_id\"]\n rescue JWT::DecodeError => e\n logger.error e\n return false\n end\n end",
"def needs_access?\n @api_secret and @access_token.to_s == ''\n end",
"def request_access_token\n Firebase.logger.info('Requesting access token...')\n Firebase.logger.debug(\"token_uri: #{token_uri}\")\n res = Neko::HTTP.post_form(token_uri, jwt)\n Firebase.logger.debug(\"HTTP response code: #{res[:code]}\")\n if res.class == Hash && res[:code] == 200\n data = JSON.parse(res[:body], {symbolize_names: true})\n @access_token = data[:access_token]\n @expires = Time.now + data[:expires_in]\n Firebase.logger.info('Access token acquired.')\n s = \"Token #{@access_token.length} bytes, expires #{@expires}\"\n Firebase.logger.debug(s)\n return true\n else\n Firebase.logger.error('Access token request failed.')\n Firebase.logger.debug(\"HTTP #{res[:code]} #{res[:message]}\")\n end\n return false\n end",
"def check_token\n @usuario = Credentials.check_token(authorization: request.headers[\"Authorization\"])\n end",
"def access_token_expired?\n\t\t\t\treturn false if self.expires_at.nil?\n\n\t\t\t\t# Expiration date less than now == expired\n\t\t\t\tself.expires_at < Time.now\n\t\t\tend"
] | [
"0.8140243",
"0.81180745",
"0.8112279",
"0.806671",
"0.7994866",
"0.79767174",
"0.79271895",
"0.7919153",
"0.78944325",
"0.7700348",
"0.76701516",
"0.76685643",
"0.7586358",
"0.7541547",
"0.74958205",
"0.7488552",
"0.7412302",
"0.7315815",
"0.72392935",
"0.71928656",
"0.7188963",
"0.71666664",
"0.71457446",
"0.70982444",
"0.7090808",
"0.7082999",
"0.7070881",
"0.7064207",
"0.70556957",
"0.70513374",
"0.70320004",
"0.70317894",
"0.7024579",
"0.70134777",
"0.7011806",
"0.70103353",
"0.69939834",
"0.695716",
"0.6948669",
"0.6939362",
"0.693346",
"0.6929423",
"0.6916348",
"0.69143814",
"0.68839145",
"0.6880884",
"0.68461215",
"0.68461215",
"0.6824019",
"0.68216217",
"0.6805499",
"0.6800966",
"0.67980117",
"0.676655",
"0.67430115",
"0.6730203",
"0.6726487",
"0.6713925",
"0.67060584",
"0.66871285",
"0.66785026",
"0.6672821",
"0.66701686",
"0.6669381",
"0.66603416",
"0.66583055",
"0.66583055",
"0.66358405",
"0.6633764",
"0.6624431",
"0.6617658",
"0.6617658",
"0.661537",
"0.66070205",
"0.6599577",
"0.65934014",
"0.6585827",
"0.6583699",
"0.6565536",
"0.65470827",
"0.6532832",
"0.65224606",
"0.6522349",
"0.65013206",
"0.6498424",
"0.64913744",
"0.6490196",
"0.64705783",
"0.64687026",
"0.64687026",
"0.6467887",
"0.64674157",
"0.6450841",
"0.6450825",
"0.6428905",
"0.642653",
"0.64229107",
"0.6411264",
"0.6410735",
"0.64106023"
] | 0.64973617 | 85 |
list products in the store TODO: add constraints to the find based on category, etc. | def list
@products = Product.find(:all, :page => {:start => 1, :size => 15})
@product_cols = 3
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def products_list\n\t\[email protected]_list\n\t\tproducts = @store.products\n\t\tproducts.each do |product|\n\t\t\tputs \"Name: #{product.name} ---> Price: #{product.price}\"\n\t\tend\n\t\[email protected]_view(@current_user, @current_user.actions)\n\tend",
"def products\n products_list\n .where(@filterable.filter_params)\n .order(@sortable.sort_params)\n .page(@paginator.current_page).per_page(@paginator.page_size)\n end",
"def product_list\n a = selectable_products\n l = products a\n l\n end",
"def products_list\n @products = Haiwet::Product.list\n @products.each.with_index(1) do |prod, i|\n puts \"#{i}- #{prod.name}\"\n end\n end",
"def listProducts\n @@products.each_with_index { |p, i|\n puts \"#{i + 1}. #{p.name}\"\n }\n end",
"def admin_list\n @products = Product.find(:all)\n end",
"def list\n @product_pages, @products = paginate :product, :per_page => 10\n end",
"def products\n request :public, :get, :products\n end",
"def products\r\n\t\t@current_area = 'products'\r\n\t\t@current_menu = 'products'\r\n\r\n\t\tsort_order ||= get_sort_order(\"s-code\", \"product_code\")\r\n\t\tsort_order ||= get_sort_order(\"s-name\", \"product_name\")\r\n\t\tsort_order ||= \"product_name ASC\"\r\n\r\n\t\tpage = params[:page] ? params[:page].to_i : 1\r\n\t\titems_per_page = 30\r\n\t\toffset = (page - 1) * items_per_page\r\n\r\n\t\tif params[:query] and !params[:query].empty?\r\n\t\t\t@keywords = params[:query].split\r\n\t\t\t@query = @keywords.join(' ')\r\n\t\t\tmode = params[:mode] || 'all'\r\n\t\t\twhere_parts = @keywords.collect { |k| \"(product_code LIKE '%#{k}%' OR product_name LIKE '%#{k}%' OR description LIKE '%#{k}%' OR id='#{k}')\" }\r\n\t\t\twhere_clause = where_parts.join(mode == 'all' ? ' AND ' : ' OR ')\r\n\t\telse\r\n\t\t\twhere_clause = '1'\r\n\t\tend\r\n\t\t@product_count = Product.count('available=1 AND ' + where_clause)\r\n\r\n\t\t@pages = Paginator.new(self, @product_count, items_per_page, page)\r\n\r\n\t\tif params[:delete] and params[:select]\r\n\t\t\tc = params[:select].keys.collect { |k| \"id=#{k}\" }.join(' OR ')\r\n\t\t\tProduct.update_all 'available=0', c\r\n\t\t\tredirect_to :action => :products\r\n\t\tend\r\n\r\n\t\tif params[:add_to]\r\n\t\t\tif params[:select]\r\n\t\t\t\tc = Category.find(params[:category_id])\r\n\t\t\t\tProduct.find(:all, :conditions => params[:select].keys.collect { |k| \"id=#{k}\" }.join(' OR ')).each do |p|\r\n\t\t\t\t\t# don't crash with a MySQL \"duplicate key\" error if the product already belongs to the selected category\r\n\t\t\t\t\tif !p.categories.index(c)\r\n\t\t\t\t\t\tp.categories << c\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\telse\r\n\t\t\t\tredirect_to :action => :new, :category_id => params[:category_id]\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\t@products = Product.find(:all, :conditions => 'available=1 AND ' + where_clause, :order => sort_order, :offset => offset, :limit => items_per_page)\r\n\tend",
"def index\n @products = Product.find_products_for_sale\n end",
"def index\n Shop.set_store_session\n @products = ShopifyAPI::Product.all\n end",
"def products\n end",
"def products\n find_products\n end",
"def index\n @store_products = StoreProduct.all\n end",
"def products(params = {})\n Product.find_all_by_shop_category_id(id, params)\n end",
"def list_products_stored\n list = DATABASE.execute(\"SELECT name FROM products WHERE shelf_id = #{@id}\")\n end",
"def index\n @product_lists = @product_lists.order(:id).search(params[:search], params[:page])\n end",
"def products\n Product.all\n end",
"def index\n\t\t@products = Product.all\n\tend",
"def show\n @products = Product.search(params).paginate(:page => params[:page], :per_page => 10)\n end",
"def index\n products = @_products.order('products.id ASC')\n products = products.page(params[:page]).per(params[:per_page]) if params[:page].present?\n @products = products\n end",
"def products()\n return filter_products()\n end",
"def index\n @categories = store.categories\n @products = store.products.active.page(params[:page]).per(12)\n end",
"def index\n @products = Product.where(:store_id => current_merchant.store_name)\n end",
"def index\n\t \n\t#@products = Product.all\n\t \n\t# replace default function by a search\n\t@products = search \n\t \n end",
"def find_products\n\n product_ids = session[:compare_products] || []\n if product_ids.length > 4\n flash[:notice] = I18n.t('compare_products.limit_is_4')\n product_ids = product_ids[0..3]\n elsif product_ids.length < 1\n flash[:error] = I18n.t('compare_products.insufficient_data')\n redirect_to \"/t/#{@taxon.permalink}\"\n end\n @products = Spree::Product.find(:all, :conditions => { :id => product_ids},\n :include => { :product_properties => :property },\n :limit => 4)\n end",
"def show\n @products = @merk_lensa.products.order(\"created_at ASC\").paginate(:page => params[:page], :per_page => 9)\n end",
"def products\n Product.find_all_by_vendor_id(@id)\n end",
"def index\n \t\t@product = Product.find_by_id([params[:id]]);\n \t\tcat = @product.category;\n \t\t@products = Product.where(Category_id:cat)\n end",
"def index\n\t\t@products = Product.search(params[:search]).filter_category(params[:filter_category]).filter_types(params[:types]).filter_volume(params[:minvol], params[:maxvol]).filter_length(params[:minlen], params[:maxlen]).filter_width(params[:minwid], params[:maxwid]).filter_height(params[:minheig], params[:maxheig]).filter_diameter(params[:mindiam], params[:maxdiam]).filter_cover(params[:cover]).order(params.fetch(:sort, \"position ASC\"))\n end",
"def list_products\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Products\"\n \n if(@company.can_view(current_user))\n if(params[:restock])\n @products = Product.where([\"company_id = ? AND quantity <= reorder\", @company.id]).paginate(:page => params[:page])\n @view_restock = true\n else\n if(params[:q] and params[:q] != \"\")\n fields = [\"name\", \"code\", \"category\", \"description\", \"comments\"]\n \n q = params[:q].strip\n @q_org = q\n \n query = str_sql_search(q, fields)\n \n @products = Product.where([\"company_id = ? AND (#{query})\", @company.id]).paginate(:page => params[:page]) \n else\n @products = Product.where(company_id: @company.id).paginate(:page => params[:page])\n end\n end\n else\n errPerms()\n end\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def list\n \n @product_types = ProductType.find(:all, :order => \"name\")\n end",
"def find_all\n products = []\n @db.query(\"SELECT id, name FROM products WHERE is_active = 1\", :symbolize_keys => true).each do |prod|\n products << prod\n end\n products\n end",
"def find_products(payload = {})\n request('FindProducts', payload)\n end",
"def product_list\n current_user.products.order('name').collect {|p| [ p.name, p.ticket_project_id, p.id ]}\n end",
"def all(params = {})\n path = \"/product-view/products\"\n\n handle_all_request(path, :products, params)\n end",
"def all\n @products = Product.get_list_active_products.page(params[:page]).per(10)\n if @products.present?\n @products\n else\n @object = 'product'\n render \"api/v1/errors/404\", status: 401\n end\n end",
"def list\r\n\t\t@current_area = 'features'\r\n\t\t@current_menu = 'products'\r\n\r\n\t\tsort_order ||= get_sort_order(\"s-code\", \"products.product_code\")\r\n\t\tsort_order ||= get_sort_order(\"s-name\", \"products.product_name\")\r\n# heh - doesn't work well when products are featured in multiple categories/static pages\r\n#\t\tsort_order ||= get_sort_order(\"s-category_static\", [ \"categories.name\", \"static_pages.name\" ])\r\n\t\tsort_order ||= \"products.product_code ASC\"\r\n\r\n\t\tpage = params[:page] ? params[:page].to_i : 1\r\n\t\titems_per_page = 30\r\n\t\toffset = (page - 1) * items_per_page\r\n\r\n\t\tif params[:query] and !params[:query].empty?\r\n\t\t\t@keywords = params[:query].split\r\n\t\t\t@query = @keywords.join(' ')\r\n\t\t\tmode = params[:mode] || 'all'\r\n\t\t\twhere_parts = @keywords.collect { |k| \"(products.product_code LIKE \\\"%#{k}%\\\" OR products.product_name LIKE \\\"%#{k}%\\\" OR products.description LIKE \\\"%#{k}%\\\" OR products.id=\\\"#{k}\\\")\" }\r\n\t\t\twhere_clause = where_parts.join(mode == 'all' ? ' AND ' : ' OR ')\r\n\t\telse\r\n\t\t\twhere_clause = '1'\r\n\t\tend\r\n\t\t@features_count = Feature.count(where_clause, :include => [:product])\r\n\r\n\t\t@pages = Paginator.new(self, @features_count, items_per_page, page)\r\n\r\n\t\tif params[:delete] and params[:select]\r\n\t\t\tc = params[:select].keys.collect { |k| \"id=#{k}\" }.join(' OR ')\r\n\t\t\tFeature.delete_all c\r\n\t\t\tredirect_to :action => :list\r\n\t\tend\r\n\r\n\t\t@features = Feature.find(:all, :conditions => where_clause, :include => [:categories, :static_pages, :product], :order => sort_order, :offset => offset, :limit => items_per_page)\r\n\tend",
"def index\n @products = @co.products\n end",
"def index\n if current_user.admin?\n @products = params[:store_id] ? Product.where(item_type: 'Store', item_id: params[:store_id]) : Product.all\n else\n @products = params[:store_id] ? Product.where(item_type: 'Store', item_id: params[:store_id]) : current_user.products\n end\n\n palabra = \"%#{params[:search]}%\"\n\n @products = Product.where(\"name LIKE ? OR description LIKE ?\", palabra, palabra)\n end",
"def shopping_products items\n\titems.select do |item|\n\t\titem['kind']=='shopping#product'\n\tend\nend",
"def catalog_item\n \tif params[:search]\n \t\t @products = Product.search(params[:search])\n \telse\n \t\t@products=Product.all\n \tend\n end",
"def list_products\n @company = Company.find(params[:company_id])\n @pagetitle = \"#{@company.name} - Products\"\n \n if(@company.can_view(current_user))\n if(params[:restock])\n @products = Product.where([\"company_id = ? AND quantity <= reorder\", @company.id]).order('name').paginate(:page => params[:page]) \n @view_restock = true\n else\n if(params[:search] and params[:search] != \"\") \n @products = Product.where([\"company_id = ? and (code LIKE ? OR name LIKE ?)\", @company.id,\"%\" + params[:search] + \"%\", \"%\" + params[:search] + \"%\"]).order('code').paginate(:page => params[:page]) \n else\n @products = Product.where([\"company_id = ?\",@company.id ]).order('code').paginate(:page => params[:page]) \n end\n end\n else\n errPerms()\n end\n end",
"def index\n\t@products=products.all\nend",
"def products\n pages = page.children.all(\n :conditions => { :class_name => 'ShopProductPage' },\n :order => 'pages.position ASC'\n ).map(&:shop_product)\n end",
"def index\n # Get all the products\n @products = Product.all\n end",
"def products\n Product.find_by_vendor(@id)\n end",
"def search_for_products\r\n @categories = Category.select(:id, :name).all\r\n end",
"def search_product_list\n $tracer.trace(__method__)\n return WebInStoreProductList.new(ToolTag.new(div.className(create_ats_regex_string(\"productsearchitems\")).tr, __method__))\n end",
"def index\n @admin_products = Admin::Product.all\n end",
"def index\n @product_names = @product_names.order(:id).search(params[:search], params[:page])\n end",
"def _products_manage_list\r\n\t\t\tproject = Project.find params[:search][:id]\r\n\r\n\t\t\t# Author\r\n\t\t\tauthorize! :edit, project\r\n\r\n\t\t\tproducts = Project.product_search_with_params params[:search]\r\n\r\n\t\t\treturn render json: { status: 1 } if products[:real_estates].blank? && products[:floor_real_estates].blank?\r\n\r\n\t\t\t# Paging\r\n\t\t\tper = 30\r\n\t\t\tcount = products[:real_estates].count + products[:floor_real_estates].count\r\n\t\t\tparams[:page] ||= 1\r\n\t\t\tpage = params[:page].to_i\r\n\t\t\tif products[:real_estates].present?\r\n\t\t\t\toffset = (page - 1) * per\r\n\r\n\t\t\t\tif offset >= products[:real_estates].count\r\n\t\t\t\t\toffset -= products[:real_estate].count\r\n\t\t\t\t\tproducts[:real_estates] = []\r\n\t\t\t\t\tproducts[:floor_real_estates] = products[:floor_real_estates].offset(offset).limit(per)\r\n\t\t\t\telse\r\n\t\t\t\t\tproducts[:real_estates] = products[:real_estates].offset(offset).limit(per)\r\n\t\t\t\t\tif products[:real_estate].count == per\r\n\t\t\t\t\t\tproducts[:floor_real_estates] = []\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tlimit = per - products[:real_estates].count\r\n\t\t\t\t\t\tproducts[:floor_real_estates].limit(limit)\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\telse\r\n\t\t\t\tproducts[:floor_real_estates] = products[:floor_real_estates].page page, per\r\n\t\t\tend\r\n\r\n\t\t\trender json: {\r\n\t\t\t\tstatus: 0,\r\n\t\t\t\tresult: {\r\n\t\t\t\t\tlist: render_to_string(partial: 'products_list', locals: { products: products }),\r\n\t\t\t\t\tpagination: render_to_string(partial: 'shared/pagination', locals: { page: page, per: per, total: count })\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\tend",
"def index\n \n if params[:cat_id].present?\n \n # Read by this category id\n cat = Category.find(params[:cat_id])\n @products = cat.products\n @search_desc = \"Showing all \" + cat.name\n \n elsif params[:search].present? \n \n # Read based on the search param\n s = '%' + params[:search] + \"%\"\n @products = Product.where('lower(name) LIKE ?', s.downcase).all\n \n # Also search through descriptions\n @products += Product.where('lower(description) LIKE ?', s.downcase).all\n \n # Also search the categories for a matching name\n cats = Category.where('lower(name) LIKE ?', s.downcase).all\n cats.each do |cat|\n @products += cat.products\n end \n\n # Make sure products are unique in the array\n @products = @products.uniq # The coolest statement yet!!\n @search_desc = \"Search results\"\n else \n @products = Product.all\n @search_desc = \"Showing all products\"\n end\n\n # Setup the pagination voodoo\n if @products.kind_of?(Array)\n @products = Kaminari.paginate_array(@products).page(params[:page]).per(12)\n else\n @products = @products.page(params[:page]).per(12)\n end\n\n end",
"def index\n @products = Product.featured.available.paginate(\n :per_page =>\n (CartConfig.get(:products_per_page, :store) || 15),\n :page => (params[:page] || 1).to_i,\n :readonly => true,\n :order =>'updated_at desc'\n )\n end",
"def list_fg_products\n\treturn if authorise_for_web('fg_product','read') == false \n\n \tif params[:page]!= nil \n\n \t\tsession[:fg_products_page] = params['page']\n\n\t\t render_list_fg_products\n\n\t\t return \n\telse\n\t\tsession[:fg_products_page] = nil\n\tend\n\n\tlist_query = \"@fg_product_pages = Paginator.new self, FgProduct.count, @@page_size,@current_page\n\t @fg_products = FgProduct.find(:all,\n\t\t\t\t :limit => @fg_product_pages.items_per_page,\n\t\t\t\t :order => 'fg_product_code',\n\t\t\t\t :offset => @fg_product_pages.current.offset)\"\n\tsession[:query] = list_query\n\trender_list_fg_products\nend",
"def products\n run(:get,\"/school_products\", [200])\n end",
"def find_all_by(opts = {})\n list_all_products(opts)\n end",
"def index\n page = params[:page].to_i\n @admin_products = Product.page(page).per(10)\n end",
"def index\n @categories = Category.all\n if params[:showall] == \"false\"\n @products = Product.get_discounted\n else\n @products = Product.all\n end\n\n if params[:order] == \"ascending\"\n @products = Product.order(:price)\n elsif params[:order] == \"descending\"\n @products = Product.order(price: :desc)\n end\n\n if params[:category]\n @products = Category.find_by(name: params[:category]).products\n end\n end",
"def get_search_product_list\n\t\tresponse_search = Partay.get('http://shoponline.tescolotus.com/api/v1/search/products?query=Sugar&page=1&sortBy=Relevance', :headers => {'Content-Type' => 'application/json', 'language' => 'en-gb', 'region' => 'TH', 'userId' => access_token})\n\t\t@@product_list=Array.new\n\t\t3.times do |i|\n\t\t\t@@count ||=0\n\t\t\tsearch_result=JSON(response_search['productItems'][i])\n\t\t\tproduct_list_name =JSON(search_result)[\"product\"][\"shortDescription\"]\n\t\t\t@@product_list.push product_list_name\n\t\t\t@@count+= 1\n\t\tend\n\t\tself.product_name_list(@@product_list)\n\tend",
"def index\n @products = current_seller.product.all\n end",
"def index\n @products = Product.search(params).paginate(:page => params[:page], :per_page => 10)\n end",
"def product_list()\n $tracer.trace(__method__)\n return GameStopProductList.new(ToolTag.new(div.className(create_ats_regex_string(\"products\")).div.className(\"/^product$/\"), __method__), self)\n end",
"def index\n @category_products = CategoryProduct.all\n end",
"def index\n @products = Product.paginate(page: params[:page], per_page: 40)\n end",
"def index\n @product_specs = ProductSpec.all\n end",
"def index\n expose Product.page(params[:page])\n end",
"def products\n FarMar::Product.by_vendor(id)\n end",
"def products\n FarMar::Product.by_vendor(id)\n end"
] | [
"0.78513247",
"0.7784803",
"0.7737194",
"0.75699866",
"0.7493385",
"0.74132067",
"0.732146",
"0.7308817",
"0.7297656",
"0.72874194",
"0.72600836",
"0.72364306",
"0.72322136",
"0.7230215",
"0.7220764",
"0.7219494",
"0.7213784",
"0.71856505",
"0.71729434",
"0.7164039",
"0.7122019",
"0.7090108",
"0.7052156",
"0.70474434",
"0.70434016",
"0.70339197",
"0.7018757",
"0.70151544",
"0.7000469",
"0.6998639",
"0.698621",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.698481",
"0.6982417",
"0.6976223",
"0.6970013",
"0.69580615",
"0.6948557",
"0.6942358",
"0.6939886",
"0.6937715",
"0.6931021",
"0.6909894",
"0.6905388",
"0.689774",
"0.68909717",
"0.6887646",
"0.6880443",
"0.68661475",
"0.6863715",
"0.6831921",
"0.68287",
"0.68257487",
"0.6822668",
"0.6817888",
"0.68100536",
"0.68088996",
"0.67973584",
"0.6794681",
"0.6791812",
"0.67863816",
"0.6785958",
"0.6784392",
"0.6783212",
"0.6767046",
"0.676417",
"0.67564905",
"0.6751891",
"0.6750243",
"0.67499524",
"0.67409754",
"0.67409754"
] | 0.7102552 | 21 |
hack to handle bug in URI.parse, which doesn't allow subdomains to contain underscores | def parse_uri(url = nil)
URI.parse(url)
rescue URI::InvalidURIError
host = url.match(".+\:\/\/([^\/]+)")[1]
uri = URI.parse(url.sub(host, 'dummy-host'))
uri.instance_variable_set('@host', host)
uri
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_domain_part\n assert_kind_of(N::URI, N::URI.new(\"http://somethingelse.com/foobar/bla/\").domain_part)\n assert_equal(\"http://somethingelse.com/foobar/bla/\", N::URI.new(\"http://somethingelse.com/foobar/bla/\").domain_part.to_s)\n assert_equal(\"http://somethingelse.com/foobar/bla/\", N::URI.new(\"http://somethingelse.com/foobar/bla/thing\").domain_part.to_s)\n assert_equal(\"http://somethingelse.com/foobar/bla#\", N::URI.new(\"http://somethingelse.com/foobar/bla#thong\").domain_part.to_s)\n end",
"def uri_normalize(uri)\n \treturn 'http://' + uri unless uri =~ /http:\\/\\//\n \turi\n\tend",
"def uri_normalize(uri)\n \treturn 'http://' + uri unless uri =~ /http:\\/\\//\n \turi\n\tend",
"def domain_name(url)\n #url.gsub(/http:|https:|www.|\\/\\/|.com.*/,'')\n url.gsub(/http:|https:|www.|\\/\\//,'').split('.').first\nend",
"def normalize_url(url); end",
"def domain_name(url)\n url.gsub(/http(s)?:\\/\\/(www.)?/, '').match(/[^.]+/)[0]\nend",
"def parse_url_host\n url = self.url.gsub(/^https?\\:\\/\\//, '')\n url = url.gsub(/www\\./, '') unless (url.match(/www\\./).blank? && url.gsub(/www\\./, '').match(/[A-Za-z]/))\n self.url = \"https://\" + url\n end",
"def reg_url2; /(.+)\\//; end",
"def reg_url2; /(.+)\\//; end",
"def clean_url(url)\n begin\n url = Addressable::URI.escape(url)\n url = \"http://#{url}\" if Addressable::URI.parse(url).scheme.nil?\n uri = URI(url)\n host = uri.host.downcase\n\n if host.start_with?('www.')\n host = host[4..-1]\n end\n\n host + uri.path.downcase\n rescue\n logger.debug \"Bad URL encountered in clean_url\"\n url\n end\n end",
"def domain_name(url)\n url.gsub(\"www.\",\"\").split(\"//\")[1].split(\"/\")[0].split('.')[0]\nend",
"def domain_name(url)\n url.match(/(http[s]?:\\/\\/[\\\\w]{3}?\\.?)(\\w+-?\\w+)/)[-1]\nend",
"def sanitize_url(url)\n # URL matches 'www'\n if url =~ /w{3}/\n sterilize url.split(/\\./)[1]\n # URL does not match 'www'\n else\n first_parts = url.split(/\\./)[0..1]\n scheme_eliminated = first_parts.map {|part| part.gsub(/[a-zA-Z]+\\W+/, '')}.join(' ')\n sterilize(scheme_eliminated) \n end\n end",
"def get_domain(url)\n url_partitioned_at_double_hash = url.partition(\"//\")\n domain_partitioned_at_hash = url_partitioned_at_double_hash[2].partition(\"/\")\n domain_partitioned_at_hash[0]\nend",
"def get_host_from_url(url)\n return url[0...url.index(\"/\")]\nend",
"def domain_name(str)\n str = str.split('//')\n str = str[str.size - 1].split('.')\n str.delete('www')\n str[0]\nend",
"def fix_host\n if host.blank?\n begin\n uri = URI(url)\n logger.debug (self.host = uri.host.match(/\\w*\\.\\w*$/)[0])\n rescue\n return false\n end\n end\n true\n end",
"def parse_user_domain(hostname)\n return hostname.split('.').first if Rails.configuration.url_host.empty?\n Rails.configuration.url_host.split(',').each do |url_host|\n return hostname.chomp(url_host).chomp('.') if hostname.include?(url_host)\n end\n ''\n end",
"def normalize_url(url)\n\t\tbegin\n\t\t\turl.strip!\n\t\t\t# Converting the scheme and host to lower case in the process, i.e. 'HTTP://www.Example.com/' => 'http://www.example.com/' \n\t\t\t# Normalize the base\n\t\t\tbase=url_2_site(url) \n\t\t\t# Case#1, remove the trailing dot after the hostname, i.e, 'http://www.yahoo.com./' => 'http://www.yahoo.com/'\n\t\t\tbase=base.sub(/\\.\\/$/,'/')\n\t\t\t# Normalize the relative path, case#1\n\t\t\t# retrieve the file path and remove the first '/' or '.', \n\t\t\t# i.e. 'http://www.example.com/mypath' or 'http://www.example.com/./mypath' => 'mypath'\n\t\t\tpath=url_2_path(url).sub(/^(\\/|\\.)*/,'')\n\t\t\t# Normalize the relative path, case#2\n\t\t\t# Replace dot-segments. \"/../\" and \"/./\" with \"/\", i.e. 'http://www.example.com/../a/b/../c/./d.html\" => 'http://www.example.com/a/c/d.html'\n\t\t\tpath=path.gsub(/\\/\\.{1,2}\\//,'/')\n\t\t\tif path.nil?\n\t\t\t\treturn base\n\t\t\telse\n\t\t\t\treturn base+path\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__} for #{url}: #{ee}\" if @verbose\n\t\t\treturn url\n\t\tend\n\tend",
"def get_domain url\n uri = URI.parse url\n host = uri.host.downcase\n host.start_with?('www.') ? host[4..-1] : host\n end",
"def normalize_path(url); end",
"def normalize_path(url); end",
"def normalize_query url\n url = PostRank::URI.normalize(url) rescue nil\n return if url.blank?\n return if url.host.blank? || (! HOST_WHITELIST.include?(url.host))\n return unless (url.scheme == 'http')\n url\n end",
"def normalize_query url\n url = PostRank::URI.normalize(url) rescue nil\n return if url.blank?\n return if url.host.blank? || (! HOST_WHITELIST.include?(url.host))\n return unless (url.scheme == 'http')\n url\n end",
"def parse_url(uri)\n return uri if uri.is_a? URI\n\n uri = URI.parse(uri)\n is_incomplete = uri.scheme.nil? && uri.host.nil?\n is_incomplete ? URI.parse('http://' + uri.to_s) : uri\n end",
"def normalize_uri(uri)\n (uri =~ /^(https?|ftp|file):/) ? uri : \"http://#{uri}\"\n end",
"def normalize_uri uri\n (uri =~ /^https?:/) ? uri : \"http://#{uri}\"\n end",
"def test_absolute_uri_underscores\n parser = HttpParser.new\n req = parser.env\n http = \"GET http://under_score.example.com/foo?q=bar HTTP/1.0\\r\\n\\r\\n\"\n parser.buf << http\n assert_equal req, parser.parse\n assert_equal 'http', req['rack.url_scheme']\n assert_equal '/foo?q=bar', req['REQUEST_URI']\n assert_equal '/foo', req['REQUEST_PATH']\n assert_equal 'q=bar', req['QUERY_STRING']\n\n assert_equal 'under_score.example.com', req['HTTP_HOST']\n assert_equal 'under_score.example.com', req['SERVER_NAME']\n assert_equal '80', req['SERVER_PORT']\n assert_equal \"\", parser.buf\n assert ! parser.keepalive?\n end",
"def ensure_url(str)\n if str.respond_to?(:scheme)\n str\n else\n str = str.to_s\n str.gsub! /\\s/, ''\n str.gsub! /(\\#|\\?).*/, ''\n Addressable::URI.parse str\n end\n end",
"def normalize_scheme(scheme)\n return \"http\" unless scheme\n scheme.to_s[/^\\w+/]\n end",
"def normalize_uri(uri)\n (uri =~ /^(https?|ftp|file):/) ? uri : \"http://#{uri}\"\n end",
"def domain_name(url)\n url.match(%r{(http(s)?://)?(www.)?([a-zA-Z0-9-]*)}).to_a.last\nend",
"def test_no_domain\n assert_equal(nil, N::URI.new(\"file:thingy\").domain_part)\n end",
"def sanitise(url)\n if url and m = url.match(/(\\w+)(:\\/*)([\\w\\.\\-].*)(\\/?.*)?/)\n clean_url = m.captures[0].downcase + m.captures[1] + m.captures[2].downcase\n if m.captures[3]\n clean_url << m.captures[3]\n end\n else\n return nil\n end\n end",
"def clean_uri url\n i = url.index('#')\n url[i+1..-2]\nend",
"def get_url_domain\n uri = URI.parse(url)\n host = uri.host.downcase\n host.start_with?('www.') ? host[4..-1] : host\n end",
"def cleanse_domain(domain)\n domain.downcase!\n domain = domain.sub(/^https?\\:\\/\\//, '').sub(/^www./,'')\n domain = domain.split(\"/\").first\n domain = domain.split(\"@\").last\n\n domain = PublicSuffix.parse(domain)\n domain = \"#{domain.sld}.#{domain.tld}\"\n domain\n end",
"def parse_domain_name\n if @options[:domain].blank? && !@options[:username].blank?\n if @options[:username].include?('\\\\')\n @options[:domain], @options[:username] = username.split('\\\\')\n elsif @options[:username].include?('/')\n @options[:domain], @options[:username] = username.split('/')\n end\n end\n end",
"def normalize_url(url)\n return nil if url.nil?\n begin\n uri = Addressable::URI.heuristic_parse(url)\n uri.host.present? && /^http(s)?$/.match(uri.scheme) ? uri.to_s : nil\n rescue\n nil\n end\n end",
"def clean_url url\n return url if url.nil?\n url.gsub('%2F', '/').gsub(/^\\/+/, '').gsub('//', '/')\n end",
"def clean_url\n #use try instead for nil?\n unless self.url.nil?\n parsed_url = URI.parse(self.url).host.sub(/\\Awww\\./, '')\n else\n nil\n end\n end",
"def test_absolute_uri_uri_parse\n \"#{URI::REGEXP::PATTERN::UNRESERVED};:&=+$,\".split(//).each do |char|\n parser = HttpParser.new\n req = parser.env\n http = \"GET http://#{char}@example.com/ HTTP/1.0\\r\\n\\r\\n\"\n assert_equal req, parser.headers(req, http)\n assert_equal 'http', req['rack.url_scheme']\n assert_equal '/', req['REQUEST_URI']\n assert_equal '/', req['REQUEST_PATH']\n assert_equal '', req['QUERY_STRING']\n\n assert_equal 'example.com', req['HTTP_HOST']\n assert_equal 'example.com', req['SERVER_NAME']\n assert_equal '80', req['SERVER_PORT']\n assert_equal \"\", http\n assert ! parser.keepalive?\n end\n end",
"def normalize_url\n return if self.url.blank?\n normalized = self.url.normalize\n if normalized.blank?\n self.errors.add(:url, \"is invalid\")\n return false\n elsif normalized.match(\"archiveofourown.org/users\")\n self.errors.add(:url, \"cannot be ao3 user\")\n return false\n elsif normalized.match(\"(.*)/collections/(.*)/works/(.*)\")\n normalized = $1 + \"/works/\" + $3\n elsif normalized.match(\"archiveofourown.org/collections\")\n self.errors.add(:url, \"cannot be an ao3 collection\")\n return false\n end\n self.url = normalized\n end",
"def domain_name(url)\n if url.match(/^www/)\n p url.split(\".\")[1]\n elsif url.match(/^http/)\n x = url.split(\"/\")[2]\n if x.match(/^www/)\n p x.split(\".\")[1]\n else\n p x.split(\".\")[0]\n end\n else\n p url.split(\".\")[0]\n end\nend",
"def normalize_url url\n unless url.match(/https?:\\/\\//)\n url = \"http://#{url}\"\n end\n\n url\n end",
"def correct_uri( url )\n uri = URI( url )\n if uri.scheme == 'http'\n case\n when uri.host.match( 'github.com' )\n # remove possible subdomain like 'wiki.github.com'\n uri = URI \"https://github.com#{uri.path}\"\n when uri.host.match( 'bitbucket.org' )\n uri = URI \"https://#{uri.host}#{uri.path}\"\n end\n end\n\n uri\n end",
"def categorize_uri(str)\n regex = /\\.+/ # really simple host regex to thwart unwanted strings\n str = \"http://#{str}\" unless str.to_s =~ %r{\\Ahttps?://}\n uri = URI.parse(str.to_s)\n path = uri.path.chomp('/')\n return :unknown if (uri.host =~ regex).nil?\n\n path.empty? ? :host : :url\n rescue URI::InvalidURIError\n :unknown\n end",
"def domain_parts\n PublicSuffix.parse domain\n rescue PublicSuffix::DomainInvalid\n nil\n end",
"def domain_parts\n PublicSuffix.parse domain\n rescue PublicSuffix::DomainInvalid\n nil\n end",
"def absolutify_url(url)\n url =~ /^\\w*\\:/i ? url : File.join(@url,url)\n end",
"def extract_host(u)\n URI.split(u).compact[1]\n end",
"def sanitize_path\n gsub(/[\\/: ]/,'_')\n end",
"def normalize(domain)\n # strip off the protocol (\\w{1,20}://), the URI (/), parameters (?), port number (:), and username (.*@)\n # then split into parts via the .\n parts = domain.gsub(%r{^\\w{1,20}://}, '').gsub(%r{[/?:].*}, '').gsub(/.*?@/, '').split('.')\n # grab the last two parts of the domain\n dom = parts[-2, 2].join '.'\n # if the dom is in the two_level_tld list, then use three parts\n dom = parts[-3, 3].join '.' if @two_level_tld.index dom\n dom = parts[-4, 4].join '.' if @three_level_tld.index dom\n dom\n end",
"def sanitize_url(str); end",
"def validate_url\r\n url = @hostname\r\n #puts \"DEBUG: url: \" + url\r\n \r\n url_part = []\r\n url_parts = url.split('.') \r\n #puts \"DEBUG: url_parts[0]: \" + url_parts[0]\r\n \r\n if url_parts[0].is_a? Numeric \r\n validate_sub_url(url_parts[0])\r\n validate_sub_url(url_parts[1])\r\n validate_sub_url(url_parts[2])\r\n validate_sub_url(url_parts[3])\r\n else # letters\r\n #puts \"URL just letters\"\r\n end\r\n ping_url\r\n end",
"def sf_domain(uri)\n uri = uri.to_s.split('/')\n uri.empty? ? '' : uri[2]\n end",
"def subdomain\n host.split(\".\").first\n end",
"def get_host_name(url)\n\tmatch = %r|(https?://)?(?<host>[^/]+)(/.*$)?|.match(url)\n\tmatch['host']\nend",
"def slashless_url(url)\n url.chomp('/')\n end",
"def host_from_uri(domain)\n Addressable::URI.parse(domain).host || Addressable::URI.parse(\"http://#{domain}\").host\n end",
"def normalized_host\n # Remove trailing '.' characters\n host.sub(/\\.*$/, '').downcase if host\n end",
"def reg_url; /(.+)/; end",
"def reg_url; /(.+)/; end",
"def build_url(url)\n # this will remove any of the blank spaces. There is no reason for blank space in the url or brake lines\n url = url.gsub(\" \", \"\").gsub(/\\n/, \"\").gsub(/\\r/, \"\")\n \n \n # Step one tells me that the uri does have a http or a https to use\n one = url.slice(/(https|http)/)\n if one.nil?\n request_response = \"http://\"\n uri_split = url.split(\".\")\n else\n request_response = url.split(\"//\")[0] + \"//\"\n uri_split = url.split(\"//\")[1].split(\".\")\n end\n \n # Step two and three check for the .com and www at the begging. \n # The count is to make sure that is it missing something and not just taking the place of a sub domain.\n if uri_split.count <= 2\n two = url.slice(/(com|gov|org|net|mobi)/)\n three = url.slice(/(www)/)\n # don't add if the thing is there\n if three.nil?\n uri_split.unshift(\"www\")\n end\n if two.nil?\n uri_split << \"com\"\n end\n end\n path_seperator = uri_split[uri_split.length - 1].split(/\\//)\n if path_seperator && path_seperator.length <= 1\n uri_split[uri_split.length - 1] = path_seperator\n end\n string = uri_split.map{ |split| split }.join(\".\").to_s\n # I can't figure this part out but it sucks\n path_thing = string.split(/\\//) \n unless url.blank?\n url = request_response + string\n end\n end",
"def clean_url\n url = self.original_url\n url = url.gsub(' ', '')\n url = url.strip\n if url !~ REGEX_PROTOCOL\n url = \"http://#{url}\"\n end\n begin\n self.original_url = URI.parse(url).normalize.to_s\n rescue URI::InvalidURIError\n # handle urls that cannot be parsed\n self.original_url = url\n end\n end",
"def extract_host(u)\n URI.split(u).compact[1]\n end",
"def extract_subdomain(host, tld_length); end",
"def uri_normalizer; end",
"def get_url_host_base(host)\n host_split = host.split '.'\n\n # check for hostnames without periods, like \"localhost\"\n if host_split.size == 1\n return host\n end\n\n host_split.pop(2).join('.')\n\n end",
"def host_and_path(uri)\n uri = URI.parse(uri) unless uri.is_a? URI\n host = uri.host\n path = uri.path.gsub(/\\/$/, '')\n path = path.empty? ? '/' : uri.path\n URI.parse(\"#{host}#{path}\")\n end",
"def parse_url(str)\n # regexp borrowed from js client\n parser = Regexp.new /^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/\\/?)?((?:(([^:@]*):?([^:@]*))?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/\n key = [\"scheme\",\"authority\",\"userInfo\",\"user\",\"pass\",\"host\",\"port\",\"relative\",\"path\",\"directory\",\"file\",\"query\"]\n match_data = parser.match str\n m = match_data.captures\n uri = {}\n 11.downto(0) do |i|\n uri[key[i]] = m[i] || nil\n end\n # this regex doesn't work the same as PHP parse_url\n # and it was stolen from the js client so that gives us more differences\n # so let's fix the discrepancies\n uri['fragment'] = str.scan(/#(.*)$/).to_s\n %w|relative directory authority file|.each { |w| uri.delete w }\n return uri.reject { |k,v| v == nil or v == \"\" } # remove values that are nil or empty\n end",
"def url_parse(url)\n begin\n uri = URI.parse(url)\n\n uri = URI.parse(\"http://#{url}\") if uri.class == URI::Generic\n uri.path = '/' unless uri.path.match(/^\\//)\n\n uri if PROTOCOLS.include?(uri.scheme)\n rescue URI::InvalidURIError\n puts \"Bad URL: #{url}\"\n end\n\n end",
"def clean_path(x)\n ip = url_unescape(x)\n ip.gsub!(/^#{Regexp.escape(root_uri_path)}/, '') if root_uri_path\n ip\n end",
"def absolutify_url(uri)\n if uri =~ /^\\w*\\:/i\n normalize_url(uri)\n else\n Addressable::URI.join(@url, uri).normalize.to_s\n end\n rescue URI::InvalidURIError, Addressable::URI::InvalidURIError => e\n add_fatal_error \"Link parsing exception: #{e.message}\" and nil\n end",
"def normalize_url(url)\n Addressable::URI.parse(url).normalize.to_s\n end",
"def convert_to_valid(url)\n return nil if url =~ /.jpg$/i\n url.insert(0, @main_url.first(5)) if url.start_with? '//'\n link = URI(url)\n main_page = URI(@main_url)\n if link && link.scheme && link.scheme.empty?\n link.scheme = main_page.scheme\n elsif link.nil?\n return nil\n end\n if link.scheme =~ /^http/\n request = link.to_s\n else\n request = nil\n end\n request\n rescue\n link\n end",
"def domain_name(url)\n regex = /(?:(http|https):\\/\\/)?(?:www\\.)?(?<domain_name>.*?)\\./\n return url.match(regex)[:domain_name]\n \n # original solution:\n # regex = /(?:(?:(?:http:\\/\\/)?(?:www\\.)?)|(?:(?:https:\\/\\/)?(?:www\\.)?))([\\w-]+)\\./\n # matches = regex.match(url)\n # return matches.to_a.last\nend",
"def nice_url\n\t\t# i want to take thr url and remove http:// and www.\n\t\t# gsub is global subsitution\n\t\turl.gsub(\"http://\", \"\").gsub(\"www.\", \"\")\n\tend",
"def host\n _, _, host, = URI.split url\n host\n end",
"def absolute_url_for(uri, str)\n # TODO: use URI.parse() for better handling?\n return str if str =~ /^[|[:alpha:]]+:\\/\\//\n File.join(((uri.path.empty?) ? uri.to_s : File.dirname(uri.to_s)), \n str)\n end",
"def url_for(str)\n return str if str =~ /^[|[:alpha:]]+:\\/\\//\n File.join((uri.path.empty?) ? uri.to_s : File.dirname(uri.to_s), str)\n end",
"def fix_oneoff url\n begin\n uri = URI.parse url\n return (\"\" == uri.path) ? url + '/' : url\n rescue\n #puts \"Ran into issue processing #{url}\"\n end\n end",
"def domain\n URI(base_url).host.downcase\n end",
"def conform_uri(uri_string)\n uri_string.gsub(/^(?!\\/)(.*)/, '/\\1').gsub(/[\\/]+$/, '')\n end",
"def parse_username_from_url\n URI.parse(url_from_attributes).path.split(\"/\")[1]\n rescue URI::BadURIError, URI::InvalidURIError\n nil\n end",
"def unescape_uri(uri); end",
"def urlify(string)\r\n string.downcase.split.join('-')\r\nend",
"def post_process_uri( val )\n\t\t\treturn URI.parse( val.to_s )\n\t\trescue URI::InvalidURIError => err\n\t\t\tself.log.error \"Error trying to parse URI %p: %s\" % [ val, err.message ]\n\t\t\treturn nil\n\t\trescue NoMethodError\n\t\t\tself.log.debug \"Ignoring bug in URI#parse\"\n\t\t\treturn nil\n\t\tend",
"def test_inexistent_local_name\n assert_equal(\"\", N::URI.new(\"http://somethingelse.com/\").local_name)\n end",
"def acceptable_from_uri?(uri)\n uri = URI(uri)\n\n host = DomainName.new(uri.host)\n\n # RFC 6265 5.3\n if host.hostname == @domain\n true\n elsif @for_domain # !host-only-flag\n host.cookie_domain?(@domain_name)\n else\n @domain.nil?\n end\n end",
"def host_without_subdomain\n parts = request.host_with_port.split('.').last(2)\n parts.join('.')\n end",
"def url_regexp\n /\\Ahttps?:\\/\\/([\\A\\s:@]+:[\\A\\s:@]*@)?[-[[:alnum:]]]+(\\.[-[[:alnum:]]]+)+\\.?(:\\d{1,5})?([\\/?]\\S*)?\\z/iux\n end",
"def external_urlname\n return urlname if urlname =~ /\\A(\\/|[a-z]+:\\/\\/)/\n \"http://#{urlname}\"\n end",
"def subdomain\n self.name.gsub('_', '.')\n end",
"def urlify(string)\n string.downcase.split.join('-')\nend",
"def unrelativize_url(url)\n url =~ /^\\/\\// ? \"#{scheme}://#{url[2..-1]}\" : url\n end",
"def unrelativize_url(url)\n url =~ /^\\/\\// ? \"#{scheme}://#{url[2..-1]}\" : url\n end",
"def converturl url\n return nil unless url\n newurl = url.sub('/wiki/','').downcase().sub('_(film)','').sub(/([12][8901].._film)/,'')\n newurl = URI.decode(newurl)\n # accept only alphanum and %\n newurl.gsub!(/[^0-9a-z%]/i,'')\n return newurl\nend",
"def url?(uri)\n /\\w+\\:\\/\\// =~ uri\n end",
"def get_subsite_url(origin_url, path)\n URI.parse(\"#{origin_url.scheme}://#{origin_url.host}#{path}\").normalize\n end"
] | [
"0.677612",
"0.6630629",
"0.6630629",
"0.6560784",
"0.65142155",
"0.64491236",
"0.64110756",
"0.6400645",
"0.6400645",
"0.6395796",
"0.6384113",
"0.63685095",
"0.63620925",
"0.6345576",
"0.62430656",
"0.62284994",
"0.6194634",
"0.61811304",
"0.61771625",
"0.61540616",
"0.61077243",
"0.61077243",
"0.6085826",
"0.6085826",
"0.6080665",
"0.60779405",
"0.6077236",
"0.6070014",
"0.60587215",
"0.60301685",
"0.6027597",
"0.6024394",
"0.60113937",
"0.6007532",
"0.5990475",
"0.5990191",
"0.59873086",
"0.5986932",
"0.5982823",
"0.5982681",
"0.598009",
"0.5969103",
"0.5968889",
"0.59564865",
"0.5948012",
"0.5945051",
"0.5942094",
"0.5935022",
"0.5935022",
"0.5934622",
"0.59331554",
"0.59288746",
"0.5912854",
"0.5904921",
"0.5892087",
"0.5882536",
"0.58821595",
"0.58803403",
"0.58765125",
"0.58760965",
"0.5873808",
"0.5869075",
"0.5869075",
"0.5859539",
"0.5858498",
"0.5852166",
"0.58332855",
"0.5832589",
"0.58295333",
"0.58160985",
"0.5811172",
"0.5811139",
"0.58055913",
"0.5782232",
"0.5779545",
"0.5765919",
"0.57625055",
"0.57607865",
"0.5760173",
"0.57601607",
"0.57516277",
"0.57506275",
"0.57461774",
"0.5741559",
"0.5739275",
"0.57345045",
"0.57318825",
"0.57278025",
"0.5727052",
"0.5714413",
"0.57104075",
"0.5709325",
"0.57036185",
"0.57012135",
"0.5681035",
"0.56763357",
"0.56763357",
"0.5673596",
"0.5661946",
"0.5658265"
] | 0.6045141 | 29 |
GET /contests/1 GET /contests/1.json | def show
@contest = Contest.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @contest }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @contest = Contest.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def index\n @contests = Contest.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end",
"def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end",
"def show\n @submissions = Contests.get_contest_submissions(params[:id])\n unless @submissions.nil?\n render json: @submissions\n return\n end\n end",
"def index\n @contests = Contest.all\n end",
"def index\n @contests = Contest.all\n end",
"def index\n @contests = Contest.all\n end",
"def index\n @contests = Contest.all\n end",
"def show\n @contestant = Contestant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contestant }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n @contest = Contest.new\n @problem_count = 4\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @contest }\n end\n end",
"def show\n respond_to do |format|\n format.html { render :layout => \"ai_contest\" }\n #format.json { render json: @ai_contest }\n end\n end",
"def index\n @contests = current_user.contests\n end",
"def get_contest\n @contest = Contest.find_by_id(params[:id])\n return if check_nil_object(@contest)\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def show\n @optin_contestant = OptinContestant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @optin_contestant }\n end\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def show\n include_admin = @current_user.is_admin?\n @submissions_table = @contest.all_submissions_table(include_admin)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @problems }\n end\n end",
"def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contests }\n end\n end",
"def index\n @contests = @event.contests\n end",
"def show\n @contest = Contest.find(params[:id])\n \n add_breadcrumb \"Tramanta\", :root_path\n add_breadcrumb @contest.name.capitalize, @contest\n\n @title_content = @contest.name\n \t@meta_description_content = @contest.instructions\n @og_type = 'article'\n @og_image = 'http://www.tramanta.com'[email protected](:xl)\n @og_description = @contest.name+' - '[email protected]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def get_contest\n @contest = Contest.find_by_id(params[:contest_id])\n return if check_nil_object(@contest)\n end",
"def show\n #REQUIRES: existence of contest with :id\n #EFFECTS: allows rendering of one particular contest and its properties\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def status\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}\") )\n end",
"def index\n @contests = Contest.find(:all, :order => 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contests }\n end\n end",
"def set_contest\n @contest = Contest.friendly.find(params[:id])\n end",
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def index\n @team_challenges = TeamChallenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @team_challenges }\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_contest\n\t\t\t@contest = Contest.find(params[:id])\n\t\tend",
"def new\n add_breadcrumb \"nueva\", :new_contest_path\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def retrieve_attempted\n\t\trender json: @@contests_attempted_shared\n\tend",
"def index\n @contestants = Contestant.all\n end",
"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",
"def show\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @challenge }\n end\n end",
"def show\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @challenge }\n end\n end",
"def get_contestsolution\n @contestsolution = Contestsolution.find_by_id(params[:id])\n return if check_nil_object(@contestsolution)\n @contestproblem = @contestsolution.contestproblem\n @contest = @contestproblem.contest\n end",
"def get_contestproblem\n @contestproblem = Contestproblem.find_by_id(params[:id])\n return if check_nil_object(@contestproblem)\n @contest = @contestproblem.contest\n end",
"def get_contest2\n @contest = Contest.find_by_id(params[:contest_id])\n return if check_nil_object(@contest)\n end",
"def fetch_experiment(id)\n url = @base + \"experiments/#{id}.json?token=#{@token}\"\n puts url\n response = JSON.parse(RestClient.get(url))\nend",
"def show\n @contest = Contest.find(params[:id])\n @num_probs = @contest.puzzle_ident == 3 ? 3 : 2\n if @contest.start > DateTime.now\n unless current_user.is_admin\n redirect_to contests_path, alert: \"That contest has not yet started\"\n return\n end\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def show\n @team_challenge = TeamChallenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @team_challenge }\n end\n end",
"def show\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @testcase }\n end\n end",
"def show\n @routine_interview = RoutineInterview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @routine_interview }\n end\n end",
"def show\n @competition = Competition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competition }\n end\n end",
"def index\n @challenges = Challenge.user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def index\n @challenges = Challenge.order(:id)\n .includes(:user)\n .page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @challenges }\n end\n end",
"def show\n @gotcha = Gotcha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gotcha }\n end\n end",
"def get_current_contest\n @contest = Contest.where(\"start_date < :today AND end_date >= :today\", {today: Date.today}).order(created_at: :desc).active.first\n if @contest.nil?\n render json: {status: \"error\", code: 404, message: \"No active contest found\" }\n end\n end",
"def index\n @contest = Contest.find_by(path: params[:contest])\n @participant = @contest.participants.find_by(path: params[:participant])\n @submits = @participant.submits\n\n @navpill\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @submits }\n end\n end",
"def show\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @challenge }\n end\n end",
"def show\n\n @competitions = Competition.all\n @competition = Competition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competition }\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n @participated = @contest.participants.include? @current_user\n\n current = DateTime.now\n @state = @contest.begin_date > current ? Contest::STATE_BEFORE\n : @contest.end_date > current ? Contest::STATE_CURRENT\n : Contest::STATE_AFTER\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n\n @contestant = Contestant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contestant }\n end\n end",
"def index\n @contestants = Contestant.all\n\n if @contestants.count > 2\n first_id = @contestants.first.id\n last_id = @contestants.last.id\n winner = rand(first_id..last_id)\n @winner = Contestant.find(winner)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contestants }\n end\n end",
"def new\n block_non_user\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def show\n @puzzle = Puzzle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puzzle }\n end\n end",
"def create\n @contest = Contest.new(contest_params)\n respond_to do |format|\n if @contest.save\n format.html { redirect_to a_contest_url(@contest), notice: I18n.t('a.contests.notices.create') }\n format.json { render action: 'show', status: :created, location: @contest }\n else\n set_data_for_new_form\n format.html { render action: 'new' }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @solution = @idea.solutions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solution }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :ok }\n end\n end",
"def index\n @competitions = Competition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @competitions }\n end\n end",
"def create\n @contest = Contest.new(contest_params)\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to [:admin, @contest], notice: 'Contest was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @contest] }\n else\n format.html { render :new }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @title = \"View Team Challenge Score\"\n @challenge_grade = ChallengeGrade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @challenge_grade }\n end\n end",
"def get_contestproblem2\n @contestproblem = Contestproblem.find_by_id(params[:contestproblem_id])\n return if check_nil_object(@contestproblem)\n @contest = @contestproblem.contest\n end",
"def index\n permitted_to! :inspect, Problem.find(params[:problem_id])\n @test_sets = TestSet.where(:problem_id => params[:problem_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @test_sets }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def set_contest\n @contest = Contest.where(:is_live => true).first\n end",
"def show\n @playground = Playground.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @playground }\n end\n end",
"def show\n @competition = Competition.includes(:challenges).find(params[:id])\n end",
"def show\n # Find the challenge in database to see if it exsits.\n @challenge = Challenge.find(params[:id])\n\n if @challenge\n # Restructure challenge and return as JSON.\n @challenge = restructure_challenge(@challenge)\n render json: {challenge: @challenge}\n else\n # Return JSON with error message.\n error = \"Challenge with that id does not exsits\"\n render json: {error: error}\n end\n end",
"def show\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment }\n end\n end",
"def show\n @experiment = Experiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @experiment }\n end\n end",
"def new\n @ai_contest = AiContest.new\n @ai_contest.owner_id = current_user.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ai_contest }\n end\n end",
"def show\n @solution = Solution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solution }\n end\n end",
"def contests()\n\t\tself.as_contestants.collect{|c| c.contest }\n\tend",
"def contest_params\n params[:contest]\n end",
"def new\n @contest = Contest.new\n end",
"def new\n @contest = Contest.new\n end",
"def index\n @experiments = Experiment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @experiments }\n end\n end",
"def index\n @solutions = @idea.solutions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @solutions }\n end\n end",
"def set_contest\n @contest = Contest.find_by_slug!(params[:contest_id])\n end"
] | [
"0.8039824",
"0.80027866",
"0.7894636",
"0.78603256",
"0.74444187",
"0.73176265",
"0.73176265",
"0.73176265",
"0.73176265",
"0.7205758",
"0.7156151",
"0.7156151",
"0.71495616",
"0.7118187",
"0.7028238",
"0.6884724",
"0.6837134",
"0.6814197",
"0.6814197",
"0.6757925",
"0.67245495",
"0.6696794",
"0.6696794",
"0.6696794",
"0.6696794",
"0.6696794",
"0.6696794",
"0.6696794",
"0.6696794",
"0.66942734",
"0.6684733",
"0.6683046",
"0.6676025",
"0.666305",
"0.66576815",
"0.6645285",
"0.6638757",
"0.6582603",
"0.6563115",
"0.6550674",
"0.6542214",
"0.6542039",
"0.6542039",
"0.6542039",
"0.65173924",
"0.649216",
"0.6473898",
"0.64714223",
"0.643028",
"0.6428822",
"0.6427494",
"0.6420713",
"0.6406576",
"0.6386852",
"0.63659686",
"0.63645667",
"0.63612735",
"0.63421583",
"0.6341572",
"0.6330421",
"0.6318123",
"0.63108957",
"0.6306589",
"0.6286191",
"0.6283374",
"0.6282897",
"0.62647015",
"0.6244773",
"0.62397736",
"0.6215018",
"0.62084967",
"0.6201794",
"0.6155441",
"0.6130417",
"0.6126309",
"0.6126157",
"0.61103743",
"0.6103228",
"0.6101493",
"0.6095954",
"0.60845727",
"0.60845727",
"0.60845727",
"0.60845727",
"0.6081174",
"0.60692203",
"0.60660565",
"0.60615",
"0.606092",
"0.606092",
"0.60562205",
"0.604813",
"0.6035212",
"0.6034032",
"0.6033922",
"0.6033922",
"0.6021501",
"0.60055226",
"0.60012937"
] | 0.79434526 | 3 |
GET /contests/new GET /contests/new.json | def new
@contest = Contest.new
respond_to do |format|
format.html {
if current_user.instance_of? Contractor
render
elsif current_user.instance_of? Designer
self.unauthorized
end
}
format.json { render :json => @contest }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @contest }\n end\n end",
"def new\n @contest = Contest.new\n @problem_count = 4\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n add_breadcrumb \"nueva\", :new_contest_path\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n block_non_user\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n\n @contestant = Contestant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contestant }\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(contest_params)\n respond_to do |format|\n if @contest.save\n format.html { redirect_to a_contest_url(@contest), notice: I18n.t('a.contests.notices.create') }\n format.json { render action: 'show', status: :created, location: @contest }\n else\n set_data_for_new_form\n format.html { render action: 'new' }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @contest = Contest.new\n end",
"def new\n @contest = Contest.new\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def new\n @optin_contestant = OptinContestant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @optin_contestant }\n end\n end",
"def new\n @competition = Competition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competition }\n end\n end",
"def new\n @competition = Competition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competition }\n end\n end",
"def new\n @competition = Competition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competition }\n end\n end",
"def new\n @ai_contest = AiContest.new\n @ai_contest.owner_id = current_user.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ai_contest }\n end\n end",
"def create\n contest = contest_params[:contest]\n puts contest\n @contest = Contests.create(contest_params)\n respond_to do |format|\n unless @contest.nil?\n @contest[:createContest] = @contest[\"createContest\"]\n format.html { redirect_to \"/contests/view/#{@contest[:createContest]}\" }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def new\n @exercice = Exercice.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercice }\n end\n end",
"def create\n @contest = Contest.new(contest_params)\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to [:admin, @contest], notice: 'Contest was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @contest] }\n else\n format.html { render :new }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @casestudy = Casestudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @casestudy }\n end\n end",
"def new\n @challenge = Challenge.new\n add_breadcrumb 'new', @challenge\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @challenge }\n end\n end",
"def new\n @challenge = Challenge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @challenge }\n end\n end",
"def new\n @challenge = Challenge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @challenge }\n end\n end",
"def new\n @solution = @idea.solutions.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solution }\n end\n end",
"def new\n @contestproblem = Contestproblem.new\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to(@contest, :notice => 'Contest was successfully created.') }\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",
"def new\n @gotcha = Gotcha.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gotcha }\n end\n end",
"def new\n @solution = Solution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solution }\n end\n end",
"def new\n @cont = Cont.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cont }\n end\n end",
"def new\n @court = Court.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @court }\n end\n end",
"def new\n @court = Court.new\n\n respond_to do |format|\n format.html { render \"new\", :layout=>false}\n format.json { render json: @court }\n end\n end",
"def new\n @case_study = CaseStudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @case_study }\n end\n end",
"def new\n @case_study = CaseStudy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @case_study }\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\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",
"def create\n @contest = Contest.new(params[:contest])\n @contest.contractor_id = current_user.id\n \n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, :notice => 'Contest was successfully created.' }\n format.json { render :json => @contest, :status => :created, :location => @contest }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n #EFFECTS: Allows rendering of a form for inputting information to create a new contest.\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def new\n @nightclub = Nightclub.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nightclub }\n end\n end",
"def create\n @game = @contest.games.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to contest_games_path, notice: 'Game was successfully created.' }\n format.json { render action: 'show', status: :created, location: @game }\n else\n format.html { render action: 'new' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @project = Project.new(user_id: current_user.id)\n find_people_list\n fetch_clients\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trial }\n end\n end",
"def new\n @petition = Petition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @petition }\n end\n end",
"def new\n @quest = Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end",
"def new\n @playground = Playground.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @playground }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.json { render json: @project }\n format.html # new.html.erb\n end\n end",
"def new\n @playground = Playground.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @playground }\n end\n end",
"def new\n @work = Work.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end",
"def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end",
"def new\n @work = Work.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @work }\n end\n end",
"def new\n @experiment = Experiment.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n kick and return if not is_god?\n @puzzle = Puzzle.new\n @other_puzzles = Puzzle.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puzzle }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @project }\n end\n end",
"def new\n @problem = Problem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end",
"def new\n @problem = Problem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @problem }\n end\n end",
"def new\n @team_challenge = TeamChallenge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @team_challenge }\n end\n end",
"def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end",
"def new\n @experiment = Experiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @experiment }\n end\n end",
"def new\n @criterion = Criterion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @criterion }\n end\n end",
"def new\n @interview = Interview.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interview }\n end\n end",
"def new\n @problem = Problem.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @problem }\n end\n end",
"def new\n @work = Work.new\n\n respond_to do |format|\n format.json { render json: @work }\n end\n end",
"def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end",
"def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end",
"def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end",
"def new\n @exercise = Exercise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise }\n end\n end",
"def new\n @tournament = Tournament.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tournament }\n end\n end",
"def new\n @game = Game.new\n @participants = Participant.find_all_by_meeting_id(@meeting.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def new\n @t = T.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @t }\n end\n end",
"def create\n @contestant = Contestant.new(contestant_params)\n\n \n if @contestant.save\n render json: @contestant\n else\n render json: @contestant.errors\n end\n \n end"
] | [
"0.84161323",
"0.84161323",
"0.8337011",
"0.8180796",
"0.81516045",
"0.7913461",
"0.7685467",
"0.7532079",
"0.7532079",
"0.7532079",
"0.75287265",
"0.75068116",
"0.75068116",
"0.73809254",
"0.73809254",
"0.73809254",
"0.7335651",
"0.7218757",
"0.7218757",
"0.7218757",
"0.72102314",
"0.7194679",
"0.7054774",
"0.7022526",
"0.70218754",
"0.7019031",
"0.69963026",
"0.69963026",
"0.6983405",
"0.6954189",
"0.6946952",
"0.69239897",
"0.6910888",
"0.6902598",
"0.68999404",
"0.6887086",
"0.6881567",
"0.6881567",
"0.6874566",
"0.68687",
"0.6866395",
"0.6862538",
"0.6852086",
"0.6851898",
"0.68440425",
"0.6832361",
"0.6827281",
"0.6826195",
"0.681421",
"0.681421",
"0.681421",
"0.681421",
"0.681421",
"0.681421",
"0.681421",
"0.681421",
"0.681421",
"0.681421",
"0.681421",
"0.681421",
"0.681421",
"0.681421",
"0.681421",
"0.681421",
"0.681421",
"0.681421",
"0.681421",
"0.681421",
"0.681421",
"0.681421",
"0.681421",
"0.6812222",
"0.68075204",
"0.6801708",
"0.6799882",
"0.6799882",
"0.679979",
"0.6782279",
"0.6782241",
"0.6780635",
"0.6779107",
"0.6779107",
"0.6778285",
"0.6769417",
"0.6769417",
"0.6769125",
"0.67666304",
"0.6764746",
"0.6762979",
"0.67603195",
"0.67603195",
"0.67603195",
"0.67603195",
"0.6750944",
"0.67491496",
"0.6748791",
"0.6748791",
"0.6748791",
"0.6748791",
"0.67445034",
"0.67389417"
] | 0.0 | -1 |
POST /contests POST /contests.json | def create
@contest = Contest.new(params[:contest])
@contest.contractor_id = current_user.id
respond_to do |format|
if @contest.save
format.html { redirect_to @contest, :notice => 'Contest was successfully created.' }
format.json { render :json => @contest, :status => :created, :location => @contest }
else
format.html { render :action => "new" }
format.json { render :json => @contest.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = @event.contests.build(contest_params)\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to [@event, @contest], notice: 'Contest was successfully created.' }\n format.json { render :show, status: :created, location: @contest }\n else\n format.html { render :new }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(contest_params)\n respond_to do |format|\n if @contest.save\n format.html { redirect_to a_contest_url(@contest), notice: I18n.t('a.contests.notices.create') }\n format.json { render action: 'show', status: :created, location: @contest }\n else\n set_data_for_new_form\n format.html { render action: 'new' }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(contest_params)\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to [:admin, @contest], notice: 'Contest was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @contest] }\n else\n format.html { render :new }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n \n respond_to do |format|\n if @contest.save\n format.html { redirect_to contest_path(@contest.path)+'/upload', \n notice: 'Contest was successfully created.' \n }\n #format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n #format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @contests = Contest.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end",
"def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n @contest.user_id = current_user.id\n parse_and_create_teams(params[:teams]) if params[:teams]\n \n respond_to do |format|\n if @contest.save\n create_open_post\n flash[:notice] = 'Contest was successfully created.'\n format.html { redirect_to(contests_path) }\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",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to(@contest, :notice => 'Contest was successfully created.') }\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",
"def create\n contest = contest_params[:contest]\n puts contest\n @contest = Contests.create(contest_params)\n respond_to do |format|\n unless @contest.nil?\n @contest[:createContest] = @contest[\"createContest\"]\n format.html { redirect_to \"/contests/view/#{@contest[:createContest]}\" }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def create\n @contestant = Contestant.new(contestant_params)\n\n \n if @contestant.save\n render json: @contestant\n else\n render json: @contestant.errors\n end\n \n end",
"def new\n @contest = Contest.new\n @problem_count = 4\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\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",
"def create\n block_non_user\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n Dir::mkdir(\"task_data/contests/#{@contest.id}\")\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @contest }\n end\n end",
"def create\n respond_to do |format|\n if @ai_contest.update_attributes(permitted_params)\n format.html { redirect_to @ai_contest, notice: 'Ai contest was successfully created.' }\n format.json { render json: @ai_contest, status: :created, location: @ai_contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ai_contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @contests = Contest.all\n end",
"def index\n @contests = Contest.all\n end",
"def index\n @contests = Contest.all\n end",
"def index\n @contests = Contest.all\n end",
"def create\n @game = @contest.games.new(game_params)\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to contest_games_path, notice: 'Game was successfully created.' }\n format.json { render action: 'show', status: :created, location: @game }\n else\n format.html { render action: 'new' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def contest_params\n params.require(:contest).permit(:name, :active_round, :posted, :api_key)\n end",
"def create_contest\n\t\t@contest = Contest.new(contest_params)\n\t\t# Store the name of the product for easier readability\n\t\t#binding.pry\n\t\[email protected]_id = Product.find_by_shopify_product_id(contest_params[:product_id]).try(:name) if contest_params[:product_id].present?\n\t\[email protected]_id = current_account.id\n\t\[email protected]_id = 1\n\t\trespond_to do |format|\n\t\t if @contest.save\n\t\t\t# Pick a winner\n\t\t\tcandidates = Order.candidate_list(params)\n\t\t\tcontest_results = ContestResults.new(candidates)\n\t\t\t# Save the winner\n\t\t\[email protected]_attribute(:order_id, contest_results.results)\n\t\t\tformat.html { redirect_to root_path, notice: \"Contest Winner: <a href='#{order_path(@contest.order)}'>#{@contest.order.email}</a>\" }\n\t\t\tformat.json { render action: 'show', status: :created, location: @contest }\n\t\t else\n\t\t\tformat.html { redirect_to root_path, alert: \"Unable to create a Contest\" }\n\t\t\tformat.json { render json: @contest.errors, status: :unprocessable_entity }\n\t\t end\n\t\tend\n\tend",
"def submit\n\t\tcontest_id = get_params[:contest_id]\n\t\tstudent_id = current_student.id\n\t\tcproblem_id = get_params[:cproblem_id]\n\t\tstatus = get_params[:status]\n\t\tCproblem.submit(contest_id, cproblem_id, student_id, status)\n\t\trender json: {}\n\tend",
"def create\n if is_admin?\n @contest = current_user.contests.build(contest_params)\n\n if @contest.save\n redirect_to contest_path(:id => @contest.id)\n else\n flash[:notice] = \"contest couldn't be created\"\n redirect_to questions_path\n end\n else\n flash[:notice] = 'not sufficient permission'\n redirect_to questions_path\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n @problem_count = 4\n\n @contest.begin_date_str = params[:begin_date]\n @contest.end_date_str = params[:end_date]\n\n problems = []\n for i,p in params[:problems]\n number = p[:number]\n score = p[:score]\n\n next if number.blank? && score.blank?\n @contest.errors[:problem] << \"#{i}'s number is invalid.\" and next if number.blank?\n @contest.errors[:problem] << \"#{i}'s score is invalid.\" and next if score.blank?\n\n aoj_problem = AOJ::Problem.new(number)\n @contest.errors[:problem] << \"#{i} is invalid.\" and next unless aoj_problem.valid?\n problem = Problem.new({\n number: number.to_i,\n name: aoj_problem.name,\n score: score.to_i,\n contest: @contest,\n })\n problems << problem\n end\n @contest.problems = problems\n\n @contest.errors[:problems] << 'are required more than 0.' if problems.size==0\n\n\n unless @contest.errors.empty?\n render action: 'new' and return\n end\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_contest\n @contest = Contest.new(contest_params)\n # Store the name of the product for easier readability\n @contest.product_name = Product.find_by_shopify_product_\n id(contest_params[:product_id]).try(:name) if contest_\n params[:product_id].present?\n respond_to do |format|\n if @contest.save\n # Pick a winner\n candidates = Order.candidate_list(params)\n contest_results = ContestResults.new(candidates)\n # Save the winner\n @contest.update_attribute(:order_id,\n contest_results.results)\n format.html { redirect_to root_path, notice: \"Contest Winner: <a href='#{order_path(@contest.order)}'>#{@contest.order.email}</a>\" }\n format.json { render action: 'show', status: :created,\n location: @contest }\n else\n format.html { redirect_to root_path, alert: \"Unable to\n create a Contest\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def contest_params\n # TODO set case based on rights\n # all for admin\n # only vice for committee_head\n # only judge for jury_head\n # etc\n params.require(:contest).permit(:name, :starts_at, :ends_at, :regulations, :committee_head_ids, :jury_head_ids, :committee_vice_ids, jury_judge_ids: [])\n end",
"def create\n @optin_contestant = OptinContestant.new(params[:optin_contestant])\n\n respond_to do |format|\n if @optin_contestant.save\n format.html { redirect_to @optin_contestant, notice: 'Optin contestant was successfully created.' }\n format.json { render json: @optin_contestant, status: :created, location: @optin_contestant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @optin_contestant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def contest_params\n params.require(:contest).permit(:name, :description)\n end",
"def show\n @contest = Contest.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def new\n add_breadcrumb \"nueva\", :new_contest_path\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def create\n @book_contest = BookContest.new(book_contest_params)\n\n respond_to do |format|\n if @book_contest.save\n format.html { redirect_to @book_contest, notice: 'Book contest was successfully created.' }\n format.json { render :show, status: :created, location: @book_contest }\n else\n format.html { render :new }\n format.json { render json: @book_contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n block_non_user\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def index\n @contests = @event.contests\n end",
"def show\n @submissions = Contests.get_contest_submissions(params[:id])\n unless @submissions.nil?\n render json: @submissions\n return\n end\n end",
"def contest_params\n params.require(:contest).permit(:name, :contest_type, :description, :judging_criteria, :additional_details, :start_date, :end_time, :reward, :premium, :sponsor, :status, :private, :admin_id)\n end",
"def new\n @contest = Contest.new\n end",
"def new\n @contest = Contest.new\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contest }\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contest }\n end\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def create\n @bracketcontest = Bracketcontest.new(bracketcontest_params)\n # This next statement is due to Manager inheriting from Competition.\n @bracketcontest.competition = @manager.as_competition()\n @bracketcontest.bracketgrouping_id = @bracketgrouping.id\n\n respond_to do |format|\n if @bracketcontest.save\n\t save_contestants()\n\t flash[:notice] = 'Bracketcontest was successfully created.' \n\t format.html { redirect_to edit_bracketgrouping_bracketcontest_path(@bracketgrouping, @bracketcontest)}\n\t format.json { render :show, status: :created, location: @bracketcontest }\n\telse\n flash[:alert] = 'Unable to save new Bracket Contest. ' + @bracketcontest.errors.full_messages().join(\" \")\n format.html { render :new }\n format.json { render json: @bracketcontest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def contest_params\n params[:contest]\n end",
"def contest_params\n\t\t\tparams.require(:contest).permit(:title, :start_time, :finish_time, :description)\n\t\tend",
"def create\n @contest = Contest.new(params.require(:contest).permit(:number, :description, :medal))\n\n if @contest.save\n flash[:success] = \"Concours ajouté.\"\n redirect_to @contest\n else\n render 'new'\n end\n end",
"def create\n @showdown = Showdown.new(showdown_params)\n if params.has_key?(:contestant)\n contestants = []\n params[:contestant].each_with_index do |contestant, index|\n if Contestant.where(name: contestant).count > 0\n contestants << Contestant.where(name: contestant).first\n else\n contestant = Contestant.create(name: contestant)\n contestant.portrait_url = JSON.parse(params[\"portrait#{index + 1}\"])[0]['url']\n if contestant.save\n contestants << contestant\n end\n end\n end\n if params.has_key?(:stats)\n params[:stats].each do |index, stat_row|\n stat = Stat.create(showdown: @showdown, description: stat_row[:description])\n ContestantStat.create(stat: stat, value: stat_row[:contestant1], contestant: contestants.first)\n ContestantStat.create(stat: stat, value: stat_row[:contestant2], contestant: contestants.last)\n end\n end\n @showdown.contestants = contestants\n end\n\n respond_to do |format|\n if @showdown.save\n format.html { redirect_to @showdown, notice: 'Showdown was successfully created.' }\n format.json { render :show, status: :created, location: @showdown }\n else\n format.html { render :new }\n format.json { render json: @showdown.errors, status: :unprocessable_entity }\n end\n end\n end",
"def contest_params\n params.require(:contest).permit(:user_id, \n :league, \n :name, \n :gameset_id,\n :size, \n :starttime, \n :game_id, \n :game_ids => [], \n :games_attributes => [:id, :name,\n :entries_attributes => [:id, :user_id, :game_id, :weight, :selected_winner_id, :contest_id]\n ])\n end",
"def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contests }\n end\n end",
"def index\n @contests = current_user.contests\n end",
"def contest_params\n params.require(:contest).permit(:nombre, :banner, :url, :descripcion, :premio, :fechainicio, :fechafin, :administrator_id)\n end",
"def index\n @contestants = Contestant.all\n end",
"def contest_params\n params[\"params\"].require(:contest).permit(:contest_type, :battlepet_traits => [], :battlepets => [])\n end",
"def new\n\n @contestant = Contestant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contestant }\n end\n end",
"def contest_params\n params.require(:contest).permit(:description_en, :description_ja,\n :end_at, :name_en, :name_ja, :score_baseline,\n :start_at, :status, :password)\n end",
"def index\n @contest = Contest.find_by(path: params[:contest])\n @participant = @contest.participants.find_by(path: params[:participant])\n @submits = @participant.submits\n\n @navpill\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @submits }\n end\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def process_contest(jasper, contest_id = nil)\n contest_id = jasper.contest_id if contest_id == nil\n dContest = nil\n contest_params = extract_contest_params_hash(jasper)\n if (contest_id)\n dContest = updateOrCreateContest(contest_id, contest_params)\n else\n dContest = Contest.create(contest_params)\n end\n if dContest\n process_scores(dContest, jasper)\n end\n dContest\nend",
"def create\n @contest_entry = ContestEntry.new(params[:contest_entry])\n\n respond_to do |format|\n if @contest_entry.save\n format.html { redirect_to new_contest_entry_path, :notice => 'Contest was successfully entered.' }\n format.xml { render :xml => @contest_entry, :status => :created, :location => @contest_entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contest_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :ok }\n end\n end",
"def set_contest\n\t\t\t@contest = Contest.find(params[:id])\n\t\tend",
"def create\n @testcase = Testcase.new(params[:testcase])\n\n respond_to do |format|\n if @testcase.save\n format.html { redirect_to @testcase, :notice => 'Test was successfully created.' }\n format.json { render :json => @testcase, :status => :created, :location => @test }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_contest\n @contest = Contest.friendly.find(params[:id])\n end",
"def create\n contestorganization = Contestorganization.create(params.require(:contestorganization).permit(:contest_id, :user_id))\n redirect_to contest_path(contestorganization.contest)\n end",
"def update\n @contest =Contest.find_by_id(params[:contest_id])\n\n if [email protected]?\n @contest.content = params[:contest_content]\n @contest.detail = params[:contest_detail]\n @contest.save\n\n if request.xhr?\n render :json => {\n :status => \"success\"\n }\n end\n else\n if request.xhr?\n render :json => {\n :status => \"failure\"\n }\n end\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url, notice: 'Contest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n #MODIFIES: the database\n #EFFECTS: updates the database with information about contest with :id provided by the user\n # in the form rendered by the 'new' method\n @contest = Contest.new(params[:contest])\n \n @index =0\n \t@key_words = ['First Year', 'Second Year', 'Cramming', 'Donezo', 'Ballin',\n \t'Mr. Jefferson', 'Lawnie', 'Comm School', 'Cav Man', 'Streaking', 'Winter',\n \t'Bro', 'Incompatible', 'Too Much Facebook']\n# \n# #NEW CODE ADDED TO SCAFFOLDED METHOD\n# @is_active = 'true'\n# \t @hours = 0\n# \t @name=key_words[index]\n# \t @index++ \t \n# #END OF NEW CODE\n# \n \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\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n \tend\n \t \n end",
"def destroy\r\n @contest.destroy\r\n respond_to do |format|\r\n format.html { redirect_to contests_url, notice: 'Contest was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def contest_params\n params.require(:contest).permit(:name, :starts_in)\n end",
"def create\n @case_test = CaseTest.new(case_test_params)\n\n respond_to do |format|\n if @case_test.save\n format.html { redirect_to @case_test, notice: 'Case test was successfully created.' }\n format.json { render :show, status: :created, location: @case_test }\n else\n format.html { render :new }\n format.json { render json: @case_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if @test.done.blank?\n redirect_to root_path, warning: \"This test have not finished yet\"\n return\n end\n params[:submission] = {}\n params[:submission][:user_id] = current_user.id\n @submission = @test.submissions.create(submission_params)\n respond_to do |format|\n if @submission.save\n @test.questions.each do |question|\n question.answers.each do |answer|\n answer.answers_of_questions.create({choice: false, question_id: question.id, submission_id: @submission.id})\n end\n end\n format.html { redirect_to edit_test_submission_path(@test, @submission) }\n else\n format.html { render :new }\n end\n end\n end",
"def index\n @contests = Contest.find(:all, :order => 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contests }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contest }\n end\n end",
"def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to admin_contests_url, notice: 'Contest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n\n reviews = []\n params[:scores].keys.each{ |name|\n score = params[:scores][name]\n peer_review = PeerReview.new(name:name, score:score, miniproject_id:params[:project][:id])\n peer_review.save\n reviews << peer_review\n }\n\n render json: reviews\n\n end",
"def create\n @gotcha = Gotcha.new(params[:gotcha])\n\n respond_to do |format|\n if @gotcha.save\n format.html { redirect_to gotchas_url, notice: 'Gotcha was successfully created.' }\n format.json { render json: @gotcha, status: :created, location: @gotcha }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gotcha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @team_challenges = TeamChallenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @team_challenges }\n end\n end",
"def create\n @test = Test.create!(test_params)\n\n render json: @test\n end"
] | [
"0.74872786",
"0.74872786",
"0.74872786",
"0.7152174",
"0.7103855",
"0.70241404",
"0.70208913",
"0.69897294",
"0.695391",
"0.68805426",
"0.68404317",
"0.68307537",
"0.68174773",
"0.6759615",
"0.6731611",
"0.67187345",
"0.6692199",
"0.6692199",
"0.66318876",
"0.66176033",
"0.6520299",
"0.6520299",
"0.6520299",
"0.6520299",
"0.65089417",
"0.6475509",
"0.64315784",
"0.6342171",
"0.6270461",
"0.62629926",
"0.6192201",
"0.617658",
"0.612865",
"0.6126723",
"0.611971",
"0.6110996",
"0.6110996",
"0.6096046",
"0.6089086",
"0.6088324",
"0.60711634",
"0.6058476",
"0.604821",
"0.6047567",
"0.6047527",
"0.6047527",
"0.603183",
"0.603183",
"0.60173815",
"0.60173815",
"0.60173815",
"0.60173815",
"0.60173815",
"0.60173815",
"0.60173815",
"0.60173815",
"0.60157955",
"0.5952712",
"0.5947898",
"0.59425944",
"0.58959156",
"0.5890836",
"0.5880081",
"0.5866825",
"0.58536714",
"0.58355",
"0.58186406",
"0.5814973",
"0.5814619",
"0.58050555",
"0.5802681",
"0.5790118",
"0.5787183",
"0.5785035",
"0.5782465",
"0.57753545",
"0.57746994",
"0.57646805",
"0.57432234",
"0.5728277",
"0.5718328",
"0.5700197",
"0.5700197",
"0.5700197",
"0.5700197",
"0.56997097",
"0.5677862",
"0.5659604",
"0.5641331",
"0.56233394",
"0.56082803",
"0.5605624",
"0.5583407",
"0.5583407",
"0.5583407",
"0.55762047",
"0.5567733",
"0.5554577",
"0.55437106",
"0.554355"
] | 0.67118084 | 16 |
PUT /contests/1 PUT /contests/1.json | def update
@contest = Contest.find(params[:id])
respond_to do |format|
if @contest.update_attributes(params[:contest])
format.html { redirect_to @contest, :notice => 'Contest was successfully updated.' }
format.json { head :no_content }
else
format.html { render :action => "edit" }
format.json { render :json => @contest.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @contest = Contest.find_by(path: params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to contest_path(@contest.path)+'/upload' }\n #format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n #format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @contest.update(contest_params)\r\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @contest }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @contest.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @contest.update(contest_params)\n format.html { redirect_to [@event, @contest], notice: 'Contest was successfully updated.' }\n format.json { render :show, status: :ok, location: @contest }\n else\n format.html { render :edit }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contest =Contest.find_by_id(params[:contest_id])\n\n if [email protected]?\n @contest.content = params[:contest_content]\n @contest.detail = params[:contest_detail]\n @contest.save\n\n if request.xhr?\n render :json => {\n :status => \"success\"\n }\n end\n else\n if request.xhr?\n render :json => {\n :status => \"failure\"\n }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contest.update(contest_params)\n format.html { redirect_to [:admin, @contest], notice: 'Contest was successfully updated.' }\n format.json { render :show, status: :ok, location: [:admin, @contest] }\n else\n format.html { render :edit }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n block_non_user\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n flash[:notice] = 'Contest was successfully updated.'\n format.html { redirect_to(contests_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contest.update(contest_params)\n format.html { redirect_to a_contests_url, notice: I18n.t('a.contests.notices.create') }\n format.json { head :no_content }\n else\n set_data_for_edit_form\n format.html { render action: 'edit' }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to(@contest, :notice => 'Contest was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ai_contest = AiContest.find(params[:id])\n\n respond_to do |format|\n if @ai_contest.update_attributes(ai_contest_params)\n format.html { redirect_to @ai_contest, notice: 'Ai contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ai_contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n flash[:notice] = 'Contest was successfully updated.'\n format.html { redirect_to(@contest) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n #REQUIRES: existence of contest with :id\n #MODIFIES: the database\n #EFFECTS: updates the database with info about contest with \"id provided by user via 'edit.'\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n flash[:notice] = 'Contest was successfully updated.'\n format.html { redirect_to(@contest) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n @contest = Contest.find(params[:id])\n\n if not params[:contest][:category_id].nil?\n @category = Category.find(params[:contest][:category_id])\n @contest.category = @category\n end\n\n if not params[:contest][:event_id].nil?\n @event = Event.find(params[:contest][:event_id])\n @contest.event = @event\n end\n\n if not params[:contest][:judge_sheet_id].nil?\n @judge_sheet = JudgeSheet.find(params[:contest][:judge_sheet_id])\n @contest.judge_sheet = @judge_sheet\n end\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, :notice => 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n @contest = Contest.find(params[:id])\n end",
"def set_contest\n\t\t\t@contest = Contest.find(params[:id])\n\t\tend",
"def update\n @contest = Contest.find(params[:contest_id])\n\n respond_to do |format|\n if @editorial.update(editorial_params)\n format.html { redirect_to admin_contest_path(@contest), notice: 'Editorial was successfully updated.' }\n format.json { render :show, status: :ok, location: admin_contest_path(@contest) }\n else\n format.html { render :edit }\n format.json { render json: @editorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n contestID = params[:id]\n submissionID = params[:contestID]\n res = Contests.set_winner(contestID, submissionID)\n # email using mailjet\n contest = Contests.get_contest(contestID).first\n test = \"Congrats on winning the contest: #{contest[\"title\"]}, You have won $#{contest[\"price\"]}!\"\n system(\"curl -X POST --user \\\"7c80d03e683e8c7313d50629a9feafb7:434aaee16cb9e82e6ff117fc2716c2c7\\\" https://api.mailjet.com/v3/send/message -F from='[email protected]' -F [email protected] -F subject='Congrats on winning!' -F text='#{test}'\")\n redirect_to \"/contests/view/#{contestID}\"\n end",
"def update\n respond_to do |format|\n if @bracketcontest.update(bracketcontest_params)\n\tsave_contestants()\n\tflash[:notice] = 'Bracketcontest was successfully updated.' \n format.html { redirect_to [@bracketgrouping, @bracketcontest]}\n format.json { render :show, status: :ok, location: @bracketcontest }\n else\n format.html { render :edit }\n format.json { render json: @bracketcontest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @optin_contestant = OptinContestant.find(params[:id])\n\n respond_to do |format|\n if @optin_contestant.update_attributes(params[:optin_contestant])\n format.html { redirect_to @optin_contestant, notice: 'Optin contestant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @optin_contestant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contestant.update(contestant_params)\n format.html { redirect_to @contestant, notice: 'Contestant was successfully updated.' }\n format.json { render :show, status: :ok, location: @contestant }\n else\n format.html { render :edit }\n format.json { render json: @contestant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contestant.update(contestant_params)\n format.html { redirect_to @contestant, notice: 'Contestant was successfully updated.' }\n format.json { render :show, status: :ok, location: @contestant }\n else\n format.html { render :edit }\n format.json { render json: @contestant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_contest\n @contest = Contest.friendly.find(params[:id])\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, notice: 'Contest was successfully created.' }\n format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book_contest.update(book_contest_params)\n format.html { redirect_to @book_contest, notice: 'Book contest was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_contest }\n else\n format.html { render :edit }\n format.json { render json: @book_contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @ai_contest.update_attributes(permitted_params)\n format.html { redirect_to @ai_contest, notice: 'Ai contest was successfully created.' }\n format.json { render json: @ai_contest, status: :created, location: @ai_contest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ai_contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_contest\n @contest = Contest.find_by_slug!(params[:contest_id])\n end",
"def set_contest\n #@contest = Contest.find(params[:contest_id])\n if @entry\n @contest = @entry.contest\n else\n @contest= Contest.find(params[:contest_id])\n end\n end",
"def update\n @solution = @idea.solutions.find(params[:id])\n\n if @solution.update_attributes(params[:solution])\n render json: { text: \"success\" }\n else\n render json: { text: \"fail\"}\n end\n end",
"def create\n @contest = @event.contests.build(contest_params)\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to [@event, @contest], notice: 'Contest was successfully created.' }\n format.json { render :show, status: :created, location: @contest }\n else\n format.html { render :new }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n \n respond_to do |format|\n if @contest.save\n format.html { redirect_to contest_path(@contest.path)+'/upload', \n notice: 'Contest was successfully created.' \n }\n #format.json { render json: @contest, status: :created, location: @contest }\n else\n format.html { render action: \"new\" }\n #format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(contest_params)\n\n respond_to do |format|\n if @contest.save\n format.html { redirect_to [:admin, @contest], notice: 'Contest was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @contest] }\n else\n format.html { render :new }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @contestant = Contestant.find(params[:id])\n\n respond_to do |format|\n if @contestant.update_attributes(params[:contestant])\n format.html { render action: 'thankyou'}#redirect_to @contestant, notice: 'Contestant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contestant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_exercise.update(api_v1_exercise_params)\n format.html { redirect_to @api_v1_exercise, notice: 'Exercise was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_exercise }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contest }\n end\n end",
"def update\n @gotcha = Gotcha.find(params[:id])\n\n respond_to do |format|\n if @gotcha.update_attributes(params[:gotcha])\n format.html { redirect_to @gotcha, notice: 'Gotcha was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gotcha.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contest }\n end\n end",
"def show\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contest }\n end\n end",
"def update\n if @contest.update_attributes(params.require(:contest).permit(:number, :description, :medal))\n flash[:success] = \"Concours modifié.\"\n redirect_to contest_path\n else\n render 'edit'\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :ok }\n end\n end",
"def create\n @contest = Contest.new(contest_params)\n respond_to do |format|\n if @contest.save\n format.html { redirect_to a_contest_url(@contest), notice: I18n.t('a.contests.notices.create') }\n format.json { render action: 'show', status: :created, location: @contest }\n else\n set_data_for_new_form\n format.html { render action: 'new' }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contest = Contest.new(params[:contest])\n @contest.contractor_id = current_user.id\n \n respond_to do |format|\n if @contest.save\n format.html { redirect_to @contest, :notice => 'Contest was successfully created.' }\n format.json { render :json => @contest, :status => :created, :location => @contest }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @contest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n if @testcase.update_attributes(params[:testcase])\n format.html { redirect_to @testcase, :notice => 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @challenge ||= Challenge.find(params[:id])\n\n respond_to do |format|\n if @challenge.update_attributes(params[:challenge])\n format.html { redirect_to @challenge, notice: 'Challenge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @challenge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team_challenge = TeamChallenge.find(params[:id])\n\n respond_to do |format|\n if @team_challenge.update_attributes(params[:team_challenge])\n format.html { redirect_to @team_challenge, :notice => 'Team challenge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @team_challenge.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def new\n @contest = Contest.new\n @problem_count = 4\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def update\n @club = Club.find(params[:id])\n\n if @club.update_attributes(params[:club])\n head :no_content\n else\n render json: @club.errors, status: :unprocessable_entity\n end\n end",
"def update\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n if @challenge.update_attributes(params[:challenge])\n format.html { redirect_to @challenge, notice: 'Challenge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @challenge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n if @challenge.update_attributes(params[:challenge])\n format.html { redirect_to @challenge, notice: 'Challenge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @challenge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n nombreImagen = SecureRandom.uuid + File.extname(contest_params[:banner].original_filename)\n carpeta = File.join(Rails.public_path, \"uploaded_images\", Time.now.strftime(\"%Y-%m-%d\"))\n rutaAbsoluta = File.join(carpeta, nombreImagen)\n FileUtils.mkdir_p(carpeta)\n File.open(rutaAbsoluta, 'wb') do |f|\n f.write(contest_params[:banner].read)\n end\n \n params[:contest][:banner] = \"/uploaded_images/\" + Time.now.strftime(\"%Y-%m-%d\") + \"/\" + nombreImagen\n params[:contest][:url] = \"http://\" + request.host + \":\" + (request.port.to_s) +\"/contests/join/\" + params[:contest][:url]\n\n respond_to do |format|\n if @contest.update(contest_params)\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { render :show, status: :ok, location: @contest }\n else\n format.html { render :edit }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_case(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = put(\"cases/#{id}\",options)\n response.case\n end",
"def update\n respond_to do |format|\n if @story.update(story_params)\n format.json { render json: @story, root: false, status: :ok, location: @story }\n else\n format.json { render json: @story.errors, root: false, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @contests = Contest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end",
"def index\n @contests = Contest.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contests }\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, :notice => 'exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @exercise.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_put_success\n put \"/blah\", @test_obj do |response|\n assert response.ok?, \"Update test object failed\"\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to [@clclass,@exercise], notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: [@clclass,@exercise].errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exercise.update(exercise_params)\n format.html { redirect_to @exercise, notice: I18n.t('exercises.updated') }\n format.json { render :show, status: :ok, location: @exercise }\n else\n format.html { render :edit }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @study_case.update(study_case_params)\n render :show, status: :ok\n else\n render json: @study_case.errors, status: :unprocessable_entity\n end\n end",
"def submit\n\t\tcontest_id = get_params[:contest_id]\n\t\tstudent_id = current_student.id\n\t\tcproblem_id = get_params[:cproblem_id]\n\t\tstatus = get_params[:status]\n\t\tCproblem.submit(contest_id, cproblem_id, student_id, status)\n\t\trender json: {}\n\tend",
"def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contest }\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n if @team.update_attributes(params[:team])\n head :no_content\n else\n render json: @team.errors, status: :unprocessable_entity\n end\n end",
"def new\n @contest = Contest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @contest }\n end\n end",
"def contest_params\n params.require(:contest).permit(:name, :active_round, :posted, :api_key)\n end",
"def update\n @story = Story.find(params[:id])\n @story.update_attributes(params[:story])\n respond_with @story\n end",
"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",
"def set_regularcontest\n @regularcontest = Regularcontest.find(params[:id])\n end",
"def set_contestant\n @contestant = Contestant.find(params[:id])\n end",
"def set_contestant\n @contestant = Contestant.find(params[:id])\n end",
"def set_contestant\n @contestant = Contestant.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @case_test.update(case_test_params)\n format.html { redirect_to @case_test, notice: 'Case test was successfully updated.' }\n format.json { render :show, status: :ok, location: @case_test }\n else\n format.html { render :edit }\n format.json { render json: @case_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @criterion = Criterion.find(params[:id])\n\n if @criterion.update_attributes(params[:criterion])\n head :no_content\n else\n render json: @criterion.errors, status: :unprocessable_entity\n end\n end",
"def update\n @post = @contest.posts.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n flash[:notice] = 'Post was successfully updated.'\n format.html { redirect_to(@post) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n if @exercise.update_attributes(params[:exercise])\n format.html { redirect_to @exercise, notice: 'Exercise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7452851",
"0.7452833",
"0.74279934",
"0.74279934",
"0.7191935",
"0.71750563",
"0.7164745",
"0.7117877",
"0.705355",
"0.70395637",
"0.7026145",
"0.69851846",
"0.6976812",
"0.69482785",
"0.6924179",
"0.69112897",
"0.67661893",
"0.67661893",
"0.6714746",
"0.6714746",
"0.6714746",
"0.6714746",
"0.6714746",
"0.6714746",
"0.6714746",
"0.6714746",
"0.67142934",
"0.6535673",
"0.6516422",
"0.6472743",
"0.6467889",
"0.6432117",
"0.6417549",
"0.6417549",
"0.6404684",
"0.63111335",
"0.63111335",
"0.63111335",
"0.6308509",
"0.6307323",
"0.62750924",
"0.6190771",
"0.61481744",
"0.6124303",
"0.6094022",
"0.6080321",
"0.6075212",
"0.6073242",
"0.6054178",
"0.6038532",
"0.60332114",
"0.599993",
"0.5993445",
"0.5993445",
"0.5993214",
"0.59878755",
"0.59876275",
"0.5983491",
"0.5961615",
"0.5939891",
"0.59193057",
"0.59136397",
"0.5906577",
"0.5906577",
"0.5906577",
"0.5906577",
"0.58962613",
"0.58943343",
"0.58936346",
"0.58936346",
"0.5892689",
"0.5863258",
"0.58622557",
"0.5859768",
"0.5853722",
"0.5832476",
"0.5828141",
"0.5824858",
"0.5815993",
"0.58106244",
"0.58035",
"0.57963014",
"0.57953817",
"0.57928",
"0.57928",
"0.5774506",
"0.5767811",
"0.57671505",
"0.5766244",
"0.5756513",
"0.57564044",
"0.57549286",
"0.57549286",
"0.57549286",
"0.5753911",
"0.57534707",
"0.5751995",
"0.57514614",
"0.57514614",
"0.57514614"
] | 0.7441542 | 2 |
DELETE /contests/1 DELETE /contests/1.json | def destroy
@contest = Contest.find(params[:id])
@contest.destroy
respond_to do |format|
format.html { redirect_to contests_url, :notice => 'Contest was successfully deleted.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ai_contest = AiContest.find(params[:id])\n @ai_contest.destroy\n\n respond_to do |format|\n format.html { redirect_to ai_contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n block_non_user\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url, notice: 'Contest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #REQUIRES: existence of contest with :id\n #MODIFIES: the database\n #EFFECTS: deletes the information in the database of the contest with :id\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to(contests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to admin_contests_url, notice: 'Contest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to(contests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to(contests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to(contests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @contest.destroy\r\n respond_to do |format|\r\n format.html { redirect_to contests_url, notice: 'Contest was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to event_contests_url(@event), notice: 'Contest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find_by(path: params[:id])\n\n destroy_directory(@contest.path)\n destroy_problems(@contest)#with submits\n destroy_participants(@contest)\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n #format.json { head :no_content }\n end\n end",
"def destroy\n @contestant = Contestant.find(params[:id])\n @contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to contestants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n contest = @data_set.contest\n @data_set.destroy\n respond_to do |format|\n format.html { redirect_to admin_contest_url(contest), notice: 'Data set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n contest = @editorial.contest\n @editorial.destroy\n respond_to do |format|\n format.html { redirect_to admin_contest_url(contest), notice: 'Editorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @optin_contestant = OptinContestant.find(params[:id])\n @optin_contestant.destroy\n\n respond_to do |format|\n format.html { redirect_to optin_contestants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contestant.destroy\n respond_to do |format|\n format.html { redirect_to contestants_url, notice: 'Contestant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n contest = @problem.contest\n @problem.destroy\n respond_to do |format|\n format.html { redirect_to admin_contest_url(contest), notice: 'Problem was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contestant.destroy\n redirect_to root_path\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @test_case.destroy\n respond_to do |format|\n format.html { redirect_to test_cases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testcase = Testcase.find(params[:id])\n @testcase.destroy\n\n respond_to do |format|\n format.html { redirect_to testcases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_exercise.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book_contest.destroy\n respond_to do |format|\n format.html { redirect_to book_contests_url, notice: 'Book contest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @oncourse_exercise.destroy\n respond_to do |format|\n format.html { redirect_to oncourse_exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n contest = @contestorganization.contest\n @contestorganization.destroy\n redirect_to contest_path(contest)\n end",
"def destroy\n @gotcha = Gotcha.find(params[:id])\n @gotcha.destroy\n\n respond_to do |format|\n format.html { redirect_to gotchas_url, notice: 'Gotcha was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ci_experiment.destroy\n respond_to do |format|\n format.html { redirect_to ci_experiments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test = LoadTest.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to load_tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_run.destroy\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @challenge = Challenge.find(params[:id])\n @challenge.destroy\n\n respond_to do |format|\n format.html { redirect_to challenges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @challenge = Challenge.find(params[:id])\n @challenge.destroy\n\n respond_to do |format|\n format.html { redirect_to challenges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise_plan = ExercisePlan.find(params[:id])\n @exercise_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_plans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test = Test.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reqdifficulty.destroy\n respond_to do |format|\n format.html { redirect_to reqdifficulties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @challenge.destroy\n respond_to do |format|\n format.html { redirect_to challenges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @challenge ||= Challenge.find(params[:id])\n @challenge.destroy\n\n respond_to do |format|\n format.html { redirect_to challenges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @case_test.destroy\n respond_to do |format|\n format.html { redirect_to case_tests_url, notice: 'Case test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_run = TestRun.find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @routine_interview = RoutineInterview.find(params[:id])\n @routine_interview.destroy\n\n respond_to do |format|\n format.html { redirect_to routine_interviews_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exerciseoverview.destroy\n respond_to do |format|\n format.html { redirect_to exerciseoverviews_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @intake.destroy\n respond_to do |format|\n format.html { redirect_to intakes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_case_result.destroy\n respond_to do |format|\n format.html { redirect_to test_case_results_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @exercice = Exercice.find(params[:id])\n @exercice.destroy\n\n respond_to do |format|\n format.html { redirect_to exercices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team_challenge = TeamChallenge.find(params[:id])\n @team_challenge.destroy\n\n respond_to do |format|\n format.html { redirect_to team_challenges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @challenge = Challenge.find(params[:id])\n @challenge.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_challenges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clientcase = Clientcase.find(params[:id])\n @clientcase.destroy\n\n respond_to do |format|\n format.html { redirect_to clientcases_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @exercise = Exercise.find(params[:id])\n @exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to clclass_exercises_path(@clclass) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @puzzle = Puzzle.find(params[:id])\n @puzzle.destroy\n\n respond_to do |format|\n format.html { redirect_to puzzles_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @trial.destroy\n respond_to do |format|\n format.html { redirect_to trials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_stuff.destroy\n respond_to do |format|\n format.html { redirect_to test_stuffs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nightclub.destroy\n respond_to do |format|\n format.html { redirect_to nightclubs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daily_exercise = DailyExercise.find(params[:id])\n @daily_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to daily_exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @do_exercise = DoExercise.find(params[:id])\n @do_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to do_exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @programme_exercise.destroy\n respond_to do |format|\n format.html { redirect_to programme_exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team_test = TeamTest.find(params[:id])\n @team_test.destroy\n\n respond_to do |format|\n format.html { redirect_to team_tests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @testdb = Testdb.find(params[:id])\n @testdb.destroy\n\n respond_to do |format|\n format.html { redirect_to testdbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: \"Exercise was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to contest_games_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @case_study.destroy\n respond_to do |format|\n format.html { redirect_to :delete, flash: { message: 'Case study was successfully deleted.' } }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise.destroy\n respond_to do |format|\n format.html { redirect_to exercises_url, notice: 'Exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game_task.destroy\n respond_to do |format|\n format.html { head :no_content }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testis = Teste.find(params[:id])\n @testis.destroy\n\n respond_to do |format|\n format.html { redirect_to testes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @performed_exercise.destroy\n respond_to do |format|\n format.html { redirect_to performed_exercises_url, notice: 'Performed exercise was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @post = Post.find(params[:id])\n #@post = @contest.posts.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to(posts_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @test_run = TestRun.accessible_by(current_ability).find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @drug_test = DrugTest.find(params[:id])\n @drug_test.destroy\n\n respond_to do |format|\n format.html { redirect_to drug_tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutorial_quest = Tutorial::Quest.find(params[:id])\n @tutorial_quest.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorial_quests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @assert = Assert.find(params[:id])\n @assert.destroy\n\n respond_to do |format|\n format.html { redirect_to asserts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jsontest.destroy\n respond_to do |format|\n format.html { redirect_to jsontests_url, notice: 'Jsontest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assert = Assert.find(params[:id])\n @assert.destroy\n\n respond_to do |format|\n format.html { redirect_to asserts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @patient_exercise = PatientExercise.find(params[:id])\n @patient_exercise.destroy\n\n respond_to do |format|\n format.html { redirect_to patient_exercises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solution = Solution.find(params[:id])\n @solution.destroy\n\n render json: { text: \"success\" }\n end",
"def destroy\n @testimonial = Testimonial.find(params[:id])\n @testimonial.destroy\n\n respond_to do |format|\n format.html { redirect_to testimonials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise_execution.destroy\n respond_to do |format|\n format.html { redirect_to exercise_executions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @experiment = Experiment.find(params[:id])\n @experiment.destroy\n\n respond_to do |format|\n format.html { redirect_to experiments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @experiment = Experiment.find(params[:id])\n @experiment.destroy\n\n respond_to do |format|\n format.html { redirect_to experiments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @experiment = Experiment.find(params[:id])\n @experiment.destroy\n\n respond_to do |format|\n format.html { redirect_to experiments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @playground = Playground.find(params[:id])\n @playground.destroy\n\n respond_to do |format|\n format.html { redirect_to playgrounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @playground = Playground.find(params[:id])\n @playground.destroy\n\n respond_to do |format|\n format.html { redirect_to playgrounds_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.80987906",
"0.80896854",
"0.8085642",
"0.8085642",
"0.8085642",
"0.8085642",
"0.7983932",
"0.7868613",
"0.7868047",
"0.78431594",
"0.7790738",
"0.77683955",
"0.77683955",
"0.77683955",
"0.77602553",
"0.76734424",
"0.76611394",
"0.75796723",
"0.7568219",
"0.74781656",
"0.7476672",
"0.73513526",
"0.7268441",
"0.7155321",
"0.71370775",
"0.70659256",
"0.7042214",
"0.697022",
"0.693286",
"0.693286",
"0.6919242",
"0.6897613",
"0.68239444",
"0.682189",
"0.68146",
"0.6804745",
"0.6795882",
"0.6792481",
"0.67920727",
"0.6784444",
"0.67834353",
"0.6782923",
"0.675645",
"0.6750939",
"0.6743145",
"0.6730391",
"0.6729766",
"0.6729411",
"0.67277694",
"0.67277694",
"0.67277694",
"0.67277694",
"0.6727354",
"0.6722641",
"0.6722641",
"0.67139775",
"0.67035896",
"0.6700461",
"0.66996664",
"0.6699662",
"0.66977143",
"0.66952604",
"0.6694699",
"0.6677491",
"0.66759896",
"0.66714215",
"0.6667993",
"0.66677463",
"0.666657",
"0.6666349",
"0.66610146",
"0.66608155",
"0.6658696",
"0.6655315",
"0.66467637",
"0.66449857",
"0.66407335",
"0.6638612",
"0.6634207",
"0.6634207",
"0.66339153",
"0.6630586",
"0.6630107",
"0.6627829",
"0.66277385",
"0.66237277",
"0.6618027",
"0.6616832",
"0.66150326",
"0.6613457",
"0.6613003",
"0.66125107",
"0.66109014",
"0.6610273",
"0.660821",
"0.66065997",
"0.66065997",
"0.66065997",
"0.6604989",
"0.6604989"
] | 0.79219407 | 7 |
Starts the benchmark. Returns an Array of request times in seconds. | def run
done = false
times = []
threads = ThreadGroup.new
count_m = Mutex.new
@threads.times do
Thread.start do
threads.add Thread.current
until @num_requests <= 0 do
count_m.synchronize do
if @num_requests % @tenths == 0 then
print @num_requests
elsif @num_requests % @hundredths == 0 then
print '.'
end
@num_requests -= 1
end
$stdout.flush
times << time_request
end
end
Thread.pass
end
threads.enclose
threads.list.each { |t| t.join }
puts
return times
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response_times\n times = []\n start_time = Time.now\n final_time = Time.now + @max_time\n counter = 1\n while Time.now < final_time do\n times << @request_builder.call(@url, counter)\n sleep(@sleep_time)\n counter += 1\n end\n times\n end",
"def time_request\n\t\tstarttimes = Process.times\n\t\tyield\n\tensure\n\t\truntimes = Process.times\n\t\t@run_count += 1\n\t\t@total_utime += utime = (runtimes.utime - starttimes.utime)\n\t\t@total_stime += stime = (runtimes.stime - starttimes.stime)\n\t\tself.log.info \\\n\t\t\t\"[PID %d] Runcount: %d, User: %0.2f/%0.2f, System: %0.2f/%0.2f\" %\n\t\t\t[ Process.pid, @run_count, utime, @total_utime, stime, @total_stime ]\n\tend",
"def request_start\n Process.clock_gettime(Process::CLOCK_REALTIME)\n end",
"def request_start\n Process.clock_gettime(Process::CLOCK_REALTIME)\n end",
"def benchmark\n start_time = Time.now\n result = yield\n\n [time_beween_in_ms(start_time, Time.now), result]\n end",
"def time_request\n time do\n do_request\n end\n end",
"def methods_time\n Benchmark::Tms.new\n end",
"def start!\n (@benchmarks ||= []) << Time.now\n @current = @benchmarks.size - 1\n end",
"def benchmark\n t1 = Time.now\n output = yield\n [\"#{(Time.now - t1) * 1000}ms\", output]\nend",
"def benchmark\n start_time = Time.now\n yield\n end_time = Time.now\n running_time = end_time - start_time\nend",
"def test_concurrent_requests\n app do\n get '/sleep/:i' do\n t = params[:i].to_i * FACTOR\n sleep t\n \"Slept #{t}\"\n end\n end\n \n time = Benchmark.realtime do\n (1..REQUESTS).map do |i|\n Thread.new(i) do |i|\n get \"/sleep/#{i}\"\n \n assert_equal(200, response.status)\n assert_equal(\"Slept #{i * FACTOR}\", response.body)\n end\n end.each(&:join)\n end\n \n assert_in_delta REQUESTS * FACTOR, time, 0.05 # 0.05 is a empirically found ‘overhead’ time\n end",
"def benchmark\nend",
"def run_start_time\n @data['controls'].map { |control| control['results'].map { |result| DateTime.parse(result['start_time']) } }.flatten.min\n end",
"def blocks_time\n Benchmark::Tms.new\n end",
"def benchmark\n start = Time.now\n yield\n p Time.now - start\nend",
"def benchmark\n start_time = Time.now\n yield\n end_time = Time.now\n end_time - start_time\n\n # Your benchmarking code goes here.\nend",
"def benchmark\n start_time = Time.now\n calculation = yield\n end_time = Time.now\n run_time = end_time - start_time\n run_time\nend",
"def custom_benchmark\n start_time = Time.now\n yield if block_given?\n elapsed_time = Time.now - start_time\n puts \"Custom Benchmark Time in Seconds: #{elapsed_time}\"\nend",
"def call\n render_endpoint_request do\n benchmark, response = make_benchmarked_request\n render json: { benchmark: benchmark, status: response.status, body: response.body }, status: 200\n end\n end",
"def requests_per_second\n requests / horizon_time\n end",
"def benchmark\n start_time = Time.now\n result = yield\n end_time = Time.now\n benchmark = end_time - start_time\nend",
"def server_timing; end",
"def run_time\n ((Time.now - start_time) * 1000).round\n end",
"def search_request_concern_bm_start\n @search_request_benchmark = {}\n @search_request_start_time = Time.zone.now\n end",
"def custom_benchmark(name)\n start_time = Time.now\n yield if block_given?\n elapsed_time = Time.now - start_time\n puts \"#{name} Time in Seconds: #{elapsed_time}\"\nend",
"def call(env)\n start = Time.now\n status, headers, @response = @app.call(env)\n stop = Time.now\n elapsed_ms = (stop - start) * 1000\n @log.debug(\"type=measure.response.elapsed \\\nmethod=#{env['REQUEST_METHOD']} \\\npath=#{env['PATH_INFO']} \\\nstatus=#{status} \\\nelapsed=#{elapsed_ms}ms\")\n headers['x-response-time'] = \"#{elapsed_ms}ms\" if !headers.include? 'x-response-time'\n [status, headers, self]\n end",
"def run_all_benchmarks\n args = {num: params[:num]}\n @service.run_all_benchmarks(args)\n flash[:notice] = \"Benchmark Started\"\n respond_to do |format|\n format.js { render :update_service }\n end\n end",
"def expected_runtime_seconds(report_count:)\n runs = report_count * options[:lines_multipliers].length\n warmup_time_seconds = runs * options[:benchmark_warmup]\n bench_time_seconds = runs * options[:benchmark_time]\n\n warmup_time_seconds + bench_time_seconds\n end",
"def benchmark!\n @benchmark = true\n end",
"def start\n # trap_signals\n\n loop do\n runtime = Benchmark.realtime { perform }\n sleep(@interval - runtime) if runtime < @interval && !stop?\n\n break if stop?\n end\n end",
"def bench(action, msg = nil)\n @t ||= Time.now\n @total ||= 0\n @step ||= 0\n case action\n when :start\n @step = 0\n @total = 0\n @t = Time.now\n when :step\n @step += 1\n int = Time.now - @t\n @total += int\n @t = Time.now\n dbg(\"Benchmark #{msg.nil? ? (\"%02d\" % @step) : msg}: #{\"%8.3fms\" % (int * 1000)} (Total: #{\"%8.3fms\" % (@total * 1000)}).\")\n end\nend",
"def ab_test(nRequest, nThread, uri)\n res = %x(ab -n #{nRequest} -c #{nThread} #{uri})\n return res.match(/(?<=Time taken for tests:).*(?=seconds)/).to_s.to_f, res.match(/(?<=Time per request:).*(?=\\[ms\\] \\(mean\\))/).to_s.to_f\nend",
"def perform_request\n returned = nil\n @requests ||= 0\n @requests += 1\n @request_time ||= 0\n @request_time += Benchmark.realtime { returned = yield }\n returned\n ensure\n @handlers.each { |handler| handler.call(@requests, @request_time) }\n end",
"def profiler_start\n start_perf_profiler\n end",
"def benchmark_time(*args, &block)\n b = BenchmarkTime::BenchmarkTime.new(*args, &block)\n b.run\nend",
"def benchmark_request(number=1)\n uri = URI.parse('http://thefuckingweather.com/?RANDLOC=')\n time = Benchmark.realtime do\n uri.open\n end\n puts \"Request #{number} took #{time} secs\"\nend",
"def timing(stat, ms, sample_rate=1); send stat, ms, 'ms', sample_rate end",
"def main\n require 'benchmark'\n result_hash = nil\n \n time = Benchmark.measure { result_hash = build_pcrs_hash }\n show do\n title \"operations batched\"\n note \"#{time.to_s}\" \n end\n \n log_info result_hash\n {}\n end",
"def start_timing\n args = request_params\n\n if !args[:link].nil?\n start_timing_for_link(args[:map_id], args[:round], args[:link])\n else\n start_timing_for_round(args[:map_id], args[:round])\n end\n\n head :ok\n end",
"def stock_picker_benchmarker number_of_runs, stock_array_size\n\tstart_time = Time.now\n\ttime_per_run = []\n\t\n\tnumber_of_runs.times do\n\t\tstock_input = Array.new(stock_array_size) { rand(1..20) }\n\t\tstart_iter = Time.now\n\n\t\t#p stock_picker(stock_input)\n\t\t\n\t\tend_iter \t= Time.now\n\t\ttime_per_run.push(end_iter - start_iter)\n\tend\n\n\tend_time = Time.now\n\ttotal_duration = end_time - start_time\n\taverage_time_per = time_per_run.inject(0.0) { |sum, el| sum + el} / time_per_run.size\n\n\tputs \"Number of Runs: #{number_of_runs}\"\n\tputs \"Number of Days for stock picker: #{stock_array_size}\"\n\tputs \"Total Duration of test: #{total_duration} ms\"\n\tputs \"Average time per run: #{average_time_per} ms\"\nend",
"def server_timing=(_arg0); end",
"def detect_microseconds()\n\t\tsum = 0.0\n\t\tlimit = [ 100, @log_record_array.length()-1 ].min\n\t\tfor i in 0..limit\n\t\t\tsum = sum + @log_record_array[ i ].info[ POS_REQ_TIME ]\t\n\t\tend\n\t\ttreshold = 1000\n\t\tif ( sum / i > treshold )\n\t\t\tputs(\" + Guessing microseconds: average request time is greater than #{treshold}\")\n\t\t\t@log_record_array.each {|rec| rec.info[ POS_REQ_TIME ] = rec.info[ POS_REQ_TIME ].to_f / 1000000.to_f }\t\n\t\telse\n\t\t\tputs(\" + Guessing seconds: average request time is lesser than #{treshold}\")\n\t\tend\n\n\t\t\t\t\t\n\t\t\n\tend",
"def query_times_graphs\n controller = params[:controller_name]\n action = params[:action_name]\n data = redis(logger: true).zrangebyscore(\"request_timings/total/by_action/#{controller}##{action}\",\n 1.month.ago.to_i, '+inf',\n with_scores: true)\n .map { |y, x| [x.to_f, y.to_f] }\n throw 'No Data' if data.nil? || data.empty?\n smoothed = moving_avg(data)\n final = (params[:raw].present? ? data : smoothed).map { |x, y| [Time.at(x.to_i).to_datetime, y] }\n render json: [\n { name: 'Timings', data: final }\n ]\n end",
"def build_timing; end",
"def display_status\n reqs_per_sec = sprintf('%.2f',\n (@req.inject(:+).to_f / @req.length.to_f))\n\n puts \"\\nRequests per second: #{reqs_per_sec}\"\n @status.map do |status_code, status_count|\n puts \"HTTP Status #{status_code}: #{status_count}\"\n end\n puts \"Total time: #{@total_time} s\"\n end",
"def get_total_runtime_ms\n (TimeDifference.between(*get_runtime_timestamps).in_seconds * 1000).to_i\n end",
"def calculate_thread_times\r\n # Cache thread times since this is an expensive\r\n # operation with the required sorting \r\n @result.threads.each do |thread_id, methods|\r\n top = methods.sort.last\r\n \r\n thread_time = 0.01\r\n thread_time = top.total_time if top.total_time > 0\r\n\r\n @thread_times[thread_id] = thread_time \r\n end\r\n end",
"def latency\n runopts(:latency)\n end",
"def call_times(times)\n raise '#call_times should be redefined per Benchmark::IPS::Job::Entry instance'\n end",
"def start!\n @time = now\n @cpu_time_start = now_cpu\n @allocation_count_start = now_allocations\n end",
"def time()\n return _request([\n 'time',\n '0'\n ])[0]\n end",
"def timer(method)\n Benchmark.bm do |x|\n x.report { method }\n end\n end",
"def generate_time\n\t\tret = Array.new\n\t\tcount unless @fileinfo[:count]\n\t\ttrigger unless @fileinfo[:trigger]\n\t\tsampling unless @fileinfo[:sampling]\n\n\t\t(0..@fileinfo[:count] - @fileinfo[:trigger] - 1).each {|i| \n\t\t\tret << (i * @fileinfo[:sampling] * 1e-6)\n\t\t}\n\t\treturn ret\n\tend",
"def start_times\n \t@start_time1 = self.start_time1\n\n @start_time2 = self.start_time2\n\n @start_time3 = self.start_time3\n\n start_times = [@start_time1, @start_time2, @start_time3]\n end",
"def time\n\talltime = Array.new\n\tslices = 10\n\ti = 0\n\twhile i < slices.to_i do\n\t\talltime.push(Time.now)\n\t\ti+=1\n\tend\n\tyield\nend",
"def clock_gettime\n t = [0,0]\n ChangeTime.new.gett(t)\n t\n end",
"def measure_execution_time(data = nil, repeat: 1, &work)\n inputs = data || range(1, 10_000)\n times = []\n\n inputs.each_with_index do |input, i|\n GC.start\n measurements = []\n\n repeat.times do\n measurements << Clock.measure { work.(input, i) }\n end\n\n times << measurements.reduce(&:+).to_f / measurements.size\n end\n [inputs, times]\n end",
"def cstime=(*) end",
"def timers\n metrics(Timer)\n end",
"def cycle_start_time\n if stats[:start] && stats[:real_start]\n Time.at(*stats[:start]) + stats[:real_start]\n end\n end",
"def get_run_time(ant)\n end",
"def main\n \n require 'benchmark'\n result_hash = nil\n \n time = Benchmark.measure { result_hash = build_pcrs_hash }\n show do\n title \"operations batched\"\n note \"#{time.to_s}\" \n end\n \n log_info result_hash\n \n {}\n end",
"def getTimes()\n return @times\n end",
"def cycle_start_time\n if stats[:start] && stats[:actual_start]\n Time.at(*stats[:start]) + stats[:actual_start]\n end\n end",
"def start_time\n # API results are in milliseconds since the unix epoch\n epoch_msec = raw_result.fetch('time')\n epoch_sec = epoch_msec / 1000\n\n Time.at(epoch_sec).ctime\n end",
"def start_clock\n @start_time = Time.now\n end",
"def cstime(*) end",
"def run\n threads = []\n test_start = Time.now\n puts \"Starting #{options.threads} worker threads at #{test_start}\"\n @options.threads.times do |thread_id|\n threads << Thread.new do\n worker_thread(thread_id)\n end\n end\n threads.each { |t| t.join }\n test_end = Time.now\n puts \"Total test time: #{test_end.to_f - test_start.to_f}\"\n end",
"def measure(iterations = 1)\n time_elapsed = []\n\n iterations.times do\n @start = Time.now\n yield\n @stop = Time.now\n time_elapsed << (@stop - @start)\n end\n\n # reduce(:+) takes all elements in array, performs an operation, and keeps a running total\n time_elapsed.reduce(:+) / iterations.to_f\nend",
"def get_server_latency(server, num_requests)\n\n failures = 0\n latencies = []\n @fatal_errors = nil\n # common header parts\n headers = \"GET \" +\n (CLOUD_PATH % [@settings.licence_key, '']).gsub(/\\s+/, \"\") + \" HTTP/1.0\\r\\n\" +\n \"Host: \" + server[:host] + \":\" + server[:port].to_s + \"\\r\\n\" +\n \"Accept: application/json\\r\\n\" +\n \"User-Agent: ruby/\" + API_VERSION + \"\\r\\n\" +\n DA_HEADER_PREFIX + \"Latency-Checker: \"\n # only the first request will send the settings\n configs = ((@self_auto_ranking.nil?)?'y':@self_auto_ranking) + ';' +\n ((@settings.auto_server_ranking)?'y':'n') + ';' +\n @settings.cloud_service_timeout.to_s + ';' +\n @settings.auto_server_ranking_max_failures.to_s + ';' +\n @settings.auto_server_ranking_num_requests.to_s + ';' +\n @settings.auto_server_ranking_lifetime.to_s + ';' +\n @settings.server_phaseout_lifetime.to_s + ';' + \"\\r\\n\"\n # ignore the first call because it can take an unreal long time\n\n i = 0\n\n while i < num_requests+1 &&\n failures < @settings.auto_server_ranking_max_failures\n\n start = Time.now\n begin\n\n errors = []\n\n response = connect_cloud(server, headers + ((i==0)?configs:\"#{i}\\r\\n\") +\n \"Connection: Close\\r\\n\\r\\n\", errors)\n\n if response[0] == FAILOVER_NOT_REQUIRED\n if i > 0 \n latencies.push((Time.now - start)*1000) \n end\n i += 1\n next\n elsif response[0] == FAILOVER_STOP\n # licence errors which are found at ranking,\n # to stop any further cloud call\n @fatal_errors = errors\n break\n end\n rescue\n # Keep checking servers\n end\n failures += 1\n \n latencies.push(-1)\n \n end\n\n return latencies\n end",
"def time(times = 1)\n require 'benchmark'\n ret = nil\n Benchmark.bm { |x| x.report { times.times { ret = yield } } }\n ret\nend",
"def set_request_start_time\n @request_start_time = Time.now\n end",
"def timers\n @client.fetch(:timers)\n end",
"def get_launch_time(opts, bundle)\n sbengine = Thread.new { run(opts, bundle) }\n iogen = Thread.new { run_iogen(bundle) }\n sbengine.join\n iogen.join\n\n # Since sbengine ran in verbose mode, we\n # parse the log for timestamp on the gre.init event.\n (parse_result(sbengine.value) * 1000).round\n end",
"def get_total_runtime\n TimeDifference.between(*get_runtime_timestamps).humanize\n end",
"def response_time_metrics\n result = {}\n @urls.each do |url|\n result[url[:name]] = get_metrics(url[:path])\n end\n print result\n end",
"def with_benchmarking\n self.time = Benchmark.realtime do\n yield\n end\n end",
"def initialize\n self[:start_time] = Time.now.to_f\n self[:time] = Time.now.to_f\n self[:trace] = []\n end",
"def simulate_latency\n sleep(rand(2)) if Rails.env == 'development'\n end",
"def run\n # Process Starting Time\n starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n\n # Get records from national service. They'll be fetched from a certain time onwards.\n new_nat_assertions = national_consents_get\n\n # Get new consent records from HEL service.\n new_hel_consents = hel_records_get\n\n # Identify and add new records\n mapping_all_new_consents(new_nat_assertions[:assertions], new_hel_consents)\n\n # Process Ending Time and calculate total time taken for processing.\n ending = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n Logging.logger.info \"Time taken to run the job: #{format('%<time>0000.3f', time: (ending - starting))}sec\"\n end",
"def times_for_send_update_requests(start_time, end_time)\n times = []\n\n task_time = start_time.beginning_of_hour + 30.minutes\n task_time += 1.hour if task_time < start_time\n\n while task_time < end_time\n times << task_time\n task_time += 1.hour\n end\n\n times\n end",
"def getStarted\n if @dry_run\n nil\n else\n JSON.parse(@client[\"/LoadTest?loadTestId=#{@test_id}\"].get)[0].to_h['start_time']\n end\n end",
"def time()\n return self._request([\n 'time',\n '0'\n ])[0]\n end",
"def time\n request :public, :get, :time\n end",
"def bench type\n t1 = Time.now\n yield\n t2 = Time.now\n p \"#{type} used #{t2 - t1} seconds\"\nend",
"def measure_queue_time(env)\n start_time = queue_start(env)\n\n return unless start_time\n\n queue_time = request_start.to_f - start_time.to_f\n queue_time unless (queue_time < 0)\n end",
"def run_benchmark(num_itrs_hint)\n times = []\n total_time = 0\n num_itrs = 0\n\n loop do\n time = time_itr { yield }\n num_itrs += 1\n\n # NOTE: we may want to avoid this as it could trigger GC?\n time_ms = (1000 * time).to_i\n puts \"itr \\##{num_itrs}: #{time_ms}ms\"\n\n # NOTE: we may want to preallocate an array and avoid append\n # We internally save the time in seconds to avoid loss of precision\n times << time\n total_time += time\n\n if num_itrs >= $WARMUP_ITRS + $MIN_BENCH_ITRS and total_time >= $MIN_BENCH_TIME\n break\n end\n end\n\n # Write each time value on its own row\n CSV.open($out_csv_path, \"wb\") do |csv|\n csv << times\n end\nend",
"def runtime_latency\n (finished_at || Time.current) - performed_at if performed_at\n end",
"def gs2_run_times\n\t\t\traise FluxOptionError.new(\"gs2_run_times called and flux_option != gs2\") if not flux_gs2?\n\t\t\trun_times = []\n\t\t\tFile.open(@directory + '/' + output_file, \"r\").each_line{|l| l.scan(/Job.*timer.*(\\b\\d+\\.\\d+\\b)/){run_times.push $~[1].to_f}}\n\t\t\tsz = run_times.size.to_f\n\t\t\treturn run_times.pieces((sz / n_flux_tubes.to_f).ceil)\n\n\t\tend",
"def chart_times\n access_times = self.daily_requests.limit(10)\n access_times.map(&:times)\n end",
"def latency; end",
"def timed(&block)\n @@start_time = Time.now\n Thread.new(&block).join\n @@elapsed_time = Time.now - @@start_time\n @@average_times.push(@@elapsed_time) \n end",
"def measure_queue_time(env)\n start_time = queue_start(env)\n\n return unless start_time\n\n queue_time = request_start.to_f - start_time.to_f\n queue_time unless queue_time.negative?\n end",
"def measure\n start = Time.now\n yield\n Time.now - start\n end",
"def requests\n @requests_lock.synchronize { Array.new(@requests) }\n end",
"def average_response_time\n (active_time / requests.to_f) * 1000\n end",
"def start_processing\n @ran = true\n @start_time = Time.now\n end",
"def stats\n request :get, \"_stats\"\n end",
"def stats\n request :get, \"_stats\"\n end",
"def get_requests(snmp = nil)\n @req_rate ||= { }\n report = { }\n snmp = @snmp_manager unless snmp\n\n get_names(snmp) if @names.empty?\n res = gather_snmp_metrics_by_name(\"Virtual Servers/Requests\", @names, OID_LTM_VIRTUAL_SERV_STAT_TOT_REQUESTS, snmp)\n NewRelic::PlatformLogger.debug(\"Virtual Servers: Got #{res.size}/#{@names.size} Request metrics\")\n\n unless res.nil?\n res.each_key do |metric|\n @req_rate[metric] ||= NewRelic::Processor::EpochCounter.new\n report[metric] = @req_rate[metric].process(res[metric])\n end\n\n sorted_report = report.sort_by { |k,v| v }.reverse\n sorted_report.each_with_index do |row, index|\n @f5_agent.report_metric row[0], \"req/sec\", row[1]\n break if index >= (MAX_RESULTS - 1)\n end\n end\n end"
] | [
"0.6848309",
"0.66205114",
"0.6387109",
"0.6387109",
"0.63492465",
"0.6341557",
"0.6176479",
"0.61509836",
"0.60824037",
"0.59680545",
"0.591732",
"0.5859425",
"0.5840765",
"0.58400464",
"0.5839045",
"0.5831944",
"0.5804365",
"0.58034307",
"0.577173",
"0.5766091",
"0.5757748",
"0.5736992",
"0.5719103",
"0.5691089",
"0.5660127",
"0.56538564",
"0.56504595",
"0.5650351",
"0.5572494",
"0.5535663",
"0.55270904",
"0.55220914",
"0.54989934",
"0.54918724",
"0.5479376",
"0.5448484",
"0.54333603",
"0.5415116",
"0.5387999",
"0.5385756",
"0.537487",
"0.5371575",
"0.53674483",
"0.535708",
"0.535201",
"0.5347215",
"0.53210425",
"0.5320927",
"0.53064495",
"0.5300176",
"0.5296734",
"0.5296326",
"0.52803344",
"0.5278653",
"0.52733094",
"0.52731067",
"0.52668804",
"0.5259617",
"0.525218",
"0.52507013",
"0.5247315",
"0.52310807",
"0.5229467",
"0.52179766",
"0.5205608",
"0.520028",
"0.51989573",
"0.5189637",
"0.51868117",
"0.5178627",
"0.51743627",
"0.51589966",
"0.514635",
"0.51422626",
"0.5136972",
"0.51340324",
"0.5128117",
"0.51246923",
"0.51211935",
"0.5120225",
"0.511849",
"0.5112996",
"0.5111784",
"0.51052207",
"0.51050615",
"0.50956607",
"0.5092879",
"0.50877327",
"0.50864744",
"0.5074793",
"0.5070504",
"0.50661695",
"0.5059583",
"0.50555056",
"0.50357985",
"0.50355285",
"0.5032424",
"0.5029837",
"0.5029837",
"0.50296915"
] | 0.60694987 | 9 |
Returns the amount of time taken to execute the given block. | def time
start_time = Time.now.to_f
yield
end_time = Time.now.to_f
return end_time - start_time
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile (block_description, &block)\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_description}: #{duration} seconds\"\nend",
"def profile block_description, &block\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_description}: #{duration} seconds\"\nend",
"def profile(description_of_block, &block)\n start_time = Time.now \n block.call \n duration = Time.now - start_time\n puts description_of_block+': '+duration.to_s+' seconds'\nend",
"def time_block\n start = Time.now\n yield\n time = Time.now - start\n puts \"Block took basically 0 time\" if time < 0.001\n raise \"Block took #{time} to execute\" if time > 0.001\nend",
"def timed_run(&block)\n time = Benchmark.measure do\n block.call\n end\n puts time\nend",
"def profile blockDescription, &block\n startTime = Time.now\n\n block.call\n \n duration = Time.now - startTime\n\n puts blockDescription + ': '+duration.to_s+' seconds'\n\nend",
"def average_exec_time(&block)\n (0...1000).sum do\n Benchmark.measure(&block).real\n end / 1000\nend",
"def profile block_description, &block\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_description}: #{duration} seconds\" if $profiling_status\nend",
"def measure_time(&block)\n start_time = Time.now\n yield\n Time.now - start_time\nend",
"def profile block_description, &block\n profiling_on = true\n if profiling_on == true\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_description}: #{duration} seconds\"\n else\n block.call\n end\nend",
"def blocks_time\n Benchmark::Tms.new\n end",
"def bench(&block)\n t0 = Time.now\n block.call\n t1 = Time.now\n\n t1 - t0\nend",
"def time description = '', &block\n start = Time.now\n yield\n puts \"execution time of #{description.empty? ? block.to_s : description}: #{Time.now - start}\"\nend",
"def profile block_description, &block \n \tif $profiling_on\n \t\tstart_time = Time.new\n\t\tblock.call\n\t\tduration = Time.new - start_time\n\t\tputs \"#{block_description}: #{duration} seconds\"\n\telse\n\t\tblock.call\n\tend\nend",
"def with_timer(&block)\n start_time = Time.now\n block.call\n end_time = Time.now\n duration_in_seconds = (end_time - start_time).to_i\n $stderr.puts \"Total duration: #{ duration_in_seconds } seconds.\"\n end",
"def time_operation(&block)\n start = Time.now.to_ms\n yield\n Time.now.to_ms - start\n end",
"def benchmark\n start_time = Time.now\n calculation = yield\n end_time = Time.now\n run_time = end_time - start_time\n run_time\nend",
"def execution_time\n @process.instance_variable_get(:@execution_time).total\n end",
"def timed(&block)\n @@start_time = Time.now\n Thread.new(&block).join\n @@elapsed_time = Time.now - @@start_time\n @@average_times.push(@@elapsed_time) \n end",
"def timer(&block)\n start_time = Time.now\n yield(start_time)\n time_elapsed = Time.now - start_time\n end",
"def time(count = 1000, &block)\n start = Time.now\n 1000.times { yield }\n end_time = Time.now\n puts (end_time - start) * 1000\nend",
"def runtime_latency\n (finished_at || Time.current) - performed_at if performed_at\n end",
"def debug_time(msg, &block)\n t0 = Time.now\n value = block.call\n debug \"TIME: #{msg} #{sprintf \"%.6f\", (Time.now - t0)} sec\"\n value\n end",
"def time\n start = Time.now.to_f\n yield\n puts \"Computation time is:\\n\"\n puts Time.now.to_f - start\n end",
"def time\n\t\t\t\tDateTime.strptime(block_nTime.to_s, \"%s\").to_s\n\t\t\tend",
"def time_this &block\n _time_this_starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n block.call\n Process.clock_gettime(Process::CLOCK_MONOTONIC) - _time_this_starting\nend",
"def benchmark\n start_time = Time.now\n yield\n end_time = Time.now\n running_time = end_time - start_time\nend",
"def time(&block)\n t = Time.now\n [yield, Time.now - t]\n end",
"def time_it\n time_before = Time.now\n yield\n time_after = Time.now\n\n puts \"It took #{time_after - time_before} seconds.\"\nend",
"def grandfather_clock block_description, &block\n profling_on = true\n if profling_on == true\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_description}: #{duration} seconds\"\n else\n block.call\n end\nend",
"def time(label, &block)\n raise ArgumentError, 'no block given' unless block\n\n `#{@native}.time(label)`\n\n begin\n if block.arity == 0\n instance_exec(&block)\n else\n yield(self)\n end\n ensure\n `#{@native}.timeEnd()`\n end\n end",
"def time_it\n time_before = Time.now\n yield\n time_after = Time.now\n\n puts \"it took #{time_after - time_before} seconds.\"\nend",
"def time\n beg_time = Time.now\n yield\n end_time = Time.now\n end_time - beg_time\n end",
"def total_time=(_arg0); end",
"def time(who, &block)\n trace_execution_unscoped(key(who), {}, &block)\n end",
"def with_logging(&block)\n\tstart_time = Time.now\n\tputs \"Starting running code at #{start_time}\"\n\tblock.call\n\tend_time = Time.now\n\tputs \"Finishing running code #{end_time}\"\n\ttime_taken = end_time - start_time\n\tputs \"Time taken was #{time_taken} seconds\"\nend",
"def custom_benchmark\n start_time = Time.now\n yield if block_given?\n elapsed_time = Time.now - start_time\n puts \"Custom Benchmark Time in Seconds: #{elapsed_time}\"\nend",
"def custom_benchmark(name)\n start_time = Time.now\n yield if block_given?\n elapsed_time = Time.now - start_time\n puts \"#{name} Time in Seconds: #{elapsed_time}\"\nend",
"def benchmark\n start_time = Time.now\n result = yield\n end_time = Time.now\n benchmark = end_time - start_time\nend",
"def bench type\n t1 = Time.now\n yield\n t2 = Time.now\n p \"#{type} used #{t2 - t1} seconds\"\nend",
"def profile_time\n time_elapsed = Benchmark.realtime do\n yield\n end\n\n puts \"Time: #{time_elapsed.round(3)} seconds\"\n # print \";#{time_elapsed.round(3)}\"\n end",
"def time\n tstart = Time.now.to_f\n yield\n tend = Time.now.to_f\n tend - tstart\nend",
"def benchmark\n start = Time.now\n yield\n p Time.now - start\nend",
"def bench(name, &block)\n time = Benchmark.realtime do\n yield block\n end\n puts \"#{name}: #{time}\"\nend",
"def exec_time(proc)\n begin_time = Time.now\n proc.call\n Time.now - begin_time\nend",
"def cstime=(*) end",
"def getblockcount\n coind.getblockcount\n end",
"def exec_time(a)\n begin_time = Time.now\n a.call\n return Time.now - begin_time\nend",
"def get_block_count\n call_blockchain_api('getblockcount').to_i\n end",
"def bench(descr)\n start = Time.now\n yield\n puts \"#{descr} : #{Time.now-start} seconds\"\nend",
"def time_itr\n start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n yield\n end_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n delta_time = end_time - start_time\n return delta_time\nend",
"def block_length()\n #This is a stub, used for indexing\n end",
"def block_length()\n #This is a stub, used for indexing\n end",
"def time(times = 1)\n require 'benchmark'\n ret = nil\n Benchmark.bm { |x| x.report { times.times { ret = yield } } }\n ret\nend",
"def time(message=nil)\n start = Time.now\n result = yield\n elapsed = Time.now - start\n \n print \"[#{message}] \" if message\n puts \"elapsed time: %0.5fs\" % elapsed\n result\nend",
"def measure\n start_real = System.monotonic_time\n start_cpu = System.cpu_time\n retval = yield\n\n real_time = System.monotonic_time - start_real\n cpu_time = System.cpu_time - start_cpu\n\n @real_time += real_time\n @cpu_time += cpu_time\n @call_count += 1\n\n if above_threshold?\n self.class.gitlab_method_call_duration_seconds.observe(@transaction.labels.merge(labels), real_time)\n end\n\n retval\n end",
"def time_elapsed\n if !self.finished.blank?\n ((self.finished - self.started) / 60).to_i\n end\n end",
"def measure\n start = Time.now\n yield\n Time.now - start\n end",
"def time(msg, &block)\n return(yield) unless $verbose\n print \"#{msg}...\"\n t = Time.now.to_f\n response = yield\n print \"(%0.2f ms) \" % (Time.now.to_f - t)\n if info = response['result_info']\n print \"[%s/%s/%s/%s] \" %\n info.values_at(*%w(page per_page count total_count)).map(&:to_s)\n end\n puts \"OK\" if response.fetch('success')\n puts \"FAIL\" unless response.fetch('success')\n response\n end",
"def log description,&block\n puts \"#{description} block has started.\"\n block.call\n puts \"#{description} block has finished, returning: #{description.to_s.length}\"\nend",
"def cstime(*) end",
"def timer\n # 2. start executing the method\n start_time = Time.now\n yield # 3. jump out of 'timer', start execuding the block\n\n # 6. continue executing the method as per usual\n end_time = Time.now\n\n puts \"Elapsed time: #{end_time - start_time} s\"\nend",
"def exec_time(proc)\n start_time = Time.now\n proc.call\n Time.now - start_time\nend",
"def exec_time(proc)\n start = Time.now\n proc.call\n Time.now - start\nend",
"def run_time\n ((Time.now - start_time) * 1000).round\n end",
"def cpu_time\n @cpu_time_finish - @cpu_time_start\n end",
"def benchmark\n start_time = Time.now\n yield\n end_time = Time.now\n end_time - start_time\n\n # Your benchmarking code goes here.\nend",
"def time\n start = Time.now\n yield\n Time.now - start\nend",
"def time_it\n time_before = Time.now\n yield # do whatever\n time_after = Time.now\n puts \"It tooke #{time_after - time_before} seconds!\"\nend",
"def measure(heading)\n start_time = Time.now\n print heading\n result = yield\n end_time = Time.now - start_time\n puts \" (#{end_time} s)\"\n result\nend",
"def total_time; end",
"def time(key, &block)\n if block_given?\n yield\n else\n NullTimedExecution\n end\n end",
"def block_count\n request('getblockcount')\n end",
"def duration_time\n if !block_given?\n if @cached_duration_time != nil\n return @cached_duration_time\n end\n return @cached_duration_time = @j_del.java_method(:durationTime, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling duration_time()\"\n end",
"def block_count\n @disk.block_count - @data_start\n end",
"def benchmark\n t1 = Time.now\n output = yield\n [\"#{(Time.now - t1) * 1000}ms\", output]\nend",
"def exec_time(proc)\n # your code here\n x = Time.now\n proc.call()\n y = Time.now\n y - x\nend",
"def blocks_time\n @measurements[PATH_MEASURES].time if @measurements[PATH_MEASURES]\n end",
"def time(identifier)\n if active?\n unless block_given?\n raise \"Please supply a block of code for Etalon to instrument\"\n end\n\n start = Time.now\n\n return_value = yield\n\n duration = elapsed(start)\n\n key = key_from(identifier: identifier)\n store = instrument_store_for(key: key)\n\n store[:count] += 1\n store[:min] = duration if duration < store[:min]\n store[:max] = duration if duration > store[:max]\n store[:all] << duration\n\n return_value\n else\n yield\n end\n end",
"def duration(proc)\n start = Time.now\n proc.call\n dur = Time.now - start\nend",
"def begin_time\n if !block_given?\n if @cached_begin_time != nil\n return @cached_begin_time\n end\n return @cached_begin_time = @j_del.java_method(:beginTime, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling begin_time()\"\n end",
"def tm()\n start = Time.now\n result = yield\n delta = Time.now - start\n puts \"Elapsed: #{delta} seconds\"\n result\nend",
"def time\n building_time + execution_time\n end",
"def execution_time\n @execution_time ||= order.attribute_ids_with_qauntity.map do |data|\n att = photographer_attributes.find_by(attribute_item_id: data.first)\n att.default_time + data.last.modulo(att.attribute_item.base_quantity) * att.extra_time\n end.sum\n end",
"def time\n @began = Time.now\n yield\n ensure\n self.info \"Finished in %.1f sec.\" % (Time.now - @began)\n end",
"def block_count; @data[17].to_i; end",
"def times\n if block_given? # metodo de kernel para verificar si viene un bloque\n p yield(1, 100) # yield ejecuta el bloque que se paso por parametros\n end\nend",
"def get_run_time(ant)\n end",
"def time\n started_at = Time.now.to_f\n yield()\n ensure\n update((Time.now.to_f - started_at.to_f) * 1000)\n end",
"def run_time_or_time_elapsed\n if self.end_time \n return Time.at(self.end_time - self.start_time)\n else\n return Time.at(Time.now - self.start_time)\n end\n end",
"def duration_block_in_minutes\n 180\n end",
"def measure\n start = Time.now\n yield\n Time.now - start\n end",
"def handle_tslb\n { tslb: (Time.now - @node.last_block_time).to_i }\n end",
"def run_time\n return nil unless self.start_time\n (self.end_time || Time.now) - self.start_time\n end",
"def time\n end_time - start_time\n end",
"def time\n each_item.reduce(0) { |a, e| a + e.duration }\n end",
"def benchmark_time(*args, &block)\n b = BenchmarkTime::BenchmarkTime.new(*args, &block)\n b.run\nend",
"def get_total_runtime_ms\n (TimeDifference.between(*get_runtime_timestamps).in_seconds * 1000).to_i\n end",
"def time_elapsed\n\t\treturn Time.now - self.start_time\n\tend",
"def summarize(&block)\n started = Time.now\n yield\n ensure\n results(Time.now - started)\n end"
] | [
"0.7433315",
"0.7376588",
"0.73042643",
"0.7244509",
"0.71874106",
"0.718099",
"0.7154886",
"0.6948005",
"0.6876386",
"0.67497885",
"0.6725823",
"0.6526324",
"0.65033",
"0.6447613",
"0.64385056",
"0.64196855",
"0.62957144",
"0.6288237",
"0.6252005",
"0.6245605",
"0.6185272",
"0.614316",
"0.6129801",
"0.6106997",
"0.60357934",
"0.6005331",
"0.6000706",
"0.5974789",
"0.59515166",
"0.59380525",
"0.5936253",
"0.59264135",
"0.5917171",
"0.5915476",
"0.5900191",
"0.5890076",
"0.5887751",
"0.58857805",
"0.5881081",
"0.58761036",
"0.587215",
"0.58685523",
"0.578058",
"0.57615626",
"0.5754517",
"0.5733829",
"0.572432",
"0.57196003",
"0.5716255",
"0.57018745",
"0.5696479",
"0.5695625",
"0.5695625",
"0.5688196",
"0.5686085",
"0.5683111",
"0.5677551",
"0.5675097",
"0.56741655",
"0.567241",
"0.56670594",
"0.56652856",
"0.5654866",
"0.5649887",
"0.5638303",
"0.56359696",
"0.56321585",
"0.5617297",
"0.56168664",
"0.5613788",
"0.5600328",
"0.56000537",
"0.5599955",
"0.55998385",
"0.5587326",
"0.5587109",
"0.5570231",
"0.55689263",
"0.5543335",
"0.5542763",
"0.5540953",
"0.55380756",
"0.5530122",
"0.552796",
"0.55245095",
"0.54858685",
"0.54818094",
"0.54816955",
"0.54784375",
"0.54780465",
"0.5476862",
"0.5472257",
"0.5464996",
"0.5453706",
"0.54405063",
"0.5427343",
"0.542622",
"0.5414924",
"0.54127085",
"0.5404395"
] | 0.6375307 | 16 |
Returns the time taken to perform a request. | def time_request
time do
do_request
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def runtime_latency\n (finished_at || Time.current) - performed_at if performed_at\n end",
"def requests_per_second\n requests / horizon_time\n end",
"def get_response_time(uri)\n t0 = Time.now\n res = Net::HTTP.get_response(uri)\n\n Time.now - t0\nend",
"def time_request\n\t\tstarttimes = Process.times\n\t\tyield\n\tensure\n\t\truntimes = Process.times\n\t\t@run_count += 1\n\t\t@total_utime += utime = (runtimes.utime - starttimes.utime)\n\t\t@total_stime += stime = (runtimes.stime - starttimes.stime)\n\t\tself.log.info \\\n\t\t\t\"[PID %d] Runcount: %d, User: %0.2f/%0.2f, System: %0.2f/%0.2f\" %\n\t\t\t[ Process.pid, @run_count, utime, @total_utime, stime, @total_stime ]\n\tend",
"def response_time\n @response_time\n end",
"def time\n request :public, :get, :time\n end",
"def time\n\t\tresponse = self.request( :time )\n\t\treturn nil if response.empty?\n\t\treturn Time.at( response.first[:time].to_i )\n\tend",
"def server_timing; end",
"def took\n response['took']\n end",
"def took\n response['took']\n end",
"def response_time\n metrics['Response Time'].round\n end",
"def request_timeout()\n @req_timeout\n end",
"def time_elapsed\n Time.now - @start_time\n end",
"def time\n Integer(connection.write(\"get_time\", false))\n rescue ArgumentError\n 0\n end",
"def time\n Integer(connection.write(\"get_time\", false))\n rescue ArgumentError\n 0\n end",
"def time\n Integer(connection.write(\"get_time\", false))\n rescue ArgumentError\n 0\n end",
"def time_elapsed\n\t\treturn Time.now - self.start_time\n\tend",
"def request_time\n @request_time ||= Time.now.utc\n end",
"def execution_time\n @process.instance_variable_get(:@execution_time).total\n end",
"def time()\n return _request([\n 'time',\n '0'\n ])[0]\n end",
"def elapsed_time\n (Time.now.to_f - @start_time) * 1000\n end",
"def cpu_time\n @cpu_time_finish - @cpu_time_start\n end",
"def elapsed_time\n (Time.now.to_f - @start_time) * 1000000\n end",
"def get_queue_time\r\n @account = current_user\r\n # if the user is not logged in, give arbitrary time\r\n if @account == nil then\r\n if Rails.env.development? then\r\n return 140\r\n else\r\n return 0\r\n end\r\n end\r\n @userRequest = @account.queue_request\r\n # if there is no actual queue request, give arbitrary time\r\n if @userRequest == nil then\r\n if Rails.env.development? then\r\n return 140\r\n else\r\n return 0\r\n end \r\n end\r\n # Compare request end time to now\r\n @now = DateTime.current().getutc()\r\n if @now <= @userRequest.end_time then\r\n # Return time left in seconds\r\n return @userRequest.end_time.to_i - @now.to_i\r\n else\r\n return 0\r\n end \r\n end",
"def time()\n return self._request([\n 'time',\n '0'\n ])[0]\n end",
"def time_remaining\n end",
"def time_elapsed\n if !self.finished.blank?\n ((self.finished - self.started) / 60).to_i\n end\n end",
"def run_time\n ((Time.now - start_time) * 1000).round\n end",
"def time_remaining\n\n end",
"def get_time_remaining\n\n end",
"def take_time\n if self.completed?\n (complete_on - started_on) if complete_on && started_on\n end\n end",
"def cstime(*) end",
"def time\n building_time + execution_time\n end",
"def time\n end_time - start_time\n end",
"def total_time; end",
"def time_sec; Time.now.sec; end",
"def cpu_time_used\n domain_info[:cpuTime]\n end",
"def cpu_time_used\n domain_info[:cpuTime]\n end",
"def total_time\n Time.now - @now\n end",
"def usage_operation_update_time\n data[:usage_operation_update_time]\n end",
"def elapsed\n (Time.now - @start_time).round\n end",
"def time\n #Parse the raw time into a binary time structure...\n time = send_request(Packets::RequestTime.new)\n\n #And convert that to a ruby time.\n time.to_time()\n end",
"def wait_time\n if rate_limit_remaining < 50\n [rate_limit_reset - Time.zone.now, 0.001].sort.last\n else\n 3600.0 / rate_limiting\n end\n end",
"def time_remaining( address )\n address = encode( address )\n get(\"/timeremaining/#{address}\")\n end",
"def response_times\n times = []\n start_time = Time.now\n final_time = Time.now + @max_time\n counter = 1\n while Time.now < final_time do\n times << @request_builder.call(@url, counter)\n sleep(@sleep_time)\n counter += 1\n end\n times\n end",
"def report_time_elapsed\n self.test_session.time_elapsed\n end",
"def get_time()\n\t\t\tkparams = {}\n\t\t\tclient.queue_service_action_call('system', 'getTime', 'bigint', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def average_response_time\n (active_time / requests.to_f) * 1000\n end",
"def elapsed_time\n @internal_data.elapsed_time\n end",
"def execute_time\n @next_time\n end",
"def elapsed\n Time.now - @time_start\n end",
"def total_time\n (@fetch_time || 0) + (@parse_time || 0)\n end",
"def total_time\n (@fetch_time || 0) + (@parse_time || 0)\n end",
"def uptime\n\t\treturn Time.now - self.start_time\n\tend",
"def get_time\n Process.clock_gettime(Process::CLOCK_MONOTONIC)\n end",
"def uptime\n Time.now - @start_time\n end",
"def run_time_or_time_elapsed\n if self.end_time \n return Time.at(self.end_time - self.start_time)\n else\n return Time.at(Time.now - self.start_time)\n end\n end",
"def uptime\n LOG_STAT()\n id = id_gen()\n LOG_CALL(id, true, __method__)\n defer { LOG_CALL(id, false, 'uptime') }\n return fmt_time(Time.now.to_i - STARTUP_TIME)\n end",
"def elapsed_time\n if end_time && start_time\n return ((end_time - start_time)/60).round\n else\n return 0\n end\n end",
"def wait_time\n self.measurement.wait_time\n end",
"def get_run_time(ant)\n end",
"def timeout\n return @timeout\n end",
"def completiontime\r\n\t\t\t`#{BITS::BITSADMIN} /getcompletiontime {#{@id}}`\r\n\t\tend",
"def uptime\n @started ? (Time.now - @started).to_i : 0\n end",
"def cstime=(*) end",
"def run_time\n return nil unless self.start_time\n (self.end_time || Time.now) - self.start_time\n end",
"def time\n return @time\n end",
"def elapsed_time\n if @start_time && @end_time\n @end_time - @start_time\n else\n nil\n end\n end",
"def elapsed_time\n return nil if !started_at.present? || aborted_at.present?\n\n (finished_at.present? ? finished_at : Time.now) - started_at\n end",
"def get_timeout\n if @valgrind\n return timeout_seconds * TestBase::VALGRIND_TIMEOUT_MULTIPLIER\n elsif has_active_sanitizers\n return timeout_seconds * TestBase::SANITIZERS_TIMEOUT_MULTIPLIER\n else\n return timeout_seconds\n end\n end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def time; end",
"def seconds\n (Time.now - @start_time).to_i\n end",
"def service_time\n service_time = 0\n @solution.each { |route| service_time += route.service_time }\n return service_time\n end",
"def duration\n\t\tt =(Time.now- @start)\n\t\treturn t\n\tend",
"def total_time=(_arg0); end",
"def remaining_time()\n return @total_time_units - @done_time_units\n end",
"def idletime\n @executor.getKeepAliveTime(java.util.concurrent.TimeUnit::SECONDS)\n end",
"def process_duration\n t1 = Process.times.utime\n Process.times.utime - t1\nend",
"def get_elapse_time\n @start_time ||= @time_now\n return @time_now - @start_time\n end",
"def get_response_time #:doc:\n ret = session[:prompt_time].nil? ? 0 : (1000 * (Time.now - session[:prompt_time])).round\n session[:prompt_time] = nil\n ret\n end",
"def time\n @time\n end",
"def methods_time\n Benchmark::Tms.new\n end",
"def get_total_time\n return RideShare.get_all_trip_durations_in_seconds(@trips)\n end",
"def request_timeout\n timeout = request.env['HTTP_TIMEOUT']\n return if timeout.nil? || timeout.empty?\n\n timeout = timeout.split /,\\s*/\n timeout.reject! {|t| t !~ /^Second-/}\n timeout.first.sub('Second-', '').to_i\n end",
"def get_total_runtime_ms\n (TimeDifference.between(*get_runtime_timestamps).in_seconds * 1000).to_i\n end",
"def load_time\n \"#{(Time.now-@start_time).round(4)}s\"\n end",
"def fetchSimulationTime()\n com = Sumo::Traci::Command_GetVariable.new(:sim, :timeStep, \"\") ;\n execCommands(com) ;\n time = com.responseValue() ;\n return time ;\n end",
"def nsec\n 0\n end",
"def http_timeout; end",
"def measure_queue_time(env)\n start_time = queue_start(env)\n\n return unless start_time\n\n queue_time = request_start.to_f - start_time.to_f\n queue_time unless (queue_time < 0)\n end",
"def time\n (route[:time].to_i / 60).ceil\n end",
"def latency; end"
] | [
"0.7391947",
"0.72868717",
"0.7237059",
"0.7222084",
"0.71357614",
"0.704371",
"0.6997002",
"0.6966069",
"0.6847586",
"0.6841729",
"0.6826769",
"0.6766358",
"0.67625606",
"0.6728186",
"0.6728186",
"0.6728186",
"0.6716749",
"0.66869056",
"0.66575545",
"0.66535807",
"0.6603224",
"0.6602808",
"0.65982074",
"0.6536441",
"0.65060997",
"0.64916676",
"0.6482597",
"0.6482099",
"0.64602685",
"0.64080554",
"0.64013827",
"0.6374543",
"0.63716996",
"0.6362058",
"0.6320962",
"0.6320111",
"0.6308873",
"0.6308873",
"0.6304902",
"0.6286987",
"0.62819326",
"0.6267209",
"0.6264215",
"0.6263411",
"0.62619656",
"0.6252045",
"0.6236877",
"0.6217098",
"0.6210653",
"0.61959106",
"0.6190765",
"0.6189169",
"0.6189169",
"0.6170777",
"0.6150002",
"0.61438066",
"0.614279",
"0.61406296",
"0.613738",
"0.61358637",
"0.61318976",
"0.61258537",
"0.6122859",
"0.6110358",
"0.610868",
"0.61066544",
"0.6102575",
"0.61003447",
"0.60802907",
"0.6079309",
"0.6069365",
"0.6069365",
"0.6069365",
"0.6069365",
"0.6069365",
"0.6069365",
"0.6069365",
"0.6069365",
"0.6069365",
"0.6063059",
"0.6062484",
"0.60545784",
"0.6044397",
"0.6038867",
"0.6034392",
"0.6019489",
"0.60053235",
"0.6002944",
"0.5999331",
"0.59908605",
"0.59848696",
"0.59788847",
"0.59564185",
"0.5955528",
"0.5954506",
"0.5945296",
"0.59378237",
"0.5937456",
"0.5928963",
"0.5926188"
] | 0.7660052 | 0 |
def select_category_from_projects "SELECT category FROM projects;" end Make sure each ruby method returns a string containing a valid SQL statement. | def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name
"SELECT projects.title,(SELECT SUM(pledges.amount))
FROM projects
INNER JOIN pledges ON projects.id = pledges.project_id
GROUP BY projects.title;"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_category_from_projects\n\"SELECT category FROM projects;\"\nend",
"def selects_the_category_names_and_pledge_amounts_of_all_pledges_in_the_music_category\n\"SELECT projects.category, pledges.amount\nFROM pledges\nINNER JOIN projects\nON projects.id = pledges.project_id\nWHERE projects.category = 'music';\n\"\nend",
"def current_categories(db)\r\n\tretrieve_categories = '\r\n\tSELECT name FROM categories'\r\n\tcategories = db.execute(retrieve_categories)\r\nend",
"def selects_the_category_name_and_the_sum_total_of_the_all_its_pledges_for_the_books_category\n\"SELECT projects.category, SUM(pledges.amount)\nFROM pledges\nINNER JOIN projects\nON pledges.project_id = projects.id \nWHERE projects.category = 'books';\"\nend",
"def selects_the_category_name_and_the_sum_total_of_the_all_its_pledges_for_the_books_category\n\"SELECT Projects.category, SUM(Pledges.amount) FROM Projects JOIN Pledges ON Pledges.project_id = Projects.id WHERE Projects.category = 'books';\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"Write your SQL query Here\"\nend",
"def categories()\n db = connect()\n db.execute('SELECT * FROM categories')\n end",
"def category()\n sql = \"SELECT * FROM categories WHERE id = $1 ORDER BY name;\"\n values = [@category_id]\n sql_result = SqlRunner.run(sql, values)\n return Category.new(sql_result[0])\n end",
"def get_category_name(category_id)\n db = SQLite3::Database.new \"#{$script_dir}/cfps.db\"\n category = db.get_first_value(\"select name from category where id = ?\", [category_id])\n\n return categor\nend",
"def projects\n where(:_type => ProjectCategory.name)\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n \"Write your SQL query Here\"\n \"SELECT projects.title, SUM(pledges.amount)\n FROM projects\n INNER JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY projects.title ORDER BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"Write your SQL query Here\"\n \"SELECT projects.title, SUM(amount) FROM projects\n INNER JOIN pledges ON project_id = projects.id\n GROUP BY title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT title, SUM(amount)\nFROM projects\nINNER JOIN pledges\nON projects.id = pledges.project_id\nGROUP BY title\nORDER BY title\"\n\n# FROM owners\n# INNER JOIN cats_owners\n# ON owners.id = cats_owners.owner_id\n# JOIN cats ON cats_owners.cat_id = cats.id\n# WHERE cats_owners.owner_id = 2;\n\nend",
"def current_categorized_expenses(db, user_name)\r\n\tretrieve_categorized_expenses = '\r\n\tSELECT categories.name, amount FROM expenses\r\n\tJOIN users ON expenses.user_id = users.id\r\n\tJOIN categories ON expenses.category_id = categories.id\r\n\tWHERE users.name = ?'\r\n\tcategorized_expenses = db.execute(retrieve_categorized_expenses, [user_name])\r\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"Write your SQL query Here\"\n\"SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON projects.id = pledges.project_id GROUP BY(projects.title) ;\"\nend",
"def getCategories(_, _, _)\n @db.categories\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n sql = <<-SQL\n SELECT projects.title, SUM(pledges.amount) FROM projects JOIN pledges ON pledges.project_id = projects.id GROUP BY projects.title;\n SQL\n\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n <<-SQL\n SELECT projects.title , sum(pledges.amount)\n FROM projects\n INNER JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY pledges.project_id\n ORDER BY projects.title\n SQL\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"Write your SQL query Here\"\n \n\"SELECT projects.title, SUM(amount) \nFROM pledges \nINNER JOIN projects \nON pledges.project_id = projects.id GROUP BY projects.title;\"\nend",
"def category(id)\n db = connect()\n return db.execute('SELECT Id,Title FROM discussions WHERE CatId=?', id), db.execute('SELECT * FROM categories WHERE Id=?', id)\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"Write your SQL query Here\"\n \"SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON pledges.project_id = projects.id GROUP BY projects.title ORDER BY title\"\nend",
"def list_projects # :nologin:\n query = create_query(:Project, :all, :by => :title)\n show_selected_projects(query)\n end",
"def get_category_id(category)\n db = SQLite3::Database.new \"#{$script_dir}/cfps.db\"\n category_id = db.get_first_value(\"select id from category where name = ?\", [category])\n\n return category_id\nend",
"def select(db); end",
"def select(db); end",
"def get_records_for_category categ\n if categ.nil? or categ == \"\"\n #return @records\n get_data \"select * from todo\"\n else\n #return @records.select { |row| row[0] == categ }\n get_data \"select * from todo where categ = '#{categ}' \"\n end\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n <<-SQL \n SELECT projects.title, SUM(pledges.amount)\n FROM projects \n INNER JOIN pledges on projects.id = pledges.project_id \n GROUP BY projects.title\n ORDER BY projects.title\n SQL\nend",
"def project_statement\n project_clauses = []\n active_subprojects_ids = []\n\n active_subprojects_ids = project.descendants.active.map(&:id) if project\n if active_subprojects_ids.any?\n if has_filter?(\"subproject_id\")\n case operator_for(\"subproject_id\")\n when '='\n # include the selected subprojects\n ################\n # Smile specific : [project.id] + removed\n ids = values_for(\"subproject_id\").map(&:to_i)\n project_clauses << \"#{Project.table_name}.id IN (%s)\" % ids.join(',')\n when '!'\n # exclude the selected subprojects\n\n ################\n # Smile specific : [project.id] + removed\n ids = active_subprojects_ids - values_for(\"subproject_id\").map(&:to_i)\n project_clauses << \"#{Project.table_name}.id IN (%s)\" % ids.join(',')\n when '!*'\n # main project only\n project_clauses << \"#{Project.table_name}.id = %d\" % project.id\n else\n # all subprojects\n project_clauses << \"#{Project.table_name}.lft >= #{project.lft} AND #{Project.table_name}.rgt <= #{project.rgt}\"\n end\n elsif Setting.display_subprojects_issues?\n project_clauses << \"#{Project.table_name}.lft >= #{project.lft} AND #{Project.table_name}.rgt <= #{project.rgt}\"\n else\n project_clauses << \"#{Project.table_name}.id = %d\" % project.id\n end\n elsif project\n project_clauses << \"#{Project.table_name}.id = %d\" % project.id\n end\n project_clauses.any? ? project_clauses.join(' AND ') : nil\n end",
"def select(sql, name = nil)\n raise NotImplementedError, \"select is an abstract method\"\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n<<-SQL\n SELECT projects.title, SUM(pledges.amount)\n FROM projects\n JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY projects.title;\nSQL\nend",
"def index\n\n # @sql = \"Projects.name ILIKE '#{'%'+params[:name]+'%'}' \" if params[:name].present?\n @sql = params[:name].present? ? \"Projects.name ILIKE '#{'%'+params[:name]+'%'}' \" : \"Projects.name ILIKE '%' \"\n @sql += \"OR Projects.description ILIKE '#{'%'+params[:name]+'%'}' \" if params[:name].present?\n\n @sql += \"and Projects.category ILIKE '#{'%'+params[:categorysdigital]+'%'}' \" if params[:categorysdigital].present?\n if params[:categorysdigital].present?\n @sql += \"or Projects.category ILIKE '#{'%'+params[:categorysmarketing]+'%'}' \" if params[:categorysmarketing].present?\n else\n @sql += \"And Projects.category ILIKE '#{'%'+params[:categorysmarketing]+'%'}' \" if params[:categorysmarketing].present?\n end\n\n if params[:categorysdigital].present? || params[:categorysmarketing].present?\n @sql += \"or Projects.category ILIKE '#{'%'+params[:categorysdesign]+'%'}' \" if params[:categorysdesign].present?\n else\n @sql += \"And Projects.category ILIKE '#{'%'+params[:categorysdesign]+'%'}' \" if params[:categorysdesign].present?\n end\n\n @sql += \"and Projects.progress = #{params[:progresspropose].to_i} \" if params[:progresspropose].present?\n if params[:progresspropose].present?\n @sql += \"or Projects.progress = #{params[:progressselected].to_i} \" if params[:progressselected].present?\n else\n @sql += \"and Projects.progress = #{params[:progressselected].to_i} \" if params[:progressselected].present?\n end\n\n if params[:progressselected].present?\n @sql += \"or Projects.progress = #{params[:progressclose].to_i} \" if params[:progressclose].present?\n else\n @sql += \"and Projects.progress = #{params[:progressclose].to_i} \" if params[:progressclose].present?\n end\n\n # @sql += \"ORDER progress\"\n @projects = Project.where(@sql).order(:progress)\n @count = @projects.count\n @count_tt = Project.count\n end",
"def projects_countries(site, category_id = nil)\n if category_id.present? && category_id.to_i > 0\n if site.navigate_by_cluster?\n category_join = \"inner join clusters_projects as cp on cp.project_id = p.id and cp.cluster_id = #{category_id}\"\n else\n category_join = \"inner join projects_sectors as pse on pse.project_id = p.id and pse.sector_id = #{category_id}\"\n end\n end\n\n Country.find_by_sql(\n<<-SQL\nselect c.id,c.name,count(ps.*) as count from countries as c\n inner join countries_projects as pr on c.id=pr.country_id\n inner join projects as p on p.id=pr.project_id\n inner join projects_sites as ps on p.id=ps.project_id and ps.site_id=#{site.id}\n #{category_join}\n where p.primary_organization_id=#{self.id}\n group by c.id, c.name order by count DESC\nSQL\n ).map do |r|\n [r, r.count.to_i]\n end\n end",
"def projects_countries(site, category_id = nil)\n if category_id.present?\n if site.navigate_by_cluster?\n category_join = \"inner join clusters_projects as cp on cp.project_id = p.id and cp.cluster_id = #{category_id}\"\n else\n category_join = \"inner join projects_sectors as pse on pse.project_id = p.id and pse.sector_id = #{category_id}\"\n end\n end\n\n Country.find_by_sql(\n<<-SQL\nselect c.id,c.name,count(ps.*) as count from countries as c\n inner join countries_projects as pr on c.id=pr.country_id\n inner join projects as p on p.id=pr.project_id and (p.end_date is null OR p.end_date > now())\n inner join projects_sites as ps on p.id=ps.project_id and ps.site_id=#{site.id}\n #{category_join}\n where p.primary_organization_id=#{self.id}\n group by c.id, c.name order by count DESC\nSQL\n ).map do |r|\n [r, r.count.to_i]\n end\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM pledges\nINNER JOIN projects \nON pledges.project_id = projects.id\nGROUP BY project_id\nORDER BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n# Select projects title column and the sum of the pledges amount column\n# from the projects database,\n# join the pledges (Join table)\n# with projects.id and the pledges project id. Match these numbers\n# Group the tables together by Projects title and then\n# sort by projects.title\n\"SELECT Projects.title, SUM(Pledges.amount)\n FROM Projects\n JOIN Pledges\n ON Projects.id = Pledges.project_id\n GROUP BY Projects.title\n ORDER BY Projects.title;\n\"\nend",
"def get_project_name(id)\n con = PG::Connection.connect(\"localhost\",5432,nil,nil,\"aaa\",\"admin\")\n sql = \"SELECT name \"\n sql += \"FROM projects \"\n sql += \"WHERE id='#{id}' \"\n res = con.exec(sql)\n con.close\n name = \"NA\"\n name = res[0]['name'] if res.num_tuples > 0\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n<<-SQL\n SELECT DISTINCT title ,SUM(amount) FROM projects INNER JOIN pledges ON projects.id = pledges.project_id\n GROUP BY projects.title\n SQL\nend",
"def sql\n <<-SQL\n -- Search learning paths\n SELECT DISTINCT\n c.id,\n c.name,\n c.course_code,\n c.settings,\n cc.content,\n 'learning_path' AS content_type,\n c.id AS learning_path_id,\n 0 AS learning_objective_id\n FROM courses c\n LEFT OUTER JOIN fearless_taggings ts\n ON ts.taggable_id = c.id AND ts.taggable_type = 'LearningPath'\n LEFT OUTER JOIN fearless_tags t\n ON t.id = ts.tag_id\n LEFT OUTER JOIN fearless_custom_contents cc\n ON cc.contentable_id = c.id AND cc.contentable_type = 'LearningPath'\n WHERE 0=0\n #{construct_account_clause}\n #{construct_course_worklow_clause}\n #{construct_name_sql}\n #{construct_all_tags_search('t', 'name')}\n UNION ALL\n -- Search learning objectives\n SELECT DISTINCT\n cm.id,\n cm.name,\n c.course_code,\n c.settings,\n cc.content,\n 'learning_objective' AS content_type,\n cm.context_id::bigint AS learning_path_id,\n cm.id::bigint AS learning_objective_id\n FROM context_modules cm\n INNER JOIN courses c\n ON c.id = cm.context_id\n AND cm.context_type = 'Course'\n LEFT OUTER JOIN fearless_taggings ts\n ON ts.taggable_id = cm.id AND ts.taggable_type = 'LearningObjective'\n LEFT OUTER JOIN fearless_tags t\n ON t.id = ts.tag_id\n LEFT OUTER JOIN fearless_custom_contents cc\n ON cc.contentable_id = cm.id AND cc.contentable_type = 'LearningObjective'\n WHERE 0=0\n #{construct_account_clause}\n #{construct_generic_workflow_clause('cm')}\n #{construct_name_sql('cm')}\n #{construct_all_tags_search('t', 'name')}\n UNION ALL\n -- Search learning learning_event\n SELECT DISTINCT\n ct.id,\n ct.title AS name,\n c.course_code,\n c.settings,\n cc.content,\n 'learning_event' AS content_type,\n ct.context_id::bigint AS learning_path_id,\n ct.context_module_id::bigint AS learning_objective_id\n FROM content_tags ct\n INNER JOIN courses c\n ON c.id = ct.context_id\n AND ct.context_type = 'Course'\n LEFT OUTER JOIN fearless_taggings ts\n ON ts.taggable_id = ct.id AND ts.taggable_type = 'LearningEvent'\n LEFT OUTER JOIN fearless_tags t\n ON t.id = ts.tag_id\n LEFT OUTER JOIN fearless_custom_contents cc\n ON cc.contentable_id = ct.id AND cc.contentable_type = 'LearningEvent'\n WHERE 0=0\n #{construct_account_clause}\n #{construct_generic_workflow_clause('ct')}\n #{construct_name_sql('ct', 'title')}\n #{construct_all_tags_search('t', 'name')}\n SQL\n end",
"def get_category_name\n Category.find(:first, :select => ['name'],:conditions=>['has_complexity=?',false]).name rescue ''\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"\nSELECT \nProjects.title,\nSUM(Pledges.amount)\nFROM Pledges\nINNER JOIN Projects\nON Pledges.project_id = Projects.id\nGROUP BY Projects.title\nORDER BY Projects.title\n\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT Projects.title, SUM(pledges.amount) \nFROM projects \nJOIN pledges \nON Projects.id = pledges.project_id \nGROUP BY title\"; \nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM projects\nINNER JOIN pledges \nON projects.id=pledges.project_id\nGROUP BY projects.id\nORDER BY projects.title;\"\nend",
"def makeQueryTableAll(tableName)\n #sql = \"SELECT * FROM [\" << tableName << \"]\"\n sql = \"SELECT * FROM [\" << tableName << \"]\" << \" WHERE id < 3\"\n #puts(sql) #debug\n return sql\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"SELECT projects.title, sum_pledges FROM (SELECT pledges.project_id, SUM(pledges.amount) AS sum_pledges FROM pledges GROUP BY pledges.project_id) INNER JOIN projects ON projects.id = project_id ORDER BY projects.title\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n<<-SQL\nSELECT projects.title, SUM(pledges.amount) \nFROM projects \nINNER JOIN pledges on projects.id = pledges.project_id\nGROUP BY (pledges.project_id)\nORDER BY projects.title;\nSQL\nend",
"def category_totals(db, user_name, number)\r\n\tretrieve_totals = '\r\n\tSELECT categories.name, SUM(amount) FROM expenses\r\n\tJOIN users ON expenses.user_id = users.id\r\n\tJOIN categories ON expenses.category_id = categories.id\r\n\tWHERE categories.id = ?\r\n\tAND users.name = ?'\r\n\ttotals = db.execute(retrieve_totals, [number, user_name])[0]\r\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\r\n\"SELECT title, SUM(pledges.amount) FROM projects\r\nJOIN pledges ON projects.id = pledges.project_id\r\nGROUP BY projects.id\r\nORDER BY title ASC\"\r\nend",
"def add_category(db, category)\r\n\tnew_category = '\r\n\tINSERT INTO categories (name)\r\n\tVALUES (?)'\r\n\tdb.execute(new_category, [category])\r\nend",
"def select_category\n #Parbauda vai ekrans ir redzams\n @screens.screen_create_filter.visible?\n #Pievieno kategoriju no filtra datiem\n @screens.screen_create_filter.select_row(@filter_data.category)\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"Select title, amount from projects, pledges where projects.id = pledges.id order by title ASC;\"\nend",
"def projects_countries(site, category_id = nil, organization_id = nil, location_id = nil)\n if category_id.present? && category_id.to_i > 0\n if site.navigate_by_cluster?\n category_join = \"inner join clusters_projects as cp on cp.project_id = p.id and cp.cluster_id = #{category_id}\"\n else\n category_join = \"inner join projects_sectors as pse on pse.project_id = p.id and pse.sector_id = #{category_id}\"\n end\n end\n\n if organization_id.present? && organization_id.to_i > 0\n organization_filter = \"and p.primary_organization_id = #{organization_id}\"\n end\n\n if location_id.present?\n location_filter = \"and c.id IN (#{location_id})\"\n end\n\n Country.find_by_sql(\n<<-SQL\nselect c.id,c.name,count(ps.*) as count from countries as c\n inner join countries_projects as pr on c.id=pr.country_id #{location_filter}\n inner join projects as p on p.id=pr.project_id and (p.end_date is null OR p.end_date > now()) #{organization_filter}\n inner join projects_sites as ps on p.id=ps.project_id and ps.site_id=#{site.id}\n inner join donations as dn on dn.project_id = p.id\n #{category_join}\n where dn.donor_id = #{self.id}\n group by c.id, c.name order by count DESC\nSQL\n ).map do |r|\n [r, r.count.to_i]\n end\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT projects.title, SUM(pledges.amount) FROM pledges INNER JOIN projects ON projects.id=pledges.project_id GROUP BY projects.title;\"\n## FROM - where are they talking to each other - where is the scotch tape\nend",
"def select(componentName, text, componentInfo=nil)\n $marathon.select(ComponentId.new(componentName, componentInfo), text.to_s)\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n \"SELECT projects.title,\n SUM(pledges.amount)\n FROM pledges\n INNER JOIN projects\n ON projects.id = pledges.project_id\n GROUP BY projects.title;\"\n\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, \nSUM(pledges.amount) \nFROM projects\nJOIN pledges ON pledges.project_id = projects.id\nGROUP BY projects.title\nORDER BY projects.title ASC;\"\nend",
"def select_all(sql, name = nil) end",
"def select\n @pds_projects = PdsProject.includes(:company).where('ProjectID in (?)', PROJECT_LIST)\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, sum(amount) AS pledge_amount\nFROM pledges\nJOIN projects\nWHERE pledges.project_id = projects.id\nGROUP BY project_id\nORDER BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n <<-SQL\n SELECT\n title, sum(amount)\n FROM\n projects\n JOIN pledges\n ON pledges.project_id = projects.id\n GROUP BY\n title\n ORDER BY\n title\n SQL\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount )\nFROM projects \nJOIN pledges\nON projects.id = pledges.project_id \nGROUP BY projects.title \nORDER BY projects.title \";\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n \"SELECT projects.title, sum(pledges.amount)\n FROM projects\n INNER JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY pledges.project_id\n ORDER BY projects.title ASC;\n \"\nend",
"def db_fetch\n \"SELECT *\" + from_table_where + sql_match_conditions\n end",
"def get_category(cate, limitl, limitr)\n return Product.find_by_sql(\"select * from products where tag like '%#{cate}%' order by id limit #{limitl}, #{limitr}\")\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT projects.title, SUM(pledges.amount) FROM pledges INNER JOIN projects ON projects.id = pledges.project_id GROUP BY projects.title ORDER BY projects.title \"\nend",
"def select_project\n @projects = Project.find(:all)\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT projects.title, SUM(pledges.amount)\n FROM projects\n JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT title, SUM(amount)\nFROM projects\nINNER JOIN pledges\nON projects.id = pledges.project_id\nGROUP BY projects.title\nORDER BY projects.title;\"\nend",
"def sql_statement_find\n @sql_statement_find ||=\n <<-SQL\n SELECT\n applications.id AS id,\n teams.name AS team_name,\n projects.name AS project_name,\n (application_data -> :project_id)::int AS project_id,\n application_data -> :project_plan AS project_plan,\n application_data -> :why_selected_project AS why_selected_project,\n application_data -> :signed_off_at AS signed_off_at,\n (application_data -> :signed_off_by)::int AS signed_off_by,\n application_data -> :mentor_fav AS mentor_fav,\n CASE WHEN :project_id::text = 'project1_id' THEN 1 ELSE 2 END AS choice,\n hstore_to_json_loose(slice(application_data, ARRAY[:student0_attrs])) AS student0,\n hstore_to_json_loose(slice(application_data, ARRAY[:student1_attrs])) AS student1\n FROM applications\n INNER JOIN teams\n ON teams.id = applications.team_id\n INNER JOIN projects\n ON projects.id::text = applications.application_data -> :project_id\n WHERE (application_data -> :project_id)::int IN (:project_ids)\n AND applications.season_id = :season_id\n AND applications.id = :id;\n SQL\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT Projects.title, SUM(Pledges.amount)\n FROM projects\n JOIN pledges\n ON Projects.id = Pledges.project_id\n GROUP BY project_id\n ORDER BY Projects.title\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\n FROM pledges\n INNER JOIN projects\n ON pledges.project_id = projects.id\n GROUP BY projects.title\n ORDER BY projects.title\n\"\nend",
"def sql\n @sql ||= begin\n bind_params = []\n 1.upto(selector_keys.length + setter_keys.length) { |i| bind_params << \"$#{i}\" }\n %{SELECT #{name}(#{bind_params.join(', ')})}\n end\n end",
"def select(componentName, text, componentInfo=nil)\n $marathon.select(ComponentId.new(componentName, componentInfo), text.to_s)\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM projects\nJOIN pledges\nON projects.id = pledges.project_id\nGROUP BY projects.title;\"\nend",
"def getCat \n\t\tputs ''\n\t\tputs 'Fetching categories . . '\n\t\[email protected]('ul.dropdown li a').each do |cat|\n\t\t\tarr=[]\n\t\t\tarr.push cat.text\n\t\t\tarr.push cat['href']\n\t\t\t@arr_cat.push arr\n\t\t\tprint '. '\n\t\tend\n\t\ti=0\n\t\t@arr_cat.each do |pair|\n\t\t\[email protected] 'insert into category values (?, ? ,?)', i, pair[0], pair[1]\n \t\t\ti +=1\n \t\tend\n\tend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM (pledges.amount)\nFROM projects\nINNER JOIN pledges\nON projects.id = pledges.project_id\nGROUP BY title\nORDER BY title ASC;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT Projects.title, SUM(Pledges.amount) FROM Projects JOIN Pledges ON Pledges.project_id = Projects.id GROUP BY Projects.title;\"\nend",
"def add_project_name_to_jql jql_string\n unless jql_string.empty?\n jql_string.insert(0, \"project=#{@project} AND \")\n else\n \"project=#{@project}\"\n end\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT title, SUM(amount) FROM pledges INNER JOIN projects ON projects.id = pledges.project_id GROUP BY projects.id ORDER BY title;\"\nend",
"def search(category, query_term)\nresult = @conn.exec(\"SELECT * FROM students WHERE #{category} = '#{query_term}';\");\n puts student\n result.each do |student|\n puts \"#{k}: #{v}\"\n end\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT projects.title, SUM(pledges.amount)\n FROM projects\n INNER JOIN pledges\n ON pledges.project_id = projects.id\n GROUP BY(projects.title);\"\nend",
"def show_categories(html_dsl)\r\n categories = Category.where(\"user_id = #{session[:user_id]} and category_id is null\").order('name ASC')\r\n category_html = create_category_table(categories)\r\n html_dsl.inject(category_html)\r\n end",
"def show_categories(html_dsl)\r\n categories = Category.where(\"user_id = #{session[:user_id]} and category_id is null\").order('name ASC')\r\n category_html = create_category_table(categories)\r\n html_dsl.inject(category_html)\r\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, sum(pledges.amount) FROM projects INNER JOIN pledges on pledges.project_id=projects.id group by pledges.project_id ORDER BY projects.title ASC\"\nend",
"def selects_all_female_bears_return_name_and_age\n <<-SQL \n SELECT \n bears.name, \n bears.age \n FROM bears \n WHERE sex='F';\n SQL\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n \"SELECT projects.title, SUM(pledges.amount) FROM projects\n JOIN pledges ON projects.id = pledges.project_id\n GROUP BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n \"SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON pledges.project_id=projects.id GROUP BY projects.title ORDER BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM projects\nINNER JOIN pledges\nON projects.id = pledges.project_id GROUP BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n # SELECT titles, amounts FROM projects, pledges ORDER BY titles ASC\n #SELECT titles.projects, pledges.amounts ORDER BY titles ASC\n \"SELECT projects.title, SUM(pledges.amount) FROM projects\n JOIN pledges \n ON pledges.project_id = projects.id \n GROUP BY(pledges.project_id)\n ORDER BY projects.title ASC\n \";\nend",
"def sql_statement_all\n @sql_statement_all ||=\n <<-SQL\n SELECT\n applications.id AS id,\n teams.name AS team_name,\n projects.name AS project_name,\n (application_data -> :project_id)::int AS project_id,\n application_data -> :signed_off_at AS signed_off_at,\n (application_data -> :signed_off_by)::int AS signed_off_by,\n application_data -> :mentor_fav AS mentor_fav,\n CASE WHEN :project_id::text = 'project1_id' THEN 1 ELSE 2 END AS choice\n FROM applications\n INNER JOIN teams\n ON teams.id = applications.team_id\n INNER JOIN projects\n ON projects.id::text = applications.application_data -> :project_id\n WHERE (application_data -> :project_id)::int IN (:project_ids)\n AND applications.season_id = :season_id;\n SQL\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n \"SELECT projects.title, SUM(pledges.amount)\n FROM projects\n JOIN pledges ON pledges.project_id = projects.id\n GROUP BY title\n ORDER BY title ASC;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON projects.id = pledges.project_id GROUP BY projects.title ORDER BY projects.title ASC;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"select\nprojects.title,\nsum(pledges.amount) as sum_all_pledges\nfrom projects\ninner join pledges\non projects.id = pledges.project_id\ngroup by projects.title\norder by projects.title;\n\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n \"SELECT projects.title, SUM(pledges.amount) \n FROM projects\n JOIN pledges\n ON pledges.project_id = projects.id\n GROUP BY projects.title;\"\nend",
"def category_selection(category)\n category = Public_apis.find_by_name(category)\n #goes over list item array . find method to find item\n\n \n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM projects\nLEFT JOIN pledges\nON projects.id=pledges.project_id\nGROUP BY projects.title\nORDER BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n #SELECT title, SUM(quantity) FROM groceries GROUP BY aisle ORDER BY SUM(quantity);\n\n \"SELECT projects.title, sum( pledges.amount)\nFROM projects\nJOIN pledges\nwhere projects.id=pledges.project_id\ngroup by projects.title order by projects.title\n;\"\n\nend",
"def frey_example\n # Find all the cats that are the same color as the cat named 'Freyja'.\n # Including 'Freyja' in the results.\n # DO NOT USE A SUBQUERY\n\n execute(<<-SQL)\n SELECT\n color_cats.name\n FROM\n cats AS freyja_cats\n JOIN\n cats AS color_cats ON freyja_cats.color = color_cats.color\n WHERE\n freyja_cats.name = 'Freyja';\n SQL\nend",
"def select &blck\n @projects.select(&blck)\n end",
"def select &blck\n @projects.select(&blck)\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT p.title, SUM(pl.amount) FROM pledges pl INNER JOIN projects p ON pl.project_id = p.id GROUP BY pl.project_id ORDER BY p.title\"\nend"
] | [
"0.91981363",
"0.70684034",
"0.69916224",
"0.6651801",
"0.66231173",
"0.6513625",
"0.64876",
"0.6324443",
"0.6061143",
"0.59409004",
"0.5938305",
"0.5936245",
"0.5900887",
"0.5882952",
"0.5870606",
"0.58542585",
"0.5853712",
"0.5840277",
"0.5819194",
"0.5785329",
"0.57822204",
"0.5699265",
"0.5697001",
"0.56910396",
"0.56910396",
"0.569008",
"0.568214",
"0.5679455",
"0.563316",
"0.56282234",
"0.56202763",
"0.562004",
"0.561618",
"0.5589269",
"0.558222",
"0.55741537",
"0.55734766",
"0.55726343",
"0.556879",
"0.55442446",
"0.55411935",
"0.5527624",
"0.5487611",
"0.5480295",
"0.54792297",
"0.5478854",
"0.5475931",
"0.5466553",
"0.54620075",
"0.54591227",
"0.54512274",
"0.5447939",
"0.5432765",
"0.5430723",
"0.5429964",
"0.5428628",
"0.54243755",
"0.5423199",
"0.5422102",
"0.5416082",
"0.5393256",
"0.5386254",
"0.53844714",
"0.5382238",
"0.53815633",
"0.5381353",
"0.53730273",
"0.5361857",
"0.5352266",
"0.5351445",
"0.5348369",
"0.5348134",
"0.53479743",
"0.53419787",
"0.53407365",
"0.5332726",
"0.5332524",
"0.53219175",
"0.5321195",
"0.531972",
"0.5312044",
"0.5312044",
"0.5306883",
"0.52992225",
"0.52966166",
"0.5290944",
"0.5286729",
"0.5284725",
"0.5284546",
"0.5284275",
"0.5283349",
"0.5276348",
"0.52737325",
"0.52729166",
"0.5268388",
"0.52644706",
"0.5259389",
"0.5256466",
"0.5256466",
"0.52551633"
] | 0.54076433 | 60 |
Turn off stdout for all specs | def quiet_stdout
around(:example) do |example|
capture_stdout true
example.run
capture_stdout false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disable_stdout\n @old_stdout = STDOUT.dup\n # via Tomas Matousek, http://www.ruby-forum.com/topic/205887\n STDOUT.reopen(::RUBY_PLATFORM =~ /djgpp|(cyg|ms|bcc)win|mingw/ ? 'NUL' : '/dev/null')\n end",
"def disable_stdout\n @old_stdout = STDOUT.dup\n STDOUT.reopen(PLATFORM =~ /mswin/ ? \"NUL\" : \"/dev/null\")\n end",
"def spec_helper_silence_stdout( &block )\n spec_helper_silence_stream( $stdout, &block )\nend",
"def disable_stdout\n stdoutoutputter = Log4r::Outputter[\"#{@name.to_s}-stdout\"]\n stdoutoutputter.level = Log4r::OFF\n end",
"def suppress_output\n $stderr.reopen(\"/dev/null\", \"a\")\n $stdout.reopen($stderr)\n end",
"def silence_output\n # @orig_stderr = $stderr\n @orig_stdout = $stdout\n \n # redirect stderr and stdout to /dev/null\n # $stderr = File.new('/dev/null', 'w')\n $stdout = File.new('/dev/null', 'w')\nend",
"def silence_output\n @orig_stderr = $stderr\n @orig_stdout = $stdout\n $stderr = File.new('/dev/null', 'w')\n $stdout = File.new('/dev/null', 'w')\nend",
"def enable_output\n $stdout = @original_stdout\n @original_stdout = nil\nend",
"def silence_output\n @orig_stderr = $stderr\n @orig_stdout = $stdout\n \n # redirect stderr and stdout to /dev/null\n $stderr = File.new('/dev/null', 'w')\n $stdout = File.new('/dev/null', 'w')\nend",
"def suppress_output\n original_stdout, original_stderr = $stdout.clone, $stderr.clone\n $stderr.reopen File.new('/dev/null', 'w')\n $stdout.reopen File.new('/dev/null', 'w')\n yield\nensure\n $stdout.reopen original_stdout\n $stderr.reopen original_stderr\nend",
"def without_stderr; end",
"def suppress_output\n original_stdout = $stdout.clone\n original_stderr = $stderr.clone\n $stderr.reopen File.new('/dev/null', 'w')\n $stdout.reopen File.new('/dev/null', 'w')\n yield\nensure\n $stdout.reopen original_stdout\n $stderr.reopen original_stderr\nend",
"def silence_output\n # Store the original stderr and stdout in order to restore them later\n @original_stderr = $stderr\n @original_stdout = $stdout\n\n # Redirect stderr and stdout\n $stderr = File.new('/dev/null', 'w')\n $stdout = File.new('/dev/null', 'w')\nend",
"def silence_output\n orig_stdout = $stdout\n $stdout = StringIO.new\n yield\n $stdout = orig_stdout\nend",
"def supress_stdout\n mock_io = StringIO.new\n stdout_real, $stdout = $stdout, mock_io\n if block_given?\n begin\n yield\n ensure\n $stdout = stdout_real\n end\n end\n mock_io\nend",
"def silent\n if ENV[\"RSPECQ_DEBUG\"]\n yield\n return\n end\n\n begin\n orig = $stdout.clone\n $stdout.reopen(File::NULL, \"w\")\n yield\n ensure\n $stdout.reopen(orig)\n end\n end",
"def suppress_output(&block)\n $stdout = File.new(\"/dev/null\", \"w\")\n $stderr = File.new(\"/dev/null\", \"w\")\n result = block.call\n $stdout = STDOUT\n $stderr = STDERR\n result\n end",
"def suppress_stdout\n original_stderr = $stderr\n original_stdout = $stdout\n $stderr = File.open(File::NULL, 'w')\n $stdout = File.open(File::NULL, 'w')\n yield\n ensure\n $stderr = original_stderr\n $stdout = original_stdout\n end",
"def silenced\n $stdout = StringIO.new\n\n yield\n ensure\n $stdout = STDOUT\n end",
"def hide_output\n keep_stdout = $stdout\n keep_stderr = $stderr\n $stdout = StringIO.new\n $stderr = StringIO.new\n yield\n ensure\n $stdout = keep_stdout\n $stderr = keep_stderr\n end",
"def enable_output\n # $stderr = @orig_stderr\n $stdout = @orig_stdout\n # @orig_stderr = nil\n @orig_stdout = nil\nend",
"def enable_output\n $stderr = @orig_stderr\n $stdout = @orig_stdout\n @orig_stderr = nil\n @orig_stdout = nil\nend",
"def enable_output\n $stderr = @orig_stderr\n $stdout = @orig_stdout\n @orig_stderr = nil\n @orig_stdout = nil\nend",
"def silent_out\n stdout = $stdout\n $stdout = StringIO.new\n begin\n yield if block_given?\n ensure\n $stdout = stdout\n end\nend",
"def hide\n real_stdout = $stdout\n $stdout = StringIO.new\n yield\nensure\n $stdout = real_stdout\nend",
"def enable_output\n $stderr = @original_stderr\n $stdout = @original_stdout\n @original_stderr = nil\n @original_stdout = nil\nend",
"def silence!\n IO.console.raw!\n end",
"def enable_output\n $stderr = @original_stderr\n $stdout = @original_stdout\n @original_stderr = nil\n @original_stdout = nil\n `rm #{log_file} && touch #{log_file}`\nend",
"def teardown\n reset_stdout\n end",
"def without_stdout_buffering\n sync, $stdout.sync = $stdout.sync, true\n yield\n ensure\n $stdout.sync = sync\n end",
"def quiet\n if @suppress_output\n \">/dev/null 2>&1\"\n end\n end",
"def silence_output\n # Store the original stderr and stdout in order to restore them later\n @original_stderr = $stderr\n @original_stdout = $stdout\n\n # Redirect stderr and stdout\n $stderr = File.new(log_file, 'w')\n $stdout = File.new(log_file, 'w')\nend",
"def suppress; @write = false end",
"def clear_stdout!\n @stdout_handler.clear!\n end",
"def reset_output\n $stdout = StringIO.new\nend",
"def turn_off\n STDOUT.puts \"\\e]2;\\a\"\n end",
"def test_verbose_mode_server_prints_received_contents_to_stdout\n skip(msg='Do not know how to capture STDOUT without implementing custom output stream variable')\n end",
"def teardown\n $stdout = @old_stdout\n end",
"def teardown\n $stdout = @old_stdout\n end",
"def teardown\n $stdout = @old_stdout\n end",
"def quietly\n d = Spy.on_instance_method(cmd_class, :display)\n yield\n assert d.has_been_called?\n d.unhook\n end",
"def clear_stdout\n $stdout.string = ''\n end",
"def without_stderr\n old_stderr = $stderr\n $stderr = StringIO.new\n\n yield\n ensure\n $stderr = old_stderr\n end",
"def silence\n old_o, old_e = $stdout, $stderr\n $stdout = StringIO.new\n $stderr = StringIO.new\n\n yield\nensure\n $stdout = old_o if old_o\n $stderr = old_e if old_e\nend",
"def suppress_diff_output\n return if @config[:runtime_config][:diff]\n\n @run_data[:profiles]&.each do |p|\n p[:controls]&.each do |c|\n c[:results]&.each do |r|\n next unless r[:message] # :message only set on failure\n\n pos = r[:message].index(\"\\n\\nDiff:\")\n next unless pos # Only textual tests get Diffs\n\n r[:message] = r[:message].slice(0, pos)\n end\n end\n end\n end",
"def assume_silence\n GitReview.any_instance.stub(:puts)\nend",
"def reset\n @tests = RSpec::Core::World.new\n # resets \"pending examples\" in reporter\n RSpec.configuration.reset\n configure_output\n end",
"def off\n %x{stty -raw} if TTY::Platform.unix?\n end",
"def clear_stdout\n $stdout.string = '' if $stdout.is_a?(StringIO)\n end",
"def clear_console_output\n return \"\" unless @clear_console_output\n return \"2>/dev/null\" if File.exist?(\"/dev/null\") #Linux console clear\n end",
"def should_print?\n !@suppress_output\n end",
"def normal\n @print_mode = 0\n write_print_mode\n end",
"def stdout_to_dev_null\n $stdout = File.open('/dev/null', 'w')\n yield\n $stdout = STDOUT\n end",
"def stdout_to_dev_null\n $stdout = File.open('/dev/null', 'w')\n yield\n $stdout = STDOUT\n end",
"def clear!\n @output = ''\n @verbose = false\n end",
"def stdouts; end",
"def echo_off\n system \"stty -echo\"\n end",
"def unsuppress_logger\n Log.silent(false)\n @logger_suppressed = nil\n end",
"def do_quietly?(&block)\n unless @verbose\n old_stdout = $stdout.clone\n $stdout.reopen(File.new(\"/dev/null\", \"w\"))\n begin\n block.call\n rescue Exception => e\n $stdout.reopen old_stdout\n raise e\n ensure\n $stdout = old_stdout\n end\n else\n block.call\n end\n end",
"def configure_output\n RSpec.configuration.output_stream = $stdout\n @formatter = RSpec.configuration.add_formatter(Inspec::Formatters::Base)\n RSpec.configuration.add_formatter(Inspec::Formatters::ShowProgress, $stderr) if @conf[:show_progress]\n set_optional_formatters\n RSpec.configuration.color = @conf[\"color\"]\n end",
"def raw_no_echo_mode\n end",
"def capture_stdout(&block)\n silence_stdout true, &block\n end",
"def setup()\n $stdout.sync\n end",
"def dev_null(&block)\n orig_stdout = $stdout.dup # does a dup2() internally\n $stdout.reopen('/dev/null', 'w')\n yield\nensure\n $stdout.reopen(orig_stdout)\nend",
"def silent(*what)\n return unless block_given?\n\n begin\n _stdout, $stdout = $stdout, StringIO.new if what.include?(:stdout)\n _stderr, $stderr = $stderr, StringIO.new if what.include?(:stderr)\n\n yield\n ensure\n $stdout = _stdout if what.include?(:stdout)\n $stderr = _stderr if what.include?(:stderr)\n end\nend",
"def discard\n FileUtils.rm options.output\n end",
"def discard\n FileUtils.rm options.output\n end",
"def raw_no_echo_mode; end",
"def raw_no_echo_mode; end",
"def set_default_outputs\n @output_options = OUTPUTS\n end",
"def stdout!(stdout)\n @stdout = stdout\n self\n end",
"def quiet(&block)\n with_verbose(false, &block)\n end",
"def quiet(&block)\n with_verbose(false, &block)\n end",
"def redirect_stdout\n if Capybara::Chromefoil.mri?\n yield\n else\n begin\n prev = STDOUT.dup\n $stdout = @write_io\n STDOUT.reopen(@write_io)\n yield\n ensure\n STDOUT.reopen(prev)\n $stdout = STDOUT\n prev.close\n end\n end\n end",
"def silence_stderr\n orig_stderr = $stderr.clone\n $stderr.reopen File.new('/dev/null', 'w')\n yield\n ensure\n $stderr.reopen orig_stderr\n end",
"def quiet; end",
"def reset_logging\n\t\tLoggability.formatter = nil\n\t\tLoggability.output_to( $stderr )\n\t\tLoggability.level = :fatal\n\tend",
"def disable_log_to_screen\n @log_to_screen = false\n end",
"def dev_null(&block)\n begin\n orig_stdout = $stdout.dup # does a dup2() internally\n $stdout.reopen('/dev/null', 'w')\n yield\n ensure\n $stdout.reopen(orig_stdout)\n end\nend",
"def clear_stderr\n $stderr.string = ''\n end",
"def redirect_io( simulate = false )\n begin\n STDIN.reopen '/dev/null'\n rescue ::Exception\n end\n\n unless simulate\n STDOUT.reopen '/dev/null', 'a'\n STDERR.reopen '/dev/null', 'a'\n end\n end",
"def onquiet\n end",
"def disable_logging\n @logger = nil\n end",
"def shutup\n if ARGV.verbose?\n yield\n else\n begin\n tmperr = $stderr.clone\n tmpout = $stdout.clone\n $stderr.reopen '/dev/null', 'w'\n $stdout.reopen '/dev/null', 'w'\n yield\n ensure\n $stderr.reopen tmperr\n $stdout.reopen tmpout\n end\n end\nend",
"def enable_stdout\n stdoutoutputter = Log4r::Outputter[\"#{@name.to_s}-stdout\"]\n stdoutoutputter.level = Log4r::ALL\n end",
"def show_summary!\n @runopts[:show_log] = false\n end",
"def all_stdout\n registered_commands.each(&:stop)\n\n registered_commands.each_with_object(\"\") { |e, a| a << e.stdout }\n end",
"def teardown\n\t\t$stderr = @original_stderr\n\t\t$stdout = @original_stdout\n\tend",
"def teardown\n\t\t$stderr = @original_stderr\n\t\t$stdout = @original_stdout\n\tend",
"def setup\n set_debug_level(0)\n end",
"def without_warnings\n old_verbose = $VERBOSE\n begin\n $VERBOSE = nil\n yield\n ensure\n $-v = old_verbose\n end\n end",
"def silence_generator\n logger_original = Rails::Generator::Base.logger\n myout = StringIO.new\n Rails::Generator::Base.logger = Rails::Generator::SimpleLogger.new(myout)\n yield if block_given?\n Rails::Generator::Base.logger = logger_original\n myout.string\n end",
"def silence_generator\n logger_original = Rails::Generator::Base.logger\n myout = StringIO.new\n Rails::Generator::Base.logger = Rails::Generator::SimpleLogger.new(myout)\n yield if block_given?\n Rails::Generator::Base.logger = logger_original\n myout.string\n end",
"def clear_output(wait=false)\n Display.clear_output(wait)\n end",
"def off\n %x{stty -raw} rescue nil\n end",
"def disable_logger_noise\n StraightServer::Config.logmaster = { 'log_level' => 'INFO', 'file' => 'straight.log' }\n @initializer.create_logger\n expect(StraightServer.logger).to receive(:info).and_return ''\n end",
"def disable_verbose_log()\n PureHailDB.ib_cfg_set(\"print_verbose_log\", :bool, false)\n end",
"def out_clean\n out = $stdout\n $stdout = @stdout\n out.string\n end",
"def quiet\n @commands_and_opts.push OPTIONAL_OPTS[:quiet]\n self\n end",
"def swallow_stdout\n s = StringIO.new\n oldstd = $stdout\n $stdout = s\n yield\n return s.string\n ensure\n $stdout = oldstd\n end"
] | [
"0.7479832",
"0.7455504",
"0.73046803",
"0.7264223",
"0.7196278",
"0.71467674",
"0.7102035",
"0.7097419",
"0.70925206",
"0.7090385",
"0.7014187",
"0.7011816",
"0.6969808",
"0.6958182",
"0.6949559",
"0.69119877",
"0.6897611",
"0.68912137",
"0.6880098",
"0.6784229",
"0.6730688",
"0.67288655",
"0.67288655",
"0.67267585",
"0.6726293",
"0.66915214",
"0.6663073",
"0.6648824",
"0.65667754",
"0.6494983",
"0.6466022",
"0.6462727",
"0.64072126",
"0.6391174",
"0.63625294",
"0.6307228",
"0.6299836",
"0.6274184",
"0.6274184",
"0.6274184",
"0.6266512",
"0.62406623",
"0.6228433",
"0.6210903",
"0.6187876",
"0.6138676",
"0.6130804",
"0.6121932",
"0.60927",
"0.60429615",
"0.60400385",
"0.6033849",
"0.59929144",
"0.59929144",
"0.59823203",
"0.5965029",
"0.59508723",
"0.59385645",
"0.59308976",
"0.59230864",
"0.5865519",
"0.5847646",
"0.58466643",
"0.5818235",
"0.5807024",
"0.58024555",
"0.58024555",
"0.57775545",
"0.57775545",
"0.57429177",
"0.5719534",
"0.57172966",
"0.57172966",
"0.57108474",
"0.57056767",
"0.57024086",
"0.5698739",
"0.56982565",
"0.5690261",
"0.5667647",
"0.5666756",
"0.5642288",
"0.56362486",
"0.56226957",
"0.56176686",
"0.5599635",
"0.5586545",
"0.558545",
"0.558545",
"0.55755925",
"0.5568706",
"0.55649406",
"0.55649406",
"0.55630696",
"0.5551881",
"0.55386627",
"0.55190617",
"0.5515844",
"0.55108",
"0.55007136"
] | 0.67396927 | 20 |
Clear the catalogue (= make it empty). | def zap_catalogue!()
catalogue.clear
save_catalogue
zap_rentals!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear() end",
"def clear() end",
"def clear; end",
"def clear; end",
"def clear; end",
"def clear; end",
"def clear; end",
"def clear; end",
"def clear; end",
"def clear\n end",
"def clear\n end",
"def clear\n end",
"def clear\n\t\tend",
"def clear\n end",
"def clear\n end",
"def clear\n end",
"def clear\n\n end",
"def clear!; end",
"def clear!; end",
"def clear!; end",
"def clear\n do_clear\n end",
"def clear\n initialize\n end",
"def clear\n initialize\n end",
"def clear!\n context_manager.clear!\n breadcrumbs.clear!\n end",
"def clear\n return\n end",
"def clear!\n @items.clear\n end",
"def clear\n @products.clear\n end",
"def clear\n initialize\n self\n end",
"def clear!\n end",
"def clear!\n registered_items.clear\n end",
"def clear!\n registered_items.clear\n end",
"def empty()\n hand = Clutch.new()\n # add all the items in the Bag to the new Clutch. also empties the bag\n hand.add(bag)\n hand\n end",
"def clear\n @components.clear\n end",
"def clear\n @items.clear\n end",
"def clear\n raise \"not implemented\"\n end",
"def clear!\n @items.clear\n end",
"def clear\n store.clear\n end",
"def clear\n @items = []\n end",
"def clear\n return unless @list\n @list.clear\n @native_text.clear if @native_text # check this line, should it be removed 2014-08-27 - 20:54\n fire_dimension_changed :clear\n init_vars\n end",
"def clear\n ingredients.clear\n Recipe.clear\n end",
"def clear\n @sections.clear\n end",
"def clear()\n merge(clear: 'true')\n end",
"def fill_catalogue()\n @@products.clear\n add_product(Fruit.new(\"Apples\", 10))\n add_product(Fruit.new(\"Oranges\", 5))\n add_product(Fruit.new(\"Banana\", 20))\n add_product(Fruit.new(\"Watermelon\", 1))\n add_product(Houseware.new(\"Vacuum cleaner\", 150))\n add_product(Product.new(\"Anchovies\",2))\n end",
"def clear()\n @library = []\n prompt\n end",
"def clear\n @mutex.synchronize do\n @tuples.clear\n @objects.clear\n @catdata.clear\n end\n self\n end",
"def clear\n EmptyList\n end",
"def clear\n hashed.clear\n list.clear\n end",
"def clear\n lib.tcidbvanish( @db )\n end",
"def clear\n\n self.list=([])\n end",
"def clear\n @display.clear\n end",
"def clear\n reset_defaults\n self\n end",
"def clear\r\n assert_exists\r\n assert_enabled\r\n #highlight(:set)\r\n set_clear_item(false)\r\n #highlight(:clear)\r\n end",
"def clear\n create_new_rep\n end",
"def clear\n system 'clear'\n \n end",
"def clear_inventory\n while @inventory.size.nonzero?\n @inventory.pop\n end\n end",
"def clear\r\n @resources.clear\r\n end",
"def clear!()\n @list = nil\n end",
"def clear\n writeln(\"clear\")\n end",
"def clear\n ''\n end",
"def clear\n self.configuration = {}\n end",
"def clear\n ve 'rm(list=ls())'\n end",
"def clear\n @a.clear\n end",
"def clear\n\n @consequences.clear\n @index = 0\n end",
"def clear\n @imgs.clear\n @tilesets.clear\n @sounds.clear\n @songs.clear\n @fonts.clear\n end",
"def clear\n raise NotImplementedError\n end",
"def clear\n raise NotImplementedError\n end",
"def clear\n @adapter.clear(collection)\n end",
"def clear!\n @all = Set.new\n end",
"def clear!\n contexts.clear\n end",
"def clear!\n contexts.clear\n end",
"def clear\n render({})\n end",
"def clear ; @data.clear ; end",
"def clear\n @list = []\n end",
"def clear() \n @obj.clear() \n end",
"def reset!\n @bundles.clear\n end",
"def clear!\n @active_subplot.clear!\n end",
"def clear\n super\n __wx_item_data.clear\n end",
"def clear\n namespace + '_clear'\n end",
"def reset!\n @products = []\n end",
"def reset!\n @products = []\n end",
"def clear_properties\n Config::Collection.clear\n end",
"def clear\n # self\n end",
"def clear\n self.class.empty\n end",
"def clear\n home\n self.track = []\n end",
"def clear\n\torder_meals(@main, @side, @extra)\nend",
"def clear\n @atlas.clear\n end",
"def clear\n @list = []\n end",
"def clear!\n @types.clear\n end",
"def clear\n @hash_tags.clear\n end",
"def clear\n with(keys: EMPTY_ARRAY)\n end",
"def clear\n systems.clear\n scenes.clear\n true\n end",
"def clear\n @dao.collection.remove\n end",
"def clear!\n items.clear\n save\n end",
"def clear!\n @adapters = []\n end",
"def clear\n messages.clear\n details.clear\n end",
"def clear\n @registry = {}\n end",
"def clear\n @registry.clear\n self\n end",
"def clear!\n @documents = {}\n @attributes = {}\n @lookup_map = nil\n @all_loaded = false\n @all = []\n end",
"def clear\n @storage.empty\n end",
"def clear!\n @paths = []\n end"
] | [
"0.7291971",
"0.7291971",
"0.7102319",
"0.7102319",
"0.7102319",
"0.7102319",
"0.7102319",
"0.7102319",
"0.7102319",
"0.70909053",
"0.70909053",
"0.707453",
"0.69890213",
"0.695495",
"0.695495",
"0.695495",
"0.69023705",
"0.68929696",
"0.68929696",
"0.68929696",
"0.68755454",
"0.68589246",
"0.68589246",
"0.685435",
"0.6771488",
"0.6753619",
"0.67440003",
"0.6674611",
"0.66442776",
"0.6643292",
"0.6643292",
"0.66367483",
"0.662967",
"0.662174",
"0.6600831",
"0.65941477",
"0.6591803",
"0.6569916",
"0.6559185",
"0.65478164",
"0.6528226",
"0.6522178",
"0.65086293",
"0.6499484",
"0.6464333",
"0.64297533",
"0.64285696",
"0.6418442",
"0.6414694",
"0.6413662",
"0.6409835",
"0.63952386",
"0.6379113",
"0.63715494",
"0.63685787",
"0.63570315",
"0.63501024",
"0.6341133",
"0.63279784",
"0.6326551",
"0.63137335",
"0.6307367",
"0.6302733",
"0.6293849",
"0.6290337",
"0.6290337",
"0.6282016",
"0.6278446",
"0.6274634",
"0.6274634",
"0.62605274",
"0.62574995",
"0.62412244",
"0.62255174",
"0.62133795",
"0.6211602",
"0.6210371",
"0.6196181",
"0.6195319",
"0.6195319",
"0.6194541",
"0.6191365",
"0.6190333",
"0.61879003",
"0.61840737",
"0.61702794",
"0.6166819",
"0.61657643",
"0.61437374",
"0.61389935",
"0.6135572",
"0.6129181",
"0.6125936",
"0.6122219",
"0.6116637",
"0.61158746",
"0.6115023",
"0.6105506",
"0.61007524",
"0.60922617"
] | 0.6632013 | 32 |
Search a Video object having the given title | def search_video(aTitle)
result = catalogue.find { |video| video.title.strip == aTitle.strip }
if result.nil?
msg = "Video with title '#{aTitle}' isn't in the catalogue."
$stderr.puts msg
end
return result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search\n\n title = params[:title]\n\n @videos = Video.where('title ILIKE ?', \"%#{title}%\")\n # sql query where string of title is found in the vid title\n \n if @videos.nil?\n render json: \"No results found\"\n else\n render \"api/videos/search\"\n end\n end",
"def search_movie(title)\n headers = {\n accept: 'application/json',\n api_key: ENV['TMDB_API_KEY'],\n content_type: 'json',\n query: title,\n }\n\n response = RestClient.get \"https://api.themoviedb.org/3/search/movie/\", { params: headers }\n json_response = JSON.parse(response)\n\n return json_response\n end",
"def find_movie_by_title(arg)\n query_response = RestClient.get(\"http://www.omdbapi.com/?t=#{arg}&apikey=a2d3299b\") #query the database\n parsed_response = JSON.parse(query_response) #parse the response into a useable hash\n movie_deets_hash = #extract relevant details from the hash\n {\"Title\" => parsed_response[\"Title\"],\n \"Released\" => parsed_response[\"Released\"].slice(-4..).to_i,\n \"Genre\" => parsed_response[\"Genre\"],\n \"Director\" => parsed_response[\"Director\"]}\n add_movie_to_database(movie_deets_hash) #create a movie_object for the selected movie, if it doesn't already exist\n end",
"def search_for_title(title)\n parameters = {\n 'folderId' => find_public_folder,\n 'q' => \"title = '#{title}'\", # full_title\n 'fields' => 'items/id'}\n client = google_api_client\n drive = client.discovered_api('drive', 'v2')\n result = client.execute(:api_method => drive.children.list,\n :parameters => parameters)\n if result.status == 200\n if result.data.items.length > 0\n result.data.items[0]['id']\n elsif result.data.items.length == 0\n nil\n else\n nil\n end\n end\n end",
"def find_song_by_title(songs, title)\n songs.find do |song|\n song[:title] == title\n end\n end",
"def search_videos(searchterm,params={})\n @opensearch.search_videos(searchterm,params) \n end",
"def index\n authorize! :read, @videos\n @videos = searchitems(params[:search],Video,'video_name')\n @video = @videos.first\n end",
"def search\n params = request.query_parameters\n @search_keyword = params[:search_keyword]\n @page = 1\n @page = params[:page] if params[:page]\n\n unless @search_keyword.blank?\n @results = Video.search @search_keyword, load: false, per_page: 12, page: @page, fields: [\"title^10\",\"transcript\"]\n end\n end",
"def video_search(keyword, search_mode='all', options={})\n resp_types, opts = merge_defaults(options, %w(main artists releases tracks categories))\n self.class.get(\"/video/v1/list/search/#{search_mode}/#{URI.escape(keyword)}?response=#{resp_types.join(',')}\", opts)\n end",
"def by_title(title)\n Pages::Finder.by_title(title)\n end",
"def by_title(title)\n validate_by_title_args(title)\n\n query = {q: title}\n @params.merge!(query)\n\n perform_request\n end",
"def video_details\n unless params[:vid_id].blank?\n puts params[:vid_id]\n @video = Video.find(params[:vid_id])\n query_params = request.query_parameters[\"q\"]\n unless query_params.nil?\n @search_keyword = query_params\n end\n\n end\n end",
"def search\n begin\n @active_page = \"videos\"\n @search_text = get_unescaped_search_text\n @search_result = Video.search ThinkingSphinx::Query.escape(\"*#{@search_text}*\")\n @success = true\n rescue Exception => e\n @success = false\n log_error(e, \"Error occured in search action of VideosController\")\n end\n end",
"def find_by_title(title, options = {})\n options = {\n limit: nil,\n types: %w(title_popular title_exact title_approx title_substring)\n }.merge!(options)\n\n result = self.class.get('http://www.imdb.com/xml/find', :query => {\n :q => title,\n :json => '1',\n :tt => 'on'\n }).parsed_response\n\n results = []\n\n options[:types].each do |key|\n if result[key]\n result[key].each do |row|\n break unless results.size < options[:limit] if options[:limit]\n next unless row['id'] && row['title'] && row['description']\n\n title = {\n type: key,\n imdb_id: row['id'],\n title: row['title'],\n release_year: row['description'].scan(/\\A\\d{4}/).first\n }\n\n results << title\n end\n end\n end\n\n results\n end",
"def search\n begin\n words= params[:search][:qw].strip\n @query_info=words\n\n # search in the descriptions\n @videos=VMetadata.search(words, :page => params[:page], :per_page => @@per_page,\n :match_mode => :any, :rank_mode => :proximity_bm25)\n\n respond_to do |format|\n format.html { render 'query/show' }\n end\n rescue ActiveRecord::RecordNotFound\n render(:file => \"#{Rails.root}/public/404.html\",\n :status => \"404 Not Found\")\n end\n end",
"def index\n @tvshows = Tvshow.all\n if params[:search].present?\n @tvshows = @tvshows.where(\"(lower(title) like ?)\",\"%#{params[:search].strip.downcase}%\")\n end\n end",
"def search(term=nil, options={})\n options.to_options!\n params = {}\n params[:'max-result'] = options[:max_result] || 1\n params[:'start-index'] = options[:start_index]\n term = options[:term] || term\n params.reject! { |k,v| !v }\n response = request \"video/search?#{term.to_query('term')}&#{params.to_param}\"\n parse_many response.read\n end",
"def find_by_title(title)\n url = SEARCH_URL+\"#{URI.escape(title)}&first=yes\"\n Kinopoisk.fetch(url, proxies: @proxies, debug: @debug).headers['Location'].to_s.match(/\\/(\\d*)\\/$/)[1]\n end",
"def searchtitle\n end",
"def query(keyword)\n return unless keyword\n\n where(\"title ILIKE '%?%'\", keyword)\n end",
"def video_title\n if video\n video.title\n end\n end",
"def get_by_title (page = 1)\n\t\taction = \"discover/movie\"\n\t\targument = \"&sort_by=original_title.asc\" + \"&page=\" + page.to_s\n\t\tresponse = call_api(action, argument)\n\t\tmovies = process_results(response[\"results\"])\n\tend",
"def search_videos(args = {})\n args = receive_should_validate? args\n\n get('redtube.Videos.searchVideos', args,\n [:category, :page, :search, :tags, :stars,\n :thumbsize, :ordering, :period], args[:should_validate])\n end",
"def movie\n #movie_name = 'Batman'\n # @movie_name = params[:movie_name] # in order to be available in the view\n movies = search_query([], %[\n FILTER regex(?title, '^.*#{query_param(true)}', 'i')\n ])\n @groups = {nil => movies} unless movies.empty?\n render 'results', locals: {title: \"Movies with title containing '#{query_param}'\"}\n end",
"def index\n @entities = Entity.any_of( { :title => /.*#{params[:search]}.*/i } )\n end",
"def find_book_by_title(title)\n for book in @books\n if book[:title] == title\n return book\n end\n end\n end",
"def get_video_title(youtube_url)\n doc = Hpricot(open(youtube_url))\n (doc/\"title\").each do |title|\n return $1 if title.inner_text =~ %r{YouTube - (.+)}\n end\nend",
"def by_title(title)\n Categories::Finder.by_title(title)\n end",
"def by_title(title)\n Products::Categories::Finder.by_title(title)\n end",
"def search_book(query)\n\n @book = Book.where(\"title like ?\" , query + '%')\n\n @book\n\n end",
"def search \n\n if params[:title].present?\n moviesFilter = @movies.where(\"title like ?\",\"%#{params[:title]}%\")\n @movies = moviesFilter\n end\n\n if params[:order].present?\n if params[:order] == \"ASC\" || \"DESC\"\n moviesFilter = @movies.order(\"date_created #{params[:order]}\")\n @movies = moviesFilter\n end\n end\n\n \n #if params[:idGenre].present?\n #@movieFilter = @movies.joins(\"INNER JOIN movie_genres ON movie_genres.movie_id = movies.id where movie_genres.genre_id = 1\")\n #@movies << @movieFilter\n #end\n\n if params[:idGenre].present?\n\n @movieFilter = []\n @movies.each do |mov|\n if mov.movie_genres.find_by(genre_id: params[:idGenre]) \n @movieFilter << mov\n end \n end\n @movies = @movieFilter\n end\n end",
"def find(data)\n @items.each do |item|\n return item if item.title == data\n end\n return nil\n end",
"def index\n @movies = if params[:title]\n Movie.where('title LIKE ?', \"%#{params[:title].downcase.titleize}%\").paginate(:page => params[:page], :per_page => 15)\n # elsif\n # flash[:notice] = 'No search results'\n else\n @movies = Movie.all.paginate(:page => params[:page], :per_page => 15)\n end\n end",
"def search\n http, request = frame_request @keyword\n\n # Getting response from YouTube\n response = http.request(request)\n\n # Parsing for serialization of the response\n json_response = JSON.parse(response.body)\n\n # Any mishaps inside the code-block will return an empty array.\n begin\n json_response['feed']['entry'].map{ |rsp| \n rsp['media$group']['media$content'].first.send(:[],'url')\n }\n rescue\n []\n end\n end",
"def search_lesson(like_search_string)\n Lesson.where(\"title LIKE ?\", like_search_string)\nend",
"def find_by_titles(*opts)\n titles, opts_qs = handle_options(opts)\n titles_qs = make_qs(\"titles\", titles)\n MediaWikiBase.new(make_url(opts_qs.push(titles_qs)))\n end",
"def on_the_big_screen\n Movie.all.select{ |movie| movie.title == self.title }\n end",
"def test_search_by_title\n assert_equal 1, Book.search_by_title(\"Life of bob\").size, \"1 Book listed with title Life of bob\"\n assert_equal 1, Book.search_by_title(\"LiFe oF bOB\").size, \"1 Book listed with title LiFe oF bOB - capitalisation does not matter\"\n assert_equal 2, Book.search_by_title(\"Test\").size, \"2 Books listed by with a test in the title\"\n assert_equal 3, Book.search_by_title(\"\").size, \"Blank returns all 3 books\"\n assert_equal 3, Book.search_by_title(nil).size, \"Blank returns all 3 books\"\n assert_equal 0, Book.search_by_title(\"The Hobbit\").size, \"No Tolkien books expected\"\n end",
"def find_by_id(id)\n videos.where(id: id).as(Video).one\n end",
"def find_by_id(imdb_id)\n result = self.class.get('/title/maindetails', :query => {\n :tconst => imdb_id, :locale => @locale\n }).parsed_response\n\n Title.new(result['data'])\n end",
"def search_by(aspect, name)\n self.all.select { |movie| movie.send(aspect).include?(name) }\n end",
"def search_videos(search_string)\n url = \"http://www.blip.tv/search/?search=#{search_string}&skin=json\"\n request = open(url,{\"UserAgent\" => \"Ruby-Wget\"}).read\n json = JSON.parse(request[16...-3])\n parse_json_videos_list(json)\n end",
"def matches_title?(q)\n search_regexp = /(\\b|[\\/\\._-])#{Regexp.escape(q)}/\n\n @result[:title].downcase =~ search_regexp ||\n # Break CamelCase words into their individual components and search\n @result[:title].gsub(/([a-z\\d])([A-Z])/,'\\1 \\2').downcase =~ search_regexp\n end",
"def search\n # query_param = params[:query].downcase\n # @found_articles = Article.all.where(\"lower(title) LIKE :query\", query: query_param)\n # render \"search\"\n end",
"def title\n if @title == nil\n \"Movie not found!\"\n else\n @title\n end\n end",
"def require_movie\n @movie = Movie.find_by title: params[:title]\n unless @movie\n render status: :not_found, json: { errors: { title: [\"No movie with title #{params[:title]}\"] } }\n end\n end",
"def find_by_title(string)\n @todos.each do |todo|\n return todo if (todo.title =~ /#{string}/)\n end\n nil\n end",
"def find_by_title(todo_title)\n select { |todo| todo.title == todo_title }.first\n end",
"def file_by_title(title)\n if title.is_a?(Array)\n return self.root_collection.file_by_title(title)\n else\n return files(\"q\" => [\"title = ?\", title], \"maxResults\" => 1)[0]\n end\n end",
"def get_movies_by_film(title)\n all_movies = RestClient.get('http://www.swapi.co/api/films/')\n movies_hash = JSON.parse(all_movies)\n\n results = movies_hash[\"results\"].select {|movie| movie[\"title\"].downcase == title}\n # results is an array containing a hash\n\n if results[0].length > 0\n puts \"Title: #{results[0][\"title\"]}\"\n puts \"Director: #{results[0][\"director\"]}\"\n puts \"Release Date: #{results[0][\"release_date\"]}\"\n else\n puts \"Movie not found\"\n end\nend",
"def video_by(video)\n vid = nil\n vid_regex = /(?:youtube.com|youtu.be).*(?:\\/|v=)([\\w-]+)/\n if video =~ vid_regex\n vid = $1\n else\n vid = video\n end\n video_id =\"http://gdata.youtube.com/feeds/api/videos/#{vid}?v=2#{@dev_key ? '&key='+@dev_key : ''}\"\n parser = YouTubeIt::Parser::VideoFeedParser.new(video_id)\n parser.parse\n end",
"def build_load_title_query(imdb_id)\n \"t=loadvideo&q=#{imdb_id}\"\n end",
"def find_by_title(*opts)\n find_by_titles(opts).pages.first\n end",
"def movie_title=(title)\n mt = Movie.arel_table\n m = Movie.where(mt[:name].matches(title)).first\n if movie = m\n self[:movie_id] = movie.id\n else \n m = Movie.create(name: title)\n self[:movie_id] = m.id\n end\n end",
"def find\n\t\trender json: Subject.where(\"name LIKE ?\",\"%#{params[:term].titlecase}%\")\n\tend",
"def index\n @q = Video.search(params[:q])\n @videos = @q.result(distinct: true).page(params[:page])\n end",
"def search_for_title(name)\n raise 'You are trying to search a file with NO name' if name.nil? || name.empty?\n client = google_api_client\n result = client.list_files(page_size: 1,\n q: \"name contains '#{ name }' and '#{ find_public_folder }' in parents\",\n fields: 'files(id, name)'\n )\n if result.files.length > 0\n result.files[0].id\n else\n nil\n end\n end",
"def find_book_by_title(book_title)\n books = @books\n for book in books\n if (book[:title] == book_title)\n return book\n end\n end\n return nil\n end",
"def has_movie(title)\n page.has_css?(@movie_list_css, text: title)\n end",
"def search\n if params[:search].present?\n @searching = Music.search{ fulltext \"#{params[:search]}\" }\n @musics = @searching.results\n p @musics\n else\n @musics = Music.all\n end\n end",
"def add_video(aTitle)\n # Simplification: no check for title collision\n catalogue << Video.new(aTitle, :available)\n save_catalogue\n end",
"def find_recipe_by_title\n # view_recipe(Recipe.find_by(title: ask('Which recipe would you like to look for? >:'))) # ask for recipe title, search for it and display\n list_recipes(Recipe.where(\"title LIKE ?\", \"%\"+ ask('Which recipe would you like to look for? >:') + \"%\").order(:title))\n\n end",
"def search(search_term)\n results = Content.where('status_id=2 and lower(sub_title) = lower(?)', search_term)\n to_ext_json(results)\n end",
"def find_by_title(str)\n self.each do |todo|\n return todo if todo.title == str\n end\n nil\n # select { |todo| todo.title == str }.first # alt from solution\n end",
"def list_books_w_matching_title(title)\n books = @mybooks.get_books_by_title(title)\n\tbooks.each {|book| puts \"#{book[:key]} | #{book[:author]}, #{book[:title]}\"}\nend",
"def search_text(query, text)\n text = pattern(text)\n query.where { title.ilike(text) | description.ilike(text) }\n end",
"def search_string\n [self.title].join(' ')\n end",
"def search\n\n \t@matches = []\n\n\t\tpattern = params[:search].downcase\n \tfind = Regexp.new(Regexp.quote(pattern))\n\t\t\n \tPlayer.all.each do |p|\t\t\t\n\t\t\tplayer_matches = false\n \tif p.name.downcase =~ find\n \t\tplayer_matches = true\n \t\t@matches << [p.name]\n \t\tbreak\n \tend\n end\n \n \trender :text => @matches.to_json()\n \tend",
"def title\n \tobject.movie_name\n end",
"def search(pattern)\n Vimpack::Commands::Search.run(self, pattern)\n end",
"def show\n @video = Video.find_by(slug: params[:id])\n end",
"def index\n @titles = Title.search(params[:search], params[:page])\n end",
"def search(q_text, q_offset, q_limit)\n # Request options preparation\n @options = { query: { q: q_text, offset: q_offset, limit: q_limit, api_key: @api_key } }\n # GET request to API and return response\n # HTTParty handles request errors and includes status into the response variable\n return self.class.get('/v1/videos/search', @options)\n end",
"def movie_info(movie_url)\n movie_hash = get_movies_from_api\n movie_hash[\"results\"].find do |movie_info|\n movie_info[\"url\"] == movie_url\n end\nend",
"def browse(params = {}, lang = @default_lang)\n handle_response(Movie, 'Movie.browse', lang, :query => {:order => \"asc\", :order_by => \"title\"}.merge(params))\n end",
"def search\n\t\t@articles = Article.where(\"text = ?\",params[:q])\n \n #Article.find_by_text(params[:q])\n \n #debug\n @articles.each do |article|\n puts article.title\n end\n \n \n\t\t#@articles = Article.where(:text => params[:q]) ' 1=1 -- '\n\n\t\t#@articles = Article.where(\"text = ?\", params[:q] )\n \n \n #TODO\n # add filter for other fields\n # Article.where(\"text = ? and title = ?\",params[:text],params[:title])\n \n # to add LIKE filter SQL : name like %aa%\n # \"name LIKE ? OR postal_code like ?\", \"%#{search}%\", \"%#{search}%\"\n \n end",
"def test_find_movie_title_already_exists\n movies = Movies.new(@movies)\n result = movies.find_movie('Titanic')\n assert_equal(true, result)\n end",
"def to_search_string\n\t\tself.title\n\tend",
"def videos_by(params, options={})\n if params.respond_to?(:to_hash) and not params[:user]\n request = YouTubeG::Request::VideoSearch.new(params)\n\n elsif (params.respond_to?(:to_hash) && params[:user]) || (params == :favorites)\n request = YouTubeG::Request::UserSearch.new(params, options)\n\n else\n request = YouTubeG::Request::StandardSearch.new(params, options)\n end\n \n logger.debug \"Submitting request [url=#{request.url}].\"\n parser = YouTubeG::Parser::VideosFeedParser.new(request.url)\n parser.parse\n end",
"def search_movies(name, page_limit, page)\n url = \"#{@@movies_query_url}&q=#{CGI::escape(name)}&page_limit=#{page_limit}&page=#{page}\"\n return get(url)\n end",
"def search_movies(name)\n # The TMDB api wrapper returns an instance of a 'results' object\n # This object (OpenStruct?) contains the meta data of the request made to the api\n # in a instance variable called table, which also contains a list of TMDB::Movie\n # Objects that represent the movies the api returned as results of the search\n\n # Store the raw results object from the api\n results_object = Tmdb::Search.movie(name)\n\n # Check if the part of the 'results' object that contains the actual list of movies\n # is empty and if it is return nil (Meaning movie was not found) and exit the function\n if results_object.instance_variable_get('@table')[:results][0] == nil\n return nil\n end\n\n # Strip the results object of the attributes and store them in the results hash\n results_hash = results_object.instance_variable_get('@table')\n # Get the list of movies and store them in an array\n movie_array = results_hash[:results]\n # map over the array to substitute a hash for each movie object containing only their\n # name and id (also stored under @table instance variable on the object)\n movie_array.map do |movie|\n {\n name: movie.instance_variable_get('@table')[:title],\n id: movie.instance_variable_get('@table')[:id]\n }\n end\n # returns the array\n end",
"def title_for_search\n (title || \"\").strip.sub(/\\Athe\\s+/i, \"\").sub(/\\Aan?\\s+/i, \"\")\n end",
"def index\n\n @articles = Article.order(\"title DESC\")\n\n @articles = Article.paginate(:page=>params[:page],per_page:6).order(\"created_at desc\") \n\n if params[:title].present?\n\n @articles = @articles.where(\"title ILIKE ?\", \"%#{params[:title]}%\")\n\n\n\n elsif params[:title] == params[:title].nil?\n\n flash[:alert] = \"No hay coincidencias\"\n\n end\n\n end",
"def show\n @college_video = CollegeVideo.all.find_by slug: (params[:id])\n end",
"def searchPost(keyword)\n posts = Post.where(deleted_user_id: nil).where(\"title like ? or description like ?\", \"%\" + keyword + \"%\", \"%\" + keyword + \"%\")\n end",
"def find_media(term)\n results = {}\n results[:books] = Book.search(term)\n results[:movies] = Movie.search(term)\n results[:tv_series] = Tv.search(term)\n results\n end",
"def verify_if_keyword_present_inresultPage(keyword)\n\n puts \"Verifying if title contains \"+keyword\n @@search_result_information.each do |hash|\n if hash['title'].include? keyword\n puts hash['name']+\"'s title contains searched keyword \"+keyword\n else\n puts hash['name']+\"'s title' doesn't contain searched keyword \"+keyword\n end\n end\n end",
"def video_list\n self.video_list = videos.map { |video| video[\"title\"] }\n end",
"def find_article(title)\n path_to_article \"/wiki/Special:Search?search=#{title}\"\n end",
"def show\n @user = User.find(params[:id])\n if params[:search]\n search = params[:search]\n @heading = \"Search results\"\n @movies = Movie.where('title LIKE :search OR genre LIKE :search or actors Like :search', search: \"%#{search}%\")\n else\n whichone()\n end\n @likes = Movie.where(id: @user.likes)\n end",
"def index\n movie = params[:movie]\n if movie.blank?\n @movies = Movie.all.reverse\n else\n @movies = Movie.all\n @movies = Movie.where(\"lower(title) LIKE ?\", \"%#{movie.downcase}%\")\n end\n @queries = Query.all\n end",
"def select_video(title)\n first(:link, title).click\n expect(page).to have_text 'Add to'\n # plz_be_quiet\nend",
"def video_by(vid)\n video_id = vid =~ /^http/ ? vid : \"http://gdata.youtube.com/feeds/api/videos/#{vid}\"\n parser = YouTubeG::Parser::VideoFeedParser.new(video_id)\n parser.parse \n end",
"def show\n @videos = Video.find_by(id: params[:id])\n end",
"def search_result\n @search = params[:search]\n query = params[:search] #Query variable is the string a user enters in the search bar.\n url = Addressable::URI.parse('https://api.themoviedb.org/3/search/tv?api_key=fb6a1d3f38c3d97f67df6d141f936f29&language=en-US')\n url.query_values = url.query_values.merge(query: query)\n response = HTTParty.get(url)\n @results = JSON.parse(response.body, symbolize_names: true) \n end",
"def index\n if params[:search].present?\n @search = params[:search]\n @movies = Movie.where('lower(actor) LIKE (?)', \"%#{@search.downcase}%\").all\n else\n @movies = Movie.all\n end\n end",
"def eql?(other)\n title == other.title\n end",
"def test_find_by_title\n assert_equal(@todo1, @list.find_by_title(\"Buy milk\"))\n end",
"def movie_search\n\n puts \"Please enter the name of the movie you would like to search\"\n input = gets.chomp\n system \"clear\"\n query_response = RestClient.get(\"http://www.omdbapi.com/?s=#{input}&apikey=a2d3299b\") #send query to database to search for movies containing the the user's input in the title\n\n parsed_response = JSON.parse(query_response) #parse the response into a hash\n\n movie_results = parsed_response[\"Search\"].map do |movie| #iterate through the hash and extract the movie titles into an array\n movie[\"Title\"] \n end\n puts \"Your search returned the following results:\"\n\n #todo !iterate through the hash again (movie_reslts) to get the release year of each movie\n movie_years = parsed_response[\"Search\"].map do |movie| #iterate through the hash and extract the movie year into an array\n movie[\"Year\"]\n end\n\n\n movie_results.each.with_index(1).map do |movie, index| #iterate through the array of movie titles and print them to the screen, along with their index # + 1\n puts \"#{index}. #{movie}\"\n end\n find_movie_from_list(movie_results) #allow the user to select a movie from their movie list\n end",
"def video_by(params)\n params = {:video_id => params} if !params.is_a?(Hash)\n url = \"http://gdata.youtube.com/feeds/api/\"\n video_id = params[:video_id].split(\"/\").last\n if params[:user]\n url << \"users/#{params[:user]}/uploads/#{video_id}\"\n else\n url << \"videos/#{video_id}\"\n end\n parser = YouTubeG::Parser::VideoFeedParser.new(url, request_headers, request_options)\n parser.parse\n end"
] | [
"0.8041182",
"0.6938407",
"0.688318",
"0.68469834",
"0.67216545",
"0.66604215",
"0.6647731",
"0.6602205",
"0.65458626",
"0.6432728",
"0.63991",
"0.63984686",
"0.63691866",
"0.6345562",
"0.6301288",
"0.62897646",
"0.6278824",
"0.62653005",
"0.62631667",
"0.6205694",
"0.6204542",
"0.6199068",
"0.60911405",
"0.60569924",
"0.6032157",
"0.60143864",
"0.5983933",
"0.59760517",
"0.5939745",
"0.59392923",
"0.5861368",
"0.58562005",
"0.5840907",
"0.5827652",
"0.57894164",
"0.5789146",
"0.5786157",
"0.57849526",
"0.57763773",
"0.57717466",
"0.5768232",
"0.57619447",
"0.57400024",
"0.57369834",
"0.57071406",
"0.5684737",
"0.56817824",
"0.5674364",
"0.5673924",
"0.5664566",
"0.56582",
"0.5654375",
"0.56508815",
"0.5650534",
"0.5648658",
"0.5638576",
"0.5638156",
"0.5633698",
"0.56286955",
"0.5618939",
"0.56178623",
"0.5585431",
"0.5577539",
"0.5574136",
"0.5570973",
"0.5570171",
"0.5561978",
"0.5559339",
"0.5543254",
"0.55328363",
"0.5503207",
"0.5498841",
"0.5497822",
"0.5493488",
"0.54923356",
"0.54795074",
"0.54792064",
"0.5477194",
"0.5475968",
"0.5464769",
"0.54645866",
"0.54553705",
"0.54434514",
"0.54431385",
"0.5441566",
"0.54381907",
"0.5433748",
"0.5432917",
"0.54255223",
"0.5425142",
"0.5410624",
"0.54040515",
"0.5403834",
"0.54003507",
"0.54002273",
"0.53957933",
"0.53919685",
"0.53917474",
"0.5390243",
"0.53886104"
] | 0.7790585 | 1 |
Add a new video to the catalogue | def add_video(aTitle)
# Simplification: no check for title collision
catalogue << Video.new(aTitle, :available)
save_catalogue
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_video(video)\n @videos << video\n return true\n end",
"def add_video(tag)\n\n @driver.find_element(:link, 'Add Video').click\n\n wait = Selenium::WebDriver::Wait.new(:timeout => 30) # seconds\n wait.until { @driver.find_element(:link_text, \"Save Video\") }\n\n # Type in URL of video into\n @driver.find_element(:id, 'videoUrlField').send_keys(tag)\n @driver.find_element(:link_text, \"Save Video\").click\n\n # Wait while video is processed\n wait = Selenium::WebDriver::Wait.new(:timeout => 30) # seconds\n wait.until { @driver.find_element(:link_text, \"Edit Video\") }\n end",
"def create\n @video = Video.new(video_params)\n puts @video\n puts \"**********************************\"\n if @video.save\n flash[:success] = 'Video added!'\n redirect_to '/videos'\n else\n render :new\n end\n end",
"def call\n video = search_youtube\n if video.present?\n context.playlist.add_video!(\n title: video.title,\n url: \"https://www.youtube.com/watch?v=#{video.id}\",\n user: context.user\n )\n context.dj.new_video_added!\n context.message = \"Success! #{video.title} was added to the playlist.\"\n else\n context.errors = \"Sorry but couldn't find any vides for #{query}.\"\n context.fail!\n end\n end",
"def create_videos\n end",
"def create\n @video = Video.new(video_params)\n\n if @video.save\n flash[:notice] = \"Successfully added new video!\"\n redirect_to videos_path\n else\n flash[:alert] = \"Error adding new video!\"\n render :new\n end\n end",
"def add_video_to_album album_id, video_id\n put(\"/albums/#{album_id}/videos/#{video_id}\", code: 204)\n end",
"def create_video\n Yt::Video.new(id:(@video_id))\n end",
"def create\n # @video = Video.new(params[:video])\n \n # @video = current_user.videos.new(params[:video])\n \n @video = Video.new\n @video.user_id = current_user.id\n @video.archive_id = params[:video][:archive_id]\n @video.question_id = params[:video][:question_id]\n \n current_user.videos << @video\n\n respond_to do |format|\n if @video.save\n # format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n # format.html 3{ render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put_video(*video_args, &block)\n args = parse_media_args(video_args, \"videos\")\n args.last[:video] = true\n put_connections(*args, &block)\n end",
"def add_video\n\n @video_playlist = VideoPlaylist.find(params[:id])\n @video_playlist_item_position = VideoPlaylistItem.where(\"video_playlist_id=?\", params[:id])\n .order(\"position ASC\")\n .find(:last)\n @video_playlist_item_position = @video_playlist_item_position.nil? ? 1 : @video_playlist_item_position.position + 1\n @video_playlist_item = VideoPlaylistItem.new(video_playlist_id: params[:id],\n video_id: params[:video_id],\n position: @video_playlist_item_position)\n\n @notice=\"\"\n\n @video_to_add = Video.find(params[:video_id])\n\n if @video_playlist_item.save\n flash[:notice] = 'Video was successfully added.'\n session[:videos_search] = collection_to_id_array(@video_playlist.videos)\n end\n end",
"def add_videos(gallery_name, video_url_list = [\"http://www.youtube.com/watch?v=Jr-ubPWN7n4\", \"http://www.youtube.com/watch?v=K-KkSiIjlm0\"], _browser = @browser)\n Log.logger.info(\"Adding New Videos into the Gallery.\")\n add_media_action(gallery_name, video_url_list, _browser)\n end",
"def create\n vid = Video.create(video_params)\n redirect_to \"/videos/#{vid.id}\"\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to video_show_path(@video.category, @video), notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: video_show_path(@video.category, @video) }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_video_to_folder folder_id, video_id\n put(\"/projects/#{folder_id}/videos/#{video_id}\", code: 204)\n end",
"def create\n @video = Video.new(params[:video])\n @licenses = License.all\n @galleries = Gallery.all\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_video\n @new_video = Video.new(params[:video])\n @new_video.save\n @video = Video.find_all_by_appliance_id_and_brand_id_and_appliance_problem_id(params[:video][:appliance_id], params[:video][:brand_id], params[:video][:appliance_problem_id])\n render(:partial => 'video', :collection => @video)\n end",
"def call\n if url.valid? and video.present?\n context.playlist.add_video!(\n title: video.title,\n url: url.to_s,\n user: context.user\n )\n context.dj.new_video_added!\n context.message = \"Success! Your video was added to the playlist.\"\n else\n context.fail!\n context.errors = \"That doesn't look like a valid youtube url. \"\n end\n end",
"def create\n @video = @room.videos.new(video_params)\n respond_to do |format|\n if @video.save\n format.html { redirect_to upload_video_path(@video), notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n if @video.save\n redirect_to @video, notice: \"Video was successfully created.\"\n else\n render :new\n end\n end",
"def create\n @album = Album.find(params[:album_id])\n @video = @album.videos.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @album, notice: 'Video creado satisfactoriamente.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @video = @videoable.textbook_videos.new\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to home_admin_path, notice: '视频创建成功!' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n @video.relateds.build\n @video.resources.build\n # obtain video metadata using the Wistia API\n Rails.logger.info(\"obtaining metadata from Wistia API for #{@video.wistia}\")\n media = Wistia::Media.find(@video.wistia)\n @video.title = media.name\n @video.description = ActionController::Base.helpers.strip_tags(media.description)\n @video.duration = (media.duration.to_i / 60) % 60\n @video.thumbnail_url = media.thumbnail.url\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to videos_path, notice: 'Created video listing.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @c_video = CVideo.new(params[:c_video])\n\n respond_to do |format|\n if @c_video.save\n format.html { redirect_to @c_video, notice: 'A new video was successfully created.' }\n format.json { render json: @c_video, status: :created, location: @c_video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @c_video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(params[:video])\n @asset = Asset.new(params[:asset])\n @video.asset = @asset\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to(@video, :notice => 'Video was successfully created.') }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @video = Video.new\n end",
"def new\n @video = Video.new\n end",
"def new\n @video = Video.new\n end",
"def new\n @video = Video.new\n end",
"def new\n @video = @project.videos.build\n \n respond_to do |format|\n if @user.can_add_videos?\n format.html # new.html.erb\n format.xml { render :xml => @video }\n else\n flash[:warning] = \"You cannot add any more videos, upgrade plan or remove old videos.\"\n format.html { redirect_to(project_url(@project, :subdomain => @user.subdomain)) }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(link: video_params[:link], user: current_user)\n\n if @video.save\n redirect_to athlete_path(current_user)\n else\n render 'new'\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to root_url, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(params[:video])\n @video.published = true\n @video.hits = 0\n @video.current_review = 1\n @video.attach_covers\n respond_to do |format|\n if @video.save\n format.html { redirect_to videos_path, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(nicovideo_id: params[:nicovideo_id])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { redirect_to videos_path , alert: 'Video was not successfully created.' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sales_video = Sales::Video.new(sales_video_params)\n\n respond_to do |format|\n if @sales_video.save\n format.html { redirect_to sales_seller_course_video_path(@seller, @course, @sales_video), notice: \"Video foi criado com sucesso.\" }\n format.json { render :show, status: :created, location: @sales_video }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @sales_video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params.merge({ project_id: @project.id }))\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to action: 'show', controller: 'videos', project_id: @project.id, id: @video.id, notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render action: 'show', status: :created, location: @video }\n else\n format.html { render action: 'new' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_video_to_my_queues(video)\n visit home_path\n #find(\"a[href='/videos/#{video.to_param}']\").click\n find(\"a[href='/videos/#{video.token}']\").click\n click_link \"+ My Queue\"\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n flash[:notice] = 'Video was successfully created.'\n format.html { redirect_to(@video) }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @video = current_user.videos.new(video_params)\n respond_to do |format|\n if @video.save\n format.html { redirect_to videos_path(), notice: 'Video criado com sucesso.' }\n format.json { render :index, status: :created, location: @video }\n else\n format.html { redirect_to new_video_path(), notice: 'Video não salvo.' }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to(@video, :notice => 'Video was successfully created.') }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(params[:video])\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to(@video, :notice => 'Video was successfully created.') }\n format.xml { render :xml => @video, :status => :created, :location => @video }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @video.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Vídeo criado com sucesso' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @file = vid_params['file'].tempfile\n type = vid_params['file'].content_type\n client = YouTubeIt::Client.new(:username => ENV['GMAIL'], :password => ENV['GMAIL_PASSWORD'], :dev_key => ENV[\"YOUTUBE_API_KEY\"])\n res = client.video_upload(@file, title: vid_params['title'], description: vid_params['description'], category: 'People', :keywords => ['darity', 'dare', 'charity'])\n @video = Video.new(url: res.player_url, uid: res.player_url.gsub(/&.*/, \"\").gsub(/.*=/, \"\"), description: vid_params[\"description\"], title: vid_params['title'], dare_id: params[:dare_id])\n if @video.save\n redirect_to current_user\n else\n render html: \"Error\"\n end\n end",
"def create\n\tif user_type != 'guest' and user_type != 'bunned' and user_type != 'new_user'\n\t\tparams[:video][:user_id] = current_user.id\n\t\t@video = Video.new(params[:video])\n\t\trespond_to do |format|\n\t\t if @video.save\n\t\t\tformat.html { redirect_to @video, :notice => 'Видео успешно добавлено' }\n\t\t\tformat.json { render :json => @video, :status => :created, :location => @video }\n\t\t else\n\t\t\tformat.html { render :action => \"new\" }\n\t\t\tformat.json { render :json => @video.errors, :status => :unprocessable_entity }\n\t\t end\n\t\tend\n\telse\n\t\tredirect_to '/404'\n\tend\n end",
"def video(filename, opts = {})\n n = input(filename, opts)\n @videos << n\n n\n end",
"def new\n begin\n @active_page = \"videos\"\n @video = Video.new\n respond_with(@video)\n rescue Exception => e\n log_error(e, \"Error occured in New action of VideosController\")\n flash_error(t('videos.new_page_load_error'))\n end\n end",
"def new_video_added!\n start! if waiting?\n end",
"def new\n \n @video = Video.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video }\n end\n end",
"def create \n @video = Video.new(params[:video])\n \n if signed_in?\n @video.user_id = current_user.id\n end\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n existing = Video.with_url(params[:video][:url])\n if existing.nil?\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n else\n format.html { redirect_to existing, notice: 'Video has already been submitted.' }\n format.json { render json: existing, location: @video }\n end\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n @video.board_id = @board.id\n\n urlVideo = VideoInfo.new(@video.source)\n\n\n @video.iFrame_Source = urlVideo.embed_code\n @video.title = urlVideo.title\n @video.date = urlVideo.date\n @video.provider = urlVideo.provider\n @video.description = urlVideo.description\n @video.smaller_thumbnail = urlVideo.thumbnail_small\n @video.larger_thumbnail = urlVideo.thumbnail_large\n\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to board_video_path(@board, @video), notice: 'Video was successfully created.' }\n format.json { render :show, status: :created, location: @video }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # This comment part specifies how to perform server side uploading\n # http://cloudinary.com/documentation/rails_video_upload#rails_video_upload_examples\n # http://cloudinary.com/documentation/upload_videos\n # http://cloudinary.com/documentation/video_management\n # http://cloudinary.com/documentation/rails_video_manipulation\n \n # video_public_id = \"video_#{SecureRandom.urlsafe_base64}\"\n # response = Cloudinary::Uploader.upload(params[:video][:target_file], :resource_type => :video, :public_id => video_public_id)\n # Cloudinary::Uploader.upload_large(params[:video][:target_file], :resource_type => :video, :public_id => \"my_folder/my_sub_folder/myvideo1\", :eager => [{:width => 300, :height => 300, :crop => :pad}], :eager_async => true, :eager_notification_url => \"http://c45a1454.ngrok.io/videos/transform_notification\")\n begin\n @active_page = \"videos\"\n if params[:id].blank?\n @video = Video.new(video_params)\n else\n @video = Video.find(params[:id])\n @video.update_attributes(video_params)\n end\n @video.save\n rescue Exception => e\n log_error(e, \"Error occured in Create action of VideosController\")\n flash_error(t('videos.create_page_error'))\n ensure\n redirect_to \"/videos\"\n end\n end",
"def create\n @congratulations_video = CongratulationsVideo.new(congratulations_video_params)\n @congratulations_video.name = @congratulations_video.name.downcase\n @congratulations_video.slug = Digest::MD5.hexdigest @congratulations_video.name\n respond_to do |format|\n if @congratulations_video.save\n format.html { redirect_to @congratulations_video, notice: 'Congratulations video was successfully created.' }\n format.json { render :show, status: :created, location: @congratulations_video }\n else\n format.html { render :new }\n format.json { render json: @congratulations_video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params.merge(:owner => current_user))\n @original = nil\n if (@video.errors[:video_exists])\n @original = Video.where(:external_id => @video.external_id, :type => @video.type).first\n end\n if @video.save\n render :json => @video, :include => ALL_INCLUDES\n else\n render :json => @video.errors, status: :unprocessable_entity\n end\n end",
"def create\n @video = Video.new(video_params)\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video.as_json }\n else\n format.html { render :new }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @video = Video.new(video_params)\n @video.added_by=current_user.id\n respond_to do |format|\n if @video.save\n @video.add_labels(params[:Label])\n format.html { redirect_to media_videos_path}\n format.json { render :show, status: :created, location: [:media, @video] }\n format.js {}\n else\n format.html { render :new }\n format.json { render json: [:media, @video.errors], status: :unprocessable_entity }\n end\n end\n end",
"def new\n authorize! :create, @videos\n @videos = Video.new\n end",
"def create\n token = token_from_link params[:video][:token]\n\n gdata = Youtube.new token\n\n @video = Video.new(params[:video]) do |v|\n v.user = current_user\n v.token = token\n v.name = gdata.title if v.name.blank?\n\n v.yt_title = gdata.title\n v.yt_thumb = gdata.thumb\n v.yt_rating = gdata.rating_100\n v.yt_view_count = gdata.view_count\n v.yt_favorite_count = gdata.favorite_count\n v.yt_published = gdata.published\n end\n\n respond_to do |format|\n if @video.save\n format.html { redirect_to @video, notice: 'Video was successfully created.' }\n format.json { render json: @video, status: :created, location: @video }\n else\n format.html { render action: \"new\" }\n format.json { render json: @video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end",
"def set_video\n @video = Video.find(params[:id])\n end"
] | [
"0.72062457",
"0.700506",
"0.6960435",
"0.692486",
"0.6888988",
"0.6880837",
"0.6855038",
"0.6742286",
"0.672718",
"0.6692539",
"0.6686246",
"0.66738904",
"0.66335833",
"0.662919",
"0.6610617",
"0.6593061",
"0.656236",
"0.65562165",
"0.65392566",
"0.65276724",
"0.652362",
"0.6486342",
"0.64735854",
"0.64546174",
"0.645072",
"0.64332783",
"0.64332783",
"0.64332783",
"0.64332783",
"0.64070356",
"0.6403376",
"0.6403376",
"0.6403376",
"0.6403376",
"0.6403376",
"0.63999707",
"0.63999707",
"0.63999707",
"0.63999707",
"0.6399567",
"0.63900906",
"0.638605",
"0.6377688",
"0.63674355",
"0.63667464",
"0.636215",
"0.63554746",
"0.63554746",
"0.6353736",
"0.63391703",
"0.6326516",
"0.6324175",
"0.6324175",
"0.631101",
"0.6296176",
"0.6282656",
"0.6279177",
"0.62786955",
"0.62751436",
"0.62605417",
"0.6259596",
"0.6250303",
"0.62417185",
"0.6229079",
"0.6228574",
"0.6228277",
"0.6225047",
"0.62236065",
"0.62141603",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213",
"0.6212213"
] | 0.81517845 | 0 |
nuevo archivo agregamos decimales, para leer y hacer espacio | def proyections(ventas_base, augment, start_array, end_array)
a = ventas_base.map.with_index do |sales, index|
if index >= start_array && index <= end_array
(sales*augment)
else
sales
end
end
return a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fichier_de_donnees_pour(nb_items)\n \"../testdata/stock_options_#{nb_items/1024}K.txt\"\nend",
"def trailer_arquivo_posicao_394_a_400(sequencial)\n\t\t\t\t\t\t\"#{sequencial}\".adjust_size_to(6, '0', :right)\n\t\t\t\t\tend",
"def monta_header_arquivo\n header_arquivo = '' # Descrição Posição Tamanho\n header_arquivo << cod_banco # CÓDIGO DO BANCO [1......3] 03(9) 341\n header_arquivo << '0000' # CÓDIGO DO LOTE [4......7] 04(9) 0000\n header_arquivo << '0' # TIPO DE REGISTRO [8......8] 01(9) 0\n header_arquivo << ''.rjust(6, ' ') # BRANCOS [9.....14] 06(X)\n header_arquivo << versao_layout_arquivo # LAYOUT DE ARQUIVO [15....17] 03(9) 081\n header_arquivo << Util::Empresa.new(documento_debitado, false).tipo # TIPO DE INSCRIÇÃO DA EMPRESA DEBITADA [18....18] 01(9) 1 = CPF 2 = CNPJ\n header_arquivo << documento_debitado.to_s.rjust(14, '0') # CNPJ da EMPRESA DEBITADA [19....32] 14(9)\n header_arquivo << ''.rjust(20, ' ') # BRANCOS [33....52] 20(X)\n header_arquivo << agencia.rjust(5, '0') # NÚMERO AGÊNCIA DEBITADA [53....57] 05(9)\n header_arquivo << ''.rjust(1, ' ') # BRANCOS [58....58] 01(X)\n header_arquivo << conta_corrente.rjust(12, '0') # CONTA NÚMERO DEBITADA [59....70] 12(9)\n header_arquivo << ''.rjust(1, ' ') # BRANCOS [71....71] 01(X)\n header_arquivo << digito_conta # DAC DA AGÊNCIA/CONTA DEBITADA [72....72] 01(9)\n header_arquivo << empresa_mae.format_size(30) # NOME DA EMPRESA [73...102] 30(X)\n header_arquivo << nome_banco.format_size(30) # NOME DO BANCO [103..132] 30(X)\n header_arquivo << ''.rjust(10, ' ') # BRANCOS [133..142] 10(X)\n header_arquivo << '1' # CÓDIGO REMESSA/RETORNO [143..143] 01(9) 1=REMESSA\n header_arquivo << data_geracao # DATA DE GERAÇÃO DO ARQUIVO [144..151] 08(9) DDMMAAAA\n header_arquivo << hora_geracao # HORA DE GERAÇÃO DO ARQUIVO [152..157] 06(9) HHMMSS\n header_arquivo << ''.rjust(9, '0') # ZEROS [158..166] 09(9)\n header_arquivo << densidade_gravacao.rjust(5, '0') # DENSIDADE DE GRAVAÇÃO DO ARQUIVO [167..171] 05(9) 0 Padrao | 1600 BPI | # 6250 BPI\n header_arquivo << ''.rjust(69, ' ') # BRANCOS [172..240] 69(X)\n header_arquivo\n end",
"def inizializza_file_path\n lista_file\n check_file\n end",
"def leer_archivo(nombre=\"#{@ruta_archivo}\")\n puts \"Leyendo archivo...\"\n valido = verificador_ruta\n if valido\n puts \"La ruta es valida\"\n File.open(nombre, 'r') do |archivo|\n while linea = archivo.gets\n @contenido.concat(linea)\n end\n end\n end\n end",
"def max_files; end",
"def read_tiempos (fh)\n @tiempo1 = fh.readline.to_f\n @tiempo2 = fh.readline.to_f\n @tiempo3 = fh.readline.to_f\n @tiempo4 = fh.readline.to_f\n @tiempo5 = fh.readline.to_f\n @tiempo6 = fh.readline.to_f\n @tiempo7 = fh.readline.to_f\n @tiempo8 = fh.readline.to_f\n #ESCRIBO variable del registro\n @partida.tiempo_1 = @tiempo1\n @partida.tiempo_2 = @tiempo2\n @partida.tiempo_3 = @tiempo3\n @partida.tiempo_4 = @tiempo4\n @partida.tiempo_5 = @tiempo5\n @partida.tiempo_6 = @tiempo6\n @partida.tiempo_7 = @tiempo7\n @partida.tiempo_8 = @tiempo8\n #LEO Y ESCRIBO PUESTOS\n @partida.puesto_nadador_1 = fh.readline.to_i \n @partida.puesto_nadador_2 = fh.readline.to_i \n @partida.puesto_nadador_3 = fh.readline.to_i \n @partida.puesto_nadador_4 = fh.readline.to_i \n @partida.puesto_nadador_5 = fh.readline.to_i \n @partida.puesto_nadador_6 = fh.readline.to_i \n @partida.puesto_nadador_7 = fh.readline.to_i \n @partida.puesto_nadador_8 = fh.readline.to_i \n \n end",
"def imprime_ficha\n \n prawnto :prawn => {\n :left_margin => 20,\n :right_margin => 20,\n :top_margin => 400,\n :bottom_margin => 20 }\n \n @paciente = Paciente.find(params[:id]) \n @razon = \"\"\n @razon = @paciente.razon unless @paciente.razon.nil?\n @rfc = \"\"\n @rfc = @paciente.rfc unless @paciente.rfc.nil?\n @consulta = Consulta.find(params[:consulta_id])\n \n if [email protected]?\n @ref_estudio = @consulta.cita.operation.ref_estudio unless @consulta.cita.operation.ref_estudio.nil?\n @fecha_hora = @consulta.cita.fecha_hora unless @consulta.cita.fecha_hora.nil?\n else\n @ref_estudio = \"\"\n @fecha_hora = \"\"\n end\n \n \n \n respond_to do |format|\n #format.html # show.html.erb\n #format.xml { render :xml => @pago }\n format.pdf {render :layout => false }\n end\n end",
"def guardar_archivo(nombre_archivo, in_file=\"#{@contenido}\")\n puts \"Guardando...\"\n nombre = nombre_archivo + \".txt\"\n File.open(nombre,'w') do |archivo|\n archivo.puts in_file\n end\n puts \"Guarde el archivo en: \" + nombre\n end",
"def gera_arquivo\n raise Brcobranca::RemessaInvalida, self if invalid?\n\n arquivo = [monta_header_arquivo]\n\n # contador de do lotes\n contador = 1\n arquivo.push monta_lote(contador)\n\n arquivo << monta_trailer_arquivo(contador, ((pagamentos.size * 2) + (contador * 2) + 2))\n\n remittance = arquivo.join(\"\\n\").to_ascii.upcase\n remittance << \"\\n\"\n remittance.encode(remittance.encoding, universal_newline: true).encode(remittance.encoding, crlf_newline: true)\n end",
"def entrar_arquivo\n end",
"def gera_arquivo\n raise Brcobranca::RemessaInvalida, self if invalid?\n\n arquivo = [monta_header_arquivo]\n\n # contador de do lotes\n contador = 1\n arquivo.push monta_lote(contador)\n\n arquivo << monta_trailer_arquivo(contador, ((pagamentos.size) + (contador * 2) + 2))\n\n remittance = arquivo.join(\"\\r\\n\").to_ascii.upcase\n remittance << \"\\r\\n\"\n\n remittance.encode(remittance.encoding, universal_newline: true).encode(remittance.encoding, crlf_newline: true)\n end",
"def gera_relatorio(partial, arquivo)\n linhas = 0\n tmp = render_to_string :template => false, \n :partial => partial\n f = File.new(arquivo, \"w\")\n f.write(tmp)\n f.close\n wc = %x[wc #{arquivo}] #word count!\n linhas = wc.split[0]\n return linhas\n end",
"def file_size\n 1000 # temporarily disable file size calculation\n # TODO: fix this in production env (perhaps zencoder is not replacing target file?)\n # self.file.size\n end",
"def file_name\n file_name = \"h\"\n write_zeros.times { file_name += \"0\" }\n file_name += @@count.to_s + \".txt\"\n end",
"def recuperar_dados(arquivo)\n @tools.leitura arquivo\n end",
"def monta_trailer_arquivo(nro_lotes, sequencial)\n trailer_arquivo = '' # Descrição Posição Tamanho\n trailer_arquivo << cod_banco # CÓDIGO DO BANCO [1.....3] 03(9) 341\n trailer_arquivo << '9999' # CÓDIGO DO LOTE [4.....7] 04(9) 9999\n trailer_arquivo << '9' # TIPO DE REGISTRO [8.....8] 01(9) 9\n trailer_arquivo << ''.rjust(9, ' ') # BRANCOS [9....17] 09(X)\n trailer_arquivo << counter_lotes(nro_lotes, 6) # TOTAL QTDE DE LOTES [18...23] 06(9) NOTA 17\n trailer_arquivo << sequencial.to_s.rjust(6, '0') # TOTAL QTDE REGISTROS [24...29] 06(9) NOTA 17\n trailer_arquivo << ''.rjust(211, ' ') # BRANCOS [30..240] 211(X)\n trailer_arquivo\n end",
"def thirteen\n x = read_file_13\n x = x.to_s\n x = x[0,10]\n\n return x.to_i\nend",
"def generar_alumno\n line = read\n promedio = 0\n line.each do |x|\n arr = x.split(' ')\n promedio = (arr[1].to_f + arr[2].to_f + arr[3].to_f + arr[4].to_f +\n arr[5].to_f) / 5\n file = File.open(\"#{arr[0]}.csv\", 'w')\n file.puts \"#{arr[0]} tiene promedio #{promedio}\"\n file.close\n end\n puts 'Documentos generados!'\nend",
"def creoarchivo(nom,promedio)\n\tfile = File.open(\"#{nom}\", 'w')\n\tfile.puts promedio\n\tfile.close\t\nend",
"def processa_arquivo(caminho_logs = nil, caminho_ips_ignorados = nil)\n if caminho_logs.nil?\n imprime_banner\n else\n begin\n lista_requisicoes = []\n lista_ips_ignorados = obtem_ips_ignorados caminho_ips_ignorados\n arquivo = File.open caminho_logs, 'r'\n puts \"Processando arquivo #{caminho_logs}...\"\n arquivo.each_line do |linha|\n\t requisicao = processa_linha linha, lista_ips_ignorados\n\t unless requisicao.nil?\n\t lista_requisicoes << requisicao\n\t end\n end\n arquivo.close\n exporta lista_requisicoes\n exporta_coordenadas lista_requisicoes\n puts \"OK.\"\n rescue Errno::ENOENT\n puts 'Arquivo de logs não encontrado.'\n end\n end\nend",
"def create\n\n @pregoestitulosgrafico = Pregoestitulosgrafico.new(pregoestitulosgrafico_params)\n\n @arquivo = Arquivo.new\n\n path = File.join(Rails.root, \n \"public/pregoes/\", \n params[:pregoestitulosgrafico][:arquivo_id].original_filename)\n\n # escreve o arquivo no local designado\n File.open(path, \"wb\") do |f| \n f.write(params[:pregoestitulosgrafico][:arquivo_id].read)\n end\n\n @arquivo.caminho = \"public/pregoes/\" + params[:pregoestitulosgrafico][:arquivo_id].original_filename # imagem[\"public_id\"] #+ \".\" + imagem[\"format\"]\n @arquivo.nome = params[:pregoestitulosgrafico][:arquivo_id].original_filename # imagem[\"public_id\"] #+ \".\" + imagem[\"format\"]\n\n @arquivo.save\n\n @pregoestitulosgrafico.arquivo_id = @arquivo.id\n\n pregoestitulo = Pregoestitulo.find(@pregoestitulosgrafico.pregoestitulo_id)\n\n respond_to do |format|\n if @pregoestitulosgrafico.save\n format.html { redirect_to pregoestitulo, notice: 'Arquivo incluído com sucesso.' }\n format.json { render :show, status: :created, location: @pregoestitulosgrafico }\n else\n format.html { render :new }\n format.json { render json: @pregoestitulosgrafico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def deco_file; end",
"def parse_remaining_files; end",
"def read_txt\n # Open TXT file\n # f = File.open(self.fichero, \"r\")\n # Use TXT file content\n f = self.fichero\n # Loop thru open file lines\n f.each_line do |line|\n cod_reg = line[0,2]\n if cod_reg == '80'\n # Totals line\n amount = line[36,12]\n self.total_bills = line[22,6].to_i\n self.total_amount = (amount[0,10] + '.' + amount[10,2]).to_d\n elsif cod_reg == '02'\n # Header line\n pdate = line[36,6]\n self.nif = line[10,8]\n self.sufijo = line[18,3]\n self.process_date_time = Date.parse(pdate[4,2] + pdate[2,2] + pdate[0,2]) rescue Date.today\n elsif cod_reg == '01' || cod_reg == '90'\n # First or Last line\n else\n # Invoice charged line: Save in array\n amount = line[36,12]\n self.lista_cobros.push(bill_id: line[76,11].to_i,\n amount: (amount[0,10] + '.' + amount[10,2]).to_d,\n date: line[30,6],\n issuer: line[10,8],\n suffix: line[18,3],\n charge_code: line[21,1],\n charge_bank: line[22,4],\n charge_office: line[26,4],\n charge_id: line[48,6],\n iban_head: line[4,4],\n ccc_bank: line[54,4],\n ccc_office: line[58,4],\n ccc_dc: line[62,2],\n ccc_account_no: line[64,10],\n debit_code: line[74,1],\n cancel_code: line[75,1],\n reference: line[76,13])\n end\n end # f.each_line\n # f.close\n end",
"def monta_trailer_arquivo(nro_lotes, sequencial)\n raise Brcobranca::NaoImplementado, 'Sobreescreva este método na classe referente ao banco que você esta criando'\n end",
"def CreaArchivos(aux)\n estado = false\n Dir.chdir(\"C:\\\\Imatch\\\\configuracion\")\n archivo = \"TR_\" + aux + \".xml\"\n print \"\\tVerificando archivo de configuracion \" + archivo + \"...\\n\"\n if File.exists?(archivo)\n print \"\\tArchivo \" + archivo + \" existe...\\n\"\n else\n File.open(archivo, 'w') do |registro|\n registro.puts '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>'\n registro.puts '<ConfiguracionArchivo>'\n registro.puts ' <entidad>' + aux + '</entidad>'\n registro.puts ' <carpetaDeInput>C:\\\\SFTP\\\\Tickets\\\\' + aux + '\\\\</carpetaDeInput>'\n registro.puts ' <carpetaDeProcesados>C:\\\\SFTP\\\\Tickets\\\\' + aux + '\\\\procesados\\\\</carpetaDeProcesados>'\n registro.puts ' <carpetaDeErrores>C:\\\\SFTP\\\\Tickets\\\\' + aux + '\\\\errores\\\\</carpetaDeErrores>'\n registro.puts ' <prefix>PO</prefix>'\n registro.puts ' <readerConfig>C:\\\\Imatch\\\\Configuracion\\\\Sistema\\\\ticket\\\\TR_SpringConfig.xml</readerConfig>'\n registro.puts ' <cantidadDiasHistorico>365</cantidadDiasHistorico>'\n registro.puts ' <entidadLiquidante>false</entidadLiquidante>'\n registro.puts ' <capturaArchivos>true</capturaArchivos>'\n registro.puts '</ConfiguracionArchivo>'\n end\n print \"\\tArchivo \" + archivo + \" creado...\\n\"\n estado = true\n end\n return estado\nend",
"def generate_visa_file(type, contacts, establishment)\n if type == \"credit\"\n filename = \"DEBLIQC\"\n else\n filename = \"DEBLIQD\"\n end\n begin_register_type = \"0\"\n end_register_type = \"9\"\n constant_type = \"DEBLIQ\"\n establishment = establishment #\"3617131\"\n constant = \"900000 \"\n date = Time.now.year.to_s.rjust(4,\"0\")+Time.now.month.to_s.rjust(2, \"0\")+Time.now.day.to_s.rjust(2, \"0\")\n hour = Time.now.hour.to_s.rjust(2, \"0\")+Time.now.min.to_s.rjust(2, \"0\")\n debit_type = \"0\"\n status = \" \"\n begin_reserved = \" \"*55\n end_reserved = \" \"*36\n mark = \"*\"\n credit_or_debit = (type == \"credit\" ? \"C\" : \"D\")\n\n contact_register_type = \"1\"\n contact_reserved_space_1 = \" \"*3\n contact_reserved_space_2 = \" \"*26\n transaction_code = \"0005\"\n\n\n total_count = contacts.count.to_s.rjust(7, \"0\")\n total_amount = sprintf(\"%.02f\", contacts.sum(\"amount\").to_s).rjust(16, \"0\").delete(\".\")\n # filename = DEBLIQ + \"C\" if params[:type => \"credito\"] algo así\n first_line = begin_register_type+constant_type+credit_or_debit+\" \"+establishment.rjust(10, \"0\")+constant+\n date+hour+debit_type+status+begin_reserved+mark\n end_line = end_register_type+constant_type+credit_or_debit+\" \"+establishment.rjust(10, \"0\")+constant+\n date+hour+total_count+total_amount+end_reserved+mark\n\n File.open(filename, \"w\") do |f|\n f.puts(first_line)\n contacts.each do |contact|\n contact_line = contact_register_type +\n contact.card_number.to_s.rjust(16, \"0\") +\n contact_reserved_space_1 +\n contact.bill.to_s.rjust(8, \"0\") +\n date +\n transaction_code +\n sprintf(\"%.02f\", contact.amount.to_s).rjust(16, \"0\").delete(\".\") +\n contact.identifier.to_s.rjust(15, \"0\") +\n (contact.new_debit? ? \"E\" : \" \") +\n \" \" +\n contact_reserved_space_2 +\n mark\n f.puts(contact_line)\n end\n f.puts(end_line)\n end\n end",
"def avec_fichier( nom_fichier, contenu )\n # On cree le fichier.\n File.open( nom_fichier, \"w\" ) do |fich|\n contenu.each do |ligne|\n fich.puts ligne\n end\n end\n\n # On execute le bloc.\n yield\n\n # On supprime le fichier.\n FileUtils.rm_f nom_fichier\nend",
"def avec_fichier( nom_fichier, lignes = [], conserver = nil )\n # On cree le fichier.\n File.open( nom_fichier, \"w\" ) do |fich|\n lignes.each do |ligne|\n fich.puts ligne\n end\n end\n\n # On execute le bloc.\n yield\n\n # On supprime le fichier sauf si indique autrement, auquel cas on\n # retourne son contenu.\n if conserver\n contenu_fichier( nom_fichier )\n else\n FileUtils.rm_f nom_fichier\n end\nend",
"def avec_fichier( nom_fichier, lignes = [], conserver = nil )\n # On cree le fichier.\n File.open( nom_fichier, \"w\" ) do |fich|\n lignes.each do |ligne|\n fich.puts ligne\n end\n end\n\n # On execute le bloc.\n yield\n\n # On supprime le fichier sauf si indique autrement, auquel cas on\n # retourne son contenu.\n if conserver\n contenu_fichier( nom_fichier )\n else\n FileUtils.rm_f nom_fichier\n end\nend",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def file; end",
"def nactiSoubor(path)\r\n File.readlines(path).map { |str| str.split(\" \")} #nacitam si soubor a generuji 2D pole jeho obsahu\r\nend",
"def max_file_buffer; end",
"def max_file_buffer; end",
"def citesteFila(filename, mode)\n aFile = File.new(filename, mode)\n if aFile\n content = aFile.sysread(20000)\n puts content\n else\n puts \"Fila nu a fost deschisa.\"\n end\n end",
"def initialize(info, prefix_dir) \r\n @info_dictionary = info\r\n @files = Array.new\r\n @piece_files = Array.new\r\n @pieceLength = info[\"piece length\"]\r\n @numBytes = 0\r\n @totalPieces = info[\"pieces\"].bytesize / 20\r\n \r\n build_dir_path(prefix_dir)\r\n \r\n unless prefix_dir.chars.last == File::SEPARATOR \r\n prefix_dir += File::SEPARATOR \r\n end\r\n \r\n no_files_existed = true\r\n if info[\"files\"] != nil\r\n # multiple file mode\r\n \r\n unless Dir.exists?(prefix_dir + info[\"name\"])\r\n Dir.mkdir(prefix_dir + info[\"name\"])\r\n end\r\n \r\n info[\"files\"].each { |file|\r\n @numBytes += file[\"length\"]\r\n filename = file[\"path\"].last\r\n \r\n build_dir = prefix_dir + info[\"name\"] + File::SEPARATOR # for making directory trees\r\n file[\"path\"].rotate(-1).drop(1).each { |dir| # don't use filename (last element)\r\n build_dir += (dir + File::SEPARATOR) # use constant separator for portability\r\n unless Dir.exists?(build_dir)\r\n Dir.mkdir(build_dir)\r\n end\r\n }\r\n \r\n if File.exists?(build_dir + filename)\r\n no_files_existed = false\r\n end\r\n @files << [File.open(build_dir + filename, File::RDWR | File::CREAT), file[\"length\"]]\r\n if @files.last[0].size < @files.last[1]\r\n @files.last[0].seek(@files.last[0].size, IO::SEEK_SET)\r\n @files.last[0].write(\"\\0\" * (@files.last[1] - @files.last[0].size))\r\n end\r\n }\r\n else\r\n # single file mode\r\n @numBytes = info[\"length\"] \r\n if File.exists?(prefix_dir + info[\"name\"])\r\n no_files_existed = false\r\n end\r\n @files << [File.open(prefix_dir + info[\"name\"], File::RDWR | File::CREAT), info[\"length\"]]\r\n if @files.last[0].size < @files.last[1] # still needs to be checked even if file exists\r\n @files.last[0].seek(@files.last[0].size, IO::SEEK_SET)\r\n (0..((@files.last[1] - @files.last[0].size)/1024)).each {\r\n @files.last[0].write(\"\\0\" * 1024)\r\n }\r\n end\r\n end\r\n unless no_files_existed\r\n recheckComplete()\r\n else\r\n gen_initial_states()\r\n end\r\n \r\n #puts @bitfield.to_binary_string\r\n end",
"def size_fil_trailer\n 4 + 4\n end",
"def zapisData(nactenySoubor,nazev)\r\n pocetNodu = nactenySoubor[1].length - 1 #pocet nodu je mensi o 1 právě kvůli tomu hashtagu\r\n delkaSouboru = nactenySoubor.length\r\n\r\n # nyní si potřebuji sesypat data ze zbytku nacteneho pole do úhledné formy pro intenzity\r\n vystupniDataHodnot = []\r\n index = 1\r\n\r\n for i in 2...delkaSouboru\r\n delkaRadku = nactenySoubor[i].length #delka nacteneho radku\r\n for j in 0...delkaRadku\r\n vystupniDataHodnot.push(nactenySoubor[i][j].to_f / nactenySoubor[1][index].to_f) #tvorim si pole dat pro grafy a napocitavam si intenzity\r\n index += 1\r\n end\r\n end\r\n\r\n # nyní si připravím x souřadnice pro graf\r\n xAxis = []\r\n xAxis[0] = 0\r\n\r\n for i in 0...(pocetNodu - 1)\r\n xAxis[i+1] = nactenySoubor[1][i+1].to_i + xAxis[i].to_i\r\n end\r\n\r\n # zapis samotnéhop datového souboru o 2 sloupcích\r\n file = File.open(\"data_gnuplot/#{nazev}.txt\", \"w\")\r\n file.puts \"#{nactenySoubor[0][1]}\"\r\n for i in 0...xAxis.length\r\n file.puts \"#{xAxis[i]} #{vystupniDataHodnot[i]}\"\r\n end\r\n file.close\r\nend",
"def add(filename)\n raise StandardError, \"That filename is invalid, its too long\" if filename.length > 255\n # Get the next record number\n p n = getNextRecordNumber\n \n filename = File.expand_path(filename)\n filename.gsub!(/^([a-z])/){$1.upcase}\n \n utf8 = filename\n # Are there any UTF8 characters to deal with?\n if not filename =~ /^[\\x21-\\x7E]+$/i\n # Use File::SEPARATOR\n filename = filename[0,3]+(filename[3..-1].split(\"\\\\\").collect { |chunk| ((chunk =~ /^[\\x21-\\x7E]+$/i) ? chunk : chunk.gsub(/([^a-z0-9_])/i,\"\")[0..5].upcase+\"~1\"+File.extname(chunk))}.join(\"\\\\\"))\n end\n \n test = open(\"temp.txt\",\"w\")\n # Go to the end of the file, where the next record needs to be written\n @fh.sysseek(0, IO::SEEK_END)\n @fh.write filename.ljust(280,\"\\000\")\n @fh.write [n].pack(\"V\")\n @fh.write [filename.match(/^([A-Z]):/i)[1].upcase[0] - 65].pack(\"V\")\n @fh.write [((Time.now.to_f+11644473600)*(10**7)).to_i].pack(\"Q\")\n @fh.write [(open(utf8).read.length / Sys::Filesystem.stat(filename[0,3]).block_size).ceil].pack(\"V\")\n @fh.write Iconv.new(\"UTF-16LE\",\"UTF-8\").iconv(utf8).ljust(520,\"\\000\")\n @fh.write \"\\x0D\\x0A\"\n \"D#{filename[0..0].downcase}#{n+1}\"+File.extname(utf8)\n end",
"def file_number_initial_value\n @file_number ||= 100_000\n # this seed file creates 40 new veterans on each run, 100 is sufficient margin to add more data\n @file_number += 100 while Veteran.find_by(file_number: format(\"%<n>09d\", n: @file_number))\n @file_number\n end",
"def ingresar_producto(nuevo)\n file = File.open('productos.txt','a')\n file.puts nuevo\n file.close\nend",
"def not_test_read_head_part\r\n files_part1 = [\"9-14(15~20略).TXT\", \"33-39(21~32略).TXT\", \"40-43.txt\", \"44-47.txt\", \"48-55.TXT\",\r\n \"56-57概述结束.TXT\", \"58-59.TXT\"]\r\n files_part2 = Array.new\r\n #从60开始,到 471\r\n (60..471).to_a.each{ |i|\r\n files_part2 << i.to_s+\".TXT\"\r\n }\r\n read_from_files(files_part1 + files_part2)\r\n end",
"def subir_imagen=(file_data)\n\t\t#Se ejecuta solo si no esta vacio\n\t\tunless file_data.blank?\n\t\t\tputs \"FILEDATA: #{file_data}\"\n\t\t\t@file_data = file_data\n\t\t\t#Parte el archivo en 2 por el caracter '.' y coge la ultima parte\n\t\t\t# para luego convertirlo a minuscula\n\t\t\tself.imagen = file_data.original_filename.split('.').last.downcase\n\t\t\tputs \"IMAGEN: #{self.imagen}\"\n\t\t\t# self.imagen = \"#{id}.#{imagen}\"\n\t\tend\n\tend",
"def fin; false; end",
"def process_file(zos, fn_encoding, use_conv, output_format)\n file_now = @file_list[0]\n bukas_req(file_now[1]) do |res|\n if @conn_closed\n end_download\n zip_end zos\n elsif $ready_to_down and @read_to_down_check != file_now[3]\n zos.put_next_entry(encode_str(\"下線維修中,請稍後再繼續下載(中斷處為最後下載中的一話or集)\"))\n zos.puts \"下線維修中,請稍後再繼續下載(中斷處為最後下載中的一話or集)\"\n zip_end zos\n elsif res\n $logger.info \"#{@client_id} - Saving file - #{file_now[2]} - #{file_now[0]}\"\n zos.put_next_entry(\"#{encode_str(file_now[0], fn_encoding, use_conv)}.#{output_format}\")\n res = res[64..-1]\n w, h, d = case output_format\n when \"webp\"\n [-1, -1, res]\n when \"png\"\n WebP.decodeRGBA(res)\n else # jpg (RGB) is default\n WebP.decodeRGB(res)\n end\n if d.empty?\n #process_file(zos, fn_encoding, use_conv, output_format)\n $logger.info \"#{@client_id} - bukas wrong! - webp decoding failed - #{file_now[1]}\"\n zos.put_next_entry(\"Something Wrong!!!\")\n zos.puts \"Something Wrong!!!\"\n zip_end zos\n else\n zos.puts case output_format\n when \"webp\"\n d\n when \"png\"\n PNG.encodePNG(w, h, d)\n else # jpg is default\n JPEG.encodeJPEG(w, h, d)\n end\n @read_to_down_check = file_now[3]\n @file_list.shift\n if @file_list.empty?\n $logger.info \"#{@client_id} - Download finished!\"\n zip_end zos\n else\n process_file(zos, fn_encoding, use_conv, output_format)\n end\n end\n else\n $logger.info \"#{@client_id} - bukas wrong! - no data - #{file_now[1]}\"\n zos.put_next_entry(\"Something Wrong!!!\")\n zos.puts \"Something Wrong!!!\"\n zip_end zos\n end\n end\n end",
"def file_size\n number_to_human_size(super)\n end",
"def fichier_de_donnees_pour(nb_items)\n \"testdata/#{nb_items}Words.txt\"\nend",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def sauvegarder(nomFichier)\n\t\n\t\t# Ouverture du fichier\n\t\tfichier = File.open(nomFichier, \"w\")\n\t\t\n\t\t# Traduction de chacune des grilles de la liste des grilles en ligne de fichier\n\t\tligne = \"\"\n\t\[email protected] do |grille|\n\t\t\tligne = grille.toLigneFichier()\n\t\t\tfichier.write(ligne)\n\t\tend\n\t\t\n\t\t# Fermeture du fichier\n\t\tfichier.close()\n\tend",
"def save\n file = File.new(@file,\"w+\")\n index =0\n while index < @max_lines do\n file.puts @properties[index]\n index +=1\n end\nend",
"def pos_fil_header\n 0\n end",
"def initialize (fraseIniziale, separatore)\n @@mioKonta = Hash.new\n @f = File.new(\"outrunner2.txt\", \"w\")\n # timedate 28/06/2013\n nuovaFrase = fraseIniziale + \" eseguito il \" +Time.new().to_s.gsub(\" +0200\", \"\")\n @nRiga = 1\n @f.write(formatta0()+\"..inizio.. #{nuovaFrase}\\n\")\n @separatore = separatore\n end",
"def sum_from_file(filename)\nend",
"def sum_from_file(filename)\nend",
"def max_file_buffer=(_arg0); end",
"def max_file_size\n 0\n end",
"def file_content file_name=HOSTS_FILE\n \n begin\n\tfilename = File.realpath(file_name)\n\t\tbkup = filename + \".backup\"\n\t\t\tbackup_files = Dir.glob(bkup + \"*\").sort_by do |f|\n\t\t\t\tf.match(/\\d+$/)\n\t\t\t\t$&.nil? ? 0 : $&.to_i\n\t\t\tend\n\t\tbackup_files.reverse.each do |fname|\n\t\t\tif m = fname.match(/\\.backup\\.(\\d+)$/)\n\t\t\t\tFile.rename(fname, \"%s.%d\" % [bkup, m[1].to_i + 1])\n\t\t\telsif fname == bkup\n\t\t\t\tFile.rename(bkup, bkup + \".1\")\n\t\t\tend\n\t\n\t\tend\n rescue Exception => ex\n\tputs \"OOPS, the backup wasn't destroyed the last time you ran this script\"\n end \n #read the file\n content = \"\"\n file = File.open(file_name, \"r\")\n while (line = file.gets)\n content += \"#{line}\"\n end\n file.close \n content\nend",
"def summarize_file(path); end",
"def size_fil_header\n 4 + 4 + 4 + 4 + 8 + 2 + 8 + 4\n end",
"def sum_from_file(filename)\n\nend",
"def estrai_allegati()\n lista_email = @files.select{|f| f.fnmatch(\"*Profilo acquisto energia*\")}\n lista_allegati = []\n lista_email.each do |email| \n msg = Mapi::Msg.open(email.to_s) \n allegato = msg.attachments.find { |h| (h.filename).match(\"xls\")}\n (lista_allegati << TMP_FOLDER+\"/\"+ File.basename(allegato.filename)).uniq! \n tmp_file = open(TMP_FOLDER+ \"/\"+ File.basename(allegato.filename), 'wb') \n allegato.save tmp_file\n tmp_file.close\n end\n return lista_allegati \n end",
"def make\n count = Docsplit.extract_length(file_path.to_s)\n\n instance[pages_count_column] = count\n instance.run_callbacks(:save) { false }\n\n File.open(file.path)\n end",
"def open_new_file_to_write(input, number)\n\toutfile = File.new(\"per-#{number}bp-#{input}.txt\", \"w\")\n\toutfile.puts \"position\\tnumhm\\tnumht\"\n\toutfile\nend",
"def partOne(file_path)\n File.read(file_path)\n .split(\"\\n\\n\")\n .map { |calories_per_elf| calories_per_elf.split(\"\\n\").map(&:to_i).sum }\n .max\nend",
"def export(filename=@location + \"-suntimes-#{@year}.txt\")\n File.write filename, @to_dx.to_s\n end",
"def FileModesOwnership\n\tarquivo = File.new(\"arquivo_novo.txt\", \"w\")\n\tarquivo.chmod(0755)\n\tarquivo.close()\nend",
"def make\n @file.read(1)\n @file.rewind\n @file\n end",
"def file_save file\n\t\tfields \t\t\t\t= {}\n \t\tfields[:uid] \t\t= file_uid\n\t\tfields[:fnum] \t\t= file_num_generate\n\t\tfields[:name] \t\t= file[:filename].split('.').first\n\t\tfields[:created]\t= Time.now\n\t\tfields[:type]\t\t= file[:type]\n \t\tfields[:path] \t\t= \"#{file_uid}-#{fields[:created].to_i}#{_random(3)}\"\n\n\t\t# allow these file type to save\n\t\tunless _var(:file_type).include? file[:type]\n\t\t\t_throw Sl[:'the file type isn`t allowed to save']\n\t\tend\n\n\t\t# allow the scope of file size\n\t\tfile_content = file[:tempfile].read\n\t\tif (fields[:size] = file_content.size) > _var(:file_size).to_i\n\t\t\t_throw Sl[:'the file size is too big']\n\t\tend\n\n\t\t# save the info of file\n\t\tSdb[:file_info].insert(fields)\n\n\t\t# save the body of file\n\t\tpath = Spath[:upload_dir] + fields[:path]\n\t\tSimrb.path_write path, file_content\n\t\t_msg :file_save, Sl['saved file successfully']\n\n# \t\t\tFile.open(Spath[:upload_dir] + fields[:path], 'w+') do | f |\n# \t\t\t\tf.write file_content\n# \t\t\tend\n\n# \n# \t\t# return the value\n# \t\tunless reval == nil\n# \t\t\tSdb[:file_info].filter(fields).get(reval)\n# \t\tend\n\tend",
"def generarImagen()\n\t\tFile.open(@programa+'.pbm', 'w') do |f2|\n\t\t\tf2.puts \"P1\"\n\t\t\tf2.puts \"#{@tam_ancho} #{@tam_alto}\"\n \t\t\t@tam_alto.times do |i|\n \t\t\t\ts = \"\"\n\t\t\t\t@tam_ancho.times do |j|\n\t\t\t\t\ts << @plano[i][j].to_s + \" \"\n\t\t\t\tend\n\t\t\t\tf2.puts s\n\t\t\tend\n\t\tend\n\tend",
"def descramble_file( path )\n pathname = Pathname.new( path )\n # Not exist Pathname#binwrite on Ruby 2.0.0\n #pathname.binwrite( descramble( pathname.binread ) )\n IO.binwrite( pathname, descramble( pathname.binread ) )\n end",
"def write_due\n journal_use = 0\n @file.size != 0 && (journal_use.to_f / @file.size) >= JOURNALING_UPPER_TOLERANCE\n end",
"def transform_enrollment_file\n #puts \"Transforming enrollment file for #{@district.name}\"\n att_array = []\n enr_array = []\n tmp_array = []\n #Load up the attendance and enrollment files into arrays\n for file_path in @files\n if !File.directory?(file_path)\n IO.foreach(file_path, sep_string = get_sep_string(file_path)) do |line|\n unless line.blank?\n line.gsub!(/[\"][^\"]*[\"]/) { |m| m.gsub(',','|') }\n att_array.push(line) if file_path.downcase.index('att')\n enr_array.push(line) if file_path.downcase.index('enroll')\n end \n end\n end\n end\n #Process enrollment file for rewrite\n @file_to_write = File.open(File.join(@dir, \"tmp_e.tmp\"),\"w\")\n #Run through each attendance record, when tea_id matches, use enrollment value to re-build enrollment file\n #with report dates\n att_array.each do |rec|\n date,@tmp_tea_id,absent = rec.split(\",\") if @allowed_attendance_headers.length == 3\n date,@tmp_tea_id,school_name,absent = rec.split(\",\") if @allowed_attendance_headers.length == 4\n if date.downcase.index(\"date\").blank?\n enr_array.each do |line|\n @enrolled = 0\n tmp_line = line.split(@delimiter)\n if tmp_line.length == 3\n if is_date?(tmp_line.first.gsub('\"',''))\n enroll_date,tea_id,enrolled = tmp_line\n else\n tea_id,name,enrolled = tmp_line\n end \n elsif tmp_line.length == 4\n enroll_date,tea_id,name,enrolled = tmp_line \n end\n unless @six_digit_campus_id\n tea_id = \"0#{value}\" if tea_id.length == 2\n tea_id = \"00#{value}\" if tea_id.length == 1\n tea_id = \"#{@district.district_id}#{tea_id}\"\n end\n @tmp_tea_id.gsub!('\"',\"\")\n tea_id.gsub!('\"',\"\")\n @tmp_tea_id.gsub!(\"'\",\"\")\n tea_id.gsub!(\"'\",\"\")\n tea_id.strip!\n @tmp_tea_id.strip!\n enrolled.strip!\n enrolled.gsub!('\"',\"\")\n enrolled.gsub!(\"'\",\"\")\n enrolled.gsub!(\"|\",\"\")\n if tea_id.to_i != @tmp_tea_id.to_i\n next\n else\n @enrolled = enrolled.to_i\n break\n end\n end\n tmp_array.push('\"'+date.gsub('\"',\"\")+'\"')\n tmp_array.push('\"'+@tmp_tea_id.gsub('\"',\"\")+'\"')\n tmp_array.push('\"'+school_name.gsub('\"',\"\").gsub('|',',')+'\"') unless school_name.blank?\n tmp_array.push('\"'+\"#{@enrolled}\"+'\"')\n @file_to_write.puts tmp_array.join(\",\")\n tmp_array = [] \n end\n end\n @file_to_write.close\n for file_path in @files\n if file_path.downcase.index('enroll')\n #Delete file just read\n File.delete(file_path)\n #Rename temp file to previously read file\n File.rename(File.join(@dir, \"tmp_e.tmp\"), file_path)\n end\n end\n end",
"def dados_do_arquivo\n\t\t\t\t\treturn if self.invalid?\n\n\t\t\t\t\t# contador dos registros do lote\n\t\t\t\t\tcontador = 1\n\n\t\t\t\t\t# Metodo 'monta_header' implementado no module -> BrBoleto::Remessa::Cnab400::Helper::Header\n\t\t\t\t\tarquivo = [monta_header] \n\t\t\t\t\tcontador += 1\n\n\t\t\t\t\tpagamentos.each do |pagamento|\n\t\t\t\t\t\tarquivo << monta_detalhe(pagamento, contador)\n\t\t\t\t\t\tcontador += 1\n\t\t\t\t\tend\n\n\t\t\t\t\t# Metodo 'monta_trailer' implementado no module -> BrBoleto::Remessa::Cnab400::Helper::Trailer\n\t\t\t\t\tarquivo << monta_trailer(contador)\n\n\t\t\t\t\tretorno = ActiveSupport::Inflector.transliterate(arquivo.join(\"\\n\")).to_ascii.upcase\n\t\t\t\t\tretorno << \"\\n\"\n\t\t\t\t\tretorno.encode(retorno.encoding, :universal_newline => true).encode(retorno.encoding, :crlf_newline => true)\n\t\t\t\tend",
"def import(date, file, min_page = 0, max_page)\r\n\r\n \tputs \"Importing data from: #{file}\"\r\n\r\n # Load date\r\n @date = date\r\n\r\n # Regex patterns\r\n id_regex = /^(0|\\d{6,9}|\\d{12,13}|X{13}|UPI\\d{8,10}(?:\\/\\d)?|U\\/I-\\d{4}\\/\\d{2}|UF\\/I\\d{4}\\/\\d{2}|\\d{2,3}-\\d{1,7}-\\d{1,7}(?:[\\/|\\-|\\s]\\d{1,4})?)$/\r\n\r\n # output dir\r\n out_dir = File.join(Rails.root, \"db\", \"export\")\r\n Dir.mkdir(out_dir) if !Dir.exist?(out_dir)\r\n\r\n @banks = Set.new\r\n\r\n # Output CSV files\r\n @result_csv = CSV.open(File.join(out_dir, \"#{date}.csv\"), \"w\")\r\n\r\n owner_lines = []\r\n\r\n # Statistics\r\n @total = {}\r\n @total.default = 0\r\n\r\n @cases = [0, 0, 0, 0, 0, 0]\r\n\r\n start = Time.now\r\n \tPDF::Reader.new(file).pages.each_with_index do |page, page_num|\r\n \t\t#Skip first min_page\r\n next if page_num < min_page\r\n\r\n # Stop after max_page \r\n \t\tbreak if page_num > max_page\r\n\r\n @total[:pages] += 1\r\n\r\n \t\t\tpage.text.lines.each do |line|\r\n # skip empty lines\r\n \t\t\t\tif !line.strip!.blank?\r\n\r\n \t\t\t\t\t# Match owner ID - this is new owner\r\n \t\t\t\t\tif line =~ id_regex\r\n \t\t\t\t\t\t# parse and save owner info but skip first line\r\n \t\t\t\t\t\tparse(owner_lines) if !owner_lines.empty?\r\n\r\n \t\t\t\t\t\t# start capturing data for new owner\r\n \t\t\t\t\t\towner_lines = [$~[1]]\r\n # skip strings which are not accounts: headers and footers\r\n \t\t\t\t\telsif !(line =~ /Broj racuna/i || line =~ /^\\d{2}\\/\\d{2}\\/\\d{4}/ || line =~ /^JIB/) && (!owner_lines.empty?)\r\n \t\t\t\t\t\towner_lines << line.gsub(/\\s{2,}/,'\\t')\r\n \t\t\t\t\tend\r\n \t\t\t\tend\r\n \t\t\tend\r\n \t\tend\r\n\r\n @result_csv.close\r\n\r\n puts \"Statistics: #{@total.to_yaml}\\n#{@cases}\"\r\n puts \"Loading finished in: %3d:%04.2f\"%(Time.now-start).divmod(60.0)\r\n \tend",
"def prepareForFile(filename)\n end",
"def cargar_noticias (ruta_noticias)\n\n Find.find(ruta_noticias) do |ruta| # Iteramos por todo lo que hay en esa ruta.\n ruta_fichero = case\n # Comprobamos que lo que se encuentra en el directorio es un fichero.\n when File.file?(ruta) then ruta\n when File.directory?(ruta) then nil\n else nil \n end\n if (ruta_fichero!=nil) && (!File.zero?(ruta_fichero)) then # Si el archivo existe y no es vacío.\n noticia = IO.readlines(ruta_fichero)\n @hemeroteca.insertar!(leer_noticia(noticia))\n end \n end\n end",
"def checksum!(path = nil, opts = {})\n opts = opts.inject({}){ |r, (k,v)| r[k.to_sym] = v; r }\n \n raise \"Path uses differnt extension\" if path && File.extname(path) != File.extname(self.local_path)\n \n \n if opts[:debug]\n raise (\"File '%s' does not exist\" % File.expand_path( path ) ) if path && !File.exist?( File.expand_path( path ) )\n else\n raise (\"File '%s' does not exist\" % path ) if path && !File.exist?( File.expand_path( path ) )\n end\n \n raise \"Can not specify both piece_size and piece_count\" if opts[:piece_size] && opts[:piece_count]\n raise \"piece_size must be an Integer\" if opts[:piece_size] && !opts[:piece_size].is_a?(Integer)\n raise \"piece_count must be an Integer\" if opts[:piece_count] && !opts[:piece_count].is_a?(Integer)\n \n path ||= self.local_path\n \n #get filesize\n self.size = File.size( File.expand_path( path ) )\n\n # Overrides piece_count if set\n # minimum size of 1KB for a piece\n if opts[:piece_size]\n @piece_count = nil\n @piece_size = [opts[:piece_size], 1024].max\n end\n\n\n # Overrides piece_size if set\n # This will be a multiple of 1024, and the last file will be slightly smaller\n # this means 1KB is the minimum size for a piece\n if opts[:piece_count]\n @piece_count = opts[:piece_count]\n @piece_size = ((@size / @piece_count) / 1024.0).ceil * 1024 \n end\n\n self.hashes = []\n self.hashes << Metalink4FileHash.new( hash_value: Digest::SHA256.file( File.expand_path( path ) ).hexdigest, hash_type: \"sha-256\" )\n if self.piece_size\n i = 0\n (0...@size).step(self.piece_size).each do |offset|\n self.hashes << Metalink4FileHash.new( hash_value: Digest::SHA256.hexdigest(File.read(File.expand_path( path ), self.piece_size, offset)), hash_type: \"sha-256\", piece: i )\n i += 1\n end\n end\n end",
"def close_file\r\n end",
"def Obtener_Archivo(file)\n if File.file?(file)\n linea = IO.readlines(file)\n linea.each do |hash|\n pregunta, respuesta = hash.chomp.split('-')\n hash = {question: pregunta, answer: respuesta}\n @array_hash << hash\n end\n else\n p 'Ha ocurrido un error, No se encuentra el archivo'\n end\n end",
"def pos_fil_trailer\n size - size_fil_trailer\n end",
"def encode_file\n # open 'orginal' to read from\n # fr = File.open(\"#{original_datei}\", 'r') dann muss die Datei explizit geschlossen werden\n File.open(\"#{original_datei}\", 'r') {|fr|\n # create 'encoded' to write to\n File.open(\"encoded_#{original_datei}\",'w') { |fw|\n # encode each letter and then write to 'encoded'\n fr.each_byte{|byte|\n fw << encode(byte).chr\n }\n }\n }\n end",
"def height\n file.height\n end",
"def genenate_average_files\n puts 'genenate_average_files'\n @data.each do |e|\n final = get_avg(e)\n puts \"#{e[0]} #{final}\"\n File.open(e[0].to_s, 'w') do |file|\n file.puts(\"#{e[0]}, #{final}\")\n end\n end\n end",
"def max_file_buffer=(bytes); end",
"def file_name_date_to_date(record,row)\n #rintraccio il file\n file = ImportFile.find(session[:file_id])\n #campagna 199X\n camp90 = /([9])(\\d)\\D+\\d+[.]\\S*/\n #campagna 20XX in avanti\n camp00 = /(\\d+)\\D+\\d+[.]\\S*/\n #se il file si riferisce alle campagne dal 1990 al 1999\n if file.file_name =~ camp90\n #anno = 19 + numeri rimanenti\n anno = \"19\" + $1 + $2\n #se il file si riferisce alle campagne dal 2000 al 2099\n elsif file.file_name =~ camp00\n #anno = 20 + numeri rimanenti\n anno = \"20\" + $1\n end\n #memorizzo temporaneamente la data per poterci lavorare sopra\n data_temp = Copl.new\n data_temp.data = record.data\n #a meno che l'anno della data del record non corrisponda a quello del nome del file\n unless data_temp.data.year == anno.to_i\n #salvo l'errore\n save_error(record,\"File name - Data\",row)\n #segnalo che c'è stato un errore sulla riga\n session[:row_error] = true\n #e segnalo l'errore sul file\n session[:file_error] = true\n end\n end"
] | [
"0.58282757",
"0.5818248",
"0.5766256",
"0.5655342",
"0.5636226",
"0.56290364",
"0.56137425",
"0.5577193",
"0.5572983",
"0.5538802",
"0.5532013",
"0.55307984",
"0.55025285",
"0.5459186",
"0.5455853",
"0.54396135",
"0.5432284",
"0.54289836",
"0.5415739",
"0.5407692",
"0.5388275",
"0.53860927",
"0.5373942",
"0.5366263",
"0.53554887",
"0.5346361",
"0.5326892",
"0.53123003",
"0.52988154",
"0.5274095",
"0.5274095",
"0.5273338",
"0.5273338",
"0.5273338",
"0.5273338",
"0.5273338",
"0.5273338",
"0.5273338",
"0.5273338",
"0.5273338",
"0.5273338",
"0.5273338",
"0.52678436",
"0.52618223",
"0.52618223",
"0.5237476",
"0.5231495",
"0.52298236",
"0.52233577",
"0.52193785",
"0.5193823",
"0.5178014",
"0.51777875",
"0.5173048",
"0.51688457",
"0.51499176",
"0.51494175",
"0.51363933",
"0.51248705",
"0.51248705",
"0.51248705",
"0.51248705",
"0.51248705",
"0.51248705",
"0.5119587",
"0.51182747",
"0.5117255",
"0.5115029",
"0.5105113",
"0.5105113",
"0.5102416",
"0.5092432",
"0.50907236",
"0.5081813",
"0.5075928",
"0.50691783",
"0.50641423",
"0.5050783",
"0.504331",
"0.50410664",
"0.50394166",
"0.5030597",
"0.5025112",
"0.5024506",
"0.5024041",
"0.50170124",
"0.50159746",
"0.5007421",
"0.5003474",
"0.4999927",
"0.49871632",
"0.49852192",
"0.49841627",
"0.49788243",
"0.49741355",
"0.49737006",
"0.49600863",
"0.4955409",
"0.4951416",
"0.4944718",
"0.49441296"
] | 0.0 | -1 |
Make an alg name simple enough so we can use it as a file name without problems. | def new_image_filename(alg_name, variation_index = '')
name = alg_name.to_s.dup
LETTER_REPLACEMENTS.each { |k, v| name.gsub!(k, v) }
name = "alg_#{name}#{variation_index}.#{FORMAT}"
unless name.ascii_only?
raise ArgumentError, "Even with some replacements, we couldn't transform #{alg_name} " \
'to an ASCII-only string.'
end
if name_to_alg[name]
raise ArgumentError,
"Two algs map to file name #{name}: #{alg_name} and #{name_to_alg[name]}"
end
name_to_alg[name] = alg_name
name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_file_name(name)\r\n if name.match(/(.*)\\.([^\\.]*)/)\r\n fname, fext = $1, $2\r\n else\r\n fname, fext = name, \"dat\"\r\n end\r\n fname = fname.slugerize\r\n fext = fext.slugerize\r\n hash = Time.now.usec % 814949\r\n return \"#{hash.to_s(16)}_#{fname}.#{fext}\"\r\n end",
"def gen_name\n name.to_s.downcase\n end",
"def create_file_name(ext = nil)\n ext ||= self.ext\n return name unless ext\n \"#{unique_key}.#{ext}\"\n end",
"def create_filename(heat_number)\n name = competition.to_s\n name += \"_\"\n name += \"heat_\"\n name += heat_number.to_s.rjust(3, \"0\")\n \"#{name.first(59)}.txt\"\n end",
"def make_file_name yr, qtr, mth, wk\n name = 'Booking_Summary'\n if yr\n name = \"#{name}_#{yr}\"\n elsif qtr\n name = \"#{name}_#{qtr}\"\n elsif mth\n name = \"#{name}_#{mth}\"\n elsif wk\n name = \"#{name}_#{wk}\"\n else\n raise \"[Error]: Could not generate a file name\"\n end\n name = \"#{name}.xlsx\"\n name\n end",
"def square_name\n \"#{file}#{rank}\".to_sym\n end",
"def make_file_name(proposal, type='paltrack')\n if type == 'paltrack'\n make_paltrack_file_name(proposal)\n else\n @filename = @flow_type.upcase << @formatted_seq\n end\n end",
"def build_name(name)\n \"_design/#{name}\"\n end",
"def assertive_name\n @assertive_name ||= (\n if operator.to_s.end_with?('?')\n operator.to_s.chomp('?').to_sym\n else\n name.split('::').last.chomp('Assay').downcase.to_sym\n end\n )\n end",
"def unique_name(name)\n \"pedant_#{name}_#{pedant_suffix}\"\n end",
"def autoname(type)\n begin\n\treturn unless @outdir\n\tstamp = sprintf('%.6f',\"#{Time.now.to_i}.#{Time.now.usec}\".to_f).gsub('.','')\n\tFile.join(@outdir,\"#{type.upcase}_#{stamp}.#{@format.downcase}\")\n rescue Exception => e\n\[email protected] \"#{e.message} #{e.backtrace.inspect}\"\n\[email protected] \"#{e.message} #{e.backtrace.inspect}\" if @logger \n end\n end",
"def mk_name\n \"quarley poller #{rand(1_000_000)} #{Time.now.to_i}\"\n end",
"def algorithm_name\n raise NotImplementedError\n end",
"def make_file_name aExtension, *aWords #:nodoc:\n aWords.join(' ').to_file_name.ext(aExtension)\n end",
"def generate_filename(script)\n (Zlib::Inflate.inflate(script[2]) != '' ? \"#{fix_name(script[1])}.rb\" : 'EMPTY')\nend",
"def generate(name); end",
"def generate_new_filename(original_filename)\n s = Time.now.to_i.to_s + rand(999).to_s\n hash = Digest::MD5.hexdigest(s) \n original_filename = original_filename.gsub('#', '').gsub(/\\s+/, ' ')\n hash += ('-' + original_filename.sub(/\\A[a-z0-9]{32}-/, ''))\n hash.downcase \n end",
"def filename\n @name ||= ActiveSupport::SecureRandom.hex\n\t\"#{@name}#{File.extname(original_filename).downcase}\" if original_filename\n end",
"def genfilename(ext, time = Time.now)\n time.strftime(\"%Y-%m-%d\") + ext\n end",
"def name\n [@n.to_s + character.to_s, symmetry].reject{|p| p == \"\"}.join(\"_\")\n end",
"def calcIUPACname\n getIncompleteName + Constants::ALKANE_SFIX\n end",
"def createValidName(inname)\r\n outname = inname.gsub(/[\\s\\/\\\\?*#+]/,'') # Remove illegal chars (replace with underscore).\r\n outname.gsub!(/_+/,\"_\") # Replace consecutive uscores with single uscore.\r\n outname.gsub!(/\\./,\"-\") # Replace period with dash.\r\n\r\n outname\r\n end",
"def awful_file_name\n (((0x00..0x7f).to_a - [0x00, 0x0a, 0x2b, 0x2f]).map { |n| n.chr }).join + '.txt'\n end",
"def generate_name_target(opts={})\n # check if file already renamed to YYYYMMDD-hhss-AAA[AAA] format\n if (/^(\\d{8}-\\d{4}_\\w{3,6}_)(.*)/ =~ @name)\n name_clean = $2 \n # check if file already renamed in YYYYMMDD-hhss format \n elsif (/^(\\d{8}-\\d{4}_)(.*)/ =~ @name) \n name_clean = $2\n # for all others just rename\n else\n name_clean = @name\n end\n return opts[:date_time_original].strftime('%Y%m%d-%H%M')+\"_#{opts[:author_nikname]}_#{name_clean}\" \n end",
"def file_name(name)\n name.to_s.gsub(/-/, \"_\").underscore\n end",
"def file_name\n\t\treturn 'st' + student_id.to_s + 'pr' + problem_id.to_s + 'so' + id.to_s\n\tend",
"def conformScoreName(name, engine)\n base = \n case engine\n when \"X! Tandem\"\n \"xtandem\"\n when \"MASCOT\"\n \"mascot\"\n when \"OMSSA\"\n \"OMSSA\"\n when \"Tide\"\n \"sequest\"\n when \"Phenyx\"\n \"Phenyx\"\n when \"SpectraST\"\n \"SpectraST\"\n end\n \n [base, name].join(':')\n end",
"def to_const_name(name)\nconst_name = name.to_s.gsub(/[^a-z0-9_]/i,'_').squeeze('_').upcase\n if const_name =~ /^[^a-z]/i\n const_name = \"T_\"+const_name\n end\n const_name.to_sym\n end",
"def create_name\n prefix = ('A'...'Z').to_a.shuffle[0..1].join('')\n suffix = (100..1000).to_a.sample\n \"#{prefix}#{suffix}\"\n end",
"def generate_name\n self.name = \"#{album.name}-#{self.image_file_file_name}\"\n end",
"def make_paltrack_file_name( proposal )\n if EdiHelper.current_out_is_cumulative\n @filename = \"#{@flow_type.upcase}#{EdiHelper.network_address}#{Time.now.strftime('%Y%m%d-%H%M%S')}.#{proposal.hub_address}\"\n else\n @filename = \"#{@flow_type.upcase}#{EdiHelper.network_address}#{@formatted_seq}.#{proposal.hub_address}\"\n end\n end",
"def generate_unique_filename\n name = options[:file_name] || wrapper.name\n # TODO: Sanitize the file name\n\n filename = \"#{name}.swatches\"\n\n related_files = related_file_indexes(filename)\n\n filename = if related_files.present?\n \"#{name}-#{related_files.max + 1}#{SWATCHES_EXTENSION}\"\n else\n \"#{name}#{SWATCHES_EXTENSION}\"\n end\n\n @swatches_path = File.join(options[:export_directory], filename)\n end",
"def generate_name\n @seed ||= 0\n @seed += 1\n \"_anon_#{@seed}\"\n end",
"def generate_filename(filename)\n\t\t# Just some entropy to prevent collisions... not trying\n\t\t# to protect any information.\n\t\tfilename = \"#{filename}:#{SecureRandom.hex(10)}:#{Time.now}\"\n\n\t\tdigest = Digest::SHA256.new\n\t\treturn digest.hexdigest filename\n\tend",
"def to_engine_name(name)\n return nil unless name.instance_of?(String)\n name.underscore.gsub(/\\//, '_')\n end",
"def make_file_name(proposal, type='paltrack')\n @filename = \"item_export_#{Time.now.strftime('%Y%m%d%H%M%S')}.csv\"\n end",
"def makeNewFilename\n # note use of hard coded 6 digit counter width - is this enough files?\n pad = \"0\" * (6 - @count.to_s.length) + count.to_s\n newbase = @baseFilename.sub(/(\\.\\w*)$/, pad + '\\1')\n @filename = File.join(File.dirname(@filename), newbase)\n Logger.log_internal {\"File #{@filename} created\"}\n end",
"def human_from_name; end",
"def conformScoreName(name, engine)\n base = \n case engine\n when \"X! Tandem (k-score)\"\n \"xtandem\"\n when \"X! Tandem\"\n \"xtandem\"\n when \"MASCOT\"\n \"mascot\"\n when \"OMSSA\"\n \"OMSSA\"\n when \"Tide\"\n \"sequest\"\n when \"Phenyx\"\n \"Phenyx\"\n when \"SpectraST\"\n \"SpectraST\"\n end\n \n [base, name].join(':')\n end",
"def make_file_name(proposal, type='paltrack')\n @filename = \"sales_export_#{Time.now.strftime('%Y%m%d%H%M%S')}.csv\"\n end",
"def unique_name(name)\n \"#{name}_#{Time.now.to_i}\"\n end",
"def unique_name(name)\n \"#{name}_#{Time.now.to_i}\"\n end",
"def short_name( fn )\n #puts \"Calculate short name for #{fn}\\n\"\n return fn if ARCH != 'w32'\n fn.gsub!( /\\//, \"\\\\\" )\n buffer = ' ' * 260\n length = ShortPName.call( fn, buffer, buffer.size )\n fn = buffer.slice(0..length-1) if length > 0\n fn.gsub!( /\\\\/, '/' )\n return fn\nend",
"def random_name(basename = \"maestro\")\n parts = (basename.nil? or basename.empty? ? \"maestro\" : basename).split(\".\")\n parts[0]=\"#{parts[0]}#{name_split_char}#{(0...5).map{ ('a'..'z').to_a[rand(26)] }.join}\"\n parts.join(\".\")\n end",
"def construct_file_label( number, source_name, generic_work )\n\n unknown = 'UNKNOWN'\n last_name = generic_work.author_last_name.blank? ? unknown : generic_work.author_last_name.split( ' ' ).first\n first_name = generic_work.author_first_name.blank? ? unknown : generic_work.author_first_name.split( ' ' ).first\n year = generic_work.date_published.blank? ? unknown : generic_work.date_published\n degree = generic_work.degree.blank? ? unknown : generic_work.degree.split( ' ' ).first\n suffix = File.extname( source_name )\n\n return \"#{number}_#{last_name}_#{first_name}_#{year}_#{degree}#{suffix}\"\n end",
"def makeObjectFileName(fileName)\n # substitution of '_' with '__' prevents collisions\n @build.buildPath + \"/\" + fileName.gsub('_', '__').gsub('/', '_').gsub('.', '_') + \".o\"\n end",
"def get_basic_name(linker, bb)\n prefix = bb.get_output_prefix(linker)\n return \"#{prefix}#{bb.name}#{bb.shared_suffix(linker)}\"\n end",
"def name\n @name ||= filename.split(\".\").first.sub(/^_/, \"\")\n end",
"def make_name(key = '')\n ## If you don't dup these, words will get concatenated onto them during the join process\n genitive = self.genitive.dup\n definitive = self.definitive.dup\n\n while true\n # 50% chance that the name will be a single word, 50% chance that it will be two words combined somehow\n name = rand < 0.5 ? get_word(key) : nil\n if name.nil?\n # 60% chance that each word will use the same key as invoked\n w1_key = rand < 0.6 ? key : ''\n w1 = get_word(w1_key).capitalize\n w2_key = rand < 0.6 ? key : ''\n w2 = get_word(w2_key).capitalize\n\n # 50% chance to be joined without the lang's genitive word\n if rand > 0.5\n name = join([w1, w2], self.joiner)\n else\n name = join([w1, genitive, w2], self.joiner)\n end\n end\n\n # 10% to prefix with definitive\n name = join([definitive, name], self.joiner) if rand < 0.1\n\n # Generate another one if this doesn't meet the min- or maxchar reqs\n next if (name.length < self.minchar) || (name.length > self.maxchar)\n\n name.capitalize!\n\n # Check to see if this string has already been generated\n used = false\n self.names.each do |lang_name|\n if (name.include? lang_name) || (lang_name.include? name)\n used = true\n break\n end\n end\n\n # Start over if this name exists already\n next if used\n\n self.names << name\n return name\n end\n end",
"def create_filename(prev_name)\n prev_name[/\\d+$/] ? prev_name.next : prev_name + '02'\n end",
"def hash_to_file_name(hash)\n version = \"-#{hash[:version]}\" if hash[:version]\n classifier = \"-#{hash[:classifier]}\" if hash[:classifier]\n \"#{hash[:id]}#{version}#{classifier}.#{extract_type(hash[:type]) || DEFAULT_TYPE}\"\n end",
"def unique_object_name_for(name)\n \"#{name}_#{SecureRandom.hex(5)}\"\n end",
"def file_name(name)\r\n return name.to_s.downcase + '.rb' if name.kind_of?(Symbol)\r\n return ext_name(name).downcase + '.rb'\r\n end",
"def build_feature_filename(feature)\n features_subdir = \"#{Rails.root}/#{get_tag_dir}\"\n Dir.mkdir features_subdir unless Dir.exists?(features_subdir)\n \"#{features_subdir}#{feature.id}_#{feature.subject.parameterize}.feature\"\n end",
"def base_filename; class_to_filename(name.gsub(/.*:/, '')); end",
"def make_queue_name(klass)\n name = klass.dup\n name.gsub!(/::/, '/')\n name.gsub!(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2')\n name.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n name.tr!(\"-\", \"_\")\n name.downcase!\n name\n end",
"def name2fn (name)\n sec=$sections_by_name[canonize(name)]\n return \"badSectionlink.htm#\"+name unless sec\n cnum=pad(sec.chapnum)\n snum=pad(sec.secnum)\n if $opt_c\n res=\"chap#{cnum}.htm\"\n res<< \"#SECT#{snum}\" unless snum==\"000\"\n return res\n else\n return \"c#{cnum}s#{snum}.htm\"\n end\nend",
"def generate_name_target(opts={})\n # check if file already renamed to YYYYMMDD-hhss-AAA[AAA] format\n if (/^(\\d{8}-\\d{4}[-_]\\w{3,6}[_]\\w{1,13}[_])(.*)/ =~ @name)\n name_clean = $2\n elsif (/^(\\d{8}-\\d{6}[-_]\\w{3,6}[-_ ])(.*)/ =~ @name)\n name_clean = $2\n elsif (/^(\\d{8}-\\d{4}[-_]\\w{3,6}[-_ ])(.*)/ =~ @name)\n name_clean = $2\n # check if file already renamed in YYYYMMDD-hhss format\n elsif (/^(\\d{8}-\\d{4}[-_ ])(.*)/ =~ @name)\n name_clean = $2\n elsif (/^(\\d{8}_)(.*)/ =~ @name)\n name_clean = $2\n # for all others just rename\n else\n name_clean = @name\n end\n# opts[:date_time_original].strftime('%Y%m%d-%H%M%S')+\"_#{opts[:author_nikname]}_#{opts[:file_format]}#{name_clean}\"\n opts[:date_time_original].strftime('%Y%m%d-%H%M%S')+\"_#{opts[:author_nikname]} #{name_clean}\"\n end",
"def filename()\n @name ||= \"#{SecureRandom.hex()}.png\"\n end",
"def createValidName(inname)\r\n $LOG.debug \"PpmContext::createValidName( #{inname} )\"\r\n outname = inname.gsub(/[\\s\\/\\\\?*#+]/,'') # Remove illegal chars (replace with underscore).\r\n outname.gsub!(/_+/,\"_\") # Replace consecutive uscores with single uscore.\r\n outname.gsub!(/\\./,\"-\") # Replace period with dash.\r\n outname.gsub!(/[\\(\\)\\$]/,\"\") # Remove L & R Parens, dollar signs.\r\n outname.gsub!(/\\%/,\"Perc\") # Replace '%' with Perc.\r\n\r\n outname\r\n end",
"def calc_program_name project_symbol\n camel_to_snake_case(project_symbol).downcase\n end",
"def name_to_file(name)\n array = name.scan(/[A-Z][a-z]*/)\n raise TypeError, Ajaila::Messager.warning(\"The name of variable should start with capital letter: \\\"table:MyTable\\\"\") if array == []\n return array.map(&:downcase).join(\"_\")\n end",
"def otm_get_file_name_for(sym)\n f = self.generate_tmp_file_name(sym)\n case sym\n when :mysql_commands \n \"#{f}.sql\"\n when :oracle_commands\n \"#{f}.sql\" # sqlplus is such a jackass, the file name must end in .sql for it to work, fyi\n when :oracle_output\n \"#{f}.txt\"\n else\n raise \"Invalid file_name #{sym}\"\n end\n end",
"def filename_for(diagram, name_option)\n base_name = diagram_base_name(diagram, name_option)\n if @diagram_base_names.include?(base_name)\n idx = 2\n idx += 1 while @diagram_base_names.include?(base_name + \" - #{idx}\")\n base_name += \" - #{idx}\"\n end\n base_name\n end",
"def ext_name(name)\r\n return name.to_s if name.kind_of?(Symbol)\r\n return name.gsub(/\\s/, '_')\r\n end",
"def build_converted_file_name(source, from_lang, to_lang)\n # Get components of filename\n dirname = File.dirname(source)\n basename = File.basename(source, \".*\")\n extname = File.extname(source)\n\n # Blank out the from language\n basename.sub! Regexp.new(\"_#{from_lang}\", \"i\"), \"\"\n \n \"#{dirname}/#{basename}_#{to_lang}#{extname}\"\n end",
"def name() @filename end",
"def file_name\n name.underscore\n end",
"def unique_format_name\n string_with_id(name.observation_name)\n rescue StandardError\n \"\"\n end",
"def make_filename(file_index)\n return SAVE_PATH + SAVE_FILE_NAME.gsub(/\\{ID\\}/i) { (file_index + 1).to_s }\n end",
"def ga_to_method_name(name)\n snakecase(name.gsub(/\\Aga:/, \"\")).to_sym\n end",
"def make_url_friendly( name )\n return name.strip.gsub(/[^A-Za-z0-9_]/, '+')\n end",
"def default_name\n return unless name\n Dry::Core::Inflector.underscore(name).tr('/', '_').to_sym\n end",
"def new_file name\n raise \"Not a Valid Directory\" unless valid_directory?\n\n file_name = \"#{Time.now.strftime(\"%Y%m%d%H%M%S\")}_#{name}.txt\"\n \"#{output_directory_path}#{file_name}\"\n end",
"def synthesize_job_name\n klass_name = name.scan(/[^:]+/).last\n klass_name = klass_name[/(.+)Job/, 1] || klass_name\n klass_name.scan(/[A-Z][a-z]+/).map(&:downcase).join('_').to_sym\n end",
"def default_file_name\n \"#{klass_name.underscore}_#{id}\"\n end",
"def Name(name)\n\tname = SecureRandom.alphanumeric\nend",
"def generate_name_with_digit (digit)\n char_array = ('a'..'z').to_a + ('0'..'9').to_a + ['_'] # char_array.length is 37\n\n quotient = digit\n queue = []\n while true do\n queue.push quotient % N_CHAR\n quotient = (quotient / N_CHAR).round - 1\n if quotient <= -1\n break\n end\n end\n\n name = ''\n while queue.any? do\n name = name + char_array[queue.pop]\n end\n name\n end",
"def gen_filename\n name = @issue[\"created\"].strftime(\"%Y-%m-%d-\") + \n @issue[\"title\"].gsub(/\\W+/, \"_\") +\n \".yaml\"\n n = 1\n while File.exist?(File.join(@dir, name))\n name = File.basename(name, \".yaml\") + \"-\" + n.to_s + \".yaml\"\n n += 1\n end\n\n name\n end",
"def unique_resource_name(build_option_name, suffix)\n normalised_name = build_option_name.downcase.gsub(/[^a-z]+/, '-')\n \"#{normalised_name}##{suffix}\"\n end",
"def unique_format_name\n title = all_subjects.map(&:format_name).uniq.sort.join(\" & \")\n if title.blank?\n :image.l + \" ##{id || \"?\"}\"\n else\n title + \" (#{id || \"?\"})\"\n end\n end",
"def algorithm=(alg)\n return @algorithm if Algorithm::EXISTING == alg\n case alg\n when String\n @algorithm = Algorithm.algorithm_from_name(alg)\n when ::HTAuth::Algorithm\n @algorithm = alg\n else\n raise InvalidAlgorithmError, \"Unable to assign #{alg} to algorithm\"\n end\n return @algorithm\n end",
"def normalize_name\n lower = @name.downcase\n non_word = lower.gsub(/\\W/,'_').gsub(/_+/,'_')\n normalized = non_word.split('_').compact.join('_')\n [normalized, Digest::SHA1.hexdigest(@name)[0..10]].join('_')\n end",
"def filename\n @name ||= \"#{timestamp}-#{secure_token(8)}.#{file.extension}\" if original_filename.present?\n end",
"def temp_action_name\n file_name = \"action_#{@platform_info[\"language\"]}_#{precision_timestamp}.#{@platform_info[\"ext\"]}\"\n end",
"def otm_get_file_name_for(sym)\n f = self.generate_tmp_file_name(sym)\n case sym\n when :mysql_commands, :oracle_commands\n \"#{f}.sql\" # sqlplus is such a jackass, the file name must end in .sql for it to work, fyi\n when :oracle_output\n \"#{f}.txt\"\n else\n raise \"Invalid file_name #{sym}\"\n end\n end",
"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",
"def set_unique_name\n salt = rand 1000000\n salt2 = rand 100\n if self.title.blank?\n self.unique_name = \"#{salt}_#{salt2}\" \n else\n self.unique_name = \"#{self.title.gsub(/[^\\w\\.\\-]/,'_').downcase}_#{salt}\"\n end\n end",
"def layar_name\n \t\"apollo\" + self.name.strip.downcase.gsub(/[^a-z0-9]/, '')\n end",
"def current_image_filename\n \"#{name.downcase.gsub(' ', '')}certification.png\"\n end",
"def make_filename(file_index)\r\n return \"Save#{file_index + 1}.rxdata\"\r\n end",
"def unmiga_name\n gsub(/_(str|sp|subsp|pv)__/,\"_\\\\1._\").tr('_', ' ')\n end",
"def to_name\n basename.to_s.sub extname, ''\n end",
"def calculate_file_name(file_path,file_name)\n file_sha = Digest::SHA256.file(file_path)\n \"#{file_sha}_#{file_name}\"\n end",
"def set_algorithm_name\n @algorithm_name = AlgorithmName.find(params[:id])\n end",
"def progname; \"Dis-organizer\"; end",
"def progname; \"Dis-organizer\"; end",
"def progname; \"Dis-organizer\"; end",
"def build_audio_file_name\n return track.build_audio_file_name(segment_artist, record, segment, genre)\n end",
"def create_short_filename(tv, q, f)\n ext = helper_make_ext(q,f)\n \"#{tv['track_key']}.#{ext}\"\n end"
] | [
"0.64403033",
"0.6133815",
"0.6062381",
"0.60166794",
"0.6015186",
"0.5975764",
"0.59757346",
"0.5946585",
"0.59103715",
"0.5874238",
"0.5863449",
"0.58564645",
"0.58420175",
"0.5806091",
"0.5801089",
"0.577255",
"0.57408434",
"0.57219",
"0.57114017",
"0.57091564",
"0.5704789",
"0.5699168",
"0.5687483",
"0.5680637",
"0.5676056",
"0.56680155",
"0.5646098",
"0.56439877",
"0.5635213",
"0.5627969",
"0.56177264",
"0.5612304",
"0.5581254",
"0.5580624",
"0.55792594",
"0.5566803",
"0.55658334",
"0.5560068",
"0.5559152",
"0.5555105",
"0.555237",
"0.555237",
"0.5549994",
"0.5549502",
"0.55400753",
"0.5530126",
"0.5527698",
"0.5525795",
"0.5518732",
"0.5510573",
"0.5503798",
"0.5502212",
"0.54879045",
"0.54856336",
"0.54842687",
"0.54717445",
"0.5469479",
"0.5460314",
"0.54579836",
"0.5450055",
"0.5448294",
"0.54352194",
"0.54334515",
"0.54299414",
"0.54239005",
"0.5420349",
"0.5416603",
"0.5414468",
"0.54117054",
"0.54085714",
"0.5405067",
"0.53945",
"0.5389227",
"0.53781044",
"0.53748494",
"0.5370951",
"0.5363749",
"0.5360958",
"0.53604376",
"0.535541",
"0.53457046",
"0.5345159",
"0.5343846",
"0.53379047",
"0.533686",
"0.5331769",
"0.53278357",
"0.53254807",
"0.5323567",
"0.5322556",
"0.5318371",
"0.5309247",
"0.5305081",
"0.5304906",
"0.53021544",
"0.53001446",
"0.53001446",
"0.53001446",
"0.529804",
"0.52961135"
] | 0.7438881 | 0 |
Note that this will be called in parallel, so it needs to be threadsafe. | def process_note_input(note_input)
state = @options.color_scheme.solved_cube_state(@options.cube_size)
@solved_mask&.apply_to(state)
note_input.modified_alg.inverse.apply_to(state)
@visualizer.fetch_and_store(state, absolute_output_path(note_input.image_filename))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lock; end",
"def lock; end",
"def lock; end",
"def thread()\n #This is a stub, used for indexing\n end",
"def private; end",
"def executor; end",
"def executor; end",
"def executor; end",
"def run() end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def thread; end",
"def thread; end",
"def thread; end",
"def sync() end",
"def sync() end",
"def sync() end",
"def sync; end",
"def synchronized?; end",
"def in_parallel?; end",
"def pausable; end",
"def prepareForReuse; end",
"def sync()\n #This is a stub, used for indexing\n end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def lock!; end",
"def parallelize_me!; end",
"def running; end",
"def running; end",
"def io_lock; end",
"def allow_concurrency; end",
"def allow_concurrency; end",
"def post_process; end",
"def run(_); end",
"def run(_); end",
"def refork; end",
"def robin; end",
"def in_new_thread; end",
"def mutex; end",
"def mutex; end",
"def mutex; end",
"def mutex; end",
"def locked; end",
"def fsync()\n #This is a stub, used for indexing\n end",
"def run\n end",
"def processor; end",
"def queue; end",
"def queue; end",
"def used?; end",
"def call\n advance until done?\n end",
"def perform\n \n end",
"def finished; end",
"def run\n \n end",
"def run\n \n end",
"def perform; end",
"def perform; end",
"def flush()\n #This is a stub, used for indexing\n end",
"def multi; end",
"def finish_synchronize; end",
"def process\n end",
"def ready; end",
"def ready; end",
"def run\n raise \"Not implemented yet.\"\n end",
"def finalized; end",
"def lock\n end",
"def next() end",
"def next() end",
"def next()\n \n end",
"def next()\n \n end",
"def run\n end",
"def done; end",
"def finish()\n #This is a stub, used for indexing\n end",
"def process\n raise \"Must be implemented\"\n end",
"def probers; end",
"def runnables; end",
"def calls; end",
"def calls; end",
"def run; raise NotImplementedError; end",
"def run; raise NotImplementedError; end",
"def flush; end",
"def flush; end",
"def flush; end",
"def flush; end",
"def flush; end",
"def producer; end",
"def next_result()\n #This is a stub, used for indexing\n end",
"def call\n # implement in subclasses\n end",
"def implementation; end"
] | [
"0.66191655",
"0.66191655",
"0.66191655",
"0.6590784",
"0.6361765",
"0.63361984",
"0.63361984",
"0.63361984",
"0.6144356",
"0.6138351",
"0.6138351",
"0.6138351",
"0.6138351",
"0.6138351",
"0.6138351",
"0.6138351",
"0.6138351",
"0.6138351",
"0.6134933",
"0.6134933",
"0.6134933",
"0.6101819",
"0.6101819",
"0.6101819",
"0.61001426",
"0.6044479",
"0.6035944",
"0.59989345",
"0.59857184",
"0.59025127",
"0.5888266",
"0.5888266",
"0.5888266",
"0.5888266",
"0.5888266",
"0.5888266",
"0.5888266",
"0.5888266",
"0.58707535",
"0.58457875",
"0.5771731",
"0.5771731",
"0.5764522",
"0.57301384",
"0.57301384",
"0.5722568",
"0.5701674",
"0.5701674",
"0.5699552",
"0.566739",
"0.5636691",
"0.56278205",
"0.56278205",
"0.56278205",
"0.56278205",
"0.56268775",
"0.5594652",
"0.5542576",
"0.5538862",
"0.5516353",
"0.5516353",
"0.5506952",
"0.54995596",
"0.54886425",
"0.5484971",
"0.54503244",
"0.54503244",
"0.5450095",
"0.5450095",
"0.5440383",
"0.5439649",
"0.5402535",
"0.54024875",
"0.53739625",
"0.53739625",
"0.53726935",
"0.5368155",
"0.53496885",
"0.5346105",
"0.5346105",
"0.5337963",
"0.5337963",
"0.5329947",
"0.5314394",
"0.53101224",
"0.53023505",
"0.5300242",
"0.5294855",
"0.5285814",
"0.5285814",
"0.5272482",
"0.5272482",
"0.5266802",
"0.5266802",
"0.5266802",
"0.5266802",
"0.5266802",
"0.52538663",
"0.5244898",
"0.5241415",
"0.52411467"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_status
@status = Status.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def status_params
params.require(:status).permit(:title, :status_group_id, :sorter)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def valid_params_request?; end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end"
] | [
"0.69811666",
"0.6782836",
"0.6747644",
"0.6742015",
"0.6735273",
"0.6593917",
"0.65037674",
"0.6498627",
"0.6482372",
"0.64795715",
"0.64566946",
"0.6439213",
"0.6380714",
"0.6378147",
"0.63657266",
"0.63206697",
"0.6300169",
"0.62992156",
"0.6295538",
"0.62943023",
"0.62915146",
"0.6290595",
"0.62824667",
"0.62420255",
"0.62403506",
"0.6217174",
"0.6213706",
"0.62112075",
"0.6194868",
"0.6178784",
"0.6174678",
"0.6172499",
"0.61630744",
"0.61544263",
"0.615248",
"0.6147727",
"0.61221075",
"0.6119646",
"0.61076134",
"0.6106584",
"0.6094013",
"0.6081423",
"0.6071337",
"0.6063637",
"0.6021453",
"0.6018253",
"0.60161054",
"0.60112554",
"0.60071784",
"0.60071784",
"0.60004836",
"0.6000254",
"0.5999255",
"0.59930664",
"0.59919107",
"0.5991741",
"0.5980763",
"0.59663844",
"0.59605104",
"0.5960486",
"0.5959414",
"0.5957901",
"0.59538954",
"0.5953327",
"0.59450173",
"0.59391475",
"0.59391475",
"0.59386194",
"0.59351885",
"0.593139",
"0.5926316",
"0.5925927",
"0.59176016",
"0.59119296",
"0.5909275",
"0.5908221",
"0.59053046",
"0.58983994",
"0.58980995",
"0.58964473",
"0.5895902",
"0.5893993",
"0.58927304",
"0.5887752",
"0.58841616",
"0.5880381",
"0.58752084",
"0.586956",
"0.5868584",
"0.58679324",
"0.5867004",
"0.58667004",
"0.58642864",
"0.5863347",
"0.58626384",
"0.58615845",
"0.58594906",
"0.5854959",
"0.5854423",
"0.58506453",
"0.5850135"
] | 0.0 | -1 |
Return an image tag for the club avatar thumbnail. | def clubthumbnail_tag(club)
image_tag(club.clubavatar.thumbnail_url, :border => 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile_image_thumbnail\n image_path = profile_user_image.present? ? profile_user_image.image.url(:thumbnail) :\n DEFAULT_USER_PROFILE_IMAGE_NAME\n\n h.image_tag image_path, class: 'img-thumbnail', alt: full_name\n end",
"def profile_image_miniature\n image_path = profile_user_image.present? ? profile_user_image.image.url(:miniature) :\n DEFAULT_USER_PROFILE_IMAGE_NAME\n\n h.image_tag image_path, class: 'img-thumbnail', alt: full_name\n end",
"def artist_avatar\n if self.avatar.attached?\n image_tag artist.avatar\n else\n image_tag 'default_avatar.jpg'\n end\n end",
"def avatar_for_small(post)\n if post.picture?\n image_tag post.picture.url(:thumb)\n else \n image_tag \"thumb/profile.jpg\"\n end\n end",
"def user_thumbnail(user)\n if user.thumbnail.present?\n image_tag(user.thumbnail, border: 0)\n else\n image_tag('assets/images/default_image.jpg', border: 0)\n end\n end",
"def render_super_tiny_avatar_for(user)\n if user.avatar?\n image_tag(user.avatar.small.url, class: 'media-object thumbnail').html_safe\n else\n image_tag('fallback/default.gif', height: '35px', width: '35px', class: 'media-object thumbnail').html_safe\n end\n end",
"def avatar_img\n \"https://cdn.discordapp.com/avatars/#{id}/#{avatar}.webp?size=1024\"\n end",
"def avatar_img\n \"https://cdn.discordapp.com/avatars/#{id}/#{avatar}.webp?size=1024\"\n end",
"def thumbnail_image(size = :medium)\n if !remote_image.blank?\n return \"http://fffff.at/tempt1/photos/data/eyetags/thumb/#{self.attributes['remote_image'].gsub('gml','png')}\"\n # elsif Rails.env == 'development' && !File.exist?(self.image_path(size)) #don't do image 404s in development\n # return \"/images/defaults/tag_#{size.to_s}.jpg\"\n else\n return self.image(size)\n end\n end",
"def user_profile_img(user)\n if user.avatar?\n return image_tag(user.avatar, alt: user.name, size: \"60x60\")\n else\n img_url = 'no_image.png'\n end\n image_tag(img_url, alt: user.name, size: \"60x60\")\n end",
"def avatar_for(user, size=32)\n image_location = if user.avatar.nil? || user.avatar.empty?\n \"http://www.gravatar.com/avatar.php?gravatar_id=#{MD5.md5(user.email)}&rating=PG&size=#{size}\"\n else\n sanitize(user.avatar)\n end\n image_tag image_location, :size => \"#{size}x#{size}\", :class => 'photo'\n end",
"def avatar_photo (person)\n if person.image.attached?\n image_tag person.image\n else\n image_tag \"static/placeholder.jpg\"\n end\n end",
"def avatar\n \"https://cdn.discordapp.com/avatars/#{@obj['id']}/#{@obj['avatar']}.webp?size=1024\"\n end",
"def profile_image(profile)\n url = Gravatar.new(profile.display_email || '@').image_url size: 40,\n secure: true, default: :mm\n image_tag url, alt: \"gravatar for #{profile.name}\",\n style: 'width: 40px; height: 40px;'\n end",
"def picture\n if self.avatar?\n self.avatar.url\n elsif self.image_url != nil\n self.image_url\n else\n 'generic_avatar'\n end\n end",
"def thumbnail_url\n @thubnail_url ||= url_for_format('thumbnail', 'png')\n end",
"def thumbnail_for(user, size)\n if user.photos.any?\n if size == \"small\"\n image_tag user.photos.first.image.url(:small), alt: user.name, width: \"50\", height: \"50\"\n else\n image_tag user.photos.first.image.url(:avator), alt: user.name, width: \"200\", height: \"150\"\n end \n else\n default_gender_image(user,size)\n end\n end",
"def render_answer_avatar_for(user)\n if user.avatar?\n image_tag(user.avatar.tiny.url, class: 'media-object tiny-thumbnail').html_safe\n else\n image_tag('fallback/default.gif', height: '30px', width: '30px', class: 'media-object tiny-thumbnail').html_safe\n end\n end",
"def render_tiny_avatar_for(user)\n if user.avatar?\n image_tag(user.avatar.tiny.url).html_safe\n else\n image_tag('fallback/default.gif', height: '35px', width: '35px').html_safe\n end\n end",
"def thumbnail_name\n \"#{@user.screen_name}_thumbnail.png\"\n end",
"def user_avatar(user)\n user.avatar ? user.avatar.photo.url(:thumb) : \"default-avatar.jpg\"\n end",
"def thumb_url\n image.url(:thumbnail)\n end",
"def thumb_url\n image.url(:thumbnail)\n end",
"def avatar_tag(person, options={})\n style_name = options.delete(:style_name) || :small\n image_options = {\n :width => 50,\n :height => 50,\n :alt => \"avatar\",\n :title => person.name}.merge(options)\n image_tag(person.avatar.url(style_name), image_options)\n end",
"def avatar(object, size=200, return_image_tag_only=false, url=nil, alt=nil, show_tooltip=true)\n alternative = \"\"\n if show_tooltip\n tooltip_text = (alt.nil? ? h(object.name) : alt)\n else\n alternative = (alt.nil? ? h(object.name) : alt) \n end\n \n case object.class.name.downcase\n when \"person\", \"institution\", \"project\"\n if object.avatar_selected?\n img = image_tag avatar_url(object, object.avatar_id, size), :alt=> alternative, :class => 'framed'\n else\n img = null_avatar(object.class.name, size, alternative)\n end\n end\n \n # if the image of the avatar needs to be linked not to the url of the object, return only the image tag\n if return_image_tag_only\n return img\n else \n unless url\n url = eval(\"#{object.class.name.downcase}_url(#{object.id})\")\n end\n return link_to(img, url, :title => tooltip_text)\n # return link_to(img, url, :title => tooltip_title_attrib(tooltip_text))\n end\n end",
"def avatar_for(size = 32, options = {})\n avatar = if size.class == String && size.end_with?('%')\n user.user_profile.public_avatar_url(:sq200)\n elsif size <= 35\n user.user_profile.public_avatar_url(:sq35)\n elsif size <= 100\n user.user_profile.public_avatar_url(:sq100)\n elsif size <= 200\n user.user_profile.public_avatar_url(:sq200)\n else\n user.user_profile.public_avatar_url\n end\n image_tag(avatar, width: size, class: options[:class] ? options[:class] : 'image')\n end",
"def avatar_for(model, args = {})\n args = {:class => 'avatar', :size => '48x48'}.merge(args)\n if model.avatar && model.avatar.has_image?\n image_tag(model.avatar.image.url(Avatar.styles[args[:size]]), args)\n elsif model.respond_to?(:email)\n gravatar_image_tag(model.email, {:gravatar => {:default => default_avatar_url}}.merge(args))\n else\n image_tag(\"avatar.jpg\", args)\n end\n end",
"def thumbnail_name\n \"#{@user.name}_thumbnail.png\"\n end",
"def linked_in_avatar(user)\n image_tag(user.user_info[\"linked_in\"][\"image\"])\n end",
"def avatar_url(avatar_size=\"small\")\n if self.has_shelby_avatar\n return self.shelby_avatar_url(avatar_size)\n else\n return self.user_image_original || self.user_image || \"#{Settings::ShelbyAPI.web_root}/images/assets/avatar.png\"\n end\n end",
"def profile_image_tag(person, options = {})\n source = profile_image_source(person, options)\n options[:link_uri] = person_path(person) if add_image_link?(options)\n options[:alt_text] = \"Current photo of #{person}\"\n profile_or_team_image_div source, options\n end",
"def get_image_profile_pic\n last_pic = images.where(\"kind = ?\", \"profile_pic\").last\n\n if last_pic.nil?\n return \"/assets/octacat-resized.png\"\n else\n last_pic.url\n end\n end",
"def avatar_for(user, size=80)\n user.avatar.attached? ? image_tag(url_for(user.set_avatar(size)), class: \"avatar\") : gravatar_for(user, size)\n end",
"def avatar\n image = images.where(:thumbnail => true).first \n if image.present?\n { :original => image.url(\"original\"),\n :listing => image.url(\"listing\"),\n :mini => image.url(\"mini\"),\n :thumb => image.url(\"thumb\") }\n end\n end",
"def image_avatar_tag(person, options={})\n options = {:size => '35x35', :anonymous => false}.merge(options).symbolize_keys\n anonymous = !!options.delete(:anonymous)\n image_tag(image_avatar_path(person, {:anonymous => anonymous}.merge(options)), \n {:alt => person ? (anonymous ? \"\" : h(person.username_or_name)) : \"\", \n :title => person ? (anonymous ? \"\" : h(person.username_or_name)) : \"\"}.merge(options))\n end",
"def thumbnail_url\n return if picture.nil?\n\n crop = crop_values_present? || content.settings[:crop]\n size = render_size || content.settings[:size]\n\n options = {\n size: thumbnail_size(size, crop),\n crop: !!crop,\n crop_from: crop_from.presence,\n crop_size: crop_size.presence,\n flatten: true,\n format: picture.image_file_format,\n }\n\n picture.url(options) || \"alchemy/missing-image.svg\"\n end",
"def avatar_url\n \"https://avatars.githubusercontent.com/u/#{uid}?v=2\"\n end",
"def render_comment_avatar_for(comment_user)\n if comment_user.avatar?\n image_tag(comment_user.avatar.profile.url, class: \"media-object thumbnail\").html_safe\n else\n image_tag('fallback/default.gif', height: '55px', width: '55px', class: 'media-object thumbnail').html_safe\n end\n end",
"def avatar_url\n avatar_uri(object)\n end",
"def avatar_url\n\t\t\"http://zombitar.com/#{id}.jpg\"\n\tend",
"def avatar(avatar_holder)\n if avatar_holder.avatar.attached?\n avatar = avatar_holder.avatar\n else\n avatar = \"https://arena-fighter.s3.eu-west-3.amazonaws.com/avatar.jpg\"\n end\n end",
"def image\n (object.image_url.nil? || object.image_url.empty?) ? h.content_tag(:span,\"\",class: \"glyphicon glyphicon-picture\") : h.image_tag(object.image_url)\n end",
"def author_avatar_for_post(post)\n if post.user.avatar?\n url = post.user.avatar.url(:thumb)\n else\n url = \"https://s3.amazonaws.com/scvrush/uploads/post/featured_image/100x100_dark.png\"\n end\n return image_tag(url)\n end",
"def thumbnail_url\n company.image.url(:thumbnail)\n end",
"def avatar_for(user, size = nil)\n avatar_tag user.avatar, size, user.name if user.is_a? User\n end",
"def fb_avatar_tag(fb_id = nil, type = :square)\n if fb_id\n tag(:img, src: fb_avatar(fb_id, type), alt: \"Facebook Avatar for User #{fb_id}\")\n end\n end",
"def avatar_image\n avatar_data = NSData.alloc.initWithContentsOfURL(NSURL.URLWithString(avatar_url))\n image = UIImage.alloc.initWithData(avatar_data)\n end",
"def startIndivThumbnail image\n return \"\n <li class='span3'>\n <div class='thumbnail'>\n <img id='peopleImg' src= #{image} >\n <div class='caption'> \"\n end",
"def thumbnail(geometry = nil)\n if geometry.is_a?(Symbol) and Refinery::Images.user_image_sizes.keys.include?(geometry)\n geometry = Refinery::Images.user_image_sizes[geometry]\n end\n\n if geometry.present? && !geometry.is_a?(Symbol)\n image.thumb(geometry)\n else\n image\n end\n end",
"def display_profile_image\n if self.picture.present? && self.picture.url(:small).present?\n self.picture.url(:small)\n else\n ActionController::Base.helpers.asset_path('user.png')\n end\n end",
"def image\n return unless resource.avatar\n \"#{Seek::Config.site_base_host}/#{resource.class.table_name}\" \\\n \"/#{resource.id}/avatars/#{resource.avatar.id}?size=250\"\n end",
"def current_avatar\n logged_in? ? \n image_tag(\"/avatar/show?secret_code=#{session[:secret_code]}&\", :alt => current_user.login) : # The '&' is a hack to prevent the appended .png from spoiling the call\n image_tag('id_image.gif', :alt => \"ID Image\", :size => '70x70')\n end",
"def avatar(html_options: {}, options: {})\n html_options = {\n alt: object.name\n }.merge(html_options)\n\n helpers.image_tag(avatar_url(options), html_options)\n end",
"def role_avatar\n \"/assets/#{role}_profile_pics/thumb/missing.png\"\n end",
"def thumbnail_image\n end",
"def get_thumbnail(id)\n\n avatar_url = Rails.cache.fetch(\"/avatar_urls/#{id}\", :expires_in => 10.minutes) do\n puts \"cache miss\"\n begin\n Box.admin_client.user_from_id(id, fields: [:avatar_url]).avatar_url\n rescue\n puts \"own avatar...\"\n Box.admin_client.user_from_id(session[:box_id], fields: [:avatar_url]).avatar_url\n end\n end\n avatar_url\n end",
"def avatar_url\n uploaded ? avatar.url : \"/assets/no_avatar.png\"\n end",
"def profile_img(uid, type=\"normal\")\n \"http://graph.facebook.com/#{uid}/picture?type=#{type}\"\n end",
"def avatar\n if object.dp.present?\n k = object.dp.url.gsub('upload','upload/g_face,c_thumb,w_150,h_150')\n else\n k = object.avatar\n end\n end",
"def img\n\t if self.upload.try(:image).present?\n\t self.upload.try(:image).url(:thumb)\n\t else\n\t 'images/contests.png'\n\t end\n\tend",
"def avatar_image_tag(user=nil, options = {})\n user ||= current_user\n avatar = user.avatar\n empty = options.delete(:empty) || false\n if avatar\n \"<img src='#{image_path avatar.public_filename}' class='avatar' style='width: #{avatar.width}px; height: #{avatar.height}px' />\"\n elsif empty\n case empty\n when :blank, 'blank'\n image_tag 'noavatar.gif', :class => 'avatar'\n end\n end\n end",
"def tw_image_url(type)\n \"http://api.twitter.com/1/users/profile_image?user_id=#{tw_user_id}&size=#{type}\"\n end",
"def thumbnail_url\n \n PLACEHOLDER_PROJECT_IMAGE_URL\n\n end",
"def render_author_avatar_for(post_user)\n if post_user.avatar?\n image_tag(post_user.avatar.url, class: \"media-object thumbnail\").html_safe\n else\n image_tag('fallback/default.gif', height: '150px', width: '150px', class: 'media-object thumbnail').html_safe\n end\n end",
"def image\n require 'digest/md5'\n \"http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(author_email.downcase)}\"\n end",
"def image\n #images = Musicbrainz_db.get_cover_art(self.id)[\"images\"]\n\n images = SearchModule.get_cover_art(self.id)\n if images != nil\n return images[\"images\"].first[\"thumbnails\"][\"large\"]\n else\n return 'http://djpunjab.in/cover.jpg'\n end\n end",
"def medium_image_tag\n image_tag medium_image_path, alt: @picture.alt_text, class: 'medium-image', title: @picture.title\n end",
"def thumbnail_tiny_url\n album_cover ? album_cover.photo.photo_url_tiny : photos.size > 0 ? photos.first.photo_url_tiny : nil\n end",
"def profile_pic(facebook_id, opts={})\n type = opts.delete(:type) || \"square\" # <= Valid types: square, small, normal, large\n opts = {:class=>\"profile-pic\", :border=>0}.merge(opts)\n image_tag(\"//graph.facebook.com/#{facebook_id}/picture?type=#{type}\", opts)\n end",
"def avatar\n object.avatar.url\n end",
"def the_image\n if object.is_group_conversation?\n object.image.url\n else\n participant = other_participant\n Rails.logger.info \"Error: #{object.inspect}\" unless participant.present?\n participant.avatar_url(:now)\n end\n end",
"def social_profile_image(profile, options = { size: 80 })\n return nil if profile.nil?\n image_tag(profile.image_url, size: options[:size], alt: profile.identity.email)\n end",
"def check_user_image_large(user)\n if user.image.present?\n cl_image_tag user.image, class: \"profile_image_large\"\n else\n image_tag \"avatar.png\"\n end\n end",
"def header_nav_avatar\n if current_user.role? :superadmin\n avatar = current_user.institution.institution_logo.url(:thumb)\n else\n avatar = current_user.user_avatar.url(:thumb)\n end\n\n image_tag(avatar, class: 'img-squared', id: 'nav-user-avatar')\n end",
"def thumbnail_url\n return self.endpoint.thumbnail_url(self.id)\n end",
"def create_thumbnail\n return create_resized_pic(THUMBNAIL_HEIGHT, THUMBNAIL_WIDTH, SIZE_THUMBNAIL)\n end",
"def avatar_url\r\n return @user.avatar_url\r\n end",
"def avatar\n return \"default_user.png\" unless self.job_id.present?\n the_job = Job.where(id: self.job_id).first\n return \"default_user.png\" unless the_job.present?\n the_job.icon_path\n end",
"def get_small_avatar\n KAG.get \"/player/#@nick/avatar/s\"\n end",
"def thumbnail_url\n image_url(\"200x200-fix\") || image_url(\"224x148-fix\") || strip_url\n end",
"def avatar_url(style = :small)\n if avatar_file_name\n avatar.url(style)\n else\n url = avatar.url(style)\n providers.each do |e|\n next unless e.image_url\n\n url = e.image_url\n end\n url\n end\n end",
"def render_tiny_author_avatar_for(post_user)\n if post_user.avatar?\n image_tag(post_user.avatar.tiny.url).html_safe\n else\n image_tag('fallback/default.gif', height: '20px', width: '20px').html_safe\n end\n end",
"def author_avatar\n is_anonymous ? Avatar.default.url : user.profile.avatar.url\n end",
"def avatar_url(user)\n url = \"http://www.gravatar.com/avatar/#{Digest::MD5::hexdigest(user.email)}?d=mm\"\n image_tag(url, :alt => 'Avatar', :class => 'avatar')\n end",
"def get_thumbnail_url\n nil\n end",
"def user_avatar_tag(user, options={})\n options = options.symbolize_keys\n options[:alt] ||= user.username\n options[:class] = Array.wrap(options[:class]) # ensure array\n options[:class] << 'user-avatar' # append 'user-avatar' CSS class\n\n image_tag(user_avatar_url(user, options[:size]), options)\n end",
"def user_avatar(user_id, size)\n user = User.find(user_id)\n if user.avatar.attached?\n image_tag user.avatar.variant(resize: \"#{size}x#{size}\"), height: \"#{size}px\", width: \"#{size}px\"\n else\n image_tag 'default-avatar.png', height: \"#{size}px\", width: \"#{size}px\"\n end\n end",
"def vimeo_thumbnail(format='small')\n thumbnail_id = case format.to_s\n when 'small' then 0\n when 'medium' then 1\n when 'large' then 2\n else 0\n end\n vimeo_info[\"thumbnails\"][\"thumbnail\"][thumbnail_id]\n end",
"def avatar(user, options={})\n return unless user\n options.reverse_merge!(:url => \"/\", :width => 24)\n image_tag avatar_url(user, options), :class => 'avatar', :width => options[:width]\n end",
"def social_image_for(user, options = { size: 80 })\n image_urls = user.social_profiles.pluck(:image_url)\n border = 4\n unless image_urls.empty?\n image_tag(image_urls.sample, size: options[:size] + border,\n alt: user.email, class: \"gravatar\")\n end\n end",
"def social_image_for(user, options = { size: 80 })\n image_urls = user.social_profiles.pluck(:image_url)\n border = 4\n unless image_urls.empty?\n image_tag(image_urls.sample, size: options[:size] + border,\n alt: user.email, class: \"gravatar\")\n end\n end",
"def img\n if self.upload.try(:image).present?\n self.upload.try(:image).url(:thumb)\n else\n 'images/cmn1.jpg'\n end\n end",
"def thumbnail_url\n album_cover ? album_cover.photo.photo_url_small : photos.size > 0 ? photos.first.photo_url_small : nil\n end",
"def thumbnail_url\n return '' if self.variant_image_thumbnail.blank?\n self.variant_image_thumbnail.filename.url\n end",
"def avatar_url(format = nil)\n return API::User.default_avatar(@discriminator) unless @avatar_id\n\n API::User.avatar_url(@id, @avatar_id, format)\n end",
"def generate_thumbnail(image_path, commit_id)\n Gg::ImageProcessing.new(\"#{satellitedir}/#{image_path}\")\n .generate(image_for(commit_id, 'thumbnails'), 'thumbnail')\n end",
"def avatar\n avatar_id.nil? ? Photo.last : Photo.find(avatar_id)\n end",
"def avatar\n if object.avatar.attached?\n if Rails.env === 'production'\n object.avatar.url\n else\n rails_blob_url(object.avatar)\n end\n end\n end",
"def fake_thumbnail(commit_id)\n src = File.join(Rails.public_path, 'mini_dir.png')\n FileUtils.ln_s src, image_for(commit_id, 'thumbnails')\n end",
"def profile_picture_for(user)\n if user.picture?\n image_tag(user.picture.url, alt: user.name, class: \"profile_picture\")\n else\n image_tag(random_default_image, alt: user.name, class: \"profile_picture\")\n end\n end"
] | [
"0.7750083",
"0.72984594",
"0.72029465",
"0.71783537",
"0.7132888",
"0.7103467",
"0.7012389",
"0.70120025",
"0.6947808",
"0.6881491",
"0.68230605",
"0.6801746",
"0.67763066",
"0.67535955",
"0.67494065",
"0.6738214",
"0.67337334",
"0.67268974",
"0.67265147",
"0.6723629",
"0.6722138",
"0.67171913",
"0.67171913",
"0.6716188",
"0.6684043",
"0.6676741",
"0.6669911",
"0.6660547",
"0.6621518",
"0.66200775",
"0.6616183",
"0.66113466",
"0.6604027",
"0.6603058",
"0.6588234",
"0.6584884",
"0.6576441",
"0.6562541",
"0.65477955",
"0.653897",
"0.65341324",
"0.653264",
"0.65021855",
"0.64964",
"0.6492705",
"0.64698493",
"0.6455923",
"0.6452118",
"0.64490724",
"0.6418105",
"0.6416467",
"0.64070207",
"0.6406091",
"0.6404078",
"0.6400681",
"0.6400373",
"0.6398699",
"0.63800704",
"0.6358676",
"0.6358325",
"0.6351612",
"0.6350148",
"0.634477",
"0.6340959",
"0.63312024",
"0.6329733",
"0.6328182",
"0.63221866",
"0.6320195",
"0.63184315",
"0.6317126",
"0.6314911",
"0.6312904",
"0.6311023",
"0.63022697",
"0.6296484",
"0.6294861",
"0.6292021",
"0.6290804",
"0.6287388",
"0.6284808",
"0.6284184",
"0.62816817",
"0.627145",
"0.6269288",
"0.62681425",
"0.6252212",
"0.62506574",
"0.6249197",
"0.6246251",
"0.6246251",
"0.62386847",
"0.62295693",
"0.62222385",
"0.6220059",
"0.62147784",
"0.6207506",
"0.6205058",
"0.6203614",
"0.6187267"
] | 0.8426535 | 0 |
return [string output, string error_message, integer exitcode, boolean exception ] | def execute(cmd)
error_message=""
exception = false
# execute
begin
#output = ` #{cmd} `
output = %x( #{cmd})
#output = system(call "#{cmd}")
retcode = $?.exitstatus
rescue Exception => e
error_message= e.message.red
exception = true
end
#retcode = $?.exitstatus
return { "output" => output, "error" => error_message,
"retcode" => retcode, "exception" => exception }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error(rc)\n return rc[0].strip if rc[2].success?\n\n puts \"ERROR: #{rc[1]}\"\n\n exit(-1)\nend",
"def error(msg, code)\n STDERR.puts msg\n exit code\nend",
"def error(msg, code)\n STDERR.puts msg\n exit code\nend",
"def exitstatus; end",
"def error(msg)\n puts \"#{msg}\\n\\n\"\n exit -1\nend",
"def process_result(result, exit_status); end",
"def error(message, code = 1)\n puts \"custodian: #{message}\"\n exit code\n end",
"def exitstatus(*) end",
"def error(message) puts(message) || exit end",
"def generate_error(args, response)\n \n puts \"Error!\"\n puts response.body\n exit 1\n\nend",
"def system_exitcode(t, stderr, name)\t\n\t\tif t.value.success?\n\t\t\t$logfile.puts \"#{Time.new.strftime(\"%c\")}: #{name} succeded.\"\n\t\t\tif stderr.any?\n\t\t\t\t$logfile.puts \"#{name} output:\"\n\t\t\t\tstderr.readlines.each {|line| $logfile.puts line}\n\t\t\tend\n\t\telse\n\t\t\t$logfile.puts \"#{Time.new.strftime(\"%c\")}: Error in #{name}:\"\n\t\t\tstderr.readlines.each {|line| $logfile.puts line}\n\t\t\texit\n\t\tend\n\tend",
"def exit(res=0) end",
"def handle_errors(output)\n if $? != 0\n puts output\n puts \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n puts \"~ FATAL: Command failed with status #{$?}\"\n exit 1\n end\nend",
"def er(msg)\n puts \"Error: #{msg}\"\n exit 1\nend",
"def fail(msg, code=1)\n STDERR.puts msg\n exit code\nend",
"def fail(msg, code=1)\n STDERR.puts msg\n exit code\nend",
"def fail(msg, code=1)\n STDERR.puts msg\n exit code\nend",
"def fail(msg, code=1)\n STDERR.puts msg\n exit code\nend",
"def fail(msg, code=1)\n STDERR.puts msg\n exit code\nend",
"def exit_status_from_exception; end",
"def system_exitcode(t, stderr, name)\t\n\t\tif t.value.success?\n\t\t\t$logfile.puts \"#{Time.new.strftime(\"%c\")}: Running #{name} finished.\"\n\t\t\tif stderr.any?\n\t\t\t\t$logfile.puts \"#{name} output:\"\n\t\t\t\tstderr.readlines.each {|line| $logfile.puts line}\n\t\t\tend\n\t\telse\n\t\t\t$logfile.puts \"#{Time.new.strftime(\"%c\")}: Error in #{name}:\"\n\t\t\tstderr.readlines.each {|line| $logfile.puts line}\n\t\t\texit\n\t\tend\n\tend",
"def error_and_exit(msg = nil)\n CE.fg(:yellow)\n puts 'Invalid command error.'\n CE.fg(:red)\n puts \" [Error] #{msg}\" if msg\n CE.fg(:yellow)\n puts \" your command : bucky #{ARGV.join(' ')}\"\n puts ' Please input some commands.'\n puts \" e.g. bucky #{NEW_COMMAND.join(' ')}\"\n puts \" bucky #{RUN_COMMAND.join(' ')}\"\n puts \" bucky #{MAKE_SERVICE_COMMAND.join(' ')}\"\n puts \" bucky #{MAKE_PAGE_COMMAND.join(' ')}\"\n puts \" bucky #{RERUN_COMMAND.join(' ')}\"\n puts \" bucky #{LINT_COMMAND.join(' ')}\"\n exit\nend",
"def exit_code\n # there must be no unit test failures\n # pp @results\n final_exit_code = 0\n if @results['rubocop']\n # more than 10 errors per file on average\n status = @results['rubocop']['total_errors'] / @results['rubocop']['total_files']\n if status > 10\n puts \"More than 10 RuboCop errors per file found. Found #{status}\"\n final_exit_code = 1\n end\n end\n\n if @results['openstudio_style']\n total_files = @results['openstudio_style']['by_measure'].count\n status = @results['openstudio_style']['total_errors'] / total_files\n if status > 10\n puts \"More than 10 OpenStudio Style errors found per file. Found #{status}\"\n final_exit_code = 1\n end\n\n status = @results['openstudio_style']['total_warnings'] / total_files\n if status > 25\n puts \"More than 25 OpenStudio Style warnings found per file, reporting as error. Found #{status}\"\n final_exit_code = 1\n end\n end\n\n if @results['minitest']\n if @results['minitest'][:total_errors] > 0 || @results['minitest'][:total_failures] > 0\n puts 'Unit Test (Minitest) errors/failures found.'\n final_exit_code = 1\n end\n end\n\n # if @results['coverage']\n # status = @results['coverage']['total_percent_coverage']\n # if status < 70\n # puts \"Code coverage is less than 70%, raising error. Coverage was #{status}\"\n # final_exit_code = 1\n # end\n # end\n\n # Since the data are relative to the directory from which it has been run, then just show from current dir (.)\n puts 'Open ./test_results/dashboard/index.html to view measure testing dashboard.'\n\n return final_exit_code\n end",
"def asmError( line, message )\n print \"Error on line \", line, \":\\n\"\n print message\n exit 1\nend",
"def fatal_error(message)\n puts message\n exit -1\nend",
"def die str, exit_code=-1\n dump_help \"****\\n#{str}\\n****\"\n exit exit_code\n end",
"def check_exit_code!(executable, command, output)\n if $?.exitstatus != 0\n raise DownloaderError, \"Error on `#{executable} #{command}`.\\n#{output}\"\n end\n end",
"def exit!(res=0) end",
"def error!(status, msg)\n error msg\n exit status\n end",
"def to_s\n if msg.nil?\n exitcode.to_s\n else\n msg + exitcode.to_s\n end\n end",
"def test_outputonfailure\n provider = newprovider\n\n dir = tstdir\n file = File.join(dir, \"mycmd\")\n sh = Puppet::Util.which(\"sh\")\n File.open(file, \"w\") { |f|\n f.puts %{#!#{sh}\n echo A Failure >&2\n exit 2\n }\n }\n File.chmod(0755, file)\n\n provider.commands :cmd => file\n\n inst = provider.new(nil)\n\n assert_raise(Puppet::ExecutionFailure) do\n inst.cmd \"some\", \"arguments\"\n end\n\n out = nil\n begin\n inst.cmd \"some\", \"arguments\"\n rescue Puppet::ExecutionFailure => detail\n out = detail.to_s\n end\n\n\n assert(\n out =~ /A Failure/,\n\n \"Did not receive command output on failure\")\n\n\n assert(\n out =~ /Execution of/,\n\n \"Did not receive info wrapper on failure\")\n end",
"def return_error(message)\n result = {}\n result[:_error] = {\n msg: message,\n kind: 'puppetlabs/cisco_ios',\n details: {}\n }\n puts result.to_json\n exit 1\nend",
"def error_io\n exit_code == -1 ? $stderr : $stdout\n end",
"def oops str\n STDERR.puts str\n exit\nend",
"def fail(msg)\n $stderr.puts(msg)\n exit(1)\nend",
"def print_result_and_exit(success, failmsg, checkpoints, response=nil)\n output_data = {}\n output_data[\"checkpoints\"] = checkpoints\n output_data[\"response\"] = response unless response.nil?\n output_data[\"success\"] = success\n output_data[\"message\"] = failmsg\n puts JSON.pretty_generate(output_data)\n exit(success ? 0 : 1)\nend",
"def exit_code\n self.__options[:exit_code]\n end",
"def run_with_err_output(command)\n %x{ #{command} 2>&1 }\n end",
"def run_with_err_output(command)\n %x{ #{command} 2>&1 }\n end",
"def run_with_err_output(command)\n %x{ #{command} 2>&1 }\n end",
"def run_with_err_output(command)\n %x{ #{command} 2>&1 }\n end",
"def quit_with_error( error_msg )\n puts error_msg\n exit \nend",
"def die (text)\n if $convert\n $configure << %{\n\nif [[ \"$LAST\" == \"no\" ]]; then\n echo -e \"#{text}\"\n do_exit\nfi\n\n }\n else\n fail(text)\n end\nend",
"def result(output)\n output\n end",
"def result_log(title, message, processlog, returnflagfile)\n logprefix = get_log_prefix(title)\n execute \"operation_success\" do\n command \"echo '#{logprefix} #{message} result:[success]' >> #{processlog}\"\n only_if { ::File.exist?(returnflagfile)}\n end\n execute \"operation_failed\" do\n command \"echo '#{logprefix} #{message} result:[failed]' >> #{processlog}\"\n not_if { ::File.exist?(returnflagfile)}\n end\n ruby_block \"manual_fatal\" do\n block do\n Chef::Application.fatal!(\"chefclient is mannually aborted due to failure of execute \", 42) if not ::File.exist?(returnflagfile)\n end\n action :run\n end\n file \"#{returnflagfile}\" do\n action :delete\n ignore_failure true\n end\nend",
"def ferror(a)\n $stderr.puts('ERROR: ' + a)\n exit(1)\nend",
"def output_error(string)\n if Command.ui\n Command.ui.error string\n else\n $stderr.puts \"ERROR: #{string}\"\n end\n end",
"def shell_error_string ( e )\n if e > 32\n return nil\n else\n return case e\n when 0 then \"Out of memory or resources\"\n #define ERROR_FILE_NOT_FOUND 2L\n #define SE_ERR_FNF 2\n when 2 then \"File not found\"\n #define ERROR_PATH_NOT_FOUND 3L\n #define SE_ERR_PNF 3\n when 3 then \"Path not found\"\n #define SE_ERR_ACCESSDENIED 5\n when 5 then \"Access denied\"\n #define SE_ERR_OOM 8\n when 8 then \"Not enough memory\"\n #define ERROR_BAD_FORMAT 11L\n when 11 then \"Invalid exe\"\n #define SE_ERR_SHARE 26\n when 26 then \"Sharing violation\"\n #define SE_ERR_ASSOCINCOMPLETE 27\n when 27 then \"Invalid file association\"\n #define SE_ERR_DDETIMEOUT 28\n when 28 then \"DDE timeout\"\n #define SE_ERR_DDEFAIL 29\n when 29 then \"DDE fail\"\n #define SE_ERR_DDEBUSY 30\n when 30 then \"DDE busy\"\n #define SE_ERR_NOASSOC 31\n when 31 then \"No file association\"\n #define SE_ERR_DLLNOTFOUND 32\n when 32 then \"DLL not found\"\n else \"Unspecified error\"\n end # case\n end # else\nend",
"def error!\n # Unhandled exception\n if @exception\n exception_message\n exit 2\n # Some checksums did not match?\n elsif !(invalid_packages.empty? && invalid_metadata_files.empty?)\n error_message\n exit 2\n # We don't have checksums for some packages?\n elsif unverifiable_package_count != 0\n unverifiable_packages_message\n exit 2\n else\n success_message\n exit 0\n end\n end",
"def error(msg)\n return if @nolog\n puts msg\n exit 5\n end",
"def result_code; end",
"def result_code; end",
"def stderr; end",
"def stderr; end",
"def stderr; end",
"def stderr; end",
"def error(message)\n Kernel.puts \" !\"\n message.split(\"\\n\").each do |line|\n Kernel.puts \" ! #{line.strip}\"\n end\n Kernel.puts \" !\"\n exit 1\nend",
"def code_parser(returned_code,expected_code,logger)\n code_status = false\n expected_code.each { |code| \n if returned_code == code.to_i\n code_status = true\n end\n }\n\n if code_status\n exitcode = OK_STATE\n logger.debug_message \"Set exit code to #{OK_STATE}. It is #{exitcode}\"\n else\n exitcode = CRITICAL_STATE\n logger.debug_message \"Set exit code to #{CRITICAL_STATE}. It is #{exitcode}\"\n end\n\n return exitcode\nend",
"def set_exit_exception; end",
"def die text\n $stderr.puts text\n exit ERRCODE\n end",
"def nb_arguments_exit(arg, qt, count)\n puts 'Error :'.red + ' for instruction \"' + @command.yellow + ' ' + @instruction.yellow + '\"'\n puts arg.yellow + ' was given ' + count.to_s.yellow + ' argument(s), ' + qt.to_s.yellow + ' are required'\n puts ''\n exit 4\n end",
"def exit!(msg, err = -1)\n Kitchenplan::Log.debug(msg)\n Process.exit err\n end",
"def usage_error\n $stderr.printf(\"%s\\n\", usage)\n exit(-1)\n end",
"def err(msg)\n puts msg.red\n exit(1)\n end",
"def error( text )\n puts \"Script #{@name} #{version} - Error: #{text}\"\n exit 1\n end",
"def fail(msg)\n $stderr.puts msg\n Kernel.exit 1\nend",
"def erroneous_result(cmd, exception)\n stdout = nil\n stderr = ([exception.message] + exception.backtrace).join(\"\\n\")\n status = 1\n rspec_example_metadata(cmd, stdout, stderr)\n CommandResult.new(stdout: stdout, stderr: stderr, exit_status: status)\n end",
"def exit_code=(value)\n end",
"def error message\n puts \"error: #{message}\" unless nil == message\n exit 1\nend",
"def error(message)\n STDERR.puts message\nend",
"def process_output command\n @warnings = [] # Keep global so we can show the warnings with the swf\n errors = []\n\n stdin, stdout, stderr = Open3.popen3(command)\n\n while msg = stderr.gets do\n message = /(.+)\\(([0-9]+)\\): col: ([0-9]+) (Error|Warning): (.*)/.match(msg)\n\n if message then\n array = case message[4]\n when \"Warning\" then @warnings\n when \"Error\" then errors\n end\n\n array.push(message)\n end\n\n 4.times {stderr.gets}\n end\n\n unless errors.empty? then\n puts html_head(:window_title => \"ActionScript 3 — Errors\", :page_title => \"Errors for #{@document_class}\")\n puts \"#{@command}\\n\\n<br />\"\n print_message_list errors\n html_footer\n TextMate.exit_show_html\n\n false # Code shouldn't get here\n else\n true\n end\nend",
"def get_FailureDescription()\n \t return @outputs[\"FailureDescription\"]\n \tend",
"def exit_message\n @exit_message\n end",
"def err(message)\n STDERR.puts(message)\n exit 1\n end",
"def printUsage(returnCode)\n scriptName = 'dbfetch_net_http.rb'\n puts <<END_OF_STRING\nUsage:\n #{scriptName} <method> [arguments...]\n\nA number of methods are available:\n\n getSupportedDBs - list available databases\n getSupportedFormats - list available databases with formats\n getDbFormats - list formats for a specifed database\n getFormatStyles - list styles for a specified database and format\n fetchData - retrive an database entry. See below for details of arguments.\n fetchBatch - retrive database entries. See below for details of arguments.\n\nFetching an entry: fetchData\n\n #{scriptName} fetchData <dbName:id> [format [style]]\n\n dbName:id database name and entry ID or accession (e.g. UNIPROT:WAP_RAT)\n format format to retrive (e.g. uniprot)\n style style to retrive (e.g. raw)\n\nFetching entries: fetchBatch\n\n #{scriptName} fetchBatch <dbName> <idList> [format [style]]\n\n dbName database name (e.g. UNIPROT)\n idList list of entry IDs or accessions (e.g. 1433T_RAT,WAP_RAT).\n Maximum of 200 IDs or accessions.\n format format to retrive (e.g. uniprot)\n style style to retrive (e.g. raw)\nEND_OF_STRING\n exit(returnCode)\nend",
"def exit_exception; end",
"def chef_error(e)\n if e.is_a?(::RightScale::Exceptions::Exec)\n msg = \"External command error: \"\n if match = /RightScale::Exceptions::Exec: (.*)/.match(e.message)\n cmd_output = match[1]\n else\n cmd_output = e.message\n end\n msg += cmd_output\n msg += \"\\nThe command was run from \\\"#{e.path}\\\"\" if e.path\n elsif e.is_a?(::Chef::Exceptions::ValidationFailed) && (e.message =~ /Option action must be equal to one of:/)\n msg = \"[chef] recipe references an action that does not exist. #{e.message}\"\n elsif e.is_a?(::NoMethodError) && (missing_action_match = /undefined method .action_(\\S*)' for #<\\S*:\\S*>/.match(e.message)) && missing_action_match[1]\n msg = \"[chef] recipe references the action <#{missing_action_match[1]}> which is missing an implementation\"\n else\n msg = \"Execution error:\\n\"\n msg += e.message\n file, line, meth = e.backtrace[0].scan(BACKTRACE_LINE_REGEXP).flatten\n line_number = line.to_i\n if file && line && (line_number.to_s == line)\n dir = AgentConfig.cookbook_download_dir\n if file[0..dir.size - 1] == dir\n path = \"[COOKBOOKS]/\" + file[dir.size..file.size]\n else\n path = file\n end\n msg += \"\\n\\nThe error occurred line #{line} of #{path}\"\n msg += \" in method '#{meth}'\" if meth\n context = \"\"\n if File.readable?(file)\n File.open(file, 'r') do |f|\n lines = f.readlines\n lines_count = lines.size\n if lines_count >= line_number\n upper = [lines_count, line_number + 2].max\n padding = upper.to_s.size\n context += context_line(lines, line_number - 2, padding)\n context += context_line(lines, line_number - 1, padding)\n context += context_line(lines, line_number, padding, '*')\n context += context_line(lines, line_number + 1, padding)\n context += context_line(lines, line_number + 2, padding)\n end\n end\n end\n msg += \" while executing:\\n\\n#{context}\" unless context.empty?\n end\n end\n msg\n end",
"def exit(args)\nend",
"def print_usage_exit(code)\n STDERR.puts(File.open(\"#{File.expand_path(File.dirname(__FILE__))}/usage.txt\").read)\n exit code\nend",
"def print_usage_exit(code)\n STDERR.puts(File.open(\"#{File.expand_path(File.dirname(__FILE__))}/usage.txt\").read)\n exit code\nend",
"def do_exit(code = nil, msg = nil)\n msg, code = msg_code unless code\n puts '%s: %s' % [CODES[code.to_i], msg.to_s] + @perf.to_s\n exit 3 if @verbose\n exit code\n end",
"def exit(ret)\n @exit_status = ret\n if defined? Rbkb::Cli::TESTING\n throw(((ret==0)? :exit_zero : :exit_err), ret)\n else\n Kernel.exit(ret)\n end\n end",
"def failed_example_output(example)\n full_description = example.full_description\n location = example.location\n formatted_message = strip_message_from_whitespace(example.execution_result.exception.message)\n \n \"#{full_description} - #{location} \\n #{formatted_message}\"\n end",
"def runTest()\n # open program\n stdin, stdout, stderr, wait_thr = Open3.popen3(@definition.executable, *@definition.arguments)\n\n # put input template to program\n if File.file?(@definition.stdin)\n expect_stdin = IO.readlines(@definition.stdin)\n else\n expect_stdin = [ ]\n end\n\n expect_stdin.each do |x| stdin.puts x end\n stdin.close\n\n # store program output\n result_stdout = stdout.readlines\n result_stderr = stderr.readlines\n stdout.close\n stderr.close\n\n # retreive exit status\n result_status = wait_thr.value.exitstatus\n\n # compare program stdout\n if File.file?(@definition.stdout)\n expect_stdout = IO.readlines(@definition.stdout)\n else\n expect_stdout = [ ]\n end\n mismatch_stdout = compare(expect_stdout, result_stdout)\n\n # compare program stderr\n if File.file?(@definition.stderr)\n expect_stderr = IO.readlines(@definition.stderr)\n else\n expect_stderr = [ ]\n end\n mismatch_stderr = compare(expect_stderr, result_stderr)\n\n # compare program output files\n mismatch_files = false\n @definition.files.each do |output_file, file|\n if File.file?(file)\n expect_file = IO.readlines(file)\n else\n expect_file = [ ]\n end\n\n if File.file?(output_file)\n result_file = IO.readlines(output_file)\n else\n result_file = [ ]\n end\n mismatch_files |= compare(expect_file, result_file)\n end\n\n # compare program status\n mismatch_status = @definition.status != result_status\n\n # debugging output\n if @environment.verbose\n if mismatch_stdout\n puts \"mismatch in stdout\"\n end\n if mismatch_stderr\n puts \"mismatch in stderr\"\n end\n if mismatch_files\n puts \"mismatch in files\"\n end\n if mismatch_status\n puts \"mismatch in status\"\n end\n end\n\n # check the test results\n if !mismatch_stdout && !mismatch_stderr && !mismatch_files && ! mismatch_status\n return_value = false\n else\n return_value = true\n end\n\n return return_value\n end",
"def usage(result, out)\n Usage.call(result, out)\n exit(1)\n end",
"def usage(s,c)\n\t$stderr.puts(s + getusage())\n\texit(c)\nend",
"def get_ssh_exitcode( index = 1 )\n index.is_a?(Fixnum) and index > 0 ? self.ssh_exitcode[-index] : self.ssh_exitcode[index]\n end",
"def output_results\n puts(output_copy)\n exit_code = 0\n exit_code = 1 if @changed_files.any? && @flags.include?(:error_on_annotation)\n exit_code\n end",
"def assert_exec_output(node, command, expected_exitcode, expected_outputs)\n params = {}\n params[:exceptiononfailure] = false\n params[:exitcode] = true\n (exitcode, output) = node.execute(command, params)\n assert_equal(expected_exitcode.to_s, exitcode, \"Wrong exitcode returned\")\n assert_correct_output(expected_outputs, output)\n end",
"def return_msg\n case return_code\n when 0x00\n 'Connection Accepted'\n when 0x01\n 'Connection refused: unacceptable protocol version'\n when 0x02\n 'Connection refused: client identifier rejected'\n when 0x03\n 'Connection refused: server unavailable'\n when 0x04\n 'Connection refused: bad user name or password'\n when 0x05\n 'Connection refused: not authorised'\n else\n \"Connection refused: error code #{return_code}\"\n end\n end",
"def script_error(path, error); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end",
"def output=(_arg0); end"
] | [
"0.6937589",
"0.6878476",
"0.6878476",
"0.6824858",
"0.6706357",
"0.664009",
"0.66048604",
"0.6603489",
"0.65850323",
"0.6454553",
"0.63912106",
"0.63901067",
"0.6378749",
"0.6345811",
"0.6320164",
"0.6320164",
"0.6320164",
"0.6320164",
"0.6320164",
"0.6311839",
"0.6311628",
"0.62617487",
"0.6226713",
"0.61747295",
"0.6139122",
"0.6130894",
"0.6106187",
"0.610251",
"0.6067368",
"0.6053688",
"0.6049489",
"0.6045507",
"0.6039025",
"0.6021053",
"0.60049015",
"0.5993268",
"0.5944543",
"0.59278125",
"0.59278125",
"0.59278125",
"0.59278125",
"0.59174997",
"0.59158576",
"0.5913617",
"0.58951306",
"0.5893643",
"0.58849454",
"0.58795726",
"0.58665615",
"0.5858116",
"0.5852174",
"0.5852174",
"0.5839122",
"0.5839122",
"0.5839122",
"0.5839122",
"0.5834367",
"0.5827195",
"0.5826561",
"0.58219284",
"0.5808728",
"0.580121",
"0.57936156",
"0.5789162",
"0.5774453",
"0.57716805",
"0.57680696",
"0.57669723",
"0.57628495",
"0.5761777",
"0.57560104",
"0.57534784",
"0.57380414",
"0.57373095",
"0.57358223",
"0.57347304",
"0.5734705",
"0.57289076",
"0.57245725",
"0.57245725",
"0.5721542",
"0.57191706",
"0.5716426",
"0.57160944",
"0.5714654",
"0.5713354",
"0.5713171",
"0.57042646",
"0.57038",
"0.57001585",
"0.5695562",
"0.56927925",
"0.56927925",
"0.56927925",
"0.56927925",
"0.56927925",
"0.56927925",
"0.56927925",
"0.56927925",
"0.56927925"
] | 0.60361856 | 33 |
include ::Forms::DateOfBirthField include Validations::USDate.on(:date_of_birth) | def initialize(*attributes)
@addresses = [Address.new(kind: 'home'), Address.new(kind: 'mailing')]
@same_with_primary = "true"
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_birthdate\n errors.add(:birthdate, \"Birthdate can't be in the future\") if birthdate && birthdate > Date.today\n end",
"def birth_date_and_date_of_joining\n if !user.user_information.birth_date.blank? && !date_of_joining.blank?\n valid = user.user_information.birth_date && date_of_joining && user.user_information.birth_date < date_of_joining\n errors.add(:base, \"must be before date of joining\") unless valid\n end\n end",
"def validate_date_of_birth\n unless self.profile.date_of_birth.blank?\n if self.profile.date_of_birth > 13.years.ago.to_date \n errors.add_to_base(\"You must be over 13.\")\n return false\n end\n end\n end",
"def date_of_birth\n return @date_of_birth if @date_of_birth.present?\n return if date_fields.blank?\n return date_fields.input_field_values if date_fields.partially_complete? || date_fields.form_date_invalid?\n\n @date_of_birth = attributes[:date_of_birth] = date_fields.form_date\n end",
"def is_a_valid_date\n errors.add(:birthdate, \"is not a valid date.\") if birthdate.present? and birthdate > Date.current\n end",
"def validate_birthdate\n return true if self.birthday.to_s.blank?\n\n if self.birthday.to_datetime.year < 1900\n errors.add(:birthday, :invalid_date)\n return false\n end\n\n if self.birthday.to_datetime > Time.now\n errors.add(:birthday, :birth_date_greater_than_today)\n return false\n end\n\n return true\n end",
"def must_be_eighteen\n if dob && dob.to_date >= 18.years.ago\n self.errors.add(:dob, 'Student must be atleast 18 years old')\n end\n end",
"def validate_age\n if date_of_birth.present? && (date_of_birth > 18.years.ago.to_date || date_of_birth < 100.years.ago.to_date)\n errors.add(:date_of_birth, 'You should be over 18 years old.')\n end\n end",
"def presence_of_dob\n\t\tif dob.blank?\n\t\t\terrors.add(:dob, ActiveRecord::Error.new(\n\t\t\t\tself, :base, :blank, { \n\t\t\t\t\t:message => \"Date of birth can't be blank.\" } ) )\n\t\tend\n\tend",
"def birth_date\n getBirthDate && getBirthDate.to_date\n end",
"def birthdate\n Date.parse(super) if super\n end",
"def date_of_birth_cannot_be_in_the_future\n # stretch\n if self.date_of_birth.present? && self.date_of_birth > DateTime.now\n errors.add(:date_of_birth, \"can't be in the future\")\n end\n end",
"def birthday_validator\n if (@year.to_i - @age.to_i == @birth_year.to_i)\n true\n else\n false\n end\n end",
"def date_field(field, options = {})\n append_class_option(options, \"date_field\")\n value = object.send(field)\n if value.is_a?(Date)\n value = I18n.l(value, :format => :default)\n end\n options[:value] = value\n text_field(field, options)\n end",
"def date_of_birth_cannot_be_in_the_future\n if date_of_birth > Date.today\n errors.add(:date_of_birth, \"can't be in the future\")\n end\n end",
"def user_age\n \terrors.add(:birth_day, \"Your age must be 21 years or more\") if\n \t (Date.today.year - self.birth_day.to_i) <= 21\n end",
"def birth\n birth_date.try(:to_date)\n end",
"def apply_validations_for_date\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a Date\") if value && (! value.kind_of?(Date))\n end\n end",
"def valid_registration_date\n errors.add(:registration_deadline, 'The registration deadline could not be parsed.') unless registration_date_is_valid?\n end",
"def check_minimum_age\n errors.add(:birthdate, 'You must be 13 years or older to use our service') if birthdate && birthdate_changed? && birthdate.year > (Date.today - 13.years).year\n end",
"def birth_date_cannot_be_in_the_future\n if birthdate.present? && birthdate >= Date.today\n errors.add(:birthdate, \"Can't be in the future\")\n end\n end",
"def initialize(date_of_birth)\n if date_of_birth.kind_of?(Date)\n @date_of_birth = date_of_birth\n end\n end",
"def birthday_older_than_13\n now = Time.now.utc.to_date\n if !birthday.nil?\n age = now.year - birthday.year - ((now.month > birthday.month || (now.month == birthday.month && now.day >= birthday.day)) ? 0 : 1)\n end\n errors.add(:birthday, I18n.t('activerecord.errors.models.user.attributes.birthday.age')) if birthday.nil? || age < 13\n end",
"def set_birth_date\n self.birth_date = Time.now\n end",
"def birthdate_for(user)\n\t\tuser.birthdate.strftime(\"%B %e, %Y\")\n\tend",
"def validates_dates\n ( Date.parse(self['birth_date']) rescue errors.add(:birth_date, 'invalid.date') ) if !self['birth_date'].blank?\n ( Date.parse(self['ffck_number_date']) rescue errors.add(:ffck_number_date, 'invalid.date') ) if !self['ffck_number_date'].blank?\n ( Date.parse(self['medical_certificate_date']) rescue errors.add(:medical_certificate_date, 'invalid.date') ) if !self['medical_certificate_date'].blank?\n ( Date.parse(self['tetanus_vaccine_date']) rescue errors.add(:tetanus_vaccine_date, 'invalid.date') ) if !self['tetanus_vaccine_date'].blank?\n end",
"def birth_date(user_birth_date)\n user_birth_date.strftime('%d %B %Y', 'fr') rescue ''\n end",
"def date_of_birth_cannot_be_in_the_future\n if date_of_birth > Date.today\n errors.add(:date_of_birth, \"You cannot be born in the future...\")\n end\n end",
"def date_of_birth=(*args)\n read_only ? date_of_birth : super\n rescue ArgumentError\n nil\n end",
"def date_field_enter(date)\n my_date = Date.parse(date)\n year = my_date.year\n month = my_date.strftime('%b')\n day = my_date.strftime('%d')\n\n day_field = @field.all(:css, 'input[id$=\"DayValue\"]').first\n day_field.set \"#{day}\"\n\n month_drop_down = @field.all(:css, 'select[id$=\"MonthLongValue\"]').first[:id]\n select(month, :from => month_drop_down)\n\n year_field = @field.all(:css, 'input[id$=\"YearValue\"]').first\n year_field.set \"#{year}\"\n end",
"def date_field(field, options={})\n options.reverse_merge!(:value => field_value(field), :id => field_id(field))\n options[:class] = 'date_field'\n options.merge!(:class => field_error(field, options))\n @template.date_field_tag field_name(field), options\n end",
"def birthdate_cannot_be_before_1900\n\t\tif birthday && birthday < Date.parse('1899-12-31')\n\t\t\terrors.add(:birthday, \"invalid date\")\n\t\tend\n\tend",
"def validate_dated_around_now\n self.errors.add(:exam_date, \"ist kein korrektes Datum, bitte versuche es erneut.\") unless ((Date.today)..(5.years.from_now)).include?(self.exam_date)\n end",
"def validate_dated_around_now\n self.errors.add(:exam_date, \"ist kein korrektes Datum, bitte versuche es erneut.\") unless ((Date.today)..(5.years.from_now)).include?(self.exam_date)\n end",
"def birth\n date_parser(self[:birth])\n end",
"def vdate_pin(attr)\nvalidates_presence_of attr , :message => \"^Please Fill #{attr}\"\nvalidates_format_of attr , :with => /^\\d{6}$/ ,\n :message => \"^invalid #{attr}, #{attr} is 6 digit number\"\nend",
"def check_age\n errors.add(:birthday, \"must be before #{(Date.today - 18.years).strftime('%m/%d/%Y')}\") if age.to_i < 18\n errors.add(:birthday, \"must be after #{(Date.today - 110.years).strftime('%m/%d/%Y')}\") if age.to_i > 110\n end",
"def dob\n @registration.dob.strftime('%B %d, %Y')\n end",
"def birth_date\n year = yr_of_birth > 30 ? yr_of_birth+1900 : yr_of_birth+2000\n birth_dt.nil? ? Date.new(year, mth_of_birth, day_of_birth) : birth_dt.to_date\n end",
"def over_18?\n date_of_birth <= 18.years.ago.to_date\nend",
"def admit_date_is_after_dob\n\t\tif !admit_date.blank? && \n\t\t\t!study_subject.blank? && \n\t\t\t!study_subject.dob.blank? && \n\t\t\tstudy_subject.dob.to_date != Date.parse('1/1/1900') &&\n\t\t\tadmit_date < study_subject.dob &&\n\t\t\tadmit_date.to_date != Date.parse('1/1/1900')\n\t\t\terrors.add(:admit_date, \"is before study_subject's dob.\") \n\t\tend\n\tend",
"def date_is_valid\n if !date.is_a? Date\n errors.add :date, I18n.t('activerecord.errors.invalid_date_format')\n elsif date.to_date > Date.today\n errors.add :date, I18n.t('activerecord.errors.future_date')\n end\n end",
"def html_for_date_field(object, field)\n \"<p>\n <label for = '#{field}' >\n Select your #{field}:\n </label>\n <input type = 'date' \n name = create_form[#{field}]\n placeholder = 'mm/dd/yy'\n value = '#{date_humanized(object.send(field))}'>\n </input>\n </p>\"\n end",
"def form_date\n \"#{date.month}/#{date.day}/#{date.year - 2000}\"\n end",
"def over_18?\n date_of_birth <= 18.years.ago.to_date \n end",
"def before_save\n if self.fecha_nac\n self.anio_nac = self.fecha_nac.year if (self.fecha_nac.year && self.anio_nac == Time.now.year.to_s)\n end\n end",
"def format_date \n begin\n if !self.unformatted_dob.blank?\n self.dob = Date.strptime(self.unformatted_dob, \"%m/%d/%Y\").to_time(:utc)\n end\n rescue\n errors.add :base, \"Invalid date for DOB.\"\n return false\n end\n end",
"def validate_date\n if self.date.present? && self.date < Date.today\n errors.add(:date, \"can't be in the past\")\n end\n end",
"def warn_invalid_date; end",
"def fiscal_year\n super(fy_year)\n end",
"def validate_date\n if params[:date_posted].blank?\n update_error('date_posted', 'Please enter a date.')\n elsif date_posted.nil?\n update_error('date_posted',\n 'We could not parse the date you entered. Please use the format \"yyyy-mm-dd\".')\n else\n year = date_posted.year\n # FIXME: This is not very DRY, as Txaction does this validation. We should\n # probably move date validation to the Txaction model\n if year < 1920 || year > 9999\n update_error('date_posted', \"The date is not valid. Please enter a year between 1920 and 9999.\")\n end\n end\n end",
"def date_validation\n\t\tif start_date >= end_date\n \t\terrors.add(:end_date, \"must be greater than start date\")\n \tend\n end",
"def date_of_birth\n DateTime.parse(user_data['date_of_birth']).strftime(FOOTER_DATE_FORMAT) if user_data\n end",
"def patient_admit_date_is_after_dob\n\t\tif !patient.nil? && !patient.admit_date.blank? && \n\t\t\t\t!dob.blank? && patient.admit_date < dob &&\n\t\t\t\tdob.to_date != Date.parse('1/1/1900') &&\n\t\t\t\tpatient.admit_date.to_date != Date.parse('1/1/1900')\n\t\t\terrors.add('patient:admit_date', \"Admit date is before study_subject's dob\") \n\t\tend\n\tend",
"def patient_admit_date_is_after_dob\n\t\tif !patient.nil? && !patient.admit_date.blank? && \n\t\t\t\t!dob.blank? && patient.admit_date < dob &&\n\t\t\t\tdob.to_date != Date.parse('1/1/1900') &&\n\t\t\t\tpatient.admit_date.to_date != Date.parse('1/1/1900')\n\t\t\terrors.add('patient:admit_date', \"Admit date is before study_subject's dob\") \n\t\tend\n\tend",
"def age\n Time.current.year - date_of_birth.year\n end",
"def age\n Time.now.year - self.dob.year\n end",
"def person_dob=(dob)\n self[:person_dob] = dob\n begin\n self.person_dob_date = Date.parse(dob)\n rescue\n # Date entered is unparseable\n self.person_dob_date = nil\n end\n end",
"def person_age_validation\n return unless person && pet_kind\n return unless pet_kind.name == 'Andorinha'\n return unless (person.date_of_birth + 18.years) < Date.today\n\n errors[:person] << I18n.t('activerecord.errors.pet.person_age',\n name: person.name,\n pet_kind: pet_kind.name)\n end",
"def birthday_field\n # unit_test_no_generate: birthday_field, input.className(create_ats_regex_string(\"ats-bdayfield\"))\n $tracer.trace(__method__)\n return ToolTag.new(input.className(create_ats_regex_string(\"ats-bdayfield\")), __method__)\n end",
"def born_date\n super.to_s(:long)\n end",
"def dob\n @dob\n end",
"def birth_day(user_birth_date)\n Date.strptime(user_birth_date.strftime('%d/%m', 'fr'), '%d/%m').strftime('%A %d %B', 'fr') rescue ''\n end",
"def test_validate_valid_date\n g = GradeEntryForm.new(short_identifier: 'T1',\n date: 1.day.from_now,\n is_hidden: false)\n assert g.valid?\n end",
"def patient_admit_date_is_after_dob\n#\t\tif !patient.nil? && !patient.admit_date.blank? && \n#\t\t\t!pii.nil? && !pii.dob.blank? && patient.admit_date < pii.dob &&\n#\t\t\tpii.dob.to_date != Date.parse('1/1/1900') &&\n\t\tif !patient.nil? && !patient.admit_date.blank? && \n\t\t\t!dob.blank? && patient.admit_date < dob &&\n\t\t\tdob.to_date != Date.parse('1/1/1900') &&\n\t\t\tpatient.admit_date.to_date != Date.parse('1/1/1900')\n\t\t\terrors.add('patient:admit_date', \"is before study_subject's dob.\") \n\t\tend\n\tend",
"def create_date_field(form,\n value,\n name,\n label,\n field_id,\n required: false,\n validation: nil,\n html_class: nil,\n is_multiple: false,\n readonly: false,\n index: 0,\n ttip: nil,\n example: nil,\n default_value: nil)\n render partial: 'dynamic_form/fields/text_field',\n locals: {\n f: form,\n multiple: is_multiple,\n index:,\n field_value: value,\n field_name: name,\n field_label: label,\n field_class: html_class,\n field_id:,\n input_type: 'date',\n readonly:,\n required:,\n validation:,\n ttip:,\n example:,\n default_value:\n }\n end",
"def bound_date_field(method, attrs = {})\n update_bound_controls(method, attrs, 'date')\n attrs[:value] = @obj.send(method)\n attrs[:name] ||= control_name(method)\n unbound_date_field(attrs)\n end",
"def birthday\n Date.civil(year, month, day)\n end",
"def veteran_birth_date\n veteran.birth_date\n end",
"def insurance_dates_validator\n errors.add(:end_date, 'cannot be before start date.') if start_date > end_date\n end",
"def date_picker(field, options = {})\n append_class_option(options, \"date_picker\")\n date_field(field, options)\n end",
"def age_calculate\n date = self.date_of_birth\n d1 = Date.parse date\n d2 = Date.today\n age = d2.year - d1.year\n age\n end",
"def unobtrusive_datepicker_includes\n #javascript 'datepicker'\n #stylesheet 'datepicker'\n end",
"def over_18?\n\t\tself.date_of_birth <= Date.today - 18.years\n\tend",
"def age \n Date.today.year - birth_date.year\n end",
"def mobilisation_start_date_validation\n mobilisation_start_date = initial_call_off_start_date - mobilisation_period.weeks - 1.day\n errors.add(:mobilisation_start_date, :greater_than) if mobilisation_start_date <= Time.zone.today\n end",
"def pre_validation\n\n end",
"def valid_start_date\n errors.add(:start_date, 'The start date cannot be parsed.') unless start_date_is_valid?\n end",
"def birth_date\n details.at(\"time[itemprop='birthDate']\")['datetime'].parse_date rescue nil\n end",
"def datepicker_input(form, attribute, opts = {})\n opts.reverse_merge!(\n as: :datepicker,\n datepicker_options: {\n changeYear: true,\n changeMonth: true,\n yearRange: 'c-80:c+10'\n }\n )\n\n form.input attribute, opts\n end",
"def subclass_validations ; true ; end",
"def birth_date\n object.demographics&.birth_date&.to_date&.to_s\n end",
"def valid_before; end",
"def diagnosis_date_is_after_dob\n\t\tif !diagnosis_date.blank? && \n\t\t\t!study_subject.blank? && \n\t\t\t!study_subject.dob.blank? && \n\t\t\tdiagnosis_date < study_subject.dob\n\t\t\terrors.add(:diagnosis_date, \"is before study_subject's dob.\") \n\t\tend\n\tend",
"def user_field_params\n params.require(:user_field).permit(:date_birth, :first_name, :last_name, :email, :city)\n end",
"def start_form_column(column, options)\n text_field :record, :start, options.merge({:class => \"date_picker\"})\n end",
"def require_guardian?\n birth_date.present? && minor?\n end",
"def date_restrictable_must_be_chronological\n\n # bounce unless we have both dates\n return if valid_from.blank? or valid_until.blank?\n\n # otherwise…\n unless valid_until.to_date >= valid_from.to_date\n\n field_name = self.class.human_attribute_name( :valid_from )\n errors.add( :valid_until, :must_be_on_or_after, { field: field_name })\n\n end\n\n end",
"def not_too_young?\n if date_of_birth.present?\n if date_of_birth > Time.now.strftime(\"%Y\").to_i\n errors.add(:date_of_birth, \"can't be greater than the actual year\")\n end\n end\n end",
"def str_dob\r\n\t\tunless self.date_of_birth.nil?\r\n\t\t\tself.date_of_birth.strftime('%m-%d-%Y')\r\n\t\tend\r\n\tend",
"def clean_date\n read_attribute :date\n end",
"def dateify_dob\n self.dob ||= \"\"\n parts = self.dob.split(\"/\").map{|i| i.to_i}\n self.dob = \"#{parts[0].to_s.rjust(2, \"0\")}/#{parts[1].to_s.rjust(2, \"0\")}/#{parts[2]}\"\n end",
"def _before_validation\n end",
"def nice_dob\n\t\t@nice_dob = @dob.strftime(\"%A the #{@dob.day.ordinalize} %B %Y\")\n\tend",
"def valid_after; end",
"def age\n Date.current.year - self.year_of_birth\n end",
"def ui_date_picker_field(content = nil, options = nil, html_options = nil, &block)\n UiBibz::Ui::Core::Forms::Dates::DatePickerField.new(content, options, html_options, &block).render\n end",
"def age_from_dob\n\n # Convert the String date input, to a date time format to use in the method.\n # Add an instance scope ie. @dob\n # Which ever object that's been created ie as a Person, will have access to this method, so\n # person = Person.new\n # person.age_from_dob - this will now work!\n dob_dt = DateTime.parse(@dob)\n\n # Today's date\n today = DateTime.now\n\n # This rounds down to the nearest whole no.\n (today.mjd - dob_dt.mjd)/365\n\nend",
"def next_birthday\n Date.distance_to(self.date_of_birth)\n \tend",
"def apply_validations_for_timestamp\n apply_validations_for_datetime\n end",
"def pre_validation\n\n\n end"
] | [
"0.69490683",
"0.6717087",
"0.6696131",
"0.6577748",
"0.6492285",
"0.64385664",
"0.6424931",
"0.63769794",
"0.6319543",
"0.6271041",
"0.62241215",
"0.6149071",
"0.6148309",
"0.60825634",
"0.6075924",
"0.6045734",
"0.60068053",
"0.5987927",
"0.59471613",
"0.5940142",
"0.59331435",
"0.59207165",
"0.5912082",
"0.58966464",
"0.58902824",
"0.586496",
"0.5854923",
"0.5853408",
"0.58261544",
"0.5776732",
"0.5773825",
"0.5768621",
"0.57424164",
"0.57424164",
"0.57188624",
"0.56960815",
"0.56911427",
"0.56812775",
"0.5662339",
"0.56541854",
"0.56427145",
"0.5632416",
"0.5616418",
"0.56147915",
"0.5611078",
"0.55806696",
"0.55646324",
"0.5555939",
"0.55554855",
"0.5551095",
"0.55305475",
"0.55301",
"0.5528617",
"0.55266786",
"0.55266786",
"0.55206984",
"0.5514468",
"0.5510034",
"0.54823834",
"0.5480512",
"0.54773366",
"0.5470393",
"0.5465302",
"0.545912",
"0.54506433",
"0.5449563",
"0.5448099",
"0.54457015",
"0.54291385",
"0.5421305",
"0.5408085",
"0.5401262",
"0.5397919",
"0.5397028",
"0.53952783",
"0.5394254",
"0.5391696",
"0.5368013",
"0.5363919",
"0.5361703",
"0.5356708",
"0.5355217",
"0.5352913",
"0.53470325",
"0.534481",
"0.5331016",
"0.5321506",
"0.5315542",
"0.5309053",
"0.53080577",
"0.5303502",
"0.5300943",
"0.53006613",
"0.5291299",
"0.5289569",
"0.5289064",
"0.52824706",
"0.5279471",
"0.5275408",
"0.5271216",
"0.52689207"
] | 0.0 | -1 |
The +Bot+ initially keeps no promises | def initialize(id)
super
@promises = {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def waiting; end",
"def waiting; end",
"def run()\r\n @bot.run :async\r\n @bot.online\r\n wake_up(@bot)\r\n\r\n @bot.bucket :helpBucket, limit: 1, time_span: 30, delay: 1\r\n @bot.bucket :hamBucket, limit: 5, time_span: 1, delay: 1\r\n\r\n # Create all markov commands, invoked by dictionary name.\r\n @dict.each_pair do |dictName, dictionary|\r\n commandName = dictName.gsub(/\\s+/,\"_\").downcase.to_sym\r\n @bot.command(commandName, bucket: :hamBucket, rate_limit_message: \"Slow down please!\") do |event, flag|\r\n if bot_can_respond?(@bot, event)\r\n event.respond( @commands.markov_command(event, flag, @numSentences, dictName) )\r\n GC.start\r\n end\r\n end\r\n end\r\n\r\n # Recite all public commands.\r\n @bot.command(:help, bucket: :helpBucket, rate_limit_message: \"Slow down please!\") do |event, flag|\r\n if bot_can_respond?(@bot, event)\r\n event.respond( @commands.get_help(@desc, @prefix) )\r\n end\r\n end\r\n\r\n # Set the num sentences.\r\n @bot.command(:setlength, bucket: :hamBucket, rate_limit_message: \"Slow down please!\") do |event, num|\r\n @numSentences = [1, [num.to_i, 8].min].max # Clamp between 1 and 8.\r\n if bot_can_respond?(@bot, event)\r\n event.respond( \"Number of sentences to generate set to \" + @numSentences.to_s + \".\" )\r\n end\r\n end\r\n\r\n # Report current memory usage.\r\n # Only works when run on linux!\r\n @bot.command(:memory, bucket: :helpBucket, rate_limit_message: \"Slow down please!\") do |event, flag|\r\n if bot_can_respond?(@bot, event)\r\n event.respond( \"Previously I was using \" + @commands.get_prev_mem_usage().to_s() + \" kilobytes of memory.\\n\" + \"I am now using \" + @commands.get_mem_usage().to_s() + \" kilobytes of memory.\" )\r\n end\r\n end\r\n\r\n # Sleep.\r\n @bot.command(:sleep, bucket: :hamBucket, rate_limit_message: \"Slow down please!\") do |event, flag|\r\n if event.author == @bot.bot_application.owner\r\n # Save and close everything.\r\n @commands.save_dicts(@dict.values)\r\n @logger.close_open_logs()\r\n\r\n # Say goodnight.\r\n if bot_can_respond?(@bot, event) and @byeStrings.size > 0\r\n event.respond(@byeStrings.sample)\r\n end\r\n\r\n # Set status to offline and stop the bot.\r\n @bot.invisible\r\n @bot.stop\r\n else\r\n # Respond with a no-no.\r\n if bot_can_respond?(@bot, event) and @rejectStrings.size > 0\r\n event.respond(@rejectStrings.sample)\r\n end\r\n end\r\n end\r\n\r\n # Chat logger.\r\n @bot.message do |event|\r\n @logger.process_message(event, @dict[@logFilename], @prefix)\r\n end\r\n\r\n # Add to dictionary.\r\n @bot.command(:addto, bucket: :hamBucket, rate_limit_message: \"Slow down please!\") do |event, dictName|\r\n if bot_can_respond?(@bot, event) && event.author == @bot.bot_application.owner\r\n messageArray = event.content.strip.split(\" \")[2 .. -1]\r\n success = true\r\n response = \"\"\r\n\r\n if nil==dictName\r\n response = response + \"Please specify a dictionary name. \"\r\n success = false\r\n end\r\n if nil==messageArray or messageArray.length <= 0 \r\n response = response + \"Please provide a string. \"\r\n success = false\r\n end\r\n\r\n if success\r\n message = messageArray.join(\" \")\r\n success = @logger.add_to_dict(event, @dict[dictName], message)\r\n end\r\n\r\n if success==0\r\n response = \"Got it.\"\r\n elsif success==1\r\n response = \"Couldn't do it. That dictionary doesn't exist. \" + response\r\n else\r\n response = \"Couldn't do it. \" + response\r\n end\r\n\r\n event.respond(response)\r\n else\r\n # Respond with a no-no.\r\n if bot_can_respond?(@bot, event) and @rejectStrings.size > 0\r\n event.respond(@rejectStrings.sample)\r\n end\r\n end\r\n end\r\n\r\n # Member join Message.\r\n @bot.member_join do |event|\r\n channel = (event.server.channels.keep_if{|chan| chan.name == @joinChannelName} )[0]\r\n if not channel or not @welcomeMessage or @welcomeMessage==\"\" then return end\r\n\r\n @bot.send_message(channel, \"<@!\" + event.user.id.to_s + \"> \" + @welcomeMessage)\r\n end\r\n\r\n @bot.sync\r\n end",
"def wait; end",
"def wait; end",
"def wait; end",
"def pending?; end",
"def run\n @bot.run\n end",
"def send_pending; end",
"def initialize\r\n @done = false\r\n end",
"def new_bot email, password, room\n counter = Thread.new do\n TT.run do\n client = TT::Client.new(email, password, room: room)\n my_bot = Bot.new(client)\n client.on :user_spoke do |message|\n puts \"**** in :user_spoke message: #{message.content}\"\n my_bot.tell(message.content, message.sender) if message.content.split[0] == client.user.name\n end\n client.on :user_entered do |user|\n my_bot.say_hello user\n end\n client.on :song_started do |song|\n my_bot.bop song\n end\n end\n end\nend",
"def call\n advance until done?\n end",
"def sync() end",
"def sync() end",
"def sync() end",
"def enter_pending; end",
"def executor!\n @executor = true\n end",
"def executor!\n @executor = true\n end",
"def executor!\n @executor = true\n end",
"def done!\n # Do nothing\n end",
"def done!\n # Do nothing\n end",
"def mock\n self.known_queues = Set.new\n self.connection.close if self.connection(ensure_started: false)\n self.connection = BunnyMock.new(self.config).start\n end",
"def wait_for_pending_sends; end",
"def wait_connection; end",
"def wait_connection; end",
"def hook_bot(bot)\r\n @thread.exit if @thread&.alive?\r\n @thread = Thread.new do\r\n update_stats(bot.users.size, bot.servers.size)\r\n sleep 10 * 60\r\n end\r\n @thread\r\n end",
"def run_bot\n return if !ENV['LOOMIO_USER']\n\n # initialize the handler here so that the authentication doesn't have to be repeated\n loomio = LoomioHandler.new()\n\n # start a new thread and run an infinite loop inside it\n #Thread.new do\n loop do\n LogEntry\n .where(loomio_consumed: [false, nil]) # extract all log_entries that haven't been processed yet\n .each { |log_entry|\n process(log_entry, loomio)\n }\n sleep 5 # check for new events every 5 seconds\n end\n #end\nend",
"def omni\n @channel = nil\n true\n end",
"def initialize(responses, queue)\n @id = \"Bot-\" + SecureRandom.uuid\n @responses = responses\n @queue = queue\n @agent = Mechanize.new\n @state = {}\n @thread = Thread.new {run}\n end",
"def queue() = @queue ||= CommandQueue.new",
"def wait\n true\n end",
"def let_mes_catch_up\n sleep 1\n end",
"def sync; end",
"def process\n if command = AVAILABLE_COMMANDS.find { |command_class| command_class.new(@user, @message).should_start? }\n command.new(@user, @message).start\n else\n BotCommand::Undefined.new(@user, @message).start\n end\n end",
"def do_run\n ready\n aim\n fire!\n end",
"def setup_bot\n # Respond to DMs\n $bot.private_message do |event|\n next if !RESPOND && event.user.id != BOTMASTER_ID\n remove_mentions!(event.content)\n special = event.user.id == BOTMASTER_ID && event.content[0] == '!'\n special ? respond_special(event) : respond(event)\n str = special ? 'Special ' : ''\n str = \"#{str}DM by #{event.user.name}: #{event.content}\"\n special ? succ(str) : msg(str)\n rescue => e\n lex(e, 'Failed to handle Discord DM')\n ensure\n release_connection\n end\n\n # Respond to pings\n $bot.mention do |event|\n next if !RESPOND && event.user.id != BOTMASTER_ID\n remove_mentions!(event.content)\n respond(event)\n msg(\"Mention by #{event.user.name} in #{event.channel.name}: #{event.content}\")\n rescue => e\n lex(e, 'Failed to handle Discord ping')\n ensure\n release_connection\n end\n\n # Parse all messages, and optionally respond\n $bot.message do |event|\n next if !RESPOND && event.user.id != BOTMASTER_ID\n remove_mentions!(event.content)\n if event.channel == $nv2_channel\n $last_potato = Time.now.to_i\n $potato = 0\n end\n mishnub(event) if MISHU && event.content.downcase.include?(\"mishu\")\n robot(event) if !!event.content[/eddy\\s*is\\s*a\\s*robot/i]\n if event.content[0] == '!' && event.user.id == BOTMASTER_ID && event.channel.type != 1\n respond_special(event)\n succ(\"Special command: #{event.content}\")\n end\n rescue => e\n lex(e, 'Failed to handle Discord message')\n ensure\n release_connection\n end\n\n # Respond to button interactions\n $bot.button do |event|\n next if !RESPOND && event.user.id != BOTMASTER_ID\n respond_interaction_button(event)\n rescue => e\n lex(e, 'Failed to handle Discord button interaction')\n ensure\n release_connection\n end\n\n # Respond to select menu interactions\n $bot.select_menu do |event|\n next if !RESPOND && event.user.id != BOTMASTER_ID\n respond_interaction_menu(event)\n rescue => e\n lex(e, 'Failed to handle Discord select menu interaction')\n ensure\n release_connection\n end\n\n log(\"Configured bot\")\nrescue => e\n fatal(\"Failed to configure bot: #{e}\")\n exit\nend",
"def reset\n @async_command_aborted = false\n super\n end",
"def implicit_wait; end",
"def done\n # Do nothing.\n end",
"def command_queue; end",
"def start\n send_message('Which pants do you like, dear customer?')\n \n @items=Item.where(\"itemType = ?\", \"pants\")\n @items.each do |item|\n send_photo({remote: item[:remotePath],local:item[:localPath]})\n end\n user.reset_next_bot_command\n end",
"def await\n Fibril.current.tick while !self.depleted\n end",
"def wait\n\tend",
"def wait_async\n @wait_async = true\n end",
"def ready=(_); end",
"def ready; end",
"def ready; end",
"def robots_mutex; end",
"def wake_up(bot)\r\n bot.servers.each do |key, server|\r\n server.channels.each do |channel|\r\n if channel.name == @botChannelName and @awakenStrings.size > 0\r\n bot.send_message(channel, @awakenStrings.sample)\r\n end\r\n end\r\n end\r\n end",
"def run\n begin\n loop do\n command = @queue.pop\n start_time = Time.now\n # Commands are defined in command modules\n command['command'] == 'STOP' ? break : self.send(command['method'].to_sym, @agent, @state)\n end_time = Time.now\n diff = end_time - start_time\n @responses << {id: @id, command: command['command'], method: command['method'], step: command['step'], status: @agent.page.code, time: diff}\n break unless ['200', '301', '302'].include? @agent.page.code\n end\n rescue Exception => e\n puts \"Something went wrong! Bot: #{@id}, #{e}\"\n @responses << {id: @id, status: 'dead'}\n end\n end",
"def bot()\n merge(bot: 'true')\n end",
"def reset!\n raise if working?\n @is_complete = false\n end",
"def call\n executor.consume\n end",
"def wait\n #$_api_queue.clear\n wait_for(/>/)\nend",
"def running; end",
"def running; end",
"def initialize\n @working = true\n end",
"def establecer_bot(bot)\n @bot = bot\n end",
"def finish\n verify_not_closed\n wait_all_sent\n end",
"def reset\n initialize(@channel, @name, @opts)\n end",
"def post_init\n @queue, @input, @timers = [], [], {}\n connect { start_session }\n send_next_command\n end",
"def initialize(session, msg_timeout = 2, max_delay = 12, bot_list = false)\n @session = session\n @msg_timeout = msg_timeout\n @max_delay = max_delay\n @purged = false\n @aid = \"#{@@next_id}\"\n @@next_id += 1\n\n @response_text = {}\n @responded = {}\n @finished = []\n\n # The initial bot list for when the aggregator is started\n if (!bot_list)\n @bot_list = @session.bot_list\n else\n @bot_list= bot_list\n end\n \n #@bot_list = bot_list\n #if @session.kind_of?(HiBot::MUCSessionHandler)\n # @bot_list.map! { |jid| jid.split(\"/\").pop }\n #end\n # print \"Bot list: #{@bot_list.sort.join(\", \")}\\n\"\n\n @delay_thread = Thread.new {\n sleep( @max_delay )\n self.purge\n }\n reset_wait()\n # reset_auto_destruct()\n end",
"def starter\n @starter ||= EM.Callback { @running = true }\n end",
"def run(async = false)\n @bot.run(async)\n end",
"def start_bot\n Telegram::Bot::Client.run(@token) do |bot|\n @bot=bot\n bot.listen do |message|\n @last_message=message\n # print message to terminal for debug\n puts message\n # switch case for different command\n # TODO: extract each command to a new method\n case message.text\n when /\\A\\/start/\n bot.api.send_message(chat_id: message.chat.id, text: \"Hello, #{message.from.first_name}. I am started! >.<\")\n when /\\A\\/stop/\n bot.api.send_message(chat_id: message.chat.id, text: \"Bye, #{message.from.first_name}. Why did you stop me? T^T\")\n when /\\A\\/help/\n bot.api.send_message(chat_id: message.chat.id, text:\n \"/run\\nFormat: /run {code}\\nAvailable method: times, puts, print, each, p \\nExample: \\n/run 3.times{|x| puts x*x}\\n/run puts 'I am a happy little bot.'\\nThis bot is created by @Energy0124. \\nSource code is avaliable here:\\n https://github.com/Energy0124/EnergyRubyTelegramBot.git \")\n # running ruby code on server in a sandbox\n when /\\A\\/run/\n if message.text=~ /\\A\\/run@Energy0124TestBot/\n message.text.slice! '/run@Energy0124TestBot'\n else\n message.text.slice! '/run'\n end\n begin\n # capture the stdout\n stdout=with_captured_stdout {\n s = Sandbox.new\n priv = Privileges.new\n # whitelist some safe method\n priv.allow_const_read *@allowed_const_read\n priv.allow_methods *@allowed_methods\n # eval the ruby code\n s.run(priv, message.text, :timeout => 3)\n }\n # print the stdout\n puts(stdout)\n # send stdout as telegram message\n send_reply(\"Result:\\n#{stdout}\")\n # catch exception\n rescue Exception => ex\n send_reply(\"Error:\\n#{ex}\")\n end\n # for fun\n when /fuck/i\n send_reply(\"I fucking hate people saying 'fuck'.\")\n when /dota/i\n send_reply('Dota is the best!')\n when /stupid bot/i\n send_reply('Still a bit smarter than you :P')\n when /\\A\\/(admin|secret)/i\n send_reply('https://youtu.be/dQw4w9WgXcQ')\n end\n end\n end\n end",
"def once\n end",
"def simulate!\n bots = @bot_specifications.each_with_object({}) do |(bot, spec), hash|\n initial_values = @initial_values.find_all { |k, v| v == bot }\n hash[bot] = Bot.new(initial_values.map(&:first), spec[:low], spec[:high])\n end\n\n loop do\n steps = bots.map { |id, bot| [id, bot.run_step] }.find_all(&:last)\n return if steps.empty?\n steps.each do |id, commands|\n commands.each do |command|\n case command[0]\n when :compared\n if @watch && command[1] == @watch[0] && command[2] == @watch[1]\n @watch[2].call(id)\n end\n when :give\n if command[1] == 'bot'\n recipient_bot = command[2]\n recipient_value = command[3]\n bots[recipient_bot].receive_value(recipient_value)\n elsif command[1] == 'output'\n recipient_output = command[2]\n recipient_value = command[3]\n puts \"output #{recipient_output} gets value #{recipient_value}\"\n end\n end\n end\n end\n end\n end",
"def run\n # Include all handlers now.\n Dir['./handlers/*.rb'].sort.each do |file|\n require file\n end\n\n @config.bots.each do |bot_id, bot_data|\n conn = DiscordConnection.new(bot_data)\n\n conn.connection_id = bot_id\n\n conn.message do |msg|\n next unless @config.discord.allowed_channel_types.include?(msg.channel.channel_type)\n\n if (prefix = check_prefix(msg.text))\n CommandDispatcher.handle prefix, msg\n else\n @handlers.each do |handler|\n break if handler.call(msg) == true\n end\n end\n end\n\n conn.mention do |msg|\n next unless @config.discord.allowed_channel_types.include?(msg.channel.channel_type)\n next if msg.content.match? /^(\\.|\\!)(a|d|add_|del_|delete_|remove_|count_)?q(uote|s|uotes|uote_count)?\\b/\n next unless msg.content.present?\n next if bot_data.client_type == :user\n\n msg.send_message \"#{msg.message.author.mention}, please type `.help` if you would like to learn more about my functions!\"\n end\n\n @connections.push conn\n conn.connect\n end\n\n SweetieBot.log \"Made #{@connections.length} connection#{@connections.length > 1 ? 's' : ''}.\"\n SweetieBot.log 'Ready!'\n\n # keep the main thread alive\n loop do\n if @should_stop\n stop!\n exit\n end\n\n sleep 1\n end\n end",
"def running?; end",
"def done?; true end",
"def sync\n end",
"def sync\n end",
"def initialize\n @setup = false\n @reply_to = UUID.generate\n @pending = Hash.new\n end",
"def reset\n @messages = []\n @error = nil\n @status = :ready\n end",
"def initialize\n @responses = []\n @semaphore = Semaphore.new\n @lock = Mutex.new\n end",
"def synchronous!\n @asynchronous = false\n end",
"def wait_for_any_input\n Bot.on :message do |message|\n puts \"Received '#{message.inspect}' from #{message.sender}\"\n sender_id = message.sender['id']\n show_humour_replies(sender_id, HUMOUR)\n end\nend",
"def enqueue_pending_output; end",
"def run_bot\n $bot.run(true)\n trap(\"INT\") { shutdown }\n leave_unknown_servers\n log(\"Bot connected to servers: #{$bot.servers.map{ |id, s| s.name }.join(', ')}.\")\nrescue => e\n fatal(\"Failed to execute bot: #{e}\")\n exit\nend",
"def reset!\n executions.reset\n end",
"def wait_until_not_full; end",
"def wait_for_irc\n while @mockirc.ready?\n sleep 0.05\n end\n\n # For safety, we need to wait yet again to be sure YAIL has processed the data it read.\n # This is hacky, but it decreases random failures quite a bit\n sleep 0.1\n end",
"def sleepy_run; end",
"def run() end",
"def run\n puts \"------------------ NEW TURN ------------------\"\n ask_question\n get_answer\n validate_answer\n end",
"def try_fire_torpedo\n\t\tfire_torpedo if torpedo_ready?\n\tend",
"def after_players_ready\r\n end",
"def wait_until_ready\n # this method may be left unimplemented if that is applicable\n end",
"def busy?; end",
"def reset!\n runner.tick!\n Worker.before_fork\n end",
"def flush_when_ready\n # make super()-safe so we can make liberal use of mixins\n end",
"def ready?; @ready; end",
"def ready?; @ready; end",
"def asynchronous!\n @asynchronous = true\n end",
"def set_message_waiting\n @message_waiting = true\n $game_message.main_proc = Proc.new { @message_waiting = false }\n end",
"def set_ready!\n puts \"game #{state_name}\"\n if created?\n puts \"call confirmation methods\"\n confirm1\n confirm2\n end\n end",
"def reset!\n return unless @connection.started?\n\n @connection.stop\n perform_setup\n end",
"def clear_pending\n @async_requests.clear\n nil\n end",
"def start \n @Done = false \n end",
"def start\n send_message('Hello! Welcome to Hedma store🥰')\n send_message('Which item do you want to buy, dear customer?')\n user.set_next_bot_command('pants')\n end",
"def perform_work\n object_client.notify_goobi\n end"
] | [
"0.6199822",
"0.6199822",
"0.61876655",
"0.5983125",
"0.5983125",
"0.5983125",
"0.5959639",
"0.59473974",
"0.59110236",
"0.58900875",
"0.5882327",
"0.58805674",
"0.5850394",
"0.5850394",
"0.5850394",
"0.58356315",
"0.5743751",
"0.5743751",
"0.5743751",
"0.5721636",
"0.5721636",
"0.5708351",
"0.57002515",
"0.5667944",
"0.5667944",
"0.5644387",
"0.56427026",
"0.5638297",
"0.56278366",
"0.56183046",
"0.56181514",
"0.56168795",
"0.5615456",
"0.56016505",
"0.5598133",
"0.5588981",
"0.5583912",
"0.55807453",
"0.5575294",
"0.5563216",
"0.5550704",
"0.5547784",
"0.55450124",
"0.5542262",
"0.5541877",
"0.5540718",
"0.5540718",
"0.55354553",
"0.5531607",
"0.5496143",
"0.54646426",
"0.54637223",
"0.54618055",
"0.5452822",
"0.54487264",
"0.54487264",
"0.5448406",
"0.5448194",
"0.5445735",
"0.54411924",
"0.542532",
"0.5424344",
"0.54175085",
"0.5415389",
"0.54153067",
"0.54087543",
"0.54055345",
"0.5404026",
"0.5389158",
"0.5388998",
"0.53881437",
"0.53881437",
"0.538731",
"0.5381562",
"0.53797865",
"0.5376961",
"0.5370916",
"0.5359004",
"0.5338862",
"0.53367066",
"0.5329673",
"0.5329158",
"0.53201824",
"0.5314025",
"0.53132486",
"0.53125983",
"0.5308245",
"0.53018653",
"0.5295492",
"0.52913314",
"0.5289841",
"0.5281365",
"0.5281365",
"0.528102",
"0.52745885",
"0.527049",
"0.52680993",
"0.5263919",
"0.52610993",
"0.52583426",
"0.52540904"
] | 0.0 | -1 |
Has this +Bot+ promised to give a +kind+ of +microchip+? | def promised_to?(kind)
@promises.key? kind
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_softwire?(); @type == GRT_SOFTWIRE; end",
"def physical_device?\n arches.any? do |arch|\n arch[/arm/, 0]\n end\n end",
"def is_hardwire?(); @type == GRT_HARDWIRE; end",
"def device?\n type == :device\n end",
"def card_detection\n end",
"def one_bit?\n identify.include?('1-bit')\n end",
"def check_devices\n\n\n end",
"def is_hub?\n return (serialNumber.hex & 0xff000000) == 0xff000000\n end",
"def chip_api\n Settings.check_in.chip_api\n end",
"def is_intel_x520?\n vendor == :intel && product =~ /x520(\\D|$)/i && n_ports == 2\n end",
"def teleportable?\n !grabbed?\n end",
"def megacli_usable?\n (File.writable?('/dev/megaraid_sas_ioctl_node') or File.writable?('/dev/megadev0')) and (Facter::Util::Resolution.which('MegaCli') or Facter::Util::Resolution.which('megacli'))\nend",
"def no_device?\n\ttrue if devices.size < 1\nend",
"def physical_device?\n if udid.nil?\n stack = Kernel.caller(0, 6)[0..-1].join(\"\\n\")\n raise RuntimeError,\n %Q[udid is nil\n\n#{stack}\n\n name: #{name}\nversion: #{version}\n]\n end\n !udid[DEVICE_UDID_REGEX, 0].nil?\n end",
"def powered?\n respond_to? :isPowered ? isPowered : false\n end",
"def powered?\n respond_to? :isPowered ? isPowered : false\n end",
"def multiple_devices?\n\ttrue if devices.size > 1\nend",
"def firmware_name\n \"Little Wire\"\n end",
"def hpricot? ; false end",
"def battery_connected?\n $ioreg_return.split(' = ')[4].strip.split(\"\\n\")[0] == \"Yes\" ? true : false\n end",
"def check_devices\n\traise \"No connected device was found.\" if no_device?\nend",
"def has_otp_device?\n !yubico_identity.nil?\n end",
"def is_intel_x520_i350?\n vendor == :intel && product =~ /x520\\/I350(\\D|$)/i && n_ports == 4\n end",
"def platform?(what)\n\t\t(platform & what).empty? == false\n\tend",
"def is_qlogic_57810?\n vendor == :qlogic && product =~ /(^|\\D)57810(\\D|$)/ && n_ports == 2\n end",
"def is_sunxi_hardware()\n fh = File.open(\"/proc/cpuinfo\")\n return nil if not fh\n fh.each_line {|l|\n if l =~ /^Hardware/ and l =~ /(Allwinner)|(sun\\di)/ then\n return true\n end\n }\n return nil\nend",
"def needs_ffs?()\n gadget.needs_ffs?()\n end",
"def detect?(machine)\n machine.communicate.test(\"\")\n end",
"def driving_low?\n output? && !@mplab_pin.high?\n end",
"def is_qlogic_57840?\n vendor == :qlogic && product =~ /(^|\\D)57840(\\D|$)/ && n_ports == 4\n end",
"def disabled_feature\n\tatm = AtmMachine.new(100, PinValidator)\n\tcard = CreditCard.new(1234, 30)\n\tatm.insert_card(card, 666)\n\tatm.insert_card(card, 1234)\nend",
"def request_device?(device)\n (request.user_agent.to_s.downcase =~ (Mobylette.devices.device(device) || %r{not_to_be_matched_please}) ? true : false)\n end",
"def ice?\n return $game_player.system_tag == TIce\n end",
"def has_motor \t\n\tend",
"def worth\n Chip.value_of(all_chips)\n end",
"def should_i_sip?\n #If we don't have our total scores, wait until character fills them in.\n if plugins[Character].total_mana && plugins[Character].total_health \n #Otherwise, begin checking health and mana to see if we need to do some drinking...\n if health_below_threshold? && sipper_enabled?\n send_kmuddy_command(\"drink health\")\n @sipper_enabled = false\n end\n if mana_below_threshold? && sipper_enabled?\n send_kmuddy_command(\"drink mana\")\n @sipper_enabled = false\n end\n end\n end",
"def coupled?\n true\n end",
"def is_qlogic_57800?\n vendor == :qlogic && product =~ /(^|\\D)57800(|\\D|$)/ && n_ports == 4\n end",
"def shouldHit\n # If 17 or above, lock the hand so it cannot receive any more cards\n \tif @hands[0].checkHand > 16 or @hands[0].checkHand < 0\n \t @hands[0].lock\n \tend\n \t@hands[0].canGetCards\n end",
"def probe?\n self.type == :probe\n end",
"def eval_platform\n if @platform == \"PC\"\n puts \"PC are great!\"\n else\n puts \"Your platform is probably underpowered.\"\n end\n end",
"def driving_high?\n output? && @mplab_pin.high?\n end",
"def is_intel_x710_i350?\n vendor == :intel && product =~ /x710\\/I350(\\D|$)/i && n_ports == 4\n end",
"def eth_gpu_en; eth_ctrl_bit(1); end",
"def hardware_information\n super\n end",
"def lights_on?\n return [true,false].sample\n end",
"def i2c_exists?\n\tFile.exist?('/dev/i2c-0') || File.exist?('/dev/i2c-1')\nend",
"def supports_serial?\n true\n end",
"def devkit?\n @kind == :devkit\n end",
"def type_electric?\n return type?(GameData::Types::ELECTRIC)\n end",
"def has_physical_device\n return @has_physical_device\n end",
"def play_like_a_master\r\n card = nil\r\n #TODO\r\n return card\r\n end",
"def is_intel_x710?\n vendor == :intel && product =~ /x710(\\D|$)/i\n end",
"def uwi\n self.well_info.uwi || self.well_info.api\n end",
"def support_characteristic\n @support_characteristic ||= rand(0..2)\n end",
"def coupled?\n false\n end",
"def discoverable?\n fails_any = false\n\n # TODO Loop through agent requirements\n\n return !fails_any\n end",
"def pbHasFatefulSpecies?(species)\n if species.is_a?(String) || species.is_a?(Symbol)\n species = getID(PBSpecies,species)\n end\n for pokemon in $Trainer.pokemonParty\n return true if pokemon.species==species && pokemon.obtainMode==4\n end\n return false\nend",
"def machine_readable?\n @prompt == :machine\n end",
"def detect_radio()\n ret=get_cmd('OM;',0.1,1.0,5)\n if(ret)\n if(ret.include?('A'))\n $kx_atu=true\n end\n if(ret.include?('P'))\n $kx_pa=true\n end\n if(ret.include?('F'))\n $kx_filter=true\n end\n if(ret.include?('T'))\n $kx_extatu=true\n end\n if(ret.include?('B'))\n $kx_charger=true\n end\n if(ret.include?('X'))\n $kx_transverter=true\n end\n if(ret.include?('I'))\n $kx_rtcio=true\n end\n if(ret=~/01;$/)\n $kx_model=2\n end\n if(ret=~/02;$/)\n $kx_model=3\n end\n return(true)\n else\n return(nil)\n end\nend",
"def must_buy_train?(entity)\n must_buy_power?(entity)\n end",
"def battery?\n !no_battery?\n end",
"def can_loot?\n false\n end",
"def is_device? type\n request.user_agent.to_s.downcase.include?(type.to_s.downcase)\n end",
"def promiscuous?\n\t\t\treturn false\n\t\tend",
"def apple_silicon?\n RUBY_PLATFORM.match(/arm64/)\n end",
"def running_on_shitty_gpu?\n return @shitty_gpu\n end",
"def unknown?\n\t\treturn ( major.text.include?('InsufficientInformation') )\n\tend",
"def simulator?\n !physical_device?\n end",
"def megapixel? = unit == 'megapixel'",
"def check_devices2(id)\n\n end",
"def wheelchair?\n [true, false].sample\n end",
"def power\n\t\tbrand(Rex::Post::Meterpreter::Extensions::Stdapi::Sys::Power)\n\tend",
"def promiscuous?\n\t\treturn self.component.promiscuous?\n\tend",
"def is_handset? type\n Handset.is_handset? request.user_agent, type\n end",
"def pc?\n self.identifier = 'FF'\n end",
"def pin_required?\n\t\tnot command(\"AT+CPIN?\").include?(\"+CPIN: READY\")\n\tend",
"def dial_up_numbers_ok? \n (!senior.blank? && !senior.devices.gateways.first.blank?) ? senior.devices.gateways.first.dial_up_numbers_ok? : false\n #\n # Fri Sep 24 04:26:03 IST 2010\n # logic updated to check user.devices by type of device\n #\n # senior.blank? ? false : senior.dial_up_numbers_ok_for_device?( senior.device_by_serial_number( kit_serial_number))\n end",
"def sample?\n raise 'Not implemented'\n end",
"def test_hardware_cpu_type\n assert [:intel, :ppc].include?(Hardware.cpu_type)\n end",
"def is_device?(type)\n\t\trequest.user_agent.to_s.downcase.include?(type.to_s.downcase)\n\tend",
"def hard?\n !soft?\n end",
"def toggable?\n return @switch != nil\n end",
"def is_brand? brand\n Handset.is_brand? request.user_agent, brand\n end",
"def connect\n require 'littlewire' unless defined?(::LittleWire)\n @littlewire = ::LittleWire.new(connect_to_usb)\n super\n return true\n end",
"def rech_bonus?\n has_feature?(:esper_recharger)\n end",
"def is_cuffed?\n return weapon_id == 33\n end",
"def is_huaweios?\n return [email protected](/^huaweios-.*$/)\n end",
"def bet(chips)\n\n end",
"def usable?(machine, raise_error=false)\n end",
"def detect\n end",
"def has_physical_device\n return @has_physical_device\n end",
"def toggable?\n @switch != nil\n end",
"def is_arm?\n !RUBY_PLATFORM.index(\"arm64e\").nil?\nend",
"def is_arm?\n !RUBY_PLATFORM.index(\"arm64e\").nil?\nend",
"def devices; end",
"def machine?\n machine_flag != '0'\n end",
"def type_ice?\n return type?(GameData::Types::ICE)\n end",
"def supports_injection?\n\n\tinj_works = false\n\t\n\tif !system(\"aireplay-ng -9 mon0 > inj_test.txt\")\n\t\tsystem(\"clear\")\n\t\tputs \"Sorry, either your wireless is disabled or\"\n\t\tputs \"your wireless card does not support injection.\"\n\t\tputs \"This makes cracking impossible.\"\n\t\tputs\n\tend\n\t\n\tfile = File.foreach(\"inj_test.txt\") do |line| \n\t\n\t\tif line =~ /Injection is working!/\n\t\t\tinj_works = true\n\t\tend\n\t\t\n\tend\n\t\n\treturn inj_works\nend",
"def what_platform\n if @platform == \"PC\"\n puts \"PC are Awesome!\"\n else\n puts \"This platform is inferior\"\n end\n end",
"def is_device?(type)\n request.user_agent.to_s.downcase.include?(type.to_s.downcase)\n end"
] | [
"0.6721788",
"0.639083",
"0.63561624",
"0.6243865",
"0.6088038",
"0.6053154",
"0.6010889",
"0.5944566",
"0.5944557",
"0.59338075",
"0.5797902",
"0.57492965",
"0.57349926",
"0.57042587",
"0.5686725",
"0.5686725",
"0.568638",
"0.5672969",
"0.56384075",
"0.56308585",
"0.56295323",
"0.5629274",
"0.56121814",
"0.5604938",
"0.56044793",
"0.55974597",
"0.5566579",
"0.5563777",
"0.55612975",
"0.5553926",
"0.5551216",
"0.55456084",
"0.55430835",
"0.5532074",
"0.55295116",
"0.5525753",
"0.55120915",
"0.55086285",
"0.55059457",
"0.5505137",
"0.54964006",
"0.5483679",
"0.54639685",
"0.54620415",
"0.5461832",
"0.5453169",
"0.54525167",
"0.54408145",
"0.5440105",
"0.5436765",
"0.5416164",
"0.5401625",
"0.5399931",
"0.53918207",
"0.53913605",
"0.53775525",
"0.5370484",
"0.5346959",
"0.5338694",
"0.53269887",
"0.5301739",
"0.5299833",
"0.5297611",
"0.52898145",
"0.52881306",
"0.5276914",
"0.5270069",
"0.526449",
"0.5263466",
"0.52610135",
"0.52594435",
"0.5256417",
"0.52563196",
"0.5251572",
"0.524628",
"0.52424085",
"0.5233879",
"0.52298397",
"0.52258873",
"0.5225629",
"0.52229166",
"0.52161443",
"0.5213834",
"0.520629",
"0.5202514",
"0.5201126",
"0.5197659",
"0.51966417",
"0.519518",
"0.51875985",
"0.5186659",
"0.51844096",
"0.51841587",
"0.51825243",
"0.51825243",
"0.51768667",
"0.51764673",
"0.5175173",
"0.5174356",
"0.5172935",
"0.51705146"
] | 0.0 | -1 |
Get the +id+ of the +Entity+ that was promised a +kind+ of +microchip+ +kind+ can either be +:low+ or +:high+ | def givee(kind)
@promises[kind]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kind_identifier\n kind ? kind.identifier : nil\n end",
"def kind\n data['kind']\n end",
"def kind\n attributes.fetch(:kind)\n end",
"def kind\n attributes.fetch(:kind)\n end",
"def kind\n attributes.fetch(:kind)\n end",
"def kind\n attributes.fetch(:kind)\n end",
"def kind\n attributes.fetch(:kind)\n end",
"def kind\n attributes.fetch(:kind)\n end",
"def id\n \"#{kind}_#{@id}\"\n end",
"def id\n \"#{kind}_#{@id}\"\n end",
"def kind \n return @raw.kind \n end",
"def kind\n return @kind\n end",
"def kind\n return @kind\n end",
"def find_by_kind(kind)\n raise ArgumentError, 'Kind is a mandatory argument' unless kind\n filtered_set(entities, key: 'kind', value: kind)\n end",
"def get_id(entity)\n check_property_value(entity.properties, :type)\n check_property_value(entity.properties, :name)\n\n get_id_by_type_and_name(entity.properties[:type], entity.properties[:name])\n end",
"def kind_key\n Claim.kinds[self.kind]\n end",
"def kind\n type.to_s.underscore[5..-1]\n end",
"def kind; end",
"def kind; end",
"def kind; end",
"def kind; end",
"def kind; end",
"def kind; end",
"def set_kind\n @kind = Kind.find(params[:id])\n end",
"def kind\n @gapi[\"kind\"]\n end",
"def kind\n @gapi[\"kind\"]\n end",
"def get_entity_type_identifiers\n get_kind_type_identifiers_related_to Occi::Core::Entity.kind.type_identifier\n end",
"def get_kind\n\t\tend",
"def thing_type_id\n return @children['thing-type-id'][:value]\n end",
"def kind\n self.class.kind\n end",
"def kind\n self.class.kind\n end",
"def kind\n self.class.kind\n end",
"def kind\n self.class.kind\n end",
"def kind\n raise NotImplementedError\n end",
"def tile_kind(x, y)\n without_locking do\n Tile.where(:planet_id => id, :x => x, :y => y).select(\"kind\").\n c_select_value\n end\n end",
"def kind\n @ole.Kind\n end",
"def kind\n @ole.Kind\n end",
"def kind\n @ole.Kind\n end",
"def kind\n @ole.Kind\n end",
"def kind\n @ole.Kind\n end",
"def kind\n @ole.Kind\n end",
"def get_entity_type_identifier(type)\n get_type_identifier(type, Occi::Core::Entity.kind)\n end",
"def entityID\n end",
"def entityID\n end",
"def sensor_at(time, kind)\n edge = sensor_edges.where(kind: kind).before(time).order(:created_at).last\n edge && edge.value\n end",
"def entity_values(kind)\n self.entities.kind(kind.to_s).pluck('value')\n end",
"def kind!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 24 )\n\n type = KIND\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 158:8: 'kind'\n match( \"kind\" )\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__, 24 )\n\n end",
"def kind=(kind)\n unless kind\n raise Occi::Core::Errors::InstanceValidationError,\n 'Missing valid kind'\n end\n\n @kind = kind\n reset_attributes!\n\n kind\n end",
"def kind\n self.name.underscore.to_sym\n end",
"def kind\n self.name.underscore.to_sym\n end",
"def entity_id\n entities.select{|e| e.name == name}.first.id\n end",
"def entity\n @entity ||=\n begin\n detected = lam.QueryAssignedLicenses().find{|la| la.entityDisplayName == resource[:entity_id]}\n if detected\n detected.entityId\n else\n resource[:entity_id]\n end\n end\n end",
"def id?\n @kind == :id\n end",
"def set_tag_kind\n @tag_kind = TagKind.find(params[:id])\n end",
"def kind\n super&.inquiry\n end",
"def get_entity id\n @entities.each do |e|\n return e if e.id == id\n end\n end",
"def techno\n object.techno.id\n end",
"def get_typename_from_id(id)\n case id.chars[0]\n when 'T'\n 'trackId'\n when 'A'\n 'artistId'\n when 'B'\n 'albumId'\n when 'L'\n 'curatedStationId'\n else\n 'stationId'\n end\n end",
"def kind\n # returns nil, overridden and returning :question, :problem, etc. in sublcass\n end",
"def platform_id\n case handle\n when \"nokia_6260\"\n 0x101fb3f4\n when \"nokia_6600\"\n 0x101f7963\n when \"nokia_6630\"\n 0x101f7964\n when \"nokia_7610\"\n 0x101fd5db\n when \"nokia_e61\"\n 0x20001858\n when \"nokia_n70\", \"nokia_n72\"\n 0x10200f9a\n else\n raise\n end\n end",
"def nature_id\n return @nature\n end",
"def kind_as_string\n @ole.KindAsString\n end",
"def hotel_kind_description(kind_id = nil)\n self.extra ||= { }\n self.extra[:hotel_kind_description] ||= { }\n kind_id ? self.extra[:hotel_kind_description][kind_id.to_s] : self.extra[:hotel_kind_description]\n end",
"def is_kind? k, itm\n itm.attributes[:kind] == k\nend",
"def id; Common.device_id(@handle); end",
"def kind() @tag.sub( /_.*/, '' ) end",
"def kind() @tag.sub( /_.*/, '' ) end",
"def entity\n @keys[:entity]\n end",
"def entity_id\n match(/Entity\\sID\\s+:\\s+([A-F0-9]+)$/)\n end",
"def kind\n match_path(2..2)\n end",
"def user_kind\n UserKind.find(user_kind_id)\n end",
"def input_id_from_type(type); end",
"def element_id what\n \"#{object_type}_#{what}\"\n end",
"def trigger_kind\n attributes.fetch(:triggerKind)\n end",
"def trigger_kind\n attributes.fetch(:triggerKind)\n end",
"def kind=(value)\n @kind = value\n end",
"def kind=(value)\n @kind = value\n end",
"def object_class_from_kind(kind)\n case kind\n when 't1'\n RedditKit::Comment\n when 't2'\n RedditKit::User\n when 't3'\n RedditKit::Link\n when 't4'\n RedditKit::PrivateMessage\n when 't5'\n RedditKit::Subreddit\n when 'LabeledMulti'\n RedditKit::Multireddit\n when 'LabeledMultiDescription'\n RedditKit::MultiredditDescription\n when 'modaction'\n RedditKit::ModeratorAction\n end\n end",
"def entity_by_id(model_class)\n halt 400 unless (params[:id].to_i.to_s == params[:id])\n model_class[params[:id]] || (halt 404)\n end",
"def details_by_type_and_name(type, name)\n entity_id = get_id_by_type_and_name(type, name)\n if entity_id.nil?\n raise \"Id for entity with type '#{type}' and name '#{name}' can't be found\"\n else\n details_by_type_and_id(type, entity_id)\n end\n end",
"def entity_type\n return @entity_type\n end",
"def determine_kind(int)\n if int == 3\n return :equilateral\n elsif int == 2\n return :isosceles\n else\n return :scalene\n end\n end",
"def details_by_type_and_id(type, id)\n get(resource_path_for_entity_type(type) + \"/#{id}\")\n end",
"def identify(ident=:default)\n self.class.identify(ident)\n end",
"def identifier\n best_identifier\n end",
"def getTokenKind()\r\n return @curr_token.id\r\n end",
"def type\n entity_type.name\n end",
"def get_entity_type_identifiers\n get_entity_types_related_to Occi::Core::Entity.kind.type_identifier\n end",
"def find_entity(entity_id, entity_type)\n entity_class = begin; entity_type.constantize; rescue; nil; end\n return if entity_class.nil?\n\n @entity = if entity_class.respond_to?(:visible)\n entity_class.visible.find_by(id: entity_id)\n else\n entity_class.find_by(id: entity_id)\n end\n end",
"def set_kind\n return unless new_record?\n self.kind = Kind.where(:name => 'Graphics').first\n end",
"def set_kind\n return unless new_record?\n self.kind = Kind.where(:name => 'Graphics').first\n end",
"def read_device_info (device, kind)\n kind = kind.to_sym\n kinds = [:ip, :udid, :serial]\n unless kinds.include?(kind)\n raise \"#{kind} must be one of '#{kinds}'\"\n end\n cmd = \"cat ~/.xamarin/devices/#{device}/#{kind} | tr -d '\\n'\"\n `#{cmd}`\nend",
"def schema_for_kind(kind)\n api_name, schema_name = kind.split('#', 2)\n if api_name != self.name\n raise ArgumentError,\n \"The kind does not match this API. \" +\n \"Expected '#{self.name}', got '#{api_name}'.\"\n end\n for k, v in self.schemas\n return v if k.downcase == schema_name.downcase\n end\n return nil\n end",
"def kind\n linkinfo && linkinfo.kind\n end",
"def id\n @values.fetch('ai.device.id') { \n @values['ai.device.id'] = nil\n }\n end",
"def identifier\n identifiers = geo_concern.identifier\n if identifiers.nil? || identifiers.empty?\n geo_concern.id\n elsif identifiers.is_a?(String)\n identifiers\n else\n identifiers.first\n end\n end",
"def thumb_id(product) \n thumbs = product.photos.active.usage(\"Thumb\").sort_by_display_order\n if thumbs.size == 0\n return nil\n else\n return thumbs[0].id\n end\n end",
"def type\n if entity.respond_to?(:resource_type)\n entity.resource_type\n else\n entity.class\n end.to_s\n end",
"def get_id(what, item)\n case what.keys[0]\n when :study\n /^study_(?<s_id>\\d+)_manage_link$/.match(item['id'])[:s_id]\n when :study_group\n /^study_group_(?<sg_id>\\d+)_manage_link$/.match(item['id'])[:sg_id]\n when :site\n raise \"don't know how to search for site id\"\n when :team\n raise \"don't know how to search for team id\"\n else\n nil\n end\n end",
"def get_model_sys_id(model)\n query_data = URI::encode(model)\n url = \"#{@service_now_url}/table/cmdb_hardware_product_model?sysparm_query=display_name%3D#{query_data}\"\n sys_id = get_record_sys_id(url)\n sys_id\n end",
"def device_type\n self[:type]\n end"
] | [
"0.68468493",
"0.5960586",
"0.5879935",
"0.5879935",
"0.5879935",
"0.5879935",
"0.5879935",
"0.5879935",
"0.5843972",
"0.5843972",
"0.58017254",
"0.5797987",
"0.5797987",
"0.57493675",
"0.5694975",
"0.5694857",
"0.56832236",
"0.55979294",
"0.55979294",
"0.55979294",
"0.55979294",
"0.55979294",
"0.55979294",
"0.5555357",
"0.55502015",
"0.55502015",
"0.5529746",
"0.54852057",
"0.54578626",
"0.54412085",
"0.54412085",
"0.54412085",
"0.54184544",
"0.54159725",
"0.5407847",
"0.535053",
"0.535053",
"0.535053",
"0.535053",
"0.535053",
"0.535053",
"0.53266853",
"0.5310488",
"0.5310488",
"0.53013086",
"0.527093",
"0.5248562",
"0.52474153",
"0.52392495",
"0.52392495",
"0.5237649",
"0.52291524",
"0.5164122",
"0.51410824",
"0.51009846",
"0.5091102",
"0.5070631",
"0.50597763",
"0.5053739",
"0.5048455",
"0.5021733",
"0.5019082",
"0.50041986",
"0.49651766",
"0.496046",
"0.4958015",
"0.4958015",
"0.4956541",
"0.49539512",
"0.4932864",
"0.4924922",
"0.49215662",
"0.49101353",
"0.48921847",
"0.48921847",
"0.48894125",
"0.48894125",
"0.48885584",
"0.4887423",
"0.48754242",
"0.48730183",
"0.48545507",
"0.484229",
"0.4839306",
"0.48381183",
"0.48355395",
"0.4817014",
"0.47867802",
"0.47864798",
"0.4785481",
"0.4785481",
"0.4784433",
"0.47824422",
"0.47766182",
"0.47747168",
"0.47597128",
"0.47526506",
"0.4743463",
"0.47420883",
"0.47339895",
"0.47298202"
] | 0.0 | -1 |
"Hello, " + name + ". How are you doing?" end puts greeting("Bob") | def multiply(number1, number2)
number1 * number2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def greeter(name)\n puts \"Hello #{name}! How are you today?\"\nend",
"def greet\n puts \"Hello! My name is #{name}!\"\n end",
"def greet(name)\n print \"Hello, #{name} how are you doing today?\"\nend",
"def greeting\n puts \"Hi, my name is #{@name}.\"\n end",
"def greeting(name)\n print \"hello \" + name + \" what the fuck is your problem?\"\nend",
"def greet name, name2\n puts \"Hello, #{name} and #{name2} how are you all doing today?\"\nend",
"def greeting(name)\nputs \"Hello #{name}. It's nice to meet you.\"\nend",
"def greeting(name)\n\tputs \"Hello \" + name + \". Have a nice day!\"\nend",
"def greeting\n puts \"Hi my name is #{@name}\"\n end",
"def greeting(name)\n\tputs \"Hello, \" + name + \". How are you doing?\"\nend",
"def greeting(name)\n puts \"Hi \" + name\n namet\nend",
"def greeting(name)\r\n\tp \"hello \" +\"\"+ name\r\nend",
"def greeting(name)\n puts \"Hello, #{name}. Nice to meet you.\"\nend",
"def greeting(name)\r\n print \"Hello there, #{name}!\"\r\nend",
"def greeting(name)\n\tp \"hello\" + \" \" + name\nend",
"def greeting(name)\n\tp \"hello\" + \" \" + name\nend",
"def greet(name)\n\t\"Hello, #{name}!\"\nend",
"def greeting\nputs \"HELLO, BONJOUR, HOLA, GUTENTAG, HALLO, HOWDY, NAMASKAR, MERHABA\"\nend",
"def hello(name, age)\n\tputs \"Welcome #{name}, #{age} is definitely not too old to learn how to code\" \nend",
"def greeting(name)\n puts \"Hello, \" + name + \", I like cats!\"\nend",
"def greeting(name)\n puts \"Hello #{name}, welcome to the program!\"\nend",
"def greeting\r\n name = \"Bob\"\r\n puts \"hello, #{name}!\"\r\nend",
"def greet\n puts '------------------------'\n puts \"Greetings to you #{@name}\"\n end",
"def greeting(name)\n \"Hi my name is #{name}, nice to meet you!\"\nend",
"def greeting(name)\n puts \"Aloha \" + name\nend",
"def hello_user(name)\n\tputs \"\\nHi #{name}! It\\'s nice to meet you.\"\nend",
"def greet\n puts \"Hello, #{@name}!\"\n end",
"def greeting_a_person(name)\n puts \"Hello #{name}\"\nend",
"def greeting(greeting, name)\n puts \"#{greeting}, #{name}\"\nend",
"def greeter(name)\n return \"hello \" + name + \" its nice to see you.\"\nend",
"def greet(name)\n puts \"hello \" + name\nend",
"def greet\n\t\tputs \"Hi, my name is #{@name}\"\n\tend",
"def greet person\n puts \"Hello, #{person}!\"\nend",
"def greet\n hello + \" \" + world # this format allows us to use puts on line 31\nend",
"def greet person\n\t'Hello, ' + person + '!'\nend",
"def greet (name)\n \"Hello, #{name}!\"\nend",
"def greet(name)\n \"Hi, #{name}.\"\nend",
"def greeting(name)\n return \"Hello,#{name}!\"\n \n \"Good moming,#{name}\"\nend",
"def greeting(name)\n\t\tputs \" Hi there #{name}, how are you doing today?\"\n\tend",
"def greeting(name)\n\t\"Hello, #{name}\"\nend",
"def say_hello(name)\n puts \"Good afternoon, #{name}. How are you?\"\nend",
"def say_hello_to(name)\n puts \"Hello, #{name}. It's good to see you.\"\n puts \" \"\n end",
"def greet(name)\n greeting = \"Hello #{bob}!\"\n return greeting\nend",
"def greeting(name)\n \"Howdy #{name}, welcome back!\"\nend",
"def greet(folks); \"Hi, #{folks}!\"; end",
"def greet(name)\n puts \"Hello, #{name}\"\nend",
"def greeting(name)\n puts \"Hello, #{name}.\"\nend",
"def greeting(name=\"rubyist\")\n \"Welcome, #{name}! Ready to code?\"\nend",
"def greeting(name)\n \"Hello,\" + name + \". How are you doing?\"\nend",
"def greeting(name)\n name = name.strip\n puts \"`Hello #{name}. It's nice to meet you.`\"\nend",
"def greets(name)\n puts \"hello #{name}, my name is #{@greeter_name}\"\n end",
"def greet(name)\nreturn \"Hello, #{name}!\"\nend",
"def say_happy_birthday_to(name)\n puts \"Happy Birthday #{name}!\"\nend",
"def greet(first_name, last_name)\n p \"Hey \" + first_name + \", your last name is \" + last_name\nend",
"def greet(first_name, last_name)\n p \"Hey \" + first_name + \", your last name is \" + last_name\nend",
"def greet (name)\n\treturn \"Hello, #{name}\"\nend",
"def greet(first_name, last_name)\n p 'Hey ' + first_name + ', your last name is ' + last_name\nend",
"def saygoodbye(name=\"John\", surname=\"Doe\")\n puts (\"Good Bye \" + name + \" \" + surname)\nend",
"def greet(name)\n return \"Hello, #{name}!\"\nend",
"def greet(name)\n return puts \"Hello, #{name} how are you doing today?\"\nend",
"def greeting(person)\n puts \"Hello, \" + person\nend",
"def greeting(name) \n puts \"Hello, \"+name\nend",
"def sayhi(name, age)\n puts (\"Hello \" + name + \", you are\" + age.to_s)\nend",
"def greet(first_name, last_name)\n p \"Hey \" + first_name + \", your last name is \" + last_name\nend",
"def greeting \n\t\t\"Hi my name is #{@name}\"\n\tend",
"def greeting(name)\n \"Hello, #{name}!\"\nend",
"def greeting(name)\n puts \"Hello, #{name}\"\nend",
"def greeting(name)\n puts \"Hello, #{name}\"\nend",
"def greeting(name)\n puts \"Good day \"+name.capitalize\nend",
"def greeting(name)\n \"Good to see you #{name}\"\nend",
"def greet(name)\n result = \"Good night #{name}\"\n return result\nend",
"def introduction(name1, name2)\n puts \"Ladies and gentlemen, let me introduce you to Mr. \" + name1 + \" and Mrs. \" + name2 + \"!\"\nend",
"def sayhi(name, age)\n puts (\"Hello\" + name + \", you are \" + age.to_s)\nend",
"def greeter(name)\n return \"Hello, #{name}!\"\nend",
"def greeting(name)\n return \"Hello #{name}! Nice to meet you!\"\nend",
"def greet(first, last)\n p \"Hi, \" + last + \", \" + first\nend",
"def greeting(name)\n \"Good Morning #{name}!\"\nend",
"def greeting(name)\n \"Hello there, \" + name + \"!\"\nend",
"def greet(person)\n puts \"Hello, \" + person\nend",
"def greet(person)\n puts \"Hello, \" + person\nend",
"def say_hello(name)\n return \"Hi, #{name}. Have a good day.\"\nend",
"def introduce\n puts \"Hi my name is #{name} and I am #{age} years old\"\n end",
"def greeting(name)\n puts \"Hello \" + name.strip + \". It's nice to meet you.\"\nend",
"def greeting(name)\n \"Hello #{name}!\"\nend",
"def greeting(name)\n \"Hello #{name}!\"\nend",
"def sayHi\n\t\tputs \"hello, my name is #{@name}\"\n\tend",
"def greeter (name)\n return \"Hello #{name}\"\n end",
"def helloPerson(name)\n puts \"hello #{name.capitalize}!\"\nend",
"def greeting(name)\n \"Hello, \" + name\nend",
"def greeting(name)\n puts \"Hello #{name}\"\n end",
"def greeting (name)\n puts \"What is your name?\"\n name = gets.chomp\n puts \"Hello #{@name}!\"\n end",
"def greet(who)\n\t\"Hello, #{who}!\"\nend",
"def greet(who)\n\t\"Hello, #{who}!\"\nend",
"def greet(who)\n\t\"Hello, #{who}!\"\nend",
"def greeter(name)\n return \"Hello #{name}!\"\nend",
"def greeting(name)\n \"Hello, \" + name + \". How are you doing?\"\nend",
"def greet time, name\n puts \"Good #{time}, #{name}!\"\nend",
"def greetings(name)\n puts \"Hello #{name.capitalize}\"\nend",
"def greeting(name)\n \"Hello \" + name.capitalize + \"!\"\nend",
"def hello(name)\n \n str = \"Hello, #{name}\"\n return str \n \nend",
"def say_hi(name)\n result = \"Hey Hi, #{name}\"\n return result\nend"
] | [
"0.8643108",
"0.8629694",
"0.85908693",
"0.8585934",
"0.85859305",
"0.8548421",
"0.85146636",
"0.8502299",
"0.8491893",
"0.84510684",
"0.841168",
"0.8410347",
"0.8402453",
"0.8391969",
"0.83801395",
"0.83801395",
"0.8360681",
"0.83586866",
"0.8356783",
"0.8335855",
"0.8332421",
"0.83262795",
"0.8315167",
"0.83110374",
"0.83045834",
"0.8299374",
"0.82913595",
"0.8284112",
"0.82520235",
"0.82482874",
"0.82437086",
"0.8237667",
"0.82357657",
"0.82189566",
"0.8217365",
"0.82112783",
"0.8202771",
"0.81986684",
"0.81981725",
"0.81947905",
"0.8194526",
"0.8190859",
"0.8176277",
"0.8171581",
"0.816349",
"0.816163",
"0.8150048",
"0.8125535",
"0.81231695",
"0.8113383",
"0.81092185",
"0.80959016",
"0.8091792",
"0.80787027",
"0.80787027",
"0.80772495",
"0.8073872",
"0.8073324",
"0.8072301",
"0.807193",
"0.8065211",
"0.80619675",
"0.8054315",
"0.80502194",
"0.80448043",
"0.8041609",
"0.8038905",
"0.8038905",
"0.80367774",
"0.8035353",
"0.80311745",
"0.80147094",
"0.80117625",
"0.80084306",
"0.8000438",
"0.79961544",
"0.799205",
"0.79871124",
"0.79838234",
"0.79838234",
"0.79811877",
"0.7974331",
"0.7970574",
"0.7969943",
"0.7969943",
"0.79691297",
"0.796436",
"0.7957121",
"0.79524285",
"0.7951238",
"0.79470754",
"0.79435754",
"0.79435754",
"0.79435754",
"0.7943246",
"0.7942538",
"0.7942442",
"0.7924278",
"0.7914309",
"0.7892784",
"0.78825206"
] | 0.0 | -1 |
Check for valid request token and return user | def authorize_request
@current_user = AuthorizeApiRequest.new(request.headers).call[:user]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_authentication_token\n \n @user = User.find_by_services_authentification_token(params[:auth_token])\n bad_request if @user.nil?\n end",
"def authenticate_user_from_token!\n user_token = params[:auth_token].presence\n user = user_token && User.find_by_authentication_token(user_token.to_s)\n \n unless user\n render json: { errors: 'user must signed in' }, status: :unprocessable_entity\n end\n end",
"def verify_auth_token\n halt 401 unless valid_user?(extracted_token)\n end",
"def authenticate_user_from_token\n unless authenticate_with_http_token { |token, options| User.find_by(auth_token: token) }\n render json: { error: 'Bad Token'}, status: 401\n end\n end",
"def verify_auth_token\n token = params[:auth_token]\n if token.nil?\n render_json_response(400, \"Authorization token needed\")\n return\n end\n\n user = User.find_by_authentication_token(token)\n if user.nil?\n render_json_response(401, \"Bad token\")\n return\n end\n\n @user = user\n end",
"def authenticate_user\n @token = Token.find_by(auth_token: request.headers['HTTP_AUTH_TOKEN'])\n return render json: { message: 'token invalid' }, status: 422 unless @token\n\n @current_user = @token.user\n end",
"def check_authenticate_user\n if request.headers[:token].present?\n @auth_token = AuthToken.find_by(token: request.headers[:token])\n @current_user = auth_token.user if @auth_token.present?\n unless @auth_token && @current_user\n error_response_with_obj(HTTP_UNAUTHORIZED[:code], \"Invalid Authentication token\")\n end\n else\n error_response_with_obj(HTTP_UNAUTHORIZED[:code], \"Invalid Authentication token\")\n end\n end",
"def authenticate_user_from_token!\n\t\t@api_token = ApiToken.find_by_token(params[:token])\n @user = @api_token.try(:user)\n if @user.nil?\n render json: { error: 'Not authorized' }, status: 401\n end\n end",
"def validate_token\n token = params[:token]\n return false if token.nil?\n \n user = User.validate_token(token)\n return false if user.nil?\n \n login_user(user)\n return true\n end",
"def user\n @user ||= User.find(decoded_auth_token[:user_id]) if decoded_auth_token\n @user || errors.add(:token, 'Invalid Token') && nil\n end",
"def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n # else\n # authentication_error\n end\n end",
"def token_verify\r\n\r\n #render json: {id: params[\"user\"][\"id\"], params: params}\r\n \r\n user_tmp = User.find(params[:id])\r\n if user_tmp.authentication_token == params[:authentication_token]\r\n $granted = true\r\n render json: false\r\n else\r\n \r\n render json: false\r\n end\r\n end",
"def check_authentication\n @token = request.headers[:token]\n @user = Usuario.find_by_token(@token) \n if @user ==nil\n json_response={\n error: 'authentication error'\n }\n respond_with json_response, location: nil\n end \n \n end",
"def get_token\n # Get the user by email\n user = User.find_by_email(params[:email])\n \n # return unauthorized if the user was not found\n if !user \n render json: { error: 'unauthorized' }, status: :unauthorized\n return\n end\n \n # if the user is not authenticated via the authenticate method\n # then return unauthorized\n if !user.authenticate( params[:password] )\n render json: { error: 'unauthorized' }, status: :unauthorized\n return\n end\n \n # if our code gets here, we can generate a token and response.\n # JWT's include an expiry, we will expire the token in 24 hours\n token = jwt_encode({user_id: user.id}, 24.hours.from_now)\n render json: {token: token, exp: 24, username: user.email, userId: user.id},\n status: :ok\n \n end",
"def fetch_user_from_auth_token\n @user = decode_auth_token ? User.find(decode_auth_token['user_id']) : nil\n errors.add(:token, 'invalid token') if @user.nil?\n @user\n end",
"def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authenticate_error\n end\n end",
"def authenticate_user_from_token!\n # user_id = params[:user_id].presence\n # user = user_id && User.find(user_id)\n # api_token = params[:api_token] || env['HTTP_API_TOKEN']\n # if user && Devise.secure_compare(user.api_token, api_token)\n # sign_in user, store: false and return\n # end\n\n # render_error({ :error => \"Please sign in first.\" })\n end",
"def authenticate_user_from_token\n unless authenticate_with_http_token { |token, options| User.find_by(api_token: token) }\n render json: { error: 'Bad Token'}, status: 401\n end\n end",
"def authenticate_request!\n\t\t# unless is if in reverse. If user_id_in_token == false then render error\n\t unless user_id_in_token?\n\t render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n\t return\n\t end\n\t @current_user = User.find(auth_token[:user_id])\n\trescue JWT::VerificationError, JWT::DecodeError\n\t render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n\tend",
"def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authentication_error\n end\n end",
"def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authentication_error\n end\n end",
"def check_token\n @usuario = Credentials.check_token(authorization: request.headers[\"Authorization\"])\n end",
"def verify_jwt_token\n begin\n if request.format.json?\n token = request.headers['Authorization'].split(' ').last\n decoded_token = JWT.decode token, nil, false\n @current_user = User.find(decoded_token[0][\"user_id\"])\n head :unauthorized if request.headers['Authorization'].nil? || !AuthToken.valid?(token)\n else\n authenticate_user!\n end\n rescue => exception\n head :unauthorized \n end\n end",
"def verify_token\n associate = Associate.where(id: params[:associate_id])[0] if params[:associate_id]\n #checking signed_in user\n if user_signed_in?\n #checking token is nil or not.\n if params[:token].nil?\n #response in json format\n render :json=> { success: false, message: \"Token is required to proceed further.\" },:status=> 203\n return\n elsif associate && associate.associate_user == true\n return true\n #checking token with the current_user\n elsif current_user.authentication_token != params[:token]\n render :json=> { success: false, message: \"Problem with the authentication token.please check token.\" },:status=> 203\n return\n else\n end\n end\n end",
"def authenticate_user_from_token\n authenticate_with_http_token do |token, options|\n user_email = options[:email]\n user_email && User.where(email: user_email, authentication_token: token).first\n end\n end",
"def check_token\n input_token = request.headers['X-Auth-Token'] || params[:token]\n return unless input_token\n\n token = AuthenticationToken.find_by(token: input_token)\n return unless token\n\n # Count token usage\n token.inc(number_of_use: 1)\n # Update the updated_at because inc doesn't do it\n token.set(updated_at: Time.now.getlocal)\n\n # Sign in\n sign_in token.user\n end",
"def verify_token\n token ||= request.env['HTTP_AUTHORIZATION']\n if token.nil?\n error 401, { :error => 'Unauthorized.' }.to_json\n else\n token = token.split(' ').last unless token.nil?\n begin\n @user = verify(token)\n rescue JWT::ExpiredSignature\n error 401, { :error => 'Expired token.' }.to_json\n end\n end\n end",
"def validate_access_token obj\n if obj[\"access_token\"] == request_details[:access_token]\n User.new(obj)\n else\n false\n end\n end",
"def send_token_for_valid_login_of(user)\n\t\trender json: {token: user.auth_token }\n\tend",
"def valid_token\n StatsManager::StatsD.time(Settings::StatsConstants.api['user']['valid_token']) do\n if ![\"facebook\"].include?(params[:provider]) # using include? allows us to do this for twitter/tumblr in the future\n return render_error(404, \"this route only currently supports facebook as a provider.\")\n end\n\n if auth = current_user.first_provider(params[:provider]) and auth.is_a? Authentication\n @token_valid = GT::UserFacebookManager.verify_auth(auth.oauth_token)\n @status = 200\n else\n return render_error(404, \"This user does not have a #{params[:provider]} authentication to check on\")\n end\n end\n end",
"def authenticate\n authenticate_or_request_with_http_token do |token _options|\n @current_user = User.find_by token: token\n end\n end",
"def authenticate_user_from_token!\n user_token = params[:auth_token].presence\n if user_token\n user = User.where(authentication_token: user_token.to_s).first\n if user\n # Notice we are passing store false, so the user is not\n # actually stored in the session and a token is needed\n # for every request. If you want the token to work as a\n # sign in token, you can simply remove store: false.\n sign_in user, store: false\n else\n render status: 401, json: {success: false, error: \"invalid token\" }\n end\n end\n end",
"def token\n authenticate_username_password || render_unauthorized\n end",
"def verify_access_token\n user = User.find_by(access_token: params[:session][:access_token])\n if user\n render json: user, status: :ok\n else\n render json: 'Token failed verification', status: :unprocessable_entity\n end\n end",
"def verify_access_token\n debugger\n @user = User.find_by(access_token: params[:session][:access_token])\n if @user\n render text: \"verified\", status: 200\n else\n render text: \"Token failed verification\", status: 422\n end\n end",
"def valid_user(user_id)!\n user = User.find(user_id)\n if user\n p \"valid user!!!!!!!!!\"\n if user_id && params[:token] == user.token\n @current_user = user\n @verified_request = true\n p \"valid request!\"\n else\n p \"Salted Token Error\"\n render :json => { :success => false, :message => 'Salted Token Error' }, :status => 401\n end\n else\n p \"user not found :( \"\n #TODO: Hide this error in the future\n render :json => { :success => false, :message => 'User not found!' }, :status => 404\n end\n end",
"def authenticate_user (temp = false)\r\n token = request.headers['token']\r\n user_token = Token.find_by(access_token: token)\r\n @current_user = nil\r\n if params[:hashtoken].present?\r\n if params[:id].present?\r\n hash_token = TokenEventInvite.where(access_token: params[:hashtoken], event_id: params[:id].to_i).first\r\n if hash_token.present?\r\n user_id = hash_token.user_id\r\n @current_user = User.find_by(id: user_id)\r\n else\r\n @current_user = authenticate_old_event( params[:hashtoken], params[:id].to_i)\r\n end\r\n else\r\n hash_token = TokenUserConfirmation.where(access_token: params[:hashtoken]).first ||\r\n TokenPasswordReset.where(access_token: params[:hashtoken]).first\r\n if hash_token != nil\r\n user_id = hash_token.user_id\r\n @current_user = User.find_by(id: user_id)\r\n else\r\n render json: ErrorResponse.new(\r\n code: 401, message: 'Missing token. Authorization has been denied for this request.'\r\n ), adapter: :json, status: :unauthorized unless temp\r\n return nil\r\n end\r\n end\r\n elsif user_token.present?\r\n user_id = user_token.user_id\r\n @current_user = User.find_by(id: user_id)\r\n if @current_user.present? && request.path.include?(\"/ambassador/\")\r\n @current_user = @current_user.admin.present? ? @current_user.admin : @current_user.av_user\r\n end\r\n else\r\n if token.present?\r\n @current_user = authenticate_old( token)\r\n if @current_user.present?\r\n if @current_user.present? && request.path.include?(\"/ambassador/\")\r\n @current_user = @current_user.admin.present? ? @current_user.admin : @current_user.av_user\r\n end\r\n return nil\r\n else\r\n render json: ErrorResponse.new(\r\n code: 401, message: 'User not found. Authorization has been denied for this request.'\r\n ), adapter: :json, status: :unauthorized unless temp\r\n return nil\r\n end\r\n end\r\n render json: ErrorResponse.new(\r\n code: 401, message: 'Missing token. Authorization has been denied for this request.'\r\n ), adapter: :json, status: :unauthorized unless temp\r\n return nil\r\n end\r\n if @current_user.blank?\r\n render json: ErrorResponse.new(\r\n code: 401, message: 'Bad Request: User not found'\r\n ), adapter: :json, status: :unauthorized unless temp\r\n nil\r\n end\r\n end",
"def authenticate_user\n if not params.has_key?(:auth_token)\n failure\n return\n end\n @current_user = User.find_by_authentication_token(params[:auth_token])\n # Adding the conditional to throw json error\n unless @current_user\n failure\n end\n end",
"def verify_access_token\n \tuser = User.find_by(auth_token: params[:session][:auth_token])\n\n \tif user\n \t\trender text: \"verified\", status: 200\n \telse\n \t\trender text: \"Invalid token\", status: 422\n \tend\n end",
"def check_session_create\n if params[:user][:token].present?\n @user = User.find_by_authentication_token(params[:user][:token])\n if @user.blank?\n render :json => {:success => \"false\", :errors => \"authentication failed\"}\n return\n end\n else\n render :json => {:success => \"false\", :errors => \"authentication failed\"}\n end\n end",
"def current_user\n if decode_token\n #returns an array\n #user_id is the key on our payload\n user_id = decode_token[0]['user_id']\n #using user_id to find our user\n @user = User.find_by(id: user_id)\n else\n render json: { message: 'Did not find user.' }, status: :unauthorized \n end\n end",
"def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n user = User.find_by(access_token: auth_token)\n\n fail AccessDenied unless user\n\n @current_user = user\n end",
"def show\n if User.find_by_authentication_token(params[:Token])\n @user = User.find_by_authentication_token(params[:Token])\n batsd_log_success\n elsif !params[:Token]\n batsd_log_error(:type => :auth)\n respond_error(\"No token supplied.\")\n else\n batsd_log_error(:type => :auth)\n respond_error(\"Invalid API key.\")\n end \n end",
"def token\n authenticate_username_password || render_unauthorized\n end",
"def authorize_request\n\t\tauthenticate_with_http_token do |token, options|\n\t\t\tUser.find_by(token: token)\n\t\tend\n\tend",
"def verify\n token = params[:token]\n @user = User.verify token\n if @user\n render json: {\n data: {\n token: @user.token,\n user: @user,\n },\n }\n else\n render json: {message: error_messages[:incorrect_verification_token]},\n status: :unprocessable_entity\n end\n end",
"def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n client_id = request.headers['Client-ID']\n\n if auth_token\n authenticate_with_auth_token(auth_token, client_id)\n else\n authentication_error\n end\n end",
"def token_auth\n user = User.find_by_login_and_single_access_token(params[:login], params[:token])\n respond_to do |format|\n if user\n format.xml { render :xml => \"ok\" }\n else\n format.xml { render :xml => \"fail\" }\n end\n end\n end",
"def request_token\n @token = current_client_application.create_request_token\n if @token\n render :text => @token.to_query\n else\n render :nothing => true, :status => 401\n end\n end",
"def restrict_access\n authenticate_or_request_with_http_token do |token, options|\n if User.exists?(token: token)\n @currentUser = User.find_by_token(token)\n end\n end\n end",
"def require_token_or_user\n if params[:token].present? && params[:salt].present?\n require_token\n else\n require_user\n end\n end",
"def authorize_request\n authenticate_with_http_token do |token, option|\n User.find_by(token: token)\n end\n end",
"def authenticated_user_with_token\n ApiKey.find_user_with_token(decoded_token)\n end",
"def check_auth_token\n token = decoded_auth_token\n render json: { error: 'Not Authorized' }, status: :unauthorized unless token\n end",
"def authorize_request\n authenticate_with_http_token do |token, options|\n User.find_by(token: token)\n end\n end",
"def validation_login\n validate_token User, params[:token]\n end",
"def request_token\n @token=current_client_application.create_request_token\n if @token\n render :text=>@token.to_query\n else\n render :nothing => true, :status => 401\n end\n end",
"def verify_access_token\n auth_token = request.headers['Authorization']\n user_id = auth_token.split(':').first\n \n if user_id == params[:id]\n @user = User.find(user_id)\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: { error: I18n.t('unauthorized') }, status: 401\n end\n end",
"def authenticate_user!\n token, options = ActionController::HttpAuthentication::Token.token_and_options(request)\n\n super unless token == 'rbMmEeoH8RxRDyN24PQv'\n end",
"def authenticate_with_token\n # get the token from the header\n # get the token from the post body\n # get the token from json post\n \n token = request.headers[\"HTTP_AUTHORIZATION\"]\n \n if (!token)\n if (not_protected self.controller_name, self.action_name)\n return nil\n end\n\n redirect_to controller: 'application', action: 'index' \n end\n\n #@user = get_user_by_token(token)\n end",
"def validate_token\n token = params[:token]\n return false if token.nil?\n \n user = User.validate_token(token)\n return false if user.nil?\n \n login_user(user)\n return true\n end",
"def authenticate\n \n authenticate_or_request_with_http_token do |token|\n begin\n decoded = decode(token)\n @current_user = User.find_by(id: decoded[0][\"user_id\"]) \n \n rescue JWT::DecodeError\n render json: {authorized: false }, status: 401 \n end\n end \n end",
"def authenticate_user_from_token!\n raise AuthorizationError unless http_auth_token.present?\n result = find_user\n raise BadRequestError, result.errors if result.failure?\n @current_user = result.current_user\n end",
"def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @user = User.find_by_auth_key(token)\n head :unauthorized unless @user\n return\n end\n end",
"def user \n @user ||= User.find(decoded_token[:user_id]) if decoded_token\n rescue ActiveRecord::RecordNotFound => e \n raise (ExceptionHandler::InvalidToken, e.message)\n end",
"def get_current_user\n return if !bearer_token\n decoded_jwt = decode_token(bearer_token)\n User.find(decoded_jwt[0][\"user\"][\"id\"])\n end",
"def autenticate_user\n auth_token = request.headers[:HTTP_AUTH_TOKEN] #auth_token in header\n return render_message ({status:ERR_STATUS, responseMessage: \"Sorry! You are not an authenticated user.\",responseCode: ERROR}) unless auth_token\n @user = User.find_by(auth_token: auth_token)\n unless @user\n return render_message({status:ERR_STATUS,responseMessage: UNAUTHORIZED_MESSAGE,responseCode: UNAUTHORIZED})\n end\n end",
"def verify_token\n check_auth_token(request.headers['authtoken'],params[:profile_id])\n end",
"def user\n # find a User matching the decoded token if the decode operation was successfull\n user = User.find(decoded_auth_token[:user_id]) if decoded_auth_token\n\n if user\n # return the user if active\n return user if user.active\n\n # Else raise a JWTException Inactive Account\n raise(API::JWTExceptionHandler::InactiveAccount, APIMessages.account_not_active)\n end\n rescue ActiveRecord::RecordNotFound => e\n # Raise an Invalid Token if there is no matching User from db\n raise(API::JWTExceptionHandler::InvalidToken, (\"#{APIMessages.invalid_token} #{e.message}\"))\n end",
"def authorize_request\n authenticate_with_http_token do |token, options|\n User.find_by(token: token)\n end\n end",
"def current_user\n authenticate_token\n end",
"def authenticate_request!\n fail NotAuthenticatedError unless user_id_included_in_auth_token?\n @current_user = User.find(decoded_auth_token[:user_id] || decoded_auth_token[:id])\n fail NotAuthenticated if @current_user.blank?\n rescue JWT::ExpiredSignature, JWT::ImmatureSignature\n raise AuthenticationTimeoutError\n rescue JWT::VerificationError, JWT::DecodeError, ActiveRecord::RecordNotFound\n raise NotAuthenticatedError\n end",
"def authenticate_token!\n return render_error(\"Problem with Authentication Token\",401, 401) unless Token.find_by(access_token: params[:access_token])\n end",
"def valid_token\n return access_token if access_token && !expiring?\n return access_token if request_access_token\n raise 'No valid access token.'\n end",
"def authorize\n @user = User.find_by_id_and_multitrack_token(params[:user_id], params[:token])\n head(@user ? :ok : :forbidden)\n end",
"def token\n authenticated\n end",
"def auth_token\n return token if token.present?\n\n false\n # raise(CustomException::MissingToken, 'token is missing')\n end",
"def validate_token\n return true if @current_username\n token = get_token\n token.force_encoding('utf-8') if token\n token_object = AccessToken.find_by_token(token)\n if token_object && token_object.validated?\n @current_username = token_object.username\n return true\n else\n return false\n end\n end",
"def authenticate\n \t# get token from header\n \tauthentication_token = request.headers['token']\n \t@user = User.find_by_authentication_token authentication_token if authentication_token\n \t\n \tunless @user\n \t\trender json: {success: false, message: I18n.t('unauthorized'), data: {}}, status: :unauthorized\n \t\treturn false\n \tend\n end",
"def require_access_token\n # make sure the request has been signed correctly\n verify_signature\n \n # NOTE make sure you define Controller#find_token which\n # returns an object that responds to the access_token? message\n # access_token? should return true if the token object is an AccessToken\n # it should return false if the token object is a RequestToken\n if !current_token.access_token?\n throw :halt, render(invalid_access_token_message, :status => 401, :layout => false)\n end\n end",
"def user_present?\n user_token_present? && User.find_by(auth_token: user_token)\n end",
"def authenticate_token\n render_401 if @token.blank? || [email protected]?\n end",
"def authenticate!\n client_id = params[:client_id] || params[:query][:client_id] rescue nil\n token = params[:token] || params[:query][:token] rescue nil\n user = User.get_user(client_id, token)\n unless user\n render json: { 'errors' => ['Authorized users only.'] }, status: 401\n end\n user\n end",
"def get_user_by_token(token)\n decoded = JWT.decode(token, 'somesecrethere')\n now = Time.now().to_i\n\n if (decoded[0][:expires] < now)\n return nil\n end\n\n user = User.find_by uuid: decoded[0][:user_id]\n if (!user)\n return nil\n end\n\n return user\n end",
"def token_or_current_or_guest_user\n token_user || current_or_guest_user\n end",
"def authenticate_token \n\t\tauthenticate_with_http_token do | token, options| \n\t\t\tUser.find_by(auth_token: token)\n\t\tend\n\tend",
"def authenticate_user_from_token!\n user_token = params[:auth_token].presence\n user = user_token && User.find_by_authentication_token(user_token.to_s)\n \n if user\n # Notice we are passing store false, so the user is not\n # actually stored in the session and a token is needed\n # for every request. If you want the token to work as a\n # sign in token, you can simply remove store: false.\n sign_in user, store: false\n end\n end",
"def current_user\n token_locations = [cookies[:auth_token], ENV['DANGEROUS_AUTH_HACK'], params[:auth_token]]\n token = token_locations.find{|x| !x.blank? }\n if token\n Identity.includes(:person).find_by(token: token).try(:person)\n else\n nil\n end\n end",
"def call\n fetch_user_from_auth_token\n end",
"def authenticated_user\n return render_error(2, 'Invalid auth token') if logged_device.nil?\n logged_device\n end",
"def get_user_info\n userTokenInfo = request.env['oauth.token']\n @user = userTokenInfo.user\n end",
"def token_verification\n user = User.with_reset_password_token(params[:user][:reset_password_token])\n if user && user.email == params[:user][:email] && user.reset_password_period_valid?\n render_success_response({},\"Token is valid\")\n else\n json_response({\n success: false,\n message: \"Invalid Token\"\n }, 400)\n end\n end",
"def authenticate_request!\n return render_unauthorized unless request.headers['Authorization'].present?\n\n @token ||= AuthenticateRequest.get(User, request.headers['Authorization'].split(' ').last)\n @current_user = @token[:user]\n end",
"def processToken(token, context=nil)\n if token.nil? or token.empty?\n debug(\"Error: processToken: Null/empty token.\")\n return\n end\n stoken = decodeToken token\n stoken = validateToken stoken\n stoken = parse stoken\n unless stoken\n debug(\"Error: processToken: Failed to decode/validate token: #{token}\")\n return\n end\n sappid = stoken['appid']\n unless sappid == appid\n debug(\"Error: processToken: Application ID in token did not match ours: #{sappid}, #{appid}\")\n return\n end\n begin\n user = User.new(stoken['ts'], stoken['uid'], stoken['flags'], \n context, token)\n return user\n rescue Exception => e\n debug(\"Error: processToken: Contents of token considered invalid: #{e}\")\n return\n end\n end",
"def verify_jwt_token\n # token = request.headers['HB-UserToken']\n # if not token\n # render :status => 401, :json => {:message => \"User token required\"}\n # return\n # end\n \n #begin\n # jwt = JWT.decode(token, JWT_SECRET)\n #rescue JWT::DecodeError\n # render :status => :unauthorized, :json => {:message => \"Invalid token\"}\n # return\n #end\n \n #@current_user = User.find_by_authentication_token(jwt[0][\"user_token\"])\n @current_user = User.find_by_email('[email protected]')\n #if not @current_user\n # render :status => 401, :json => {:message => \"Invalid user token\"}\n # return\n #end\n \n @ability = Ability.new(@current_user)\n \n end",
"def current_user\n puts decoded_token\n \n if decoded_token\n # user_id = User.find_by(id: user_id)\n User.find_by(id: decoded_token[0][\"user_id\"])\n\n end\n end",
"def authenticate_request!\n payload, header = JsonWebToken.verify(http_token)\n header if false # Commeent this line\n @requested_user = {\n email: payload['https://sassbox.com/email'],\n first_name: payload['https://sassbox.com/first_name'],\n last_name: payload['https://sassbox.com/last_name']\n }\n rescue JWT::VerificationError, JWT::DecodeError\n render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n end",
"def get_user_by_auth_token\n user = UserSession.find_by_auth_token!(params[:auth_token]).user\n\n json_response 200,\n success: true,\n message_id: 'ok',\n message: I18n.t('success.ok'),\n data: {\n user: user.slice(:id, :username)\n }\n end",
"def get_user_id_from_token\n if request.headers['Authorization'].present?\n @token = request.headers['Authorization'].split(' ').last\n @payload ||= AuthToken.decode(@token)\n if @payload && @payload[:user_id]\n return @payload[:user_id]\n end\n end\n return nil\n end",
"def sign_in\n @user = User.find_by_email(params[:auth][:email])\n if @user && @user.authenticate(params[:auth][:password])\n auth_token = Knock::AuthToken.new payload: { sub: @user.id }\n render json: { username: @user.username, jwt: auth_token.token, moderator: [email protected] }, status: 200\n else \n render json: { error: 'incorrect details entered' }, status: 404\n end\nend",
"def authenticate_or_use_token\n if params[:token].blank?\n return current_account.users.authenticate(params[:login], params[:password])\n else\n return current_account.users.first(:conditions => { :admin_login_token => params[:token] })\n end\n end"
] | [
"0.77663815",
"0.7615777",
"0.74398065",
"0.7404742",
"0.7396012",
"0.73896915",
"0.73461586",
"0.73138165",
"0.7312087",
"0.72945833",
"0.7259202",
"0.7254861",
"0.7249174",
"0.7248579",
"0.7245904",
"0.71891725",
"0.7188027",
"0.71810305",
"0.7180644",
"0.7159302",
"0.7159302",
"0.71532315",
"0.71475273",
"0.7143527",
"0.7136126",
"0.7135483",
"0.71225184",
"0.7121817",
"0.71126986",
"0.71048",
"0.7076257",
"0.7069944",
"0.7067789",
"0.7060205",
"0.70527077",
"0.7048695",
"0.70413315",
"0.70369375",
"0.70255685",
"0.7024279",
"0.70150757",
"0.70043075",
"0.7003298",
"0.6998699",
"0.69914615",
"0.6989353",
"0.69871104",
"0.69867265",
"0.6984563",
"0.697813",
"0.69779766",
"0.69697666",
"0.69632804",
"0.6953819",
"0.6952144",
"0.69448924",
"0.6941756",
"0.69398504",
"0.693975",
"0.6938201",
"0.69321346",
"0.6917815",
"0.6909656",
"0.6869132",
"0.6867449",
"0.6863823",
"0.6861181",
"0.6855956",
"0.68516135",
"0.6838096",
"0.68359566",
"0.683552",
"0.6827409",
"0.681741",
"0.6813272",
"0.67881984",
"0.6780756",
"0.6771654",
"0.6767689",
"0.67532635",
"0.67530465",
"0.67477137",
"0.67449534",
"0.6741985",
"0.6738224",
"0.67351663",
"0.67321897",
"0.6717378",
"0.67161405",
"0.67071784",
"0.6702168",
"0.66986465",
"0.66900647",
"0.6689214",
"0.6688061",
"0.6683699",
"0.6680146",
"0.6663976",
"0.66632164",
"0.6653215",
"0.6648147"
] | 0.0 | -1 |
Usage verdiff [file_path_1,file_path_2,...] [template_directory] | def resolve_path(path)
unless Pathname.new(path).absolute?
File.join(Dir.pwd, path)
else
path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diff_cmd(file, version)\n fail \"The #{self.class} driver does not support the diff_cmd method!\"\n end",
"def diff___( from_file, to_file )\r\n raise StandardError, \"Under investigation\" \r\n got = @ndev.rpc.file_compare( :from_file => from_file, :to_file => to_file )\r\n end",
"def diff( *files, **options )\n\t\treturn self.server.run( :diff, *files, **options )\n\tend",
"def generate_diff(app_file:, prototype_file:)\n rails_file = File.join(app_fetcher.output_dir, app_file)\n prototype_file = File.join(prototype_fetcher.output_dir, prototype_file)\n\n File.join(diff_dir, File.basename(app_file)).tap do |output|\n system \"bin/codediff.py --wrap #{WRAP_WIDTH} --yes #{rails_file} #{prototype_file} -o #{output}\"\n end\n end",
"def file_diff(package, from, to, file)\n ret = true\n Dir.mktmpdir {|tmpdir| \n files_found = system(\"cd #{tmpdir} && #{osc_cmd} co #{from} #{package} #{file} && mv #{file} #{file}.new && #{osc_cmd} co #{to} #{package} #{file} >/dev/null 2>&1\")\n unless files_found\n puts \"=== Cannot check out file #{file} from package #{package}\"\n ret = true\n else\n ret = ! system(\"cd #{tmpdir} && diff #{file} #{file}.new\")\n end\n }\n ret\nend",
"def diff\n require \"tempfile\"\n new_file = Tempfile.new([\"new_config.\", \".yml\"])\n new_file.write(sorted_file)\n result = `git diff --no-index -- #{file} #{new_file.path}`.gsub(\n no_slash_beginning(new_file.path),\n no_slash_beginning(file)\n )\n ensure\n new_file.close\n new_file.unlink\n result\n end",
"def filematch(file1, file2)\n system(\"diff #{file1} #{file2} > /dev/null\")\nend",
"def filematch(file1, file2)\n system(\"diff #{file1} #{file2} > /dev/null\")\nend",
"def test_diff\n \tassert_equal(UI.parseCommand('diff', DiffCmd1*\" \"),UI.main(DiffCmd1))\n \tassert_equal(UI.parseCommand('diff', DiffCmdInv*\" \"),UI.main(DiffCmdInv))\n end",
"def diff_gitignore\n system(\"diff .gitignore ~/code/tmpl/gitignore-gem\")\n end",
"def diff_gitignore\n system(\"diff .gitignore ~/code/tmpl/gitignore-gem\")\n end",
"def diff(v1, v2)\n repos.git.diff(v1, v2, path)\n end",
"def do_diff(base_path, path)\n if base_path.nil?\n # If there's no base path, then the file\n # must have been added\n puts(\"Added: #{path}\")\n name = path\n elsif path.nil?\n # If there's no new path, then the file\n # must have been deleted\n puts(\"Removed: #{base_path}\")\n name = base_path\n else\n # Otherwise, the file must have been modified\n puts \"Modified: #{path}\"\n name = path\n end\n\n # Set up labels for the two files\n base_label = \"#{name} (original)\"\n label = \"#{name} (new)\"\n\n # Output a unified diff between the two files\n puts \"=\" * 78\n differ = Svn::Fs::FileDiff.new(@base_root, base_path, @root, path)\n puts differ.unified(base_label, label)\n puts\n end",
"def template(*path); end",
"def create_template_spec_dot_rb\n\tsystem('touch template_spec.rb')\n\tfile = File.open('template_spec.rb', 'w')\n\tfile.puts(\"require_relative '../lib/template'\")\n\tfile.puts('')\n\tfile.puts('')\n\tfile.puts(\"describe 'the /name/ method' do\")\n\tfile.puts(\"\tit 'should /action/' do\")\n\tfile.puts(\"\t\texpect(/name/(/argument/)).to eq(/result/)\")\n\tfile.puts(\"\tend\")\n\tfile.puts(\"end\")\n\tfile.close\nend",
"def template_for(file); end",
"def templates_for(file); end",
"def createDiffResult(working_dir, channel_cfg, vimapp, isReleaseOperator,backupRoot)\n\n remotedir = readChannelDir(channel_cfg, vimapp) + \"/\"+ File.basename(working_dir)\n puts remotedir.green\n if File.directory?(remotedir) == false\n FileUtils.mkdir_p remotedir\n end\n\n reportFile1 = \"#{remotedir}/report\"\n reportFile2 = \"#{remotedir}/rdetail\"\n lines = File.open(reportFile1, \"r:UTF-8\").each_line.to_a\n\n hashes = Array.new\n lines.each do |line|\n if line.start_with? \"hash=\"\n hashes.push line.gsub(\"hash=\",\"\").strip.chomp\n end\n end\n\n g = gitOpen(working_dir)\n \n logs = getGitLog(g)\n local_branches = getGitBranches(g)[:local]\n diff = compareHashes g, logs, hashes\n \n def getDiffDetails(diffinfo)\n puts \"diffdetails\"\n data = Array.new \n\n diffinfo[:files].each do |file|\n print \"[\"\n print file[0].cyan\n print \"] \"\n print \"[+] #{file[1][:insertions]}\".green\n print \" \"\n print \"[-] #{file[1][:deletions]}\".red\n puts\n # file, insertions, deletions\n data.push \"file=#{file[0]},#{file[1][:insertions]},#{file[1][:deletions]}\"\n end\n\n return data \n end\n\n diff_details = getDiffDetails diff[1]\n \n puts \"\\n\\n|||||||||||||||||||||||||WRITE|||||||||||||||||||||||||||||||||\\n\\n\"\n\n puts \"hash=\"+diff[2]\n puts \"hash=\"+diff[3]\n diff_details.each do |d| \n puts d\n end\n\n diffReportDir = \"#{working_dir}/.diffreport\"\n FileUtils.mkdir_p diffReportDir \n\n #write diff detail to file \n r_detail = \"#{diffReportDir}/detail\"\n\n puts \">> 222\"\n f = File.open(r_detail, \"w:UTF-8\")\n diff[0].each do |l|\n f.puts l\n end\n f.close\n\n f = File.open(r_detail+\".color\", \"w:UTF-8\")\n diff[0].each do |l|\n if isPlus(l)\n f.puts l.green\n elsif isMinus(l)\n f.puts l.red\n else\n f.puts l\n end\n end\n f.close\n\n puts \">> 111\"\n #write diff to file\n diffReport = \"#{diffReportDir}/report\"\n f = File.open(diffReport, \"w:UTF-8\")\n f.puts \"hash=\"+diff[2]\n f.puts \"hash=\"+diff[3]\n diff_details.each do |d| \n f.puts d\n end\n f.close\n puts \"\\n\\nWRITTEN\\n\\n\".green\n\n if isReleaseOperator == false\n FileUtils.cp \"#{diffReport}\", \"#{reportFile1}\"\n FileUtils.cp \"#{r_detail}\", \"#{reportFile2}\"\n else\n metaOK = FileUtils.identical?(diffReport, reportFile1)\n detailOK = FileUtils.identical?(r_detail, reportFile2)\n \n puts \n print \"[ OVERVIEWS ] \" #metaOK.to_s.red\n puts metaOK ? \"IDENTICAL\".green : \"DIFFERENT\".red\n print \"[CODE DETAILS] \"\n puts detailOK ? \"IDENTICAL\".green : \"DIFFERENT\".red\n puts\n def compare(file1, file2)\n puts \">> compare\"\n lines1 = File.open(file1, \"r:UTF-8\").each_line.to_a\n lines2 = File.open(file2, \"r:UTF-8\").each_line.to_a\n def showInclusion(lines1, lines2, i)\n lines1.each do |line|\n if lines2.include?(line) == false\n if i == true\n puts \"[YOURS] \"+ line.chomp.cyan\n else\n puts \"[REMOTE] \"+ line.chomp.yellow\n end\n end\n end\n end\n showInclusion(lines1, lines2, true)\n showInclusion(lines2, lines1, false)\n end\n compare diffReport, reportFile1\n compare r_detail, reportFile2\n end\n\n files = Array.new\n diff_details.each do |d| \n if d.start_with? \"file=\"\n files.push d.gsub(\"file=\",\"\").strip.chomp\n end\n end\n if hashes.size > 0\n #compareBackupsWithOldVersion(g, working_dir, backupRoot, files, hash) \n #compareBackupsWithOldVersion(g, working_dir,backupRoot,files, hash[1]) \n end\n end",
"def generate_diff\n jsons = version_jsons.map { |j| pretty_json(j) }\n differ = Differ.send(diff_method, *jsons).format_as(:html)\n differ.gsub!('<ins', \"\\n<ins\") if diff_method == :diff_by_line\n @diff = sanitize(differ).html_safe\n end",
"def cmd_diff\n print_tree(DiffEditor, nil, true)\n end",
"def diff_strings(a, b)\n require 'tempfile'\n require 'open3'\n\n # Create files\n Tempfile.open('old') do |old_file|\n Tempfile.open('new') do |new_file|\n # Write files\n old_file.write(a)\n old_file.flush\n new_file.write(b)\n new_file.flush\n\n # Diff\n cmd = [ 'diff', '-u', old_file.path, new_file.path ]\n Open3.popen3(*cmd) do |stdin, stdout, stderr|\n result = stdout.read\n return (result == '' ? nil : result)\n end\n end\n end\n rescue Errno::ENOENT\n warn 'Failed to run `diff`, so no diff with the previously compiled ' \\\n 'content will be available.'\n nil\n end",
"def file(context: nil, ignore_deletions: false)\n differ = \"git diff#{cmd}\"\n differ << \" --unified=#{context}\" if context\n differ << \" --diff-filter=d\" if ignore_deletions\n run(differ)\n end",
"def generate_file_diff(left, right, overrides = {})\n defaults = {title_left: 'Expected', title_right: 'Actual', stylesheet: link('styles/compare_it.css')}\n overrides = defaults.merge(overrides)\n # Temporary file for the HTML report - it is deleted after we're done.\n temp_diff_file = Tempfile.new('diff')\n temp_diff_file.close\n # The Windows file paths.\n left_file = Converter.to_windows_path(left)\n right_file = Converter.to_windows_path(right)\n diff_file = Converter.to_windows_path(temp_diff_file.path)\n # Arguments\n # /min - Minimised mode.\n # /G: - Generate report, N - Line numbers, S - Statistics, X - External CSS, 0 - Context lines.\n executable = @config_manager['tool.compare_it.executable']\n args = [left_file, \"/=#{overrides[:title_left]}\", right_file, \"/=#{overrides[:title_right]}\", '/min', '/G:NSX0', diff_file]\n FileUtils.cd(Dir.tmpdir) { system(executable, *args) }\n # The diff content.\n diff_html = File.readlines(temp_diff_file.path)\n diff_html[0] = '<!DOCTYPE html>' + \"\\n\"\n diff_html[6] = '<link href=\"' + overrides[:stylesheet] + '\" rel=\"stylesheet\" type=\"text/css\" />' + \"\\n\"\n # Delete the temporary file.\n temp_diff_file.unlink\n # Return the diff content.\n diff_html.join\n end",
"def template_files\n Pathname.glob(staged_root.join(\"**\", \"*.erb\")).select(&:file?)\n end",
"def test_ut_diff_result_02\n original_file = OriginalFile.new(\n :source_name => \"simple 1\",\n :path => \"http\",\n :normal_result_id => 349898,\n :hirisk_result_id => 4564,\n :critical_result_id => 45 )\n assert_equal(\"simple 1\",original_file.source_name)\n assert_equal(349898,original_file.normal_result_id)\n assert_equal(4564,original_file.hirisk_result_id)\n assert_equal(45,original_file.critical_result_id)\n assert_equal(\"http\",original_file.path)\n end",
"def diff2; end",
"def template_path(filename)\n File.join(PatienceDiff::TEMPLATE_PATH, filename)\n end",
"def diff\n element_name = happy_path? ? @processor.kind.output_name : @processor.kind.error_name\n html_diff(\n @ciat_file.element(element_name).as_file,\n @ciat_file.element(element_name, :generated).as_file, \n @ciat_file.element(element_name, :diff).as_file)\n end",
"def display_diff(version1, version2)\n version1_text = render_wiki_content(:content => version1)\n version2_text = render_wiki_content(:content => version2)\n diff(version1_text, version2_text)\n end",
"def test_file\n assert_pattern_match [ \"/directory\", \"component.vwf\", nil, nil ], \"/directory/component.vwf/\"\n end",
"def templates() = templates_path.glob('**/*.erb')",
"def diff( path, options={} )\n raise Svn::Error, \"cannot diff directory #{path}@#{to_s}\" if dir? path\n\n other = options[:with] if options[:with].is_a? Root\n other = repo.revision(options[:with]) if options[:with].is_a? Numeric\n other ||= repo.revision(to_i - 1)\n\n return other.diff( path, :with => self ) if other < self\n\n content = \"\"\n begin\n content = file_content_stream( path ).to_counted_string\n rescue Svn::Error => err\n raise if options[:raise_errors]\n end\n\n other_content = \"\"\n begin\n other_content= other.file_content_stream( path ).to_counted_string\n rescue Svn::Error => err\n raise if options[:raise_errors]\n end\n\n Diff.string_diff( content, other_content ).unified(\n :original_header => \"#{path}@#{to_s}\",\n :modified_header => \"#{path}@#{other}\"\n )\n end",
"def diff(from, to=nil)\n scm :diff, repository, authentication, \"-r#{from}:#{to || head}\"\n end",
"def diff1; end",
"def diff(from, to=nil)\n scm :diff, repository, authentication, \"-r#{from}:#{to || head}\"\n end",
"def parse_template_files(file_paths)\n require \"tempfile\"\n\n file_paths.each do |file_path|\n remote_path = File.join(latest_release, file_path)\n\n remote_template_paths = []\n\n # If a file was given, see if a template file exists.\n begin\n remote_template_paths += capture(\"ls -1 #{remote_path}.erb\").to_s.split\n rescue Capistrano::CommandError\n end\n\n # If a path was given, see recursively check for any templates.\n begin\n remote_template_paths += capture(\"find #{remote_path} -name '*.erb'\").to_s.split\n rescue Capistrano::CommandError\n end\n\n remote_template_paths.each do |remote_template_path|\n # Download the template path from the server. We want to grab the copy from\n # the server, and not the local copy, since they may differ (If I'm doing\n # a deploy and I haven't done an svn update or I'm deploying a specific\n # branch while sitting in another branch locally).\n Tempfile.open(\"capistrano-template\") do |temp_file|\n get(remote_template_path, temp_file.path)\n\n # Parse the template file as a Ruby file so we can evaluate\n # variables.\n content = File.read(temp_file.path)\n parsed_content = Erubis::Eruby.new(content).result(binding)\n\n logger.info(\"Parsed template file:\\n\\n\")\n puts parsed_content\n logger.info(\"\\n\")\n\n install_remote_path = remote_template_path.gsub(/\\.erb$/, \"\")\n\n # Write the evaluated configuration file to the server as the real\n # configuration file.\n put(parsed_content, install_remote_path)\n end\n end\n end\nend",
"def diff(actor, from=nil, to=nil)\n from ||= current_revision(actor)\n to ||= \"HEAD\"\n `#{svn} diff #{authorization} #{rep_path}@#{from} #{path}@#{to}`\n end",
"def diffsplit( path, options={})\n\t\tvert = \"vertical\" if options[:vertical]\n\t\tVim::command(\"#{vert} diffsplit #{path}\")\n\tend",
"def show_usage_and_exit\r\n puts 'Usage:', 'verifier.rb *filename* file should be a blockchain.txt file'\r\n exit 1\r\nend",
"def copy_template(*args)\n args.each do |path|\n # puts \"Installing #{path}...\".magenta\n remove_file path\n file path, File.read(File.join(@path_templates, path))\n # puts \"\\n\"\n end\nend",
"def compare_inventory_files(old_file, new_file)\n old_inventory = inventory_from(old_file)\n\n\n new_inventory = inventory_from(new_file)\n\n x = (new_inventory - old_inventory).length\n # Excercise: add number of added files\n puts \"The following #{x} file(s) have been added:\"\n puts new_inventory - old_inventory\n\n y = (old_inventory - new_inventory).length\n\n puts \"\"\n # Excercise: add number of deleted files\n puts \"The following #{y} file(s) have been deleted:\"\n puts old_inventory - new_inventory\n\n x = new_inventory.length - x\n\n y = old_inventory.length - y \n\n puts \"\"\n # Excercise: add number of unchanged files\n puts \"Unchanged files: #{x} \"\n puts \"Verification of unchanged files: #{y} \"\nend",
"def diff(other)\n require_cmd! diff_cmd\n out = nil\n\n begin\n this_dir = unpack\n other_dir = other.is_a?(Polisher::Gem) ? other.unpack :\n (other.is_a?(Polisher::Git::Repo) ? other.path : other)\n result = AwesomeSpawn.run(\"#{diff_cmd} -r #{this_dir} #{other_dir}\")\n out = result.output.gsub(\"#{this_dir}\", 'a').gsub(\"#{other_dir}\", 'b')\n rescue\n ensure\n FileUtils.rm_rf this_dir unless this_dir.nil?\n FileUtils.rm_rf other_dir unless other_dir.nil? ||\n !other.is_a?(Polisher::Gem)\n end\n\n out\n end",
"def diff_file(from_file, to_file, context=3)\n seq1 = File.open(from_file).readlines\n from_mtime = File.stat(from_file).mtime\n seq2 = File.open(to_file).readlines\n to_mtime = File.stat(to_file).mtime\n sdiff = Diff::LCS.sdiff(seq1, seq2)\n diff_lines(seq1, seq2, from_file, to_file, from_mtime, \n to_mtime, context)\n end",
"def diff_template= table\n @diff_template = table\n end",
"def test_dirs(desc, dir1, dir2)\n\n test_missing_files(desc, dir1, dir2)\n\n dir_files(dir1).each do |file|\n file2 = file.sub(dir1, dir2)\n if File.exist?(file2)\n if diff = diff_file(file, file2)\n @failures << {\n desc: \"#{desc}\\nDiff of file: #{file.sub(dir1+'/', '')}\\n\",\n result: format_diff(diff)\n }\n pout 'F'.red\n else\n pout '.'.green\n end\n end\n end\nend",
"def template!(path, full_paths = T.unsafe(nil)); end",
"def changes_from_template\n changes_from_document(template, false)\n end",
"def diff(from, to)\n @repository.diff(from, to, path)\n end",
"def diff_dumps(file, timestamp1, timestamp2)\n begin\n puts \"Getting diff comparison from dumps at #{timestamp1} and #{timestamp2}\"\n tempfile1 = Tempfile.new('owr-')\n tempfile2 = Tempfile.new('owr-')\n find_dump(file, timestamp1, tempfile1)\n find_dump(file, timestamp2, tempfile2)\n tempfile1.close\n tempfile2.close\n difference = `diff #{tempfile1.path} #{tempfile2.path}`\n puts difference\n ensure\n tempfile1.unlink\n tempfile2.unlink\n end\nend",
"def template(filename)\n File.binread(File.join(__dir__, 'templates', filename))\n end",
"def cnfs_template(file_name)\n generated_files << template(templates_path.join(\"#{file_name}.erb\"), file_name)\n end",
"def diff(from, to)\n @repo.diff(from, to).path(path)\n end",
"def erubis_template template_filename, *args\n require 'erubis'\n template = Erubis::Eruby.new File.read(template_filename)\n text = template.result *args\n text\nend",
"def diff( string, &block )\n # Make sure the directory of the file exists.\n FileUtils.mkdir_p File.dirname( path )\n\n # Write the new string to the file.\n File.open path, 'w' do |f|\n f << Tilt.new( path ).render( string )\n end\n\n # If the file hasn't been checked in, raise an error.\n sh \"git ls-files #{path} --error-unmatch\" do |err|\n raise Errno::ENOENT, path\n end\n\n # If the file has changed, call the block.\n sh \"git diff --exit-code #{path}\" do |err|\n block.call err\n end\n end",
"def diff_to_compare; end",
"def generate_file_files\n setup\n\n page_file = @template_dir + 'page.rhtml'\n fileinfo_file = @template_dir + 'fileinfo.rhtml'\n\n # for legacy templates\n filepage_file = @template_dir + 'filepage.rhtml' unless\n page_file.exist? or fileinfo_file.exist?\n\n return unless\n page_file.exist? or fileinfo_file.exist? or filepage_file.exist?\n\n debug_msg \"Generating file documentation in #{@outputdir}\"\n\n out_file = nil\n current = nil\n\n @files.each do |file|\n current = file\n\n if file.text? and page_file.exist? then\n generate_page file\n next\n end\n\n template_file = nil\n out_file = @outputdir + file.path\n debug_msg \" working on %s (%s)\" % [file.full_name, out_file]\n rel_prefix = @outputdir.relative_path_from out_file.dirname\n search_index_rel_prefix = rel_prefix\n search_index_rel_prefix += @asset_rel_path if @file_output\n\n asset_rel_prefix = rel_prefix + @asset_rel_path\n\n unless filepage_file then\n if file.text? then\n next unless page_file.exist?\n template_file = page_file\n @title = file.page_name\n else\n next unless fileinfo_file.exist?\n template_file = fileinfo_file\n @title = \"File: #{file.base_name}\"\n end\n end\n\n @title += \" - #{@options.title}\"\n template_file ||= filepage_file\n\n render_template template_file, out_file do |io|\n here = binding\n # suppress 1.9.3 warning\n here.local_variable_set(:asset_rel_prefix, asset_rel_prefix)\n here.local_variable_set(:current, current)\n here\n end\n end\n rescue => e\n error =\n RDoc::Error.new \"error generating #{out_file}: #{e.message} (#{e.class})\"\n error.set_backtrace e.backtrace\n\n raise error\n end",
"def verify_template\n verification_templates(main_only: true).each(&:verify)\n end",
"def templates\n file_list '{templates,puppet}/**/*.{erb,epp}'\n end",
"def template(name)\n File.join TemplatePath, \"#{name}.rb\"\nend",
"def diff(&block); end",
"def template(template_name = 'template.txt')\n File.read([File.dirname(__FILE__), template_name].join('/'))\n end",
"def generate_file_files\n template_file = @template_dir + 'file-page.html.erb'\n debug_msg \"Generating file documentation\"\n @all_files.each do |file|\n debug_msg \" file #{file.path}\"\n outfile = @output_dir + file.path\n @file = file\n self.render_template(template_file, binding(), outfile)\n end\n end",
"def determine_template(options); end",
"def each(options = {}, &block)\n options = { :source => 'files', :context => 3 }.merge options\n Diffy::Diff.new(prepared_expected.to_s, prepared_produced.to_s, options).each &block\n end",
"def template\n File.read(File.expand_path('../../../../templates/violations.md.mustache', __FILE__))\n end",
"def render template, options={}\n put_on_a_hat\n\n if options.has_key? :dir\n template = :\"#{options[:dir]}/#{template}\" if options[:dir]\n\n elsif view_dir\n template = :\"#{view_dir}/#{template}\"\n end\n\n return erubis template, options\n end",
"def show\n render layout: 'diff'\n end",
"def initialize\n @diffoptions = VersionedFiles.format_options['diff_ignore']\n @fname_paths = VersionedFiles.files\n @style = Styler.new\n end",
"def view_template(source, *args, &block)\n config = args.last.is_a?(Hash) ? args.pop : {}\n destination = args.first || source.sub(/\\.tt$/, '')\n \n source = File.expand_path(source.to_s)\n context = instance_eval('binding')\n \n create_file destination, nil, config do\n content = ERB.new(::File.binread(source), nil, '-', '@output_buffer').result(context)\n content = block.call(content) if block\n content\n end\n end",
"def test_version_files_found\n Dir.glob( @setup_issue_show.issues_directory.join('*.show*') ).each do |file|\n version = /(\\d\\.)+/.match( file )[0][0...-1]\n @setup_issue_show.current_version = version\n\n assert_equal \"#{version}.show.html.erb\", @setup_issue_show.show_file.basename.to_s, 'Did not find the expected version file.'\n end\n end",
"def template_file(file)\n File.join(\n MiGA::MiGA.root_path,\n 'lib', 'miga', 'cli', 'action', 'browse', file\n )\n end",
"def template_file\n @template_file || \"#{path}/#{template_name}.#{template_extension}\"\n end",
"def local_diff\n `cd #{@local_path} && git diff HEAD`\n end",
"def runDiffOperation(new_output, old_output, diff_folder)\n #Searching for New & updated files\n @files = Dir.glob(new_output+\"**/**\")\n for file in @files\n partName=file.split(new_output).last \n if (File.directory?(file))\n if !File.exist?(old_output+partName)\n if !File.exist?(diff_folder+partName)\n createFolder(diff_folder+partName)\n puts \"Dir Created -\" + partName\n else\n puts \"Target Dir Exists -\" + partName\n end\n end\n else\n #New file copy operation\n if !File.exist?(old_output+partName) \n folder= partName.split(partName.split(\"/\").last).first\n if folder==nil\n folder=\"\"\n end\n if !File.exist?(diff_folder+folder)\n createFolder(diff_folder+folder)\n puts \"Dir Created -\" + diff_folder+folder\n end\n File.copy(file,diff_folder+folder)\n puts \"New File Copied -\"+file +\" to \"+diff_folder+folder\n #Updated file copy operation\n elsif !(File.compare(file,old_output+partName))\n folder= partName.split(partName.split(\"/\").last).first\n if folder==nil \n folder=\"\"\n end\n if !File.exist?(diff_folder+folder)\n createFolder(diff_folder+folder)\n puts \"Dir Created -\" + diff_folder+folder\n end\n File.copy(file,diff_folder+folder)\n puts \"Updated File Copied -\"+file +\" to \"+diff_folder+folder\n end\n end\n end\n #Searching for Deleted files & creating the list\n deletedFileList=diff_folder+\"deletedFiles.list\"\n timestamp = Time.now.to_s()\n deletedFileName=\"\"\n deletedFilesCount=0;\n @files = Dir.glob(old_output+\"**/**\")\n for file in @files\n partName=file.split(old_output).last\n check=partName.include?'search/'\n if !File.exist?(new_output+partName) && !check\n if !(File.directory?(file))\n deletedFileName=partName.split(\"/\").last\n open(deletedFileList, 'a') { |f|\n f.puts deletedFileName\n }\n end\n# deletedFileName= timestamp +\"\\t\"+deletedFileName\n deletedFilesCount=deletedFilesCount+1 \n end\n end\n if Dir.glob(diff_folder+\"**/**\") .length==0\n if (File.directory?(diff_folder))\n Dir.rmdir(diff_folder)\n end\n if (File.directory?(@book_update_folder))\n Dir.rmdir(@book_update_folder)\n end \n puts \"No Changes made\"\n exit\n end\nend",
"def create_difference_file(diffgraph1, diffgraph2, filename)\n log.info \"[*] Adding additions to difference file\"\n FileUtils.touch(filename)\n triple_output_to_file(diffgraph1, filename, \"+\")\n log.info \"[*] Adding removals to difference file\"\n triple_output_to_file(diffgraph2, filename, \"-\")\n log.info \"[*] Difference file created\"\nend",
"def generate_from_templates\r\n %w{package.json _config.yml}.each do |file|\r\n template file\r\n end\r\n end",
"def test_application_as_file\n assert_pattern_match [ \"/\", \"component.vwf\", nil, nil ], \"/component.vwf\"\n assert_pattern_match [ \"/directory\", \"index.vwf\", nil, nil ], \"/directory\"\n assert_pattern_match [ \"/directory\", \"component.vwf\", nil, nil ], \"/directory/component.vwf\"\n end",
"def generate_in(directory)\n migration_path = File.expand_path(\"#{directory}/#{@filename}\")\n template_type = @change ? 'migration_generate_change_template.erb' : 'migration_generate_up_down_template.erb'\n File.open(migration_path, 'w') { |f| f.write(render \"geode/templates/#{template_type}\") }\n relative_migration_path = Pathname.new(migration_path).relative_path_from(Pathname.pwd).to_s\n puts \"+ Generated migration #{@name} at #{relative_migration_path}\"\n end",
"def add_template_path( args )\n files = args[:files]\n if !(options.templates.frozen?)\n files.each do |fn|\n options.templates << File.expand_path(fn)\n end\n end\n if args[:freeze] == true\n options.templates.freeze\n end\n end",
"def template(from, to)\n erb = File.read(File.expand_path(\"../templates/#{from}\", __FILE__))\n put ERB.new(erb).result(binding), to\nend",
"def template(from, to)\n erb = File.read(File.expand_path(\"../templates/#{from}\", __FILE__))\n put ERB.new(erb).result(binding), to\nend",
"def runDiffOperation(new_output, old_output, diff_folder)\n #Searching for New & updated files\n @files = Dir.glob(new_output+\"**/**\")\n for file in @files\n partName=file.split(new_output).last \n if (File.directory?(file))\n if !File.exist?(old_output+partName)\n if !File.exist?(diff_folder+partName)\n createFolder(diff_folder+partName)\n puts \"Dir Created -\" + partName\n else\n puts \"Target Dir Exists -\" + partName\n end\n end\n else\n #New file copy operation\n if !File.exist?(old_output+partName) \n folder= partName.split(partName.split(\"/\").last).first\n if !File.exist?(diff_folder+folder)\n createFolder(diff_folder+folder)\n puts \"Dir Created -\" + partName\n end\n File.copy(file,diff_folder+folder)\n puts \"New File Copied -\"+file\n #Updated file copy operation\n elsif !(File.compare(file,old_output+partName))\n folder= partName.split(partName.split(\"/\").last).first\n if folder==nil \n folder=\"\"\n end\n if !File.exist?(diff_folder+folder)\n createFolder(diff_folder+folder)\n puts \"Dir Created -\" + partName\n end\n File.copy(file,diff_folder+folder)\n puts \"Updated File Copied -\"+file\n end\n end\n end\n #Searching for Deleted files & creating the list\n deletedFileList=diff_folder+\"deletedList.list\"\n timestamp = Time.now.to_s()\n deletedFileName=\"\"\n deletedFilesCount=0;\n @files = Dir.glob(old_output+\"**/**\")\n for file in @files\n partName=file.split(old_output).last\n if !File.exist?(new_output+partName)\n if (File.directory?(file))\n deletedFileName=partName + \"/\"\n else\n deletedFileName=partName\n end\n# deletedFileName= timestamp +\"\\t\"+deletedFileName\n open(deletedFileList, 'a') { |f|\n f.puts deletedFileName\n }\n deletedFilesCount=deletedFilesCount+1 \n end\n end\n if Dir.glob(diff_folder+\"**/**\") .length==0\n if (File.directory?(@book_prod_final_update_folder))\n Dir.rmdir(@book_prod_final_update_folder)\n end\n if (File.directory?(diff_folder))\n Dir.rmdir(diff_folder)\n end\n if (File.directory?(@book_update_folder))\n Dir.rmdir(@book_update_folder)\n end \n puts \"No Changes made\"\n exit\n end\nend",
"def diff_unified(text_old, text_new, label=\"--- old\\n+++ new\\n\", context=3)\n tmp_old = \"_tmp.old.#{rand()}\"\n tmp_new = \"_tmp.new.#{rand()}\"\n File.open(tmp_old, 'w') {|f| f.write(text_old) }\n File.open(tmp_new, 'w') {|f| f.write(text_new) }\n begin\n #diff = `diff -u #{tmp_old} #{tmp_new}`\n diff = `diff --unified=#{context} #{tmp_old} #{tmp_new}`\n ensure\n File.unlink(tmp_old)\n File.unlink(tmp_new)\n end\n diff.sub!(/\\A\\-\\-\\-.*\\n\\+\\+\\+.*\\n/, label.to_s)\n return diff\n end",
"def setup_rspec\n template('.rspec.tt', '.rspec')\n template('Rakefile.tt', 'Rakefile')\n template('spec/lib/versioned/version_spec.rb.tt', \"spec/#{version_path.sub(/\\.rb$/, '_spec.rb')}\")\n template('spec/lib/versioned_spec.rb.tt', \"spec/lib/#{namespaced_path}_spec.rb\")\n template('spec/spec_helper.rb.tt', 'spec/spec_helper.rb')\n end",
"def assert_renders_correctly(name, path)\n input_source = path.read\n output_source = @handler.compile(Template.new(input_source))\n value = @view.instance_eval output_source\n reference = (REFERENCE_PATH + @view.prawnto_options[:filename]).read\n\n message = \"template: #{name}\\n\"\n message += \">\"*30 + \" original template: \" + \">\"*20 + \"\\n\"\n message += input_source + \"\\n\"*2\n message += \">\"*30 + \" manipulated template: \" + \">\"*20 + \"\\n\"\n message += output_source + \"\\n\" + \"<\"*60 + \"\\n\"\n\n assert_equal reference, value, message\n end",
"def create_view_templates\n unless @check_migration\n template 'views/images.html.erb', File.join(file_path, \"_images.html.erb\")\n template 'views/image.html.erb', File.join(file_path, \"_image.html.erb\")\n template 'views/images_field.html.erb', File.join(file_path, \"_images_field_#{@chunk}.html.erb\")\n else\n unless File.exists?(\"#{file_path}/_images_field_#{@chunk}.html.erb\")\n template 'views/images_field.html.erb', File.join(file_path, \"_images_field_#{@chunk}.html.erb\")\n end\n end\n end",
"def versionfile(dir = Dir.pwd, options = {})\n file = (options[:file]) ? options[:file] : 'VERSION'\n version = (options[:version]) ? options[:version] : '0.0.0'\n info \" ==> bootstrapping a VERSION file\"\n path = normalized_path(dir)\n path = FalkorLib::Git.rootdir(path) if FalkorLib::Git.init?(path)\n unless Dir.exist?( path )\n warning \"The directory #{path} does not exists and will be created\"\n really_continue?\n FileUtils.mkdir_p path\n end\n versionfile = File.join(path, file)\n if File.exist?( versionfile )\n puts \" ... not overwriting the #{file} file which already exists\"\n else\n FalkorLib::Versioning.set_version(version, path, :type => 'file',\n :source => { :filename => file })\n Dir.chdir( path ) do\n run %( git tag #{options[:tag]} ) if options[:tag]\n end\n end\n\n # unless File.exists?( versionfile )\n # run %{ echo \"#{version}\" > #{versionfile} }\n # if FalkorLib::Git.init?(path)\n # FalkorLib::Git.add(versionfile, \"Initialize #{file} file\")\n # Dir.chdir( path ) do\n # run %{ git tag #{options[:tag]} } if options[:tag]\n # end\n # end\n # else\n # puts \" ... not overwriting the #{file} file which already exists\"\n # end\n end",
"def createIndexFileWithVersionInfo\n\tindex = fileRead(\"config/www/index.html\")\n\tversion = readVersionNumber()\n\tgitInfo = readGitInfo(\"evothings-client\", \".\")\n\[email protected] do |lp|\n\t\tif(lp[:location].start_with?(\"http://\") or lp[:location].start_with?(\"https://\"))\n\t\t\tcmd = \"git ls-remote #{lp[:location]} HEAD\"\n\t\t\tputs cmd\n\t\t\thash = open(\"|#{cmd}\").read.strip.split[0]\n\t\t\tgitInfo << \"\\n<br/>\" + \"#{lp[:name]}: #{hash[0,8]}\"\n\t\telse\n\t\t\tgitInfo << \"\\n<br/>\" + readGitInfo(lp[:name], lp[:location])\n\t\tend\n\tend\n\tversionString = \"#{version}<br/>\\n<br/>\\n#{gitInfo}<br/>\\n\"\n\tif(!index.gsub!(\"<version>\", versionString))\n\t\traise \"Could not find <version> in config/www/index.html\"\n\tend\n\tfileSave(\"www/index.html\", index)\nend",
"def read_file(template)\r\n File.read(template)\r\nend",
"def generate_matchfile_content(template: nil)\n project = UI.input(\"What is your GitLab Project (i.e. gitlab-org/gitlab): \")\n\n return \"gitlab_project(\\\"#{project}\\\")\"\n end",
"def diff(prefix, diff_format)\n versions = OneCfg::EE::Config::Versions.new\n migrators = versions.migrators\n migrators = migrators.get_migrators_range(migrators.all_from,\n versions.cfg_version)\n migrators.select! {|m| m.yaml? }\n\n migrator = migrators.last\n\n # load YAML descriptor\n if migrator.nil?\n raise OneCfg::Config::Exception::UnsupportedVersion,\n 'Could not find suitable migrator with files'\n end\n\n migrator.load_yaml\n\n if !migrator.yaml || !migrator.yaml['patches']\n # this should not happen\n raise OneCfg::Config::Exception::FatalError,\n \"Migrator for #{migrator.label} doesn't have valid YAML\"\n end\n\n ###\n\n OneCfg::LOG.debug('Comparing against state from ' \\\n \"#{migrator.label} migrator\")\n\n patch_gen = OneCfg::EE::Patch::Generate.new(prefix)\n\n # process each file from descriptor\n migrator.yaml['patches'].each do |name, info|\n patch_gen.add(name, info)\n end\n\n case diff_format\n when 'yaml'\n patch_gen.generate_yaml\n when 'line'\n patch_gen.generate_line\n else\n patch_gen.generate_hintings\n end\n end",
"def templates\n Dir.glob(::Webby.path('examples') / '*').sort\n end",
"def native(from,to)\n command = \"cd #{@repodir} ; git diff --name-status #{from} #{to}\"\n puts \"Checking difference : \\n#{command}\"\n result = `#{command}`\n exitcode = $?\n exit -1 unless exitcode == 0\n return result.split(/\\n/)\n end",
"def template_result template, context, template_file\n template.filename = template_file.to_s\n template.result context\n rescue NoMethodError => e\n raise RDoc::Error, \"Error while evaluating %s: %s\" % [\n template_file.expand_path,\n e.message,\n ], e.backtrace\n end",
"def update_template_files(opts)\n template_id = opts.delete(:template_id)\n path = \"/template/update_files/#{template_id}\"\n prepare_files opts\n\n HelloSign::Resource::Template.new post(path, body: opts)\n end",
"def diff(from, to=nil)\n from << \"..#{to}\" if to\n scm :diff, from\n end",
"def dodiff(item)\n trmt = Tempfile.new([tolocalname(item, @itemkey)+'_remote_', '.lua'])\n tlcl = Tempfile.new([tolocalname(item, @itemkey)+'_local_', '.lua'])\n if item.has_key? :script then\n Pathname.new(tlcl.path).open('wb') do |io|\n io << item[:script]\n end\n else\n Pathname.new(tlcl.path).open('wb') do |io|\n io << item[:local_path].read\n end\n end\n df = \"\"\n begin\n download(Pathname.new(trmt.path), item)\n\n cmd = $cfg['diff.cmd'].shellsplit\n cmd << trmt.path.gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR || ::File::SEPARATOR)\n cmd << tlcl.path.gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR || ::File::SEPARATOR)\n\n df, _ = Open3.capture2e(*cmd)\n ensure\n trmt.close\n trmt.unlink\n tlcl.close\n tlcl.unlink\n end\n df\n end",
"def process(arguments)\n options = {}\n exclude_args = [:from, :to, :tab_delimited]\n arguments.each_pair do |arg, val|\n options[arg] = val if val && !exclude_args.include?(arg)\n end\n options[:csv_options] = {:col_sep => \"\\t\"} if arguments.tab_delimited\n rep = CSVDiff::Report.new\n rep.diff(arguments.from, arguments.to, options)\n\n output_dir = FileTest.directory?(arguments.from) ?\n arguments.from : File.dirname(arguments.from)\n left_name = File.basename(arguments.from, File.extname(arguments.from))\n right_name = File.basename(arguments.to, File.extname(arguments.to))\n output = arguments.output ||\n \"#{output_dir}/Diff_#{left_name}_to_#{right_name}.diff\"\n rep.output(output, arguments.format)\n end",
"def read_file(template)\n File.read(template)\nend",
"def print_file_diffs(file_safety, repo, fname, user_name)\n entry = file_safety[fname]\n if entry.nil?\n # File not in audit list\n elsif entry[\"safe_revision\"].nil?\n puts \"No safe revision for #{fname}\"\n rev = %x[svn info -r head \"#{repo}/#{fname}\"].match('Last Changed Rev: ([0-9]*)').to_a[1]\n if rev\n mime_type = %x[svn propget svn:mime-type \"#{repo}/#{fname}\"].chomp\n if ['application/octet-stream'].include?(mime_type)\n puts \"Cannot display: file marked as a binary type.\"\n puts \"svn:mime-type = #{mime_type}\"\n else\n fdata = %x[svn cat -r \"#{rev}\" \"#{repo}/#{fname}\"]\n # TODO: Add header information like svn\n begin\n puts fdata.split(\"\\n\").collect{|line| \"+ #{line}\"}\n rescue ArgumentError # invalid byte sequence in UTF-8\n puts \"+ \" + fdata\n end\n end\n puts \"To flag the changes to this file as safe, run:\"\n else\n puts \"Please code review a recent working copy, note the revision number, and run:\"\n rev = '[revision]'\n end\n puts %( rake audit:safe release=#{rev} file=#{fname} reviewed_by=#{user_name} comments=\"\")\n puts\n else\n if entry[\"last_changed_rev\"].nil?\n update_changed_rev(file_safety, [fname])\n end\n svnlatest = entry[\"last_changed_rev\"] # May have been prepopulated en mass\n if entry[\"last_changed_rev\"] == -1\n # Not in svn repository\n elsif svnlatest > entry['safe_revision']\n cmd = \"svn diff -r #{entry['safe_revision']}:#{svnlatest} -x-b #{repo}/#{fname}\"\n puts cmd\n system(cmd)\n puts %(To flag the changes to this file as safe, run:)\n puts %( rake audit:safe release=#{svnlatest} file=#{fname} reviewed_by=#{user_name} comments=\"\")\n puts\n else\n # Safe\n end\n end\nend",
"def matching_views_in_source_location\n location_without_extension = source_location.chomp(File.extname(source_location)).split(\"/\").tap do |pathname|\n pathname.last.delete_suffix! \"_component\"\n end.join(\"/\")\n Dir[\"#{location_without_extension}.liquid\", \"#{location_without_extension}_component.liquid\"]\n end"
] | [
"0.6310686",
"0.6279778",
"0.6132113",
"0.5863539",
"0.58592904",
"0.5843786",
"0.58210397",
"0.5820684",
"0.5801605",
"0.57951117",
"0.57951117",
"0.57612795",
"0.5740408",
"0.57354623",
"0.5695076",
"0.56876934",
"0.56864756",
"0.5640578",
"0.5587838",
"0.55745655",
"0.5570895",
"0.55571073",
"0.5555074",
"0.5520462",
"0.545656",
"0.5450844",
"0.54478794",
"0.5435132",
"0.54292923",
"0.5415426",
"0.53946006",
"0.5392648",
"0.5346378",
"0.53121495",
"0.5309473",
"0.52999",
"0.52992445",
"0.5297652",
"0.52804923",
"0.52688754",
"0.52681905",
"0.5263048",
"0.5262054",
"0.5261936",
"0.52579135",
"0.5244213",
"0.52437997",
"0.52382916",
"0.5211653",
"0.52111924",
"0.5209235",
"0.519181",
"0.518802",
"0.51873565",
"0.51695204",
"0.5165025",
"0.51609606",
"0.51593447",
"0.5158656",
"0.5146976",
"0.51445496",
"0.5140498",
"0.5126836",
"0.5119097",
"0.5115782",
"0.5109872",
"0.5108691",
"0.51030827",
"0.5099439",
"0.50909543",
"0.5086198",
"0.50677985",
"0.5059774",
"0.50497913",
"0.5048771",
"0.5041078",
"0.5040931",
"0.5034871",
"0.5030169",
"0.5029731",
"0.5029731",
"0.5029639",
"0.50295544",
"0.5027864",
"0.50261945",
"0.50192523",
"0.50167274",
"0.5012089",
"0.5007927",
"0.5001014",
"0.5000829",
"0.5000683",
"0.4997317",
"0.49934876",
"0.49839377",
"0.49832636",
"0.49796757",
"0.4978666",
"0.49770346",
"0.4970848",
"0.49707356"
] | 0.0 | -1 |
This method generates an array of all moves that can be made after the current move. | def children
node_arr = []
(0..2).each do |row|
(0..2).each do |col|
if @board.empty?([row, col])
updated_board = @board.dup
updated_board[[row, col]] = @next_mover_mark
updated_positions = @prev_move_pos.dup
updated_positions += [row, col]
node_arr << TicTacToeNode.new(updated_board, @next_mover_mark == :o && :x || :o, updated_positions)
end
end
end
node_arr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_possible_moves\n positions_array = []\n x = @position[0]\n y = @position[1]\n next_position = [x+1,y+2]\n positions_array << next_position if position_check(next_position)\n next_position = [x+1,y-2]\n positions_array << next_position if position_check(next_position)\n next_position = [x-1,y+2]\n positions_array << next_position if position_check(next_position)\n next_position = [x-1,y-2]\n positions_array << next_position if position_check(next_position)\n next_position = [x+2,y+1]\n positions_array << next_position if position_check(next_position)\n next_position = [x+2,y-1]\n positions_array << next_position if position_check(next_position)\n next_position = [x-2,y+1]\n positions_array << next_position if position_check(next_position)\n next_position = [x-2,y-1]\n positions_array << next_position if position_check(next_position)\n positions_array\n end",
"def generate_moves\n @delta.each do |step|\n new_pos = [@pos[0] + step[0], @pos[1] + step[1]]\n @move_list << new_pos if valid_coord?(new_pos)\n end\n end",
"def moves\n possible_moves = []\n dir do |dir|\n possible_moves += MyDirections(pos, dir)\n end\n possible_moves\n end",
"def generate_moves\n @delta.each do |step|\n (1..7).each do |i|\n new_pos = [@pos[0] + step[0] * i, @pos[1] + step[1] * i]\n if valid_coord?(new_pos)\n @move_list << new_pos\n break if @board[new_pos]\n else\n break\n end\n end\n end\n end",
"def possible_moves\n return []\n end",
"def all_moves_array(initial_x, initial_y)\n\t\tfinal = []\n\t\tx = initial_x + 2\n\t\tfinal << [x, initial_y+1] << [x, initial_y-1]\n\t\tx = initial_x - 2\n\t\tfinal << [x, initial_y+1] << [x, initial_y-1]\n\t\ty = initial_y + 2\n\t\tfinal << [initial_x+1, y] << [initial_x-1, y]\n\t\ty = initial_y - 2\n\t\tfinal << [initial_x+1, y] << [initial_x-1, y]\n\t\tfinal\n\tend",
"def moves\n poss_moves = []\n determine_moves.each do |diff| #array of directions\n poss_moves += grow_unblocked_moves_in_dir(diff[0],diff[1])\n end\n poss_moves\n end",
"def regular_moves\n moves = [] # initializes empty move array\n\n # choses \"forward\" y direction based on piece team\n if @team == \"l\"\n dir = 1\n else\n dir = -1\n end\n \n # looks at the two forward diagonal positions and adds them to moves array if there are no pieces there\n pos1 = [@x_pos + 1, @y_pos + dir]\n moves << pos1 if Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos1}\n pos2 = [@x_pos - 1, @y_pos + dir]\n moves << pos2 if Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos2}\n \n # deletes any moves with coordinates that aren't on the board\n moves.delete_if{|move| move.find{|n| n < 0 || n > 7}}\n return moves \n end",
"def moves\n possible_moves = []\n\n self.move_dirs.each do |dir|\n num_steps = 1\n blocked = false\n\n until blocked\n next_step = [dir[0]*num_steps, dir[1]*num_steps]\n next_pos = [self.pos[0] + next_step[0], self.pos[1] + next_step[1]]\n\n break unless next_pos.all? { |i| i.between?(0,7) }\n\n if self.board[next_pos]\n blocked = true\n possible_moves << next_pos unless self.color == self.board[next_pos].color\n else\n possible_moves << next_pos\n num_steps += 1\n end\n end\n end\n\n possible_moves\n end",
"def get_all_possible_moves\n possible_moves = []\n @MOVES.each do |arr|\n possible_moves += get_possible_moves(arr)\n end\n possible_moves\n end",
"def moves \r\n move = []\r\n move_directions do |dir|\r\n move += grow_unblocked_moves_in_dir(*dir)\r\n end\r\n move\r\n end",
"def moves\n output = []\n move_one = false\n @directions = @directions.take(3) if position != @initial_position\n directions.each_index do |index|\n possible_position = [position[0] + directions[index][0],position[1] + directions[index][1]]\n if index.even?\n if board.in_bounds?(possible_position) && occupied?(possible_position)\n output << possible_position unless board[possible_position].color == board[position].color\n end\n elsif index == 1\n if board.in_bounds?(possible_position) && !occupied?(possible_position)\n output << possible_position\n move_one = true\n end\n elsif board.in_bounds?(possible_position) && !occupied?(possible_position)\n output << possible_position if move_one\n end\n end\n output\n end",
"def moves; [] end",
"def get_next_moves\n children = Array.new()\n new_move = @moves + 1\n @code.length.times do |i|\n move_up = Combination.new(next_code(i, :up), self, new_move)\n move_down = Combination.new(next_code(i, :down), self, new_move)\n children.push(move_down, move_up)\n end\n children\n end",
"def generate_possible_moves(state)\n end",
"def possible_moves(board)\n poss_move_array = []\n current_square = @history.last\n current_coords = parse_coord(current_square)\n\n poss_move_array.push(single_march(current_coords, board)) if single_march(current_coords, board)\n\n poss_move_array.push(double_march(current_coords, board)) if first_move? && double_march(current_coords, board)\n\n valid_diagonals(current_coords, board).each { |move| poss_move_array.push(move) }\n\n # en passant only allowed opportunity first created\n poss_move_array.push(en_passant?(current_coords, board)) if en_passant?(current_coords, board)\n\n poss_move_array\n end",
"def moves\n # create array to collect moves\n final_array = []\n\n\n\n pos = self.move_dirs\n\n pos.each do |optional_pos|\n\n end\n\n # Note do these logics for all the optional positions \n spec_dx = pos[0]\n spec_dy = pos[1]\n\n possible_movements = grow_unblocked_moves_in_dir(spec_dx, spec_dy)\n possible_movements\n # ending\n\n\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n\n # return the final array of moves (containing all possible moves in all directions)\n end",
"def moves\n possible_moves = []\n\n move_dirs.each do |dir|\n possible_moves.concat(grow_unblocked_moves_in_dir(dir[0], dir[1])) \n end\n\n possible_moves \n end",
"def moves\n pos = self.current_position\n moves = []\n move_dirs.each do |arr|\n @current_position = pos\n loop do\n @current_position = [@current_position[0] + arr[0], @current_position[1] + arr[1]]\n break if [@current_position[0], @current_position[1]].any? { |val| val < 0 || val > 7 }\n if board.pos_occupied?(@current_position)\n if @board[@current_position].color == self.color\n break\n else\n moves << @current_position\n break\n end\n moves << @current_position\n end\n moves << @current_position\n end\n end\n moves\n end",
"def possible_moves\n all_moves = []\n x, y = @position\n moves = [[x, y-1], [x-1, y-1], [x-1, y], [x-1, y+1], [x, y+1], [x+1, y+1], [x+1, y], [x+1, y-1]]\n moves.each do |position|\n all_moves << [position] if position.all? { |number| number.between?(0,7) }\n end\n all_moves\n end",
"def moves!\n total_possible_moves = []\n total_possible_moves.concat(diag_moves(diag_initializer))\n total_possible_moves.concat(straight_moves(move_initializer))\n total_possible_moves.select { |move| self.valid_move?(move) }\n end",
"def moves\n moves = []\n\n # call move_dirs and generate moves\n move_dirs.each do |x,y|\n moves += valid_positions(x,y)\n end\n moves\n end",
"def moves\n available_moves = []\n\n deltas.each do |delta|\n next_move = self.position.zip_sum(delta)\n break unless on_board?(next_move)\n break unless empty_square?(next_move)\n available_moves << next_move\n end\n\n available_moves + capture_moves\n end",
"def listLegalMoveAll\n result = [] ;\n for x in 0..3\n for y in 0..3\n from = Pos.new(x,y) ;\n r = self.listLegalMoveFrom(from) ;\n r.shift ;\n result += r ;\n end\n end\n return result ;\n end",
"def moves\n available_moves = []\n\n deltas.each do |delta|\n next_move = self.position.zip_sum(delta)\n break unless empty_square?(next_move)\n if on_board?(next_move)\n available_moves << next_move\n end\n end\n\n available_moves + capture_moves\n end",
"def possible_moves\n possible_moves = []\n\n # move up\n up_right = [start[X] + 1, start[Y] + 2]\n possible_moves << up_right\n\n up_left = [start[X] - 1, start[Y] + 2]\n possible_moves << up_left\n\n # move right\n right_up = [start[X] + 2, start[Y] + 1]\n possible_moves << right_up\n\n right_down = [start[X] + 2, start[Y] - 1]\n possible_moves << right_down\n\n # move down\n down_right = [start[X] + 1, start[Y] - 2]\n possible_moves << down_right\n\n down_left = [start[X] - 1, start[Y] - 2]\n possible_moves << down_left\n\n # move left\n left_up = [start[X] - 2, start[Y] + 1]\n possible_moves << left_up\n\n left_down = [start[X] - 2, start[Y] - 1]\n possible_moves << left_down\n\n possible_moves.select { |move| @board.valid_position?(move) }\n\n end",
"def jump_moves\n moves = [] # initializes empty move array\n\n # choses \"forward\" y direction based on piece team\n if @team == \"l\"\n dir = 1\n else\n dir = -1\n end\n\n # looks at the two forward far diagonal positions and adds them to moves array if there are no pieces there and an opponent piece in between\n pos1 = [@x_pos + 2, @y_pos + 2*dir]\n moves << pos1 if Piece.all.find{|p| p.x_pos == @x_pos + 1 && p.y_pos == @y_pos + dir && p.team != @team} && Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos1}\n pos2 = [@x_pos - 2, @y_pos + 2*dir]\n moves << pos2 if Piece.all.find{|p| p.x_pos == @x_pos - 1 && p.y_pos == @y_pos + dir && p.team != @team} && Piece.all.none?{|p| [p.x_pos, p.y_pos] == pos2}\n \n\n # deletes any moves with coordinates that aren't on the board\n moves.delete_if{|move| move.find{|n| n < 0 || n > 7}}\n return moves\n end",
"def moves\n # create array to collect moves\n possible_moves = []\n move_dirs.each do |dir|\n possible_moves += grow_unblocked_moves_in_dir(dir[0],dir[1])\n end\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n\n # return the final array of moves (containing all possible moves in all directions)\n possible_moves\n end",
"def moves\n moves = []\n\n x, y = self.position\n sign = self.color == :white ? 1 : -1\n init_row = self.color == :white ? 1 : 6\n\n one_up = [x + (1 * sign), y]\n two_up = [x + (2 * sign), y]\n\n moves << one_up if self.board[one_up].nil?\n\n if (self.board[one_up].nil? && self.board[two_up].nil? && self.position.first == init_row)\n moves << two_up\n end\n\n diag_left = [x + (1 * sign), y + 1]\n diag_right = [x + (1 * sign), y - 1]\n\n if self.board[diag_left] && self.board[diag_left].color != self.color\n moves << diag_left\n end\n\n if self.board[diag_right] && self.board[diag_right].color != self.color\n moves << diag_right\n end\n\n moves.select { |move| on_board?(move) }\n end",
"def possibleMoves(arr,visited)\n moves = []\n VALID_MOVES.each do |x,y|\n if valid?([arr[0]+x,arr[1]+y],visited)\n moves.push([arr[0]+x,arr[1]+y])\n end\n end\n return moves\n end",
"def moves\n # All pieces can stay in place\n [[0,0]]\n end",
"def moves\n all_moves = []\n self.move_dirs.each do |move| \n if ((0..7).include?(self.pos[0] + move[0]) && (0..7).include?(self.pos[1] + move[1])) && !(@board[(self.pos[0] + move[0]), (self.pos[1] + move[1])].is_a?(Piece)) #|| self.color == \n all_moves << [(self.pos[0] + move[0]), (self.pos[1] + move[1])]\n end \n end\n all_moves\n end",
"def moves\n res = []\n move_dirs.each do |pos| # [0, 1]\n dx, dy = pos # 0, 1\n temp = grow_unblocked_moves_in_dir(dx, dy) # 0, 1 => [[0, 1], [0, 2], [0, 3], [0, 4], [0, 5], [0, 6]]\n res += temp \n end\n res \n\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n\n # return the final array of moves (containing all possible moves in all directions)\n end",
"def moves\n moves = []\n\n move_dirs.each do |dir| #[1,1]\n dx, dy = dir #1 0\n new_pos = grow_unblocked_moves_in_dir(dx, dy) #[1,0][2,0][3,0][4,0],[5,0][6,0][7,0]\n moves += new_pos\n end\n\n moves\n end",
"def valid_moves\n moves = []\n\n # go in all directions\n (-1..1).each do |_x_step|\n (-1..1).each do |_y_step|\n # start walking in that direction\n (1..7).each do |steps|\n x = x_coordinate + steps * x_direction\n y = y_coordinate + steps * y_direction\n\n # stop walking if you hit a wall\n break unless valid_move?(x, y)\n\n # remember the valid moves\n moves.push(Move.new(x, y))\n end\n end\n end\n moves\n end",
"def moves\n return [] if @position.empty?\n possible_moves = []\n move_dirs.each do |dir| #[-1,-1]\n test_pos = @position #[1,3] - current position\n valid = true\n while valid\n x = dir.first + test_pos.first\n y = dir.last + test_pos.last\n test_pos = [x,y]\n valid = valid_move?([x,y])\n possible_moves << [x,y] if valid\n valid = false if valid == :attack\n end\n end\n possible_moves\n end",
"def generate_successors\n @successors =\n [Move.new(x + 2, y + 1, self)] +\n [Move.new(x + 2, y - 1, self)] +\n [Move.new(x - 2, y + 1, self)] +\n [Move.new(x - 2, y - 1, self)] +\n [Move.new(x + 1, y + 2, self)] +\n [Move.new(x + 1, y - 2, self)] +\n [Move.new(x - 1, y + 2, self)] +\n [Move.new(x - 1, y - 2, self)]\n successors_copy = []\n @successors.each do |successor|\n successors_copy += [successor] if (0..7) === successor.x && (0..7) === successor.y\n end\n @successors = successors_copy\n end",
"def children\n mark = self.next_mover_mark\n possible_moves = []\n (0...3).each do |row|\n (0...3).each do |col|\n pos = [row, col]\n if board.empty?(pos)\n possible_board = board.dup\n prev_move_pos = pos\n possible_board[pos] = mark\n possible_moves << possible_board\n end\n end\n end\n possible_moves\n end",
"def find_all_moves\n stack = []\n stack << @initial_move\n until stack.empty?\n current_node = stack.shift\n calc_move(current_node)\n stack << current_node.children\n stack.flatten!\n end\n end",
"def children\n potential_moves = []\n @board.rows.each_with_index do |row, i|\n row.each_with_index do |ele, j|\n pos = [i, j]\n potential_moves << pos if @board.empty?(pos)\n end\n end\n \n new_mark = self.switch_mark\n potential_moves.map! do |pos|\n new_board = @board.dup \n new_board[pos] = next_mover_mark\n self.class.new(new_board, new_mark, pos)\n end\n \n return potential_moves\n end",
"def possible_moves(position, board, color)\n out_array = []\n\n x = position[0]\n y = position[1]\n\n add_to_move_array(x - 1, y - 2, board, color, out_array)\n add_to_move_array(x - 2, y - 1, board, color, out_array)\n add_to_move_array(x - 2, y + 1, board, color, out_array)\n add_to_move_array(x - 1, y + 2, board, color, out_array)\n add_to_move_array(x + 1, y + 2, board, color, out_array)\n add_to_move_array(x + 2, y + 1, board, color, out_array)\n add_to_move_array(x + 2, y - 1, board, color, out_array)\n add_to_move_array(x + 1, y - 2, board, color, out_array)\n\n out_array\n end",
"def generate_possible_moves(start_board)\n possible_moves = []\n\n # possible row moves\n start_board.row_count.times { |x|\n (start_board.col_count-1).times { |y|\n possible_moves << [x, y+1]\n }\n }\n\n # possible column moves\n start_board.col_count.times { |x|\n (start_board.row_count-1).times { |y|\n possible_moves << [start_board.row_count+x, y+1]\n }\n }\n\n return possible_moves\n end",
"def get_possible_moves\n moves = \n\t @@offsets.collect do |move| \n\t row = @position[:row] + move[0]\n\t col = @position[:col] + move[1]\n\t\t[row, col] if row.between?(0, 7) && col.between?(0, 7)\n\t end\n\tmoves.compact\n end",
"def get_moves\n reset_moves\n jump_moves\n base_moves if @valid_moves.empty?\n end",
"def enum_moves\n @scratch = dup_maze(@maze)\n @locs.each_with_index do |loc, robot|\n @cost = 1\n leading_edge = [loc]\n loop do\n next_edge = []\n leading_edge.each do |x, y|\n next_edge.concat search_from(x, y, robot)\n end\n break if next_edge.empty?\n leading_edge = next_edge\n @cost += 1\n end\n end\n\n @moves\n end",
"def children\n next_move_arr = []\n\n (0...3).each do |r|\n (0...3).each do |c|\n if board.empty?([r,c])\n new_board = board.dup\n new_board[[r,c]] = next_mover_mark\n next_mover_mark == :o ? next_mark = :x : next_mark = :o\n node = TicTacToeNode.new(new_board, next_mark, [r,c])\n next_move_arr << node\n end\n end\n end\n next_move_arr\n end",
"def find_possible_moves\n @possible_moves = []\n\n @moveset.each do |move, value|\n x = @x + value[0]\n y = @y + value[1]\n\n next unless ChessBoard.check_boundaries(x, y) && !visited_coordinates.include?([x, y])\n\n @possible_moves << move\n end\n end",
"def possible_moves(x, y)\n @moves = [[x+1,y+2], [x+1,y-2],\n [x-1,y+2], [x-1,y-2],\n [x+2,y+1], [x+2,y-1],\n [x-2,y+1], [x-2,y-1]]\n\n end",
"def moves\n result = []\n\n color_setter = (color == :black ? 0 : 1)\n\n ## handles single moves\n d_pos = DELTA[color_setter]\n new_move = calc_new_move(d_pos)\n result << new_move if in_bounds?(new_move) && !occupied?(new_move)\n\n ## handles double move\n d_pos = DOUBLE_MOVE[color_setter]\n new_move = calc_new_move(d_pos)\n result << new_move if in_bounds?(new_move) && !moved? && !result.empty? && !occupied?(new_move)\n\n ## handles capture moves\n CAPTURE_MOVES[color_setter].each do |c_pos|\n new_move = calc_new_move(c_pos)\n result << new_move if in_bounds?(new_move) && capturable?(new_move)\n end\n\n result\n end",
"def possibleMovements\n deltas = []\n DIRECTIONS.each do |delta|\n deltas.push(delta) if canMoveBy? delta\n end\n deltas\n end",
"def moves\n moves_arr = []\n move_dirs.each do |dir|\n dx, dy = dir\n moves_arr += grow_unblocked_moves_in_dir(dx, dy)\n end\n moves_arr\n end",
"def children\n possible_moves = []\n empty = []\n (0..2).each do |row|\n (0..2).each do |col|\n empty << [row,col] if @board.empty?([row,col])\n end\n end\n empty.each do |pos|\n dup_board = board.dup\n dup_board[pos] = @next_mover_mark\n possible_moves << TicTacToeNode.new(dup_board, next_marker, pos)\n end\n possible_moves\n end",
"def get_moves\n [\n { row: @row + 1, col: @col + 2 },\n { row: @row + 1, col: @col - 2 },\n { row: @row + 2, col: @col + 1 },\n { row: @row + 2, col: @col - 1 },\n { row: @row - 1, col: @col + 2 },\n { row: @row - 1, col: @col - 2 },\n { row: @row - 2, col: @col + 1 },\n { row: @row - 2, col: @col - 1 }\n ].select do |move|\n [:blank_space, :enemy_piece].include? describe_location(move[:row], move[:col])\n end\n end",
"def moves\n valid_moves = []\n move_dirs.each do |dx,dy| \n valid_moves += grow_unblocked_moves_in_dir(dx,dy)\n end\n valid_moves\n end",
"def possible_queen_moves(start_arr)\n\t\tchildren = []\n\t\tchildren << possible_rook_moves(start_arr)\n\t\tchildren << possible_bishop_moves(start_arr)\n\t\tchildren = children.flatten(1)\n\tend",
"def moves\n\n #\n all_moves = sigma_deltas().map {|delta| transform(delta)}\n # all_moves.select { |move| board.on_board?(move)}\n end",
"def legal_moves\n out = Set.new\n board = self.unrolled\n mark = next_turn_taker(board)\n \n board.each_with_index do |space, i|\n if space == @@MARKS[:empty]\n new_state = GameState.new(self.board_bits)\n new_state.mark_index i, mark\n out << new_state\n end\n end\n \n return out\n end",
"def build_next_moves current_node\n cur_pos = current_node.value \n\n (0...8).each do |col|\n (0...8).each do |row|\n next_pos = [col, row] \n if valid_move?(cur_pos,next_pos)\n current_node.add_child(PolyTreeNode.new(next_pos))\n @all_positions[next_pos] = true \n end\n end\n end\n end",
"def children\n moves = []\n (0..2).each do |r|\n (0..2).each do |c|\n if board.empty?([r, c])\n dup_board = board.dup\n\n dup_board[[r, c]] = next_mover_mark\n if next_mover_mark == :x\n next_mover_mark = :o\n else\n next_mover_mark = :x\n end\n\n moves << TicTacToeNode.new(dup_board, next_mover_mark, [r, c])\n p moves\n end\n end\n end\n\n return moves\n end",
"def calculate_future_moves(coord)\n possible_transitions = [[2, 1], [2, -1], [1, 2], [-1, 2], \n [-2, 1], [-2, -1], [-1, -2], [1, -2]]\n actual_transitions = []\n possible_transitions.each do |transition|\n new_position = [coord[0]+transition[0], coord[1]+transition[1]]\n if valid_coordinate?(new_position) && [email protected]?(new_position)\n actual_transitions << new_position\n end\n end\n actual_transitions\n end",
"def create_moves\n valid_moves = []\n MOVES.each do |move|\n location = [move[0] + loc[0], move[1] + loc[1]]\n valid_moves << location if location[0].between?(0,7) && location[1].between?(0,7)\n end\n valid_moves\n end",
"def children\n next_moves = []\n (0...3).each do |row|\n (0...3).each do |col|\n pos = [row, col]\n if self.board[pos].nil?\n new_board = self.board.dup\n new_board[pos] = self.next_mover_mark\n next_mark = ((self.next_mover_mark == :x) ? :o : :x)\n\n next_move = TicTacToeNode.new(new_board, next_mark, pos)\n next_moves << next_move\n end\n end\n end\n next_moves\n\n end",
"def children\n pos_positions = all_positions.select { |pos| @board[pos].nil? }\n mark = switch_mark\n moves = []\n\n pos_positions.each do |pos|\n new_board = @board.dup\n new_board[pos] = @next_mover_mark\n moves << TicTacToeNode.new(new_board, mark, pos)\n end\n\n moves\n end",
"def possible_moves\n possibles = []\n @state.each_with_index do |column, i|\n possibles << i if column[5] == :e\n end\n possibles\n end",
"def generate_slide_moves(current_pos, board, owner)\n return if out_of_bounds?(current_pos)\n\n next_piece = board.locate_piece(current_pos)\n return if next_piece&.owner == owner\n\n return [current_pos] if next_piece\n\n next_pos = [current_pos[0] + @move[0], current_pos[1] + @move[1]]\n next_moves = generate_slide_moves(next_pos, board, owner)\n return [current_pos] unless next_moves\n\n next_moves.reduce([current_pos]) { |current_moves, deep_moves| current_moves.push(deep_moves) }\n end",
"def children\n # debugger\n dup_board = @board.dup\n possible_moves = []\n \n\n # debugger\n (0...dup_board.rows.length).each do |row|\n (0...dup_board.rows.length).each do |col|\n position = [row, col]\n # debugger\n if dup_board.empty?(position)\n # debugger\n dup_board[position] = next_mover_mark\n\n if next_mover_mark == :o\n next_mover_mark = :x\n else\n next_mover_mark = :o\n end\n\n possible_moves << TicTacToeNode.new(dup_board,next_mover_mark,position)\n\n end\n end\n end\n possible_moves\n end",
"def children\n # debugger\n possible_moves = []\n\n (0...3).each do |row|\n (0...3).each do |col|\n pos = [row, col]\n new_board = @board.dup\n\n if new_board.empty?(pos)\n\n if @next_mover_mark == :o\n @next_mover_mark = :x\n else\n @next_mover_mark = :o\n end\n\n new_board.[]=(pos, @next_mover_mark)\n\n possible_moves << TicTacToeNode.new(new_board, @next_mover_mark, pos)\n @prev_move_pos = pos\n end\n end\n end\n possible_moves\n end",
"def valid_moves\n valid = []\n all_moves = self.moves\n\n all_moves.each do |end_pos|\n valid << end_pos unless move_into_check(end_pos)\n end\n \n valid\n end",
"def moves\n # warn \"Explorer: #{explorer.last}\"\n # warn @robots.map(&:last)\n # warn @items.map(&:last)\n\n clear_tasks\n assign_tasks\n\n @my_bots.map(&:next_command)\n end",
"def find_possible_moves(board)\n possible_moves = []\n move_mechanics.each do |move|\n rank = @location[0] + move[0]\n file = @location[1] + move[1]\n next unless valid_location?(rank, file)\n\n possible_moves << [rank, file] unless board.data[rank][file]\n end\n possible_moves\n end",
"def children\n next_moves = []\n mark = flip_mark(next_mover_mark)\n\n (0..2).each do |i|\n (0..2).each do |j|\n if board.empty?([i, j])\n next_moves << TicTacToeNode.new(board, mark, [i, j])\n end\n end\n end\n\n next_moves\n end",
"def possible_moves(side)\n possible_moves = []\n # initialize an 8x8 array of coordinates 1-8\n coords = Array.new(8) { [*1..8] }\n coords.each_with_index do |i, j|\n i.each do |t|\n # t is the x, i[j] is the y\n side.each do |test_piece|\n # Run move validation tests on every piece\n next unless test_piece.move_tests(to_x: t, to_y: i[j])\n # if a move passes validations, push the pieces ID and the\n # coordinates of a successful move to the possible_moves array\n possible_moves << [test_piece.id, t, i[j]]\n end\n end\n end\n possible_moves\n end",
"def moves(*move_dirs)\n possible_moves = []\n\n end",
"def next_game_trees\n return @next_game_trees unless @next_game_trees.nil?\n\n moves = @board.available_moves\n\n @next_game_trees = moves.each_with_object([]) { |move, game_trees| add_game_trees(game_trees, move) }\n\n @next_game_trees\n end",
"def moves\n\n HORIZONTAL_DIRS.each do |direction|\n x,y = direction\n grow_unblocked_moves_in_dir(x,y)\n end\n\n #call grow_unblocked_ele \n# RIGHT HERE!!!\n \n #1 call move_dirs -< put this in each class\n #will return array of all possible moves from unblocked into moves array\n\n\n #2 Then #moves is used collects the all possible moves\n\n\n # create array to collect moves\n\n # iterate over each of the directions in which a slideable piece can move\n # use the Piece subclass' `#move_dirs` method to get this info\n # for each direction, collect all possible moves in that direction\n # and add them to your moves array \n # (use the `grow_unblocked_moves_in_dir` helper method)\n\n # return the final array of moves (containing all possible moves in all directions)\n end",
"def possible_moves\r\n return [] if won?\r\n (0..8).select {|i| board.cells[i] == \" \"}\r\n end",
"def get_moves(start)\n x = start.x\n y = start.y\n moves = []\n moves << Node.new(x+2, y+1)\n moves << Node.new(x+2, y-1)\n moves << Node.new(x+1, y+2)\n moves << Node.new(x+1, y-2)\n moves << Node.new(x-1, y+2)\n moves << Node.new(x-1, y-2)\n moves << Node.new(x-2, y+1)\n moves << Node.new(x-2, y-1)\n moves = moves.reject do |node|\n node.x < 0 || node.x > 8\n end\n moves = moves.reject do |node|\n node.y < 0 || node.y > 8\n end\n moves.each { |move| move.next_node = start }\nend",
"def get_valid_moves\n # delta = color == :white ? 1 : -1\n pos = [position[0] + direction, position[1]]\n validated_moves = capture_spaces\n validated_moves << pos if valid_move?(pos)\n unless @moved || !validated_moves.include?(pos)\n\n pos = [position[0] + (2*direction), position[1]]\n validated_moves += valid_move?(pos) ? [pos] : []\n end\n\n validated_moves\n end",
"def all_moves(start, directed_moves)\n # Array of valid moves\n all_moves = []\n\n directed_moves.each do |ele|\n ele[0] = ele[0] + start[0]\n ele[1] = ele[1] + start[1]\n all_moves << ele\n end\n all_moves\n end",
"def capture_moves\n direction = get_direction\n moves = []\n x, y = @pos\n x += direction\n y += 1\n if @board[ [x, y] ] && @board[ [x,y] ].color == opponent_color\n moves << [x, y]\n end \n y -= 2\n if @board[ [x, y] ] && @board[ [x,y] ].color == opponent_color\n moves << [x, y]\n end\n moves\n end",
"def forking_moves(board, key)\n forking_moves =[]\n\n (0..2).each do |y|\n (0..2).each do |x|\n if board[y][x] == :_\n mutated_board = Marshal.load(Marshal.dump(board))\n mutated_board[y][x] = key\n mutated_winning_moves = winning_moves(mutated_board, key).uniq\n if mutated_winning_moves.count > 1\n forking_moves << mutated_winning_moves\n end\n end\n end\n end\n\n forking_moves.flatten\n \n end",
"def moves\r\n # pos = [0,0]\r\n # row, col = pos\r\n all_h = []\r\n all_d = []\r\n HORIZONTAL_DIRS.each do |h_pos|\r\n h_row, h_col = h_pos\r\n all_h += grow_unblocked_moves_in_dir(h_row, h_col) #returns all moves in h_pos\r\n end\r\n DIAGONAL_DIRS.each do |d_pos|\r\n h_row, h_col = d_pos\r\n all_d += grow_unblocked_moves_in_dir(h_row, h_col) #returns all moves in d_pos\r\n end\r\n if self.class == Queen\r\n return all_h + all_d\r\n elsif self.class == Bishop\r\n return all_d\r\n elsif self.class == Rook\r\n return all_h\r\n end\r\n end",
"def moves\n\t\tm = []\n\t\t@@moves.each do |move|\n\t\t\tfrom, to = move\n\n\t\t\tp1 = @value & MASKS[from]\n\t\t\tp2 = @value & MASKS[to]\n\n\t\t\tshift = (to - from) * 3\n\t\t\tp1 = p1 >> shift\n\t\t\tp2 = p2 << shift\n\n\t\t\tnum = (@value & INV_MASKS[from]) | p2\n\t\t\tnum = (num & INV_MASKS[to]) | p1\n\n\t\t\tm << State.new(num, @n_moves + 1)\n\t\tend\n\t\tm\n\tend",
"def find_possible_moves diffs\n [].tap do |possible_moves|\n diffs.each do |row|\n possible_moves << [self.pos[0] + row[1], self.pos[1] + row[0]]\n end\n end \n end",
"def new_move_positions(node)\n new_moves = KnightPathFinder.valid_moves(node.value).reject {|move| @visited_positions.include? move}\n new_moves.each {|move| @visited_positions << move}\n new_moves\n end",
"def legal_moves\n # Fill this in\n end",
"def makeMoves # fix this\n\t\[email protected]_index do |player,i|\n\t\t\t(0..player.numHands-1).each do |handIndex|\n\t\t\t\tmakeMove(player, handIndex, i)\n\t\t\tend\n\t\tend\n\tend",
"def children\n poss_moves = []\n next_move = (next_mover_mark == :x ? :o : :x)\n\n board.rows.each_with_index do |row, idx1|\n row.each_with_index do |pos, idx2|\n next unless pos.nil?\n _new_board = board.dup\n _new_board[[idx1, idx2]] = self.next_mover_mark\n board_node = TicTacToeNode.new(_new_board, next_move, [idx1, idx2]) \n poss_moves << board_node\n end\n end\n \n poss_moves\n end",
"def possible_moves(y_pos, x_pos, moves_list=[[y_pos,x_pos]])\n\t\t\n\t\treturn moves_list if moves_list.length > 64\n\n\t\tmove_square = y_pos+2, x_pos+1\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1]) \n\n\t\tmove_square = y_pos+2, x_pos-1\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1])\n\n\t\tmove_square = y_pos-2, x_pos+1\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1])\n\n\t\tmove_square = y_pos-2, x_pos-1\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1])\n\n\t\tmove_square = y_pos+1, x_pos+2\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1])\n\n\t\tmove_square = y_pos+1, x_pos-2\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1])\n\n\t\tmove_square = y_pos-1, x_pos+2\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1])\n\n\t\tmove_square = y_pos-1, x_pos-2\n\t\tmoves_list << move_square if check_legal_move(move_square[0],move_square[1])\n\n\t\tmoves_list.each { |move| possible_moves(move[0], move[1], moves_list) }\n\t\treturn moves_list\n\tend",
"def children\n\n # if winning_node(next_mover_mark)\n # end\n possible_moves = [self]\n #queue generation\n until possible_moves.empty?\n node = possible_moves.shift\n children_nodes = []\n self.board.rows.each_with_index do |row, i|\n row.each_with_index do |space, j|\n pos = [i,j]\n if self.board.empty?(pos)\n #self.board[pos] = @next_mover_mark\n children_nodes << TicTacToeNode.new(@board, next_mark, pos)\n end\n end\n end\n @children = children_nodes\n possible_moves += children_nodes\n end\n\n # until possible_moves.empty?\n # possible_moves.shift.children\n # end\n self\n end",
"def get_possible_moves_for(position)\n possible = []\n x = position.square[0]\n y = position.square[1]\n moves = [\n Placement.new([x-1,y-2], position), \n Placement.new([x-1,y+2], position), \n Placement.new([x-2,y-1], position), \n Placement.new([x-2,y+1], position), \n Placement.new([x+1,y+2], position), \n Placement.new([x+1,y-2], position), \n Placement.new([x+2,y-1], position), \n Placement.new([x+2,y+1], position)\n ]\n moves.each do |move|\n possible << move unless Chess.not_on_board?(move)\n end\n possible\n end",
"def build_move_tree\n arr = [root_node]\n nodes = []\n\n until arr.empty?\n this_pos = arr.shift\n arr += new_move_positions(this_pos)\n nodes << PolyTreeNode.new(this_pos)\n end\n\n nodes\n end",
"def possible_king_moves(start_arr)\n\t\tx = start_arr[0]\n\t\ty = start_arr[1]\n\t\tcandidates = []\n\t\tcandidates << [x+1,y]\n\t\tcandidates << [x-1,y]\t\t\n\t\tcandidates << [x,y+1]\t\t\t\t\n\t\tcandidates << [x,y-1]\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\tcandidates << [x+1,y+1]\n\t\tcandidates << [x-1,y-1]\t\n\t\tcandidates << [x-1,y+1]\t\t\t\t\n\t\tcandidates << [x+1,y-1]\t\t\t\t\n\t\tchildren = candidates.select { |pos| pos[0] >= 0 && pos[1] >= 0 && pos[0] <= 7 && pos[1] <= 7}\n\t\tchildren.delete_if do |child|\n\t\t\tif !(@board[child] == \"*\")\n\t\t\t\t# If pieces not same color\n\t\t\t\tif @board[child].color == @board[start_arr].color\n\t\t\t\t\tif occupied(child)\n\t\t\t\t\t\tcan_do = true\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tchildren\n\tend",
"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",
"def children\n # temp_dup[[i, j]] = @next_mover_mark # mark the board\n if @next_mover_mark == :x\n @next_mover_mark = :o\n bob = :x\n else\n @next_mover_mark = :x\n bob = :o\n end\n temp_dup = self.board.dup\n next_moves = []\n temp_dup.rows.each_with_index do |row, i|\n row.each_with_index do |col, j|\n # debugger\n if temp_dup.empty?([i, j])\n # next moes << tttn.new([board with mark placed on i,j], themark, prev_movepos)\n # next_moves << [i, j] \n \n temp_dup[[i, j]] = @next_mover_mark # mark the board\n \n \n next_moves << TicTacToeNode.new(temp_dup, @next_mover_mark, [i,j] )\n \n #temp_dup[[i, j]] = @next_mover_mark # mark the board\n \n end\n nil\n end\n end\n next_moves\n #returns nodes from all game states ???\n end",
"def possible_moves(x, y, dx, dy)\n return [[x - 1, y], [x, y + 1], [x, y - 1]] if dx > 0\n return [[x + 1, y], [x, y + 1], [x, y - 1]] if dx < 0\n return [[x + 1, y], [x, y + 1], [x - 1, y]] if dy > 0\n [[x + 1, y], [x, y - 1], [x - 1, y]]\n end",
"def moves\n to_return = []\n board_iterate do |i|\n if(i.is_a? Numeric)\n to_return.push(i)\n end\n end\n to_return.empty? ? nil : to_return\n end",
"def get_move\n #puts \"get_move for #{self}\"\n return [] if goal == nil or goal == []\n while(1)\n rv = []\n g = goal.shift\n return [] if g == nil\n puts g.join('---')\n case g[0]\n when KILL\n e = g[1] # get the ennemy\n if(not $map.exists?(e) or e.life<=0)\n puts 'this ant does not exists anymore or is dead, next goal'\n next \n end\n \n dist = distance(self,e)\n #puts \"I am #{self}\"\n #puts \"goal: kill this enneny: #{e}\"\n i = 0\n if dist > 1 # move\n # by doing this we are finding subgoals\n # TODO: add_sub_goal ?\n\n path = find_best_way(e.x,e.y)# we have to move next to it\n #puts ppath(path)\n if path==nil\n # TODO: no path, find something else to do\n puts 'no path ! , next goal'\n next\n end\n \n # we have a path to it\n # so now we have to move smartly\n # if we are at 3 cases, we can move and attack\n # more than that we have to move at 4 cases and wait the next turn\n # TODO: do not wait at a position where we can be attacked\n if(path.size-2 <= 3) # minus two because the path include our case\n i = path.size-2 # 0 based minus one, so -2 \n #puts 's1'\n elsif(path.size-2 >= 6) # we are far away\n i = 6\n #puts 's2'\n else\n i = (path.size-2)\n #puts 's3'\n end\n #puts i\n #sleep(1)\n if i <= 0\n puts \"i <= 0 (#{i}), #{ppath(path)}\"\n sleep(5)\n else\n a,b = path[i][0]\n #puts \"I am moving to (#{[a,b].join(',')})\"\n self.x,self.y = a,b\n rv << \"Cb#{object_id}~\"+[a,b].pack('cc')\n #puts x\n end\n end\n return rv if i > 3 # return if we can not attack at the same round\n #puts i\n dist = distance(self,e)\n if dist == 1\n puts 'Attack'\n rv << \"Cc#{object_id}~#{e.object_id}\"\n e.life -= 5\n end\n return rv\n else\n puts 'unknown goal, next goal'\n end # case\n end #while\n puts \"no goal ? find something else to do !\"\n rv\n end",
"def children\n new_arr = []\n i == 0\n j == 0\n while i < board.length\n j = 0 \n while j < board.length\n if !board[i][j].empty?\n dupe = board.dup\n dupe[i, j] = self.next_mover_mark\n self.prev_move_pos = [i, j]\n if self.next_mover_mark == :x \n self.next_mover_mark = :o\n else\n self.next_mover_mark = :x\n end \n new_arr << TicTacToeNode.new(dupe, next_mover_mark, prev_move_pos)\n end \n j += 1\n end \n i += 1\n end \n new_arr\n end",
"def possible_moves(spaces)\n possible_moves = []\n if ((@position + 1) % 8 == 0)\n @moves = [8,7,-1,-9,-8]\n elsif (@position % 8 == 0)\n @moves = [-8,-7,1,9,8]\n end\n @moves.each do |move|\n possible_moves << (@position + move)\n end\n possible_moves.select! { |move| (0..63).include?(move) }\n possible_moves.select! do |move| \n spaces[move].class == Fixnum or spaces[move].side_id != @side_id ? true : false\n end\n possible_moves\n end",
"def new_move_positions(pos)\n candidates = KnightPathFinder.valid_moves(pos)\n candidates = candidates.select { |e| !@considered_positions.include?(e) }\n @considered_positions.concat(candidates)\n return candidates\n #@considered_positions = (@considered_positions.concat(candidates)).uniq\n end"
] | [
"0.74542904",
"0.7448149",
"0.74069035",
"0.7375318",
"0.72373027",
"0.7234965",
"0.7215259",
"0.72118765",
"0.72038615",
"0.71801317",
"0.71401936",
"0.71162206",
"0.70881444",
"0.7080469",
"0.70726323",
"0.70608085",
"0.7033311",
"0.70258737",
"0.6983692",
"0.69750845",
"0.6953044",
"0.6935784",
"0.69339013",
"0.6915955",
"0.6886727",
"0.6839489",
"0.68358535",
"0.6801846",
"0.6732686",
"0.67154926",
"0.6705102",
"0.6704943",
"0.6686785",
"0.6680723",
"0.66660315",
"0.66644984",
"0.664729",
"0.66469306",
"0.66035616",
"0.66021794",
"0.65978515",
"0.6577279",
"0.65715486",
"0.65663666",
"0.65552974",
"0.6553916",
"0.65492857",
"0.6544759",
"0.6517942",
"0.6505624",
"0.6472235",
"0.647063",
"0.6468593",
"0.6466708",
"0.64663863",
"0.6465464",
"0.6451291",
"0.64426166",
"0.6438984",
"0.6437932",
"0.6424457",
"0.64189434",
"0.6386184",
"0.6371716",
"0.6362414",
"0.635273",
"0.6329655",
"0.63172156",
"0.63159543",
"0.63157",
"0.63140583",
"0.6309045",
"0.63024825",
"0.6281312",
"0.62702227",
"0.62634087",
"0.62630826",
"0.62550515",
"0.62527275",
"0.62421125",
"0.62361026",
"0.62262607",
"0.6225465",
"0.6221543",
"0.62158406",
"0.62156427",
"0.6196799",
"0.6189595",
"0.61826265",
"0.61628836",
"0.6150962",
"0.6149362",
"0.61478794",
"0.6122042",
"0.61185235",
"0.61116654",
"0.6108358",
"0.609023",
"0.60877866",
"0.6079096",
"0.607491"
] | 0.0 | -1 |
storage :fog Override the directory where uploaded files will be stored. This is a sensible default for uploaders that are meant to be mounted: | def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_dir\n 'file_uploads'\n end",
"def store_dir\n \"uploads\"\n end",
"def store_dir\n 'uploads'\n end",
"def store_dir\n # \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n # This works for the file storage as well as Amazon S3 and Rackspace Cloud Files.\n # Define store_dir as nil if you'd like to store files at the root level.\n nil\n end",
"def store_dir\n base_dir = ENV.fetch('FILE_STORE_DIR', \"uploads\")\n if base_dir != \"uploads\"\n public_uploads = File.join(Rails.root, \"public\", \"uploads\")\n FileUtils.symlink(base_dir, public_uploads) unless File.symlink?(public_uploads)\n base_dir = public_uploads\n end\n \"#{base_dir}/#{Rails.env}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n if Rails.env == \"production\"\n ENV['CONFIG_FILE_UPLOAD_PATH']\n else\n \"uploads\"\n end\n end",
"def store_dir\n \"uploads/\"\n end",
"def store_dir\n \"uploads/\"\n end",
"def store_dir\n \"uploads/\"\n end",
"def store_dir\n path = \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n if Rails.env.staging? or Rails.env.production?\n \"#{APP_CONFIG['deploy_path']}#{APP_CONFIG['seed_storage']}/#{path}\"\n else\n path\n end\n end",
"def store_dir\n \"#{Rails.root}/tmp/upload/\"\n end",
"def store_dir\n \"uploads/photos\"\n end",
"def store_dir\n \"uploads/imports/\"\n end",
"def store_dir\n \"#{Rails.root}/app/files/uploads/#{ENV['PROJECT_ID']}/\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/\"\n end",
"def store_dir\n \"#{Rails.root}/public/uploads/\"\n end",
"def store_dir\n \"uploads/#{Rails.env}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.uid}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n # \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n # OK!\n #{}\"/home/bjarzab/www/pola2019_storage/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n # OK!\n # \"/mnt/cloud_test/files/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n \"#{Rails.application.secrets[:carrierwave_store_dir]}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n\t\t\"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n\tend",
"def store_dir\n configured_upload_path + \"#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\" \n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{partition_dir(model.id)}/#{model.id}\"\n end",
"def store_dir\n \"system/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"system/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}\"\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end",
"def storage_dir\n File.join(thirdpartydir,\"storage\")\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.attachable_type}/#{model.attachable_id}/#{mounted_as}/#{model.id}\"\n end",
"def store_dir\r\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\r\n end",
"def store_dir\r\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\r\n end",
"def store_dir\n \"uploads/#{model.class.to_s.underscore}_#{mounted_as.to_s.pluralize}\"\n end"
] | [
"0.7506943",
"0.7366758",
"0.7333099",
"0.733298",
"0.73037624",
"0.7299172",
"0.7278739",
"0.7278739",
"0.7278739",
"0.72693604",
"0.724532",
"0.72300035",
"0.7225865",
"0.7202066",
"0.71868175",
"0.71794933",
"0.71650726",
"0.7150311",
"0.7150311",
"0.7150311",
"0.7150311",
"0.7150311",
"0.71378857",
"0.71337533",
"0.7132019",
"0.7128339",
"0.7116402",
"0.7116372",
"0.7116372",
"0.7115109",
"0.71112514",
"0.71064776",
"0.71019524",
"0.7101131",
"0.7101131",
"0.7073135"
] | 0.0 | -1 |
Add a white list of extensions which are allowed to be uploaded. For images you might use something like this: | def extension_whitelist
%w(jpg jpeg gif png)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w[jpg jpeg gif png]\n end",
"def extension_whitelist\n %w[jpg jpeg gif png]\n end",
"def extension_whitelist\n %w[jpg jpeg gif png]\n end",
"def extension_whitelist\n %w[jpg jpeg png]\n end",
"def extension_whitelist\n %w(jpg jpeg png)\n end",
"def extension_whitelist\n %w(jpg jpeg png)\n end",
"def extension_whitelist\n %w(jpg jpeg png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png pdf)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png tif tiff avi m4v mov mp4 mpg mpeg mpeg wmv qt)\n end",
"def extension_whitelist\n %w[png jpg jpeg]\n end",
"def extension_whitelist\n %w[png jpg jpeg]\n end",
"def extension_allowlist\n %w(jpg jpeg png)\n end",
"def extension_whitelist\n Spotlight::Engine.config.allowed_upload_extensions\n end",
"def extensions_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg JPG jpeg JPEG gif GIF png PNG)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png pdf)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png JPG JPEG GIF PNG)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg png)\n end",
"def extension_white_list\n %w(jpg jpeg png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\r\n %w(jpg jpeg png)\r\n end",
"def extension_whitelist\n %w[txt csv xls xlsx doc docx gif jpg jpeg png bmp svg pdf ppt pptx]\n end",
"def extension_white_list\n %w(jpg jpeg gif png pdf)\n end",
"def extension_white_list\n %w(jpg jpeg gif png pdf)\n end",
"def extension_white_list\n %w(jpg jpeg gif png pdf)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg png)\n end"
] | [
"0.81572783",
"0.8148596",
"0.8148596",
"0.8148596",
"0.81230783",
"0.8091924",
"0.8091924",
"0.8091924",
"0.8089499",
"0.79969525",
"0.79353714",
"0.79353714",
"0.7915584",
"0.78393465",
"0.7814662",
"0.7742898",
"0.7719162",
"0.76941663",
"0.7684599",
"0.7684599",
"0.7681529",
"0.76778394",
"0.7665308",
"0.7665308",
"0.7655626",
"0.7655626",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.76489",
"0.7632285",
"0.7631217",
"0.76301104",
"0.76301104",
"0.76301104",
"0.7625266",
"0.7625266",
"0.7625266",
"0.76137924"
] | 0.81239665 | 15 |
TODO: move from this | def as_json(attributes = {})
attrs = super(attributes)['attributes']
attrs.slice('id', 'body').merge(
username: user.full_name,
user_avatar_url: user.avatar_url,
created_at: I18n.l(created_at.in_time_zone, format: :answer)
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def refutal()\n end",
"def custom; end",
"def custom; end",
"def suivre; end",
"def formation; end",
"def implementation; end",
"def implementation; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def weber; end",
"def operations; end",
"def operations; end",
"def offences_by; end",
"def wrapper; end",
"def identify; end",
"def terpene; end",
"def processor; end",
"def isolated; end",
"def isolated; end",
"def sitemaps; end",
"def extra; end",
"def original_result; end",
"def intensifier; end",
"def strategy; end",
"def verdi; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def transformations; end",
"def who_we_are\r\n end",
"def reflector; end",
"def reflector; end",
"def internal; end",
"def villian; end",
"def initialize\n \n end",
"def initialize\n\t\t\n\tend",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def stderrs; end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def eplore\n end",
"def initialize\n\n end",
"def initialize\n\n end",
"def anchored; end",
"def trd; end",
"def transform; end",
"def overrides; end",
"def from; end",
"def from; end",
"def from; end",
"def from; end",
"def zuruecksetzen()\n end",
"def apply\n end",
"def berlioz; end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def operation; end",
"def private_method\n end",
"def celebration; end",
"def next()\n \n end",
"def next()\n \n end",
"def relatorios\n end",
"def apply\n\t\t\t\t\n\t\t\tend",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def r; end",
"def r; end",
"def handle; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end"
] | [
"0.7651791",
"0.6560004",
"0.64762014",
"0.645525",
"0.645525",
"0.645525",
"0.645525",
"0.61956817",
"0.61529076",
"0.61529076",
"0.60593945",
"0.6052822",
"0.6033603",
"0.6033603",
"0.60198",
"0.60198",
"0.5924076",
"0.5831859",
"0.5831859",
"0.5816814",
"0.5810565",
"0.580371",
"0.57456833",
"0.57390034",
"0.57087696",
"0.57087696",
"0.57067966",
"0.57021743",
"0.5690961",
"0.56801456",
"0.5670595",
"0.56611437",
"0.5631605",
"0.5631605",
"0.5631605",
"0.5631605",
"0.5631605",
"0.5631605",
"0.5631605",
"0.5631605",
"0.5631605",
"0.56246114",
"0.562318",
"0.5617543",
"0.5617543",
"0.5605707",
"0.56003046",
"0.5598304",
"0.55788875",
"0.55757445",
"0.55757445",
"0.55757445",
"0.55757445",
"0.55757445",
"0.55757445",
"0.55757445",
"0.55757445",
"0.5572297",
"0.5566444",
"0.5566444",
"0.5566444",
"0.5560522",
"0.5557821",
"0.5557821",
"0.5556843",
"0.55555034",
"0.5555289",
"0.55551475",
"0.55475134",
"0.55475134",
"0.55475134",
"0.55475134",
"0.5546357",
"0.553929",
"0.55320364",
"0.55212486",
"0.55212486",
"0.55212486",
"0.55212486",
"0.5517358",
"0.5511569",
"0.5506217",
"0.5499542",
"0.5499542",
"0.54968745",
"0.54949695",
"0.54898185",
"0.54898185",
"0.54898185",
"0.54898185",
"0.54898185",
"0.54898185",
"0.54898185",
"0.54898185",
"0.54866195",
"0.54866195",
"0.54859906",
"0.5483298",
"0.5483298",
"0.5483298",
"0.5483298"
] | 0.0 | -1 |
=begin def kesha_maker(array) kesha_array = [] array.each do |character| character[2] = "$" kesha_array.push(character) end kesha_array end =end | def kesha_maker(array)
array.collect do |character|
character[2] = "$"
character
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kesha_maker(array)\n kesha = []\n array.each do |i|\n i[2] = \"$\"\n kesha << i\n end\n kesha\nend",
"def kesha_maker(array)\n kesha_array = []\n array.each do |name|\n name[2] = \"$\"\n kesha_array << name\n end\n kesha_array\nend",
"def kesha_maker(array)\n array.each do |string|\n string[2] = \"$\"\n end\n array\nend",
"def kesha_maker(array)\n array.each { |word| word[2] = \"$\" }\nend",
"def kesha_maker(array)\n array.map {|item| item[2]=\"$\"}\n array\nend",
"def kesha_maker(array)\n array.map do |string|\n string[2] = \"$\"\n end\n array\nend",
"def kesha_maker(array)\n kesha_array = []\n i = 0\n array.each do |name|\n kesha_array.push(name[2] = \"$\")\n end\nend",
"def kesha_maker(array)\n array.each do |word|\n word[2] = \"$\"\n end\nend",
"def kesha_maker(array)\n array.each do |kesha|\n kesha[2] = \"$\"\nend\nend",
"def kesha_maker(any_array)\n any_array.each do |str|\n str[2] = \"$\"\n end\n \n end",
"def kesha_maker(array)\n array.each do |a|\n a[2] = \"$\"\n end\nend",
"def kesha_maker(array)\n array.each do |name|\n name[2] = '$'\n end\nend",
"def kesha_maker(array)\n array.each do |item|\n item[2] = \"$\" # (note: assign value)\n end\n return array\nend",
"def kesha_maker(array)\n\tnew_array = []\n\tarray.each do|name|\n\t\tname[2] = \"$\"\n\t\tnew_array << name\n\tend\n\tnew_array\nend",
"def kesha_maker(array)\n array.map do |elem|\n word_splice = elem.split(\"\")\n word_splice[2] = \"$\"\n word_splice.join\n end\nend",
"def kesha_maker(array)\n kesha_array = []\n\n array.each do |name|\n name_array = name.split(\"\")\n name_array[2] = \"$\"\n result = name_array.join\n kesha_array << result\n end\n\n kesha_array\nend",
"def kesha_maker(arr)\n arr.each { |str| str[2] = \"$\" }\nend",
"def kesha_maker(array)\n array.each do |item|\n item[2] = \"$\"\n end\nend",
"def kesha_maker(array)\n array.each do |item|\n item[2] = \"$\"\n end\nend",
"def kesha_maker(array)\n array.collect do |element|\n split_element_to_array = element.split(\"\")\n split_element_to_array[2] = \"$\"\n joined_array = split_element_to_array.join\n joined_array\n end\nend",
"def kesha_maker(array)\n array.collect { |x| x[2] = \"$\" }\n array\nend",
"def kesha_maker(array)\n new_array = []\n array.each do |key|\n new_array = key[2] = \"$\"\n end\nend",
"def kesha_maker(array)\n new_arr= []\n array.each do |word|\n word.split(\" \")\n word[2] = \"$\"\n new_arr << word\n end\nend",
"def kesha_maker(array)\n array.map do |element|\n element[2] = \"$\" #change 3rd character of each element to a dollar sign\n element #and return the changed element\n end\nend",
"def kesha_maker(a)\n a.each {|b| b[2] = \"$\"}\nend",
"def north_korean_cipher(coded_message)\n final = Array.new\n #coded_message = \"m^aerx%e&gsoi!\"\n #x = \"a\"\n input = coded_message.downcase.split(\"\")\n symbols = [\"@\",\"#\",\"$\",\"%\",\"^\",\"&\",\"*\"]\n @alphabet = 'a'.upto('z').to_a\n\n\ninput.each do |x|\n\nif @alphabet.include?(x)\n sel = @alphabet.index(x)\n new_pos = sel.to_i - 4\n final << @alphabet[new_pos]\nelsif symbols.include?(x)\n final << \" \"\nelsif (0..9).include?(x.to_i)\n final << x\nelse\n final << \"~\" #adds a ~ if the character is not recognized. Easier to debug this way. \nend\n #p final.join(\"\") # Uncomment if you want to see the process.\nend\np final.join(\"\")\nfinal\nend",
"def caesar_encode(string, offset)\n string.split(\"\").map do |character| #.map goes through array and creates a new array \n if $array_abc_low.include?(character) #checks if a letter is in the first/second array\n new_character = $array_abc_low[($array_abc_low.index(character)+offset)%26]\n # character_index = ($array_abc_low.index(character)+offset)%26 #adds in the offset number so the letter will change\n # new_character=$array_abc_low[character_index] #returns element in the new index\n elsif $array_abc_up.include?(character) #checks if a letter is in the first/second array\n new_character = $array_abc_up[($array_abc_up.index(character)+offset)%26]\n # character_index = ($array_abc_up.index(character)+offset)%26 #adds in the offset number so the letter will change\n # new_character=$array_abc_up[character_index]\n else character #this is for symbols/number and returns 'nil'\n end\n end.join(\"\")\nend",
"def add_letters_to_bag()\n\n bag = [\"Z\", \"X\", \"J\", \"K\", \"Q\"] # Letters which only appear once\n \n 2.times do # Letters which appear twice\n bag << \"V\"\n bag << \"W\"\n bag << \"B\"\n bag << \"C\"\n bag << \"F\"\n bag << \"H\"\n bag << \"M\"\n bag << \"Y\"\n bag << Blank.new\n bag << \"P\"\n end\n\n 3.times do bag << \"G\" end\n\n 4.times do\n bag << \"D\"\n bag << \"L\"\n bag << \"S\"\n bag << \"U\"\n end\n\n 6.times do\n bag << \"N\"\n bag << \"R\"\n bag << \"T\"\n end\n \n 8.times do bag << \"O\" end \n\n 9.times do\n bag << \"A\"\n bag << \"I\"\n end\n\n 12.times do bag << \"E\" end\n\n return bag\n end",
"def translate(message_from_txt)\n message_character_array = separate(message_from_txt.chomp)\n message_character_array.map do |letter|\n one_braille_array = get_array(letter)\n #now the output is the 3-element braille array for that one letter character\n shovel(one_braille_array)\n end\n format_lines\n end",
"def pig_latin_name(word)\n \n letters = word.split(\"\")\n \n final_array = letters.clone\n letters.each do |letter| #[p, l, u, m]\n \n \n if is_consonants?(letter)\n final_array.rotate! \n # #puts \".........#{removed_consonant}\"\n # #letters.push(removed_consonant)\n # puts \".........#{final_array}..#{letters}\"\n else \n # puts \"*****#{final_array}.... #{letters}\"\n final_array.push(\"ay\")\n return final_array.join\n end\n end\nend",
"def haiku(text)\n text_array = text.split(\" \")\n line_1 = make_line(text_array, 5)\n line_2 = make_line(text_array, 7)\n line_3 = make_line(text_array, 5)\n [line_1,line_2,line_3]\n end",
"def knot_codes(input, row)\n seed = [ 17, 31, 73, 47, 23 ]\n \"#{input}-#{row}\".each_char.map(&:ord).concat seed\nend",
"def crea_tabla(llave)\n renglon = Array.new\n tam = llave.length\n tam.times do |i|\n tmp = \"\" << llave[i]\n if ALFABETO.include? tmp\n renglon.push(tmp)\n ALFABETO.delete! tmp\n end\n end\n ALFABETO.chars{|c| renglon.push(c)}\n tabla = Array.new\n tabla.push(renglon.to_s)\n for i in (1...26)\n aux = recorre(renglon.to_s, i)\n tabla.push(aux)\n end#for\n return tabla \nend",
"def outputArray(word)\n Array.new(word.length, \"_\")\nend",
"def yell(words) # DEFINE METHOD WITH ONE PARAM\n \n i = 0 # SET FIRST INDEX VALUE\n \n new_array = [] # CREATE AN EMPTY ARRAY\n \n while i < words.length # WHILE LOOP THAT CHECKS IF I IS LESS THAN THE ARRAY LENGTH\n old_ele = words[i] # VARIABLE TO STORE INDEXED VALUE OF ARRAY\n exclamations = old_ele + \"!\" # VARIABLE THAT CONCATENATES EXCLAMATION TO END OF INDEX ARRAY VALUE\n new_array << exclamations # SHOVELS IT INTO END OF ARRAY VARIABLE\n i += 1 # INCREMENT OF ONE ITERATION\n\n end\n return new_array # RETURNS FINAL VALUE OF NEWLY CREATED ARRAY\n \n\nend",
"def caesar_cipher(text, step)\r\n\ttext.length.times do |number|\r\n\t\tcurrent_symbol = text[number]\r\n\t\ttext[number] = caesar_wrapper(current_symbol, step)\r\n\tend\r\n\tputs text\r\nend",
"def group_by_starting_letter(arr_letters)\n #hash that itera and create a key with the first letter\n hash = Hash.new { |k, v| k[v] = [] }\n #put the word into the hash how an array\n arr_letters.each do |word|\n hash[word[0]] << word\n end\n #return the hash full\n hash\nend",
"def letter_array (name)\n\tname.chars\nend",
"def guessed_letters()\n guessed = $bucket.join(\" \") # return a string of guessed letters\nend",
"def abbreviate_sentence(sent)\n # Write your code here\n empty_array = []\n sent.chars.each do |element|\n if element.length > 4\n element.each do |letters|\n letters.gsub(/[aeiou]/i, \" \" )\n letters << empty_array\n end\n end\n end\n p empty_array.join(\"\")\nend",
"def letterbank\n {\n vowels: [\"a\",\"e\",\"i\",\"o\",\"u\"],\n cap_vowels: [\"A\",\"E\",\"I\",\"O\",\"U\"],\n consonants: [\"b\",\"c\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"m\",\n \"n\",\"p\",\"q\",\"r\",\"s\",\"t\",\"v\",\"w\",\"x\",\"y\",\"z\"],\n cap_consonants: [\"B\",\"C\",\"D\",\"F\",\"G\",\"H\",\"J\",\"K\",\"L\",\"M\",\n \"N\",\"P\",\"Q\",\"R\",\"S\",\"T\",\"V\",\"W\",\"X\",\"Y\",\"Z\"],\n catch_all: [\" \", \"@\", \".\", \"-\"]\n }\nend",
"def vigenere_cipher(word,arr)\n\n new_arr = []\n alp = (\"a\"..\"z\").to_a\n word.split(\"\").each.with_index do |char,i|\n old_index = alp.index(char)\n new_index = (alp.index(char)+ arr[i % arr.length]) % 26\n new_arr << alp[new_index]\n end\n new_arr.join(\"\")\n\nend",
"def initialize\n @word = Spicy::Proton.noun(min:5)\n @word_array = word.split(\"\")\n @display_array = Array.new(word.length, \"_\")\n @candles = Array.new(5, \",\")\n @user_guesses = []\n @cake = \"\\t _|||||_ \\n\\t {~*~*~*~}\\n\\t__{*~*~*~*}__\\n\\t-------------\"\n end",
"def generate_code(str)\n word_arr = str.split(\" \")\n word_arr_simple = str.downcase.split(\" \").each {|x| x.gsub!(/\\W+/, '')}\n\n word_hash = {}\n counter = 1\n\n word_arr_simple.each do |word|\n if word_hash[word] != nil\n else\n word_hash[word] = counter\n counter += 1\n end\n end\n\n $new_array = []\n\n word_arr_simple.each_with_index do |word, index|\n $new_array << [word_arr[index], word_hash[word]]\n end\n\n # $new_array = word_arr_simple.map{|x| [x, word_hash[x]]}\n\nend",
"def build_suite (letter)\n suite = []\n\n 2.upto(10) do |value|\n suite << \"#{value.to_s+letter}\"\n end\n\n suite << \"#{'J'+letter}\"\n suite << \"#{'Q'+letter}\"\n suite << \"#{'K'+letter}\"\n suite << \"#{'A'+letter}\"\n\n suite.each {|card| @full_deck_array << card}\n end",
"def display_chars\n\t\t@dashes_arr = [] \n\t\t@word_length.times { @dashes_arr << \"_\" }\n\t\t@display_chars = @dashes_arr.join(\" \")\n\tend",
"def suit\n suit_array = [\"♦\",\"♣\",\"♠\",\"♥\"]\n end",
"def hangman(word, arr)\n #create variables to store incrementers and chars\n result = []\n i = 0\n #make sure we can compare whether given lower case or capitalized letters by making all cases the same\n word = word.upcase\n arr = arr.join(\"\").upcase\n \n # word = word.split(\"\") do we need to split string into array?\n # create a nested loops to iterate over the characters of the word, \n # each arr char should iterate over all word chars \n # push char back into word[i] position if it matches, \n # otherwise push \"_\"\n while i < word.length\n j = 0\n while j < arr.length\n if word[i] == arr[j]\n result.push(arr[j])\n end\n j += 1\n end\n if word[i] == \" \"\n result[i] = word[i]\n elsif result[i] != word[i]\n result[i] = \"_\"\n end\n i += 1\n end\n puts \"\\\"\" + result.join(\"\").downcase + \"\\\"\"\n end",
"def build_char_frequency_table(phrase)\n table = Array.new(26, 0)\n\n phrase.each_char do |char|\n x = get_char_number(char)\n if x != -1\n table[x] += 1\n end\n end\n\n table\nend",
"def cipher(create_alias)\n\tcreate_alias.map! {|letter| letter.next}\n\talias_string = create_alias.join('')\n\talias_string['!'] = ' '\n\talias_string.split(' ')\nend",
"def create_key_a\n @key_chars[0..1].join.to_i\n end",
"def encrypt(string)\r\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\r\n i = 0 \r\n array = []\r\n value = ''\r\n length = string.length\r\n while i < length \r\n a = string[i].to_s\r\n value = alphabet.index(a)\r\n if value == 25\r\n array.push(alphabet[0])\r\n else array.push(alphabet[value+1])\r\n end\r\n i += 1\r\n end\r\n p array.join\r\nend",
"def north_korean_cipher(coded_message)\n input = coded_message.downcase.split(\"\") # Turning every letter into a lower case letter and then splitting it into array\n decoded_sentence = []\n cipher = {\"e\" => \"a\", # This is technically a shift of four letters...Can you think of a way to automate this? Is a hash\n \"f\" => \"b\", # the best data structure for this problem? What are the pros and cons of hashes?\n \"g\" => \"c\", # An array would be beeter structure, we can automate the shiffting of the letters\n \"h\" => \"d\",\n \"i\" => \"e\",\n \"j\" => \"f\",\n \"k\" => \"g\",\n \"l\" => \"h\",\n \"m\" => \"i\",\n \"n\" => \"j\",\n \"o\" => \"k\",\n \"p\" => \"l\",\n \"q\" => \"m\",\n \"r\" => \"n\",\n \"s\" => \"o\",\n \"t\" => \"p\",\n \"u\" => \"q\",\n \"v\" => \"r\",\n \"w\" => \"s\",\n \"x\" => \"t\",\n \"y\" => \"u\",\n \"z\" => \"v\",\n \"a\" => \"w\",\n \"b\" => \"x\",\n \"c\" => \"y\",\n \"d\" => \"z\"}\n\n input.each do |x| # iterating over each input character\n found_match = false #when false the same character will be added to the solution\n cipher.each_key do |y| # iterating thruthe keys of cipher hash\n if x == y #if current character is equal to a hash key\n # puts \"I am comparing x and y. X is #{x} and Y is #{y}.\"\n decoded_sentence << cipher[y]\n found_match = true\n break #it will end the loop once it finds its match\n elsif x == \"@\" || x == \"#\" || x == \"$\" || x == \"%\"|| x == \"^\" || x == \"&\"|| x ==\"*\" #If it matach one of these characters it will add a space\n decoded_sentence << \" \"\n found_match = true\n break\n elsif (0..9).to_a.include?(x) # turns a range into an array and then checks if that array includes the input\n decoded_sentence << x\n found_match = true\n break\n end\n end\n if not found_match #If there is no match then add the character to the solution\n decoded_sentence << x\n end\n end\n decoded_sentence = decoded_sentence.join(\"\")\n\n if decoded_sentence.match(/\\d+/) #Finding all the didgits\n decoded_sentence.gsub!(/\\d+/) { |num| num.to_i / 100 } #Replace and divide by 100\n end\n return decoded_sentence # it sreturning the string\nend",
"def gencode(instr)\n memoizer = Hash.new { |h,morse|\n retval = []\n get_letters(morse) { |c,rest|\n h[rest].each {|s| retval << (c+s)}\n }\n h[morse] = retval\n }\n memoizer[''] = ['']\n memoizer[instr]\nend",
"def hangman(x, arr)\n\tnew_arr = []\n\tx.each_char do |a|\n\t\tarr.each do |b|\n\t\t\ta == b ? new_arr << a : new_arr << \"_\"\n\t\tend\n\tend\n\treturn new_arr.join\nend",
"def array_word\n p @arrayed_word = @secret_word.split(\"\")\n end",
"def characters_array # That's a terrible name.\n convert_to_chars\n highlight_squares\n self.rows\n end",
"def esc1(code)\n\t\t[\"\\e[#{code}\", \"\\e[2#{code}\", \"\\e[3#{code}\", \"\\e[4#{code}\", \n\t\t\t\"\\e[5#{code}\", \"\\e[6#{code}\", \"\\e[7#{code}\", \"\\e[8#{code}\"] \n\tend",
"def easy_version\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n 5.times do |i|\n vowel = vowels[i]\n @word.each_with_index do |element, index|\n if element == vowel\n @dashes[index] = vowel\n end\n end\n end\n end",
"def yell(words)\n\ti = 0\n while i < words.length\n words[i] = words[i] + \"!\"\n i += 1\n end\n return words\nend",
"def wordArray(guessword)\n word_array = []\n\n guessword.length.times do |letter|\n word_array << guessword[letter]\n end\n return word_array\nend",
"def vigenere_cipher(str, arr)\n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n str.each_char.with_index do |char, i|\n pos = alpha.index(char)\n key = arr[i % arr.length]\n new_pos = (pos + key) % alpha.length\n new_str += alpha[new_pos]\n end\n new_str\nend",
"def to_nato(words)\nnewarray = []\nnato = {\"a\" => \"Alfa\", \"b\" => \"Bravo\", \"!\" => \"!\", \".\" => \".\", \"?\" => \"?\", \"c\" => \"Charlie\", \"d\" => \"Delta\", \"e\" => \"Echo\", \"f\" => \"Foxtrot\", \"g\" => \"Golf\", \"h\" => \"Hotel\", \"i\" => \"India\", \"j\" => \"Juliett\", \"k\" => \"Kilo\", \"l\" => \"Lima\", \"m\" => \"Mike\", \"n\" => \"November\", \"o\" => \"Oscar\", \"p\" => \"Papa\", \"q\" => \"Quebec\", \"r\" => \"Romeo\", \"s\" => \"Sierra\", \"t\" => \"Tango\", \"u\" => \"Uniform\", \"v\" => \"Victor\", \"w\" => \"Whiskey\", \"x\" => \"Xray\", \"y\" => \"Yankee\", \"z\" => \"Zulu\"}\nletters = words.downcase.split(\" \").join(\"\").chars\nletters.each do |x|\nnewarray << nato[x]\nend\nnewarray.join(\" \")\n\nend",
"def positions_of_letters(list)\n letters = Hash.new()\n # puts \"\"\n # puts list.split('')\n\n list.split('').each_with_index do |letter, index|\n # puts \"inside each\"\n # puts \"index = #{index}\"\n # puts \"value = #{letter}\"\n if letter != ' ' && letters[letter].nil?\n letters[letter] = [index]\n # puts \"initializing hash letters[letter] = #{letters[letter]}\"\n\n elsif letter != ' '\n letters[letter] << index\n # puts \"adding more indexes to the letter array\"\n # puts \"#{letters[letter]}\"\n end\n end\n letters\nend",
"def yell(words)\n i = 0\n while i < words.length\n words[i] = words[i] + \"!\"\n i+= 1\n end\n return words\nend",
"def encrypt_this(text)\n x = text.split(\" \")\n x.map! do |word, index|\n if x[0].length == 1 || word.length == 1\n \"#{word[0].codepoints.join()}\"\n elsif word.length == 2\n \"#{word[0].codepoints.join()}#{word[1]}\"\n else\n \"#{word[0].codepoints.join()}#{word[-1]}#{word[2..-2]}#{word[1]}\"\n end\n end\n x.join(\" \")\nend",
"def creator(array, num_array, letter_array)\n array.map do |key|\n if num_array.include?(key[0])\n key = 'KeyCode::KEY_' + key\n elsif letter_array.include?(key)\n key = 'KeyCode::' + key.upcase\n elsif key.include?(\"LEFT\")\n key = 'KeyCode::CURSOR_LEFT'\n elsif key.include?('RIGHT')\n key = 'KeyCode::CURSOR_RIGHT'\n elsif key.include?('UP')\n key = 'KeyCode::CURSOR_UP'\n elsif key.include?('DOWN')\n key = 'KeyCode::CURSOR_DOWN'\n elsif ['CONTROL', 'CTRL', 'CNTRL'].include?(key)\n key = 'ModifierFlag::CONTROL_L'\n elsif ['OPTION', 'OPT', 'OP'].include?(key)\n key = 'ModifierFlag::OPTION_L'\n elsif ['COMM', 'COMMAND', 'CMD'].include?(key)\n key = 'ModifierFlag::COMMAND_L'\n elsif ['SHIFT', 'SHFT', 'SHIF'].include?(key)\n key = 'ModifierFlag::SHIFT_L'\n elsif ['PERIOD', 'DOT'].include?(key)\n key = 'KeyCode::DOT'\n elsif ['SEMICOLON', 'SEMI-COLON', 'SEMI_COLON'].include?(key)\n key = 'KeyCode::SEMICOLON'\n elsif [\"BR\", 'BRACKET', 'BRACE', 'BRACE_L', 'BRACKET_L', 'BRACKET_LEFT', 'LEFT_BRACKET'].include?(key)\n key = 'KeyCode::BRACKET_L' \n elsif [ 'BRACE_R', 'BRACKET_R', 'BRACKET_RIGHT', 'RIGHT_BRACKET' ].include?(key)\n key = 'KeyCode::BRACKET_R'\n end\n end\nend",
"def sentence_maker(array)\n combination = \"\"\n array[0].capitalize!\n array.each {|x| combination = combination + x.to_s + \" \"}\n combination.rstrip!\n combination = combination + \".\"\n return combination\nend",
"def encrypt(string, key)\n string_array = string.split\n string_array.map! do |word|\n word_array = word.split (\"\")\n word_array.map! do |letter|\n ceasar(letter,key)\n end\n word = word_array.join\n end\n string_array.join(' ')\nend",
"def duplicate_encode(word)\n arr = word.downcase.split('')\n\n arr.map! do |letter|\n if word.downcase.count(letter) == 1\n '('\n else\n ')'\n end\n\n end\n arr.join\nend",
"def aleatorio(arr)\n puts \"Cadena aleatoria: #{(65+rand(26)).chr*5}\"\n \nend",
"def yell(arr)\n result = [];\n i = 0;\n while i < arr.length\n result[i] = arr[i] + '!';\n i += 1;\n end\n return result\nend",
"def yell(words)\n newArr = []\n i = 0\n while i<words.length\n newWord = words[i] + \"!\"\n newArr << newWord\n i += 1\n end\n return newArr\n end",
"def vigenere_cipher(msg, arr)\n alphabet = (\"a\"..\"z\").to_a\n new_msg = \"\"\n msg.each_char.with_index do |char, i|\n pos= alphabet.index(char)\n key = arr[i % arr.length]\n new_pos = (pos + key) % alphabet.length\n new_msg += alphabet[new_pos]\n end\n new_msg\nend",
"def add_s(array)\n\t\tarray.each_with_index.collect do |word, i|\n\t\t\tif i == 1 then\n\t\t\t\tword = word\n\t\t\telse\n\t\t\t\tword << \"s\"\n\t\tend\n\tend\nend",
"def pretty_hands (card_one, card_two)\n format_cards = [card_one, card_two]\n i = 0\n while i < format_cards.length\n format_cards[i][0] = \"Ace\" if format_cards[i][0] == 1\n format_cards[i][0] = \"Jack\" if format_cards[i][0] == 11\n format_cards[i][0] = \"Queen\" if format_cards[i][0] == 12\n format_cards[i][0] = \"King\" if format_cards[i][0] == 13\n\n format_cards[i][1] = \"♦︎\" if format_cards[i][1] == 1\n format_cards[i][1] = \"♣︎\" if format_cards[i][1] == 2\n format_cards[i][1] = \"♥︎\" if format_cards[i][1] == 3\n format_cards[i][1] = \"♠︎\" if format_cards[i][1] == 4\n i += 1\n end\n return format_cards\nend",
"def letter_hash s\n s.each_char.to_a.sort.join('')\nend",
"def puzzle(sudoku)\n # this method is yours to implement\n \n sudoku.map { |char| rand(1..3) == 1 ? char = ' ' : char = char} \nend",
"def pigLatin(sentence)\n\n #declare var to hold the split string\n splitSentence = sentence.split()\n #empty array to hold split strings\n result = \"\"\n #split the word into letters\n for word in splitSentence\n letters = word.split(//)\n first_letter = letters[0]\n letters.shift()\n letters.push(first_letter)\n letters.push(\"ay \")\n\n result += letters.join()\n\n end\n\n result.capitalize!.chop!()\n return result\nend",
"def sentence_maker(array)\n sentence = array[0].capitalize\n for w in 1...array.length\n sentence = sentence + \" \" + array[w].to_s\n end\n return sentence + \".\"\nend",
"def dash_to_letter() \n $match_index_arr.map {|n| $hidden_word_arr[n] = \"#{$input}\"}\n end",
"def caesar_cipher(userWord, userShift)\n userWordArray = userWord.split(\"\") #Makes an array of characters\n shift = userShift%26\n c = []\n userWordArray.each do |letter|\n if letter.ord == 32\n c.push(letter)\n elsif letter.ord < 122\n b = letter.ord + shift\n c.push(b.chr)\n else\n b = letter.ord \n diff= (b-122) + shift\n b = 96+diff\n c.push(b.chr)\n end\n end\n c = c.join\nend",
"def hipsterfy(str)\n finalArray = []\n alphabet = (\"a\"..\"z\").to_a\n wordArray = str.split(\" \")\n wordArray.each do |word|\n firstSeen = false\n reversed = word.split(\"\").reverse\n finalWord = []\n reversed.each do |letter|\n if firstSeen == true || letter != \"a\" && letter != \"e\" && letter != \"i\" && letter != \"o\" && letter != \"u\"\n finalWord.push(letter)\n\n elsif firstSeen == false && letter == \"a\" || letter == \"e\" || letter == \"i\" || letter == \"o\" || letter == \"u\"\n # don't add here\n firstSeen = true\n end\n end\n \n newString = \"\"\n finalWord.reverse.each do |element|\n newString += String(element)\n end\n finalArray.push(newString)\n \n end\n \n \n \n # print finalArray\n finalString = \"\"\n \n finalArray.each_with_index do |word, index|\n if index != finalArray.length - 1\n finalString += word + \" \"\n else\n finalString += word\n end\n end\n \n \n \n \n \n \n return finalString\n \n \n\n \nend",
"def translate_to_cipher(sentence) #creates a method, with an array \n alphabet = ('a'..'z').to_a # sets alphabet equal to the letters a to z in an array\n cipher = Hash[alphabet.zip(alphabet.rotate(4))] #creates a hash with the values of the alphabet +4\n spaces = [\"@\", \"#\", \"$\", \"%\", \"^\", \"&\", \"*\"] #replaces the spaces with symbols \n original_sentence = sentence.downcase #makes the whole sentence downcase\n encoded_sentence = [] #creates an empty hash\n original_sentence.each_char do |element| #each character does...\n if cipher.include?(element)\n encoded_sentence << cipher[element] # puts the cipher element into the encoded_sentence\n elsif element == ' '\n encoded_sentence << spaces.sample # puts the spaces samples into the encoded_sentence\n else \n encoded_sentence << element #puts the elements into the encoded_sentence\n end\n end\n \n return encoded_sentence.join #returns the encoded_sentence decoded!\nend",
"def caesar_cipher(offset, string)\n\talph = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\ti = 0\n\tnew_string = \"\"\n\tind = 0\n\n\tputs string.length \n\n\twhile i < string.length\n\t\t\n\t\t\n\t\t\n\t\tif string[i] == \" \"\n\t\t\tnew_string = new_string + \" \"\n\t\t\t\n\t\telse \n\t\t\tind = alph.index(string[i])\n\t\t\t\n\t\t\tif (ind + offset) > 25\n\t\t\t\tind = (ind + offset) - 26 \n\t\t\t\t\n\t\t\t\tnew_string = new_string + alph[(ind)]\n\t\t\t\t\n\t\t\telse \n\t\t\t\tnew_string = new_string + alph[(ind + offset)]\n\t\t\t\t\n\t\t\tend\n\t\tend\n\t\ti +=1\n\tend\n\n\treturn new_string\n\nend",
"def sentence_maker(array)\n\tlength = array.length\n\tsum = array[0].to_s.capitalize!\n\tfor i in 1...length\n\t\tsum = sum + \" \" + array[i].to_s\n\tend\n \tsum + \".\"\nend",
"def pre_vowel_scramble(letter)\n original_index = \"zdhnt\".index(letter)\n new_letter = \"bfjpv\"[original_index]\n return new_letter\nend",
"def sentence_maker(array)\n\tx = 0\n\tsum = \"\"\n\n\t\twhile x < (array.length - 1)\n\t\t\tsum += array[x].concat \" \" \n\t\t\tx += 1\n\t\tend \n\t\t\tsum += array[x].concat \".\" \n\treturn sum\n\nend",
"def caesar_decode(string, offset)\n string.split(\"\").map do |character| #.map goes through array and creates a new array \n if $array_abc_low.include?(character) #checks if a letter is in the first/second array\n new_character = $array_abc_low[($array_abc_low.index(character)-offset)%26]\n # character_index = ($array_abc_low.index(character)-offset)%26 #adds in the offset number so the letter will change\n # new_character=$array_abc_low[character_index] #returns element in the new index\n elsif $array_abc_up.include?(character) #checks if a letter is in the first/second array\n new_character = $array_abc_up[($array_abc_up.index(character)-offset)%26]\n # character_index = ($array_abc_up.index(character)-offset)%26 #adds in the offset number so the letter will change\n # new_character=$array_abc_up[character_index]\n else character #this is for symbols/number and returns 'nil'\n end\n end.join(\"\")\nend",
"def kcode() end",
"def yell(words)\n\twords_bang = []\n\n\ti = 0\n\twhile i < words.length\n\t\twords_temp = words[i]\n\t\twords_new = words_temp + '!'\n\n\t\twords_bang << words_new\n\n\t\ti += 1\n\tend\n\t\n\treturn words_bang\nend",
"def charset\n names = []\n 26.times do |i|\n names << (65 + i).chr\n end\n names\nend",
"def Caesar_Cypher(string, shift_factor)\n coded_array = []\n arr = string.split(\"\")\n\n arr.each do |letter|\n ascii_letter = letter.ord\n\n if ascii_letter.between?(65, 90)\n ascii_letter += shift_factor\n if ascii_letter > 90\n ascii_letter -= 26\n end\n elsif ascii_letter.between?(97, 122)\n ascii_letter += shift_factor\n if ascii_letter > 122\n ascii_letter -= 26\n end\n end\n\n coded_array.push(ascii_letter.chr)\n end\n\n cypher = coded_array.join(\"\")\n p cypher\nend",
"def caesar_cipher(caesar_string, shift_factor) \n alphabet = (\"a\"..\"z\").to_a\n new_string = \"\"\n\n caesar_string.each_char do |input|\n if input == \" \"\n new_string += \" \"\n else \n old_index = alphabet.find_index(input)\n new_index = (old_index + shift_factor) % alphabet.count\n new_string += alphabet[new_index]\n end\n end\n\nputs new_string.chomp\n\nend",
"def cipher(word, key) \n #create a code for each letter of the alphabet (index == code)\n up_alpha = [\"A\",\"B\",\"C\",\"D\",\"E\",\"F\",\"G\",\"H\",\"I\",\"J\",\"K\",\"L\",\"M\",\"N\",\"O\",\"P\",\"Q\",\"R\",\"S\",\"T\",\"U\",\"V\",\"W\",\"X\",\"Y\",\"Z\"]\n down_alpha = [\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\",\"h\",\"i\",\"j\",\"k\",\"l\",\"m\",\"n\",\"o\",\"p\",\"q\",\"r\",\"s\",\"t\",\"u\",\"v\",\"w\",\"x\",\"y\",\"z\"]\n word_arr = []\n word_arr = word.split(//)\n\n #shift the value of each letter in the array \n word_arr.each do |letter|\n new_arr = []\n if up_alpha.include?(letter)\n new_index = up_alpha.index(letter) + key\n #If the new index exceed 25, rollover to index 0 (for uppercase letters)\n if new_index > 25\n new_index = new_index - 26\n new_arr.push(up_alpha[new_index])\n else \n new_arr.push(up_alpha[new_index])\n end\n\n elsif down_alpha.include?(letter)\n new_index = down_alpha.index(letter) + key\n #If the new index exceed 25, rollover to index 0 (for lowercase letters)\n if new_index > 25\n new_index = new_index - 26\n new_arr.push(down_alpha[new_index])\n else \n new_arr.push(down_alpha[new_index])\n end \n else\n new_arr.push(letter)\n end\n #combine the array into a string\n print new_arr.join()\n end\n puts ''\nend",
"def fix_start(string)\n char_array = string.split(\"\")\n first_char = string[0]\n new_array = Array.new\n\n char_array.each do |i|\n if i == \"b\"\n new_array.push(\"*\")\n else\n new_array.push(i)\n end\n end\n\n new_array[0] = first_char\n puts new_array\nend",
"def sentence_maker(array)\n combination = \"\"\n array.each {|x| combination = combination + x.to_s + \" \"}\n return combination.capitalize.chop + \".\"\nend",
"def cadenas(arr)\n 10.times do\n puts \"Cadena aleatoria: #{(65+rand(26)).chr*5}\"\n end\n \nend",
"def vigenere(key, txt)\n shift_array = key.get_shift\n count = 0\n\n txt_array = txt.split('')\n ciph=[]\n\n txt_array.each do |a|\n a = a.ord\n shift = shift_array[count % shift_array.size]\n case a\n when (64..90) \n new_char = ((a - 64 + shift) % 26) + 64 \n count += 1\n when (97..122)\n new_char = ((a- 97 + shift) % 26) + 97\n count += 1\n else \n new_char = a \n end\n ciph.push(new_char.chr)\n end\n\n ciph = ciph.join('')\n puts \"#{ciph}\"\nend",
"def pig_latin_word(string)\n array_of_char = string.downcase.split(//)\n\n if [\"a\",\"e\",\"i\",\"o\",\"u\",\"y\"].include?(array_of_char[0])\n array_of_char.push(\"ay\")\n elsif !([\"a\",\"e\",\"i\",\"o\",\"u\",\"y\"].include?(array_of_char[0]))\n consonant = array_of_char.delete_at(0)\n array_of_char.push(consonant, \"ay\")\n end\n\n return array_of_char.join\n\nend"
] | [
"0.8856897",
"0.8813024",
"0.8774708",
"0.8711452",
"0.8630604",
"0.8622542",
"0.86042774",
"0.86004066",
"0.85989594",
"0.85986775",
"0.8469509",
"0.84468347",
"0.84031886",
"0.8386328",
"0.8373424",
"0.837338",
"0.8342644",
"0.8339378",
"0.8339378",
"0.8288024",
"0.82761735",
"0.82058525",
"0.8181701",
"0.8152826",
"0.8109075",
"0.6292746",
"0.61020327",
"0.60277426",
"0.5988887",
"0.5953122",
"0.58788073",
"0.58345777",
"0.58217984",
"0.58150065",
"0.5810785",
"0.57675785",
"0.57446706",
"0.5732828",
"0.5730979",
"0.57130325",
"0.568294",
"0.56691223",
"0.5626404",
"0.5622633",
"0.56077385",
"0.560709",
"0.5606808",
"0.56042874",
"0.55979425",
"0.5593626",
"0.5580052",
"0.55754006",
"0.55574495",
"0.5556436",
"0.5553947",
"0.5548037",
"0.5545596",
"0.5538217",
"0.55348456",
"0.5533147",
"0.5531334",
"0.5527891",
"0.5526967",
"0.5526873",
"0.55268526",
"0.5525274",
"0.55243987",
"0.5521237",
"0.5516552",
"0.55154943",
"0.55144376",
"0.5513032",
"0.549832",
"0.5495505",
"0.54824364",
"0.5475448",
"0.54733175",
"0.54702485",
"0.5468308",
"0.54641026",
"0.5462712",
"0.545918",
"0.5457009",
"0.5456315",
"0.54556376",
"0.5454982",
"0.5453867",
"0.5449847",
"0.54498035",
"0.5445418",
"0.5444717",
"0.54428667",
"0.5439067",
"0.54385304",
"0.5435835",
"0.54306465",
"0.5430536",
"0.5427414",
"0.54166806",
"0.5407114"
] | 0.8825824 | 1 |
check understanding of create method | def create
@story = Story.new(story_params)
if @story.save
flash[:success] = "Thanks for sharing"
redirect_to story_path(@story)
else
flash[:error] = "Oops, sorry, something went wrong"
render :new
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n \n end",
"def create; end",
"def create; end",
"def create; end",
"def create; end",
"def create\n \t\n end",
"def create\r\n end",
"def create\n end",
"def create\n \n end",
"def create!\n end",
"def create\r\n\r\n\r\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n raise NotImplementedError\n end",
"def create\n raise NotImplementedError\n end",
"def create \n end",
"def create \n end",
"def create\n # TODO: implement create\n end",
"def create!\n raise NotImplementedError\n end",
"def create\n raise \"Not supported\"\n end",
"def create\n raise NotImplementedError\n end",
"def create\n\tend",
"def create\n\tend",
"def create\n\tend",
"def create\n\tend",
"def create\n\tend",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n\n\tend",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n \n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end",
"def create\n\n end"
] | [
"0.8637082",
"0.8635565",
"0.8635565",
"0.8635565",
"0.8635565",
"0.84175116",
"0.83964473",
"0.83905",
"0.8365424",
"0.8310063",
"0.8290388",
"0.8290368",
"0.8263731",
"0.8263731",
"0.8263731",
"0.8179925",
"0.8179925",
"0.81189525",
"0.81189525",
"0.8107339",
"0.80370194",
"0.8034528",
"0.8002922",
"0.7998363",
"0.7998363",
"0.7998363",
"0.7998363",
"0.7998363",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.79951626",
"0.7961915",
"0.7961915",
"0.7961915",
"0.7961915",
"0.7943416",
"0.79418135",
"0.79418135",
"0.79418135",
"0.79418135",
"0.79418135",
"0.79418135",
"0.79418135",
"0.79418135",
"0.7923999",
"0.7923999",
"0.7923999",
"0.7923999",
"0.7923999",
"0.7923999",
"0.7923999",
"0.7923999",
"0.7923999",
"0.7923999",
"0.7923999",
"0.7923999",
"0.7923999",
"0.7923999",
"0.7923999",
"0.7923999",
"0.7923999",
"0.7923999"
] | 0.0 | -1 |
method is only applicable within this file, public is accessible outside of this file | def story_params
params.require(:story).permit(:title, :body, :url, :author)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def public; end",
"def public; end",
"def private_method\n end",
"def public_method; end",
"def internal; end",
"def protected_method\n end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def implementation; end",
"def implementation; end",
"def private_method; end",
"def custom; end",
"def custom; end",
"def refutal()\n end",
"def accessibility; end",
"def methods() end",
"def external; end",
"def schubert; end",
"def suivre; end",
"def expose; end",
"def private_method\n\tend",
"def private_method\n\tend",
"def internal_methods; end",
"def weber; end",
"def probers; end",
"def private_method\n end",
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def zuruecksetzen()\n end",
"def internal?; end",
"def method4 # and this will be 'public'\r\n\t\t#...\r\n\tend",
"def isolated; end",
"def isolated; end",
"def api; end",
"def api; end",
"def public_method_here\n\t# stuff\nend",
"def who_we_are\r\n end",
"def protected_method\n\tend",
"def method4 # and this will be 'public'\n #...\n end",
"def init\n\n end",
"def apis; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method4 # and this will be 'public'\n #...\n end",
"def main\n super\n return self\n end",
"def wrapper; end",
"def initialize\n\n end",
"def initialize\n\n end",
"def global; end",
"def parent_api; end",
"def parent_api; end",
"def rossini; end",
"def visibility; end",
"def visibility; end",
"def visibility; end",
"def visibility; end",
"def visibility; end",
"def other_public_method\n end",
"def handle; end",
"def initialize()\r\n\r\n end",
"def interface; end",
"def interface; end",
"def protected\n\tend",
"def provider; end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def overrides; end",
"def extra; end",
"def initialize()\n\t\tend",
"def common\n \n end",
"def protected_method\n end",
"def how_it_works\r\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end"
] | [
"0.84349996",
"0.7961294",
"0.7961294",
"0.79070276",
"0.7380707",
"0.7325665",
"0.7105948",
"0.7092406",
"0.7092406",
"0.7092406",
"0.7092406",
"0.69915587",
"0.69915587",
"0.6879588",
"0.68456775",
"0.68456775",
"0.6805289",
"0.6789396",
"0.6708778",
"0.66673034",
"0.661695",
"0.66078943",
"0.66072464",
"0.65891206",
"0.65891206",
"0.6549662",
"0.65419954",
"0.6539414",
"0.6499279",
"0.64773977",
"0.64773977",
"0.64773977",
"0.6463439",
"0.6463439",
"0.6463439",
"0.6463439",
"0.6453905",
"0.643514",
"0.63930106",
"0.6374278",
"0.6374278",
"0.63657504",
"0.63657504",
"0.63504577",
"0.6322746",
"0.63212997",
"0.6309729",
"0.6293263",
"0.6291457",
"0.6277747",
"0.6277747",
"0.6277747",
"0.6277747",
"0.6277747",
"0.6277747",
"0.6277747",
"0.6277747",
"0.6277747",
"0.6277747",
"0.6277747",
"0.6277747",
"0.62655604",
"0.62594146",
"0.62416935",
"0.62400484",
"0.62400484",
"0.6239805",
"0.62297076",
"0.62297076",
"0.6219349",
"0.6216836",
"0.6216836",
"0.6216836",
"0.6216836",
"0.6216836",
"0.62148094",
"0.6212216",
"0.6197939",
"0.61890167",
"0.61890167",
"0.61816347",
"0.6160901",
"0.6160831",
"0.6160831",
"0.6160831",
"0.6160831",
"0.6150423",
"0.6149338",
"0.61432433",
"0.6127502",
"0.6119434",
"0.6099239",
"0.60896593",
"0.60896593",
"0.60896593",
"0.60896593",
"0.60896593",
"0.60896593",
"0.60896593",
"0.60896593",
"0.60896593"
] | 0.0 | -1 |
Creates a Device Group based on parameters | def create
start = Time.now
debug "Creating device group: \"#{resource[:full_path]}\""
connection = self.class.get_connection(resource[:account])
recursive_group_create(connection,
resource[:full_path],
resource[:description],
resource[:properties],
resource[:disable_alerting])
debug "Finished in #{(Time.now-start)*1000.0} ms"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_group\n group new_resource.group do\n gid new_resource.gid\n system true\n end\n end",
"def createGroup\n call :createGroup\n end",
"def create_group(attributes)\n BrickFTP::API::Group.create(attributes)\n end",
"def create_group(attributes)\n BrickFTP::API::Group.create(attributes)\n end",
"def create_group(group_name,group_uuid,classes = {},rule_term,parent_group)\n load_classifier\n groups = @classifier.groups\n @classifier.update_classes.update\n current_group = groups.get_groups.select { |group| group['name'] == group_name}\n if current_group.empty?\n cputs \"Creating #{group_name} group in classifier\"\n groups.create_group({\n 'name' => group_name,\n 'id' => group_uuid,\n 'classes' => classes,\n 'parent' => groups.get_group_id(\"#{parent_group}\"),\n 'rule' => rule_term\n })\n else\n cputs \"NODE GROUP #{group_name} ALREADY EXISTS!!! Skipping\"\n end\nend",
"def CreateGroup params = {}\n \n APICall(path: 'groups.json',method: 'POST',payload: params.to_json)\n \n end",
"def new_group(group_data)\n [:id, :name].each { |attr| raise(ArgumentError, \"Missing or Invalid Parameter(s)\") unless group_data.key?(attr) }\n set_values group_data\n end",
"def create_new_vm_group\n end",
"def create_group(attributes)\n post(\"/v1/groups\", attributes)\n end",
"def create_port_group\n Puppet.debug \"Entering Create Port Group method.\"\n @networksystem=host.configManager.networkSystem\n if (find_vswitch == false)\n raise Puppet::Error, \"Unable to find the vSwitch \" + resource[:vswitch]\n end\n hostnetworkpolicy = RbVmomi::VIM.HostNetworkPolicy()\n hostportgroupspec = RbVmomi::VIM.HostPortGroupSpec(:name => resource[:portgrp], :policy => hostnetworkpolicy, :vlanId => resource[:vlanid], :vswitchName => resource[:vswitch])\n @networksystem.AddPortGroup(:portgrp => hostportgroupspec)\n\n if (resource[:traffic_shaping_policy] !=nil )\n traffic_shaping\n end\n if (resource[:failback] !=nil )\n set_failback\n end\n if (resource[:overridefailoverorder] !=nil )\n setoverridepolicy\n end\n if (resource[:checkbeacon]!= nil)\n set_checkbeacon\n end\n if (resource[:portgrouptype] == :VMkernel)\n Puppet.debug \"Entering type VMkernel\"\n add_virtual_nic\n\n if (resource[:vmotion] !=nil )\n setupvmotion\n end\n\n if (resource[:mtu] !=nil )\n setupmtu\n end\n end\n Puppet.notice \"Successfully created a portgroup {\" + resource[:portgrp] + \"}\"\n end",
"def createGroup _args\n \"createGroup _args;\" \n end",
"def createGroup(groupName, gid)\r\n uri = sprintf(\"/api/v1/group_categories/%d/groups\", gid) \r\n \r\n dbg(\"POST #{uri}\")\r\n dbg(\"name=#{groupName}\")\r\n newGroup = $canvas.post(uri, {'name' => groupName})\r\n dbg(newGroup)\r\n return newGroup\r\nend",
"def createGroup(groupName, gid)\r\n uri = sprintf(\"/api/v1/group_categories/%d/groups\", gid) \r\n \r\n dbg(\"POST #{uri}\")\r\n dbg(\"name=#{groupName}\")\r\n newGroup = $canvas.post(uri, {'name' => groupName})\r\n dbg(newGroup)\r\n return newGroup\r\nend",
"def create_group(user_id,device_token)\n @key_name_prefix=\"grupo_\"\n options = {\n :body =>{\"operation\": \"create\",\n \"notification_key_name\": @key_name_prefix+user_id.to_s,\n \"registration_ids\": [device_token]\n }.to_json,\n :headers => {'Content-Type'=> 'application/json',\n 'Authorization' => 'key = AAAAE0hYQbA:APA91bEdyT2IqQcv0xbWqGrbxaU2ty3KOmV2Fj7-w5-7rU3W03C6pU61WUEwyNSXFhRtq2LO68rljjM4YFYQOpWUNOsSZHulxPQVulQsMgMx5zstPEfvGj900Az_NinDBmXvDEoK7NlW ',\n 'project_id' => '82818122160'\n }\n }\n return results2 = HTTParty.post(\"https://android.googleapis.com/gcm/notification\",options)\n end",
"def create\n cu = User.find params[:user_id]\n\n @group = Group.new(params[:group])\n cu.groups << @group\n\n case params[:group_type].to_i\n when 1\n @group.groupable = ArtistGroup.create\n\n if defined?(params[:instr_id]) && (not params[:instr_id].nil?)\n m = Membership.where \"group_id = #{@group.id}\n AND userable_id = #{cu.id}\n AND userable_type = 'User'\"\n params[:instr_id].each do |i|\n m.first.instruments << Instrument.find(i)\n end\n end\n when 2\n @group.groupable = FanGroup.create :artist_group => ArtistGroup.find(params[:art_group_id].to_i)\n when 3\n @group.groupable = HostGroup.create\n end\n\n\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Die Gruppe wurde erfolgreich angelegt.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_entity_group\n @entity_group = EntityGroup.create!(client_id: @client_id,\n uuid: Util::Encryption::Admin.get_uuid,\n creator_admin_id: @admin_id,\n status: GlobalConstant::EntityGroup.active_status,\n activated_at: Time.now.to_i)\n end",
"def create_pop_group( name ) \n return \"Group #{name} already exists.\" if NodeGroup.find_by_name( name )\n \n unless File.exists?( SpkDashboard::DATA_PATH + \"/data_#{name}\" )\n return \"No params file found to create group #{name}. FILE: #{SpkDashboard::DATA_PATH + \"/data_#{name}\"}\"\n end\n \n params = self.read_group_params( name )\n \n nodegroup = NodeGroup.new(\n :name => name,\n :node_group_names => [ \"spk_base\" ],\n :parameter_attributes => params )\n \n if nodegroup.save \n return \"Successfully created group #{name}\"\n else\n return \"Failed to create group #{pop}\"\n end\n \n end",
"def create_group(group_name, path = '/')\n request(\n 'Action' => 'CreateGroup',\n 'GroupName' => group_name,\n 'Path' => path,\n :parser => Fog::Parsers::AWS::IAM::CreateGroup.new\n )\n end",
"def create\n @user.create_group!(new_group_params[:group_user_ids], {name: new_group_params[:name]})\n end",
"def create_group(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateGroup'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :comments\n\t\t\targs[:query]['Comments'] = optional[:comments]\n\t\tend\n\t\tif optional.key? :group_name\n\t\t\targs[:query]['GroupName'] = optional[:group_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def create_group\n group_params = params.require(:group_params)\n\n group_id = @infra.ec2.create_security_group({group_name: group_params[0], description: group_params[1], vpc_id: group_params[3]})\n @infra.ec2.create_tags(resources: [group_id[:group_id]], tags: [{key: 'Name', value: group_params[2]}])\n\n render text: I18n.t('security_groups.msg.change_success')\n end",
"def create_group\n group_params = params.require(:group_params)\n\n group_id = @infra.ec2.create_security_group({ group_name: group_params[0], description: group_params[1], vpc_id: group_params[3] })\n @infra.ec2.create_tags(resources: [group_id[:group_id]], tags: [{ key: 'Name', value: group_params[2] }])\n\n render plain: I18n.t('security_groups.msg.change_success')\n end",
"def create\n params[:group].delete(:domain) unless current_group.shapado_version.has_custom_domain?\n @group = Group.new\n if params[:group][:languages]\n params[:group][:languages].reject! { |lang| lang.blank? }\n end\n @group.safe_update(%w[languages name legend description default_tags subdomain logo forum enable_mathjax enable_latex custom_favicon language theme signup_type custom_css wysiwyg_editor], params[:group])\n\n @group.safe_update(%w[isolate domain private], params[:group]) if current_user.admin?\n\n @group.owner = current_user\n @group.state = \"active\"\n\n respond_to do |format|\n if @group.save\n @group.create_default_widgets\n\n Jobs::Images.async.generate_group_thumbnails(@group.id)\n @group.add_member(current_user, \"owner\")\n flash[:notice] = I18n.t(\"groups.create.flash_notice\")\n format.html { redirect_to(domain_url(:custom => @group.domain, :controller => \"admin/manage\", :action => \"properties\")) }\n format.json { render :json => @group.to_json, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create(group_hash)\n # Check arguments\n if !group_hash[:name]\n return OpenNebula::Error.new(\"Group name not defined\")\n end\n\n if group_hash[:group_admin]\n if group_hash[:group_admin][:name] && !group_hash[:group_admin][:password]\n error_msg = \"Admin user password not defined\"\n return OpenNebula::Error.new(error_msg)\n end\n end\n\n # Allocate group\n rc = allocate(group_hash[:name])\n return rc if OpenNebula.is_error?(rc)\n\n # Set group ACLs to create resources\n rc, msg = create_default_acls(group_hash[:resources])\n\n if OpenNebula.is_error?(rc)\n delete\n error_msg = \"Error creating group ACL's: #{rc.message}\"\n return OpenNebula::Error.new(error_msg)\n end\n\n # Set group ACLs to share resources\n if group_hash[:shared_resources]\n acls = Array.new\n acls << \"@#{id} #{group_hash[:shared_resources]}/@#{id} USE\"\n\n rc, msg = create_group_acls(acls)\n\n if OpenNebula.is_error?(rc)\n self.delete\n error_msg = \"Error creating group ACL's: #{rc.message}\"\n return OpenNebula::Error.new(error_msg)\n end\n end\n\n # Create associated group admin if needed\n rc = create_admin_user(group_hash)\n\n if OpenNebula.is_error?(rc)\n delete\n error_msg = \"Error creating admin user: #{rc.message}\"\n return OpenNebula::Error.new(error_msg)\n end\n\n sunstone_attrs = []\n\n # Add Sunstone views for the group\n if group_hash[:views]\n sunstone_attrs << \"VIEWS=\\\"#{group_hash[:views].join(\",\")}\\\"\"\n end\n\n if group_hash[:default_view]\n sunstone_attrs << \"DEFAULT_VIEW=\\\"#{group_hash[:default_view]}\\\"\"\n end\n\n # And the admin views\n if group_hash[:admin_views]\n sunstone_attrs << \"GROUP_ADMIN_VIEWS=\\\"#{group_hash[:admin_views].join(\",\")}\\\"\"\n else\n sunstone_attrs << \"GROUP_ADMIN_VIEWS=#{GROUP_ADMIN_SUNSTONE_VIEWS}\"\n end\n\n if group_hash[:default_admin_view]\n sunstone_attrs << \"GROUP_ADMIN_DEFAULT_VIEW=\\\"#{group_hash[:default_admin_view]}\\\"\"\n else\n sunstone_attrs << \"GROUP_ADMIN_DEFAULT_VIEW=#{GROUP_ADMIN_SUNSTONE_VIEWS}\"\n end\n\n do_update = false\n\n if sunstone_attrs.length > 0\n do_update = true\n\n update_str = \"SUNSTONE=[#{sunstone_attrs.join(\",\\n\")}]\\n\"\n end\n\n opennebula_attrs = []\n\n # Persistency attributes for new images\n if group_hash[:opennebula]\n if group_hash[:opennebula][:default_image_persistent]\n opennebula_attrs << \"DEFAULT_IMAGE_PERSISTENT=\\\"\"\\\n \"#{group_hash[:opennebula][:default_image_persistent]}\\\"\"\n end\n\n if group_hash[:opennebula][:default_image_persistent_new]\n opennebula_attrs << \"DEFAULT_IMAGE_PERSISTENT_NEW=\\\"\"\\\n \"#{group_hash[:opennebula][:default_image_persistent_new]}\\\"\"\n end\n end\n\n if opennebula_attrs.length > 0\n do_update = true\n\n update_str += \"OPENNEBULA=[#{opennebula_attrs.join(\",\\n\")}]\\n\"\n end\n\n if do_update\n rc = update(update_str, true)\n\n if OpenNebula.is_error?(rc)\n delete\n error_msg = \"Error updating group template: #{rc.message}\"\n return OpenNebula::Error.new(error_msg)\n end\n end\n\n return 0\n end",
"def create!\n misc = GroupCategory.find_by(slug: 'misc').id\n GROUP_NAMES.each do |name|\n # Make the group\n group = Group.where(\n name: name\n ).first_or_create(category_id: misc)\n # Set up an initial owner\n GroupMember.create!(user: owner, group: group, rank: :admin)\n end\n\n # Build up neighborhood, so the aozora groups have each other as neighbors\n GROUP_NAMES.permutation(2) do |from, to|\n src = Group.find_by(name: from)\n dst = Group.find_by(name: to)\n GroupNeighbor.create!(source: src, destination: dst)\n end\n end",
"def create_group(client, options)\n if options[:directory].nil? or options[:name].nil? or options[:description].nil?\n puts \"Missing arguments\"\n end\n \n directory = client.directories.get options[:directory]\n\n group = directory.groups.create({\n name: options[:name],\n description: options[:description]\n })\n puts \"Group created.\"\n\n #TODO: Add exception handling\nend",
"def create\n entity = Entity.find_by(id: group_params[:entity_id]) || not_found\n group = Group.new(\n group_name: \"#{entity.entity_name} Group\",\n entity_id: group_params[:entity_id],\n creator_id: current_user.id\n )\n if group.save\n group.entity.seatgeek_import if group.events.future.empty?\n group.join_group current_user, 'admin'\n flash.keep\n flash[:notice] = 'Group created!'\n redirect_to action: 'show', id: group.id\n else\n flash.keep\n flash[:error] = 'Group could not be created.'\n redirect_to action: 'new', entity_id: params[:entity_id]\n end\n end",
"def groups_create(params = {})\n fail ArgumentError, \"Required arguments 'name' missing\" if params['name'].nil?\n response = @session.do_post \"#{SCOPE}.create\", params\n Slack.parse_response(response)\n end",
"def create_group(group_node)\n name_ru = group_node.text.delete(\"0-9\")\n Group.create(name_ru: name_ru)\n end",
"def create\n\t\t@group = current_user.groups.create(group_params)\n\t\tif params[:users].present?\n\t\t\tparams[:users].each do |user_id|\n\t\t\t\[email protected]_groups.create(user_id: user_id)\n\t\t\tend\n\t\tend\n\t\tredirect_to :groups, notice: 'Group created successfully'\n\tend",
"def create_group(files, options = {})\n Uploadcare::Group.create(files, options)\n end",
"def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration], owner: current_user)\n if @group.save\n @group.memberships.create!(user: current_user, admin: true)\n if params[:group][:users]\n params[:group][:users].each do |u|\n @group.memberships.create!(user: User.where(\"id = ? OR email = ?\", u[:id], u[:email]).first, admin:u[:admin])\n end\n end\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def create_groups(groupnames)\r\n groupnames.map {|groupname| @logger.debug(\"Checking #{groupname} for existence...\")\r\n if get_groupid(groupname) == nil\r\n\t\t\t\[email protected](\"Looks like #{groupname} is empty, therefore creating it\")\r\n\t\t\t\tgroupobject = OpenNebula::Group.new(OpenNebula::Group.build_xml,@client)\r\n\t\t\t\trc = groupobject.allocate(groupname)\r\n\t\t\t\tif OpenNebula.is_error?(rc)\r\n \t\t\t\[email protected](\"Error occured while creating group: #{rc.message}\")\r\n \t\t end\r\n end\r\n }\r\n end",
"def define_group\n case new_resource.im_install_mode\n when 'admin'\n group = if new_resource.group.nil?\n 'root'\n else\n new_resource.group\n end\n group\n when 'nonAdmin', 'group'\n group = if new_resource.group.nil?\n Chef::Log.fatal \"Group not provided! Please provide the group that should be used to install your product\"\n raise \"Group not provided! Please provide the group that should be used to install your product\"\n else\n new_resource.group\n end\n group\n end\nend",
"def define_group\n case new_resource.im_install_mode\n when 'admin'\n group = if new_resource.group.nil?\n 'root'\n else\n new_resource.group\n end\n group\n when 'nonAdmin', 'group'\n group = if new_resource.group.nil?\n Chef::Log.fatal \"Group not provided! Please provide the group that should be used to install your product\"\n raise \"Group not provided! Please provide the group that should be used to install your product\"\n else\n new_resource.group\n end\n group\n end\nend",
"def create #:nodoc:\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n flash[:notice] = I18n.t(\"{{value}} was successfully created.\", :default => \"{{value}} was successfully created.\", :value => I18n.t(\"Group\", :default => \"Group\"))\n if params[:create_and_new_button]\n format.html { redirect_to new_group_url }\n else\n format.html { redirect_to groups_url }\n # format.xml { render :xml => @group, :status => :created, :location => @group }\n end\n else\n format.html { render :action => \"new\" }\n # format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n group = params[:group] || {}\n group.delete(:locales)\n group.delete(:domains)\n @group = GROUP.new(group)\n @group.current_user = current_user\n\n respond_to do |format|\n if @group.save\n flash[:notice] = 'Group was successfully created.'\n format.html { redirect_to(group_url(@group.id)) }\n format.xml { render :xml => @group, :status => :created, :location => group_url(@group.id) + \".xml\" }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @group = @current_user.create_group(params[:group])\n # @group = @current_user.groups.build(params[:group])\n # @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.valid?\n format.html { redirect_to circle_groups_path, notice: 'Group was successfully created.' }\n format.json { render json: @group, status: :created, location: @group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def group_create(group_name:, trace: false)\n group_query = \"{\\\"group_name\\\":\\\"#{group_name}\\\",\\\"group_external_id\\\":\\\"#{group_name}\\\",\\\"group_management_type\\\":{\\\".tag\\\":\\\"company_managed\\\"}}\"\n dropbox_query(query: '2/team/groups/create', query_data: group_query, trace: trace)\n end",
"def create\n @group = Group.new(group_params)\n unless @group.save\n render :new and return\n end\n msg = [\"Created group.\", rebuild_configs].join(\" \")\n redirect_to groups_url, notice: msg\n end",
"def set_device_group\n @device_group = DeviceGroup.find(params[:id])\n end",
"def new group_identifier, object_identifier_or_array = []\n groups.store self.class.identifierize(group_identifier), self.class.identifier_collect(object_identifier_or_array)\n end",
"def create_product_group\n ProductGroup.create(:group_id => self.group_id, :product_id => self.product_id)\n return true\n end",
"def create\n @group = Group.new(group_params)\n\n respond_to do |format|\n if @group.save\n format.json { render json: @group, status: :created }\n else\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n @group.tuners << current_tuner\n # For specified users, we need to send an invite out (Make function so that the update funciton may use)\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to(@group, :notice => 'Group was successfully created.') }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_db_parameter_group(group_name, group_family, description)\n request({\n 'Action' => 'CreateDBParameterGroup',\n 'DBParameterGroupName' => group_name,\n 'DBParameterGroupFamily' => group_family,\n 'Description' => description,\n\n :parser => Fog::Parsers::AWS::RDS::CreateDbParameterGroup.new\n })\n end",
"def new\n \t@group = Group.new\n end",
"def create_study_group(params={})\n sg_name.set params['name']\n sg_oid.set params['oid']\n is_mccadmin_only.set(true) if params['is_mccadmin_only'].downcase.include?('true')\n\n # check if apps are specified\n if params['apps']\n # special case for Test App\n if params['apps'].include?(\"Test App-MCC\")\n select_test_app\n else\n select_apps(params['apps'])\n end\n end\n\n # check if courses are specified\n if params['courses']\n if params['courses'].include?(\"Test Sample Course\")\n test_course.set(true)\n else\n select_courses(params['courses'])\n end\n end\n save_button.click\n sleep 10 #Wait for role assignments\n end",
"def create\n @tqrdc_group = Tqrdc::Group.new(tqrdc_group_params)\n\n respond_to do |format|\n if @tqrdc_group.save\n format.html { redirect_to @tqrdc_group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @tqrdc_group }\n else\n format.html { render :new }\n format.json { render json: @tqrdc_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @group = Group.new\n end",
"def new\n @group = Group.new\n end",
"def new\n @group = Group.new\n end",
"def new\n @group = Group.new\n end",
"def new\n @group = Group.new\n end",
"def group_builder; end",
"def create\n name = params[:name]\n @group = Group.new(name: name)\n @group.creator_id = @current_user.id\n if @group.save\n @current_user.creator_join!(@group)\n respond_with(@group, only: [:id, :name, :creator_id, :admin_id])\n else\n render_error(404, request.path, 20101, @group.errors.as_json)\n end\n end",
"def add_group(name, title = nil)\n name = name.to_sym\n sensors_config[name] ||= {}\n sensors_config[name][:title] = title if title\n sensors_config[name][:sensors] ||= {}\n return name\n end",
"def new\n @group = Group.new\n end",
"def __mk_group(gdoc)\n @disp_dic.ext_grp unless @disp_dic.is_a? Disp::Grouping\n gatt = gdoc.to_h\n return if gatt[:enable] == 'false'\n sub = @disp_dic.add_grp(gatt.delete(:id), gatt.delete(:label))\n gdoc.each { |e| __mk_sub_db(e, sub, gatt.dup) }\n end",
"def create_group(path, name)\n puts \"creating #{name} on path #{path}\"\n \n ret = RestClient.post \"#{@url}/groups\", \n { path: path, name: name }, \n { \"Private-Token\": @token } \n json = JSON.parse(ret.body)\n\n json['id']\n end",
"def create\n @device_group = DeviceGroup.new(device_group_params)\n\n respond_to do |format|\n if @device_group.save\n format.html { redirect_to @device_group, notice: 'Device group was successfully created.' }\n format.json { render :show, status: :created, location: @device_group }\n format.js {\n @device_groups = DeviceGroup.all\n render :create\n }\n else\n format.html { render :new }\n format.json { render json: @device_group.errors, status: :unprocessable_entity }\n format.js {\n @device_groups = DeviceGroup.all\n render :create\n }\n end\n end\n end",
"def create\n new_group = Group.new(name: params[:name])\n\n if new_group.save\n render json: { \"notice\"=>\"new group #{params[:name]} successfully created\" }\n else\n render json: { \"alert\"=>\"group creation failed. check params.\" }\n end\n end",
"def instructor_create_grp(course, group)\n load_course_grps course\n\n # Create new group set\n logger.info \"Creating new group set called '#{group.group_set}'\"\n (button = button_element(xpath: '//button[@id=\"add-group-set\"]')).when_present Utils.short_wait\n js_click button\n wait_for_element_and_type(text_area_element(id: 'new_category_name'), group.group_set)\n checkbox_element(id: 'enable_self_signup').check\n button_element(id: 'newGroupSubmitButton').click\n link_element(xpath: \"//a[@title='#{group.group_set}']\").when_present Utils.short_wait\n\n # Create new group within the group set\n logger.info \"Creating new group called '#{group.title}'\"\n js_click button_element(class: 'add-group')\n wait_for_element_and_type(edit_group_name_input_element, group.title)\n button_element(id: 'groupEditSaveButton').click\n link_element(xpath: \"//a[contains(.,'#{group.title}')]\").when_present Utils.short_wait\n (link = link_element(xpath: \"//a[contains(.,'#{group.title}')]/../following-sibling::div[contains(@class,'group-actions')]//a\")).when_present Utils.short_wait\n logger.info \"Group ID is '#{group.site_id = link.attribute('id').split('-')[1]}'\"\n end",
"def create\n @group = Group.new(permitted_params)\n @group.owner ||= current_user\n authorize @group, :create?\n respond_to do |format|\n if @group.save\n format.html { redirect_to(@group, :notice => 'Group was successfully created.') }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def define_group(name, desc, priority)\n parameters_groups[name.to_sym] =\n { desc: _t(desc), priority: priority }\n end",
"def create\n @group = Group.new(params[:group])\n\n if @group.save\n flash[:notice] = t('flash_msg46')\n @groups = Group.all\n else\n @error = true\n end\n end",
"def create_target_group(groupname, title, description)\n params = { \":name\" => groupname }\n params[\"sakai:category\"] = \"group\"\n params[\"sakai:group-description\"] = description || \"\"\n params[\"sakai:group-id\"] = groupname\n params[\"sakai:group-title\"] = title || \"\"\n params[\"sakai:joinRole\"] = \"member\"\n params[\"sakai:roles\"] = '[{\"id\":\"member\",\"title\":\"Member\",\"allowManage\":false},{\"id\":\"manager\",\"title\":\"Manager\",\"allowManage\":true}]'\n params[\"sakai:templateid\"] = \"simplegroup\"\n response = @sling.execute_post(@sling.url_for($GROUP_URI), params)\n @log.info(\"create_target_group() for #{groupname} POST response code: #{response.code}\")\n @log.debug(\"create_target_group() for #{groupname} POST response body: #{response.body}\")\n @file_log.info(\"create_target_group() for #{groupname} POST response code: #{response.code}\") if (@file_log)\n @file_log.debug(\"create_target_group() for #{groupname} POST response body: #{response.body}\") if (@file_log)\n if (response.code.to_i > 299)\n @log.warn(\"create_target_group() returned #{response.code} group may already exist?\")\n @file_log.warn(\"create_target_group() returned #{response.code} group may already exist?\") if (@file_log)\n end\n group = Group.new(groupname)\n return group\n end",
"def new\n @group = Group.new \n end",
"def create_channel_group 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_channel_group_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::Analytics::Admin::V1alpha::ChannelGroup.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def device_group_params\n params.require(:device_group).permit(:name, :icon, properties_attributes: [:id, :name, :style, :unit, :values, :fa_style])\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if !current_user || (!current_user.is_admin)\n format.html { redirect_to(@group, :notice => 'No permissions to create groups.')}\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n elsif @group.save\n format.html { redirect_to(@group, :notice => 'Group was successfully created.') }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def group_creator\n group = Random.new.rand(1..3)\n return group\nend",
"def create_attribute_group\n\t\tif AttributeGroup.where(name: \"Otros\", company_id: self.id).count < 1\n\t\t\tAttributeGroup.create(name: \"Otros\", company_id: self.id, order: 1)\n\t\tend\n\tend",
"def create\n counter = 0\n # for each class created, loop through it and enter it into the database, increment counter as well\n if !params[:group].nil?\n params[:group].each do |group|\n next if group[:group_name] == \"\" || group[:end_time] == \"\"\n # creating the user group\n @group = current_user.groups.build(group_name: group[:group_name].downcase, end_time: group[:end_time], group_day: group[:group_day], conversation_id: group[:conversation_id], time_zone: current_user.time_zone)\n @group.save\n counter += 1\n end\n if @group.nil?\n redirect_to root_path, notice: \"Sorry! You need to fill out the form\"\n elsif @group.save\n redirect_to root_path, notice: \"You made some classes, YAY!\"\n else\n render :new\n end\n end\n end",
"def create_scanning_group_with_http_info(body, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SensitiveDataScannerAPI.create_scanning_group ...'\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling SensitiveDataScannerAPI.create_scanning_group\"\n end\n # resource path\n local_var_path = '/api/v2/sensitive-data-scanner/config/groups'\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[:debug_body] || @api_client.object_to_http_body(body)\n\n # return_type\n return_type = opts[:debug_return_type] || 'SensitiveDataScannerCreateGroupResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :create_scanning_group,\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 :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SensitiveDataScannerAPI#create_scanning_group\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create_new_node_group_model(options={})\n # name, classes, parent are the only required keys\n name = options['name'] || RandomString.generate\n classes = options['classes'] || {}\n parent = options['parent'] || Rootuuid\n rule = options['rule']\n id = options['id']\n environment = options['environment']\n variables = options['variables']\n description = options['description']\n environment_trumps = options['environment_trumps']\n\n hash = { \"name\" => name,\n \"parent\" => parent,\n \"classes\" => classes }\n\n if environment_trumps\n hash['environment_trumps'] = environment_trumps\n end\n if rule\n hash['rule'] = rule\n end\n if environment\n hash['environment'] = environment\n end\n if variables\n hash['variables'] = variables\n end\n if description\n hash['description'] = description\n end\n if id\n hash['id'] = id\n end\n\n create_node_group(hash).env.body\n end",
"def apply_group\n group = \n if params[:group_name] && params[:group_name].any?\n current_account.groups.of_devices.create :name => params[:group_name]\n else\n current_account.groups.of_devices.find(params[:group_id])\n end\n\n current_account.devices.find(params[:apply_ids].split(\",\")).each do |d|\n group.devices << d unless group.devices.include?(d)\n end\n\n redirect_to devices_path\n end",
"def create(id, user_id, name)\n user = get_user(user_id)\n group = Group.new(id, user.id, name)\n @@group[id] = group\n group.add(user.id)\n return \"Group Created\"\n end",
"def create_group( group_name )\n check_user_pass\n # First we need to clean the group_name since jangosmtp only allows alphanumeric characters\n group_name.tr!('^A-Za-z0-9 ', '')\n options = {\n 'Username' => @username,\n 'Password' => @password,\n 'GroupName' => group_name\n }\n\n response = post_with_attempts( 'AddTransactionalGroup', options )\n if response != false\n new_group_id = Nokogiri::XML.parse(response.body).xpath(\"*\").first.content.split(\"\\n\")[2]\n end\n return new_group_id\n end",
"def create\n #logger.info \"Post parameters: #{params}\"\n @group = Group.new(name: params[:group][:name], expiration: params[:group][:expiration])\n if @group.save\n params[:group][:users].each do |u|\n Membership.create(group: @group, user: User.where(\"id = ? OR email = ?\", u[:id], u[:email]).first, admin:u[:admin])\n end\n render json: @group, status: :created, location: @group\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def create\n @group = Group.new(group_params)\n @group.group_users.build user_type: 'Group Owner', user_id: @current_user.id\n @group.share_id = Array.new(8){rand(36).to_s(36)}.join\n\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render :show, status: :created, location: @group }\n else\n format.html { render :new }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(group_params)\n if @group.save\n flash[:success] = \"Group created!\"\n current_user.join(@group)\n @group.promote_to_admin(current_user)\n redirect_to group_url(@group)\n else\n render 'new'\n end\n end",
"def create\n @group = Group.new(group_params)\n @group.admin_id = current_user.id\n respond_to do |format|\n if @group.save\n\tUserGroup.create(admin: true, user_id: current_user.id, group_id: @group.id)\n\tflash[:success] = \"Group was successfully created!\"\n format.html { redirect_to @group }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @request_group = RequestGroup.new(request_group_params)\n\n respond_to do |format|\n if @request_group.save\n format.html { redirect_to @request_group, \n\t\t\t\t\t\t\t\t\t\t\tnotice: 'Request group was successfully created.' }\n format.json { render action: 'show', status: :created, \n\t\t\t\t\t\t\t\t\t\t\tlocation: @request_group }\n else\n format.html { render action: 'new' }\n format.json { render json: @request_group.errors, \n\t\t\t\t\t\t\t\t\t\t\tstatus: :unprocessable_entity }\n end\n end\n end",
"def create\n @group = Group.new(params[:group])\n if @group.save\n #@group.isGroupCreator(current_user.id) == 'true'\n render ('create')\n else\n render ('new')\n end\n end",
"def createResourceGroup(resource_group_name)\n resource_group_params = Azure::ARM::Resources::Models::ResourceGroup.new.tap do |rg|\n rg.location = $region_dc\n end\n puts 'Create Resource Group...'\n print_item $resource_client.resource_groups.create_or_update(resource_group_name, resource_group_params)\nend",
"def create\n begin\n new_group = @@data_util.hash_data_to_upper_case(@@data_util.strip_hash_data(params[:dept_group]), ['description'])\n new_group[:mypclient_id] = session[:client_id]\n new_group[:isactive] = 1\n new_group[:createdby] = session[:username]\n\n @deptgroup = Deptgroup.new(new_group)\n\n if @deptgroup.save\n @@request_result[:success] = true\n @@request_result[:notice] = 'Department Sub Group was successfully created.'\n else\n @@request_result[:errormsg] = @deptgroup.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",
"def create\n @group = Group.new(group_params)\n @group.create_robotsurvey()\n @group.create_signupsurvey()\n @group.create_poststudysurvey()\n respond_to do |format|\n if @group.save\n \n format.html { redirect_to @group, notice: 'Group was successfully created.' }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_db_parameter_group( options = {} )\n raise ArgumentError, \"No :db_parameter_group_name provided\" if options.does_not_have?(:db_parameter_group_name)\n raise ArgumentError, \"No :engine provided\" if options.does_not_have?(:engine)\n raise ArgumentError, \"No :description provided\" if options.does_not_have?(:description)\n\n params = {}\n params['DBParameterGroupName'] = options[:db_parameter_group_name]\n params['Engine'] = options[:engine]\n params['Description'] = options[:description]\n\n return response_generator(:action => \"CreateDBParameterGroup\", :params => params)\n end",
"def group(value)\n attributes[:group] = value\n end",
"def create\n\t\t@group = Group.new(params[:group])\n\t\trespond_to do |format|\n\t\t\tif fonct_new_dup?\n\t\t\t\tobject_orig=Group.find(params[:object_orig_id])\n\t\t\tst = @group.create_duplicate(object_orig)\n\t\t\telse\n\t\t\tst = @group.save\n\t\t\tend\n\t\t\tif st\n\t\t\t\tflash[:notice] = t(:ctrl_object_created, :typeobj => t(:ctrl_group), :ident => @group.name)\n\t\t\t\tparams[:id][email protected]\n\t\t\t\tshow_\n\t\t\t\tformat.html { render :action => \"show\" }\n\t\t\t\tformat.xml { render :xml => @group, :status => :created, :location => @group }\n\t\t\telse\n\t\t\t\tflash[:error] = t(:ctrl_object_not_created, :typeobj => t(:ctrl_group), :msg => nil)\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create_group(name, description, visible, owner_id=nil)\n url = \"/groups/#{name}\"\n body = {\n description: description,\n visible_to_all: visible,\n }\n body[:owner_id] = owner_id unless owner_id.nil? || owner_id.empty?\n put(url, body)\n end",
"def create\n @group = Group.new(params[:group])\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to(view_group_path(@group.label), :notice => 'Group was successfully created.') }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_group(groupname)\n current_path = '/api/v1/groups'\n payload = { 'group_name' => groupname }.to_json\n @conn.post(current_path, payload)\n end",
"def create_contact_group(project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'POST'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/groups'\n\t\targs[:query]['Action'] = 'CreateContactGroup'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :contact_group\n\t\t\targs[:body]['ContactGroup'] = optional[:contact_group]\n\t\tend\n\t\tself.run(args)\n\tend",
"def create(name, type)\n configure [\"aaa group server #{type} #{name}\", 'exit']\n end",
"def create_group(name, options={})\n body = {:name => name}.merge(options)\n post(\"/groups\", :body => body)\n end",
"def group(name, &blk)\n add_child(:groups, Hubcap::Group.new(self, name, &blk))\n end",
"def create\n @group = current_user.groups.new(group_params)\n\n if @group.save\n redirect_to groups_path, notice: 'Group was successfully created.'\n else\n flash[:alert] = @group.errors.full_messages.first\n redirect_to new_group_path\n end\n end",
"def create_group(stream, group)\n stream = stream_name(stream)\n connection.xgroup(:create, stream, \"#{stream}-#{group}\", '$',\n mkstream: true)\n end"
] | [
"0.7312992",
"0.71745986",
"0.7171816",
"0.71717054",
"0.68589145",
"0.6715112",
"0.67105293",
"0.6695985",
"0.66653776",
"0.6654163",
"0.6646319",
"0.6634482",
"0.6634482",
"0.65802175",
"0.65463996",
"0.65081716",
"0.6499611",
"0.6476722",
"0.6431991",
"0.6427271",
"0.6399651",
"0.6360047",
"0.6351753",
"0.634929",
"0.63402677",
"0.6314387",
"0.6299974",
"0.62590575",
"0.62578136",
"0.62469465",
"0.6232408",
"0.6222182",
"0.6216419",
"0.621333",
"0.621333",
"0.619215",
"0.61643213",
"0.6146213",
"0.61459106",
"0.6145159",
"0.61448336",
"0.6143356",
"0.61424565",
"0.6127307",
"0.60929716",
"0.60853446",
"0.6077316",
"0.60756314",
"0.6061604",
"0.6053217",
"0.6053217",
"0.6053217",
"0.6053217",
"0.6053217",
"0.6052808",
"0.6048818",
"0.60420036",
"0.6037723",
"0.60276794",
"0.60274726",
"0.6011058",
"0.5990191",
"0.598922",
"0.5985225",
"0.59832275",
"0.59831893",
"0.59750795",
"0.5975002",
"0.59719366",
"0.5969988",
"0.596328",
"0.59601146",
"0.5958726",
"0.5957969",
"0.5955756",
"0.59466994",
"0.594426",
"0.59396607",
"0.58946943",
"0.5891681",
"0.58905494",
"0.5887559",
"0.58873624",
"0.58850336",
"0.58839536",
"0.5879376",
"0.58773977",
"0.5870753",
"0.5869859",
"0.5862122",
"0.58588606",
"0.58551246",
"0.58536357",
"0.58492684",
"0.5841111",
"0.58362013",
"0.5833056",
"0.58184737",
"0.58175933",
"0.58167094"
] | 0.7506082 | 0 |
Deletes a Device Group | def destroy
start = Time.now
debug("Deleting device group: \"#{resource[:full_path]}\"")
connection = self.class.get_connection(resource[:account])
device_group = get_device_group(connection, resource[:full_path], 'id')
if device_group
delete_device_group = rest(connection,
Puppet::Provider::Logicmonitor::DEVICE_GROUP_ENDPOINT % device_group['id'],
Puppet::Provider::Logicmonitor::HTTP_DELETE)
valid_api_response?(delete_device_group) ? nil : alert(delete_device_group)
end
debug "Finished in #{(Time.now-start)*1000.0} ms"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_group(group)\n\t\t\tend",
"def delete_group(group)\n\t\t\tend",
"def delete_group\r\n if request.post?\r\n @group=Group.find_by_id(params[:id], :conditions=>['account_id = ?',session[:account_id]])\r\n if @group.nil?\r\n flash[:error] = \"Invalid action.\"\r\n else\r\n flash[:success]= \"Group \" + @group.name + \" was deleted successfully \"\r\n @group.destroy\r\n @group_devices = Device.find(:all, :conditions=>['group_id=?',@group.id])\r\n for device in @group_devices\r\n device.icon_id =\"1\"\r\n device.group_id = nil\r\n device.save\r\n end\r\n end\r\n end\r\n redirect_to :action=>\"groups\"\r\n end",
"def delete_group(uuid)\n Uploadcare::Group.delete(uuid)\n end",
"def delete_group(group)\n\t\t\t\tgroupname = nil\n\t\t\t\tif(group.respond_to(:groupname))\n\t\t\t\t\tgroupname = group.groupname\n\t\t\t\telse\n\t\t\t\t\tgroupname = group\n\t\t\t\tend\n\n\t\t\t\t`pw groupdel #{groupname}`\n\t\t\tend",
"def delete_group(id)\n delete(\"groups/#{id}\")\n end",
"def delete_group(group_id)\n\t\tself.group_list.delete(group_id)\n\t\tself.update_attribute(:group_list, self.group_list)\n\tend",
"def delete_group(group_id)\n @api.delete(\"#{@api.path}/List/#{@id}/Group/#{group_id}\")\n end",
"def remove_group(group)\n self.groups.destroy group \n end",
"def remove_group\n group = current_account.groups.of_devices.find(params[:group_id])\n\n group.devices.delete(current_account.devices.find(params[:apply_ids].split(\",\")))\n\n redirect_to devices_path\n end",
"def delete_group(group_id)\n current_path = \"/api/v1/groups/#{group_id}\"\n @conn.delete(current_path)\n end",
"def DeleteGroup id\n \n APICall(path: \"groups/#{id}.json\",method: 'DELETE')\n \n end",
"def deleteGroup( group_id)\n params = Hash.new\n params['group_id'] = group_id\n return doCurl(\"delete\",\"/group\",params)\n end",
"def group_delete(attribs, dir_info)\n attribs = group_record_name_alternatives(attribs)\n\n check_critical_attribute( attribs, :record_name )\n\n command = {action: 'delete', scope: 'Groups', attribute: nil, value: nil}\n user_attrs = attribs.merge(command)\n\n dscl( user_attrs, dir_info )\n end",
"def destroy_google_group\n result = Gandalf::GoogleApiClient.delete_google_group(self.apps_id)\n result.data\n end",
"def delete_group(client, options)\n if options[:directory].nil? or options[:group].nil?\n puts \"Missing arguments\"\n return\n end\n\n groups = client.groups\n group = groups.get options[:group]\n group.delete\n puts \"Group deleted.\"\n return\nend",
"def destroy\n @group.destroy\n msg = [\"Destroyed group.\", rebuild_configs].join(\" \")\n redirect_to groups_url, notice: msg\n end",
"def delete_resource_group(group_name)\n cmdline = Schott::AzureCLI::Commandlines.delete_resource_group(group_name)\n sh(cmdline)\n end",
"def destroy\n Group.delete_groups_and_acls([id])\n end",
"def delete_group \n Group.destroy(params[:id])\n\n respond_to do |format|\n format.html {redirect_to dashboard_path}\n end\n end",
"def destroy\n @group = GROUP.first_or_get(params[:id])\n @group.current_user = current_user\n @group.destroy if @group\n\n respond_to do |format|\n flash[:notice] = 'Group was successfully deleted.'\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def delete_contact_group(group_name, project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'DELETE'\n\t\targs[:path]['GroupName'] = group_name\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/groups/[GroupName]'\n\t\targs[:query]['Action'] = 'DeleteContactGroup'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tself.run(args)\n\tend",
"def destroy\n begin\n @user_group.destroy!\n rescue => e\n flash['error'] = \"#{e}\"\n else\n toast!(title: \"User group deleted\",\n message: \"The user group \\\"#{@user_group.name}\\\" has been deleted.\")\n ensure\n redirect_to user_groups_path\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n redirect_to groups_path\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n redirect_to groups_path\n end",
"def delete_group\n @mailing_list_group.destroy if @ok\n render 'update_list'\n end",
"def delete(group)\n url = build_url(group)\n response = rest_delete(url)\n response.return!\n end",
"def delete_group group, &block\n\t\t\traise \"No group was given to delete\" if group.nil?\n\t\t\traise \"Group must be a NLHue::Group object\" unless group.is_a?(Group)\n\t\t\traise \"Group is not from this bridge\" unless group.bridge == self\n\t\t\traise \"Cannot delete group 0\" if group.id == 0\n\n\t\t\tdelete_api \"/groups/#{group.id}\", :lights do |response|\n\t\t\t\tstatus, result = check_json response\n\n\t\t\t\tif status\n\t\t\t\t\[email protected] group.id\n\t\t\t\tend\n\n\t\t\t\tyield status, result if block_given?\n\n\t\t\t\tif status\n\t\t\t\t\tBridge.notify_bridge_callbacks self, true\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def delete(group_id)\n if expired?(@begin_time)\n @auth = get_auth(@api_key)\n end\n Log.debug(\"#{@base_url}#{@get_post_delete_url}#{group_id}\")\n user_group = RestClient.delete \"#{@base_url}#{@get_post_delete_url}#{group_id}\", header\n end",
"def delete_group(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DeleteGroup'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :group_name\n\t\t\targs[:query]['GroupName'] = optional[:group_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def destroy #:nodoc:\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n # format.xml { head :ok }\n end\n end",
"def delete_app_group(group,app)\n\t\t\tresults = submit_cmd('delete app group',:db,\" -env #{self.env} -domain #{self.domain} -plant #{self.plant} -group #{group} -app_instance #{app}\")\n\t\t\tputs results\n\tend",
"def destroy\n Log.create! description: \"<b>#{current_user.email} </b> deleted group <b>#{@group.name} </b> at #{Time.zone.now.strftime '%d-%m-%Y %H:%M:%S'}\", role_id: current_user.roles.ids.first\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def group_destroy(group)\n if(group.persisted?)\n request(\n :path => \"/groups/#{group.id}\",\n :method => :delete,\n :expects => 204\n )\n true\n else\n false\n end\n end",
"def delete(name)\n return unless resource_group?(name)\n\n info \"deleting the resource group: #{name}\"\n @client.resource_groups.delete(name, name)\n end",
"def perform_destroy\n api.group_destroy(self)\n end",
"def delete_group_label(group, name)\n delete(\"/groups/#{url_encode group}/labels/#{name}\")\n end",
"def delete(task_group)\n @data.delete(task_group)\n end",
"def deleteEntityGroup( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/group\",params)\n end",
"def destroy\n @client.resource_groups.delete(@resource_group)\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n head :no_content\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_groups_url) }\n format.xml { head :ok }\n end\n end",
"def deleteGroup _args\n \"deleteGroup _args;\" \n end",
"def remove_group(id)\n delete(\"/groups/#{id}\")\n end",
"def remove_from_group(group)\n self.memberships.find_by(group_id: group.id).destroy!\n end",
"def destroy\n @group = Group.find(params[:group_id])\n authorize! :edit, @group\n Hydra::LDAP.remove_users_from_group(@group.code, [params[:id]])\n redirect_to edit_group_path(@group), :notice=>\"Removed member #{params[:id]}\"\n end",
"def delete(group)\n @queue[group.depth].delete(group)\n end",
"def destroy\n return access_denied unless is_admin?(current_user)\n\n @group = Group.find(params[:id])\n @group.destroy\n redirect_to(groups_url)\n end",
"def remove_group\n create_group.tap do |r|\n r.action(:remove)\n end\n end",
"def destroy\n begin\n group = Group.find(params[:id])\n group.destroy\n render json: { \"notice\"=>\"group deleted successfully\" }\n rescue ActiveRecord::RecordNotFound\n render json: { \"alert\"=>\"did not specify a valid id. no record deleted.\" }\n end\n end",
"def delete_group\n\t\t@group = Cardsort.find(params[:cardsort_id]).groups.find(params[:group_id]);\n\t\[email protected]\n\t\trespond_to do |format|\n\t\t\tformat.js { render \"delete_group\"}\n\t\tend\n\tend",
"def delete_customer_group(group_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers/groups/{group_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'group_id' => { 'value' => group_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.delete(\n _query_url,\n headers: _headers\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",
"def destroy\n @group.destroy\n redirect_to groups_url, notice: \"Group was successfully destroyed.\" \n end",
"def delete_address_group(id)\n delete(\"addressGroups/#{id}\")\n end",
"def destroy\n\n\t\t@group = Group.find(params[:id])\n\t\[email protected]\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(groups_url) }\n\t\t\tformat.xml { head :ok }\n\t\tend\n\tend",
"def destroy\n @field_group = FieldGroup.find(params[:id])\n @field_group.destroy\n\n respond_with(@field_group)\n end",
"def destroy\n @group = Group.find_by_guid(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def remove_group(group)\r\n\t\tsend('RMG', group.info[:guid])\r\n\t\t## XXX save changes locally?\r\n\t\treturn 1\r\n\tend",
"def delete_location_group(project_id, location_group_id)\n delete \"projects/#{project_id}/group/location/#{location_group_id}\"\n end",
"def destroy\n @group.destroy\n\n head :no_content\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete_group(stream, group)\n stream = stream_name(stream)\n connection.xgroup(:destroy, stream, \"#{stream}-#{group}\")\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n flash[:success] = \"Группа успешно удалена.\"\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def test_delete\n g = [22058]\n Group.delete(g)\n end",
"def remove_group(name)\n visit 'groups'\n click_link name\n\n page.accept_alert do\n click_button 'group_delete'\n end\n end",
"def delete_order_item_group(id)\n @client.raw('delete', \"/ecommerce/order-items-groups/#{id}\")\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n flash[:success] = \"Group successfully deleted\"\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def delete_security_group( options = {} )\n options = { :group_name => \"\" }.merge(options)\n raise ArgumentError, \"No :group_name provided\" if options[:group_name].nil? || options[:group_name].empty?\n params = { \"GroupName\" => options[:group_name] }\n return response_generator(:action => \"DeleteSecurityGroup\", :params => params)\n end",
"def delete(data)\n result = @client.api_request(:method => \"usergroup.delete\", :params => data)\n result ? result['usrgrpids'][0].to_i : nil\n end",
"def destroy\n @group = @course.groups.find(params[:id])\n @group.destroy\n respond_to do |format|\n format.html { redirect_to groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to admin_groups_url, notice: t('activerecord.models.group') +'删除成功!' }\n format.json { head :no_content }\n end\n end",
"def delete_order_item_group(id)\r\n @client.raw('delete', \"/ecommerce/order-items-groups/#{id}\", nil, nil, @contact_v1_url)\r\n end",
"def delete(key)\n key = to_key key\n @group.delete key if @group.key? key\n end",
"def destroy\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n group = Group.find(params[:id])\n group.destroy\n render json: {}\n end",
"def destroy\n\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n end\n end",
"def delete_group(group_oid, opts = {})\n delete_group_with_http_info(group_oid, opts)\n nil\n end",
"def delete_venuegroup(group_id)\n response = connection.post do |req|\n req.url \"venuegroups/#{group_id}/delete\"\n end\n return_error_or_body(response, response.body.response)\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n \n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @group.destroy\n render_json_message({:success => t('.success')}, 200)\n else\n render_json_message({:errors => @group.errors.messages}, 422)\n end\n end",
"def destroy\n @mem_group.destroy\n respond_to do |format|\n format.html { redirect_to admin_mem_groups_url, notice: '会员分组成功删除.' }\n format.json { head :no_content }\n end\n end",
"def del(id, which=:groups)\n resp = self.class.delete(\"/#{which}/#{id}\")\n check_errors resp\n end",
"def destroy\n @tqrdc_group.destroy\n respond_to do |format|\n format.html { redirect_to tqrdc_groups_url, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to groups_url }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end",
"def deletesecuritygroup\n if not checkRequirements([\"thezone\",\"thefirewall\"])\n return false\n end\n checkToken(@thezone)\n submit = queryGCE(:path => '/compute/v1beta15/projects/#{@thezone.name}/global/firewalls/#{@thefirewall.serial}', :method => 'delete', :options => '', :acces_token => @thezone.token )\n checkQuery(:type => 'global', :token => @thezone.token, :projectname => @thezone.name, :operationname => submit[\"name\"])\n end",
"def delete_query_group(project_id, query_group_id)\n delete \"projects/#{project_id}/querygroups/#{query_group_id}\"\n end",
"def destroy\n @current_user_group = UserGroup.find_by(id: current_user.id)\n @user_group = UserGroup.find_by(id: params[:id])\n if @user_group.user_id == current_user || (current_user.admin == true && @current_user_group.group_id == @user_group.group_id)\n @user_group.destroy\n render json: {message: \"this user group has been successfully deleted\"}\n else\n render json: {:errors => @user_group.errors.full_messages}, Status: :Unauthorized\n end\n end",
"def destroy\n @group.destroy\n audit(@group, \"destroy\", @group.name )\n respond_to do |format|\n format.html { redirect_to groups_path, notice: 'Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_group = UserGroup.find_by_id(params[:id])\n @user_group.destroy\n render :json=>{:status =>t('users.destroy.success')}\n end",
"def remove_group_from_customer(customer_id:,\n group_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::DELETE,\n '/v2/customers/{customer_id}/groups/{group_id}',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_id')\n .should_encode(true))\n .template_param(new_parameter(group_id, key: 'group_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def destroy\n @group = Group.find(params[:id])\n # Only administrators can permanently delete groups.\n # Fail gracefully if the user is not allowed.\n if !current_user or !current_user.is_admin\n respond_to do |format|\n format.html { redirect_to(@group, :notice => \"You don't have permission to do that.\") }\n format.xml { render :status => :unprocessable_entity }\n end\n return\n end\n if [email protected]?\n respond_to do |format|\n format.html { redirect_to(@group, :notice => \"You can't delete a group that owns projects.\") }\n format.xml { render :status => :unprocessable_entity }\n end\n return\n end\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end"
] | [
"0.7975324",
"0.7975324",
"0.7948557",
"0.7874789",
"0.7735191",
"0.7672911",
"0.76039845",
"0.75678635",
"0.74709594",
"0.7425904",
"0.74128747",
"0.7407958",
"0.7405626",
"0.73350495",
"0.7309228",
"0.72707385",
"0.7232702",
"0.72187245",
"0.7177549",
"0.7137803",
"0.71319276",
"0.71298695",
"0.7102315",
"0.71018165",
"0.71018165",
"0.70999545",
"0.7090006",
"0.70710075",
"0.70626014",
"0.70601934",
"0.70495206",
"0.7027727",
"0.70231587",
"0.70159304",
"0.70131606",
"0.69934803",
"0.6986648",
"0.6980496",
"0.6967521",
"0.6952871",
"0.6945129",
"0.6922278",
"0.69182616",
"0.6901561",
"0.6887263",
"0.68828845",
"0.68823963",
"0.68718064",
"0.6871487",
"0.6869154",
"0.68655473",
"0.68601793",
"0.68387777",
"0.681075",
"0.681043",
"0.68005836",
"0.6794796",
"0.67836493",
"0.678325",
"0.67644626",
"0.6756828",
"0.6739957",
"0.67318624",
"0.67304605",
"0.67059636",
"0.66930336",
"0.66902304",
"0.668824",
"0.66799074",
"0.66791266",
"0.6661873",
"0.66492075",
"0.6643232",
"0.6639372",
"0.6626624",
"0.66262525",
"0.66262525",
"0.6622956",
"0.6622956",
"0.662235",
"0.6620171",
"0.66187793",
"0.66183317",
"0.66183317",
"0.66183317",
"0.66183317",
"0.66183317",
"0.66183317",
"0.6617415",
"0.6590535",
"0.65892565",
"0.657901",
"0.6576439",
"0.657617",
"0.65756387",
"0.65711755",
"0.6566172",
"0.65649277",
"0.6548886",
"0.65414786"
] | 0.81273687 | 0 |
Verifies the existence of a device group | def exists?
start = Time.now
debug "Checking if device group \"#{resource[:full_path]}\" exists"
connection = self.class.get_connection(resource[:account])
if resource[:full_path].eql?('/')
true
else
device_group = get_device_group(connection, resource[:full_path])
debug device_group unless nil_or_empty?(device_group)
debug "Finished in #{(Time.now-start)*1000.0} ms"
nil_or_empty?(device_group) ? false : true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_exists?(group)\n Sys::Admin.get_group(group)\n true\n rescue\n false\n end",
"def has_group?(name)\n run(\"id -g #{name}\").success?\n end",
"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",
"def sec_group_exists(groups)\n groups.each do |group|\n begin\n puts \"Verifying #{group} exists...\"\n group = Tapjoy::AutoscalingBootstrap::AWS::EC2.describe_security_groups(group)\n rescue Aws::EC2::Errors::InvalidGroupNotFound => err\n STDERR.puts \"Warning: #{err}\"\n puts \"Creating #{group} for #{Tapjoy::AutoscalingBootstrap.scaler_name}\"\n Tapjoy::AutoscalingBootstrap::AWS::EC2.create_security_group(group)\n end\n end\n end",
"def sec_group_exists(groups)\n groups.each do |group|\n begin\n puts \"Verifying #{group} exists...\"\n group = Tapjoy::AutoscalingBootstrap::AWS::EC2.describe_security_groups(group)\n rescue Aws::EC2::Errors::InvalidGroupNotFound => err\n STDERR.puts \"Warning: #{err}\"\n puts \"Creating #{group} for #{Tapjoy::AutoscalingBootstrap.scaler_name}\"\n Tapjoy::AutoscalingBootstrap::AWS::EC2.create_security_group(group)\n end\n end\n end",
"def group_valid?(name, resource)\n self.class.groups.rindex{|g| g.name == name} != nil\n end",
"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",
"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",
"def ce_group_valid?\n return false unless self.group_id\n self.refresh_access_token!\n\n @oauth_access_token.get(\n \"https://www.google.com/m8/feeds/groups/default/full/#{self.group_id}\",\n {\n headers: {\n 'Content-type' => 'application/atom+xml',\n 'GData-Version' => '3.0'\n }\n }\n )\n\n true # group is valid\n rescue OAuth2::Error\n false # group is invalid\n end",
"def valid_group? host_code, group_code\n return unless group_code\n host_data = find_host host_code\n return unless host_data\n\n host_data[:groups].include? group_code\nend",
"def has_group?\n @group == ''\n end",
"def check_group_exists\n if (Group.where(group_params).count != 0)\n redirect_to Group.where(group_params).first\n end\n end",
"def check_availability!(device, group, mode: nil)\n sync do\n ([group] + group.parents.reverse).each do |grp|\n dev = grp.devices.detect { |v| v == device }\n raise DeviceNotAvailable.new(device, grp) unless dev\n\n unless dev.mode.compatible?(mode || device.mode)\n raise DeviceModeInsufficient.new(device, grp, dev.mode)\n end\n end\n end\n end",
"def valid_group?\n unless self.target_group.nil?\n if self.target_group.is_a? String\n !!(self.target_group == self.group)\n else\n !!(self.target_group == self.group(:id))\n end\n else\n # The group is OK if it wasn't specified\n return true\n end\n rescue ArgumentError => ex\n # The group is NOT OK if the group doesn't exist\n WarningShot::PermissionResolver.logger.error(\"Group [#{self.target_group}] does not exist: #{ex.message}\")\n return false\n end",
"def resource_group_exists?(group_name, system_config)\n cmdline = Schott::AzureCLI::Commandlines.resource_group_exists?(group_name)\n cmd = run_command(\"#{group_name} exists\", cmdline, system_config)\n return cmd.output.chomp == \"true\"\n end",
"def group_munge?(group, resource)\n # Check if the group is the primary group for the user\n user = resource.catalog.resources.select{|r| r.type == :user && r.name == resource[:name]}.first\n user = self.class.users.select{|u| u.name == resource[:name]}.first if user.nil?\n \n if !user.nil?\n gid = user[:gid]\n if gid.is_a?(String)\n primary = gid\n return true if primary == group\n elsif gid.is_a?(Integer)\n primary = resource.catalog.resources.select{|r| r.type == :group && r[:gid] == gid}.first\n primary = self.class.groups.select{|g| g.gid == gid}.first if primary.nil?\n return true if !primary.nil? && primary.name == group\n end\n end\n \n # Check if the group exists on the system\n if resource.catalog.resource(:group, group) != nil && resource.catalog.resource(:group, group)[:ensure] == :present\n return false\n else\n # Check if the group exists on the system\n return !group_valid?(group, resource)\n end\n end",
"def has_group?\n\t\t@group == ''\n\tend",
"def exists?(group)\n url = build_url(group)\n rest_head(url) and true\n rescue Azure::Armrest::NotFoundException\n false\n end",
"def validate_unique_kit_per_group\n if self.class.exists?(:kit_id => kit_id, :group_id => group_id)\n errors.add :kit, 'already exists in this group'\n end\n end",
"def group_exists?(name)\n @project.groups.where(name: name).count > 0\n end",
"def group?(group)\n\t\t\tend",
"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",
"def group_exists?(stream, group)\n stream = stream_name(stream)\n info = connection.xinfo(:groups, stream.to_s)\n info.any? { |line| line['name'] == \"#{stream}-#{group}\" }\n rescue Redis::CommandError => e\n logger.info \"Seems the group doesn't exist\"\n logger.info e.message\n logger.info e.backtrace.join(\"\\n\")\n false\n end",
"def may_create_group_membership?(group)\n\t\t\t!is_group_member?(group)\n\t\tend",
"def test_should_require_name_group\n group = create(:name => nil)\n assert group.errors.invalid?(:name), \":name should be required\"\n assert_invalid group, \"group shouldn't be created\"\n end",
"def autoscaling_group_exists?\n Tapjoy::AutoscalingBootstrap::AWS::Autoscaling::Group.describe.nil? ? false : true\n end",
"def group?(group)\n\t\t\t\treturn(infile(group, '/etc/group'))\n\t\t\tend",
"def in_group?(group)\n @groups.include? group\n end",
"def has_group?(group)\n\t\t# TODO: remove return true\n\t\treturn true\n\t\t# return FsLdap::groups_of_loginname(self.loginname).include? group\n\tend",
"def may_destroy_group?(group)\n\t\t\tmay_administrate?\n\t\tend",
"def exists?\n !group_info.entries.empty?\n end",
"def defined?(group_name)\n @groups.key?(group_name)\n end",
"def has_group?(q_group_name)\n contact_groups.find_by_group_name(q_group_name)\n end",
"def verify_existence_of_gforge_file_directory!\n FileUtils.mkdir_p group_file_directory unless File.exists? group_file_directory\n end",
"def defined?(group_name)\n true\n end",
"def has_group?(group)\n\t\tFsLdap.groups_of_loginname(self.loginname).include?(group)\n\tend",
"def exists?(name)\n begin\n g = list([name.to_s])\n rescue ::AWS::InvalidGroupNotFound\n return false \n end\n \n !g.empty?\n end",
"def check_portgroup_existance\n Puppet.debug \"Entering find_port_group\"\n begin\n @networksystem=host.configManager.networkSystem\n @pg = @networksystem.networkInfo.portgroup\n\n @pg.each do |portg|\n availablepgs = portg.spec.name\n if (availablepgs == resource[:portgrp])\n return true\n end\n end\n #return false if portgroup not found\n return false\n rescue Exception => e\n fail \"Unable to check the portgroup's existence because the folowing exception occurred: -\\n #{e.message}\"\n end\n end",
"def group?(name)\n eval(GROUP_CHECK, binding, __FILE__, GROUP_CHECK_LINE)\n nil\nend",
"def in_group?(group_id)\n groups.any? do |group|\n group.id == group_id\n end\n end",
"def group_required\n required_group = Group.find_or_create_by(:name => \"Admin\")\n unless current_user.groups.is_member?(required_group)\n flash[:error] = \"The function you wish to use is only available to admin users\"\n redirect_to root_path\n end\n end",
"def group_absent(name, &block)\n execute(\"if dscl . -list /Groups/#{name}; then dscl . -delete /Groups/#{name}; fi\", {}, &block)\n end",
"def check_all_available!(group: nil)\n sync do\n devices.each { |dev| check_availability!(dev, parent: group || ct.group) }\n end\n end",
"def check_all_available!(group: nil)\n sync do\n devices.each { |dev| check_availability!(dev, parent: group || ct.group) }\n end\n end",
"def test_should_require_group_id\n player = create(:group_id => nil)\n assert player.errors.invalid?(:group_id), \":groups_id should be required\"\n assert_invalid player, \"player shouldn't be created\"\n end",
"def validate_group_name\n group_name_param = params[:group_name]\n if group_name_is_unique?(group_name_param)\n render json: { valid_group_name: true }, status: :ok\n else\n render json: { valid_group_name: false,\n message: \"A Space named \\\"#{group_name_param}\\\" already exists\"\n },\n status: :ok\n end\n end",
"def creator_in_group?\n return unless errors.blank?\n if !group.users.include?(user)\n errors.add(:user, user.username + \" isn't in the group\")\n end\n end",
"def test_group\n \n user = @user_1\n group = 'customer-test'\n \n assert (not @crowd.group_member? user.name, group), \"#{user.name} is already a member of group #{group}\"\n\n @crowd.add_user_to_group user.name, group \n assert (@crowd.group_member? user.name, group) \n\n groups = @crowd.find_group_memberships user.name\n assert (groups.length > 0)\n assert (groups.include? group)\n\n @crowd.remove_user_from_group user.name, group \n assert (not @crowd.group_member? user.name, group)\n\n groups_after_remove = @crowd.find_group_memberships user.name\n\n # ensure the user in one less group \n assert_equal groups.length - 1, groups_after_remove.length\n \n end",
"def test_no_duplicate_node_groups\n ng1 = node_groups(:one)\n ng2 = NodeGroup.create(:name => ng1.name)\n assert ng2.errors.on(:name)\n end",
"def validate_associations\n errors.add(:group_id, :doesnt_exist) if @group.nil?\n end",
"def delete\n begin\n @grouper_group_type.delete GrouperSession.startRootSession # XXX How to handle sessions?\n return true\n rescue Exception => e\n @error = e\n end\n false\n end",
"def test_ownprovidergroups\n groupnames.each { |group|\n gobj = nil\n comp = nil\n fakeresource = fakeresource(:group, group)\n assert_nothing_raised {\n gobj = @provider.new(fakeresource)\n }\n\n assert(gobj.gid, \"Failed to retrieve gid\")\n }\n end",
"def ensure_user_group\n if new_resource.gid.is_a?(String)\n group_name = new_resource.gid\n Etc.getgrnam(new_resource.gid).gid\n else\n group_name = new_resource.username\n Etc.getgrgid(new_resource.gid).gid\n end\nrescue ArgumentError\n Chef::Log.info(\n \"user_account[#{new_resource.username}] creating group #{group_name}\")\n group group_name do\n gid new_resource.gid if new_resource.gid.is_a?(Integer)\n end.run_action(:create)\n Etc.getgrnam(group_name).gid\nend",
"def refresh_ce_group\n return false if ce_group_valid?\n\n group_id = existing_ce_group || add_ce_group\n return false unless group_id\n\n write_attribute :group_id, group_id\n true\n end",
"def groups_valid?\r\n begin\r\n response_groups = []\r\n authorized_groups = settings.groups\r\n raise SA1009Exception if authorized_groups.blank?\r\n attribute_element = REXML::XPath.first(document,\"/p:Response/a:Assertion/a:AttributeStatement/a:Attribute\", { \"p\" => PROTOCOL, \"a\" => ASSERTION })\r\n REXML::XPath.each(attribute_element, \"a:AttributeValue\", { \"a\" => ASSERTION }) do | attribute |\r\n response_groups << attribute.text\r\n end\r\n for group in authorized_groups\r\n raise SA1009Exception unless response_groups.include?(group)\r\n end\r\n rescue SA1009Exception => exp\r\n Rails.logger.error \"#{exp.class} - #{exp.message}\"\r\n return false\r\n else\r\n return true\r\n end\r\n end",
"def creates_user_group?(user)\n !(platform_family?('suse', 'mac_os_x') || user[:no_user_group])\n end",
"def require_request_group\n group = Group.find(params[:group])\n raise ActiveRecord::RecordNotFound unless group\n @request_group = group\n rescue LdapMixin::LdapException\n raise ActiveRecord::RecordNotFound\n end",
"def member_of?(group)\n cn_groups.include?(group)\n end",
"def group?(name)\n name = name.to_s\n @groups.find{ |g| g.name == name } || false\n end",
"def test_missing_service_group_ignored\n # Not raise\n service_list = @service_store.determine_services %w{non_existing_group}\n end",
"def ListView_HasGroup(hwnd, dwGroupId) send_listview_message(hwnd, :HASGROUP, wparam: dwGroupId) end",
"def check_command_group\n if clientdata?\n response_bad_sequence\n end\n end",
"def may_create_groups?\n\t\t\tmay_administrate?\n\t\tend",
"def check_all_available!(group = nil)\n sync do\n devices.each { |dev| check_availability!(dev, group || ct.group) }\n end\n end",
"def valid_auth_group_joined_created\n @group = Group.find_by_id(params[:id])\n if @group\n @joined = @group.users.include?(@user)\n @created = @group.creator == @user\n else\n flash[:warning] = \"Not Exist Group\"\n redirect_to :action => \"index\"\n end\n end",
"def create\n start = Time.now\n debug \"Creating device group: \\\"#{resource[:full_path]}\\\"\"\n connection = self.class.get_connection(resource[:account])\n recursive_group_create(connection,\n resource[:full_path],\n resource[:description],\n resource[:properties],\n resource[:disable_alerting])\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n end",
"def test_should_require_name\n ng = NodeGroup.create(:name => nil)\n assert ng.errors.on(:name)\n end",
"def in_group?(group_or_id)\n group_ids.include?(Ecircle::User.group_id(group_or_id))\n end",
"def create_group(group_name,group_uuid,classes = {},rule_term,parent_group)\n load_classifier\n groups = @classifier.groups\n @classifier.update_classes.update\n current_group = groups.get_groups.select { |group| group['name'] == group_name}\n if current_group.empty?\n cputs \"Creating #{group_name} group in classifier\"\n groups.create_group({\n 'name' => group_name,\n 'id' => group_uuid,\n 'classes' => classes,\n 'parent' => groups.get_group_id(\"#{parent_group}\"),\n 'rule' => rule_term\n })\n else\n cputs \"NODE GROUP #{group_name} ALREADY EXISTS!!! Skipping\"\n end\nend",
"def verify_appgroups(appgroups, zone_name)\n b_verify_ok = true\n\n appgroups.each do |appgroup_name, appgroup_data|\n $log.debug(\"Verifying appgroup \\'#{appgroup_name}\\'\")\n\n if @handler.handle_appgroup(zone_name, appgroup_name,\n appgroup_data, @project.target_dir) == false\n appgroup_data.store :status, :failed\n b_verify_ok = false\n mark(\"Appgroup \\'#{appgroup_name}\\' does not run correctly.\",\n :appgroup, appgroup_name, appgroup_data)\n else\n appgroup_data.store :status, :ok\n end\n\n next unless b_verify_ok\n\n zone_networks = objects_in_zone('networks', zone_name)\n if @handler.handle_network_attachments(zone_name, zone_networks,\n appgroup_name, appgroup_data,\n @project.target_dir) == false\n appgroup_data.store :status, :failed\n b_verify_ok = false\n mark(\"Appgroup \\'#{appgroup_name}\\' has missing network attachments\",\n :appgroup, appgroup_name, appgroup_data)\n else\n appgroup_data.store :status, :ok\n end\n end\n b_verify_ok\n end",
"def group?\n true\n end",
"def client_in_group\n @group = @user.groups.find_by_id(params[:gid])\n render errors_msg(\"User Not In Group\", 404) and return \\\n unless @group\n end",
"def ensure_not_referenced_by_any_group\n if users.empty?\n return true\n else\n errors.add(:base, 'users present')\n return false\n end\n end",
"def resource_group?(name)\n resource_groups.map(&:name).include?(name)\n end",
"def destroy\n start = Time.now\n debug(\"Deleting device group: \\\"#{resource[:full_path]}\\\"\")\n connection = self.class.get_connection(resource[:account])\n device_group = get_device_group(connection, resource[:full_path], 'id')\n if device_group\n delete_device_group = rest(connection,\n Puppet::Provider::Logicmonitor::DEVICE_GROUP_ENDPOINT % device_group['id'],\n Puppet::Provider::Logicmonitor::HTTP_DELETE)\n valid_api_response?(delete_device_group) ? nil : alert(delete_device_group)\n end\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n end",
"def group? group\n group_name = group.respond_to?(:name) ? group.name : group\n self.groups.map(&:name).include?(group_name.to_s)\n end",
"def destroy\n @group = Group.find(params[:id])\n if @group.users.length>0\n # format.html { redirect_to @group, notice: 'Group can not be deleted.' }\n render json: \"Group already contains users\", status: 412 \n else\n if @group.destroy\n # format.html { redirect_to groups_url }\n render 'show'\n else\n render json: \"Error\", status: 422 \n end\n end\n end",
"def test_fixture_node_group\n ng = node_groups(:one)\n assert ng.valid?\n end",
"def test_check_in_group_to_room()\n @room.check_in(@group2)\n assert_equal(1, @room.karaoke_room_occupied())\n end",
"def create_group\n group new_resource.group do\n gid new_resource.gid\n system true\n end\n end",
"def user_group_exists?(user_group_symbol)\n return true if user_group_symbol == Lockdown.administrator_group_symbol\n get_user_groups.include?(user_group_symbol)\n end",
"def verify_groups(test_data)\n test_groups = test_data[Org::GROUPS.name]\n errors = []\n test_groups = [{ Org::GROUP.name => ''}] unless test_groups\n test_groups.each_with_index do |test_grp, index|\n text_values_match?(test_grp[Org::GROUP.name], element_value(group_input(index)), errors)\n end\n errors\n end",
"def create\n @group = Group.new(params[:group])\n @group.owner = current_user\n\n group_name_exists = false\n current_user.owned_groups.each do |g|\n if g.name == @group.name\n group_name_exists = true\n break\n end\n end\n \n respond_to do |format|\n if group_name_exists\n format.html { redirect_to groups_path, :alert => \"You already have a list by the name '#{@group.name}'.\" }\n format.json { render :json => @group, :status => :created, :location => @group }\n elsif @group.save\n format.html { redirect_to @group, :notice => 'Group was successfully created.' }\n format.json { render :json => @group, :status => :created, :location => @group }\n else\n error_msg = 'Unexpected error while creating group.'\n if @group.errors.messages.count > 0\n error_msg = 'Following error(s) prevented the group from being saved: '\n multiple = false\n @group.errors.full_messages.each do |msg|\n if multiple\n error_msg += ', '\n end\n error_msg += msg\n multiple = true\n end\n end\n format.html { redirect_to groups_path, :action => 'index', :alert => error_msg }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def exists?(group, id, format = DEFAULT_FORMAT)\n File.exists?( file_name(group, id, format) )\n end",
"def group?\n type == :group_id\n end",
"def group?\n type == :group_id\n end",
"def has_group_in_bucket?(bucket_name, group_name)\n has_bucket?(bucket_name) && @buckets[bucket_name.to_sym].has_group?(group_name) rescue false\n end",
"def create_product_group\n ProductGroup.create(:group_id => self.group_id, :product_id => self.product_id)\n return true\n end",
"def in_group_belonging_to?(org_id)\n return true if !guidance_group.nil? && (guidance_group.org.id == org_id)\n\n false\n end",
"def verify_user_group_status\n errors.add(:base, \"This #{payable.the_group_label} has not been set up to receive payments yet. You can ask its leaders to contact LoveRealm concerning this.\") if payable_type == 'UserGroup' && !payable.is_verified?\n end",
"def system_group?\n !self[\"gContact$systemGroup\"].nil?\n end",
"def system_group?\n !self[\"gContact$systemGroup\"].nil?\n end",
"def system_group?\n !self[\"gContact$systemGroup\"].nil?\n end",
"def group?\n proprieties[:group]\n end",
"def group?\n @opts[:group] != DEFAULT_GROUP\n end",
"def has_any_group?(*group_list)\n return :system_admin if system_admin?\n return false if anonymous?\n\n r = group_list.select{|g| effective_groups.include?(g.upcase)}\n\n r.blank? ? false : r\n end",
"def belongs_to_groups?\n self.groups.count > 0\n end",
"def has_group?(name)\n (groupings || []).select{ |grouping| grouping['groups'].include?(name) }.any?\n end",
"def test_should_require_theme_id_group\n group = create(:theme_id => nil)\n assert group.errors.invalid?(:theme_id), \":theme_id should be required\"\n assert_invalid group, \"group shouldn't be created\"\n end",
"def in_group?(user, group)\n users_groups.where(user_id: user.id, group_id: group.id).count.positive?\n end"
] | [
"0.7134076",
"0.696905",
"0.6896247",
"0.681749",
"0.681749",
"0.6798795",
"0.67918974",
"0.67907494",
"0.6728133",
"0.67066514",
"0.663603",
"0.6600482",
"0.6590846",
"0.65790695",
"0.6486889",
"0.647442",
"0.6392958",
"0.6383161",
"0.63727427",
"0.63209254",
"0.6314875",
"0.63083565",
"0.62677395",
"0.6266793",
"0.62479866",
"0.62424266",
"0.6213385",
"0.61990047",
"0.61866504",
"0.6180771",
"0.618034",
"0.615716",
"0.61547",
"0.61433953",
"0.6132019",
"0.6118946",
"0.61140794",
"0.6086593",
"0.6063949",
"0.6062287",
"0.6026528",
"0.59590167",
"0.5953174",
"0.5953174",
"0.59306955",
"0.5903823",
"0.5886971",
"0.58865964",
"0.5884667",
"0.5884442",
"0.5866699",
"0.585221",
"0.5846442",
"0.58426094",
"0.58421195",
"0.5835385",
"0.58311176",
"0.58293843",
"0.58235765",
"0.5818682",
"0.58135235",
"0.5808482",
"0.5794669",
"0.5790533",
"0.57800025",
"0.5771164",
"0.5763898",
"0.57408863",
"0.57230604",
"0.57119113",
"0.57081133",
"0.57052505",
"0.5699338",
"0.5684497",
"0.56844884",
"0.56816405",
"0.567036",
"0.5665356",
"0.5657694",
"0.56555516",
"0.56474566",
"0.56418085",
"0.5638019",
"0.563652",
"0.56303334",
"0.56303334",
"0.56228024",
"0.5615809",
"0.5614916",
"0.5598557",
"0.5595496",
"0.5595496",
"0.5595496",
"0.5587964",
"0.55782056",
"0.55720097",
"0.55615914",
"0.5557679",
"0.55536944",
"0.5550305"
] | 0.70602906 | 1 |
Retrieve Device Group Description | def description
start = Time.now
debug "Checking description for device group: \"#{resource[:full_path]}\""
connection = self.class.get_connection(resource[:account])
device_group = get_device_group(connection, resource[:full_path],'description')
debug "Finished in #{(Time.now-start)*1000.0} ms"
device_group['description']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def description\n [@group.description,@description].join(' ')\n end",
"def option_group_description\n data[:option_group_description]\n end",
"def get_device_group_list\n query_api('device-groups')\n end",
"def full_description(example_group)\n example_group.metadata.fetch(:example_group).fetch(:full_description)\n end",
"def full_description(example_group)\n example_group.metadata.fetch(:full_description)\n end",
"def device_description\n return @device_description\n end",
"def description=(value)\n start = Time.now\n debug \"Updating description on device group: \\\"#{resource[:full_path]}\\\"\"\n connection = self.class.get_connection(resource[:account])\n update_device_group(connection,\n resource[:full_path],\n value,\n resource[:properties],\n resource[:disable_alerting])\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n end",
"def db_security_group_description\n data.db_security_group_description\n end",
"def cloud_desc\n MU::Cloud::AWS.iam(credentials: @config['credentials']).get_group(\n group_name: @mu_name\n )\n end",
"def get_group\n send_request(FUNCTION_GET_GROUP, [], '', 4, 'k4')\n end",
"def get_group_device_list(ent,group,dev_type=nil)\n oci_cmd = :GroupAccessDeviceGetListRequest\n config_hash = GroupAccessDeviceGetListRequest(ent,group,dev_type)\n table_header = 'accessDeviceTable'\n response_hash,cmd_ok = get_table_response(oci_cmd,table_header,config_hash)\n\n return cmd_ok,response_hash\n end",
"def description\n client.describe_auto_scaling_groups(auto_scaling_group_names: [asg_name])&.auto_scaling_groups.first\n end",
"def device_description=(value)\n @device_description = value\n end",
"def group\n @group.name\n end",
"def getGroupObjName\r\n\t\t return \"mfiforce__group__c\"\r\n\t\tend",
"def db_subnet_group_description\n data.db_subnet_group_description\n end",
"def group_get_info(attribs, dir_info)\n attribs = group_record_name_alternatives(attribs)\n\n check_critical_attribute( attribs, :record_name )\n\n command = {action: 'read', scope: 'Groups', value: nil}\n user_attrs = attribs.merge(command)\n\n dscl( user_attrs, dir_info )\n end",
"def get_device_list_for_group(device_group_id)\n path = \"device-groups/#{device_group_id}/devices\"\n query_api(path)\n end",
"def do_list_groups()\n I18n.t(\"sms.some_groups\") + \": \" + Group.primary_group_abbrevs\n end",
"def display_name\n group_name\n end",
"def display_resource(group)\n \"Group ##{group.to_param}\"\n end",
"def view_group(group)\n @uri = URI.parse(\"#{@api_url}/group/#{group}\")\n body = make_get_request\n @doc = Nokogiri::HTML(body)\n {\n title: get_title,\n description: get_description,\n name: get_name,\n regid: get_regid,\n contact: get_contact\n }\n end",
"def group_name\n data[:group_name]\n end",
"def group_name\n @attributes[:group_name]\n end",
"def group_name\n @attributes[:group_name]\n end",
"def getGroup( group_id)\n params = Hash.new\n params['group_id'] = group_id\n return doCurl(\"get\",\"/group\",params)\n end",
"def group_info\n group_id_param = params[:group_id]\n\n if group_id_param.nil? || group_id_param.blank?\n render json: { error: 'group_id not specified.' }, status: :bad_request\n return\n end\n\n group = CanvasSpaces.GroupCategory\n .groups\n .where('groups.id = ?', group_id_param)\n .eager_load(:users)\n .first\n if group.nil?\n render json: { error: 'No such group found.' }, status: :not_found\n else\n maillist = get_maillist_for_space(group.id)\n render json: { id: group.id,\n name: group.name,\n description: group.description,\n maillist: maillist,\n leader_id: group.leader_id,\n created_at: group.created_at,\n join_type: display_join_type(group.join_level),\n size: group.users.count\n },\n status: :ok\n end\n end",
"def get_labels_summary\n response = connection.get(get_labels_summary_url) do |request|\n request.params[:adminDeviceSpaceId] = \"1\"\n end\n if response.success?\n LabelsSummaryResponse.new(response.body)\n end\n end",
"def description\n response_json = @client.api_get_request('', 'tree=description')\n response_json['description']\n end",
"def group; Group.get(self.group_id); end",
"def discover\n data[@group]\n end",
"def sudo_group()\n\t\t\treturn @metadata.attributes[:sudo_group]\n\t\tend",
"def describe(display = :id)\n desc = ['********************']\n desc << \"Group id: #{id}\"\n desc << \"\\nDescription: #{description}\" if description\n desc << \"\\nEndianness: #{endian}\"\n\n unless size == 0\n desc << ''\n desc << 'Pins'\n desc << '-------'\n if display == :id\n desc << map(&:id).join(', ')\n elsif display == :name\n desc << map(&:name).join(', ')\n else\n fail 'Error: Argument options for describe method are :id and :name. Default is :id'\n end\n end\n\n desc << '********************'\n puts desc.join(\"\\n\")\n end",
"def get_attribute_group(id)\n @client.raw('get', \"/config/attribute-groups/#{id}\")\n end",
"def group\n @group\n end",
"def ListView_GetGroupInfo(hwnd, iGroupId, pgrp)\n send_listview_message(hwnd, :GETGROUPINFO, wparam: iGroupId, lparam: pgrp)\n end",
"def print_group(group)\n puts \"Name: \" + group.name\n puts \"Description: \" + (group.description.nil? ? \"None\" : group.description)\n puts \"Status: \" + group.status\n puts \"Href: \" + group.href\nend",
"def description\r\n\t\t\t`#{BITS::BITSADMIN} /getdescription {#{@id}}`\r\n\t\tend",
"def description\n ensure_full_data!\n @gapi[\"description\"]\n end",
"def os_group\n @os_group\n end",
"def get_group_supportedfields()\n @restv9.get_groups_supportedFields()\n end",
"def group\n @group\n end",
"def parse_device_description(dd)\n dd_xml = Nokogiri::XML(dd)\n raise DeviceDescriptionInvalid if dd_xml.nil?\n dd_xml.remove_namespaces!\n camera_name = dd_xml.css('device friendlyName').inner_text\n services = dd_xml.css('device X_ScalarWebAPI_Service')\n endpoints = {}\n services.each do |sv|\n service_type = sv.css('X_ScalarWebAPI_ServiceType').inner_text\n endpoints[service_type] = File.join(sv.css('X_ScalarWebAPI_ActionList_URL').inner_text, service_type)\n end\n # endpoints['liveview'] = dd_xml.css('device X_ScalarWebAPI_LiveView_URL').inner_text\n # endpoints.delete_if { |k, v| v.blank? }\n log.info \"model-name: #{camera_name}\"\n log.debug 'endpoints:'\n endpoints.each do |e|\n log.debug \" #{e}\"\n end\n endpoints\n end",
"def description\n data_from_r['description']\n end",
"def display_group\n self.groups.each do |group|\n if group != Group.find_by_name(\"Default\")\n if group != Group.find_by_name(\"Global\")\n return group.name\n end\n end\n end\n return \"N/A\"\n end",
"def collect_group_details\n cmd = 'lsgroup -a ALL' # get all group names\n result ||= inspec.backend.run_command(cmd)\n return [] if result.exit_status.to_i != 0\n names = result.stdout.split(\"\\n\")\n groups_cache = []\n names.sort.uniq.each do |n|\n groups_cache << AixGroup(inspec, n)\n end\n groups_cache\n end",
"def getDescription\r\n\t\t\t\t\treturn @description\r\n\t\t\t\tend",
"def getDescription\r\n\t\t\t\t\treturn @description\r\n\t\t\t\tend",
"def description\n text_get(7, @id)\n end",
"def discover_groups_string\n discover_groups.join(', ')\n end",
"def group\n return @children['group'][:value]\n end",
"def description\n @gapi[\"description\"]\n end",
"def group_get(name)\n execute(\"dscacheutil -q group -a name #{name}\") do |result|\n fail_test \"failed to get group #{name}\" unless /^name: #{name}/.match?(result.stdout)\n gi = {} # group info\n result.stdout.each_line do |line|\n pieces = line.split(': ')\n gi[pieces[0].to_sym] = pieces[1].strip if pieces[1] != nil\n end\n answer = \"#{gi[:name]}:#{gi[:password]}:#{gi[:gid]}\"\n\n yield answer if block_given?\n answer\n end\n end",
"def group\n return @group\n end",
"def group\n return @group\n end",
"def bde_description\n read_attribute(:description)\n end",
"def group_name\n @sg.group_name\n end",
"def group_name\n @sg.group_name\n end",
"def get_group_device_list_by_type(ent,group,dev_type_list)\n oci_cmd = :GroupAccessDeviceGetListRequest\n table_header = 'accessDeviceTable'\n\n devices_list = Array.new\n dev_type_list.each do |dev|\n config_hash = send(oci_cmd,ent,group,dev)\n device_list,cmd_ok = get_table_response(oci_cmd,table_header,config_hash)\n devices_list += device_list \n end\n\n return devices_list\n end",
"def ua_record_group_display(value = '')\n group_keys = value.split(':')\n label = [group_keys.last, ' — '].join\n label << (group_keys.count > 1 ? subgroup_label(group_keys) : group_label(group_keys))\n label.html_safe\n end",
"def details\n {\n groups: categorized_groups,\n internal_name: tag.title_including_parent,\n }\n end",
"def get_description\n return @m_description\n end",
"def get_description\n return @m_description\n end",
"def description\n data[:description]\n end",
"def description\n data[:description]\n end",
"def test_get_ad_group\n test_add_ad_group_cpc() unless @ad_group\n selector = @ad_group_srv.module::AdGroupSelector.new\n selector.adGroupIds = [@ad_group.id]\n response = @ad_group_srv.get(selector)\n assert_not_nil(response.rval.entries, 'Empty result set returned')\n assert_equal(1, response.rval.entries.size,\n 'Unexpected number of entries returned')\n assert_equal(@ad_group.id, response.rval.entries.first.id)\n end",
"def getToolsSyndicateInfogroup( entity_id, destructive)\n params = Hash.new\n params['entity_id'] = entity_id\n params['destructive'] = destructive\n return doCurl(\"get\",\"/tools/syndicate/infogroup\",params)\n end",
"def description\n @data['description']\n end",
"def description\n @data['description']\n end",
"def group_name\n group.name if group\n end",
"def description\n return @discovery_document['description']\n end",
"def description\n return @discovery_document['description']\n end",
"def get(udid)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'udid', udid)\n\t\t\tclient.queue_service_action_call('configurationgroupdevice', 'get', 'KalturaConfigurationGroupDevice', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def description\n @data['description']\n end",
"def destroy\n start = Time.now\n debug(\"Deleting device group: \\\"#{resource[:full_path]}\\\"\")\n connection = self.class.get_connection(resource[:account])\n device_group = get_device_group(connection, resource[:full_path], 'id')\n if device_group\n delete_device_group = rest(connection,\n Puppet::Provider::Logicmonitor::DEVICE_GROUP_ENDPOINT % device_group['id'],\n Puppet::Provider::Logicmonitor::HTTP_DELETE)\n valid_api_response?(delete_device_group) ? nil : alert(delete_device_group)\n end\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n end",
"def group_id\n get_info[:groupID]\n end",
"def descr\n return text_get(2, id)\n end",
"def showgroup\n group = groups.map(&:id)\n group.delete(Group.defaultgroup)\n return \"None\" if group.empty?\n Group.find(group.to_s).title \n end",
"def description\n\t\t\t@data[\"description\"]\n\t\tend",
"def description\n @gapi.description\n end",
"def device_display_name\n return @device_display_name\n end",
"def device_display_name\n return @device_display_name\n end",
"def description\n data.description\n end",
"def description\n data.description\n end",
"def description\n data.description\n end",
"def read_groups_string\n read_groups.join(', ')\n end",
"def read ()\n groups_validate\n\n gid = @options[:groupId]\n\n client = GroupsClient.new\n client.api_token = @options[:api_token]\n client.app_url = @options[:app_url]\n\n resp = client.read( gid)\n print_json resp\n end",
"def display_device_name\n return @display_device_name\n end",
"def get_description\n get_field_config['description']\n end",
"def update_device_group(connection, fullpath, description, properties, disable_alerting)\n device_group = get_device_group(connection, fullpath, 'id,parentId')\n device_group_hash = build_group_json(fullpath,\n description,\n properties,\n disable_alerting,\n device_group['parentId'])\n update_device_group = rest(connection,\n Puppet::Provider::Logicmonitor::DEVICE_GROUP_ENDPOINT % device_group['id'],\n Puppet::Provider::Logicmonitor::HTTP_PATCH,\n build_query_params(nil, nil, -1, device_group_hash.keys),\n device_group_hash.to_json)\n valid_api_response?(update_device_group) ? debug(update_device_group) : alert(update_device_group)\n end",
"def group_name\n group.blank? ? Group.direct_to_consumer.name : group.name\n end",
"def retrieve_group\n @group = Group.find(params[:group_id])\n end",
"def description\n @data['description']\n end",
"def get_description\n @description\n end",
"def group\n Group.get!(gidnumber)\n end",
"def description\n @attributes[:description]\n end",
"def get_description (launch_permission)\n \n d = begin\n\n launch_permission.get_description || \"no description found\"\n\n rescue Exception => e\n\n \"(#{e.to_s})\"\n end\n\n d = \"#{d[0, MAX_DESC_LENGTH]}...\" if d.length > MAX_DESC_LENGTH\n\n h(d)\n end",
"def get_group(group_id = 0)\n current_path = \"/api/v1/groups/#{group_id}\"\n @conn.get(current_path)\n end",
"def description\n info[\"Description\"]\n end",
"def dmdid_attribute(groupname)\n \"\"\n end"
] | [
"0.69122857",
"0.6838297",
"0.67690456",
"0.66809475",
"0.66659886",
"0.6632578",
"0.6622104",
"0.6527918",
"0.650246",
"0.64859444",
"0.62351847",
"0.62066865",
"0.61031884",
"0.608062",
"0.6066598",
"0.60373074",
"0.6005407",
"0.599934",
"0.5982732",
"0.5982492",
"0.5970798",
"0.59661263",
"0.58384466",
"0.5820278",
"0.5820278",
"0.5812451",
"0.58093923",
"0.5801414",
"0.5789056",
"0.57871556",
"0.57739353",
"0.575904",
"0.57546544",
"0.5747914",
"0.5746489",
"0.5737741",
"0.57302785",
"0.57291687",
"0.57084566",
"0.5697261",
"0.5692527",
"0.5680128",
"0.5678059",
"0.56523967",
"0.56306726",
"0.561194",
"0.56068087",
"0.56068087",
"0.56011283",
"0.55865103",
"0.5586396",
"0.55765224",
"0.55750644",
"0.55746526",
"0.55746526",
"0.5542339",
"0.5527569",
"0.5527569",
"0.5526052",
"0.552267",
"0.551999",
"0.55192554",
"0.55192554",
"0.55180866",
"0.55180866",
"0.55165386",
"0.5508762",
"0.5508267",
"0.5508267",
"0.5495605",
"0.54895884",
"0.54895884",
"0.5480978",
"0.5478622",
"0.5478166",
"0.54779965",
"0.546908",
"0.546368",
"0.54589254",
"0.5435064",
"0.5432991",
"0.5432991",
"0.54153764",
"0.54153764",
"0.54153764",
"0.54140884",
"0.5411714",
"0.54094803",
"0.54059625",
"0.54034144",
"0.5403077",
"0.5402445",
"0.54005146",
"0.5392684",
"0.53864956",
"0.5373169",
"0.5372922",
"0.537009",
"0.5362856",
"0.53576314"
] | 0.8422715 | 0 |
Update Device Group Description | def description=(value)
start = Time.now
debug "Updating description on device group: \"#{resource[:full_path]}\""
connection = self.class.get_connection(resource[:account])
update_device_group(connection,
resource[:full_path],
value,
resource[:properties],
resource[:disable_alerting])
debug "Finished in #{(Time.now-start)*1000.0} ms"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_device_group(connection, fullpath, description, properties, disable_alerting)\n device_group = get_device_group(connection, fullpath, 'id,parentId')\n device_group_hash = build_group_json(fullpath,\n description,\n properties,\n disable_alerting,\n device_group['parentId'])\n update_device_group = rest(connection,\n Puppet::Provider::Logicmonitor::DEVICE_GROUP_ENDPOINT % device_group['id'],\n Puppet::Provider::Logicmonitor::HTTP_PATCH,\n build_query_params(nil, nil, -1, device_group_hash.keys),\n device_group_hash.to_json)\n valid_api_response?(update_device_group) ? debug(update_device_group) : alert(update_device_group)\n end",
"def description\n start = Time.now\n debug \"Checking description for device group: \\\"#{resource[:full_path]}\\\"\"\n connection = self.class.get_connection(resource[:account])\n device_group = get_device_group(connection, resource[:full_path],'description')\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n device_group['description']\n end",
"def update_group(desc, type, group, value)\n method = type.to_s.sub(/s$/, '_groups')\n old_value = desc.send(method).include?(group)\n if old_value && !value\n desc.send(method).delete(group)\n elsif !old_value && value\n desc.send(method).push(group)\n end\n end",
"def device_description=(value)\n @device_description = value\n end",
"def update\n begin\n @deptgroup = Deptgroup.find(params[:id])\n\n updated_group = @@data_util.hash_data_to_upper_case(@@data_util.strip_hash_data(params[:dept_group]), ['description'])\n updated_group[:lastupdateby] = session[:username]\n\n if @deptgroup.update_attributes(updated_group)\n @@request_result[:success] = true\n @@request_result[:notice] = 'Department Sub Group was successfully updated.'\n else\n @@request_result[:errormsg] = @deptgroup.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",
"def set_device_group\n @device_group = DeviceGroup.find(params[:id])\n end",
"def update_group(group, attributes)\n group.update(attributes)\n end",
"def update\n if(params[:group][:name].nil?) or (params[:group][:name] == \"\")\n flash[:notice] = \"Group must have a name and description\"\n redirect_to edit_group_path(@group)\n elsif(params[:group][:description].nil?) or (params[:group][:description] == \"\")\n flash[:notice] = \"Group must have a name and description\"\n redirect_to edit_group_path(@group)\n else\n @group = Group.find(params[:id])\n @group.update(group_params)\n flash[:notice] = \"#{@group.name} was sucessfully updated\"\n redirect_to group_path(@group)\n end\n end",
"def description= new_description\n @gapi.update! description: new_description\n end",
"def ensure_magic_descriptor_presence(ad_group)\n # Use exceptions as activedirectory gem will throw an ArgumentError if no description exists.\n # AD groups don't have to have description fields but we will add one if needed.\n begin\n g_desc = ad_group.description\n rescue ArgumentError\n # description not set\n g_desc = \"\"\n end\n\n unless g_desc and g_desc.index MAGIC_DESCRIPTOR\n ad_group.description = \"#{MAGIC_DESCRIPTOR} #{g_desc}\"\n ad_group.save\n end\nend",
"def description(session, id, new_description)\n write_task('rvpe.image.description', session) do\n err_msg = \"You don't have permission to modify the description \" +\n 'of the image.'\n sanity_check(session, id, err_msg) do\n call_one_xmlrpc('one.image.update', session, id,\n 'DESCRIPTION', new_description)\n end\n end\n end",
"def update\n unless @group.update(group_params)\n render :edit and return\n end\n msg = [\"Updated group.\", rebuild_configs].join(\" \")\n redirect_to groups_url, notice: msg\n end",
"def update_group(group_or_id, attributes)\n instantize_group(group_or_id).update(attributes)\n end",
"def option_group_description\n data[:option_group_description]\n end",
"def update\n if @group.update_attributes(params[:group])\n respond_with(@group, only: [:id, :name, :creator_id, :admin_id])\n else\n render_error(404, request.path, 20103, \"Failed to update group info\")\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to( view_group_path(@group.label), :notice => 'Group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_group(group_id, attributes)\n put(\"/v1/groups/#{group_id}\", attributes)\n end",
"def update #:nodoc:\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = I18n.t(\"{{value}} was successfully updated.\", :default => \"{{value}} was successfully updated.\", :value => I18n.t(\"Group\", :default => \"Group\"))\n format.html { redirect_to groups_url }\n # format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n # format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def description\n [@group.description,@description].join(' ')\n end",
"def update\n @group = Group.find(params[:id])\n \n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(admin_groups_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @meta_data_group = MetaDataGroup.find(params[:id])\n\n respond_to do |format|\n if @meta_data_group.update_attributes(params[:meta_data_group])\n format.html { redirect_to @meta_data_group, notice: 'MetaData group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meta_data_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def properties=(value)\n start = Time.now\n debug \"Updating properties for device group: \\\"#{resource[:full_path]}\\\"\"\n connection = self.class.get_connection(resource[:account])\n update_device_group(connection,\n resource[:full_path],\n resource[:description],\n value,\n resource[:disable_alerting])\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n end",
"def description= new_description\n patch_gapi! description: new_description\n end",
"def update options = {}\n\n group_opts = group_options(options) \n\n # tags must be updated using a separate request from the\n # other attributes, *sigh*\n if tags = group_opts.delete(:tags)\n tags.map(&:to_hash).each do |tag|\n tag[:resource_type] = 'auto-scaling-group'\n tag[:resource_id] = name\n end\n client.create_or_update_tags(:tags => tags)\n end\n\n unless group_opts.empty?\n client_opts = group_opts.merge(:auto_scaling_group_name => name)\n client.update_auto_scaling_group(client_opts)\n end\n\n nil\n\n end",
"def update_rsgroup_config(groupName)\n @admin.updateConfiguration(groupName)\n end",
"def student_edit_grp_name(course, group, new_name)\n student_visit_grp(course, group)\n logger.debug \"Changing group title to '#{group.title = new_name}'\"\n wait_for_update_and_click edit_group_link_element\n wait_for_element_and_type(edit_group_name_input_element, group.title)\n wait_for_update_and_click save_button_element\n wait_until(Utils.short_wait) { recent_activity_heading.include? group.title }\n end",
"def update\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def description=(new_desc)\n @options[:connection].put(\"/namespaces/#{path}\", :payload => {:description => new_desc})\n @options[:description] = new_desc\n end",
"def update\n @group = Group.find_by_guid(params[:id])\n respond_to do |format|\n if @group.update_attributes(update_params)\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render json: @group }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @polco_group = PolcoGroup.find(params[:id])\n @polco_group.title = \"#{params[:polco_group][:name]}_custom\" \n\n respond_to do |format|\n if @polco_group.update_attributes(params[:group])\n format.html { redirect_to(@polco_group, :notice => 'PolcoGroup was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @polco_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_group(group_name, options = {})\n request({\n 'Action' => 'UpdateGroup',\n 'GroupName' => group_name,\n :parser => Fog::Parsers::AWS::IAM::UpdateGroup.new\n }.merge!(options))\n end",
"def update\n @group = load_group\n @group_form = group_form\n\n if @group_form.valid? && @group_form.save\n redirect_to(admin_group_path(@group_form.id))\n else\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n Log.create! description: \"<b>#{current_user.email} </b> updated group <b>#{@group.name} </b> at #{@group.updated_at.strftime '%d-%m-%Y %H:%M:%S'}\", role_id: current_user.roles.ids.first\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:group].delete(:domain) unless current_group.shapado_version.has_custom_domain?\n if params[:group][:languages]\n params[:group][:languages].reject! { |lang| lang.blank? }\n end\n @group.safe_update(%w[track_users name legend description default_tags subdomain logo logo_info forum enable_latex enable_mathjax\n custom_favicon language languages current_theme_id reputation_rewards daily_cap reputation_constrains\n has_adult_content registered_only enable_anonymous signup_type custom_css wysiwyg_editor layout\n fb_button notification_opts auth_providers allow_any_openid], params[:group])\n @group.share.safe_update(%w[fb_app_id fb_secret_key fb_active starts_with ends_with enable_twitter twitter_user twitter_pattern], params[:group][:share]) if params[:group][:share]\n @group.safe_update(%w[isolate domain private has_custom_analytics has_custom_html has_custom_js], params[:group]) #if current_user.admin?\n @group.safe_update(%w[analytics_id analytics_vendor], params[:group]) if @group.has_custom_analytics\n @group.custom_html.update_attributes(params[:group][:custom_html] || {}) if @group.has_custom_html\n @group.notification_opts.safe_update(%w[questions_to_twitter badges_to_twitter favorites_to_twitter answers_to_twitter comments_to_twitter], params[:group][:notification_opts]) if params[:group][:notification_opts]\n if params[:group][:language] && !params[:group]['languages']\n @group.languages = []\n end\n\n if @group.domain == AppConfig.domain ||\n @group.domain.index(AppConfig.domain).nil? ||\n @group.user.role == 'admin'\n @group.has_custom_js = true\n else\n @group.has_custom_js = false\n end\n\n if params[:group][:logo]\n @group.logo_version += 1\n end\n if params[:group][:custom_favicon]\n @group.custom_favicon_version += 1\n end\n\n respond_to do |format|\n if @group.save\n flash[:notice] = I18n.t('groups.update.notice')\n format.html {\n if params[:group][:custom_domain] && @group.has_custom_domain?\n redirect_to \"#{request.protocol}#{AppConfig.domain}:#{request.port}#{check_custom_domain_path(@group.id)}\"\n elsif params[:group][:custom_domain]\n redirect_to \"#{request.protocol}#{@group.domain}:#{request.port}/manage/properties/domain\"\n else\n redirect_to(params[:source] ? params[:source] : group_path(@group))\n end\n }\n format.json { head :ok }\n else\n format.html {\n flash[:error] = @group.errors.messages.first[1]\n redirect_to :back\n }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(current_user.id)\n @group = @user.groups.find(params[:id])\n @group.title = params[:title]\n @group.description = params[:description]\n @group.groupProfile = params[:groupProfile]\n @group.groupCover = params[:groupCover]\n\n @groupcategory = GroupCategory.where(:group_id => params[:id])\n @groupcategory.update(group_id: @group.id , category_id: params[:category])\n\n respond_to do |format|\n if @group.update(title: params[:title], description: params[:description])\n format.html { redirect_to user_group_path(current_user.id, @group.id) }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_group\n if @ok\n @mailing_list_group.name = params[:name]\n @ok = @mailing_list_group.save\n @mailing_list_group = MailingListGroup.find @mailing_list_group_id if !@ok\n end\n end",
"def update\n respond_to do |format|\n old_name = @group_type.description\n if @group_type.update(group_type_params)\n SystemLog.create(description: \"Atualizou o tipo de grupo #{old_name} para #{@group_type.description}\", author: name_and_type_of_logged_user)\n format.html { redirect_to [:records, @group_type], notice: 'Tipo de grupo atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @group_type }\n else\n format.html { render :edit }\n format.json { render json: @group_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n json_response(@description.update!(description_params))\n end",
"def update\n respond_to do |format|\n if @dis_group.update(dis_group_params)\n format.html { redirect_to @dis_group, notice: 'Dis group was successfully updated.' }\n format.json { render :show, status: :ok, location: @dis_group }\n else\n format.html { render :edit }\n format.json { render json: @dis_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def description=(description)\r\n\t\t\t`#{BITS::BITSADMIN} /setdescription {#{@id}} \\\"#{description}\\\"`\r\n\t\tend",
"def update\n respond_to do |format|\n if @resource_group.update(resource_group_params)\n format.html { redirect_to @resource_group, notice: 'Resource group was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource_group }\n else\n format.html { render :edit }\n format.json { render json: @resource_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n audit(@group, \"update\", @group.name)\n format.html { redirect_to group_path(@group), notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @group }\n else\n format.html { render :edit }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @record_group = RecordGroup.find(params[:id])\n @record_group.accessible = :all if admin?\n respond_to do |format|\n if @record_group.update_attributes(params[:record_group])\n flash[:notice] = 'RecordGroup was successfully updated.'\n format.html { redirect_to(@record_group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @record_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n if @group.update_attributes(params[:group])\n flash[:notice] = t('flash_msg47')\n @groups = Group.all\n # format.html { redirect_to(@group) }\n # format.xml { head :ok }\n else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end",
"def update\n @target_group = TargetGroup.find(params[:id])\n\n respond_to do |format|\n if @target_group.update_attributes(params[:target_group])\n flash[:notice] = 'TargetGroup was successfully updated.'\n format.html { redirect_to([:admin, @target_group]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @target_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def modify_d_b_description(d_b_description, d_b_instance_id, d_b_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'ModifyDBDescription'\n\t\targs[:query]['DBDescription'] = d_b_description\n\t\targs[:query]['DBInstanceId'] = d_b_instance_id\n\t\targs[:query]['DBName'] = d_b_name\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend",
"def set_Description(value)\n set_input(\"Description\", value)\n end",
"def set_Description(value)\n set_input(\"Description\", value)\n end",
"def set_Description(value)\n set_input(\"Description\", value)\n end",
"def set_Description(value)\n set_input(\"Description\", value)\n end",
"def set_Description(value)\n set_input(\"Description\", value)\n end",
"def set_Description(value)\n set_input(\"Description\", value)\n end",
"def set_Description(value)\n set_input(\"Description\", value)\n end",
"def set_Description(value)\n set_input(\"Description\", value)\n end",
"def set_Description(value)\n set_input(\"Description\", value)\n end",
"def set_Description(value)\n set_input(\"Description\", value)\n end",
"def set_Description(value)\n set_input(\"Description\", value)\n end",
"def set_Description(value)\n set_input(\"Description\", value)\n end",
"def UpdateGroup params = {}\n \n APICall(path: 'groups.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @group_label = GroupLabel.find(params[:id])\n\n respond_to do |format|\n if @group_label.update_attributes(params[:group_label])\n format.html { redirect_to @group_label, notice: 'Group label was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group_label.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @host_group = HostGroup.find(params[:id])\n\n respond_to do |format|\n if @host_group.update_attributes(params[:host_group])\n format.html { redirect_to @host_group, notice: 'Host group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @host_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tqrdc_group.update(tqrdc_group_params)\n format.html { redirect_to @tqrdc_group, notice: 'Group was successfully updated.' }\n format.json { render :show, status: :ok, location: @tqrdc_group }\n else\n format.html { render :edit }\n format.json { render json: @tqrdc_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if @group.update(group_params)\n head :no_content\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def update\n @lab_group = LabGroup.find(params[:id])\n\n respond_to do |format|\n if @lab_group.update_attributes(params[:lab_group])\n flash[:notice] = 'LabGroup was successfully updated.'\n format.html { redirect_to(@lab_group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lab_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = GROUP.first_or_get!(params[:id])\n @group.current_user = current_user\n\n @group.update_children((params[:group] || {}).delete(:locales), :locale)\n\n respond_to do |format|\n if @group.update(params[:group]) or not @group.dirty?\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(group_url(@group.id)) }\n format.xml { render :xml => @group }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_group\n @group = Group.friendly.find(params[:comment][:group_id])\n end",
"def update(description) # :nodoc:\n @description = description\n self\n end",
"def update(description) # :nodoc:\n @description = description\n self\n end",
"def manage_group\n shell_out!(\"groupmod\", set_options)\n modify_group_members\n end",
"def set_group(group)\n send_request(FUNCTION_SET_GROUP, [group], 'k4', 0, '')\n end",
"def update\n @group = Group.find(params[:id])\n if @group.update_attributes(params[:group])\n flash[:notice] = \"Grupo actualizado.\"\n redirect_to groups_path\n else\n render :action => 'edit'\n end\n end",
"def update\n respond_to do |format|\n if @unit_group.update(unit_group_params)\n format.html { redirect_to @unit_group, notice: 'Unit group was successfully updated.' }\n format.json { render :show, status: :ok, location: @unit_group }\n else\n format.html { render :edit }\n format.json { render json: @unit_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_ad_group\n test_add_ad_group_cpc() unless @ad_group\n bids = @ad_group_srv.module::ManualCPCAdGroupBids.new\n keyword_max_cpc = {\n :amount => {\n :microAmount => 3000000\n }\n }\n bids.keywordMaxCpc = keyword_max_cpc\n operation = {\n :operand => {\n :id => @ad_group.id,\n :bids => bids,\n },\n :operator => 'SET'\n }\n\n # Update ad group.\n response = @ad_group_srv.mutate([operation])\n ad_group = response.rval.value.first\n\n assert_not_nil(ad_group, 'Invalid ad group returned')\n assert_updated_correctly(operation, ad_group)\n end",
"def update\n \n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to(@group, :notice => 'Group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_group(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'UpdateGroup'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :group_name\n\t\t\targs[:query]['GroupName'] = optional[:group_name]\n\t\tend\n\t\tif optional.key? :new_comments\n\t\t\targs[:query]['NewComments'] = optional[:new_comments]\n\t\tend\n\t\tif optional.key? :new_group_name\n\t\t\targs[:query]['NewGroupName'] = optional[:new_group_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def update\n Puppet.debug(\"Debconf: updating #{resource[:name]}\")\n\n # Build the string to send\n args = [:package, :item, :type, :value].map { |e| resource[e] }.join(' ')\n\n IO.popen('/usr/bin/debconf-set-selections', 'w+') do |pipe|\n Puppet.debug(\"Debconf: debconf-set-selections #{args}\")\n pipe.puts(args)\n\n # Ignore remaining output from command\n pipe.close_write\n pipe.read(nil)\n end\n end",
"def update\n @attribute_group = AttributeGroup.find(params[:id])\n\n respond_to do |format|\n if @attribute_group.update_attributes(params[:attribute_group])\n format.html { redirect_to(@attribute_group, :notice => 'Attribute group was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @attribute_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to groups_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n \n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def ListView_SetGroupInfo(hwnd, iGroupId, pgrp)\n send_listview_message(hwnd, :SETGROUPINFO, wparam: iGroupId, lparam: pgrp)\n end",
"def group_params\n params.require(:group).permit(:name, :description)\n end",
"def group_params\n params.require(:group).permit(:name, :description)\n end",
"def group_params\n params.require(:group).permit(:name, :description)\n end",
"def group_params\n params.require(:group).permit(:name, :description)\n end",
"def group_params\n params.require(:group).permit(:name, :description)\n end",
"def group_params\n params.require(:group).permit(:name, :description)\n end",
"def group_params\n params.require(:group).permit(:name, :description)\n end",
"def update\n\t\t@group = Group.find(params[:id])\n\t\[email protected]_accessor(current_user)\n\t\trespond_to do |format|\n\t\t\tif @group.update_attributes(params[:group])\n\t\t\t\tflash[:notice] = t(:ctrl_object_updated, :typeobj => t(:ctrl_group), :ident => @group.name)\n\t\t\t\tshow_\n\t\t\t\tformat.html { render :action => \"show\" }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tflash[:error] = t(:ctrl_object_not_updated, :typeobj => t(:ctrl_group), :ident => @group.name, :error => @group.errors.full_messages)\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n\n begin\n @busgroup = Busgroup.find(params[:id])\n @busgroup.mypclient_id = session[:client_id]\n @busgroup.busgroupcode = params[:group_code].upcase.strip\n @busgroup.description = params[:description].strip\n @busgroup.lastupdateby = session[:username]\n\n if @busgroup.save \n @@request_result[:success] = true\n @@request_result[:notice] = 'Business Group successfully updated.'\n else\n @@request_result[:errormsg] = @busgroup.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",
"def update\n logger.info \"Put parameters: #{params.to_json}\"\n @group = Group.find(params[:id])\n\n if @group.update_attributes(params[:group])\n head :no_content\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @group.update(params[:group])\n format.html { redirect_to [@hub, @group], :notice => 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_query_group(project_id, query_group_id, opts = {})\n put \"projects/#{project_id}/querygroups/#{query_group_id}\", opts\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, :notice => 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @field_group = FieldGroup.find(params[:id])\n @field_group.update_attributes(field_group_params)\n\n respond_with(@field_group)\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n flash[:notice] = 'Group was successfully updated.'\n format.html { redirect_to(@group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.6973977",
"0.68643016",
"0.6430639",
"0.63025874",
"0.61800104",
"0.61226726",
"0.6101705",
"0.60991216",
"0.6080032",
"0.60615283",
"0.60192186",
"0.5890359",
"0.5890106",
"0.5878162",
"0.58680093",
"0.58624405",
"0.5862161",
"0.58130544",
"0.5806277",
"0.57867354",
"0.5779015",
"0.5772198",
"0.57711136",
"0.5770541",
"0.5757812",
"0.5745313",
"0.5740166",
"0.57392627",
"0.5730287",
"0.5716363",
"0.5705089",
"0.5702462",
"0.56980354",
"0.56740963",
"0.5665252",
"0.5641539",
"0.5640077",
"0.5624526",
"0.56181604",
"0.5611772",
"0.56093144",
"0.5585923",
"0.55722195",
"0.556298",
"0.5550495",
"0.553906",
"0.55361706",
"0.55361706",
"0.55361706",
"0.55361706",
"0.55361706",
"0.55361706",
"0.55361706",
"0.55361706",
"0.55361706",
"0.55361706",
"0.55361706",
"0.55361706",
"0.55283356",
"0.5526938",
"0.5517649",
"0.5510138",
"0.5506931",
"0.549577",
"0.5481073",
"0.5479004",
"0.5476716",
"0.5476716",
"0.5476595",
"0.54708207",
"0.5469187",
"0.5469047",
"0.54638374",
"0.5457322",
"0.54524153",
"0.54524076",
"0.54484946",
"0.54435664",
"0.5428617",
"0.5413059",
"0.54127026",
"0.54127026",
"0.54127026",
"0.54127026",
"0.54127026",
"0.54127026",
"0.54127026",
"0.54077023",
"0.5406541",
"0.54057306",
"0.5405402",
"0.54046875",
"0.54046875",
"0.5403165",
"0.5395417",
"0.5393508",
"0.53911686",
"0.53911686",
"0.53911686",
"0.53899276"
] | 0.79215366 | 0 |
Get disable_alerting status of Device Group | def disable_alerting
start = Time.now
debug "Checking disable_alerting setting for device group: \"#{resource[:full_path]}\""
connection = self.class.get_connection(resource[:account])
device_group = get_device_group(connection, resource[:full_path],'disableAlerting')
debug "Finished in #{(Time.now-start)*1000.0} ms"
device_group['disableAlerting'].to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disable_alerting=(value)\n start = Time.now\n debug \"Updating disable_alerting setting for device group: \\\"#{resource[:full_path]}\\\"\"\n connection = self.class.get_connection(resource[:account])\n update_device_group(connection,\n resource[:full_path],\n resource[:description],\n resource[:properties],\n value)\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n end",
"def disable_group(group)\n @event_groups[group] = false\n end",
"def disabled_by_microsoft_status\n return @disabled_by_microsoft_status\n end",
"def group_health group\n group_status = groups[group]\n service_health group_status\n end",
"def disabled_warnings\n Dynamic[:disabled_warnings]\n end",
"def enabled_metrics\n @group.enabled_metrics\n end",
"def subnet_group_status\n data.subnet_group_status\n end",
"def check_puppet_status(group)\n @service.class_filter group\n begin\n @service.status(:service => 'puppet').each do |rpcresult|\n # Check if puppet is disabled\n hostname = rpcresult.results[:sender]\n if rpcresult.results[:data][:status] != \"stopped\"\n raise PuppetEnabledException, hostname\n end\n end\n ensure\n # Make sure we reset the filter after a run\n @service.reset_filter\n end\nend",
"def create_disabled_changed_alert\n if @property_channel.disabled?\n PropertyChannelDisabledAlert.create_for_property(@property_channel)\n else\n PropertyChannelEnabledAlert.create_for_property(@property_channel)\n end\n end",
"def disable_alert_feature \n put(\"/globalsettings.json/alerts/disable\")\nend",
"def group_admins_enabled\n @attributes[:group_admins_enabled]\n end",
"def provision_group_exclusion\n @attributes[:provision_group_exclusion]\n end",
"def disabled_checks_by_category\n checks = REXML::XPath.first(@xml, '//VulnerabilityChecks/Disabled')\n checks ? checks.elements.to_a('VulnCategory').map { |c| c.attributes['name'] } : []\n end",
"def disabled_by_microsoft_status=(value)\n @disabled_by_microsoft_status = value\n end",
"def disabled_vuln_checks\n checks = REXML::XPath.first(@xml, '//VulnerabilityChecks/Disabled')\n checks ? checks.elements.to_a('Check').map { |c| c.attributes['id'] } : []\n end",
"def group_notifications\n @attributes[:group_notifications]\n end",
"def disabled_mail\n Accounts.disabled_mail\n end",
"def intelligent_disable(pks)\n todisable = intelligent_nodeps(pks, :disable, :cant_disable, true)\n logger.info 'COMPONENTS WITHOUT DEPENDENCIES: ' + todisable.to_s\n not_found_vnfds = set_vnfds_status(todisable[:disable][:vnfds], 'inactive')\n not_found_nsds = set_nsds_status(todisable[:disable][:nsds], 'inactive')\n set_pd_status(pks, 'inactive')\n if ( not_found_vnfds.length == 0 ) and ( not_found_nsds.length == 0 )\n logger.debug \"Catalogue: leaving DISABLE /api/v2/packages?#{query_string}\\\" with PD #{pks}\"\n halt 200, JSON.generate(result: todisable)\n else\n logger.debug \"Catalogue: leaving DISABLE /api/v2/packages?#{query_string}\\\" with PD #{pks}\"\n logger.info \"Some descriptors where not found \"\n logger.info \"Vnfds not found: \" + not_found_vnfds.to_s\n logger.info \"Nsds not found: \" + not_found_nsds.to_s\n halt 404, JSON.generate(result: todisable,\n not_found: { vnfds: not_found_vnfds, nsds: not_found_nsds })\n end\n end",
"def status\n @group.status\n end",
"def miqAlarmSpecDisabled\n alarmSpec = @miqAlarmSpecEnabled.clone\n alarmSpec.enabled = \"false\"\n (alarmSpec)\n end",
"def disable(key)\n @status[key] = :disabled\n end",
"def disable_password_reset\n @attributes[:disable_password_reset]\n end",
"def power_off_blocked\n return @power_off_blocked\n end",
"def disabled?\n status == 'disabled'\n end",
"def update_device_group(connection, fullpath, description, properties, disable_alerting)\n device_group = get_device_group(connection, fullpath, 'id,parentId')\n device_group_hash = build_group_json(fullpath,\n description,\n properties,\n disable_alerting,\n device_group['parentId'])\n update_device_group = rest(connection,\n Puppet::Provider::Logicmonitor::DEVICE_GROUP_ENDPOINT % device_group['id'],\n Puppet::Provider::Logicmonitor::HTTP_PATCH,\n build_query_params(nil, nil, -1, device_group_hash.keys),\n device_group_hash.to_json)\n valid_api_response?(update_device_group) ? debug(update_device_group) : alert(update_device_group)\n end",
"def receive_admin_alerts\n @attributes[:receive_admin_alerts]\n end",
"def bypass_inactive_disable\n @attributes[:bypass_inactive_disable]\n end",
"def disabled\n @attributes[:disabled]\n end",
"def disable_all_alerts\n self.service_subscriptions.each do |subscription|\n subscription.update_attribute :sms_enabled, false\n subscription.update_attribute :email_enabled, false\n end\n end",
"def disable_vulnerability_alerts(repo, options = {})\n opts = ensure_api_media_type(:vulnerability_alerts, options)\n boolean_from_response(:delete, \"#{Repository.path repo}/vulnerability-alerts\", opts)\n end",
"def inactive_message\n !disabled ? super : :account_has_been_disabled\n end",
"def health_check_type\n @group.health_check_type\n end",
"def deprovision_groups\n @attributes[:deprovision_groups]\n end",
"def inactive_message\n disabled? ? :disabled : super\n end",
"def receive_disabled\n\n wrap_reply('disable' => Flor.true?(payload['ret']))\n end",
"def device_compliance_setting_states\n return @device_compliance_setting_states\n end",
"def inactive_by_group\n submodules_by_group(inactive)\n end",
"def set_group_status(*groups, enable, except: nil, include_system: false)\n if enable\n enable_group(*groups, except: except)\n else\n disable_group(*groups, except: except, include_system: include_system)\n end\n end",
"def disabled_checks_by_type\n checks = REXML::XPath.first(@xml, '//VulnerabilityChecks/Disabled')\n checks ? checks.elements.to_a('CheckType').map { |c| c.attributes['name'] } : []\n end",
"def unprivileged_bpf_disabled?\n cmd_exec('cat /proc/sys/kernel/unprivileged_bpf_disabled').to_s.strip.eql? '1'\n rescue\n raise 'Could not determine kernel.unprivileged_bpf_disabled status'\n end",
"def security_disable_usb_debugging\n return @security_disable_usb_debugging\n end",
"def disable\n run \"#{try_sudo} /sbin/chkconfig puppet off\"\n end",
"def control_availability\n dpms_availability\n end",
"def enable_disable_str\n if helper_enabled?\n 'Disable'\n else\n 'Enable'\n end\n end",
"def disable\n if enabled?\n Cratus::LDAP.replace_attribute(\n dn,\n Cratus.config.user_account_control_attribute,\n ['514']\n )\n refresh\n else\n true\n end\n end",
"def disable_polling(reason = nil)\n self.deactivate\n self.deactivation_reason = reason.to_s\n self.deactivated_at = Time.now\n self.save!\n end",
"def disable_power_policies\n return @disable_power_policies\n end",
"def get_available_for_group\n send_request(FUNCTION_GET_AVAILABLE_FOR_GROUP, [], '', 1, 'C')\n end",
"def disable_switch_data(pwnfx_scope)\n pwnfx_tag_id = pwnfx_scope + '_field'\n { pwnfx_disable_scope: pwnfx_scope, pwnfx_disable: pwnfx_tag_id,\n pwnfx_disable_trigger: 'checked' }\n end",
"def disableChecker(id)\n @availableCheckers.collect {|x| x.enabled = false if x.id == id} \n end",
"def disabled_lints\n lints.select { |lint, conf| conf['enabled'] === false }.map do |lint,|\n Lint.const_get(lint)\n end\n end",
"def disable_alert(alert_name, project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'PUT'\n\t\targs[:path]['AlertName'] = alert_name\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/alerts/[AlertName]/disable'\n\t\targs[:query]['Action'] = 'DisableAlert'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tself.run(args)\n\tend",
"def skype_status_offline\n ret = @skype_obj.Invoke(\"SET USERSTATUS OFFLINE\").first\n raise \"Couldnt go offline: '#{ret}'.\" if ret != \"USERSTATUS OFFLINE\"\n nil\n end",
"def monitoring_enabled=(value)\n if value\n client.monitor_instances(:instance_ids => [id])\n true\n else\n client.unmonitor_instances(:instance_ids => [id])\n false\n end\n end",
"def error_on_disabled?\n false\n end",
"def inactive_message\n !disabled_at ? super : :deleted_account\n end",
"def get_disabled_alternatives(d)\n return d.get_disabled_alternatives\n end",
"def ListView_GetGroupState(hwnd, dwGroupId, dwMask)\n send_listview_message(hwnd, :GETGROUPSTATE, wparam: dwGroupId, lparam: dwMask)\n end",
"def filter\n # #YELLOW\n if @event['check']['alert'] == false # rubocop:disable GuardClause\n puts 'alert disabled -- filtered event ' + [@event['client']['name'], @event['check']['name']].join(' : ')\n exit 0\n end\n end",
"def revoke_on_unenroll_disabled\n return @revoke_on_unenroll_disabled\n end",
"def bit_locker_disable_warning_for_other_disk_encryption\n return @bit_locker_disable_warning_for_other_disk_encryption\n end",
"def disable_threshold\n @enable_threshold = false\n end",
"def disable\n {\n method: \"Security.disable\"\n }\n end",
"def disable\n {\n method: \"Performance.disable\"\n }\n end",
"def alert_threshold\n return @alert_threshold\n end",
"def check_availability!(device, group, mode: nil)\n sync do\n ([group] + group.parents.reverse).each do |grp|\n dev = grp.devices.detect { |v| v == device }\n raise DeviceNotAvailable.new(device, grp) unless dev\n\n unless dev.mode.compatible?(mode || device.mode)\n raise DeviceModeInsufficient.new(device, grp, dev.mode)\n end\n end\n end\n end",
"def disabled(competition)\n return \"disabled\" if competition.hcp_adjusted\n end",
"def vmotion\n Puppet.debug \"Retrieving vmotion status flag of specified portgroup.\"\n begin\n myportgroup = find_portgroup\n ports = myportgroup.port\n if (ports !=nil)\n if ( myportgroup.port[0] != nil)\n type=myportgroup.port[0].type\n if (type == \"host\")\n #if it is a VMkernel port group then need to change the vmotion flag as per given by user\n return \"currentstatus\"\n else\n #return the same value as given by user\n return resource[:vmotion]\n end\n else\n return resource[:vmotion]\n end\n\n end\n rescue Exception => e\n fail \"Unable to retrieve vmotion status flag of the specified portgroup because the following excption occurred: -\\n #{e.message}\"\n end\n end",
"def disable\n self.stop if self.status == :running\n output = supervisorctl(:remove, @resource[:name])\n rescue Puppet::ExecutionFailure\n raise Puppet::Error, \"Could not disable #{self.name}: #{output}\"\n end",
"def work_profile_block_notifications_while_device_locked\n return @work_profile_block_notifications_while_device_locked\n end",
"def config_disabled(thing)\n check = thing.to_s\n to_check = [Carnivore::Config.get(:fission, :core, :disable)].flatten.compact\n to_check.include?(check)\n end",
"def check_inst2_temp2\n # Inside this method you must call process_group. The first parameter is\n # the number of seconds to delay before enabling the group when the telemetry\n # check is true. When the telemetry check is false the group is instantly\n # disabled. The next two parameters are Proc objects which are called with\n # the group is enabled and disabled respectively. We defined our Proc objects\n # in the constructor to enable and disable the GROUND group.\n process_group(0, @temp2_enable_code, @temp2_disable_code) do\n val = tlm(\"INST2 HEALTH_STATUS TEMP2\")\n # The expression returns TRUE (to enable the group) when the value is\n # not NAN and not Infinite. If the value is NAN or Infinite the group\n # is disabled. Note that this can't prevent false positives because the\n # value has to change to something invalid before we can turn off the group\n # at which point it is too late. Typically you enable or disable a group\n # based on some external telemetry point such as a power supply output\n # to enable a group of items powered by the supply.\n !val.nan? && !val.infinite?\n end\n end",
"def disabled_warnings; end",
"def get_device_group_list\n query_api('device-groups')\n end",
"def check_authorization\n render json: { error: 'unauthorized: device has been terminated' }, status: :internal_server_error unless @device.disabled_at == nil\n end",
"def sudo_group()\n\t\t\treturn @metadata.attributes[:sudo_group]\n\t\tend",
"def emergency?\n severity == :EMERGENCY\n end",
"def max_loss_severity\n @peer_group.try(:max_loss).to_f\n end",
"def kiosk_mode_block_sleep_button\n return @kiosk_mode_block_sleep_button\n end",
"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",
"def wi_fi_blocked\n return @wi_fi_blocked\n end",
"def disable\n {\n method: \"WebAuthn.disable\"\n }\n end",
"def disabled?\n\t\t\tuserAccountControl.to_i & UAC_ACCOUNT_DISABLED != 0\n\t\tend",
"def kiosk_mode_allow_sleep_button\n return @kiosk_mode_allow_sleep_button\n end",
"def is_disabled?\n client = RestClient.where(:api_key => @api_key).first\n return true if client.nil?\n client.is_disabled\n end",
"def event_alerts_policy\n (super || Notification::EVENT_ALERT_POLICY_TEAM).to_i\n end",
"def str_d_enabled\n str_od_enabled(d)\n end",
"def disable_subject\n enable_disable_subject('Disabled')\n end",
"def disable\n @disabled = true\n end",
"def disabled_all?; end",
"def get_setting_non_compliance_report()\n return MicrosoftGraph::DeviceManagement::Reports::GetSettingNonComplianceReport::GetSettingNonComplianceReportRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def disabled\n `#{@el}.disabled`\n end",
"def group_exceptions\n rightsMetadata.groups.map {|k, v| k if v == 'exceptions'}.compact\n end",
"def ListView_IsGroupViewEnabled(hwnd) send_listview_message(hwnd, :ISGROUPVIEWENABLED) end",
"def disable\n Puppet.notice \"Disabling Puppet.\"\n lockfile.lock(:anonymous => true)\n end",
"def status\n return :not_confirmed unless confirmed?\n return :disabled unless enabled?\n \n :enabled\n end",
"def change_to_disable\n @driver.find_element(xpath: @status_option).click\n end",
"def disable(package)\n wait_until(\"Disabling package\") do\n get \"/invoke/wm.server.packages/packageDisable?package=#{CGI.escape package.to_s}\"\n end\n end",
"def disabled?\n !Agent.config[:agent_enabled]\n end",
"def threshold_disabled?\n !@enable_threshold\n end"
] | [
"0.7371675",
"0.6242139",
"0.6040878",
"0.5979644",
"0.59092927",
"0.5820182",
"0.57699585",
"0.567009",
"0.5554105",
"0.5519001",
"0.5463659",
"0.54286194",
"0.53949326",
"0.53891623",
"0.53680676",
"0.53614587",
"0.5360941",
"0.53425825",
"0.52844673",
"0.52688235",
"0.5263456",
"0.52274096",
"0.5226937",
"0.51791507",
"0.5177268",
"0.51601434",
"0.514136",
"0.5135056",
"0.5119288",
"0.5116054",
"0.51123154",
"0.5097794",
"0.5093217",
"0.5069665",
"0.506838",
"0.5067065",
"0.5059828",
"0.5051845",
"0.5051379",
"0.5028299",
"0.5020534",
"0.50151676",
"0.5003899",
"0.49800172",
"0.4978169",
"0.4975828",
"0.49739233",
"0.49699235",
"0.49610406",
"0.4957775",
"0.49539897",
"0.49447244",
"0.4937899",
"0.49220982",
"0.49214536",
"0.49154055",
"0.49080107",
"0.4904696",
"0.4899923",
"0.489576",
"0.48941964",
"0.48928723",
"0.48868957",
"0.48839748",
"0.48778427",
"0.48770967",
"0.48592216",
"0.48522776",
"0.4847571",
"0.48456436",
"0.48374313",
"0.48259583",
"0.4822289",
"0.48055655",
"0.47971636",
"0.47917372",
"0.47848967",
"0.47747117",
"0.47656485",
"0.47616863",
"0.47577718",
"0.4752966",
"0.47517177",
"0.47509384",
"0.4744466",
"0.4744428",
"0.47414726",
"0.47395942",
"0.47362155",
"0.47346228",
"0.4729303",
"0.47287378",
"0.47275525",
"0.47182158",
"0.47161242",
"0.47142956",
"0.47087908",
"0.4695072",
"0.4684428",
"0.46794054"
] | 0.8547635 | 0 |
Update disable_alerting status of Device Group | def disable_alerting=(value)
start = Time.now
debug "Updating disable_alerting setting for device group: \"#{resource[:full_path]}\""
connection = self.class.get_connection(resource[:account])
update_device_group(connection,
resource[:full_path],
resource[:description],
resource[:properties],
value)
debug "Finished in #{(Time.now-start)*1000.0} ms"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disable_alerting\n start = Time.now\n debug \"Checking disable_alerting setting for device group: \\\"#{resource[:full_path]}\\\"\"\n connection = self.class.get_connection(resource[:account])\n device_group = get_device_group(connection, resource[:full_path],'disableAlerting')\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n device_group['disableAlerting'].to_s\n end",
"def update_device_group(connection, fullpath, description, properties, disable_alerting)\n device_group = get_device_group(connection, fullpath, 'id,parentId')\n device_group_hash = build_group_json(fullpath,\n description,\n properties,\n disable_alerting,\n device_group['parentId'])\n update_device_group = rest(connection,\n Puppet::Provider::Logicmonitor::DEVICE_GROUP_ENDPOINT % device_group['id'],\n Puppet::Provider::Logicmonitor::HTTP_PATCH,\n build_query_params(nil, nil, -1, device_group_hash.keys),\n device_group_hash.to_json)\n valid_api_response?(update_device_group) ? debug(update_device_group) : alert(update_device_group)\n end",
"def disable_group(group)\n @event_groups[group] = false\n end",
"def disable_alert_feature \n put(\"/globalsettings.json/alerts/disable\")\nend",
"def set_group_status(*groups, enable, except: nil, include_system: false)\n if enable\n enable_group(*groups, except: except)\n else\n disable_group(*groups, except: except, include_system: include_system)\n end\n end",
"def disable(key)\n @status[key] = :disabled\n end",
"def create_disabled_changed_alert\n if @property_channel.disabled?\n PropertyChannelDisabledAlert.create_for_property(@property_channel)\n else\n PropertyChannelEnabledAlert.create_for_property(@property_channel)\n end\n end",
"def disable_all_alerts\n self.service_subscriptions.each do |subscription|\n subscription.update_attribute :sms_enabled, false\n subscription.update_attribute :email_enabled, false\n end\n end",
"def disabled_warnings=(new_disabled_warnings)\n Dynamic[:disabled_warnings] = new_disabled_warnings\n end",
"def intelligent_disable(pks)\n todisable = intelligent_nodeps(pks, :disable, :cant_disable, true)\n logger.info 'COMPONENTS WITHOUT DEPENDENCIES: ' + todisable.to_s\n not_found_vnfds = set_vnfds_status(todisable[:disable][:vnfds], 'inactive')\n not_found_nsds = set_nsds_status(todisable[:disable][:nsds], 'inactive')\n set_pd_status(pks, 'inactive')\n if ( not_found_vnfds.length == 0 ) and ( not_found_nsds.length == 0 )\n logger.debug \"Catalogue: leaving DISABLE /api/v2/packages?#{query_string}\\\" with PD #{pks}\"\n halt 200, JSON.generate(result: todisable)\n else\n logger.debug \"Catalogue: leaving DISABLE /api/v2/packages?#{query_string}\\\" with PD #{pks}\"\n logger.info \"Some descriptors where not found \"\n logger.info \"Vnfds not found: \" + not_found_vnfds.to_s\n logger.info \"Nsds not found: \" + not_found_nsds.to_s\n halt 404, JSON.generate(result: todisable,\n not_found: { vnfds: not_found_vnfds, nsds: not_found_nsds })\n end\n end",
"def disabled_by_microsoft_status=(value)\n @disabled_by_microsoft_status = value\n end",
"def enable_group(group)\n @event_groups[group] = true\n end",
"def change_to_disable\n @driver.find_element(xpath: @status_option).click\n end",
"def disable\n authorize! @user\n @user.enabled = false\n @user.save\n @user.owned_extensions.update_all(enabled: false)\n redirect_to root_path, notice: t(\"user.disabled\", name: @user.username)\n end",
"def disable_alert(alert_name, project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'PUT'\n\t\targs[:path]['AlertName'] = alert_name\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/alerts/[AlertName]/disable'\n\t\targs[:query]['Action'] = 'DisableAlert'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tself.run(args)\n\tend",
"def enable_alert_feature \n put(\"/globalsettings.json/alerts/enable\")\nend",
"def disable_polling(reason = nil)\n self.deactivate\n self.deactivation_reason = reason.to_s\n self.deactivated_at = Time.now\n self.save!\n end",
"def disable\n if enabled?\n Cratus::LDAP.replace_attribute(\n dn,\n Cratus.config.user_account_control_attribute,\n ['514']\n )\n refresh\n else\n true\n end\n end",
"def disableChecker(id)\n @availableCheckers.collect {|x| x.enabled = false if x.id == id} \n end",
"def suspend!\n self.update_attribute(:status, SUSPENDED)\n self.registration.update_attribute(:status, SUSPENDED) if self.registration\n end",
"def disable_app(app,enable='no')\n results = submit_cmd('update app instance',\"-env #{self.env} -app_instance #{app.name} -new_enabled #{enable}\")\n puts \"Changing enalbed status on #{app.name} from #{app.attributes[:enabled]} to: #{enable}\"\n app.attributes[:enabled] = enable\n end",
"def revoke_on_unenroll_disabled=(value)\n @revoke_on_unenroll_disabled = value\n end",
"def disable\n run \"#{try_sudo} /sbin/chkconfig puppet off\"\n end",
"def deactivate!\n update_attribute('contact_status__c','Inactive')\n end",
"def disable!\n @disabled = true\n end",
"def onupdate_unregister(b)\n b = @onupdate_list.find { |bb| bb.description == b } if b.kind_of?(String)\n @onupdate_list.delete b\n if @onupdate_list.empty?\n DFHack.onupdate_active = false\n DFHack.onupdate_minyear = DFHack.onupdate_minyeartick = DFHack.onupdate_minyeartickadv = -1\n end\n end",
"def disable\n @disabled = true\n end",
"def onupdate_unregister(b)\n @onupdate_list.delete b\n if @onupdate_list.empty?\n DFHack.onupdate_active = false\n DFHack.onupdate_minyear = DFHack.onupdate_minyeartick = 0\n end\n end",
"def monitoring_enabled=(value)\n if value\n client.monitor_instances(:instance_ids => [id])\n true\n else\n client.unmonitor_instances(:instance_ids => [id])\n false\n end\n end",
"def work_profile_block_notifications_while_device_locked=(value)\n @work_profile_block_notifications_while_device_locked = value\n end",
"def enable(key)\n @status[key] = :prohibited\n end",
"def disable\n @office = Office.find(params[:id])\n authorize! :update, @office\n \n @office.active_flag = 0\n\n track_event(\"Disabled Listing\");\n\n respond_to do |format|\n if @office.save\n format.html { redirect_to office_path(@office), notice: \"This listing has been successfully disabled.\" }\n format.json { head :no_content }\n else \n flash[:error] = 'Your office could not be disabled. Please contact us at [email protected] for assistance.'\n format.html { redirect_to office_path(@office) }\n format.json { head :no_content }\n end\n end\n end",
"def attempts_before_deactivation=(value)\n return false unless @enabled\n update(:type => self.type, :attempts_before_deactivation => value)\n end",
"def uninstall_on_device_removal=(value)\n @uninstall_on_device_removal = value\n end",
"def may_update_group?(group)\n\t\t\tmay_administrate? || is_group_moderator?(group)\n\t\tend",
"def emergency!\n self.severity = :EMERGENCY\n end",
"def block!\n self.update_attribute(:status, ConfigCenter::User::BLOCKED)\n end",
"def enable_all_alerts\n self.service_subscriptions.each do |subscription|\n subscription.update_attribute :sms_enabled, true\n subscription.update_attribute :email_enabled, true\n end\n end",
"def disable!\n @active = false\n change_status(:disabled)\n end",
"def enable_group(*groups, except: nil)\n set_service_groups_status(true, *groups, except: except)\n end",
"def disable!\n @enabled = false\n end",
"def disable\n @service.disabled = true\n end",
"def disable_threshold\n @enable_threshold = false\n end",
"def disabled=(val)\n @@lock.synchronize { @@disabled = val }\n end",
"def disable\n admin_only do\n handle_recurring_schedule_failure 'disable', 'disabled' do\n # get the schedule object to be disabled.\n @test = get_test_with_rescue\n @test.active = nil\n @test.save!\n end\n redirect_to action: \"index\"\n end\n end",
"def handle_disabled\n @was_disabled = true\n cancel_associated_job!\n\n refs_pointing_to_self = ModelReference.find_references_to(self)\n refs_pointing_to_self.update_all(disabled: true)\n end",
"def reject\n self.update_attributes(:status => REJECTED)\n end",
"def enemy_change_group(id, group_id)\n # transform all existing target enemies\n get_enemies(id).each {|e| e.ai.setup_group(group_id) if e.battler != nil}\n end",
"def check_puppet_status(group)\n @service.class_filter group\n begin\n @service.status(:service => 'puppet').each do |rpcresult|\n # Check if puppet is disabled\n hostname = rpcresult.results[:sender]\n if rpcresult.results[:data][:status] != \"stopped\"\n raise PuppetEnabledException, hostname\n end\n end\n ensure\n # Make sure we reset the filter after a run\n @service.reset_filter\n end\nend",
"def disabled_warnings\n Dynamic[:disabled_warnings]\n end",
"def disable\n @enabled = false\n end",
"def unban\n self.enabled = true\n save\n end",
"def disable!\n @enabled = false\n end",
"def disable_switch_data(pwnfx_scope)\n pwnfx_tag_id = pwnfx_scope + '_field'\n { pwnfx_disable_scope: pwnfx_scope, pwnfx_disable: pwnfx_tag_id,\n pwnfx_disable_trigger: 'checked' }\n end",
"def denied\n\t\t# Picked a random lender application and temporary set it's status to denied\n\t\tlender_app \t\t\t= LenderApplication.first\n\t\tlender_app.status \t= 'denied'\n\t\tLenderApplicationsMailer.updated(lender_app)\n\t\n\tend",
"def disable_autogrow\n change_autogrow_status_link.click\n autogrow_status_select.select('No')\n submit_autogrow_status_btn.click\n wait_until{ success_messages == \"Autogrow protection disabled.\" }\n end",
"def set_admin_device_status\n @device_status = DeviceStatus.find(params[:id])\n end",
"def disable_password_reset(username, first, last, app,config)\n puts \" Setting password reset to false for |#{username}|.\" if $options.verbose\n # need to get the admin setting code put in place NOTENOTENOTE\n # if config['source']['admins'].include?(nickname)\n # admin = true\n # else\n # admin = false\n # end\n admin = false\n begin\n result = app.provision.update_user(username, first, last, nil, nil, admin.to_s, nil, \"false\", nil )\n STDERR.puts \"Result: #{result}\" if $options.debug\n update = true\n rescue GData::GDataError => e\n if e.code == \"1300\"\n STDERR.puts \" => Set password reset to false #{username} exists\" if $options.verbose\n update = true\n elsif e.code == \"1000\"\n STDERR.puts \" => setting password reset to false #{username} unknown error\" if $options.verbose\n update = false\n #retry\n else\n STDERR.puts \"Error creating user: #{username}\" if $options.verbose\n raise e\n end\n end\nend",
"def disable_password_reset(username, first, last, app,config)\n puts \" Setting password reset to false for |#{username}|.\" if $options.verbose\n # need to get the admin setting code put in place NOTENOTENOTE\n # if config['source']['admins'].include?(nickname)\n # admin = true\n # else\n # admin = false\n # end\n admin = false\n begin\n result = app.provision.update_user(username, first, last, nil, nil, admin.to_s, nil, \"false\", nil )\n STDERR.puts \"Result: #{result}\" if $options.debug\n update = true\n rescue GData::GDataError => e\n if e.code == \"1300\"\n STDERR.puts \" => Set password reset to false #{username} exists\" if $options.verbose\n update = true\n elsif e.code == \"1000\"\n STDERR.puts \" => setting password reset to false #{username} unknown error\" if $options.verbose\n update = false\n #retry\n else\n STDERR.puts \"Error creating user: #{username}\" if $options.verbose\n raise e\n end\n end\nend",
"def disable_password_reset(username, first, last, app,config)\n puts \" Setting password reset to false for |#{username}|.\" if $options.verbose\n # need to get the admin setting code put in place NOTENOTENOTE\n # if config['source']['admins'].include?(nickname)\n # admin = true\n # else\n # admin = false\n # end\n admin = false\n begin\n result = app.provision.update_user(username, first, last, nil, nil, admin.to_s, nil, \"false\", nil )\n STDERR.puts \"Result: #{result}\" if $options.debug\n update = true\n rescue GData::GDataError => e\n if e.code == \"1300\"\n STDERR.puts \" => Set password reset to false #{username} exists\" if $options.verbose\n update = true\n elsif e.code == \"1000\"\n STDERR.puts \" => setting password reset to false #{username} unknown error\" if $options.verbose\n update = false\n #retry\n else\n STDERR.puts \"Error creating user: #{username}\" if $options.verbose\n raise e\n end\n end\nend",
"def deactivate!\n update(status: false)\n end",
"def disable(id)\n change_status id, false\n end",
"def power_off_blocked=(value)\n @power_off_blocked = value\n end",
"def properties=(value)\n start = Time.now\n debug \"Updating properties for device group: \\\"#{resource[:full_path]}\\\"\"\n connection = self.class.get_connection(resource[:account])\n update_device_group(connection,\n resource[:full_path],\n resource[:description],\n value,\n resource[:disable_alerting])\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n end",
"def disable\n self.stop if self.status == :running\n output = supervisorctl(:remove, @resource[:name])\n rescue Puppet::ExecutionFailure\n raise Puppet::Error, \"Could not disable #{self.name}: #{output}\"\n end",
"def group_health group\n group_status = groups[group]\n service_health group_status\n end",
"def do_notify_disabled(transition)\n if user && Rails.application.settings.enforce_rules\n UserMailer.access_revoked(user, self).deliver_later\n end\n end",
"def update!(**args)\n @enabled = args[:enabled] if args.key?(:enabled)\n @send_message_suppressed = args[:send_message_suppressed] if args.key?(:send_message_suppressed)\n end",
"def update\n begin\n @deptgroup = Deptgroup.find(params[:id])\n\n updated_group = @@data_util.hash_data_to_upper_case(@@data_util.strip_hash_data(params[:dept_group]), ['description'])\n updated_group[:lastupdateby] = session[:username]\n\n if @deptgroup.update_attributes(updated_group)\n @@request_result[:success] = true\n @@request_result[:notice] = 'Department Sub Group was successfully updated.'\n else\n @@request_result[:errormsg] = @deptgroup.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",
"def update\n respond_to do |format|\n if @power_outlet_group.update(power_outlet_group_params)\n format.html { redirect_to @power_outlet_group, notice: 'Power outlet group was successfully updated.' }\n format.json { render :show, status: :ok, location: @power_outlet_group }\n else\n format.html { render :edit }\n format.json { render json: @power_outlet_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def deactivate\n respond_to do |format|\n if @user_badge.update(active: false)\n format.html { redirect_to team_user_path(@team, @user), notice: 'User badge was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_badge }\n else\n format.html { render :edit }\n format.json { render json: @user_badge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mark_failed_with_reason(failed_reason)\n Rails.logger.info(\"user_kyc_whitelist_log - #{self.id} - mark as failed.\")\n self.status = GlobalConstant::KycWhitelistLog.failed_status\n self.failed_reason = failed_reason\n self.save! if self.changed?\n end",
"def vmotion=(value)\n Puppet.debug \"Updating vmotion status flag of specified portgroup.\"\n begin\n setupvmotion\n rescue Exception => e\n fail \"Unable to configure the vMotion on a port group because the following exception occurred: -\\n #{e.message}\"\n end\n end",
"def disable\n Puppet.notice \"Disabling Puppet.\"\n lockfile.lock(:anonymous => true)\n end",
"def update\n respond_to do |format|\n if @employee.update(employee_params)\n (params[:show_level].to_i == 0) ?\n @employee.update_attributes(:group_ids => nil, :level_id => nil) :\n @employee.update_attributes(:group_ids => params[:group][:group_ids])\n Tools.write2log(current_user.id, 'Обновление', 'Сотрудники', 0, employee_params.to_s)\n format.html { redirect_to @employee, notice: 'Сотудник успешно обновлен.' }\n format.json { head :no_content }\n else\n Tools.write2log(current_user.id, 'Обновление', 'Сотрудники', 1, employee_params.to_s)\n format.html { render action: 'edit' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def bypass_inactive_disable\n @attributes[:bypass_inactive_disable]\n end",
"def disable_approval!\n send(:remove_const, :DRAFT_PUNK_IS_SETUP) if const_defined? :DRAFT_PUNK_IS_SETUP\n send(:remove_const, :DRAFT_NULLIFY_ATTRIBUTES) if const_defined? :DRAFT_NULLIFY_ATTRIBUTES\n send(:remove_const, :ALLOW_PREVIOUS_VERSIONS_TO_BE_CHANGED) if const_defined? :ALLOW_PREVIOUS_VERSIONS_TO_BE_CHANGED\n fresh_amoeba do\n disable\n end\n end",
"def disable_vulnerability_alerts(repo, options = {})\n opts = ensure_api_media_type(:vulnerability_alerts, options)\n boolean_from_response(:delete, \"#{Repository.path repo}/vulnerability-alerts\", opts)\n end",
"def remove_group_watcher(group)\n return nil unless group && group.is_a?(Group)\n GroupWatcher.delete_all \"watchable_type = '#{self.class}' AND watchable_id = #{self.id} AND group_id = #{group.id}\"\n end",
"def set_all(status, except: {})\n @status.transform_values! { |v| v = status unless v == :disabled }\n except[:exceptions].each do |k|\n @status[k] = except[:status] unless @status[k] == :disabled\n end\n end",
"def update!(**args)\n @aag_config_disabled = args[:aag_config_disabled] if args.key?(:aag_config_disabled)\n end",
"def disable_approval!\n send(:remove_const, :DRAFT_PUNK_IS_SETUP) if const_defined? :DRAFT_PUNK_IS_SETUP\n send(:remove_const, :DRAFT_NULLIFY_ATTRIBUTES) if const_defined? :DRAFT_NULLIFY_ATTRIBUTES\n fresh_amoeba do\n disable\n end\n end",
"def admin_status_update(update)\n return unless update\n\n PaperTrail.request(enabled: false) do\n update_unless_locked_by_registrant(update)\n update_not_by_locked_statuses(update)\n end\n\n # check for deleted status\n statuses.each do |s|\n next if update.include? s\n\n case s\n when DomainStatus::PENDING_DELETE\n self.delete_date = nil\n when DomainStatus::SERVER_MANUAL_INZONE # removal causes server hold to set\n self.outzone_at = Time.zone.now if force_delete_scheduled?\n when DomainStatus::EXPIRED # removal causes server hold to set\n self.outzone_at = expire_time + 15.day\n when DomainStatus::SERVER_HOLD # removal causes server hold to set\n self.outzone_at = nil\n end\n end\n end",
"def disable!\n self.enabled = false\n end",
"def disable_updates hosts, opts\n logger = opts[:logger]\n hosts.each do |host|\n next if host['platform'].include?('netscaler')\n\n logger.notify \"Disabling updates.puppetlabs.com by modifying hosts file to resolve updates to 127.0.0.1 on #{host}\"\n set_etc_hosts(host, \"127.0.0.1\\tupdates.puppetlabs.com\\n\")\n end\n end",
"def ban\n update(active: false)\n reporter.update(disallow_reporting: true)\n end",
"def set_service_groups_status(enable, *groups, except: nil)\n exceptions = [*except]\n\n service_list.each do |name, metadata|\n # Skip if service is in exceptions list\n next if (exceptions & metadata[:groups]).any?\n\n # Skip if service does not *exist?*\n next unless exist?(name)\n\n # Find the matching groups among our passed arguments and our current service's groups\n matching_groups = groups & metadata[:groups]\n\n # Set the service enable config if:\n # The current service has matching groups that were requested to be set\n # OR\n # ALL_GROUPS was requested, so we are setting them all\n set_service_status(name, enable) if matching_groups.any? || groups.include?(ALL_GROUPS)\n end\n end",
"def group_admins_enabled\n @attributes[:group_admins_enabled]\n end",
"def set_grace_period_defaultee_status\n if self.group_loan_backlogs.where(:is_paid => false).count != 0 \n self.is_defaultee = true \n self.save \n end\n end",
"def update\n @registration_whitelabel_group = Registration::WhitelabelGroup.find(params[:id])\n\n respond_to do |format|\n if @registration_whitelabel_group.update_attributes(params[:registration_whitelabel_group])\n format.html { redirect_to @registration_whitelabel_group, notice: 'Whitelabel group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @registration_whitelabel_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mark_as_offensive\n self.update_attribute(:status, 1)\n end",
"def bit_locker_disable_warning_for_other_disk_encryption=(value)\n @bit_locker_disable_warning_for_other_disk_encryption = value\n end",
"def miqAlarmSpecDisabled\n alarmSpec = @miqAlarmSpecEnabled.clone\n alarmSpec.enabled = \"false\"\n (alarmSpec)\n end",
"def update_room_status\n room.update(:is_available => false)\n end",
"def alert=(value)\n self.state = { :alert => value }\n end",
"def disabled=(value)\n `#{@el}.disabled = #{value}`\n end",
"def update!(**args)\n @enable_failure_email = args[:enable_failure_email] if args.key?(:enable_failure_email)\n end",
"def package_dropped_off\n self.status = CONSTANT['BOX_RETURNED']\n self.package.user.send_dropped_off_notification\n self.package.status = CONSTANT['PACKAGE_DROPPED_OFF_DROP_OFF']\n if self.package.save\n if self.save\n if self.permissions\n self.permissions.each do |p|\n p.employee.push_operator_info self.locker.name, self.name\n end\n end\n return true\n end\n end\n return false\n end",
"def update\n @record_group = RecordGroup.find(params[:id])\n @record_group.accessible = :all if admin?\n respond_to do |format|\n if @record_group.update_attributes(params[:record_group])\n flash[:notice] = 'RecordGroup was successfully updated.'\n format.html { redirect_to(@record_group) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @record_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def disable(package)\n wait_until(\"Disabling package\") do\n get \"/invoke/wm.server.packages/packageDisable?package=#{CGI.escape package.to_s}\"\n end\n end"
] | [
"0.80387694",
"0.6416387",
"0.6183336",
"0.61413246",
"0.58565116",
"0.57329226",
"0.57147056",
"0.56291914",
"0.55382824",
"0.5524323",
"0.5500079",
"0.5492993",
"0.54369867",
"0.5432056",
"0.5413198",
"0.5348121",
"0.5259602",
"0.52381265",
"0.5232796",
"0.52298886",
"0.5205592",
"0.520008",
"0.51768994",
"0.517013",
"0.51668715",
"0.51504046",
"0.51454467",
"0.5139394",
"0.5139363",
"0.5102598",
"0.5085709",
"0.5071434",
"0.50647056",
"0.5061787",
"0.5057456",
"0.5056601",
"0.5053512",
"0.5048194",
"0.5047699",
"0.50200665",
"0.50084144",
"0.50014925",
"0.5001485",
"0.49969023",
"0.49962407",
"0.49958098",
"0.49889064",
"0.49880058",
"0.4979722",
"0.49785388",
"0.4974883",
"0.4970138",
"0.4967787",
"0.49605665",
"0.49588892",
"0.4957086",
"0.49566412",
"0.4949558",
"0.4949558",
"0.4949558",
"0.49426728",
"0.49422845",
"0.49412873",
"0.49399897",
"0.49319574",
"0.4920319",
"0.49092576",
"0.4908935",
"0.4895659",
"0.48916128",
"0.48871505",
"0.48854122",
"0.48714802",
"0.48709208",
"0.48626938",
"0.48574027",
"0.48485386",
"0.48436466",
"0.483821",
"0.4833425",
"0.48298827",
"0.48279554",
"0.48264942",
"0.4824333",
"0.4821528",
"0.48124185",
"0.48089236",
"0.4805467",
"0.48032892",
"0.48021135",
"0.4800278",
"0.47972584",
"0.47971362",
"0.4794552",
"0.4793388",
"0.47912666",
"0.47858918",
"0.47809878",
"0.477942",
"0.47766793"
] | 0.83525395 | 0 |
Retrieve Properties for device group (including password properties) | def properties
start = Time.now
debug "Checking properties for device group: \"#{resource[:full_path]}\""
connection = self.class.get_connection(resource[:account])
properties = Hash.new
device_group = get_device_group(connection, resource[:full_path], 'id')
if device_group
device_group_properties = rest(connection,
Puppet::Provider::Logicmonitor::DEVICE_GROUP_PROPERTIES_ENDPOINT % device_group['id'],
Puppet::Provider::Logicmonitor::HTTP_GET,
build_query_params('type:custom,name!:system.categories,name!:puppet.update.on',
'name,value'))
if valid_api_response?(device_group_properties, true)
device_group_properties['data']['items'].each do |property|
name = property['name']
value = property['value']
if value.include?('********') && resource[:properties].has_key?(name)
debug 'Found password property. Verifying'
verify_device_group_property = rest(connection,
Puppet::Provider::Logicmonitor::DEVICE_GROUP_PROPERTIES_ENDPOINT % device_group['id'],
Puppet::Provider::Logicmonitor::HTTP_GET,
build_query_params("type:custom,name:#{name},value:#{value}", nil, 1))
if valid_api_response?(verify_device_group_property)
debug 'Property unchanged'
value = resource[:properties][name]
else
debug 'Property changed'
end
end
properties[name] = value
end
else
alert device_group_properties
end
else
alert device_group
end
debug "Finished in #{(Time.now-start)*1000.0} ms"
properties
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_properties()\n resp = conn.get('/users/'+name+'/props/')\n \n case resp.code.to_i\n when 200\n return JSON.parse(resp.body)\n when 404\n raise RestAuthUserNotFound.new( resp )\n else\n raise RestAuthUnknownStatus.new( rest )\n end\n end",
"def properties=(value)\n start = Time.now\n debug \"Updating properties for device group: \\\"#{resource[:full_path]}\\\"\"\n connection = self.class.get_connection(resource[:account])\n update_device_group(connection,\n resource[:full_path],\n resource[:description],\n value,\n resource[:disable_alerting])\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n end",
"def get_device_group_list\n query_api('device-groups')\n end",
"def properties_via(group)\n properties = []\n property_relations_via(group).each do |relationship|\n property = relationship.property\n properties.push(property)\n end\n properties\n end",
"def attributes_from_group\n group_attributes = {}\n self.ldap_attribute_map.each do |ldap_attr, attr|\n group_attributes[ldap_attr] = attr.is_a?(Proc) ? attr.call(self.group) : self.group[attr]\n end\n group_attributes\n end",
"def get_group_device_list(ent,group,dev_type=nil)\n oci_cmd = :GroupAccessDeviceGetListRequest\n config_hash = GroupAccessDeviceGetListRequest(ent,group,dev_type)\n table_header = 'accessDeviceTable'\n response_hash,cmd_ok = get_table_response(oci_cmd,table_header,config_hash)\n\n return cmd_ok,response_hash\n end",
"def get_protection_properties(name, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = get_protection_properties_with_http_info(name, password, folder, storage)\n data\n end",
"def password\n\t\tbegin\n\t\t\tr = curl '-s', '-u', \"#{@resource[:name]}:#{@resource[:password]}\",\n\t\t\t\t\"http://localhost:#{@resource[:mgmt_port]}/api/whoami\"\n\t\t\tdebug r\n\t\trescue\n\t\t\traise \"Management plugin not reachable at localhost:%s\" % @resource[:mgmt_port]\n\t\tend\n\t\trh = JSON.parse r\n\t\t\n\t\tif( rh.key?(:name) and rh[:name] == @property_hash[:name] )\n\t\t\treturn @resource[:password]\n\t\tend\n\t\t\n\t\tif ( rh['error'] == 'not_authorised' and rh['reason'] == 'Not management user' )\n\t\t\treturn @resource[:password]\n\t\telse\n\t\t\treturn ''\n\t\tend\n\tend",
"def device_properties(id, params={})\n put(\"/devices/#{id}/properties\", params)\n end",
"def device_group_params\n params.require(:device_group).permit(:name, :icon, properties_attributes: [:id, :name, :style, :unit, :values, :fa_style])\n end",
"def get_device_list_for_group(device_group_id)\n path = \"device-groups/#{device_group_id}/devices\"\n query_api(path)\n end",
"def update_device_properties()\n return MicrosoftGraph::DeviceManagement::WindowsAutopilotDeviceIdentities::Item::UpdateDeviceProperties::UpdateDevicePropertiesRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def list(filter, pager=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'filter', filter)\n\t\t\tclient.add_param(kparams, 'pager', pager)\n\t\t\tclient.queue_service_action_call('configurationgroupdevice', 'list', 'KalturaConfigurationGroupDeviceListResponse', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def get_properties(options={})\n return send_message(SkyDB::Message::GetProperties.new(options))\n end",
"def property_details\n @property_details ||= Hash.new.tap do |result|\n details.each do |detail|\n detail.group_content.each do |group|\n title = group.title.text\n key = title.titleize.delete(' ').underscore\n break unless keys_white_list.include? key\n items = []\n group.items.each { |item| items << item.text }\n result[key.to_sym] = items unless items.empty?\n end\n end\n end\n end",
"def add_properties\n cmd = []\n # validproperties is a list of properties in undefined order\n # sort them to have a predictable command line in tests\n Puppet::Type.type(:user).validproperties.sort.each do |property|\n value = get_value_for_property(property)\n next if value.nil? || property == :password\n # the value needs to be quoted, mostly because -c might\n # have spaces in it\n cmd << flag(property) << munge(property, value)\n end\n cmd\n end",
"def list_group_mem(group)\n\t\tdevisor = \"-------------------------------------------------------------------------------\\r\\n\"\n\t\traw_list = client.shell_command_token(\"net localgroup #{group}\").split(devisor)[1]\n\t\taccount_list = raw_list.split(\"\\r\\n\")\n\t\taccount_list.delete(\"The command completed successfully.\")\n\t\treturn account_list\n\tend",
"def sudo_group()\n\t\t\treturn @metadata.attributes[:sudo_group]\n\t\tend",
"def description\n start = Time.now\n debug \"Checking description for device group: \\\"#{resource[:full_path]}\\\"\"\n connection = self.class.get_connection(resource[:account])\n device_group = get_device_group(connection, resource[:full_path],'description')\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n device_group['description']\n end",
"def get_attribute_group(id)\n @client.raw('get', \"/config/attribute-groups/#{id}\")\n end",
"def raw_system_properties(addr, user, password)\n http_get(\n addr,\n '/system/console/status-System%20Properties.txt',\n user,\n password\n ).body\n end",
"def fetch_properties(host)\n fetcher = Commands::PropertiesFetcher.new(credentials)\n fetcher.call(mc_id: host.identifier)\n end",
"def get_group_supportedfields()\n @restv9.get_groups_supportedFields()\n end",
"def group\n attribute_prop(7)\n end",
"def group_admin\n @attributes[:group_admin]\n end",
"def get_properties()\n return @properties\n end",
"def properties\n @properties ||=\n Hash[Array(@grpc.properties).map { |p| [p.name, p.value] }]\n end",
"def propname_properties\n props = self.properties\n if supports_locking?\n props = props.dup if props.frozen?\n props << { name: 'lockdiscovery', ns_href: DAV_NAMESPACE }\n end\n props\n end",
"def get_mobile_device()\n res = self.send_request 'get_mobile_device'\n device_info_xml = REXML::Document.new(res.body).root\n rez ={}\n device_info_xml.elements.each do |el|\n rez.merge! Hash[el.name.to_s,el.text.to_s]\n end\n return rez\n end",
"def update\n if params[:device_group][:property_ids]\n params[:device_group][:property_ids].each do |property_id|\n @property = Property.find(property_id)\n @device_group.properties << @property\n end\n end\n respond_to do |format|\n if @device_group.update(device_group_params)\n format.html { redirect_to @device_group, notice: 'Device group was successfully updated.' }\n format.json { render :show, status: :ok, location: @device_group }\n format.js {\n @device_groups = DeviceGroup.all\n render :update\n }\n else\n format.html { render :edit }\n format.json { render json: @device_group.errors, status: :unprocessable_entity }\n format.js {\n @device_groups = DeviceGroup.all\n render :update\n }\n end\n end\n end",
"def get_group_vals(group)\n\t\treturn Group.get_value(group, @system).value.split(\",\")\n\tend",
"def group_get_info(attribs, dir_info)\n attribs = group_record_name_alternatives(attribs)\n\n check_critical_attribute( attribs, :record_name )\n\n command = {action: 'read', scope: 'Groups', value: nil}\n user_attrs = attribs.merge(command)\n\n dscl( user_attrs, dir_info )\n end",
"def get_group_device_list_by_type(ent,group,dev_type_list)\n oci_cmd = :GroupAccessDeviceGetListRequest\n table_header = 'accessDeviceTable'\n\n devices_list = Array.new\n dev_type_list.each do |dev|\n config_hash = send(oci_cmd,ent,group,dev)\n device_list,cmd_ok = get_table_response(oci_cmd,table_header,config_hash)\n devices_list += device_list \n end\n\n return devices_list\n end",
"def permitted_attributes\n [:user_id, :group_id, :node_id, :name, :device_type_id, :body, :image,\n authorized_hosts_attributes:\n %i[id name address_mac address_ipv6 address_ipv4 comment _destroy],\n interfaces_attributes: %i[id code name network_id address_ipv6 address_ipv4\n address_mac _destroy],\n device_properties_attributes: %i[id device_property_type_id\n device_property_option_id value _destroy]]\n end",
"def OPCGroups()\r\n ret = _getproperty(0, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def properties\n @properties\n end",
"def get_server_properties\n http_get(:uri=>\"/server/properties\", :fields=>x_cookie)\n end",
"def property_group_params\n params.fetch(:property_group, {}).permit(:name, :description)\n end",
"def get_properties_with_http_info(did, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DevicesManagementApi.get_properties ...\"\n end\n # verify the required parameter 'did' is set\n fail ArgumentError, \"Missing the required parameter 'did' when calling DevicesManagementApi.get_properties\" if did.nil?\n # resource path\n local_var_path = \"/devicemgmt/devices/{did}/properties\".sub('{format}','json').sub('{' + 'did' + '}', did.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'includeTimestamp'] = opts[:'include_timestamp'] if !opts[:'include_timestamp'].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 => 'MetadataEnvelope')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DevicesManagementApi#get_properties\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def provision_groups\n @attributes[:provision_groups]\n end",
"def readProperties\n @propertiesFile = \"#{File.expand_path(File.dirname($0))}/../../conf/ddbt.properties\"\n @properties = {}\n IO.foreach(@propertiesFile) do |line|\n @properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)\\/\\/(.*)/ || line =~ /([^=]*)=(.*)/\n end\nend",
"def option_group_option_settings\n data.option_group_option_settings\n end",
"def get_ui_properties(language_id, last_date_update)\n request('getUIProperties', {\n accessKeyCode: @access_key_code,\n languageId: language_id,\n osType: @os_type,\n lastDateUpdate: last_date_update,\n })\n end",
"def get_group\n send_request(FUNCTION_GET_GROUP, [], '', 4, 'k4')\n end",
"def get(udid)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'udid', udid)\n\t\t\tclient.queue_service_action_call('configurationgroupdevice', 'get', 'KalturaConfigurationGroupDevice', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def all_info\n LdapUser.retrieve_all_information self.login \n end",
"def query_properties_with_http_info(dtid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DevicesManagementApi.query_properties ...\"\n end\n # verify the required parameter 'dtid' is set\n fail ArgumentError, \"Missing the required parameter 'dtid' when calling DevicesManagementApi.query_properties\" if dtid.nil?\n # resource path\n local_var_path = \"/devicemgmt/devices/properties\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'dtid'] = dtid\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'includeTimestamp'] = opts[:'include_timestamp'] if !opts[:'include_timestamp'].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 => 'MetadataQueryEnvelope')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DevicesManagementApi#query_properties\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def properties\n return @properties\n end",
"def properties\n @properties\n end",
"def retrieve_groups_from_ldap\n LdapUser.retrieve_groups self.login\n end",
"def command_get_device_info(command)\n\t\tcommand_get_device(command)\n\t\tif @device\n\t\t\tmessage(\" #{@device.description}\")\n\t\t\[email protected] {|name,window| message(\" #{name}: #{window.info}\")}\n\t\tend\n\tend",
"def provision_group_admin_groups\n @attributes[:provision_group_admin_groups]\n end",
"def get_properties\n xml = client.call(\"#{attributes[:url]}/property\").parsed_response\n xml.css('properties property').map { |p| Vebra::Property.new(p, self) }\n end",
"def ldap\n @attributes[:ldap]\n end",
"def list_domain_group_mem(group)\n\t\taccount_list = []\n\t\tdevisor = \"-------------------------------------------------------------------------------\\r\\n\"\n\t\traw_list = client.shell_command_token(\"net groups \\\"#{group}\\\" /domain\").split(devisor)[1]\n\t\traw_list.split(\" \").each do |m|\n\t\t\taccount_list << m\n\t\tend\n\t\taccount_list.delete(\"The command completed successfully.\")\n\t\treturn account_list\n\tend",
"def OPCGroups()\r\n ret = @dispatch._getproperty(0, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def properties\n _properties\n end",
"def set_property_group\n @property_group = PropertyGroup.find(params[:id])\n end",
"def read_settings(uuid = @uuid)\n vm = json { execute_prlctl('list', uuid, '--info', '--no-header', '--json') }\n vm.last\n end",
"def fields\n properties.keys.map(&:to_sym)\n end",
"def fields\n properties.keys.map(&:to_sym)\n end",
"def fields\n @properties.dup.delete_if{|item| item.to_s.start_with?('_sm_')}\n end",
"def get_view_properties(name, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = get_view_properties_with_http_info(name, password, folder, storage)\n data\n end",
"def group_get(name)\n execute(\"dscacheutil -q group -a name #{name}\") do |result|\n fail_test \"failed to get group #{name}\" unless /^name: #{name}/.match?(result.stdout)\n gi = {} # group info\n result.stdout.each_line do |line|\n pieces = line.split(': ')\n gi[pieces[0].to_sym] = pieces[1].strip if pieces[1] != nil\n end\n answer = \"#{gi[:name]}:#{gi[:password]}:#{gi[:gid]}\"\n\n yield answer if block_given?\n answer\n end\n end",
"def device_configuration\n return @device_configuration\n end",
"def logical_properties(disks)\n properties = Mash.new\n disks.each do |disk|\n property = Mash.new\n drive = disk[\"deviceid\"]\n property[:kb_size] = disk[\"size\"].to_i / 1000\n property[:kb_available] = disk[\"freespace\"].to_i / 1000\n property[:kb_used] = property[:kb_size] - property[:kb_available]\n property[:percent_used] = (property[:kb_size] == 0 ? 0 : (property[:kb_used] * 100 / property[:kb_size]))\n property[:mount] = disk[\"name\"]\n property[:fs_type] = disk[\"filesystem\"].to_s.downcase\n property[:volume_name] = disk[\"volumename\"].to_s.downcase\n properties[drive] = property\n end\n properties\n end",
"def cmd_getprivs(*args)\n if args.include? \"-h\"\n cmd_getprivs_help\n end\n\n table = Rex::Text::Table.new(\n 'Header' => 'Enabled Process Privileges',\n 'Indent' => 0,\n 'SortIndex' => 1,\n 'Columns' => ['Name']\n )\n\n client.sys.config.getprivs.each do |priv|\n table << [priv]\n end\n\n print_line\n print_line(table.to_s)\n end",
"def properties\n self.class.properties.keys\n end",
"def props\n ret = {\"_neo_id\" => getId()}\n iter = getPropertyKeys.iterator\n while (iter.hasNext) do\n key = iter.next\n ret[key] = getProperty(key)\n end\n ret\n end",
"def getProperties\n @widget = Widget.find(params[:id])\n wtype = WidgetType.find(@widget.widget_type_id)\n\n # Return a hash of properties obtained from each source\n # TBD: Currently used for cal widget. Can be used to send authentication tokens\n srcdata = {}\n str2lst(@widget.sources).each do |source_id|\n src = Source.find(source_id)\n sdata = src.getProperties()\n #logger.debug(\"getProperties():sdata = #{sdata}\")\n srcdata[source_id] = sdata\n end\n\n data = {:srcdata => srcdata}\n #logger.debug(\"getProperties():data = #{data}\")\n\n # The final returned hash looks like this\n # data -> {\n # srcdata -> { ... },\n # };\n render :json => {:data => data}\n end",
"def get_device_info\n IO.popen('adb shell getprop ro.product.brand') { |f| $device = f.gets.chomp.upcase}\n $device += ' '\n IO.popen('adb shell getprop ro.product.model') { |f| $device += f.gets.chomp.upcase}\n IO.popen('adb shell getprop ro.build.version.release') { |f| $os_version = f.gets.chomp.upcase}\n return $device, $os_version\nend",
"def properties(ctx)\n properties = Properties.new()\n ctx.each { |key, value| properties.put(key, value) }\n return properties\n end",
"def property_keys\n headers = { 'Accept' => 'application/json; charset=UTF-8' }\n get_request 'propertykeys', headers\n end",
"def get_password_data(instance_id)\n request(\n 'Action' => 'GetPasswordData',\n 'InstanceId' => instance_id,\n :idempotent => true,\n :parser => Fog::Parsers::AWS::Compute::GetPasswordData.new\n )\n end",
"def query_device_management\n @devices = query(\"select * from device_management \")\n end",
"def all_auth(group)\n return nil unless AUTH_STRINGS.has_key? group\n @users.select {|_, auth| auth == group}.keys\n end",
"def get_device_capabilities\n url = \"#{settings.FQDN}/1/devices/tel:#{session[:dc_address]}/info?\"\n\n # access_token\n url += \"access_token=#{session[:dc_access_token]}\"\n\n RestClient.get url do |response, request, code, &block|\n @r = response\n end\n \n if @r.code == 200\n @result = JSON.parse @r\n else\n @error = @r\n end\n\nrescue => e\n @error = e.message\nensure\n return erb :dc\nend",
"def query\n self.class.instances.each do |pkg|\n return pkg.properties if pkg.name == @resource[:name]\n end\n return nil\n end",
"def producer\n #f = @properties.field('PRODID')\n #f && f.to_text\n @properties.text('PRODID').first\n end",
"def retrieve\n if not @perm_values then\n if not File.readable?(\"#{@perm_target}/tasks\") then\n raise Puppet::Error, \"You do not appear to have a cgroup mounted at '#{@perm_target}'\"\n end\n\n @perm_values = Hash.new\n\n @perm_values[:task_uid] = File.stat(\"#{@perm_target}/tasks\").uid\n @perm_values[:task_gid] = File.stat(\"#{@perm_target}/tasks\").gid\n\n admin_uid = []\n admin_gid = []\n Dir.glob(\"#{@perm_target}/*\").each do |file|\n next if not File.file?(file)\n next if file == \"#{@perm_target}/tasks\"\n\n admin_uid << File.stat(file).uid\n admin_gid << File.stat(file).gid\n end\n\n # Setting these to blank in the case of a mixed permissions set\n admin_uid.uniq.size == 1 ? @perm_values[:admin_uid] = admin_uid.first : @perm_values[:admin_uid] = \"!!MISMATCH!!\"\n admin_gid.uniq.size == 1 ? @perm_values[:admin_gid] = admin_gid.first : @perm_values[:admin_gid] = \"!!MISMATCH!!\"\n end\n\n @perm_values\n \n end",
"def mdm_windows_information_protection_policies\n return @mdm_windows_information_protection_policies\n end",
"def get_property( propname )\n resp = conn.get('/users/'+name+'/props/'+propname+'/')\n \n case resp.code.to_i\n when 200\n return JSON.parse( resp.body )\n when 404\n case resp.header['resource-type']\n when 'user'\n raise RestAuthUserNotFound.new( resp )\n when 'property'\n raise RestAuthPropertyNotFound.new( resp )\n else\n raise RestAuthBadResponse.new( resp, \"Received 404 without Resource-Type header\" )\n end\n else\n raise RestAuthUnknownStatus.new( resp )\n end\n end",
"def properties\n self.class.get_properties\n end",
"def property_properties\n _property_properties\n end",
"def properties_hash\n hash = {}\n password_keys = $SERVICE_TYPES[self.service_type][PrismeService::TYPE_PROPS].reject do |e| !e[PrismeService::TYPE_TYPE].eql? PrismeService::TYPE_PASSWORD end.map do |e| e['key'] end\n self.service_properties.each do |sp|\n key = sp.key\n value = sp.value\n if (password_keys.include?(key))\n value = CipherSupport.instance.decrypt(encrypted_string: value)\n end\n hash[key] = value unless (value.nil? || value.empty?)\n end\n inferred_properties(hash)\n hash\n end",
"def get_slide_show_properties(name, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = get_slide_show_properties_with_http_info(name, password, folder, storage)\n data\n end",
"def discover\n data[@group]\n end",
"def describe_image_attribute(image_id, attribute='launchPermission')\n image_attr = @ec2.describe_image_attribute(image_id, attribute)\n { :users => image_attr.launchPermission.userIds,\n :groups => image_attr.launchPermission.groups }\n \n rescue Exception\n on_query_exception('describe_image_attribute')\n end",
"def group_info\n group_id_param = params[:group_id]\n\n if group_id_param.nil? || group_id_param.blank?\n render json: { error: 'group_id not specified.' }, status: :bad_request\n return\n end\n\n group = CanvasSpaces.GroupCategory\n .groups\n .where('groups.id = ?', group_id_param)\n .eager_load(:users)\n .first\n if group.nil?\n render json: { error: 'No such group found.' }, status: :not_found\n else\n maillist = get_maillist_for_space(group.id)\n render json: { id: group.id,\n name: group.name,\n description: group.description,\n maillist: maillist,\n leader_id: group.leader_id,\n created_at: group.created_at,\n join_type: display_join_type(group.join_level),\n size: group.users.count\n },\n status: :ok\n end\n end",
"def ldap_secure\n @attributes[:ldap_secure]\n end",
"def getConfigCmd(prop, value)\n\n case prop\n when 'type'\n # 'value' defines type of operation\n type = case\n when value == 'a' : 1\n when value == 'b' : 2\n when value == 'g' : 3\n else\n raise \"Unknown type. Should be 'a', 'b', or 'g'.\"\n end\n return \"iwpriv #{@deviceName} set_mode #{type}\"\n\n when \"mode\"\n # 'value' defines mode of operation\n mode = case\n when value == 'Managed' : 'managed'\n when value == 'managed' : 'managed'\n when value == 'Master' : 'master'\n when value == 'master' : 'master'\n when value == 'ad-hoc' : 'ad-hoc'\n when value == 'adhoc' : 'ad-hoc'\n when value == 'monitor' : 'monitor'\n else\n raise \"Unknown mode '#{value}'. Should be 'managed', or 'ad-hoc'.\"\n end\n return \"iwconfig #{@deviceName} mode #{mode} essid dummy channel 1\"\n\n when \"essid\"\n @essid = value\n return \"iwconfig #{@deviceName} essid #{value}\"\n\n when \"frequency\"\n return \"iwconfig #{@deviceName} freq #{value}\"\n\n when \"tx_power\"\n return \"iwconfig #{@deviceName} txpower #{value}\"\n\n when \"rate\"\n return \"iwconfig #{@deviceName} rate #{value}\"\n\n when \"rts\"\n return \"iwconfig #{@deviceName} rts #{value}\"\n\n when \"channel\"\n return \"iwconfig #{@deviceName} channel #{value}\"\n\n end\n super\n end",
"def get_properties(did, opts = {})\n data, _status_code, _headers = get_properties_with_http_info(did, opts)\n return data\n end",
"def properties(path, ctype=DEFAULT_CTYPE)\n node = metadata(path, ctype, :properties)[:properties]\n node ? node.contents : @metadata_tree.default_data(:properties)\n end",
"def info\n Plist::parse_xml(diskutil 'info', '-plist', @dev_node)\n end",
"def device_description\n return @device_description\n end",
"def getxattrs\n # # file: Scissor_Sisters_-_Invisible_Light.flv\n # user.m.options=\"-c\"\n\n cmd = %w[getfattr -d -m - -e base64] + [realpath.to_s]\n\n attrs = {}\n\n IO.popen(cmd, \"rb\", :err=>[:child, :out]) do |io|\n io.each_line do |line|\n if line =~ /^([^=]+)=0s(.+)/\n key = $1\n value = $2.from_base64 # unpack base64 string\n # value = value.encode(\"UTF-8\", \"UTF-8\") # set string's encoding to UTF-8\n value = value.force_encoding(\"UTF-8\").scrub # set string's encoding to UTF-8\n # value = value.encode(\"UTF-8\", \"UTF-8\") # set string's encoding to UTF-8\n\n attrs[key] = value\n end\n end\n end\n\n attrs\n end",
"def credentials_show\n %x(cat ros/services/iam/tmp/#{Settings.platform.environment.partition_name}/postman/222_222_222-Admin_2.json)\n end",
"def vnc_passwd\n context.fetch(:vnc_passwd, \"vnc.passwd\").to_s\n end",
"def available_properties\n @properties ||= list.properties\n end",
"def get_properties(uuid, opts = {})\n data, _status_code, _headers = get_properties_with_http_info(uuid, opts)\n data\n end"
] | [
"0.60712594",
"0.5910523",
"0.5889344",
"0.5867824",
"0.5826572",
"0.58261967",
"0.5758224",
"0.568512",
"0.55921817",
"0.55417323",
"0.55283237",
"0.5505112",
"0.5427554",
"0.5423174",
"0.54067004",
"0.5398085",
"0.5368259",
"0.5366639",
"0.53529936",
"0.53297323",
"0.52750987",
"0.52544135",
"0.5228933",
"0.5218518",
"0.51979905",
"0.51849395",
"0.5179649",
"0.5177518",
"0.517595",
"0.5171146",
"0.5155804",
"0.51478374",
"0.5140516",
"0.51374125",
"0.5135048",
"0.5126947",
"0.51174885",
"0.5107705",
"0.51032645",
"0.51029587",
"0.5093385",
"0.5090573",
"0.5087381",
"0.50872594",
"0.50851464",
"0.5063566",
"0.5056008",
"0.50509405",
"0.5048927",
"0.50206804",
"0.50185645",
"0.5016835",
"0.50142694",
"0.5005995",
"0.49940124",
"0.49920407",
"0.49850437",
"0.4971119",
"0.4953782",
"0.49520487",
"0.49520487",
"0.49456677",
"0.4936372",
"0.4936205",
"0.4934707",
"0.49314934",
"0.49314472",
"0.49297538",
"0.4928364",
"0.49226293",
"0.49225795",
"0.49168625",
"0.4915191",
"0.49145943",
"0.4909204",
"0.4908986",
"0.49076685",
"0.4901119",
"0.48936102",
"0.4882783",
"0.4878643",
"0.4878309",
"0.48776427",
"0.48739913",
"0.48696733",
"0.48640415",
"0.4857541",
"0.4855886",
"0.4854688",
"0.48429424",
"0.48381558",
"0.48373893",
"0.4831415",
"0.4829799",
"0.4820608",
"0.48187155",
"0.48169452",
"0.48161024",
"0.48159158",
"0.4813066"
] | 0.79790485 | 0 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.