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 |
---|---|---|---|---|---|---|
Explicitly set the name of a queue for the given method route Ex. queue_for :created, "derp.derp" queue_for :updated, "foo.bar" | def queue_for(method, queue_name)
@_queue_names ||= {}
@_queue_names[method] = queue_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def queue_for(clazz, method)\n ClassAndMethodRouting.queue_for(clazz, method)\n end",
"def method_name(queue)\n queue.split(\"__\").last\n end",
"def set_queue\n self.add_queue(queue_name) do |metadata, payload|\n log.info(\"Message received with the routing key: #{metadata.routing_key}\")\n log.debug(\"Processing message with routing key: '#{metadata.routing_key}' and payload: #{payload}\")\n s2_resource = s2_resource(payload)\n route_message(metadata, s2_resource)\n end\n end",
"def queued_method_queue(method)\n nice_queued_method queued_method_queued_key(method), false do\n queued_method_job_queue method\n end\n end",
"def queue( name, &block )\n destination( name, :queue, @queues, &block )\n end",
"def queue\n @handle.queue_name if @handle\n end",
"def queue(queue = 'default')\n get_queue(queue)\n end",
"def name\n @queue_string\n end",
"def queue(\n queue_name,\n url: nil,\n method: nil,\n reservation_sid: nil,\n post_work_activity_sid: nil,\n **keyword_args\n )\n append(Queue.new(\n queue_name,\n url: url,\n method: method,\n reservation_sid: reservation_sid,\n post_work_activity_sid: post_work_activity_sid,\n **keyword_args\n ))\n end",
"def queue(*queues)\n end",
"def queue(queue_name)\n @queues[queue_name]\n end",
"def queued_method_job_queue(method)\n self.send_later :queued_method_job, method\n end",
"def queue( name )\n Qup::Adapter::Kestrel::Queue.new( @addr, name )\n end",
"def queue_for(num)\n \"#{queue}.#{num}\"\n end",
"def queue_key\n queue_name.is_a?(Proc) ? default_queue_key : queue_name.to_sym\n end",
"def queue(*args)\n @queue = args.first unless args.empty?\n (@queue || :default).to_s\n end",
"def request_queue_name(name)\n \"fluffle.requests.#{name}\"\n end",
"def name\n @queue.name\n end",
"def queue(queue, klass, **options)\n check_exists\n SideJob.queue(queue, klass, options.merge({parent: self, by: \"job:#{id}\"}))\n end",
"def queue(queue)\n @configuration.queue = queue\n end",
"def route_prefix_to_method_name(method)\n \"#{route_prefix + \"_\" if route_prefix}#{method}\"\n end",
"def mock_queue(queue_name)\n data[queue_name]\n end",
"def name\n @queue.queue_name\n end",
"def queue_name(name = nil)\n name || self.class.to_s.gsub('Consumer', '')\n end",
"def queue_name\n raise 'queue_name must be ovewritten by the child class'\n end",
"def queue_name\n raise 'queue_name must be ovewritten by the child class'\n end",
"def queued_method_queued_key(method)\n queued_method_key method, 'queued'\n end",
"def routing_key_for(method, routing_key_name)\n @_routing_key_names ||= {}\n @_routing_key_names[method] = routing_key_name\n end",
"def mock_queue!(queue_name)\n mock_queue(queue_name) or raise NotFound.new\n end",
"def url_for queue_name, options = {}\n client_opts = {}\n client_opts[:queue_name] = queue_name\n client.get_queue_url(client_opts.merge(options))[:queue_url]\n end",
"def define_sending_method(name)\n self.class.send(:define_method, name) do |*args|\n @queue.send_message build_method_call(name, *args)\n end\n end",
"def exchange_name\n \"#{worker_class_name}_#{job_method}\".downcase\n end",
"def queue\n @queue ||= QueueManager.fetch(@name,@visibility)\n end",
"def create_queues\n queue\n exchange\n 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 with_queue_control\n TorqueBox::ServiceRegistry.lookup(\"jboss.messaging.default\") do |server|\n yield server.management_service.get_resource(\"jms.queue.#{_dump(nil)}\")\n end\n end",
"def route_for(name, *args); end",
"def schedule_queue_bill(*args)\n self.class.schedule_queue_bill(*args)\n end",
"def update_current_queue new_queue\n log_everything(\"Update current queue\")\n log_everything(\"New queue: \\\"#{new_queue.to_s}\\\"\")\n craft_firebase_command(\"minesweeper/queue.json\", \"PUT\", new_queue)\nend",
"def queue_key\n super || default_queue_key\n end",
"def setup_queue\n queue = Queue.find self.queue_name\n unless queue\n queue = Queue.create _id: self.queue_name\n end\n end",
"def queue(_); end",
"def queue(_); end",
"def queue\n\n @queue ||= channel.queue(*(opt('queue') || [ '' ]))\n end",
"def queue(message); end",
"def name(name, route)\n named_routes[name.to_sym] = route\n route\n end",
"def method_missing(name, *args, &block)\n if [:in, :at, :every, :cron].include? name\n if defined? @@scheduler\n ret = @@scheduler.send(name, *args, &block)\n @jobs << ret\n ret\n else\n @queue << [name, args, block]\n end\n else\n @@scheduler.send(name, *args, &block)\n end\n end",
"def handle\n @queue << \"handle\"\n end",
"def mock_queue(name=nil)\n MockQueue.new(name || \"anonymous-#{rand(2**32).to_s(16)}\")\n end",
"def queue\n @queue ||= channel.queue(queue_name)\n end",
"def queue(queue_name, &block)\n q = create_queue(queue_name)\n block.call(q) if block\n q\n end",
"def blocking_queue_handler queues, meth, timeout=Stella::Worker.queuetimeout\n queues << timeout # We do it this way to support Ruby 1.8\n queue, jobid = *(Stella::SmartQueue.redis.send(meth, *queues) || [])\n return nil if jobid.nil?\n #Stella.ld \"FOUND #{jobid} in #{queue}\"\n jobid\n end",
"def name(name, route)\n @named_routes[name.to_sym] = route\n route\n end",
"def sqs_queue(queue_name)\n SQSQueue.new(queue_name)\n end",
"def default_queue=(queue)\n @queues[nil] = queue\n end",
"def create_queue_name(base_name, priority)\n \"#{base_name}.#{priority}\"\n end",
"def add_queue(queue_name)\n queue = MockQueue.new(queue_name)\n data[queue_name] = queue\n queue\n end",
"def queue_url(*_)\n if Settings.active_job_queue.url\n Settings.active_job_queue.url\n else\n super\n end\n end",
"def [](queue_name_or_url)\n self.new queue_url(queue_name_or_url)\n end",
"def service_name(name)\n @service_queue_name = name\n end",
"def queues\n register_classes\n register_bus\n sorted_queues\n end",
"def route_name; end",
"def route_name; end",
"def queue(name)\n if @@reset_next\n Aws.empty_connection_pools!\n @sqs = nil\n @@reset_next = false\n @sqs_queues = {}\n end\n\n @sqs_queue_urls[name] ||= sqs.get_queue_url(queue_name: name).queue_url\n @sqs_queues[name] ||= Aws::SQS::Queue.new(url: @sqs_queue_urls[name], client: sqs)\n end",
"def queue\n # Probably should be a UUID in the real world\n @queue ||= channel.queue(self.object_id.to_s)\n end",
"def setup_queue\n Thread.current[:carrot] = Carrot.new(:host=>'mediashelf1.dtic.dk')\n @q = Carrot.queue(@queue_name)\n end",
"def stub_retrieving_named_queues\n allow_any_instance_of(AWS::SQS::QueueCollection).to receive(:named).with(an_instance_of(String)).and_return(mocked_queue)\n end",
"def queue() = @queue ||= CommandQueue.new",
"def intended_delivery_method(method)\n if method.to_s =~ /\\A(\\w+)_later\\Z/\n method = $1\n end\n method.to_sym\n end",
"def queue(queue_name, create = true, visibility = nil, &block)\n queues(queue_name) do |queues|\n queue = queues.map do |queue|\n queue.name == queue_name ? queue : nil\n end.compact.first\n if queue\n block.call(queue)\n else\n if queue.nil?\n if create\n req_hash = @interface.generate_request(\n 'CreateQueue', \n 'QueueName' => queue_name,\n 'DefaultVisibilityTimeout' => RightAws::SqsGen2Interface::DEFAULT_VISIBILITY_TIMEOUT\n )\n \n EventMachineAWS.async_http_request(req_hash, RightAws::SqsGen2Interface::SqsCreateQueueParser) do |result|\n #TODO: <?xml version=\\\"1.0\\\"?>\\n<ErrorResponse xmlns=\\\"http://queue.amazonaws.com/doc/2008-01-01/\\\"><Error><Type>Sender</Type><Code>AWS.SimpleQueueService.QueueDeletedRecently</Code><Message>You must wait 60 seconds after deleting a queue before you can create another with the same name.</Message><Detail/></Error><RequestId>5c70ccd9-d3a0-4f90-9161-8c50ee0fc4e8</RequestId></ErrorResponse>\"\n block.call(Queue.new(self, result))\n end\n else\n block.call(nil)\n end\n else\n block.call(queue)\n end\n end\n end\n end",
"def get_queues\n @gem_queue = get_queue 'gem'\n @md5_queue = get_queue 'md5'\n @sha512_queue = get_queue 'sha512'\n end",
"def nonblocking_queue_handler queues, meth\n jobid, queue = nil, nil\n queues.each do |q|\n queue, jobid = q, Stella::SmartQueue.redis.send(meth, q)\n break if ! jobid.nil?\n end\n return nil if jobid.nil?\n #Stella.ld \"FOUND #{jobid} in #{queue}\"\n jobid\n end",
"def queue_key\n result = queue_name\n result = try(:arguments).presence && result.call if result.is_a?(Proc)\n result&.to_sym\n end",
"def enqueue_to(queue, klass, *args); end",
"def on_dequeue(queue_name, &block)\n raise ArgumentError, \"The provided block must accept at least one argument - #{block.inspect} accepts no arguments\" if block.arity.zero?\n @queues[q_name(queue_name)] = block\n end",
"def queue; end",
"def queue; end",
"def update_queue (queue, movie)\n queue.push(movie)\nend",
"def method(method_name)\n \n @_method = method_name.to_s\n \n end",
"def routes_to?(exchange_or_queue, opts = {})\n route = exchange_or_queue.respond_to?(:name) ? exchange_or_queue.name : exchange_or_queue\n rk = opts.fetch(:routing_key, route)\n @routes.key?(rk) && @routes[rk].any? { |r| r == exchange_or_queue }\n end",
"def resolve_queue(key)\n\t\twaiting = request_queue.select { |req| req.key == key.to_i }\n\t\twaiting.each do |w|\n\t\t\tputs \"resolving queue #{request_queue}\"\n\t\t\tsend_message [\"PUT\", key, resource_table[key][0]], 0, w.host, w.port\n\t\t\trequest_queue - [w]\n\t\tend\n\tend",
"def queues\n\t\t\t@queues ||= {}\n\t\tend",
"def relative_queue\n gcp_task\n .name\n .match(%r{/queues/([^/]+)})\n &.captures\n &.first\n &.sub(/^#{self.class.config.gcp_queue_prefix}-/, '')\n end",
"def route_for routename\n case routename\n when 'Start'\n \"index\"\n when 'Login'\n \"login\"\n when 'Mitarbeiterübersicht'\n \"employees\"\n when 'Neuer Mitarbeiter'\n \"employees.new\"\n when 'FAQ'\n \"faq\"\n else\n raise \"No route defined for route named '#{routename}'.\"\n end\nend",
"def setattr(name, value)\n setattribute_raw \"/subsystem=messaging/hornetq-server=default/jms-queue=#{@resource[:name]}\", name, value\n end",
"def overload_amqp\n require MOQUEUE_ROOT + \"moqueue/overloads\"\n end",
"def exchange\n Delayed::Job.tomqueue_manager.channel.exchange(@name,\n :type => @type,\n :auto_delete => @auto_delete,\n :durable => @durable\n )\n end",
"def queues(prefix = nil, &block)\n req_hash = @interface.generate_request('ListQueues', 'QueueNamePrefix' => prefix)\n EventMachineAWS.async_http_request(req_hash, RightAws::SqsGen2Interface::SqsListQueuesParser) do |result|\n block.call(result.map{|name| Queue.new(self, name)})\n end\n end",
"def autogenerated_queues\n @log.info(\"Autogenerating queues\")\n [\n \"#{@queue_prefix}#{@model}\",\n \"#{@queue_prefix}#{@brand}\",\n \"#{@queue_prefix}android\",\n \"#{@queue_prefix}android-#{@os_version}\",\n \"#{@queue_prefix}android-#{@os_version}-#{@model}\"\n ]\n end",
"def command_queue=(value)\n unless command_queue == value\n @configured = false\n @command_queue = value\n end\n end",
"def route_and_method_from_resource_method_and_name_prefix(method, name_prefix)\n route_method = method.to_s.sub(/resource(s)?/) { $1 ? \"#{name_prefix}#{route_name.pluralize}\" : \"#{name_prefix}#{route_name}\" }\n return [ActionController::Routing::Routes.named_routes.get(route_method.sub(/_(path|url)$/,'').to_sym), route_method]\n end",
"def add_queue(queue_name, consumer_name = self.consumer_name)\n database.pgq_create_queue(queue_name.to_s)\n database.pgq_register_consumer(queue_name.to_s, consumer_name.to_s)\n end",
"def queue\n @queue ||= channel.queue(generate_queue_name, exclusive: true)\n end",
"def job_queue_name\n 'email'\n end",
"def job_queue_name\n 'email'\n end",
"def queue_reload(queue)\n raise NotImplementedError\n end",
"def setup(*_)\n @http_path = args.fetch(:path, '/')\n @http_method = args.fetch(:method, 'get').to_s.downcase.to_sym\n super\n if(message_queues[queue_key])\n raise ArgumentError.new \"Conflicting HTTP path source provided! path: #{http_path} method: #{http_method}\"\n else\n message_queues[queue_key] = Smash.new(\n :queue => Queue.new\n )\n end\n message_queues[queue_key].merge!(\n Smash.new(:config => args.to_smash)\n )\n end",
"def register_binding(queue_name, options={})\n name = queue_name.to_s\n opts = options.symbolize_keys\n exchange = (opts[:exchange] || name).to_s\n key = (opts[:key] || name).to_s\n (bindings[name] ||= []) << {:exchange => exchange, :key => key}\n register_exchange(exchange) unless exchanges.include?(exchange)\n queues = exchanges[exchange][:queues]\n queues << name unless queues.include?(name)\n end",
"def set_reply_queue(name)\n raise \"Reply Queue already set\" if reply_queue\n @reply_queue = channel.queue(name, durable: true, auto_delete: true, exclusive: false)\n end",
"def get_current_queue\n log_everything(\"Get current queue\")\n craft_firebase_command(\"minesweeper/queue.json\")\nend"
] | [
"0.6981014",
"0.68962336",
"0.6525915",
"0.6506201",
"0.6461485",
"0.645893",
"0.63431305",
"0.6225817",
"0.62112796",
"0.6160546",
"0.6122204",
"0.6091297",
"0.6089492",
"0.6051676",
"0.6035763",
"0.6011947",
"0.60045457",
"0.5979919",
"0.5968651",
"0.5962902",
"0.59467983",
"0.5944059",
"0.58960426",
"0.5895376",
"0.58863664",
"0.58863664",
"0.58805853",
"0.57518494",
"0.5729009",
"0.5723994",
"0.5723022",
"0.56761324",
"0.56677437",
"0.5651612",
"0.56457645",
"0.55900884",
"0.5570466",
"0.5561593",
"0.5559831",
"0.55457574",
"0.55437875",
"0.5543648",
"0.5543648",
"0.5540081",
"0.5485542",
"0.548429",
"0.5482353",
"0.54790336",
"0.54599017",
"0.54449505",
"0.54409266",
"0.5439171",
"0.5426356",
"0.54242855",
"0.5405194",
"0.54021573",
"0.53959936",
"0.538974",
"0.53817207",
"0.537749",
"0.53572756",
"0.53372204",
"0.53372204",
"0.53306174",
"0.53261334",
"0.52984923",
"0.5279264",
"0.52745",
"0.5269345",
"0.5262959",
"0.52626866",
"0.525756",
"0.52546763",
"0.52408946",
"0.52253205",
"0.5224918",
"0.5224918",
"0.5200287",
"0.51981",
"0.519276",
"0.5189944",
"0.51809555",
"0.5172094",
"0.51677203",
"0.51660776",
"0.51482004",
"0.5143325",
"0.5140664",
"0.51356936",
"0.5126679",
"0.5124789",
"0.5115605",
"0.51118773",
"0.51021945",
"0.51021945",
"0.5100454",
"0.50915146",
"0.5088583",
"0.50817686",
"0.50802255"
] | 0.8305483 | 0 |
Explicitly set the whole routing key to use for a given method route. | def routing_key_for(method, routing_key_name)
@_routing_key_names ||= {}
@_routing_key_names[method] = routing_key_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key(method)\n @_key = method\n end",
"def key_method method\n @key_method = method\n validates_presence_of method\n validates_length_of method, minimum: 1\n define_method(:key) { prepare_key(self.send method) }\n end",
"def routeable(method, opts={})\n ctrlr_m = method.to_sym\n opts[:via] = Array.wrap(opts[:via] || :get).map{|hm|hm.to_sym}\n\n AutoRouter::Router.map_route(self, ctrlr_m, opts)\n end",
"def register_route(method, path, controller, controller_method) \n @routes[method.to_sym][path.to_s] = {\n :controller => controller.to_s,\n :method => controller_method.to_s\n }\n end",
"def routing_key; opt('routing_key'); end",
"def route( key, &block )\n @routes[key] = compile!(\"route_#{key}\", &block)\n end",
"def route_prefix_to_method_name(method)\n \"#{route_prefix + \"_\" if route_prefix}#{method}\"\n end",
"def proxy_across_keytypes(method, key)\n key_registry.send(method, key) || key_registry.send(method, build_key(key))\n end",
"def define_resource_named_route_helper_method(method)\n self.class.send :module_eval, <<-end_eval, __FILE__, __LINE__\n def #{method}(*args)\n send \"#{method}_for_\\#{name_prefix}\", *args\n end\n end_eval\n end",
"def method_missing(method, *params, &block)\n route_macro = self.class.macros[method]\n if route_macro.nil?\n super\n else\n pattern = params.shift || route_macro[:pattern]\n options = route_macro[:options].merge(params.shift || {})\n if !params.empty?\n raise ArgumentError,\n \"wrong number of arguments (#{params.size + 2} for 2)\"\n end\n route(pattern, options)\n end\n end",
"def reroute!(routing_key)\n routing_key, @routing_key = @routing_key, routing_key\n\n begin\n yield if (block_given?)\n ensure\n @routing_key = routing_key\n end\n end",
"def set_route\n #puts \"set route #{params}\"\n @myroute = Route.find(params[:id])\n puts \"set route #{@myroute.inspect}\"\n end",
"def set_key\n self.key = SecureRandom.urlsafe_base64(KEY_LENGTH)\n self.set_key if Url.exists?(key: self.key)\n end",
"def create_route(method, params)\n fail \"No route defined for #{method} on #{name}\" unless routes[method]\n\n url_params = params.dup\n rest_path = routes[method].gsub(/:(\\w+)/) do |m|\n fail SurveyGizmo::URLError, \"Missing RESTful parameters in request: `#{m}`\" unless url_params[$1.to_sym]\n url_params.delete($1.to_sym)\n end\n\n SurveyGizmo.configuration.api_version + rest_path + filters_to_query_string(url_params)\n end",
"def add_route( verb, path, route )\n\t\tre = Regexp.compile( '^' + path.join('/') + '$' )\n\n\t\t# Make the Hash for the specified HTTP verb if it hasn't been created already\n\t\tself.routes[ re ][ verb ] = route\n\tend",
"def method_missing key, *sig, &blk\n if match = /(\\w+_|\\b)koi_(\\w+)_path$/.match(key)\n prefix, suffix = match.to_a.drop 1\n koi_engine.send :\"#{ prefix }#{ suffix }_path\", *sig, &blk\n else\n super\n end\n end",
"def add_route(*args)\n route = super\n @named_routes[route.name] = route if route.name\n @generation_key_analyzer << route.generation_keys\n route\n end",
"def routes=(_arg0); end",
"def routes=(_arg0); end",
"def routes=(_arg0); end",
"def define_route(method, path, target=nil, &block)\n route_def = {}\n # choose action for block and no-block routes\n if block_given?\n route_def = { block: block }\n else\n # { \"/\" => { :controller=>\"landing\", :action=>\"index\" } }\n route_def = target_to_controller_and_action(target)\n end\n # add method and params symbols\n route_def.merge!(\n match: get_math_for_route(path),\n method: method,\n params: process_params(path)\n )\n # add route to routes hash\n routes.push(route_def)\n end",
"def route() request.route end",
"def method_missing(method, *arg)\n # Raise an error if a method gets accessed which was not defined before\n raise RuntimeError, \"'rk.#{method.to_s}' is undefined\" unless method.to_s.include?(\"=\")\n\n # Define a method to return a value as set, for example rk.settings = 'set' defines\n # a method called \"settings\" which returns the string \"set\"\n key = method.to_s.sub(/=/, \"\")\n val = (arg || []).first.to_s\n\n instance_eval(%Q[\n def #{key}\n \"#{val}\"\n end\n ])\n\n # Store user-defined key\n @keys[key] = val\n end",
"def add_method(key)\n self.class.send(:define_method, key) do\n @hash[key]\n end\n end",
"def named_routes=(_arg0); end",
"def key=(key); end",
"def method=(_); end",
"def method_missing(method_id, params = {})\n request(method_id.id2name.gsub(/_/, '.'), params)\n end",
"def _routes; end",
"def method(method_name)\n \n @_method = method_name.to_s\n \n end",
"def route_sets; end",
"def route(verb, path, &handler)\n # Create a hash for the verb if it is the first time\n @routes[verb] ||= {}\n @routes[verb][path] = handler\n end",
"def name(name, route)\n named_routes[name.to_sym] = route\n route\n end",
"def route9\n redirect_to params[:key]\n end",
"def route=(route)\n raise(Circuit::Error, \"Route has already been set\") if self.route\n save_original_path_envs\n @env[\"PATH_INFO\"] = \"/\"+path_segments[route.length..-1].join(\"/\")\n @env[\"PATH_INFO\"] = \"\" if @env[\"PATH_INFO\"] == \"/\"\n @env[\"SCRIPT_NAME\"] = route.last.path\n @env[\"SCRIPT_NAME\"] = \"\" if @env[\"SCRIPT_NAME\"] == \"/\" and @env[\"PATH_INFO\"].present?\n @env[ENV_ROUTE] = route;\n end",
"def route(verb, path, &handler)\n @routes[verb] ||= {}\n @routes[verb][path] = handler\n end",
"def routes\n routes_method.call\n end",
"def method_missing_with_named_uri_setting(method_name, *args, &block)\n if uri_name = method_name.to_s[/.*(?=_uri=$)/] and 1 == args.size\n @uris[uri_name.to_sym] = args.first\n else\n method_missing_without_named_uri_setting(method_name, *args, &block)\n end\n end",
"def routes(set_name = :main, &block)\n return @routes ||= {} unless block_given?\n routes[set_name] = block\n self\n end",
"def name(name, route)\n @named_routes[name.to_sym] = route\n route\n end",
"def custom_routes; end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def method(method = nil)\n return @method if method.nil?\n\n @method = method.to_s.capitalize\n end",
"def routes(set_name = :main, &block)\n if set_name && block\n @@routes[set_name] = block\n else\n @@routes\n end\n end",
"def method=(value)\n @method = value\n end",
"def method_missing(method_symbol, *args)\n method = method_symbol.to_s\n method = $1 if method =~ /(.+)=$/\n if args.length > 0\n self[method] = args[0]\n else\n self[method]\n end\n end",
"def set_route_information\n @routes = {\n :root_url => root_url,\n :root_path => root_path,\n :customers_delete_path => customers_delete_path, \n :customers_all_path => customers_all_path,\n :customers_all_url => customers_all_url,\n :customers_creation_form_url => customers_creationform_url,\n :customers_creation_form_path => customers_creationform_path,\n :customers_edit_form_path => customers_editform_path,\n :customers_edit_form_url => customers_editform_url,\n :contacts_customer_contacts_path => contacts_customer_contacts_path,\n :contacts_customer_contacts_url => contacts_customer_contacts_url,\n :contacts_delete_path => contacts_delete_path,\n :contacts_delete_url => contacts_delete_url,\n :contacts_createForm_path => contacts_createForm_path,\n :contacts_createForm_url => contacts_createForm_url,\n :contacts_update_path => contacts_update_path,\n :contacts_update_url => contacts_update_url,\n :contacts_editform_path => contacts_editform_path,\n :contacts_editform_url => contacts_editform_url\n }\n end",
"def routes_method\n @routes_method ||= Proc.new do\n base_application.routes.routes.map do |route|\n next unless route.defaults.has_key?(:controller) &&\n controller_const = \"#{route.defaults[:controller]}_controller\"\n .classify\n .constantize rescue nil\n\n http_methods = (\n route.verb.is_a?(Regexp) ?\n route.verb.inspect.gsub(/[\\/\\$\\^]/, '') :\n route.verb\n ).split(\"|\")\n\n {\n alias: route.name,\n path: route.path.spec.to_s,\n controller_name: route.defaults[:controller],\n controller: controller_const,\n action: route.defaults[:action],\n http_methods: http_methods\n }\n end.compact\n end\n end",
"def routing_keys\n []\n end",
"def key=(key)\n options[:key] = key\n end",
"def named_route; end",
"def path\n return @path unless @path.nil?\n\n substitute_keys_with(@route_params)\n substitute_keys_with(known_params)\n @path = @route\n end",
"def route_name; end",
"def route_name; end",
"def reset_routes(routes=[])\n request :put, '/routes', routes\n end",
"def route14\n end",
"def resource_prefix( route )\n\t\t\tself.service_options[ :prefix ] = route\n\t\tend",
"def routes_map; end",
"def register(route, command, action = nil)\n if @route_map.has_key?(route)\n raise(Imp::RouterError, \"Route name cannot be defined twice: #{route}\")\n end\n\n @route_map[route] = { :command => command, :action => action }\n nil\n end",
"def call_routes=(value)\n @call_routes = value\n end",
"def route(name=nil, namespace=nil, &block)\n if name\n routes = opts[:namespaced_routes][namespace] ||= {}\n routes[name] = define_roda_method(routes[name] || \"multi_route_#{namespace}_#{name}\", 1, &convert_route_block(block))\n self::RodaRequest.clear_named_route_regexp!(namespace)\n else\n super(&block)\n end\n end",
"def key=(new_key)\n @key = new_key\n end",
"def method_missing(key, *args, &block)\n key = key.to_s\n if key[-1] == '='\n # This is a set method\n set(key[0..-2], *args)\n else\n args.push(Proc.new(&block)) if block\n return call(key, *args) if args.length > 0\n get(key)\n end\n end",
"def route_for_path(path, method=nil)\n env = Rack::MockRequest.env_for(path || \"\", {:method => method})\n req = ActionDispatch::Request.new(env)\n route, matches, params = Rails.application.routes.set.recognize(req)\n return route\n end",
"def add_route(route={})\n request :post, '/routes', route\n end",
"def method_missing(method, *args)\n if method.to_s[-1,1] == '='\n self[method.to_s.tr('=','').to_sym] = args.first\n else\n self[method]\n end\n end",
"def method_missing(method, *args)\n if method.to_s[-1,1] == '='\n self.put(method.to_s.tr('=',''), *args)\n else\n self.get(method)\n end\n end",
"def define_routable_methods router_class\n define_method router_class.route_name_method_name do \n router_class.route_name self\n end\n \n define_method router_class.url_method_name do \n router_class.url self\n end\n \n define_method router_class.path_method_name do \n router_class.path self\n end\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def updateKey; @key = getKey; self end",
"def method_added(id)\n\t\t\t\t\treset_routing_cache\n\t\t\t\tend",
"def add_method(method)\n # THREAD CRITICAL BEGIN\n remove_method(method.signature)\n @method.push(method)\n method.multimethod = self\n @lookup_method = { } # flush cache\n # THREAD CRITICAL END\n end",
"def add_swagger_route http_method, path, opts = {}\n full_path = path.gsub(/{(.*?)}/, ':\\1')\n match full_path, to: \"#{opts.fetch(:controller_name)}##{opts[:action_name]}\", via: http_method\n end",
"def set_key_statement\n super\n end",
"def action(method, route, &block)\n @actions << [method.to_s, build_route(@with * \"/\" + route), block]\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def set_route\n @route = Route.find(params[:id])\n end",
"def data_set_routes\n @trains[0].set_route(routes[0])\n @trains[2].set_route(routes[2])\n end",
"def method_missing( method, *args, &block )\n key = @key.dup << method.to_s\n Undefined.warn key\n return Undefined.new(key)\n end",
"def register_route(protocol, verb, match, args, block)\n @routes[protocol] ||= {}\n @routes[protocol][verb] ||= {}\n @routes[protocol][verb][match] = { block: block, args: args }\n end",
"def [](key)\n super(key.to_sym)\n end",
"def [](key)\n super(key.to_sym)\n end",
"def reload_routes!; end",
"def reload_routes!; end",
"def reset!\n @route_map = {}\n end",
"def method_missing(meth, *args)\n meth = meth.to_s\n if meth =~ /=/\n self[meth.sub('=','')] = args.first\n else\n self[meth]\n end\n end",
"def set_driver_route\n @driver_route = DriverRoute.find_by_token!(params[:id])\n end"
] | [
"0.69384617",
"0.6651482",
"0.63513935",
"0.63444024",
"0.6307341",
"0.6268025",
"0.6026637",
"0.5884365",
"0.57612115",
"0.5741135",
"0.57030064",
"0.5680921",
"0.567883",
"0.56576055",
"0.5643051",
"0.5601336",
"0.5593304",
"0.5539606",
"0.5539606",
"0.5539606",
"0.5531875",
"0.552613",
"0.55140704",
"0.55059105",
"0.5465506",
"0.54533",
"0.5442631",
"0.54227495",
"0.54172295",
"0.541098",
"0.5403828",
"0.53989017",
"0.535911",
"0.5344531",
"0.53368586",
"0.5298748",
"0.5284723",
"0.52836835",
"0.52680695",
"0.5263241",
"0.5260944",
"0.526039",
"0.526039",
"0.526039",
"0.526039",
"0.526039",
"0.526039",
"0.526039",
"0.526039",
"0.526039",
"0.526039",
"0.526039",
"0.526039",
"0.526039",
"0.52602965",
"0.52589387",
"0.5257002",
"0.5236446",
"0.52315456",
"0.5223462",
"0.5218399",
"0.5202947",
"0.51990974",
"0.5198529",
"0.51905525",
"0.51905525",
"0.51895535",
"0.5188134",
"0.51806146",
"0.5180513",
"0.517342",
"0.5172461",
"0.5166624",
"0.5163296",
"0.5155813",
"0.51518047",
"0.51496243",
"0.5147542",
"0.51451904",
"0.5128714",
"0.51240605",
"0.51184165",
"0.51149184",
"0.5105384",
"0.51047426",
"0.5095655",
"0.50886375",
"0.50880027",
"0.50880027",
"0.50880027",
"0.50875574",
"0.50797004",
"0.5077127",
"0.50747365",
"0.50747365",
"0.50745755",
"0.50745755",
"0.50743896",
"0.5070819",
"0.5063703"
] | 0.7632306 | 0 |
top rated solution on codewars | def add_binary_top(a,b)
(a+b).to_s(2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def anchored; end",
"def alg; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def algorithms; end",
"def solution4(input)\n end",
"def king_richard_iii; end",
"def villian; end",
"def solution\n (1..40).inject(:*) / (1..20).inject(:*)**2\nend",
"def algorithm=(_); end",
"def algorithm=(_); end",
"def algorithm=(_); end",
"def algorithm=(_); end",
"def recursive_solution\n\n end",
"def romeo_and_juliet; end",
"def superweening_adorningly(counterstand_pyrenomycetales)\n end",
"def sol inp\n k, ins = inp.split(' ',2)\n k = k.to_i\n ps, pr, pi, pu, pw, pd, pl = ins.split.map(&:to_f)\n\n @ps = ps\n @pr = pr\n @pu = pu\n @pw = pw\n @pd = pd\n @pl = pl\n\n #\n # required_wins = 2\n # # winning 1st set\n # first_set = ps*pi + pr*(1-pi)\n # # winning 2nd set\n # first_set * winning_another_set + (1-first_set)*winning_another_set\n #\n # required_wins.times do |i|\n # count = 0\n # while count <= i\n # wins[i] = win_scene(pi,ps,pr, count)\n # count+=1\n # break if count == i\n # lose_scene(pi,ps,pr, pr,count)\n # end\n # end\n\n # winning second set after winning first + winning second set after winning one\n # wins[0]*win_scene(pi,ps,pr) + (1-wins[0])*lose_scene(pi,ps,pr)\n\n def win_scene(pi,round,required_wins,current_wins)\n return 0 if round >= required_wins\n # puts \"w #{' '*round},#{required_wins},#{current_wins})\"\n sunny = (round == 0) ? pi : (pi+(@pu*@pw))\n sunny = 1.0 if sunny > 1\n sunny = 0.0 if sunny < 0\n chance = sunny*@ps + (1-sunny)*@pr\n binding.pry if chance > 1\n\n if required_wins == current_wins+1\n chance\n else\n # return 0 if round > 100\n return 0 if (10**7*chance).to_i < 1\n wins = win_scene(sunny,round+1,required_wins,current_wins+1)\n # lose = lose_scene(sunny,round+1,required_wins,current_wins+1)\n chance * (wins)#+ (1-chance)*lose\n end\n end\n\n def lose_scene(pi,round,required_wins,current_wins)\n return 0 if round >= required_wins\n # puts \"l #{' '*round},#{required_wins},#{current_wins})\"\n sunny = (round == 0) ? pi : (pi-(@pd*@pl))\n sunny = 1.0 if sunny > 1\n sunny = 0.0 if sunny < 0\n chance = sunny*@ps + (1-sunny)*@pr\n binding.pry if chance > 1\n\n if required_wins == current_wins\n chance\n else\n # return 0 if round > 100\n return 0 if (10**7*chance).to_i < 1\n wins = win_scene(sunny,round+1,required_wins,current_wins+1)\n # lose = lose_scene(sunny,round+1,required_wins,current_wins+1)\n chance * (wins) #+ (1-chance)*lose\n end\n end\n\n # a = win_scene(pi,0,1,0)\n b = win_scene(pi,0,k,0)\n c = lose_scene(pi,0,k,0)\n # c = (k > 1) ? lose_scene(pi,1,k,0) : 0\n\n puts b\n puts c\n b +c\n # wtf?\n # 0.4* win_scene(pi,0,k,0)+ (1-0.6)*lose_scene(pi,0,k,0)\n\n# def smth(pi, ps, pr, setcount=0)\n# arr[1] = arr[0]\n# end\n# # set 2+ ?\n# set2 = ((ps+pu)*pw + ps*(1-pw))*pi\n# (1-set1)*((ps-pd)*pl + ps*(1-pl))\n# if k > 1\n# (k-1).times do\n#\n# end\n# end\nend",
"def schumann; end",
"def stderrs; end",
"def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend",
"def solution(a)\n # write your code in Ruby 2.2\n binding.pry\n trips = Hash.new {|h,k| h[k]=0}\n start = 0\n ending = 0\n min = nil\n a.each_with_index do |trip,i|\n ending = i\n\n if trips[trip] == 0\n min = ending - start\n end\n trips[trip] += 1\n\n while start < ending\n break if trips[a[start]] - 1 == 0\n trips[start] -= 1\n start += 1\n min = ending - start if ending-start < min\n end\n end\n min\nend",
"def challenge; end",
"def solve\n return ((1..40).inject(:*) / ((1..20).inject(:*) ** 2))\nend",
"def solve\n end",
"def hook_solution?(a); end",
"def jack_handey; end",
"def coast_guard_rank; end",
"def suivre; end",
"def leeway; end",
"def leeway; end",
"def solution(s, p, q)\n # write your code in Ruby 2.2\n g = s.length + 1\n a = (s.length + 1)**3\n c = (s.length + 1)**2\n tmp = []\n res = []\n tmp.push 0\n o = 0\n s.split('').each do |i|\n o += if i == 'T'\n 1\n elsif i == 'G'\n g\n elsif i == 'C'\n c\n else\n a\nend\n tmp.push o\n end\n (0...p.length).each do |k|\n o = tmp[q[k] + 1] - tmp[p[k]]\n if o >= a\n res.push 1\n elsif o >= c\n res.push 2\n elsif o >= g\n res.push 3\n else\n res.push 4\n end\n end\n res\nend",
"def goodVsEvil(good, evil)\n # good_power, evil_power = 0, 0\n # good.split.each_with_index do |num, i|\n # if i < 3\n # good_power += num.to_i * (i + 1)\n # elsif i < 5\n # good_power += num.to_i * i\n # elsif i == 5\n # good_power += num.to_i * 2 * i\n # end\n # end\n god = good.split.each_with_index.inject(0) do |sum, (num, i)|\n if i < 3\n sum + num.to_i * (i + 1)\n elsif i < 5\n sum + num.to_i * i\n elsif i == 5\n sum + num.to_i * 2 * i\n end\n end\n \n \n evl = evil.split.each_with_index.inject(0) do |sum, (num, i)|\n case i\n when 0\n sum + num.to_i * (i + 1)\n when 1, 2, 3\n sum + num.to_i * 2\n when 4\n sum + num.to_i * (i - 1)\n when 5\n sum + num.to_i * i\n when 6\n sum + num.to_i * (i + 4) \n end\n end\n \n if evl > god\n str = \"Evil eradicates all trace of Good\"\n elsif evl < god\n str = \"Good triumphs over Evil\"\n else\n str = \"No victor on this battle field\"\n end\n \n \"Battle Result: #{str}\"\nend",
"def probers; end",
"def optimize_kevin_bacon_search\n\t\t# winning_attempts = []\n\t\t# find_kevin_bacon_2(winning_attempts)\n\t\t# if winning_attempts.count > 0\n\t\t\t# winning_attempts.each do |attempt|\n\t\t\t\t# compare with a neighbor, shorter one wins\n\t\t\t\t# there will be lots of ties we skip over\n\t\t# else\n\t\t\t# returns nil\n\t\t# end\n\t\twinning_attempts = []\n\t\tfind_save_kevin_bacon(start_node, winning_attempts)\n\t\twinning_attempts.compact!\n\t\tif winning_attempts.count == 0\n\t\t\tputs 'no bacon :('\n\t\telse\n\t\t\twinning_attempts.index do |i|\n\t\t\t\tif i != 0\n\t\t\t\t\tif winning_attempts[i - 1] < winning_attempts[i]\n\t\t\t\t\t\twinning_attempts.delete_at(i)\n\t\t\t\t\telse\n\t\t\t\t\t\twinning_attempts.delete_at(i - 1)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\twinning_attempts\n\tend",
"def silly_adjective; end",
"def find_optimal(rootCode,goalCode)\n\tfindHops(rootCode, goalCode, \n\t\tlambda{|flight,oldweight| \n\t\t\toldweight + (flight.date.date.to_i + (flight.flightDuration).seconds - @date.date.to_i)/1200 + 100 + flight.seatprice/5 \n\t\t\t# oldweight + (number of hours between arrival and departure + 100 (per hop))*3 + seatprice/5 (~25-250)\n\t\t\t})\nend",
"def terpene; end",
"def strain; end",
"def schubert; end",
"def find_shortest(rootCode,goalCode)\n\tself.findHops(rootCode, goalCode, lambda{|flight,oldweight| oldweight+1})\nend",
"def solve(ingredients, part_two: false)\n score = 0\n max = 0\n\n (0..100).each do |i|\n (0..100 - i).each do |j|\n (0..100 - i - j).each do |k|\n l = 100 - i - j - k\n capacity = calculate_total(ingredients, \"capacity\", i, j, k, l)\n durability = calculate_total(ingredients, \"durability\", i, j, k, l)\n flavor = calculate_total(ingredients, \"flavor\", i, j, k, l)\n texture = calculate_total(ingredients, \"texture\", i, j, k, l)\n calories = calculate_total(ingredients, \"calories\", i, j, k, l)\n\n next if part_two && calories != 500\n next if capacity <= 0 || durability <= 0 || flavor <= 0 || texture <= 0\n\n score = capacity * durability * flavor * texture\n max = score if score > max\n end\n end\n end\n max\nend",
"def alternatives; end",
"def problem_76a\n num = 100\n solve = lambda do |a,off,max|\n n = 0\n while a[off] < max && (a.length-off) >= 2 \n a[off] += a.pop\n n += 1\n n += solve.call(a.dup,off+1,a[off]) if a.length - off > 1\n end\n n\n end\n puts 1 + solve.call([1] * num, 0,num-1)\nend",
"def sequence(hidden, open)\n weight = { 1 => \"A\", 2 => \"2\", 3 => \"3\", 4 => \"4\", 5 => \"5\", 6 => \"6\", 7 => \"7\", 8 => \"8\", 9 => \"9\", \n 10 => \"T\", 11 => \"J\", 12 => \"Q\", 13 => \"K\" }\n i = 0\n result = []\n inputs = 1\n differ = 0\n if weight.key(hidden[i]) > weight.key(hidden[i+2])\n small = weight.key(hidden[i+2])\n big = weight.key(hidden[i])\n differ = big - small\n elsif weight.key(hidden[i]) < weight.key(hidden[i+2])\n small = weight.key(hidden[i])\n big = weight.key(hidden[i+2])\n differ = big - small\n else\n return false\n end\n return false if differ > 4\n if differ > 1\n start = small + 1\n end1 = big - 1\n start.upto(end1) do |j|\n open.each_index do |k|\n if open[k] == weight[j]\n unless result.include? weight[j]\n result << open[k]\n result << open[k+1]\n inputs += 1\n end \n end \n end \n end\n end\n return false unless differ == inputs \n if result.size < 6\n steps = (6-result.size)/2\n start = big + 1\n end1 = big + steps\n start.upto(end1) do |j|\n open.each_index do |k|\n if open[k] == weight[j]\n unless result.include? weight[j]\n result << open[k]\n result << open[k+1]\n end \n end \n end \n end\n if result.size < 6\n steps = (6-result.size)/2\n return false if small - steps < 1 \n start = small - steps\n end1 = small - 1\n start.upto(end1) do |j|\n open.each_index do |k|\n if open[k] == weight[j]\n unless result.include? weight[j]\n result << open[k]\n result << open[k+1]\n end \n end \n end \n end\n return false if result.size < 6\n end\n end \n result \n end",
"def getMoneySpent(keyboards, drives, budget)\n #\n # Write your code here.\n #\n highest_combination = -1\n keyboards.each do |keyboard|\n drives.each do |drive|\n sum = keyboard + drive\n highest_combination = sum if sum <= budget && sum > highest_combination\n end\n end\n highest_combination;\nend",
"def scientist; end",
"def berlioz; end",
"def slop!; end",
"def slop!; end",
"def master_mind(solution, guess)\n hits = hit(solution, guess)\n pseudo_hits = psuedo_hit(solution, guess)\n \"hits: #{hits}\\n pseudo hits: #{pseudo_hits}\"\nend",
"def solution1(seeds)\n turn_map = {}\n seeds.each_with_index { |n, turn| turn_map[n] = [1, turn + 1, turn + 1] }\n last_number = seeds.last\n\n ((seeds.length+1)..2020).each do |turn|\n last_stats = turn_map[last_number]\n if last_stats[TIMES_SPOKEN] == 1\n zero = turn_map[0] || [0, turn, turn]\n zero[TIMES_SPOKEN] += 1\n zero[FIRST_SPOKEN] = zero[LAST_SPOKEN]\n zero[LAST_SPOKEN] = turn\n \n turn_map[0] = zero\n last_number = 0\n else\n age = last_stats[LAST_SPOKEN] - last_stats[FIRST_SPOKEN]\n\n num = turn_map[age] || [0, turn, turn]\n num[TIMES_SPOKEN] += 1\n num[FIRST_SPOKEN] = num[LAST_SPOKEN]\n num[LAST_SPOKEN] = turn\n \n turn_map[age] = num\n last_number = age\n end\n end\n\n last_number\nend",
"def most_interesting_man_in_the_world; end",
"def solution(s, p, q)\r\n # write your code in Ruby 2.2\r\n # A -1\r\n # C -2\r\n # G -3\r\n # T -4\r\n # s - string with n charactekrs\r\n #cagccta\r\n #0123345\r\n #p,q - not empty arrays\r\n #\r\n #p[0]=2 q[0]=4 gcc 322 => 2\r\n #p[1]=5 q[1]=5 t 4 => 4\r\n \r\n \r\n arr = Array.new(q.count)\r\n \r\n \r\n\r\n \r\n arr.each_with_index{|el, i|\r\n \r\n ss = s[p[i]..q[i]]\r\n \r\n if ss.index('A') \r\n n = 1\r\n elsif ss.index('C')\r\n n=2\r\n elsif ss.index('G')\r\n n=3\r\n else \r\n n=4\r\n end\r\n \r\n arr[i] = n\r\n \r\n }\r\n \r\n \r\n \r\n arr\r\n \r\nend",
"def solution5(input)\n # Approach\n # Map over the initial array (to return a transformed array)\n # Map over each interal array (to return a transformed array)\n # Creates an enumerable range up to the value in the array\n # Multiple each value in the range using the inject method\n # which iterates and keeps the running total\n\n # Final solution\n # Uses shorthand version of inject\n # Remove the useless multiple by 1\n # Note the use of the starting value of 1 for inject\n # which makes 0!=1 class Quiz\n # find even values\n def solution1(input)\n # Final solution\n input.flatten.select do |value|\n value.even?\n end\n\n # First solution:\n # Works correctly\n # Unoptimized\n #\n # input.map do |ary|\n # ary.select do |value|\n # value.even?\n # end\n # end.flatten\n end\n\n # find value sum\n def solution2(input)\n # Final Solution\n input.flatten.inject(:+)\n\n # Second solution:\n # Works correctly\n # Doesn't use shortcut version of inject\n #\n # input.flatten.inject do |sum, value|\n # sum += value\n # end\n\n # First solution:\n # Works correctly\n # Unoptimized\n #\n # input.map do |ary|\n # ary.inject do |sum, value|\n # sum += value\n # end\n # end.inject do |sum, value|\n # sum += value\n # end\n end\n\n # find max value\n def solution3(input)\n # Final solution\n input.flatten.max\n\n # First solution:\n # Works correctly\n # Unoptimized\n #\n # input.map do |ary|\n # ary.max\n # end.max\n end\n\n # sum the array lengths\n def solution4(input)\n # Final solution\n input.map(&:length).inject(0, :+)\n\n # Second solution:\n # Works correctly\n # Doesn't use shortcut version of inject\n #\n # input.map(&:length).inject{|sum, value| sum += value}\n\n # First solution:\n # Works correctly\n # Unoptimized\n #\n # input.map do |ary|\n # ary.length\n # end.inject {|sum, value| sum += value}\n end\n\n # transform to factorials\n # Factorial is defined as the product of all the whole numbers from 1 to n\n # Examples:\n # 4! = 4*3*2*1\n # 1! = 1\n # 0! = 1\n def solution5(input)\n # Approach\n # Map over the initial array (to return a transformed array)\n # Map over each interal array (to return a transformed array)\n # Creates an enumerable range up to the value in the array\n # Multiple each value in the range using the inject method\n # which iterates and keeps the running total\n\n # Final solution\n # Uses shorthand version of inject\n # Remove the useless multiple by 1\n # Note the use of the starting value of 1 for inject\n # which makes this work properly for all values (including 0, 1)\n input.map do |ary|\n ary.map do |value|\n (2..value).inject(1, :*)\n end\n end\n\n # First solution\n # Mostly optimized\n # Does 1 more multiplication than needed (mult by 1)\n #\n # input.map do |ary|\n # ary.map do |value|\n # (1..value).inject(1) do |factorial, value|\n # factorial *= value\n # end\n # end\n # end\n end\nend",
"def minimize; end",
"def surge; end",
"def solve( n = 16 )\n max = 0\n \n (1..10).each do |a|\n (1..10).each do |b|\n next if b == a\n (1..10).each do |c|\n next if c == b || c == a\n (1..10).each do |d|\n next if d == c || d == b || d == a\n (1..10).each do |e|\n next if e == d || e == c || e == b || e == a\n\n rotate = 3*[a, b, c, d, e].each_with_index.min[1]\n (1..10).each do |f|\n next if f == e || f == d || f == c || f == b || f == a\n (1..10).each do |g|\n next if g == f || g == e || g == d || g == c || g == b || g == a\n \n t = a + f + g\n (1..10).each do |h|\n next if h == g || h == f || h == e || h == d || h == c || h == b || h == a\n next unless t == b + g + h\n\n (1..10).each do |i|\n next if i == h || i == g || i == f || i == e || i == d || i == c || i == b || i == a\n next unless t == c + h + i\n\n (1..10).each do |j|\n next if j == i || j == h || j == g || j == f || j == e || j == d || j == c || j == b || j == a\n next unless t == d + i + j && t == e + j + f\n\n s = [a, f, g, b, g, h, c, h, i, d, i, j, e, j, f]\n rotate.times {s.push s.shift}\n\n s = s.join\n next if n != s.length\n\n max = [max, s.to_i].max\n end\n end\n end\n end\n end\n end\n end\n end\n end\n end\n\n max\n end",
"def malts; end",
"def rassoc(p0) end",
"def bunny(n)\n # raise NotImplementedError, \"Method not implemented\"\n return 0 if n == 0\n return 2 + bunny(n - 1)\n\nend",
"def solve!\n end",
"def gounod; end",
"def solved(ans)\n\n end",
"def solve( n = 2_000 )\n # We can classify every tile according to its angular position around the\n # unit circle, setting position 0 at the top since that's where each row\n # starts in the problem statement. Positions 1-5 then follow every 60° as\n # we work our way counter-clockwise. Depending on which of these positions\n # each tile falls (or between which pair of positions), we use different\n # formulae to calculate its six neighbors to the N, NW, SW, S, SE, and NE:\n # \n # Pos 0: n even = fhp\n # N = n + ring (g) S = n - ring + 6 (a)\n # NW = n + ring + 1 (h) SE = n + ring - 1 (f)\n # SW = n + 1 NE = n + (2*ring + 5) (p)\n #\n # Pos 0-1: n even = bh, n odd = ag \n # N = n + ring (g) S = n - ring + 6 (a)\n # NW = n + ring + 1 (h) SE = n - ring + 5 (b)\n # SW = n + 1 NE = n - 1\n #\n # Pos 1: n even = bh, n odd = gi\n # N = n + ring (g) S = n + 1\n # NW = n + ring + 1 (h) SE = n - ring + 5 (b)\n # SW = n + ring + 2 (i) NE = n - 1\n #\n # Pos 1-2: n even = bh, n odd = ci\n # N = n - 1 S = n + 1\n # NW = n + ring + 1 (h) SE = n - ring + 5 (b)\n # SW = n + ring + 2 (i) NE = n - ring + 4 (c)\n #\n # Pos 2: n even = hj\n # N = n - 1 S = n + ring + 3 (j)\n # NW = n + ring + 1 (h) SE = n + 1\n # SW = n + ring + 2 (i) NE = n - ring + 4 (c)\n #\n # Pos 2-3: n even = dj, n odd = ci\n # N = n - ring + 3 (d) S = n + ring + 3 (j)\n # NW = n - 1 SE = n + 1\n # SW = n + ring + 2 (i) NE = n - ring + 4 (c)\n #\n # Pos 3: n even = dj, n odd = ik\n # N = n - ring + 3 (d) S = n + ring + 3 (j)\n # NW = n - 1 SE = n + ring + 4 (k)\n # SW = n + ring + 2 (i) NE = n + 1\n #\n # Pos 3-4: n even = dj, n odd = ek\n # N = n - ring + 3 (d) S = n + ring + 3 (j)\n # NW = n - ring + 2 (e) SE = n + ring + 4 (k)\n # SW = n - 1 NE = n + 1\n #\n # Pos 4: n even = jl\n # N = n + 1 S = n + ring + 3 (j)\n # NW = n - ring + 2 (e) SE = n + ring + 4 (k)\n # SW = n - 1 NE = n + ring + 5 (l)\n #\n # Pos 4-5: n even = fl, n odd = ek\n # N = n + 1 S = n - 1\n # NW = n - ring + 2 (e) SE = n + ring + 4 (k)\n # SW = n - ring + 1 (f) NE = n + ring + 5 (l)\n #\n # Pos 5: n even = fl, n odd = km\n # N = n + ring + 6 (m) S = n - 1\n # NW = n + 1 SE = n + ring + 4 (k)\n # SW = n - ring + 1 (f) NE = n + ring + 5 (l)\n #\n # Pos 5-0, except last: n even = fl, n odd = gm\n # N = n + ring + 6 (m) S = n - ring (g)\n # NW = n + 1 SE = n - 1\n # SW = n - ring + 1 (f) NE = n + ring + 5 (l)\n #\n # Pos 5-0, only last: n even = flo, n odd = gmo\n # N = n + ring + 6 (m) S = n - ring (g)\n # NW = n - ring + 1 (f) SE = n - 1\n # SW = n - (2*ring - 7) (o) NE = n + ring + 5 (l)\n #\n # From these formula, we can derive the difference between a tile and each\n # of its neighbors. If we arrange all potential differences in ascending\n # order, it becomes obvious that for n even or odd, some deltas will al-\n # ways be even, and thus can never be prime (>2).\n #\n # Furthermore, we can see that only in certain positions will a tile ever\n # differ from three neighbors by odd amounts (position 0 and just to the\n # right of position 0). In all other cases, at most two deltas will be\n # odd, meaning PD(n) will be 2 or less.\n #\n # n even n odd\n # a = ring - 6 even a\n # b = ring - 5 b even\n # c = ring - 4 even c\n # d = ring - 3 d even\n # e = ring - 2 even e\n # f = ring - 1 f even\n # g = ring even g\n # h = ring + 1 h even\n # i = ring + 2 even i\n # j = ring + 3 j even\n # k = ring + 4 even k\n # l = ring + 5 l even\n # m = ring + 6 even m\n # o = 2ring - 7 o o\n # p = 2ring + 5 p p\n pd3 = [1, 2]\n base, ring = 8, 12\n \n while pd3.size < n\n # Only at position 0 and one tile to the right will there ever be three\n # odd deltas, so those are the only ones we have to check for primality.\n # Both share a delta of f = ring - 1.\n if (ring - 1).prime?\n # Check the other odd deltas for position 0. \n pd3 << base if (ring + 1).prime? && (2*ring + 5).prime?\n\n # Check the other odd deltas for one tile to the right of position 0.\n pd3 << base + ring - 1 if (ring + 5).prime? && (2*ring - 7).prime?\n end\n\n # Advance the first tile of the current ring (base), and the number of\n # tiles it contains (ring). \n base += ring\n ring += 6\n end\n\n pd3[-1]\n end",
"def solve\n # Read lines and split into start-end pairs.\n pairs = []\n IO.read( 'resources/0079_keylog.txt' ).split.uniq.each do |line|\n pairs << line[0, 2] << line[1, 2] << line[0] + line[2]\n end\n\n # Delete duplicates and compute weight based on start character frequency.\n pairs.uniq!\n weight = (0..9).map {|i| pairs.count {|p| p[0].to_i == i}}\n\n # Order pairs according to most popular starting character, since we want\n # to maximize how many numbers appear after each one.\n pairs.sort_by! {|p| 10 * weight[p[0].to_i] + weight[p[1].to_i]}\n\n # Concatenate characters as long as they haven't been seen before. This\n # is not a general-purpose solution, but the problem (as stated) is not\n # exceptionally challenging.\n pwd = []\n pairs.reverse.each do |p|\n pwd << p[0] unless pwd.include?( p[0] )\n pwd << p[1] unless pwd.include?( p[1] )\n end\n\n pwd.join.to_i\n end",
"def solution\n 971 * (-61)\nend",
"def hureistic_search (board) #open useful in finding min conflicts\n end",
"def spice; end",
"def solve_two_vs_three_vs_five\n return if @arr[1].nil? || @arr[6].nil?\n\n #p \"1,6: #{@arr[1]},#{@arr[6]}\"\n\n @words.filter{|x| x.length == 5 && @hash[x].nil?}.each{|w|\n if @arr[1].chars.all?{|c| w.chars.include?(c)}\n solved(3, w)\n elsif w.chars.all?{|c2| @arr[6].chars.include?(c2)}\n solved(5, w)\n else\n solved(2, w)\n end\n }\n end",
"def problem_78\n n = 1\n p_cache = [1]\n\n generate = lambda do |k|\n ret = 0\n sign = 0\n Integer.generalized_pentagonals do |gp|\n if k < gp\n false # Need to exit ruby1.8, can't break...\n else\n if sign >= 0\n ret += p_cache[k-gp]\n else\n ret -= p_cache[k-gp]\n end\n sign += (sign == 1) ? -3 : 1 # 4 states + + - -\n end\n end\n p_cache[k] = ret % 100_000_000\n ret\n end\n\n p = 1\n loop do\n r = generate.call(p)\n# puts \"#{p} #{generate.call(p)}\"\n break if r % 1_000_000 == 0\n p += 1\n end\n p\nend",
"def isp; end",
"def isp; end",
"def solution1(input)\n return \"Not implemented!\"\nend",
"def wagner; end",
"def fast_food_production(work)\n t1 = 10\n y1 = 3.0\n t2 = 30\n y2 = 1.0\n\n ut = (y2-y1) / (t2-t1)\n\n res = if work <= t1\n work * y1\n elsif work <= t2\n w2 = work - t1\n work * y1 + ut * (w2+1) * w2 / 2.0\n else\n w2 = t2 - t1\n t2 * y1 + ut * (w2+1) * w2 / 2.0 + (work-t2) * y2\n end\n\n res.round(6)\nend",
"def code\n d = a + (7 * 362)\n b = c = 0\n loop do\n a = d\n while a != 0\n b = a\n a = 0\n loop do\n c = 2\n while c != 0\n break if b == 0\n\n b -= 1\n c -= 1\n end\n break if b == 0\n\n a += 1\n end\n b = 2 - c\n c = 0\n puts b\n end\n end\n end",
"def try_to_loan(loan)\n atms = Array.new(100) { |i| i.even? ? 2**i : -2**i }\n signs = atms.dup\n moves = []\n while loan != 0\n # binding.pry\n first_bigger, method = next_value(loan, atms)\n break if first_bigger == false\n if method == :cut\n moves << signs.index(atms[first_bigger])\n loan -= atms.delete_at(first_bigger)\n moves << signs.index(atms[first_bigger - 1]) if loan != 1\n loan -= atms.delete_at(first_bigger - 1) if loan != 1\n else\n moves << signs.index(atms[first_bigger - 2])\n loan -= atms.delete_at(first_bigger - 2)\n end\n p moves\n p loan\n end\nend",
"def mitch_hedberg; end",
"def bizet; end",
"def p206\n re = /1.2.3.4.5.6.7.8.9.0/\n max = Math.sqrt(1929394959697989990).floor\n\n # Round since only squares of multiples of 30 and 70 end with 9_0 (e.g. 900)\n i = round_up Math.sqrt(1020304050607080900).floor, 100\n while i < max\n p30 = (i+30) ** 2\n p70 = (i+70) ** 2\n\n if re === \"#{p30}\"\n return \"#{i+30}^2 = #{p30}\"\n elsif re === \"#{p70}\"\n return \"#{i+70}^2 = #{p70}\"\n end\n\n i += 100\n end\nend",
"def cracklepop1\n def aux x\n /[A-Z]+/i.match(x.to_s).to_s\n end\n (1..100).map do |i|\n x = i%3==0 ? 'crackle' : i\n i%5==0 ? (aux(x)+'pop') : x\n end\nend",
"def problem_108(size = 1001)\n func = lambda do |a|\n if a.length == 1\n a[0]+1\n else\n m = a[0]\n (2*m+1) * func.call(a[1,a.length]) -m\n end\n end\n\n primes = Primes.upto(200)\n prime_number = lambda do |a|\n r = 1\n a.sort.reverse.each_with_index { |m,i| r *= primes[i] ** m }\n r\n end\n\n values = {}\n last = 0\n 1.upto(100).each do |nn|\n nn.groupings do |a|\n sols = func.call a\n ans = prime_number.call a\n# puts \"np=#{nn} sols=#{sols} ans=#{ans} => #{a.inspect}\"\n if values[sols]\n values[sols] = [values[sols],[ans,a]].min\n else\n values[sols] = [ans,a]\n end\n true\n end\n size.upto(size*5/4) do |num|\n if values[num]\n puts \"for np = #{nn} => #{num} => #{values[num].inspect}\"\n if last == values[num]\n puts \"factors = #{values[num][0].factors}\"\n return values[num][0] \n end\n last = values[num]\n break\n end\n end\n #values.sort.each do |k,v|\n # puts \"#{k} => #{v}\"\n #end\n end\n nil\nend",
"def most_specific_subdivision; end",
"def solution(a, b, k)\n # write your code in Ruby 2.2\n e = b / k\n s = (a-1) / k\n\n e - s\nend",
"def dominant_octopus(fish)\n #sorted = []\n return fish if fish.length < 2\n pivot = fish.first\n left = fish[1..-1].select { |feesh| feesh.length <= pivot.length }\n #p left\n right = fish[1..-1].select { |feesh| feesh.length > pivot.length }\n\n dominant_octopus(left) + [pivot] + dominant_octopus(right)\n \n\n\nend",
"def formation; end",
"def solution(a)\n accessed = Array.new(a.size + 1, nil)\n caterpillar_back = 0\n count = 0\n\n a.each_with_index do |x, caterpillar_front|\n if accessed[x] == nil\n accessed[x] = caterpillar_front\n else\n new_caterpillar_back = accessed[x] + 1\n first_part_size = caterpillar_front - caterpillar_back\n second_part_size = caterpillar_front - new_caterpillar_back\n count += first_part_size * (first_part_size + 1) / 2\n count -= (second_part_size) * (second_part_size + 1) / 2\n caterpillar_back.upto(new_caterpillar_back - 1) { |n| accessed[a[n]] = nil}\n accessed[x] = caterpillar_front\n caterpillar_back = new_caterpillar_back\n end\n end\n\n remaining_size = a.size - caterpillar_back\n count += (remaining_size) * (remaining_size + 1) / 2\n end",
"def ninety_nine_bottles_of_beer\nend",
"def ninety_nine_bottles_of_beer\nend",
"def ninety_nine_bottles_of_beer\nend",
"def herald; end",
"def find_people_around_football_pitch_around_jindigeling\n find_shops\nend",
"def test_find_stack_overflow\n skip # because it takes *forever*\n @starting_point = MM::Ratio.new(1,1)\n @search = MM::Search.new(@starting_point)\n @search.delta = 0.001\n @search.adjacent_points_function = ->(current) {\n [MM::Ratio.new(1,1), MM::Ratio.new(-1,1)].map {|m| m + current}\n }\n goal = MM::Ratio.new(9000,1)\n @search.cost_function = ->(x) {\n (x - goal).abs\n }\n assert_equal goal, @search.find\n puts @search.iterations\n end",
"def ukp5(ukpi, return_used_items = false)\n n = ukpi[:n]\n c = ukpi[:c]\n items = ukpi[:items].clone\n\n max_w = items.max_by { | i | i[:w] }[:w]\n g = Array.new(c+max_w+1, 0)\n d = Array.new(c+max_w+1, n-1)\n sort_items_by_profitability!(items)\n\n last_y_where_nonbest_item_was_used = 0\n items.each_with_index do | it, ix |\n wi = it[:w]\n pi = it[:p]\n if g[wi] < pi then\n g[wi] = pi\n d[wi] = ix\n last_y_where_nonbest_item_was_used = wi if wi > last_y_where_nonbest_item_was_used && ix != 0\n end\n end\n\n opt = 0\n (1..(c-1)).each do | y |\n next if g[y] <= opt\n break if last_y_where_nonbest_item_was_used < y\n\n opt = gy = g[y]\n dy = d[y]\n\n # this block is a copy-past of the loop bellow only for the best item\n bi = items[0]\n pb = bi[:p]\n wb = bi[:w]\n next_y = y + wb\n old_gny = g[next_y]\n new_gny = gy + pb\n if old_gny < new_gny then\n g[next_y] = new_gny\n d[next_y] = 0\n end\n\n (1..dy).each do | ix |\n it = items[ix]\n pi = it[:p]\n wi = it[:w]\n ny = y + wi\n ogny = g[ny]\n ngny = gy + pi\n if ogny < ngny then\n g[ny] = ngny\n d[ny] = ix\n last_y_where_nonbest_item_was_used = ny if ny > last_y_where_nonbest_item_was_used\n end\n end\n end\n\n if last_y_where_nonbest_item_was_used < c-1 then\n y_ = last_y_where_nonbest_item_was_used\n while d[y_] != 0 do\n y_ += 1\n end\n# puts \"Periodicity used - c: #{c}; last_y: #{y_}\"\n\n extra_capacity = c - y_\n c1, a1 = items[0][:p], items[0][:w]\n qt_best_item_used = Rational(extra_capacity, a1).ceil\n space_used_by_best_item = qt_best_item_used*a1\n profit_generated_by_best_item = qt_best_item_used*c1\n\n opt_y = get_opt_y(c-space_used_by_best_item, items, g, d)\n g[c] = g[opt_y] + profit_generated_by_best_item\n end\n\n opt = g[c] if opt < g[c]\n\n if return_used_items then\n g.slice!(c+1, max_w)\n d.slice!(c+1, max_w)\n opt_y = get_opt_y(c, items, g, d)\n get_used_items_for_y(opt_y, items, g, d)\n else\n opt\n end\nend",
"def f_1_4tel_rek(n)\r\n if !n.integer? || n < 1\r\n return false\r\n end\r\n\r\n def end_rek(i, s)\r\n if i > 0\r\n end_rek(i - 1, (1.0 / (i * (i + 1.0) * (i + 2.0))) + s)\r\n else\r\n return s\r\n end\r\n end\r\n return end_rek(n, 0)\r\nend",
"def ravel; end",
"def minimumBribes(q)\n sum = 0\n q.each_with_index do |v,i|\n if v-(1+i) > 2\n puts \"Too chaotic\"\n return\n end\n bound = [v-2,0].max\n (bound..i-1).each do |j|\n sum+=1 if q[j] > v\n end\n end\n puts sum\nend",
"def special_pythag_trip(target_sum)\n\ta = 1\n\tb = 1\n\tfor a in (1..target_sum) do\n\t\tfor b in (1..target_sum) do\n\t\t\t#puts \"a : #{a}\"\n\t\t\t#puts \"b : #{b}\"\n\t\t\tsum_of_squares = a*a + b*b\n\t\t\tc = Math.sqrt(sum_of_squares).to_i\n\t\t\t\n\t\t\tif c*c == sum_of_squares\n\t\t\t\ttriple = [a,b,c] \n\t\t\t\tsum = triple.inject(0) {|sum,num| sum + num}\n\t\t\t\t\n\t\t\t\treturn triple[0]*triple[1]*triple[2] if sum == target_sum\n\t\t\tend\n\t\t\t\n\t\tend\n\t\n\tend\nend",
"def solve_zero_vs_six_vs_nine\n return if @arr[1].nil? || @arr[4].nil?\n\n #p \"1,4: #{@arr[1]},#{@arr[4]}\"\n\n @words.filter{|x| x.length == 6 && @hash[x].nil?}.each{|w|\n if @arr[4].chars.all?{|c| w.chars.include?(c)}\n solved(9, w)\n elsif @arr[1].chars.all?{|c2| w.chars.include?(c2)}\n solved(0, w)\n else\n solved(6, w)\n end\n }\n end"
] | [
"0.61666954",
"0.60340935",
"0.5975901",
"0.5975901",
"0.5975901",
"0.5975901",
"0.5975901",
"0.5954942",
"0.58058673",
"0.5724072",
"0.5719678",
"0.5715734",
"0.5715734",
"0.5715734",
"0.5715734",
"0.56933963",
"0.5669441",
"0.5639921",
"0.55732507",
"0.556404",
"0.5560631",
"0.55352896",
"0.55315375",
"0.5527619",
"0.5526183",
"0.5521075",
"0.54983574",
"0.5490449",
"0.5485772",
"0.54810774",
"0.5475768",
"0.5475768",
"0.54727364",
"0.5458526",
"0.54583687",
"0.54356885",
"0.5434383",
"0.54269767",
"0.542567",
"0.53926754",
"0.5387853",
"0.5383072",
"0.5367483",
"0.5351173",
"0.5332551",
"0.53090817",
"0.5299561",
"0.52948403",
"0.5291693",
"0.5288884",
"0.5288884",
"0.52767414",
"0.52681136",
"0.5259666",
"0.52347857",
"0.52132237",
"0.5209181",
"0.5205",
"0.5203587",
"0.5201661",
"0.5192883",
"0.51895654",
"0.51893646",
"0.5185929",
"0.518326",
"0.5179848",
"0.5173426",
"0.5172217",
"0.51685965",
"0.5167097",
"0.5166168",
"0.51644576",
"0.5162594",
"0.5162594",
"0.51570886",
"0.5150429",
"0.5143994",
"0.5140692",
"0.51402646",
"0.51381534",
"0.5138016",
"0.5136228",
"0.513544",
"0.51348317",
"0.51313466",
"0.5127267",
"0.5125957",
"0.5125274",
"0.5123342",
"0.5112926",
"0.5112926",
"0.5112926",
"0.5110358",
"0.5108916",
"0.51065254",
"0.5103274",
"0.5103047",
"0.5095512",
"0.5094512",
"0.5091477",
"0.50906795"
] | 0.0 | -1 |
Instantiate a new resource type with the given parameters. | def instantiate(params)
instance = Instance.new( *interpolate(params), @parent )
# instance.apply_resource_type # TODO: do we need apply_security_scheme?
instance
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_resource(type, title, parameters = {})\n parameters = parameters.merge(:name => title)\n resource = Puppet::Type.type(type.to_sym).new(parameters)\n catalog.add_resource(resource)\n resource\n end",
"def resource type, labels = {}\n Resource.new.tap do |r|\n r.type = type\n r.labels = labels\n end\n end",
"def create_resource(_params)\n resource_class.new(resource_params)\n end",
"def create_resource_for(resource_name)\n resource = self.class.const_set(resource_name, Class.new(Meli::Base))\n resource.prefix = self.class.prefix\n resource.site = self.class.site\n resource\n end",
"def build_resource(hash = {})\n self.resource = resource_class.new(hash)\n end",
"def instantiate\n resource.new(data)\n end",
"def initialize( args={} )\n\n # Create from another instance. Used for transmuting class.\n if args[:resource]\n other = args[:resource]\n @project = other.project\n @type = other.type\n @id = other.id\n @content = other.content(:load => false)\n @yaml = other.yaml_content(:load => false)\n\n # Create from a project and id\n else\n @project = args[:project]\n @type = args[:type]\n @id = args[:id]\n if SUFFIX_REGEXP =~ @id\n suffix = $2\n @id = $1 + suffix\n @type = TYPE_SUFFIXES.invert[suffix]\n end\n @content = nil\n @yaml = nil\n end\n\n if @project.nil? or @id.nil?\n raise ArgumentError, \"Insufficient resource args: #{args.inspect}\"\n end\n end",
"def build_resource\n self.resource = resource_class.new(resource_params)\n end",
"def create(res_type, config_props = {}, &block)\n # new_res = nil\n #res_name = res_name.to_sym\n #config_props[:name] ||= res_name\n config_props[:type] ||= res_type\n debug \"Create resource of type '#{res_type}'\"\n create_message_and_publish(:create, config_props, block)\n self\n end",
"def create(type, opts = nil)\n proxy_info = OmfRc::ResourceFactory.proxy_list[type]\n if proxy_info && proxy_info.create_by && !proxy_info.create_by.include?(self.type.to_sym)\n raise StandardError, \"Resource #{type} is not designed to be created by #{self.type}\"\n end\n\n before_create(type, opts) if respond_to? :before_create\n new_resource = OmfRc::ResourceFactory.new(type.to_sym, opts, @comm)\n after_create(new_resource) if respond_to? :after_create\n children << new_resource\n new_resource\n end",
"def build_resource(type, name, created_at=nil, &resource_attrs_block)\n created_at ||= caller[0]\n\n # Checks the new platform => short_name => resource mapping initially\n # then fall back to the older approach (Chef::Resource.const_get) for\n # backward compatibility\n resource_class = resource_class_for(type)\n\n raise ArgumentError, \"You must supply a name when declaring a #{type} resource\" if name.nil?\n\n resource = resource_class.new(name, run_context)\n resource.source_line = created_at\n resource.declared_type = type\n # If we have a resource like this one, we want to steal its state\n # This behavior is very counter-intuitive and should be removed.\n # See CHEF-3694, https://tickets.opscode.com/browse/CHEF-3694\n # Moved to this location to resolve CHEF-5052, https://tickets.opscode.com/browse/CHEF-5052\n resource.load_prior_resource(type, name)\n resource.cookbook_name = cookbook_name\n resource.recipe_name = recipe_name\n # Determine whether this resource is being created in the context of an enclosing Provider\n resource.enclosing_provider = self.is_a?(Chef::Provider) ? self : nil\n\n # XXX: This is very crufty, but it's required for resource definitions\n # to work properly :(\n resource.params = @params\n\n # Evaluate resource attribute DSL\n resource.instance_eval(&resource_attrs_block) if block_given?\n\n # Run optional resource hook\n resource.after_created\n\n resource\n end",
"def create(res_type, config_props = {}, core_props = {}, &block)\n config_props[:type] ||= res_type\n debug \"Create resource of type '#{res_type}'\"\n create_message_and_publish(:create, config_props, core_props, block)\n self\n end",
"def get_resource(resource_type)\n\n Occi::Log.debug(\"Instantiating #{resource_type} ...\")\n\n if @model.get_by_id resource_type\n # we got a resource type identifier\n Occi::Core::Resource.new resource_type\n elsif @model.kinds.select { |kind| kind.term == resource_type }.any?\n # we got a resource type name\n Occi::Core::Resource.new @model.kinds.select {\n |kind| kind.term == resource_type\n }.first.type_identifier\n else\n raise \"Unknown resource type! [#{resource_type}]\"\n end\n\n end",
"def resource(name, type=nil, &block)\n resource = GenericResource.new\n resource.type = type\n resource.evaluate &block\n add_resource name, resource\n end",
"def new_resource(*args)\n Freemle::Client::Resource.new(*args)\n end",
"def create_resource_type(feed_id, type_id, type_name)\n the_feed = hawk_escape_id feed_id\n\n type = create_blueprint\n type[:id] = type_id\n type[:name] = type_name\n\n begin\n http_post(\"/feeds/#{the_feed}/resourceTypes\", type)\n rescue HawkularException => error\n # 409 We already exist -> that is ok\n raise unless error.status_code == 409\n ensure\n the_type = hawk_escape_id type_id\n res = http_get(\"/feeds/#{the_feed}/resourceTypes/#{the_type}\")\n end\n ResourceType.new(res)\n end",
"def instance_of_resource_type(resource_type)\n resource = nil\n begin\n resource_class = resource_type.classify.constantize unless resource_type.nil?\n resource = resource_class.send(:new) if !resource_class.nil? && resource_class.respond_to?(:new)\n rescue NameError => e\n logger.error(\"Unable to find constant for resource type #{resource_type}\")\n end\n resource\n end",
"def create(name, type, options = {})\n Utils.stringify_keys!(options)\n path = \"/projects/#{project.name}/resources/\"\n\n headers = build_create_base_headers(name, type, options)\n body = build_create_base_body(options)\n\n location = client.post(path, headers: headers, body: body).headers['Location']\n Resource.new(name: name, resource_type: type, comment: options['comment'], location: location)\n end",
"def create(name, attributes)\n attributes = attributes.dup\n\n # Add the objectclasses\n attributes[\"objectClass\"] = objectclasses.collect { |o| o.to_s }\n attributes[\"objectClass\"] << \"top\" unless attributes[\"objectClass\"].include?(\"top\")\n\n attributes[rdn.to_s] = [name]\n\n # Generate any new values we might need.\n generate(attributes)\n\n # And create our resource.\n connect { |conn| conn.add dn(name), attributes }\n end",
"def create\n name_to_const.new\n end",
"def newparam(name, options = {}, &block)\n raise ArgumentError, 'Expected a string or symbol for parameter name.' unless name.is_a?(String) || name.is_a?(Symbol)\n raise ArgumentError, 'Expected a hash for the options.' unless options.is_a?(Hash)\n\n name = name.intern\n raise ArgumentError, \"Resource type '#{self.name}' already has a property '#{name}'.\" if @properties.has_key?(name)\n raise ArgumentError, \"Resource type '#{self.name}' already has a parameter '#{name}'.\" if @parameters.has_key?(name)\n\n parameter = Parameter.create(name, options)\n parameter.class_eval(&block) unless block.nil?\n @parameters[name] = parameter\n nil\n end",
"def create_resource_for(resource_name)\n resource = self.class.const_set(resource_name, Class.new(Docusigner::Base))\n resource.prefix = self.class.prefix\n resource.site = self.class.site\n resource\n end",
"def new_from_resource(rsrc); self.class.new_from_resource(rsrc) end",
"def new(data={})\n self.spira_resource.new(data)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource\n get_resource_ivar || begin\n set_resource_ivar class_name.new\n end\n end",
"def construct_new_resource(response)\n data = JSON.parse(response.body, symbolize_names: true)\n new(data)\n end",
"def new\n @entity = resource_class.new\n end",
"def build_resource(hash = {})\n self.resource = resource_class.new_with_session(hash, session)\n end",
"def build_resource(hash = {})\n self.resource = resource_class.new_with_session(hash, session)\n end",
"def new(attributes = {}, &block)\n assert_valid\n\n model = if discriminator = properties(repository_name).discriminator\n attributes[discriminator.name]\n end\n\n model ||= self\n\n resource = model.allocate\n resource.send(:initialize, attributes, &block)\n resource\n end",
"def initialize(resource_types=nil, resource_type_field_name=nil)\n self.resource_types = resource_types\n self.resource_type_field_name = resource_type_field_name\n end",
"def create(type, opts = {}, creation_opts = {}, &creation_callback)\n proxy_info = OmfRc::ResourceFactory.proxy_list[type]\n if proxy_info && proxy_info.create_by && !proxy_info.create_by.include?(self.type.to_sym)\n raise StandardError, \"Resource #{type} is not designed to be created by #{self.type}\"\n end\n\n before_create(type, opts) if respond_to? :before_create\n new_resource = OmfRc::ResourceFactory.create(type.to_sym, opts, creation_opts, &creation_callback)\n after_create(new_resource) if respond_to? :after_create\n\n self.synchronize do\n children << new_resource\n end\n new_resource\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def initialize(name, type: nil, resource: nil, polymorphic: false, primary_key: :id, foreign_key: nil, parent: nil)\n @name = name\n @resource_class = (resource || Class.new(Resource))\n @sideloads = {}\n @polymorphic = !!polymorphic\n @polymorphic_groups = {} if polymorphic?\n @parent = parent\n @primary_key = primary_key\n @foreign_key = foreign_key\n @type = type\n\n extend @resource_class.config[:adapter].sideloading_module\n end",
"def declare_resource(type, name, created_at=nil, &resource_attrs_block)\n created_at ||= caller[0]\n\n resource = build_resource(type, name, created_at, &resource_attrs_block)\n\n run_context.resource_collection.insert(resource, resource_type: type, instance_name: name)\n resource\n end",
"def build_resource(hash = nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def new(options = {}, &block)\n respond_with(build_resource, options, &block)\n end",
"def new(*args)\n enclosing_resource ? enclosing_resource.send(\"build_#{resource_specification.source}\", *args) : super\n end",
"def create_resource\n class_name.new(get_secure_params).tap do |model|\n model.save\n set_resource_ivar model\n end\n end",
"def resource\n resource_klass.new(attributes.symbolize_keys.merge(new_record: false))\n end",
"def create\n\t\t@resource_type = ResourceType.new(resource_type_params)\n\n\t\tif @resource_type.save\n\t\t\trender \"show\", :status => :created\n\t\telse\n\t\t\tinvalid_response(@resource_type)\n\t\tend\t\t\n\tend",
"def create(attributes = {})\n resource = new(attributes)\n resource.__send__(:_create)\n resource\n end",
"def create(type:, **options)\n find(type).new(**options)\n end",
"def define_new_resource(resource_name)\n name = resource_name.singularize\n resource_klass_name = name.to_s.camelcase\n klass_name = \"#{resource_klass_name}Resource\"\n return if AssociationResource.const_defined? klass_name\n\n base_klass = AssociationResource::IncludedResource\n base_klass.sub_name = name\n AssociationResource.const_set(klass_name, Class.new(base_klass))\n end",
"def define_new_resource(resource_name)\n name = resource_name.singularize\n resource_klass_name = name.to_s.camelcase\n klass_name = \"#{resource_klass_name}Resource\"\n return if AssociationResource.const_defined? klass_name\n\n base_klass = AssociationResource::IncludedResource\n base_klass.sub_name = name\n AssociationResource.const_set(klass_name, Class.new(base_klass))\n end",
"def transform_Resource(o, scope)\n Types::TypeFactory.resource(o.type, o.title)\n end",
"def find_or_create_resource_for(name)\r\n resource_name = name.to_s.camelize\r\n resource_name.constantize\r\n rescue NameError\r\n resource = self.class.const_set(resource_name, Class.new(ActiveTamino::Base))\r\n resource.collection = self.class.collection\r\n resource.credentials = self.class.credentials\r\n resource.doctype = self.class.doctype\r\n resource\r\n end",
"def build_resource params\n\t if(new_record?)\n\t \t r = resource_type.constantize.new params\n\t \t self.resource = r\n\t else\n\t\t resource.update_attributes params\n\t end\t \n\tend",
"def initialize(type_name, data_type, attribute_name, resource_hash, _referrable_type = nil)\n @type_name = type_name\n @data_type = data_type\n @attribute_name = attribute_name\n super(**resource_hash) # Pass resource to parent Puppet class.\n end",
"def build(args={})\n Resource.new(stack, args.to_smash)\n end",
"def hash2resource(scope, hash)\n unless type = hash[\"type\"]\n raise ArgumentError, \"Must provide type as a hash attribute when creating a resource\"\n end\n\n unless title = hash[\"title\"]\n raise ArgumentError, \"Must provide title as a hash attribute when creating a resource\"\n end\n\n resource = Puppet::Parser::Resource.new(:scope => scope, :type => type, :title => title, :source => @main)\n\n hash.each do |param, value|\n resource.set_parameter(param, value) unless %w{type title}.include?(param)\n end\n\n resource\nend",
"def declare_resource(type, name, created_at: nil, run_context: self.run_context, enclosing_provider: nil, &resource_attrs_block)\n created_at ||= caller[0]\n\n resource = build_resource(type, name, created_at: created_at, enclosing_provider: enclosing_provider, &resource_attrs_block)\n\n run_context.resource_collection.insert(resource, resource_type: resource.declared_type, instance_name: resource.name)\n resource\n end",
"def create(type, opts = {}, creation_opts = {}, &creation_callback)\n unless request_supported_children_type.include?(type.to_sym)\n raise StandardError, \"Resource #{type} is not designed to be created by #{self.type}\"\n end\n\n opts[:parent_certificate] = @certificate if @certificate\n opts[:parent] = self\n\n call_hook(:before_create, self, type, opts)\n\n new_resource = OmfRc::ResourceFactory.create(type.to_sym, opts, creation_opts, &creation_callback)\n\n log_metadata(self.uid, new_resource.uid, :create)\n\n call_hook(:after_create, self, new_resource)\n\n self.synchronize do\n children << new_resource\n end\n new_resource\n end",
"def create name, object_type, config={}\n klass = @@sources[[name, object_type]]\n raise \"No Source registered with name #{name} and type #{object_type}.\" unless klass\n klass.new(config)\n end",
"def build_resource(type, name, created_at: nil, run_context: self.run_context, enclosing_provider: nil, &resource_attrs_block)\n created_at ||= caller[0]\n\n # this needs to be lazy in order to avoid circular dependencies since ResourceBuilder\n # will requires the entire provider+resolver universe\n require_relative \"../resource_builder\" unless defined?(Chef::ResourceBuilder)\n\n enclosing_provider ||= self if is_a?(Chef::Provider)\n\n nr = new_resource if defined?(new_resource)\n\n Chef::ResourceBuilder.new(\n type: type,\n name: name,\n created_at: created_at,\n params: @params,\n run_context: run_context,\n cookbook_name: cookbook_name,\n recipe_name: recipe_name,\n enclosing_provider: enclosing_provider,\n new_resource: nr\n ).build(&resource_attrs_block)\n end",
"def new\n @resource = Resource.new \n @text = Text.new\n end",
"def new\n @resource = Resource.new\n end",
"def create_new_resource(resource_descr, type_to_create, authorizer)\n debug \"create_new_resource: resource_descr: #{resource_descr}, type_to_create: #{type_to_create}\"\n\n # New resource creation method, pass through the model\n begin\n model_obj = eval(\"OMF::SFA::Model::#{type_to_create}\")\n if model_obj.respond_to?(:handle_rest_resource_creation)\n resource = model_obj.handle_rest_resource_creation(resource_descr, authorizer, get_scheduler)\n return resource\n end\n rescue => ex\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Problem to create the resource. Reason: #{ex.reason}\"\n end\n\n debug \"Resource '#{type_to_create}' doesn't have the handle_rest_resource_creation method, proceeding with the default creation proccess...\"\n\n authorizer.can_create_resource?(resource_descr, type_to_create)\n resource = nil\n if resource_descr.kind_of? Array\n descr = []\n resource_descr.each do |res|\n res_descr = {}\n res_descr.merge!({uuid: res[:uuid]}) if res.has_key?(:uuid)\n res_descr.merge!({name: res[:name]}) if res.has_key?(:name)\n descr << res_descr unless eval(\"OMF::SFA::Model::#{type_to_create}\").first(res_descr)\n end\n raise OMF::SFA::AM::Rest::BadRequestException.new \"No resources described in description #{resource_descr} is valid. Maybe all the resources alreadt=y exist.\" if descr.empty?\n elsif resource_descr.kind_of? Hash\n descr = {}\n descr.merge!({uuid: resource_descr[:uuid]}) if resource_descr.has_key?(:uuid)\n descr.merge!({name: resource_descr[:name]}) if resource_descr.has_key?(:name)\n descr.merge!({urn: resource_descr[:urn]}) if resource_descr.has_key?(:urn)\n\n if descr.empty?\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Resource description is '#{resource_descr}'.\"\n else\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Resource with descr '#{descr} already exists'.\" if eval(\"OMF::SFA::Model::#{type_to_create}\").first(descr)\n end\n end\n\n if resource_descr.kind_of? Array\n resource = []\n resource_descr.each do |res_desc|\n resource << eval(\"OMF::SFA::Model::#{type_to_create}\").create(res_desc)\n manage_resource(resource.last) if resource.last.account.nil?\n if type_to_create == 'Account'\n @liaison.create_account(resource.last)\n end\n end\n elsif resource_descr.kind_of? Hash\n begin\n resource = eval(\"OMF::SFA::Model::#{type_to_create}\").create(resource_descr)\n rescue => ex\n raise OMF::SFA::AM::Rest::BadRequestException.new \"Resource description is invalid: #{ex.to_s}\"\n end\n manage_resource(resource) if resource.class.can_be_managed?\n if type_to_create == 'Account'\n @liaison.create_account(resource)\n end\n end\n resource\n end",
"def initialize(type: nil, name: nil, created_at: nil, params: nil, run_context: nil, cookbook_name: nil, recipe_name: nil, enclosing_provider: nil)\nsuper if defined?(::Chef::ResourceBuilder)\n @type = type\n @name = name\n @created_at = created_at\n @params = params\n @run_context = run_context\n @cookbook_name = cookbook_name\n @recipe_name = recipe_name\n @enclosing_provider = enclosing_provider\n end",
"def create_resource(type, name, attributes=[])\n result = Simp::Cli::Utils::show_wait_spinner {\n # puppet command won't necessarily exit with a non-0 exit code upon\n # failure, but will definitely return the status of the resource on\n # success\n cmd_succeeded = true\n cmd = \"puppet resource #{type} #{name} ensure=present #{attributes.join(' ')} --to_yaml\"\n result = run_command(cmd)\n if result[:stdout].match(/ensure:\\s+present/)\n info(\"Created #{type} '#{name}'\")\n else\n err_msg = \"Unable to create #{type} '#{name}'\"\n # if command failed but returned 0, error messages not already logged\n err_msg += \":\\n#{result[:stderr]}\" if result[:status]\n error(err_msg)\n cmd_succeeded = false\n end\n cmd_succeeded\n }\n\n result\n end",
"def build_resource(hash=nil, student_id=nil)\n hash[:student_id] = student_id\n self.resource = resource_class.new_with_session(hash || {}, session)\n end",
"def initialize(resource_path, parameters = {})\n @resource_path = resource_path\n @parameters = parameters\n end",
"def initialize(resource_path, parameters = {})\n @resource_path = resource_path\n @parameters = parameters\n end",
"def create_object\n definition.sought_type.new\n end",
"def create\n Puppet.debug( \"#{self.resource.type}: CREATE #{resource[:name]}\" ) \n end",
"def build_resource(hash = nil)\n # Строка из шаблона\n self.resource = resource_class.new_with_session(hash || {}, session)\n # Создание и привязка компании если параметры переданы\n self.resource.company_id = Company.create(company_params).id if company_params.present?\n # Добавляем админские права если первый пользователь\n self.resource.admin = true if self.resource.company && self.resource.company.users.count < 1\n end",
"def create_resource(resource_descr, type_to_create, authorizer)\n raise InsufficientPrivilegesException unless authorizer.can_create_resource?(resource_descr, type_to_create)\n\n if resource_descr[:account_id].nil?\n resource = eval(\"OMF::SFA::Model::#{type_to_create.classify}\").create(resource_descr)\n resource = manage_resource(resource)\n else\n resource = @scheduler.create_child_resource(resource_descr, type_to_create, nil)\n end\n\n raise UnknownResourceException.new \"Resource '#{resource_descr.inspect}' cannot be created\" unless resource\n resource\n end",
"def initialize(*args)\n super\n self.type = self.class.name\n end",
"def resource(name, &block)\n # It creates a new class based on the resource name scoped tot he Scrumy module\n klass = Scrumy::Models.const_set(name.to_s.classify, Class.new(Scrumy::Models::Model))\n # Then executes the block on the class. The class provides several class\n # methods for making instances behave correctly.\n klass.class_exec &block\nend",
"def find_or_create_resource_for(name)\n resource_name = name.to_s.camelize\n resource_name.constantize\n rescue NameError\n resource = self.class.const_set(resource_name, Class.new(ActiveResource::Base))\n resource.prefix = self.class.prefix\n resource.site = self.class.site\n resource\n end",
"def object_with_type(cl)\n o = cl.allocate.compile_time_init\n name = cl.name.split(\"::\").last.to_sym\n o.set_type @types[name]\n o\n end",
"def new(*args)\n self.class.new(*args)\n end",
"def build_resource(hash=nil)\n super\n end",
"def initialize(resource_types = nil)\n resource_types = [] if resource_types.nil?\n resource_types = [resource_types] unless resource_types.is_a?(Array)\n super(resource_types)\n end",
"def instantiate(*args)\n clazz.new(*args)\n end",
"def new(*args)\n self.class.new(*args)\n end",
"def create(*args)\n raise NotImplementedError, 'Implement a method to create the resource.'\n end",
"def create; super(:type); end",
"def build(name:, **config)\n new_resource = self.new(name: name, **config)\n yield new_resource if block_given?\n new_resource\n end",
"def build(attrs = {})\n attrs[:type] ? attrs[:type].constantize.new(attrs) : new(attrs)\n end",
"def resource_form_hash(hash)\n return unless hash['type']\n klass_name = hash['type']\n klass = resource_klass(klass_name)\n return unless klass\n klass.new(hash)\n end",
"def new\n @resource_type = ResourceType.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_type }\n end\n end",
"def create_from_properties(properties = {})\n check_property_value(properties, :type)\n\n require 'opsview_rest/entity'\n entity = OpsviewRest::Entity.new(properties[:type], properties)\n create(entity)\n end",
"def create_new_resource(resource_descr, type_to_create, authorizer)\n debug \"create_new_resource: resource_descr: #{resource_descr}, type_to_create: #{type_to_create}\"\n raise 'Method not implemented because the Central Manager just need to pass the same requisition to the other' \\\n ' brokers and create the concatenated results'\n end",
"def initialize(client, path, resource_type)\n @client = client\n @path = path\n\n if INCONSISTENT_RESOURCE_TYPES.has_key?(get_singular(resource_type))\n resource_type = INCONSISTENT_RESOURCE_TYPES[get_singular(resource_type)] + 's'\n end\n @resource_type = resource_type\n # Add create methods for the relevant root RightApi::Resources\n self.define_instance_method('create') do |*args|\n client.send(:do_post, path, *args)\n end\n\n # Add in index methods for the relevant root RightApi::Resources\n self.define_instance_method('index') do |*args|\n # Session uses .index like a .show (so need to treat it as a special case)\n if resource_type == 'session'\n ResourceDetail.new(client, *client.send(:do_get, path, *args))\n else\n RightApi::Resource.process(client, *client.send(:do_get, path, *args))\n end\n end\n\n # Adding in special cases\n Helper::RESOURCE_SPECIAL_ACTIONS[resource_type].each do |meth, action|\n # Insert_in_path will NOT modify path\n action_path = insert_in_path(path, meth)\n self.define_instance_method(meth) do |*args|\n client.send(action, action_path, *args)\n end\n end if Helper::RESOURCE_SPECIAL_ACTIONS[resource_type]\n end",
"def create(resource, format=@default_format)\n options = { resource: resource.class, format: format }\n reply = post resource_url(options), resource, fhir_headers(options)\n if [200,201].include? reply.code\n type = reply.response[:headers][:content_type]\n if !type.nil?\n if type.include?('xml') && !reply.body.empty?\n reply.resource = resource.class.from_xml(reply.body)\n elsif type.include?('json') && !reply.body.empty?\n reply.resource = resource.class.from_fhir_json(reply.body)\n else\n reply.resource = resource # just send back the submitted resource\n end\n else\n reply.resource = resource # don't know the content type, so return the resource provided\n end\n else\n reply.resource = resource # just send back the submitted resource\n end\n reply.resource_class = resource.class\n reply\n end",
"def initialize(params={})\n @name = params[:name]\n @type = params[:type]\n if params.key? :protocol\n @protocols = [ params[:protocol] ]\n else\n @protocols = params[:protocols] || []\n end\n if params.key? :ontology\n @ontologies = [ params[:ontology] ]\n else\n @ontologies = params[:ontologies] || []\n end\n if params.key? :language\n @languages = [ params[:language] ]\n else\n @languages = params[:languages] || []\n end\n @ownership = params[:ownership] || []\n @properties = params[:properties] || {}\n end",
"def new_resource model = controller_model\n resource || set_resource(model.new.tap do |record|\n settings = params[model.name.underscore] || {}\n attributes = params_with_parents(model).merge(settings)\n record.assign_attributes attributes, as: current_role\n end)\n end",
"def register(resource_type, filename, object)\n\t resource = resource_type.new(@server, filename, object)\n\t add(resource)\n\t resource\n\tend"
] | [
"0.76849955",
"0.73631656",
"0.7278977",
"0.71374035",
"0.7045993",
"0.7015812",
"0.6947854",
"0.69027716",
"0.68373656",
"0.6716825",
"0.6695796",
"0.66533244",
"0.66483086",
"0.66313326",
"0.6626307",
"0.66015065",
"0.65786743",
"0.6543751",
"0.6538809",
"0.64925677",
"0.64865375",
"0.647838",
"0.6440382",
"0.6419989",
"0.6401147",
"0.6388428",
"0.63842505",
"0.6370773",
"0.6351075",
"0.6351075",
"0.63495624",
"0.6347265",
"0.63308203",
"0.6321641",
"0.6321641",
"0.6321641",
"0.6321641",
"0.6321641",
"0.6321641",
"0.6321641",
"0.6321641",
"0.6321641",
"0.6321641",
"0.6319108",
"0.6313397",
"0.6305574",
"0.6284003",
"0.62606984",
"0.62518036",
"0.62396806",
"0.62318414",
"0.62237805",
"0.6193651",
"0.6190902",
"0.6181569",
"0.6181569",
"0.6144484",
"0.6132708",
"0.6126887",
"0.61109513",
"0.6064865",
"0.6053085",
"0.6049669",
"0.6031284",
"0.6027268",
"0.6013611",
"0.6010422",
"0.59998465",
"0.5993577",
"0.59877956",
"0.59812635",
"0.59789956",
"0.5978974",
"0.5978974",
"0.59737223",
"0.596972",
"0.5968311",
"0.59492403",
"0.5947225",
"0.59469336",
"0.59365803",
"0.5926137",
"0.59261185",
"0.59190476",
"0.5911534",
"0.5905891",
"0.59048975",
"0.59016305",
"0.590124",
"0.58942765",
"0.5891631",
"0.5869408",
"0.58506954",
"0.5843123",
"0.5840304",
"0.5835116",
"0.5831249",
"0.581108",
"0.58090377",
"0.5808163"
] | 0.70916575 | 4 |
Use callbacks to share common setup or constraints between actions. | def set_concepto
@concepto = Concepto.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] | 0.0 | -1 |
Only allow a list of trusted parameters through. | def concepto_params
params.require(:concepto).permit(:clave, :description, :capitulo_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\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 strong_params\n params.require(:user).permit(param_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 allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\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 allowed?(*_)\n true\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 allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"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 permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; 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 url_allowlist=(_arg0); 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 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 list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def params(list)\n @declared_params = list\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def safelist; end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\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 shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] | [
"0.69490993",
"0.6812977",
"0.6801889",
"0.67950445",
"0.6745037",
"0.6740698",
"0.65270424",
"0.6519444",
"0.6492448",
"0.6430671",
"0.6430671",
"0.6430671",
"0.63992614",
"0.6355569",
"0.6354901",
"0.63456345",
"0.63430274",
"0.63376623",
"0.6327184",
"0.6327184",
"0.6327184",
"0.6312343",
"0.6298636",
"0.6264699",
"0.62606114",
"0.6257774",
"0.62360454",
"0.6227809",
"0.62203985",
"0.6220124",
"0.6208926",
"0.6198754",
"0.61961126",
"0.61733264",
"0.61565864",
"0.6156045",
"0.61525464",
"0.6135898",
"0.6120792",
"0.61104727",
"0.6074026",
"0.60715514",
"0.6061967",
"0.6055065",
"0.6044363",
"0.60349673",
"0.60197556",
"0.60169685",
"0.60148275",
"0.6010643",
"0.60085577",
"0.6007718",
"0.6006462",
"0.6004975",
"0.6004975",
"0.599722",
"0.599272",
"0.5991751",
"0.59836066",
"0.5970689",
"0.59686905",
"0.5965213",
"0.59646696",
"0.59614",
"0.5960139",
"0.5933335",
"0.5928459",
"0.59223276",
"0.5907845",
"0.5903901",
"0.5903133",
"0.58924323",
"0.58886814",
"0.5880674",
"0.5880674",
"0.5880674",
"0.58724785",
"0.58617043",
"0.5853673",
"0.5843668",
"0.5842991",
"0.58351576",
"0.5831751",
"0.58289963",
"0.5827831",
"0.58164775",
"0.5814396",
"0.5814107",
"0.58099633",
"0.5802532",
"0.5802532",
"0.57996815",
"0.57947254",
"0.5784507",
"0.57802397",
"0.5776441",
"0.57747304",
"0.5767034",
"0.5766118",
"0.57619715",
"0.57567734"
] | 0.0 | -1 |
Update Keywords if needed by adding it from tags in forms | def set_page_defaults
@site_defaults = SiteConfiguration.all
@page_title ||= 'Aeromotion Pages'
@seo_keywords ||= 'Aeromotion, Tutorials, Workouts, Best Trainings, Free Videos, Personal, Best'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keywords_attributes=(new_keywords)\n keywords.clear\n\n (new_keywords || []).each do |word|\n keywords.build(:word => word)\n end\n end",
"def index_keywords!\n update_attribute(:_keywords, set_keywords)\n end",
"def update_tag_keyword(keyword,tags_set=[],args={})\n @tag_keyword[keyword] += tags_set\n @tag_blck[:keyword][keyword] += new_tags_set if args[:mode] && args[:mode] == :blck\n end",
"def update\n words = params['replacelist'].split(/\\s+/)\n words << '?' if words.length.odd? #ensure even-number length to make a hash\n replacelist = Hash[*words]\n Setting['replacelist'] = replacelist\n Setting['blacklist'] = params['blacklist'].split(/[\\r\\n]+/)\n redirect_to :controller => 'admin/keywords', :action => :index\n end",
"def update!(**args)\n @words = args[:words] if args.key?(:words)\n end",
"def set_keywords\n\t\t\tself.keywords = [title, author, description].map(&:downcase).join(' ')\n\t\tend",
"def tags\n records.each do |record|\n KEYWORDS_TAGGER.each do |name, keywords|\n record[name] = keywords.find {|keyword| record[:text].include?(keyword) }\n end\n end\n end",
"def set_search_terms\n if relevent_dish\n self.search_terms = self.name_translations.collect do |key,value|\n next value\n end.join(\" \")\n if self.restaurant\n self.restaurant_name = self.restaurant.name\n end\n if img = self.image.first\n self.top_image = img.img_url_medium\n end\n else\n self.search_terms = nil\n end\n save\n end",
"def render_keywords(tags)\n keywords = TextNormalizer.normalize_keywords(meta_tags.extract(:keywords))\n normalized_meta_tags[:keywords] = keywords\n tags << Tag.new(:meta, :name => :keywords, :content => keywords) if keywords.present?\n end",
"def set_Keywords(value)\n set_input(\"Keywords\", value)\n end",
"def keywords_attributes=(new_keyword_ids)\n self.mirrored_with_taggings = true\n assign_new_keywords!(new_keyword_ids: new_keyword_ids)\n end",
"def update_tags!\n return unless @params.key?(:tags)\n\n tags_to_remove.each do |tag_title|\n TaskTag.where(task: task).joins(:tag).merge(Tag.where(title: tag_title)).destroy_all\n end\n\n tags_to_add.each do |tag_title|\n TaskTag.where(task: task, tag: tag_from_title(tag_title)).first_or_create!\n end\n end",
"def update\n new_tags = params[:problem].to_unsafe_h[\"tag_list\"].scan(/\\w+/)\n new_tags.each do |tag|\n @problem.tag_list.add(tag)\n end\n respond_to do |format|\n if @problem.save\n format.html { redirect_to @problem, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @problem }\n else\n format.html { render :edit }\n format.json { render json: @problem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_keywords\n self.search_fields.keys.each do |namespace| \n self._keywords[namespace] = self.search_fields[namespace].map do |field|\n if field.is_a?(Hash) \n field.keys.map do |key|\n attribute = self.send(key)\n method = field[key] \n attribute = [attribute] if !attribute.is_a?(Array) \n method = [method] if !method.is_a?(Array)\n method.map {|m| attribute.map { |a| Util.keywords a.send(m), stem_keywords[namespace], ignore_list[namespace] } }\n end\n else \n value = self[field]\n value = [value] if !value.is_a?(Array)\n value.map {|v| Util.keywords(v, stem_keywords[namespace], ignore_list[namespace]) if v}\n end\n end.flatten.map(&:to_s).select{|f| not f.empty? }.uniq.sort\n \n end\n end",
"def update_tags(tags)\n rescue_extra_data\n tags = tags.split(\",\").strip\n post_tags = post_type.post_tags\n post_tags = post_tags.where.not(name: tags) if tags.present?\n term_relationships.where(\"term_taxonomy_id in (?)\", post_tags.pluck(\"#{CamaleonCms::TermTaxonomy.table_name}.id\")).destroy_all\n tags.each do |f|\n post_tag = post_type.post_tags.where({name: f}).first_or_create(slug: f.parameterize)\n term_relationships.where({term_taxonomy_id: post_tag.id}).first_or_create\n end\n update_counters(\"tags\")\n end",
"def fix_keywords\n @fix_keywords_cache ||= all_applicable_hooks.map do |hook|\n hook.keywords.map { |keyword| keyword.downcase.strip }\n end.flatten.uniq\n end",
"def remove_keyword_in_requirements\n reqs = Requirement.where(project: project)\n reqs.each do |req|\n next unless req.description.grep(%r{<abbr title='[A-Za-z0-9 ,.\\-]*'>#{key}</abbr>})\n newdesc = req.description.gsub(%r{<abbr title='[A-Za-z0-9 ,.\\-]*'>#{key}</abbr>}, key)\n req.update(description: newdesc)\n req.save\n end\n end",
"def add_keyword\n @item.keywords = @bib.keyword.map(&:content).join(\", \") if @bib.keyword.any?\n end",
"def update_search_words!\n my_string = to_s\n if latest_resource\n my_string << \" #{latest_resource.title}\"\n my_string << ' ' << latest_resource.authors.map do |author|\n \"#{author.author_first_name} #{author.author_last_name} #{author.author_email} #{author.author_orcid}\"\n end.join(' ')\n my_string << abstracts\n end\n self.search_words = my_string\n # this updates without futher callbacks on me\n update_column :search_words, my_string\n end",
"def update_search_words!\n my_string = to_s\n if latest_resource\n my_string << \" #{latest_resource.title}\"\n my_string << ' ' << latest_resource.authors.map do |author|\n \"#{author.author_first_name} #{author.author_last_name} #{author.author_email} #{author.author_orcid}\"\n end.join(' ')\n my_string << abstracts\n end\n self.search_words = my_string\n # this updates without futher callbacks on me\n update_column :search_words, my_string\n end",
"def keyword_params\n params.require(:keyword).permit(:site_id, :word)\n end",
"def update_pose_words\n\n # Step 1: get an array of all words for the current object.\n search_text = instance_eval &(self.class.pose_content)\n new_words = Query.new([], search_text.to_s).query_words\n\n # Step 2: Add new words to the search index.\n Helpers.get_words_to_add(self.pose_words, new_words).each do |word_to_add|\n self.pose_words << Word.find_or_create_by(text: word_to_add)\n end\n\n # Step 3: Remove now obsolete words from search index.\n Helpers.get_words_to_remove(self.pose_words, new_words).each do |word_to_remove|\n self.pose_words.delete word_to_remove\n end\n end",
"def keywords_field= params\n\t\t\t\ttmp = params.uniq\n\t\t\t\tself.keywordings.each do |k|\n\t\t\t\t\tself.keywords.delete(k.keyword) unless tmp.delete(k.keyword.name)\n\t\t\t\tend\n\t\t\t\ttmp.each do |keyword_name|\n\t\t\t\t\tkeyword = Keyword.find(:first, :conditions => { :name => keyword_name }) || Keyword.new(:name => keyword_name)\n\t\t\t\t\tself.keywordings.build(:keyword => keyword)\n\t\t\t\tend\n\t\t\tend",
"def set_keywords\n self._keywords = self.search_fields.map do |field|\n if field.is_a?(Hash)\n field.keys.map do |key|\n attribute = self.send(key)\n method = field[key]\n if attribute.is_a?(Array)\n if method.is_a?(Array)\n method.map {|m| attribute.map { |a| KeywordsExtractor.extract a.send(m) } }\n else\n attribute.map(&method).map { |t| KeywordsExtractor.extract t }\n end\n else\n KeywordsExtractor.extract(attribute.send(method))\n end\n end\n else\n KeywordsExtractor.extract(self.send(field))\n end\n end.flatten.compact.sort\n end",
"def update!(**args)\n @glossary = args[:glossary] if args.key?(:glossary)\n @ignore_case = args[:ignore_case] if args.key?(:ignore_case)\n end",
"def keywords\n @keywords_accessed = true\n @keywords\n end",
"def replace_keyword_in_requirement\n reqs = Requirement.where(project: project)\n reqs.each do |req|\n next unless req.description.include?(key)\n abbr = \"<abbr title='#{definition}'>#{key}</abbr>\"\n newdesc = if req.description[%r{<abbr title='[A-Za-z0-9 ,.\\-]*'>#{key}</abbr>}]\n req.description.gsub(%r{<abbr title='[A-Za-z0-9 ,.\\-]*'>#{key}</abbr>}, abbr)\n else\n req.description.gsub(key, abbr)\n end\n req.update(description: newdesc)\n req.save\n end\n end",
"def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @search_keywords_counts = args[:search_keywords_counts] if args.key?(:search_keywords_counts)\n end",
"def update\r\n @keyword = Keyword.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @keyword.update_attributes(params[:keyword])\r\n format.html { redirect_to(admin_keywords_url, :notice => \"#{@keyword.title} was successfully updated.\") }\r\n format.xml { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @keyword.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n check_access\n tags_before_change = @word.tags\n respond_to do |format|\n if @word.update(word_params)\n handle_tags(tags_before_change)\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @tags = args[:tags] if args.key?(:tags)\n end",
"def update!(**args)\n @tags = args[:tags] if args.key?(:tags)\n end",
"def update!(**args)\n @spoken_languages = args[:spoken_languages] if args.key?(:spoken_languages)\n end",
"def setKeywords(keywords)\n @fields['keywords'] = keywords\n self\n end",
"def setKeywords(keywords)\n @fields['keywords'] = keywords\n self\n end",
"def setKeywords(keywords)\n @fields['keywords'] = keywords\n self\n end",
"def setKeywords(keywords)\n @fields['keywords'] = keywords\n self\n end",
"def before_create\n keywords = []\n subkeywords = []\n end",
"def set_words\n @en_word = params[:en] && English.find_by(name: params[:en].downcase)\n @ru_word = params[:ru] && Russian.find_by(name: params[:ru].downcase)\n end",
"def update\n @joke = Joke.find(params[:id])\n\n respond_to do |format|\n str_tags = params[:joke][:tags].split(',')\n @tags = str_tags.map {|tag_name|\n Tag.find_or_create_by_name(tag_name)\n }\n @joke.tags = @tags\n \n if @joke.update_attributes(params[:joke].except(:tags))\n format.html { redirect_to @joke, :notice => 'Joke was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @joke.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @descriptions = Utils::I18n.sort_descriptions(@dictionary.dictionary_descriptions)\n\n if @dictionary.update_attributes(params[:dictionary])\n redirect_to admin_dictionary_path(@dictionary), notice: 'Dictionary was successfully updated.'\n else\n render :edit\n end\n end",
"def set_keywords=(value)\n self.product_keywords = value ? value.split(',').map{|w| w.strip} : []\n end",
"def set_keywords=(value)\n self.product_keywords = value ? value.split(',').map{|w| w.strip} : []\n end",
"def set_keywords=(value)\n self.product_keywords = value ? value.split(',').map{|w| w.strip} : []\n end",
"def set_RelatedWords(value)\n set_input(\"RelatedWords\", value)\n end",
"def update\n @keyword = Keyword.find(params[:id])\n\n respond_to do |format|\n if @keyword.update_attributes(params[:keyword])\n flash[:notice] = 'Keyword was successfully updated.'\n format.html { redirect_to(@keyword) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @keyword.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_keywords(keyword_titles)\n self.keywords = []\n keyword_titles.each do |keyword_title|\n keyword = Keyword.where(title: keyword_title).first_or_create\n self.keywords << keyword\n end\n self.keywords = self.keywords.uniq\n end",
"def update!(**args)\n @supported_language_tags = args[:supported_language_tags] if args.key?(:supported_language_tags)\n end",
"def update\n respondent = SurveyRespondent.find(params[:respondent_id])\n tag_context = params[:context] # tag context\n tag_list = params[:tags] # comma seperated list of tags\n\n if getTagOwner\n getTagOwner.tag(respondent, :with => tag_list, :on => tag_context)\n else\n respondent.set_tag_list_on(tag_context, tag_list) # set the tag list on the respondent for the context\n end\n \n respondent.save\n \n render :layout => 'content'\n end",
"def keyword_params\n params.require(:keyword).permit(:value, :site_id)\n end",
"def update!(**args)\n @key = args[:key] if args.key?(:key)\n @synonyms = args[:synonyms] if args.key?(:synonyms)\n end",
"def update!(**args)\n @key = args[:key] if args.key?(:key)\n @synonyms = args[:synonyms] if args.key?(:synonyms)\n end",
"def set_keyword\n @keyword = Keyword.friendly.find(params[:id])\n end",
"def set_keywords\n # keywords = '' -> can't write this way because keywords will only be a\n # local variable and won't reference the model's property. would work if\n # we were wanting to read only but not for property assignment\n self.keywords = [title, author, description].map(&:downcase).join(' ')\n # &: is symbol to proc\n # it knows that the variables in the array are referring to properties on\n # self\n end",
"def keyword!(keyword_ids:)\n action = mirrored_with_taggings? ? :build : :create\n keyword_ids.each { |id| taggings.send(action, tag_id: id) }\n end",
"def update\n respond_to do |format|\n if @suspicious_keyword.update(suspicious_keyword_params)\n format.html { redirect_to @suspicious_keyword, notice: 'Suspicious keyword was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @suspicious_keyword.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @headword = Headword.find(params[:id])\n\n respond_to do |format|\n if @headword.update(params.fetch(:headword, {}).permit(allowed_params))\n flash[:notice] = 'Headword was successfully updated.'\n format.html { redirect_to(@headword) }\n format.xml { head :ok }\n else\n format.html { render action: 'edit' }\n format.xml { render xml: @headword.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @screen = session.active_screen\n @form_content_reuse = params[:form_content_reuse]\n\n @label = Label.find(params[:id])\n\n @label.update_attributes(params[:label])\n \n if @label.errors.empty?\n @captions = params[:captions]\n @captions.each do |language_id, caption_name|\n caption = Caption.find(:first ,\n :conditions => {\n :captions => { :label_id => @label.id , :language_id => language_id }\n }\n )\n caption.update_attributes(\n :name => caption_name\n )\n end\n end\n end",
"def set_keywords\n product_keywords ? product_keywords.join(', ') : ''\n end",
"def set_keywords\n product_keywords ? product_keywords.join(', ') : ''\n end",
"def set_keywords\n product_keywords ? product_keywords.join(', ') : ''\n end",
"def update\n @keyword = Keyword.find(params[:id])\n\n respond_to do |format|\n if @keyword.update_attributes(keyword_params)\n flash[:notice] = ts('edit.successful', :what => Keyword.model_name.human.capitalize)\n format.html { redirect_to keywords_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @keyword.errors.to_xml }\n end\n end\n end",
"def update\n @word_list = current_user.word_list\n\n #need to first remove categories from the word\n @word.categories.each do |category|\n @word.categories.delete category\n end\n\n #then push categories in from the category_params\n if params[\"category\"].include?(:category_ids)\n (params[\"category\"])[\"category_ids\"].each do |i|\n next if i.to_i == 0\n @word.categories << Category.find(i.to_i) unless @word.categories.include?(Category.find(i.to_i))\n end\n end\n\n if category_params.include?(:title) && ((params[\"category\"])[\"title\"]) != \"\"\n @word.categories << @word_list.categories.build(title: (params[\"category\"])[\"title\"])\n end\n\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to @word_list, notice: 'Word was successfully updated.' }\n #format.json { render :show, status: :ok, location: @word }\n else\n format.html { render :edit }\n #format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_tool_keywords\n keywords = fetch_science_keywords\n if keywords.key? 'category'\n keywords['category'].each do |category|\n if category['value'] == 'EARTH SCIENCE'\n keywords['category'].delete(category)\n break\n end\n end\n end\n @tool_keywords = keywords\n end",
"def all_tags=(keywords)\n self.tags = keywords.split(',').map do |keyword|\n Tag.where(keyword: keyword.strip).first_or_create!\n end\n end",
"def update!(**args)\n @language = args[:language] if args.key?(:language)\n @sentences = args[:sentences] if args.key?(:sentences)\n @tokens = args[:tokens] if args.key?(:tokens)\n end",
"def dictionary_params\n params.require(:dictionary).permit(:word, :pronunciation, :example, :meaning, :word_tag_relation_ships_attributes => :tag_id)\n end",
"def update\n respond_to do |format|\n if @keyword.update(params)\n format.html { redirect_to @keyword, notice: 'Keyword was successfully updated.' }\n format.json { render :show, status: :ok, location: @keyword }\n else\n format.html { render :edit }\n format.json { render json: @keyword.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_keyword\n journal = Journal.find(params[:journal_id])\n issue = journal.issues.find(params[:issue_id])\n article = issue.articles.find(params[:article_id])\n @keyword = article.keywords.find(params[:id])\n end",
"def update\n @key_word = KeyWord.find(params[:id])\n\n respond_to do |format|\n if @key_word.update_attributes(params[:key_word])\n format.html { redirect_to @key_word, notice: 'Key word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @key_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def keyword_params\n params.require(:keyword).permit(:title, :description)\n end",
"def initialize_keywords\n variants = []\n search_queries.each do |sq|\n variants << sq.keyword\n variants += sq.variants\n end\n\n update_column(:keywords, variants.uniq)\n end",
"def update\n @keyword = Keyword.find(params[:id])\n\n respond_to do |format|\n if @keyword.update_attributes(params[:keyword])\n format.html { redirect_to @keyword, notice: 'Keyword was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @keyword.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @keyword.update(keyword_params)\n format.html { redirect_to @keyword, notice: 'Keyword was successfully updated.' }\n format.json { render :show, status: :ok, location: @keyword }\n else\n format.html { render :edit }\n format.json { render json: @keyword.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @keyword.update(keyword_params)\n format.html { redirect_to @keyword, notice: 'Keyword was successfully updated.' }\n format.json { render :show, status: :ok, location: @keyword }\n else\n format.html { render :edit }\n format.json { render json: @keyword.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @keyword.update(keyword_params)\n format.html { redirect_to @keyword, notice: 'Keyword was successfully updated.' }\n format.json { render :show, status: :ok, location: @keyword }\n else\n format.html { render :edit }\n format.json { render json: @keyword.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @meme.update(meme_params)\n items = @meme.keywords_string.split(\" \")\n items.each do |item| \n attrs = { :key => item}\n @keyword = Keyword.new(attrs)\n if @keyword.save\n Mapping.create(:meme_id => @meme.id, :keyword_id => @keyword.id)\n end\n end\n format.html { redirect_to @meme, notice: 'Meme was successfully updated.' }\n format.json { render :show, status: :ok, location: @meme }\n else\n format.html { render :edit }\n format.json { render json: @meme.errors, status: :unprocessable_entity }\n end\n end\n end",
"def keyword_params\n params.require(:keyword).permit(:name, :course)\n end",
"def update\n story = Story.find(params[:id])\n authorize story # check policies/story_policy.rb for auth rules\n\n if story_params[:tags]\n story_params[:tags].each do |tag|\n # If tag exists then use existing tag name\n if Tag.exists?(tag)\n story.tags << Tag.find_by_name(tag[\"name\"])\n else\n story.tags << Tag.new(tag)\n end\n end\n end\n\n if story.update(story_params.except(:tags)) && story.save\n response_with('Story successfully saved', 200)\n else\n response_with('Could not update story', 400)\n end\n end",
"def add_forms_to_lexicon\n word = self\n forms = self.extract_verb_forms\n forms.each do |form|\n Lexicon.create!(item: form, kanji: word.word, hiragana: word.hiragana, romaji: word.reading, word: word)\n end\n end",
"def update!(**args)\n @knowledge_base_name = args[:knowledge_base_name] if args.key?(:knowledge_base_name)\n end",
"def update_tags\n tags=self.tag_ids.clone\n unless tags.nil?\n self.associations.each do |a|\n #destroy an association if its tag wasn't checked in the form\n a.destroy unless tags.include?(a.tag_id.to_s)\n #for each existing association, delete its tag from the parameters(to prevent duplicate associations)\n tags.delete(a.tag_id.to_s)\n end\n devs=Tag.find(:all,:conditions=>'type_id=4',:select=>'id').map{|d| d.id.to_s}\n genres=Tag.find(:all,:conditions=>'type_id=2',:select=>'id').map{|g| g.id.to_s}\n if (tags&devs).length==0\n indie=Tag.find_by_name('Independent')\n # if no developer has been selected, assume \"Independent\"\n self.associations.create(:tag_id=>indie.id)\n end\n if (tags&genres).length==0\n other=Tag.find_by_name('Other')\n # if no genre has been selected, assume \"Other\"\n self.associations.create(:tag_id=>other.id)\n end\n tags.each do |t|\n self.associations.create(:tag_id=>t) unless t.blank?\n end\n reload\n end\n end",
"def assign_new_keywords!(new_keyword_ids:)\n valid_new_keyword_ids = new_keyword_ids.find_all(&:present?).map(&:to_i)\n current_keyword_ids = keyword_ids\n keyword! keyword_ids: (valid_new_keyword_ids - current_keyword_ids)\n unkeyword! keyword_ids: (current_keyword_ids - valid_new_keyword_ids)\n end",
"def update\n @idea = Idea.find(params[:id])\n # get user to add comment, for now use dummy user\n user = User.first\n comment_body = params[:comment_body]\n unless comment_body.nil? or comment_body.empty?\n comment = Comment.build_from(@idea, user.id, comment_body)\n comment.save\n end\n old_keywords = @idea.keywords\n \n \n if(params.has_key?(:idea))\n keyword_ids = params[:idea][:keyword_ids]\n keywords =\n Keyword.select do |k|\n keyword_ids.include? k.id.to_s\n end\n keywords.each do |kw|\n unless old_keywords.include? kw\n @idea.keywords << kw\n end\n end\n old_keywords.each do |old|\n IdeaKeyword.find_by_keyword_id_and_idea_id(old.id, @idea.id).destroy unless keywords.include? old\n end\n respond_to do |format|\n if @idea.update(idea_params)\n format.html { redirect_to @idea, notice: 'Idea was successfully updated.' }\n format.json { head :no_content }\n else\n @keywords = Keyword.all\n \t\t\t@all = Keyword.all\n # Any other options to set comments? It shows now idea's comments after trying to update unvalid idea.\n \t\t\tset_comments\n format.html { render action: 'edit' }\n format.json { render json: @idea.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to @idea\n end\n end",
"def word_params\n params.require(:word).permit(\n :word_class,\n :lexical_form,\n :translation\n ).merge(dictionary_id: @dictionary.id)\n end",
"def word_params\n params.require(:word).permit(:word, :tag_list, definitions_attributes: [:definition, :URL])\n end",
"def set_Tags(value)\n set_input(\"Tags\", value)\n end",
"def set_Tags(value)\n set_input(\"Tags\", value)\n end",
"def set_Tags(value)\n set_input(\"Tags\", value)\n end",
"def set_Tags(value)\n set_input(\"Tags\", value)\n end",
"def set_Tags(value)\n set_input(\"Tags\", value)\n end",
"def set_Tags(value)\n set_input(\"Tags\", value)\n end",
"def update!(**args)\n @idf = args[:idf] if args.key?(:idf)\n @label = args[:label] if args.key?(:label)\n @original_term = args[:original_term] if args.key?(:original_term)\n @salience = args[:salience] if args.key?(:salience)\n @signal_term = args[:signal_term] if args.key?(:signal_term)\n @virtual_tf = args[:virtual_tf] if args.key?(:virtual_tf)\n @weight = args[:weight] if args.key?(:weight)\n end",
"def update\n @keyword = Keyword.find(params[:id])\n\n respond_to do |format|\n if @keyword.update_attributes(keyword_params)\n format.html { redirect_to admin_keyword_path(@keyword), notice: '关键词修改成功.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @keyword.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_keyword\n @keyword = Keyword.find(params[:id])\n end",
"def set_keyword\n @keyword = Keyword.find(params[:id])\n end",
"def update_meta_tag(key, value)\n set_meta_tags({key => value})\n end",
"def find_keywords(feedEntryUrl, tags)\n\tputs \"extracting keywords\"\n\tdoc = Nokogiri::HTML(open(feedEntryUrl))\n\t# LOAD THE DICTIONARY OF KEYWORDS\n\t@keywords = Keyword.all # change to select only new ones in the controller\n\tdoc.xpath('//@style').remove\n\tdoc.css(\"p\").each do |para| # PRETTY SURE THIS IS CRAZY INEFFECIENT!\n\t#paraString = para.to_s\t\n\tparaString = para.text\n\n\[email protected] do |keyword| \n\n\t\t# use regex to find the keywrods and end of sentences - probably could be more effecient!\t\n\t\t# CHANGE TO DYNAMIC KEYWORD! \n\t\t# AND FIX PLURALS! - put them all in with an 'or'?\n\n\t\tpositions = paraString.enum_for(:scan, /\\b#{Regexp.escape(keyword.word)}\\b/).map { Regexp.last_match.begin(0) }\n\t\tdots = paraString.enum_for(:scan, /[\\.\\?\\!]/).map { Regexp.last_match.begin(0) }\n\n\t\t# find the end of a sentence immediatly before a keyword\n\n\t\tif dots.length >=1 # maybe check that it's not a title by having a few fullstops in a P\n\n\t\t\tpositions.each do |position|\n\n\t\t\t\tdotBefore = dots.find_all {|i| i< position}.max\n\t\t\tdotBefore=-2 if dotBefore.nil? # start of string if no punctuation before\n\t\t\t# if it's the last sentence we might actually want to go back one\n\n\t\t\tresult = paraString[dotBefore+2, position+CharacterFollow]+\"...\"\n\n\t\t\tputs paraString\n\t\t\tPost.create!(:title => \"bam\",:content => paraString,:contentSummary => result,:score => 1, :image => \"radio.jpg\",:link => feedEntryUrl, :tags => tags, :datefound => DateTime.now, :keyword => keyword.word) \n\n\tend # each keyword\n\n\tend #each\n\n\tend #if a few sentences\n\n\nend\n\nLink.update_all(:updated_at => Time.now)\n\nend",
"def add_words(new_words)\n new_words.each do |word|\n add(word)\n end\n end",
"def update\n @keyword.user_id = current_user.id\n respond_to do |format|\n if @keyword.update(keyword_params)\n format.html { redirect_to @keyword, notice: 'Keyword was successfully updated.' }\n format.json { render :show, status: :ok, location: @keyword }\n else\n format.html { render :edit }\n format.json { render json: @keyword.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sync_mirrors_with_taggings\n return unless mirrored_with_taggings?\n\n mirrors.each do |mirror|\n mirror.assign_new_keywords!(new_keyword_ids: keyword_ids)\n end\n end"
] | [
"0.6670302",
"0.62784904",
"0.62550527",
"0.610361",
"0.6043887",
"0.5984678",
"0.58891",
"0.5854891",
"0.57896894",
"0.5763776",
"0.57595944",
"0.5712599",
"0.5695622",
"0.56488657",
"0.56357926",
"0.5614026",
"0.5610397",
"0.5608313",
"0.5605238",
"0.5605238",
"0.5598555",
"0.55851924",
"0.55833703",
"0.55414605",
"0.55395573",
"0.5531219",
"0.553029",
"0.5524794",
"0.55166954",
"0.55117923",
"0.54896474",
"0.54896474",
"0.5454851",
"0.5453048",
"0.5453048",
"0.5453048",
"0.5453048",
"0.5432558",
"0.5422729",
"0.5410062",
"0.5408885",
"0.5406516",
"0.5406516",
"0.5406516",
"0.540457",
"0.53951824",
"0.5394218",
"0.53892",
"0.5385783",
"0.5375849",
"0.537009",
"0.5369855",
"0.5368859",
"0.53666884",
"0.5358007",
"0.5355419",
"0.534495",
"0.53430897",
"0.5327078",
"0.5327078",
"0.5327078",
"0.5326693",
"0.53227913",
"0.53036296",
"0.52894074",
"0.5286139",
"0.52713007",
"0.5261487",
"0.5261028",
"0.52603185",
"0.5254084",
"0.52379143",
"0.5236033",
"0.5227884",
"0.5227884",
"0.5227884",
"0.5227509",
"0.5226421",
"0.5220298",
"0.52124774",
"0.52050555",
"0.5202947",
"0.52020454",
"0.51998645",
"0.5195703",
"0.51913166",
"0.51873076",
"0.51873076",
"0.51873076",
"0.51873076",
"0.51873076",
"0.51873076",
"0.51851016",
"0.5184593",
"0.5180296",
"0.5180296",
"0.51760054",
"0.517566",
"0.51748174",
"0.51729035",
"0.5172134"
] | 0.0 | -1 |
all methods defined below will be private | def validate_marital_status(val)
unless @valid_marital_statuses.include?(val)
raise "Invalid value: #{val}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def private_method\n end",
"def internal; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def private_method; end",
"def internal_methods; end",
"def methods() end",
"def implementation; end",
"def implementation; end",
"def public; end",
"def public; end",
"def private_method\n\tend",
"def private_method\n\tend",
"def private_method\n end",
"def public_method; end",
"def accessibility; end",
"def a_private_method\n\tend",
"def custom; end",
"def custom; end",
"def protected_method\n end",
"def overrides; 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 operations; end",
"def operations; end",
"def method_missing(wh,*therest)\n # xxx internal methods must be protected at some point\n end",
"def probers; end",
"def private_methods(all=true) end",
"def expose; end",
"def internal?; end",
"def hidden_apis=(_arg0); end",
"def private=(_); end",
"def hidden_apis; end",
"def a_private_method\n end",
"def who_we_are\r\n end",
"def private_instance_methods(include_super=true) end",
"def api; end",
"def api; end",
"def weber; end",
"def apis; end",
"def wrapper; end",
"def extra; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def methods\n super + DELEGATED_METHODS\n end",
"def method3 # will be 'private'\r\n\t\t# ...\r\n\tend",
"def delegating_method; end",
"def refutal()\n end",
"def methods=(_arg0); end",
"def schubert; end",
"def isolated; end",
"def isolated; end",
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def secret_method_2 # :nodoc:\n end",
"def attr_reader(*)\n end",
"def suivre; end",
"def public_methods(all=true) end",
"def method4 # and this will be 'public'\r\n\t\t#...\r\n\tend",
"def zuruecksetzen()\n end",
"def public_instance_methods(include_super=true) end",
"def handle; end",
"def method3 # will be 'private'\n #...\n end",
"def interface; end",
"def interface; end",
"def other_public_method\n end",
"def instance_methods; end",
"def runnable_methods; end",
"def runnable_methods; end",
"def protected_method\n\tend",
"def abstract!; end",
"def under_construction\n end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def method4 # and this will be 'public'\n #...\n end",
"def method3 # will be 'private'\n #...\n end",
"def method4 # and this will be 'public'\n #...\n end"
] | [
"0.883418",
"0.8352764",
"0.7879943",
"0.78659123",
"0.78659123",
"0.78659123",
"0.78659123",
"0.7794014",
"0.76174736",
"0.7615882",
"0.7503469",
"0.7503469",
"0.74436724",
"0.74436724",
"0.7321059",
"0.7321059",
"0.72571087",
"0.7196324",
"0.71493256",
"0.7031893",
"0.69764405",
"0.69764405",
"0.6963509",
"0.6934307",
"0.68170655",
"0.68170655",
"0.68170655",
"0.68170655",
"0.68170655",
"0.68170655",
"0.68170655",
"0.68170655",
"0.68170655",
"0.68170655",
"0.68170655",
"0.68170655",
"0.67615557",
"0.67615557",
"0.6757034",
"0.67317283",
"0.6707104",
"0.66389453",
"0.6636521",
"0.6629839",
"0.66101193",
"0.66100186",
"0.65681845",
"0.656165",
"0.6558369",
"0.654347",
"0.654347",
"0.6536376",
"0.6514502",
"0.65077484",
"0.6452163",
"0.64325553",
"0.64325553",
"0.64325553",
"0.64325553",
"0.6410519",
"0.64076453",
"0.6405744",
"0.6395077",
"0.6390302",
"0.6375314",
"0.6327579",
"0.6327579",
"0.63247687",
"0.63247687",
"0.63247687",
"0.6316566",
"0.6287792",
"0.628695",
"0.6284",
"0.6282858",
"0.62774503",
"0.62764776",
"0.62750846",
"0.6273616",
"0.6272927",
"0.6272927",
"0.62564456",
"0.62485266",
"0.62451655",
"0.62451655",
"0.62341326",
"0.6229564",
"0.622197",
"0.6214833",
"0.6214833",
"0.6214833",
"0.6214833",
"0.6214833",
"0.6214833",
"0.6214833",
"0.6214833",
"0.6214833",
"0.6214833",
"0.62110347",
"0.62037027",
"0.6201984"
] | 0.0 | -1 |
=begin input: float, output: string. rules: use two digit numbers with leading zeros when formatting minutes and seconds. Use constant to represent degree symbol. if num greater than 360... DS: string algo: define a method called dms, takes one float number parameter num init lv angle, set to empty string turn float num into a string, partition at the '.' angle << num[0], also DEGREE minutes_seconds_ary = ((num[1].to_f 60.0) / 10(num[1].size).to_f).to_s.partition('.') take num at index 0, append to angle plus ' symbol angle << ((minutes_seconds_ary[1].to_f 60.0) / 10(num[1].size).round).to_s, plus seconds symbol return angle =end | def dms(num)
angle_str = %()
num_ary = num.to_s.partition('.')
#degree
angle_str << (num_ary[0] + DEGREE)
minutes_seconds_ary = ((num_ary[-1].to_f * 60.0) / 10**(num_ary[-1].size).to_f).to_s.partition('.')
#minutes
if minutes_seconds_ary[0].size <= 1
angle_str << ('0' + minutes_seconds_ary[0] + "'")
else
angle_str << minutes_seconds_ary[0] + "'"
end
# seconds
seconds = ((minutes_seconds_ary[-1].to_f * 60)/(10**(minutes_seconds_ary[-1].size))).round.to_s
if seconds.size <= 1
angle_str << ('0' + seconds)
else
angle_str << seconds
end
angle_str + %("\"")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dms(angle)\n# How does LS round them?\n# Also we have to make sure that minutes and seconds esp are either *60 if < than 60, otherwise 0.\n if angle < 0\n degrees = 360 + angle\n elsif angle >= 0 && angle < 360\n degrees = angle.floor\n else\n degrees = angle.floor - 360\n end\n\n minutes = ((angle - angle.floor) * 60)\n seconds = ((minutes - minutes.floor) * 60)\n\n minutes = minutes.round < 60 ? minutes.round : 0\n seconds = seconds.round < 60 ? seconds.round : 0\n\n # It looks like only .99999 are rounded to the next whole number. otherwise fractional part is dropped.\n sprintf(\"%0d#{DEGREE}%02d'%02d\\\"\", degrees, minutes, seconds)\nend",
"def dms(number)\n number = number.abs\n return \"#{number}#{DEGREE}00'00\\\"\" if number.integer?\n degrees, remainder = number.divmod(1)\n remainder = remainder\n minutes, seconds = (MIN_OR_SEC * remainder).divmod(1)\n seconds = (seconds * MIN_OR_SEC).to_i\n format(\"%02d#{DEGREE}%02d'%02d#{'\"'}\", degrees, minutes, seconds) #+ \"\\\"\"\n # binding.pry\nend",
"def dms(degrees)\n degree = degrees.to_i\n remainder = degrees.to_f - degrees.to_i\n minutes = (remainder * 60).to_i\n remainder_of_seconds= (remainder*60) - (remainder*60).to_i\n seconds = remainder_of_seconds * 60\n\n min = sprintf '%02d', minutes\n sec = sprintf '%02d', seconds\n\n puts \"#{degree}#{DEGREE}#{min}'#{sec}\\\"\"\nend",
"def dms(degrees)\n originally_negative = false\n if degrees < 0 \n degrees = degrees.abs\n originally_negative = true\n end\n \n total_seconds = (degrees * SECONDS_IN_DEGREE).round # takes the degrees passed in and multiplies by 3600 to return the seconds, round with no arg rounds to 0 decimal numbers\n degrees_dms , seconds_remaining = total_seconds.divmod(SECONDS_IN_DEGREE) #divmod is used to calculate degrees using total amount of seconds, divmod also returns remainder\n # which is assigned to second remaining var.\n minutes, seconds = seconds_remaining.divmod(SECONDS_IN_MINUTE) # calculating the minutes now using the left over seconds from above ^^ \n \n if originally_negative == true\n format(%(-#{degrees_dms}#{DEGREE_SYMBOL}%02d'%02d\"),minutes,seconds)\n else\n format(%(#{degrees_dms}#{DEGREE_SYMBOL}%02d'%02d\"),minutes,seconds)\n end\n \nend",
"def strf(fmt = \"%d %2m'%2.4s\\\"\")\n tokens = fmt.scan(/%[0-9.]*[%dmsDMNErW]|[^%]*/)\n have_dir = have_dms = false\n tokens.collect! do |t|\n if t[0, 1] == '%' # format\n had_dot = false\n decimals = -1\n width = -1\n format = nil\n t[1..-1].scan(/[0-9]+|\\.|[0-9]+|[%dmsDMNErW]/) do |t2|\n case t2\n when /[0-9]+/\n if had_dot\n decimals = t2.to_i\n else\n width = t2.to_i\n end\n when '%', /[Dr]/\n format = t2\n when /[dmsMwW]/\n have_dms = true\n format = t2\n when /[NE]/\n have_dir = true\n format = t2\n when '.'\n had_dot = true\n else\n raise \"unknown format character '#{t2}'\" # shouldn't be able to get here.\n end\n end\n [ :format, width, decimals, format ]\n else\n [ :filler, t ]\n end\n end\n\n deg, min, sec = to_dms if have_dms\n\n s = ''\n tokens.each do |t|\n if t[0] == :format\n case t[3]\n when '%'\n s += '%'\n when 'd'\n s += s_int(deg, t[1], have_dir)\n when 'D'\n s += s_float(@angle.to_deg, t[1], t[2], have_dir)\n when 'm'\n s += s_int(min, t[1], have_dir)\n when 'M'\n s += s_float(min + (sec / 60), t[1], t[2], have_dir)\n when 'W'\n s += s_only_places(sec / 60, t[1])\n when 's'\n s += s_float(sec, t[1], t[2], have_dir)\n when 'r'\n s += s_float(@angle, t[1], t[2], have_dir)\n when 'N'\n s += (@angle < 0 ? 'S' : 'N')\n when 'E'\n s += (@angle < 0 ? 'W' : 'E')\n end\n else\n s += t[1] # the fillers.\n end\n end\n\n return s\n end",
"def to_s\n \"#{@degrees.round(2)} #{@scale}\"\n end",
"def format_angle(value, unit)\n if unit == :degree\n value + '°'\n else\n value + ' gon'\n end\n end",
"def dms_to_rational(sign, degrees, minutes, seconds = T.unsafe(nil)); end",
"def dms_to_rational(sign, degrees, minutes, seconds = T.unsafe(nil)); end",
"def toString\n\t\t\t\"#{@degrees.round(2)} #{@scale}\"\n\t\tend",
"def dec2dms(dec)\n dec = dec.to_f\n grau = dec.abs.to_i #usar dec.round pode levar a problemas de arredondamento para cima/baixo\n min = (dec.abs - dec.abs.to_i)*60\n seg = ((min.abs - min.to_i)*60)\n sinal=\"+\"\n sinal=\"-\" if dec.to_s.match(/^-|[sSoOwW]/)\n \"#{sinal}#{grau}º #{min.to_i}\\' #{seg.round(1)}\\\"\"\n end",
"def calc_angle(hours, minutes)\n angel = (minutes * 6 - (hours * 60 + minutes) * 0.5).abs\n if angel > 180\n 360 - angel.abs\n else\n angel.abs\n end\nend",
"def angle_deg\n angle * RAD_TO_DEG\n end",
"def to_decimal_degree\n return @degree + (@arcminute + (@arcsecond.fdiv(60))).fdiv(60)\n end",
"def format_speed(speed_m_s)\n\t\t(speed_m_s*3.6).round(1).to_s + ' km/h'\n\tend",
"def dms_to_rational(sign, degrees, minutes, seconds = nil)\n result = degrees.to_i + Rational(minutes.to_i, 60)\n result += Rational(seconds.to_i, 3600) if seconds\n result = -result if sign == '-'.freeze\n result\n end",
"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 decimal_to_coordinate\n\t\treturn nil if self.blank?\n\t\tvalue = self.to_f\n\n\t\t# Degrees\n\t\tdegrees = value.to_i\n\t\tvalue = value - degrees # Remove integer part\n\t\t\n\t\t# Minutes\n\t\tvalue = value * 60\n\t\tminutes = value.to_i\n\t\tvalue = value - minutes # Remove integer part\n\n\t\t# Seconds\n\t\tvalue = value * 60\n\t\tseconds = value.round(2)\n\t\t\n\t\tresult = \"#{degrees.to_s}°\"\n\t\tresult += \" #{minutes.to_s}'\"\n\t\tresult += \" #{seconds.to_s}\\\"\"\n\t\treturn result\n\tend",
"def duration_converter(ableton_value)\n\t\tif ableton_value.to_f < 4\n\t\t\t((1/ableton_value.to_f) * 4).to_i.to_s + 'n'\n\t\telse\n\t\t\t(ableton_value.to_f/4).to_i.to_s + 'm'\n\t\tend\n\tend",
"def time_string\r\n clock = @seconds.divmod(60)\r\n if clock[0] > 59\r\n \tb = clock[1]\r\n a = clock[0].divmod(60)\r\n clock = a.push(b)\r\n else\r\n clock.unshift(0)\r\n end\r\nclock.map! do |final|\r\n if final < 10\r\n \"0\" + final.to_s\r\n else\r\n final \r\n end\r\nend\r\n clock.join(\":\")\t\r\nend",
"def to_degs\n self * (180 / Math::PI)\n end",
"def dms ( d, m, s )\n return d + ( m + s/60.0 ) / 60.0\nend",
"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 to_s\n t = \"#{@numerator}/#{2**@denominator}\"\n m = @metronome_ticks.to_f / 24\n \"measure #{@measure_number} #{@start}-#{@end} #{t} #{m} qs metronome\"\n end",
"def angle(hour, minutes)\n (hour + minutes / 60) * 30 - minutes * 6\nend",
"def deg2rad(deg) \r\nreturn (deg * $pi / 180);\r\nend",
"def deg2deg(deg)\r\n remt(deg, 360)\r\n end",
"def duration\n return unless seconds\n\n m = seconds / 60\n s = sprintf('%02d', (seconds % 60))\n\n \"#{m}:#{s}\"\n end",
"def get_timing\r\n (time_swam.minutes.to_i > 0 ? \"#{time_swam.minutes.to_i}'\" : '') +\r\n format('%02.0f\"', time_swam.seconds.to_i) +\r\n format('%02.0f', time_swam.hundreds.to_i)\r\n end",
"def get_dhms(seconds)\n seconds = Integer(seconds)\n ss = seconds % 60\n seconds = seconds / 60\n\n mm = seconds % 60\n seconds = seconds / 60\n\n hh = seconds % 24\n seconds = seconds / 24\n\n dd = seconds\n\n if (dd > 0)\n return \"%dd %02dh %02dm %02ds\" % [dd, hh, mm, ss]\n elsif (hh > 0)\n return \"%dh %02dm %02ds\" % [hh, mm, ss]\n elsif (mm > 0)\n return \"%dm %02ds\" % [mm, ss]\n else\n return \"%ds\" % ss\n end\nend",
"def to_s\n \"time sig #{@data[0]}/#{2**@data[1]}\"\n end",
"def mjd_stamp\n \"%0.5f\" % (mjd + mjd_fraction)\n end",
"def cal_angle(hour, min)\n one_min_angle = 2 * Math::PI / 60.0\n one_hour_angle = 2 * Math::PI / 12.0\n hour_angle = one_hour_angle * (hour + (min / 60.0))\n min_angle = min * one_min_angle\n ((hour_angle - min_angle) % (2 * Math::PI)).abs\nend",
"def time_delta_string seconds\n return 'less than a minute' if seconds < 60\n return \"#{seconds / 60} minute#{seconds / 60 == 1 ? '' : 's'}\" if\n seconds < 3000 # 50 minutes\n return 'about one hour' if seconds < 5400 # 90 minutes\n return \"#{seconds / 3600} hours\" if seconds < 64800 # 18 hours\n return 'one day' if seconds < 86400 # 1 day\n return 'about one day' if seconds < 172800 # 2 days\n return \"#{seconds / 86400} days\" if seconds < 604800 # 1 week\n return 'about one week' if seconds < 1209600 # 2 week\n return \"#{seconds / 604800} weeks\" if seconds < 7257600 # 3 months\n return \"#{seconds / 2419200} months\" if seconds < 31536000 # 1 year\n return \"#{seconds / 31536000} years\"\n end",
"def to_s(unit = :radians)\n case unit\n when :degrees, :deg then \"#{@degrees}°\"\n when :radians, :rad then \"#@radians rad\"\n else\n raise InvalidArgumentsError, \"Unit should be :degrees, :deg, :radians ord :rad.\"\n end\n end",
"def to_s(fmt = nil)\n if fmt\n # needs work to include distance as well as angle fmt.\n return \"#{@bearing.strf(fmt)} #{distance.round(4)}m\"\n else\n return \"#{@bearing.strf} #{distance.round(4)}m\"\n end\n end",
"def time_delta_string( seconds )\n\t\treturn 'less than a minute' if seconds < 60\n\n\t\tif seconds < 50 * 60\n\t\t\treturn \"%d minute%s\" % [seconds / 60, seconds/60 == 1 ? '' : 's']\n\t\tend\n\n\t\treturn 'about an hour'\t\t\t\t\tif seconds < 90 * MINUTES\n\t\treturn \"%d hours\" % [seconds / HOURS]\tif seconds < 18 * HOURS\n\t\treturn 'one day' \t\t\t\t\t\tif seconds < 1 * DAYS\n\t\treturn 'about a day' \t\t\t\t\tif seconds < 2 * DAYS\n\t\treturn \"%d days\" % [seconds / DAYS] \tif seconds < 1 * WEEKS\n\t\treturn 'about a week' \t\t\t\t\tif seconds < 2 * WEEKS\n\t\treturn \"%d weeks\" % [seconds / WEEKS] \tif seconds < 3 * MONTHS\n\t\treturn \"%d months\" % [seconds / MONTHS] if seconds < 2 * YEARS\n\t\treturn \"%d years\" % [seconds / YEARS]\n\tend",
"def to_s\n second_format = (second % 1).zero? ? '%02d' : '%04.1f'\n\n format(\"%04d-%02d-%02dT%02d:%02d:#{second_format}%s\", *atoms)\n end",
"def format_duration(seconds)\n return \"now\" if seconds == 0\n \n sec_in_a_min = 60\n sec_in_a_hour = 3600\n sec_in_a_day = 86400\n sec_in_a_year = 31536000\n\n result = {\n years: 0,\n days: 0,\n hours: 0,\n minutes: 0,\n seconds: 0\n }\n\n while seconds >= sec_in_a_year\n seconds -= sec_in_a_year\n result[:years] += 1\n end\n\n while seconds >= sec_in_a_day\n seconds -= sec_in_a_day\n result[:days] += 1\n end\n\n while seconds >= sec_in_a_hour\n seconds -= sec_in_a_hour\n result[:hours] += 1\n end\n\n while seconds >= sec_in_a_min\n seconds -= sec_in_a_min\n result[:minutes] += 1\n end\n\n result[:seconds] += seconds\n \n #initialise the string that will be returned\n str = \"\"\n #set up the years part of the string\n if result[:years] > 1\n str += \"#{result[:years]} years\"\n elsif result[:years] == 1\n str += \"#{result[:years]} year\"\n end\n #append a comma and space if any further text is incoming\n if result[:years] >= 1\n remaining_time = [result[:days], result[:hours], result[:minutes], result[:seconds]].count { |x| x > 0 }\n\n if remaining_time > 1\n str += \", \"\n elsif remaining_time == 1\n str += \" and \"\n end\n end\n\n #set up the days part of the string\n if result[:days] > 1\n str += \"#{result[:days]} days\"\n elsif result[:days] == 1\n str += \"#{result[:days]} day\"\n end\n #append a comma and space if any further text is incoming\n if result[:days] >= 1\n remaining_time = [result[:hours], result[:minutes], result[:seconds]].count { |x| x > 0 }\n\n if remaining_time > 1\n str += \", \"\n elsif remaining_time == 1\n str += \" and \"\n end\n end\n #set up the hours part of the string\n if result[:hours] > 1\n str += \"#{result[:hours]} hours\"\n elsif result[:hours] == 1\n str += \"#{result[:hours]} hour\"\n end\n #append a comma and space if any further text is incoming\n if result[:hours] >= 1\n remaining_time = [result[:minutes], result[:seconds]].count { |x| x > 0 }\n\n if remaining_time > 1\n str += \", \"\n elsif remaining_time == 1\n str += \" and \"\n end\n end\n\n #set up the minutes part of the string\n if result[:minutes] > 1\n str += \"#{result[:minutes]} minutes\"\n elsif result[:minutes] == 1\n str += \"#{result[:minutes]} minute\"\n end\n #append a comma and space if any further text is incoming\n if result[:minutes] >= 1\n str += \" and \" if result[:seconds] > 0\n end\n #set up the minutes part of the string\n if result[:seconds] > 1\n str += \"#{result[:seconds]} seconds\"\n elsif result[:seconds] == 1\n str += \"#{result[:seconds]} second\"\n end\n str\nend",
"def to_s\n ms, neg = @msecs < 0 ? [ -@msecs, true ] : [ @msecs, false ]\n secs = ( ms % MIN_TO_MS ) / SEC_TO_MS_F\n mmins = ( ms / MIN_TO_MS ).to_i\n hours, mins = mmins / 60, mmins % 60\n\n pad = ( secs < 10.0 ) ? '0' : '';\n\n if hours > 0\n hours = -hours if neg\n \"%+d:%02d:%s%g\" % [ hours, mins, pad, secs ]\n elsif mins > 0\n mins = -mins if neg\n \"%+d:%s%g\" % [ mins, pad, secs ]\n else\n secs = -secs if neg\n \"%+g\" % [ secs ]\n end\n end",
"def get_timing( time_swam = @time_swam )\r\n (time_swam.minutes.to_i > 0 ? \"#{time_swam.minutes.to_i}'\" : '') +\r\n format('%02.0f\"', time_swam.seconds.to_i) +\r\n format('%02.0f', time_swam.hundreds.to_i)\r\n end",
"def hand_angle(h, m)\n minute_degrees = m * 6\n hour_degrees = (30 * h) + (0.5 * m)\n degrees = (hour_degrees - minute_degrees).abs\n degrees > 180 ? 360 - degrees : degrees\nend",
"def to_f\n count = @seconds\n count += 60 * @minutes\n # 60 * 60 = 3_600\n count += 3_600 * @hours\n # 60 * 60 * 24 = 86_400\n count += 86_400 * @days\n # 365.25/12 * 86_400 == 31_557_600/12 == 2_629_800\n count += SECONDS_IN_MONTH * @months\n # 365.25 * 86_400 == 31_557_600\n count += SECONDS_IN_YEAR * @years\n return @sign * count\n end",
"def calculate_duration_string(duration)\n minutes = duration / 60\n seconds = duration - minutes * 60\n\n hours = minutes / 60\n minutes = minutes - hours * 60\n\n hr_string, min_string, sec_string = hours.to_s, minutes.to_s, seconds.to_s\n\n # hr_string = \"0\" + hr_string if hours < 10\n min_string = \"0\" + min_string if minutes < 10\n sec_string = \"0\" + sec_string if seconds < 10\n\n if hours === 0\n \"#{min_string} mins\"\n elsif hours === 1\n \"#{hr_string}hr #{min_string}mins\"\n else\n \"#{hr_string}hrs #{min_string}mins\"\n end\n\n end",
"def solution(time)\n timeArray = time.split(\".\")\n hours = timeArray[0].to_f()\n min = timeArray[1].to_f()\n if hours > 12\n hours = hours - 12\n end\n\n minDegrees = 360.00 / 60.00 * min\n hourDegrees = 360.00/12.00 * hours\n hourDegreesMin = (360.00 / (12.00 * 60.00)) * min\n hourDegreesResult = hourDegrees + hourDegreesMin\n result = hourDegreesResult - minDegrees\n return result.abs\nend",
"def ftoc(degrees)\n (5 / 9.0) * (degrees - 32)\nend",
"def rad2deg\n self * (180/Math::PI)\n end",
"def in_ms(seconds)\n \"#{'%.2f' % (seconds * 1000).round(2)}ms\"\nend",
"def time_string\n\n\t\thours = @seconds/3600 #if not an hour will be stored as 0\n\t\tremainder = @seconds%3600 #modulo gives the amount that remains\n\t\tsprintf(\"%02d:%02d:%02d\", hours, remainder/60, remainder%60) #string formatting\n\t\t\n\tend",
"def human_representation(options = {}, g = { x: x, y: y })\n g.map do |k, v|\n deg = v.to_i.abs\n min = (60 * (v.abs - deg)).to_i\n labs = (v * 1_000_000).abs / 1_000_000\n sec = ((((labs - labs.to_i) * 60) -\n ((labs - labs.to_i) * 60).to_i) * 100_000) * 60 / 100_000\n str = options[:full] ? '%.i°%.2i′%05.2f″' : '%.i°%.2i′%02.0f″'\n if options[:coord]\n out = format(str, deg, min, sec)\n # Add cardinal\n out + (k == :x ? v > 0 ? 'N' : 'S' : v > 0 ? 'E' : 'W')\n else\n format(str, v.to_i, min, sec)\n end\n end\n end",
"def track_degrees_magnetic\n f = new_format? ? 3 : 2\n return nil if @fields[f].nil? || @fields[f].empty?\n @fields[f].to_f\n end",
"def degreToRadian( degree )\n return degree * RADIAN_TO_DEGREE\n end",
"def transform_secs(seconds) \n time = ''\n \n h = (seconds.to_f / 3600.0).floor\n seconds = seconds - (h * 3600)\n time << \"#{h.to_s.rjust(2, '0')}:\" if h > 0\n \n m = (seconds.to_f / 60.0).floor\n seconds = seconds - (m * 60)\n time << \"#{m.to_s.rjust(2, '0')}:\"\n \n time << \"#{seconds.to_s.rjust(2, '0')}\"\n \n time\nend",
"def to_s format = '%8.4f'\n (\"%-6s\" + \"#{format} \" * 3) % ([name] + pos.to_a) \n end",
"def convert_input(any_value_float)\n n, degrees_remaining = any_value_float.divmod(360)\n if degrees_remaining >= 0\n degrees_remaining\n elsif\n degrees_remaining < 0\n degrees_remaining + 360\n end\nend",
"def time_string()\n #Get numerical representations for each value\n @hours = seconds / 60 / 60\n @minutes = (seconds / 60) % 60\n @seconds = seconds % 60\n\n #Convert the values to properly formatted strings\n @hours = padded(@hours)\n @minutes = padded(@minutes)\n @seconds = padded(@seconds)\n \n #return the string\n @hours + ':' + @minutes + ':' + @seconds\n end",
"def format_duration(seconds)\n seconds = seconds.to_f\n answer = Array.new\n if seconds == 0\n return \"now\"\n end\n while seconds >= (60*60*24*365) #years\n answer << (seconds / (60*60*24*365).to_f).to_s.split(\".\").first\n answer.last.to_i > 1 ? answer[-1] += \" years\" : answer[-1] += \" year\"\n seconds = (seconds % (60*60*24*365))\n end\n while seconds >= (60*60*24) #days\n answer << (seconds / (60*60*24).to_f).to_s.split(\".\").first\n answer.last.to_i > 1 ? answer[-1] += \" days\" : answer[-1] += \" day\"\n seconds = (seconds % (60*60*24))\n end\n while seconds >= (60*60) #hours\n answer << (seconds / (60*60).to_f).to_s.split(\".\").first\n answer.last.to_i > 1 ? answer[-1] += \" hours\" : answer[-1] += \" hour\"\n seconds = (seconds % (60*60))\n end\n while seconds >= (60) #minutes\n answer << (seconds / (60).to_f).to_s.split(\".\").first\n answer.last.to_i > 1 ? answer[-1] += \" minutes\" : answer[-1] += \" minute\"\n seconds = (seconds % (60))\n end\n if seconds < 60\n answer << seconds.to_i.to_s\n answer.last.to_i > 1 ? answer[-1] += \" seconds\" : answer[-1] += \" second\"\n end\n while answer[-1].split(\" \").first.to_i == 0\n answer.pop\n end\n while answer.length >= 3\n answer[1] = answer[0] + \", \" + answer[1]\n answer.shift\n end\n if answer.length == 2\n answer.join(\" and \")\n else\n answer.first\n end\nend",
"def formatted_duration(total_seconds)\n total_seconds = total_seconds.round # to avoid fractional seconds potentially compounding and messing up seconds, minutes and hours\n hours = total_seconds / (60*60)\n minutes = (total_seconds / 60) % 60 # the modulo operator (%) gives the remainder when leftside is divided by rightside. Ex: 121 % 60 = 1\n seconds = total_seconds % 60\n [hours, minutes, seconds].map do |t|\n # Right justify and pad with 0 until length is 2. \n # So if the duration of any of the time components is 0, then it will display as 00\n t.round.to_s.rjust(2,'0')\n end.join(':')\nend",
"def formatted_duration(total_seconds)\n total_seconds = total_seconds.round # to avoid fractional seconds potentially compounding and messing up seconds, minutes and hours\n hours = total_seconds / (60*60)\n minutes = (total_seconds / 60) % 60 # the modulo operator (%) gives the remainder when leftside is divided by rightside. Ex: 121 % 60 = 1\n seconds = total_seconds % 60\n [hours, minutes, seconds].map do |t|\n # Right justify and pad with 0 until length is 2. \n # So if the duration of any of the time components is 0, then it will display as 00\n t.round.to_s.rjust(2,'0')\n end.join(':')\nend",
"def to_degrees\n self / Math::PI.fdiv(180)\n end",
"def angular_velocity_rad_s\n 2 * PI / period_s\n end",
"def get_degree note\n relative_note = note - @tonic # we are only concerned with the note relative to the tonic\n octave = (relative_note.to_i / 12) - 1\n index = @intervals.index(@intervals.find{|n| n >= relative_note % 12})\n return \"#{((octave + 1) * @intervals.size) + 7}#\" unless index # if index is nil, it means note is a sharpened 7th index... we add 1 to octave to account for the -1st octave\n degree = index + 1\n approximate_degree = ((octave + 1) * 7) + degree\n accidental = ACCIDENTALS[relative_note - (((octave + 1) * 12) + @intervals[index])]\n return \"#{approximate_degree}#{accidental}\"\n end",
"def degree; end",
"def clock_angle(hour, minutes)\n h = (hour % 12) * 30 + (minutes.to_f / 60) * 30\n minute = minutes * 6\n [(h - minute).abs, 360 - (h - minute).abs].min\nend",
"def mil_to_std(miltime)\n milhours = miltime[0,2].to_i\n milminutes = miltime[2,2]\n if milhours > 12\n sthours = milhours - 12\n stampm = \"PM\"\n else\n sthours = milhours\n stampm = \"AM\"\n end\n if sthours.to_s.length == 1\n sthours = sthours.to_s.prepend(\"0\")\n end\n result = sthours.to_s + \":\" + milminutes.to_s + stampm.to_s\n return result\nend",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def to_s\n if self.is_blank_interval\n #is blank interval --> <% 17>\n stimulusText='<% '+self.duration.to_s+'>'\n else\n #is not blank interval\n stimulusText='\"'+self.text+'\"'\n if self.stimulus_type==\"wav\"\n #is sound\n if self.synchronise_with_next==true\n stimulusText='<svp start> '+stimulusText\n end\n stimulusText='<'+self.stimulus_type+'> '+stimulusText\n \n else \n if self.stimulus_type==\"bmp\"||self.stimulus_type==\"jpg\"\n #is image\n stimulusText=' <'+self.stimulus_type+' '+self.top_possition.to_s+', '+self.left_possition.to_s+'> '+stimulusText \n else\n #is text\n #add line\n stimulusText=\"<Line \"+self.present_in_line.to_s+\"> \"+stimulusText\n end\n #add the duration of the stimulus (NOT FOR AUDIO STIMULUS?????)\n stimulusText=stimulusText+' <% '+self.duration.to_s+'>'\n end\n if self.not_erase_previous\n stimulusText=\"!\"+stimulusText\n end\n \n \n #add symbol \"/\" at the end of the stimulus or not\n if self.clear_screen\n stimulusText=stimulusText+\" /\"\n else\n stimulusText=stimulusText+\",\"\n end\n end\n stimulusText\n end",
"def check_angle(hours, minutes)\n (minutes * 6 - (hours * 30 + minutes * 0.5)).abs\nend",
"def float_time_to_hhmmss(float_time)\n return if float_time.class == String\n if (float_time && float_time > 0)\n min = float_time.floor\n mm = (min % 60).floor\n hh = (min / 60).floor\n ss = ((float_time - min) * 60).round\n\n if float_time < 10.0\n return \"#{format('%01d', mm)}:#{format('%02d', ss)}\"\n elsif float_time < 60.0\n return \"#{format('%02d', mm)}:#{format('%02d', ss)}\"\n else\n return \"#{hh.to_s}:#{format('%02d', mm)}:#{format('%02d', ss)}\"\n end\n else\n return \"\"\n end\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 rotate(angle)\n primitive 'rotate ' + sprintf('%g', angle)\n end",
"def rad2deg(rad, wrap = true)\r\n deg = RD * rad\r\n deg = deg2deg(deg) if wrap\r\n deg\r\n end",
"def degToC(degF)\n (degF-32)*5/9\nend",
"def format_casual(num_units: 2, sign: :negatives)\n return '-' if nil?\n\n d = {\n h: hours,\n m: minutes,\n s: seconds,\n ms: milliseconds\n }.drop_while { |_, unit| unit.zero? }\n\n d = {ms: 0} if d.empty?\n\n d = d.first(num_units).to_h.map { |k, v| \"#{v.to_i}#{k}\" }.join(' ')\n return \"+#{d}\" if sign == :always && positive?\n return \"-#{d}\" if [:always, :negatives].include?(sign) && negative?\n d\n end",
"def to_s(angle_unit = :degrees)\n string = <<EOS\nVector :\n- x = #{x}\n- y = #{y}\n- norm = #{norm}\n- orientation = #{orientation.to_s(angle_unit)}\nEOS\n string\n end",
"def convert(degrees_F = 73)\r\n (degrees_F - 32) * 5 / 9.0\r\nend",
"def rad_to_deg(rad)\n return 360 * rad / (2 * Math::PI)\n end",
"def convDegRad(value)\n unless value.nil? or value == 0\n value = (value/180) * Math::PI\n end\n return value\n end",
"def trigonometry_difs(str)\n return case str\n when /sin<(.+)>/\n dif_sin($1)\n when /cos<(.+)>/\n dif_cos($1)\n else\n '0'\n end\n end",
"def decimal_to_strf(time_in)\r\n t = Time.now\r\n year = t.year\r\n month = t.month\r\n day = t.day\r\n hours = Integer(time_in)\r\n decimal_minutes = (time_in - hours) * 60.0\r\n minutes = Integer(decimal_minutes)\r\n decimal_seconds = (decimal_minutes - minutes) * 60.0\r\n seconds = Integer(decimal_seconds)\r\n my_time = Time.gm(year, month, day, hours, minutes, seconds) \r\n# my_time.strftime(\"%H:%M:%S\")\r\nend",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def conv_deg_rad(value)\n (value/180) * Math::PI unless value.nil? or value == 0\nend",
"def to_s\n value = self.real\n if ℤ.∋?(value)\n value = value.to_i.to_s\n else\n value = value.to_s\n end\n case(self.repr)\n when 3\n \"#{value}ʳθ\"\n when 4\n \"#{value}°θ\"\n when 5\n \"#{value}𝞽θ\"\n when 6\n \"#{value}ᵍθ\"\n else\n 🛑 RuntimeError.new(\"| c{ThetaAngle}-> m{to_s} w/ self{#{self.to_s}} val{#{self.real.to_s}} repr{#{self.repr.to_s}} had an unrecognized representation value |\")\n end\n end",
"def format_et(seconds)\n if seconds > 60.0 and seconds < 120.0\n format('%d minute and %d seconds', (seconds/60).floor, seconds.to_i % 60)\n elsif seconds > 120.0\n format('%d minutes and %d seconds', (seconds/60).floor, seconds.to_i % 60)\n else\n format('%2.2f seconds', seconds)\n end\n end",
"def format_et(seconds)\n if seconds > 60.0 and seconds < 120.0\n format('%d minute and %d seconds', (seconds/60).floor, seconds.to_i % 60)\n elsif seconds > 120.0\n format('%d minutes and %d seconds', (seconds/60).floor, seconds.to_i % 60)\n else\n format('%2.2f seconds', seconds)\n end\n end",
"def seconds2dhm seconds\n \"%2d天 %02d小时 %02d分钟\" % [seconds/86400, seconds/3600%24, seconds/60%60]\n end",
"def sec_to_rad(x)\n x*Math::PI/(180*3600)\n end",
"def interval_as_min_dot_sec\n seconds = @interval % 60\n if seconds > seconds.to_i\n #mpl3splt takes fractions of a second to hundredths of a second precision\n seconds = seconds.round(2)\n end\n min_dot_sec = \"#{(@interval.to_i / 60).floor}.#{seconds}\"\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 format_casual(num_units: 2)\n return '-' if @ms.nil? || @ms.zero?\n\n {\n h: hours,\n m: minutes,\n s: seconds,\n ms: milliseconds\n }.drop_while { |_, unit| unit.zero? }.first(num_units).to_h.map { |k, v| \"#{v.to_i}#{k}\" }.join(' ')\n end",
"def format_duration(secs)\n if !secs\n return ''\n end\n\n [[60, :sec], [60, :min], [24, :hr], [1000, :days]].map{ |count, name|\n if secs > 0\n secs, n = secs.divmod(count)\n \"#{n.to_i} #{name}\"\n end\n }.compact.reverse.join(' ')\n end",
"def humanize secs\n [\t\n \t[60, :seconds], \n \t[60, :minutes], \n \t[24, :hours], \n \t[365, :days], \n \t[100, :years]\n ].map do |count, name|\n if secs > 0\n secs, n = secs.divmod(count)\n \"#{n.to_i} #{name}\"\n end\n end.compact.reverse.join(' ')\nend",
"def to_s\n \"atan(#{@x})\"\n end",
"def format_numeric(val, istruct)\n return istruct.nil_text if val.nil?\n return val.secs_to_hms if istruct.hms\n\n if istruct.commas\n # Commify the whole number part if not done already.\n result = val.commas(istruct.post_digits)\n else\n result = val.round(istruct.post_digits).to_s\n match = result.match(/\\.(\\d+)\\z/)\n if match && match[1]&.size < istruct.post_digits\n # Add trailing zeros to pad out post_digits\n n_zeros = [istruct.post_digits - match[1].size, 0].max\n zeros = '0' * n_zeros\n result = result + zeros\n end\n result\n end\n\n if istruct.pre_digits.positive?\n match = result.match(/\\A([\\d,]+)(\\.\\d+)?\\z/)\n whole_part = match[1]\n frac_part = match[2]\n n_zeros = [istruct.pre_digits - whole_part.gsub(',', '').size, 0].max\n result =\n if n_zeros.positive?\n if istruct.commas\n # Insert leading zeros with commas\n pre_comma_match = whole_part.match(/\\A(\\d+),/)\n if pre_comma_match\n n_partial_zeros = 3 - pre_comma_match[1].size\n whole_part = \"0\" * n_partial_zeros + whole_part\n n_zeros -= n_partial_zeros\n end\n zeros = ''\n if n_zeros.positive?\n zeros = \"0\" * n_zeros\n if n_zeros > 3 && istruct.commas\n zeros = zeros.reverse.gsub!(/([0-9]{3})/, \"\\\\1,\").reverse\n end\n end\n \"#{zeros},#{whole_part}#{frac_part}\"\n else\n # Insert leading zeros without commas\n zeros = \"0\" * n_zeros\n \"#{zeros}#{whole_part}#{frac_part}\"\n end\n else\n \"#{whole_part}#{frac_part}\"\n end\n else\n result\n end\n if istruct.currency\n result = \"#{FatTable.currency_symbol}#{result}\"\n end\n result\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 time_string(string)\n\n times=string.split(\":\")\n puts times.inspect\n residual= times[1].to_f/2\n hour_degrees=times[0].to_i*30+residual\n minutes=times[1].to_i*6\n return hour_degrees-minutes\n\nend",
"def to_f()\n @sec.to_f ;\n end",
"def formattime()\n\t\tamOrpm = 0\t# this will decide P or A\n\t\ttopResult = ''\t# save top string from the digital clock\n\t\tmiddleResult = ''\t# save middle string from the digital clock\n\t\tbotResult = ''\t\t# save bot string from the digital clock\n\t\t\n\t\thour = gethour().to_i\t# change to integer for hour\n\t\tmin = getminute().to_i\t# change to integer for minute\n\t\t@amOrpm = @t.strftime(\"%p\")\t# this get PM or AM, I used strftime method which provided from the Time class\n\t\tif @amOrpm == \"PM\"\t# if PM\t\n\t\t\tamOrpm = 1\t# save 1\n\t\telse\t\t\t# if AM\n\t\t\tamOrpm = 0\t# save 0\n\t\tend\n\n\t\ttopResult = top(hour,min)\t# Save top string from the digital clock with top method\n\t\tmiddleResult = middle(hour,min)\t# Save middle string from the digital clock with middle method\n\t\tbotResult = bot(hour,min, amOrpm)\t# Save bot string from the digital clock with bot method\n\t\ttotal = topResult + middleResult + botResult\t# save all the string in the total\n\t\treturn total\t\t\t# return total represent perfect digital time\n\tend",
"def to_s(pretty=true)\n d, h, m, s, ms = elapsed\n e_t = (d > 0) ? \"#{d.to_s}d \" : ''\n if pretty\n e_t += ('%02u:' % [h]) if (d + h) > 0\n e_t += ('%02u:' % [m]) if (d + h + m) > 0\n e_t += '%02u.%03u' % [s, ms]\n else\n e_t << '%02u:%02u:%02u.%03u' % [h,m,s, ms]\n end\n end"
] | [
"0.811914",
"0.7688109",
"0.7490294",
"0.7240925",
"0.6438802",
"0.6285384",
"0.62104726",
"0.61305416",
"0.61305416",
"0.60969335",
"0.6086194",
"0.5946115",
"0.59192365",
"0.5828534",
"0.5799975",
"0.57745075",
"0.57702416",
"0.57607013",
"0.5759594",
"0.57516843",
"0.57483983",
"0.5716135",
"0.5710612",
"0.5710612",
"0.56937534",
"0.56731313",
"0.56709933",
"0.5653988",
"0.56531465",
"0.56524396",
"0.5650785",
"0.56424904",
"0.5615638",
"0.56120014",
"0.5593733",
"0.55871546",
"0.5571422",
"0.55649847",
"0.5532026",
"0.55232644",
"0.5517443",
"0.5481962",
"0.5479926",
"0.5469479",
"0.5445452",
"0.54350185",
"0.5434981",
"0.54319155",
"0.5415507",
"0.5409812",
"0.5405877",
"0.5401683",
"0.540106",
"0.5387641",
"0.53798085",
"0.53790975",
"0.53746754",
"0.5367269",
"0.5355797",
"0.5355797",
"0.53518206",
"0.5350968",
"0.53500444",
"0.53410953",
"0.5331581",
"0.53243464",
"0.5320059",
"0.53107584",
"0.53100413",
"0.5308998",
"0.53056014",
"0.5304519",
"0.52932614",
"0.5286681",
"0.5284885",
"0.52806675",
"0.5278133",
"0.52773416",
"0.52720326",
"0.52705497",
"0.52680904",
"0.52664137",
"0.52664137",
"0.5259918",
"0.5254193",
"0.5254193",
"0.5253395",
"0.5247819",
"0.52439713",
"0.524294",
"0.5239417",
"0.5235417",
"0.52330786",
"0.52325267",
"0.5224507",
"0.52174985",
"0.52114666",
"0.52103245",
"0.52046883",
"0.5203222"
] | 0.8862008 | 0 |
OCSP response stapling information. | def ocsp_response
@ocsp_response ||= if (ocsp_response = @node.at('ocspStapling/ocspResponse'))
OCSPResponse.new(ocsp_response)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def response\r\n submit.ResponseList.GetAt(0).Detail\r\n end",
"def response_data(response)\n \"\".tap do |result|\n result << \"HTTP/1.1 #{response.status.join(\" \")}\\n\"\n response.headers.each do |key, values|\n Array(values).each do |value|\n result << \"#{key}: #{value}\\n\"\n end\n end\n result << \"\\n\"\n result << response.body\n result << \"\\n\"\n end\n end",
"def info() \n \treturn self.response.info()\n\tend",
"def successful_capture_response\n '?({\"Status\":\"EmAnalise\",\"Codigo\":0,\"CodigoRetorno\":\"\",\"TaxaMoIP\":\"0.46\",\"StatusPagamento\":\"Sucesso\",\"Classificacao\":{\"Codigo\":999,\"Descricao\":\"Nao suportado no ambiente Sandbox\"},\"CodigoMoIP\":207695,\"Mensagem\":\"Requisicao processada com sucesso\",\"TotalPago\":\"1.00\"})'\n end",
"def response\n self.textual_response\n end",
"def response_metadata=(_); end",
"def response\n\t\t@response\n\tend",
"def mgs_hops_request_sent_message\n $tracer.trace(__method__)\n return ToolTag.new(div.id(\"hops_request_sent\").h4, __method__, self)\n\tend",
"def response\n lines = []\n lines << \"HTTP/1.1 101 Switching Protocols\"\n lines += response_headers.map { |header| header.join(\": \") }\n lines << \"\"\n lines << \"\"\n lines.join(CRLF)\n end",
"def process_response\n LOGGER.debug \"WORLDCAT DISCOVERY - Response from target: #{@response_status}\"\n #LOGGER.debug \"WORLDCAT DISCOVERY - Headers: #{@response_headers.collect{ |k,v| \"#{k} = #{v}\" }.join(', ')}\"\n #LOGGER.debug \"WORLDCAT DISCOVERY - Body: uncomment line!\"\n LOGGER.debug @response_body\n \n @response_body\n end",
"def formatted_response\n self.response\n end",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def get_Response()\n \t return @outputs[\"Response\"]\n \tend",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end",
"def response; end"
] | [
"0.5713922",
"0.5713922",
"0.5713922",
"0.5713922",
"0.5713922",
"0.57137907",
"0.57137907",
"0.57137907",
"0.57137907",
"0.57137907",
"0.57137907",
"0.57137907",
"0.57137907",
"0.5713761",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.57137346",
"0.5701399",
"0.56486684",
"0.56291497",
"0.5602413",
"0.5591043",
"0.5579864",
"0.55472994",
"0.55341226",
"0.55270624",
"0.5516474",
"0.5513783",
"0.5504482",
"0.5504482",
"0.5504482",
"0.5504482",
"0.5504482",
"0.5504482",
"0.5504482",
"0.5504482",
"0.5504482",
"0.54906523",
"0.54906523",
"0.54906523",
"0.54906523",
"0.54906523",
"0.54906523",
"0.54906523",
"0.54906523",
"0.54906523",
"0.54906523",
"0.54906523"
] | 0.7117692 | 0 |
Get content about rent process and show it to user | def new
@page = Page.find_by_title('Huren bij Xposers')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rent\n @page = Pwb::Page.find_by_slug \"rent\"\n @page_title = @current_agency.company_name\n # @content_to_show = []\n if @page.present?\n @page_title = @page.page_title + \" - \" + @current_agency.company_name\n # TODO: - allow addition of custom content\n # @page.ordered_visible_page_contents.each do |page_content|\n # @content_to_show.push page_content.content.raw\n # end\n end\n # @page_title = I18n.t(\"searchForProperties\")\n # in erb template for this action, I have js that will render search_results template\n # for properties - like search_ajax action does\n @operation_type = \"for_rent\"\n # above used to decide if link to result should be to buy or rent path\n\n @properties = Prop.visible.for_rent.limit 45\n # .order('price_rental_monthly_current_cents ASC').limit 35\n\n @prices_from_collection = @current_website.rent_price_options_from\n @prices_till_collection = @current_website.rent_price_options_till\n # @prices_collection = %W(#{''}\n # 150 250 500 1,000 1,500 2,000 2,500 3,000 4,000 5,000 10,000)\n\n set_common_search_inputs\n set_select_picker_texts\n apply_search_filter filtering_params(params)\n set_map_markers\n @search_defaults = params[:search].present? ? params[:search] : {}\n\n js \"Main/Search#sort\" # trigger client-side paloma script\n render \"/pwb/search/rent\"\n end",
"def show\n @submission = Submission.find(params[:id])\n \n #now lets get the nice xml to display!\n xml = Ruote::Parser.to_xml(@submission.process_definition)\n doc = REXML::Document.new xml\n @nice_xml = ''\n doc.write(@nice_xml,2)\n @task_outputs = ''\n @submission.tasks.each do|t|\n @task_outputs += \"\\n== #{t.rank} - #{t.name} =====================\\n\\n\"\n @task_outputs += \"#{t.exec_output}\\n\"\n end\n \n flash[:error] = \"Your submission appears to have an error and is probably stuck. Please contact your system administrator.\" if (! @submission.last_error.blank? && @submission.active?)\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @submission }\n end\n end",
"def show\n # Dont show content if it is restricted and user is not in the department\n if is_content_restricted_or_inactive @process_lt\n redirect_to not_allowed_path\n else\n @quality_tip = get_random_quality_tip\n user_bookmarks = Bookmark.find_by_user(@remote_user)\n @is_bookmarked = !user_bookmarks.blank? && user_bookmarks.processes.include?(@process_lt.id.to_s)\n \n trans_query = \"(origin = #{@process_lt.origin || @process_lt.id} OR id = #{@process_lt.origin || @process_lt.id}) AND id <> #{@process_lt.id}\"\n @translations = ProcessLt.where([trans_query])\n .map {|i| {name: i.name, url: process_lt_path(i.id), locale: @languages[i.locale]}}\n end\n end",
"def show\n @item_process = ItemProcess.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_process }\n end\n end",
"def show\n @work_process = WorkProcess.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_process }\n end\n end",
"def show\n @recipes = @preptime.recipes.reorder(preptime_order_by(\"recipes\")).paginate(page: params[:page], per_page: 2)\n @title = \"Recipes with prep time: \" + @preptime.name\n # goto render /views/preptimes/show.html.erb using /shared/_show_recipes using @recipes, @title\n end",
"def show\n @selective_process = SelectiveProcess.find(params[:id])\n @responsible = User.find(@selective_process.responsible)\n @activities = @selective_process.get_activities\n end",
"def get_info_about_reservation(url_res)\n req = setup_http_request($mybookings, @cookie, {:url => url_res})\n res = @http.request(req)\n if res.code != '200'\n puts \"[?] Acces impossible a mes reservations\"\n else\n body = CGI.unescapeHTML(res.body).gsub(\"”\",\"\").gsub(\"“\",\"\").force_encoding('utf-8')\n depart_arrivee = body.scan(/<i class=\"bbc-icon2-circle first size20 location-circle [green|red]+\" aria-hidden=\"true\"><\\/i>\\s*<strong>\\s*(.*)\\s*<\\/strong>\\s*<\\/div>/).flatten\n _start = body.index('<p class=\"showmore\"')\n if _start\n _start = _start + '<p class=\"showmore\">'.length\n _end = body[_start..-1].index(\"</div>\") + _start\n infos = body[_start.._end-5].split(\"<br />\")[0..-1].join(\"\").gsub(\"</p>\",\"\").gsub(\"\\n\", \" \")\n infos.gsub!('<span class=\"showmore-ellipsis\">...</span><span class=\"showmore-rest\">', '')\n infos = infos.split(\"</span>\").first\n else\n infos = \"Pas d'informations\"\n end\n code = body.scan(/<span class=\"text-code\">([^<]*)<\\/span>/).flatten.first\n return [code, depart_arrivee, infos]\n end\n return \"\"\n end",
"def show\n @recursorevision = @solicitud.recursosrevision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def show\n @requisition = Requisition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @requisition }\n format.xml { render xml: @requisitions }\n end\n end",
"def show\n #@processo = Processo.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @processo }\n end\n end",
"def show\n @processdef = Processdef.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @processdef }\n end\n end",
"def show\n @learn_process = LearnProcess.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @learn_process }\n end\n end",
"def show\n @approval_process = ApprovalProcess.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @approval_process }\n end\n end",
"def show\n @subprocesses = @order.subprocesses\n @has_leftovers = @order.has_leftovers\n @comment = OrderComment.new\n @modification = Modification.new\n @modifications = @order.modifications\n end",
"def show\n render json: @processo\n end",
"def show\n @promocion = Promocion.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @promocion }\n end\n end",
"def show\n @pluto_process_definition = collection.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @pluto_process_definition }\n end\n end",
"def get_retur_history\n add_breadcrumb \"History\", :get_retur_history_returned_processes_path\n @past_retur = ReturnedProcess\n .order(\"updated_at desc\")\n .where(\"rp_number like ?\", \"%#{@retur.rp_number}%\")\n .page(params[:page])\n .per(params[:row] ? params[:row] : 5)\n not_found if @past_retur.blank?\n end",
"def procession\n @procession ||= fetch_procession\n end",
"def show\n @ppos_prerequisite = PposPrerequisite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ppos_prerequisite }\n end\n end",
"def show\n @recrutement = Recrutement.find(params[:id])\n end",
"def show\n @ptid = Ptid.find(params[:id])\n @title = Ptid.find(params[:id]).ptid + \" Details\"\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ptid }\n end\n end",
"def show\n @repuestum = Repuestum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repuestum }\n end\n end",
"def show\n @promotion = Promotion.includes(:promotion_lines).find(params[:id])\n @promotion_lines = @promotion.promotion_lines\n @title = \"Promocion: #{@promotion.title}\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @promotion }\n end\n end",
"def show\n @core_status_processamento = Core::StatusProcessamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_status_processamento }\n end\n end",
"def show\n @repuesto = Repuesto.find(params[:id])\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @repuesto.to_json }\n end\n end",
"def process_explanation_mail\n petition = Petition.where(status: 'live').first\n PetitionMailer.process_explanation_mail(Petition.live.first)\n end",
"def show\n @procurement = Procurement.find(params[:id])\n \n breadcrumbs.add 'Procurements', procurements_path\n breadcrumbs.add @procurement.id\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @procurement }\n end\n end",
"def show\n data=params\n #Below code is to find details for the notes.\n @com_notes_entries = Communication.find(data[:com_id].to_i) #@com_notes_entries.receiver.service_provider_employee_mappings\n @matters = Matter.team_matters(@com_notes_entries.assigned_by_employee_user_id, @com_notes_entries.company_id) #FIXME: Is the company id right?\n lawyer_details(@com_notes_entries) \n company_id = CompanyLookup.find_by_lvalue_and_company_id(\"Rejected\", @com_notes_entries.company_id).id \n @contacts = Contact.all(:conditions => [\"company_id = ? AND status_type != ?\", company_id, @com_notes_entries.company_id], :order => 'first_name')\n @task = UserTask.new\n @skill_list = Physical::Liviaservices::SkillType.all\n if data[:related]\n model, id = data[:related].split(\"_\")\n instance_variable_set(\"@asset\", model.classify.constantize.find(id))\n end\n render :layout => false\n end",
"def show\n @prc = Prc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prc }\n end\n end",
"def show\n @packing_process = PackingProcess.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @packing_process }\n end\n end",
"def show\n @postum = Postum.find(params[:id])\n Postum.procist(@postum)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @postum }\n end\n end",
"def show\n @valor_campo_processo = ValorCampoProcesso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @valor_campo_processo }\n end\n end",
"def show\n @occupied_runns_for_feed_list = Runn.get_occupied_runns\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @requisition }\n end\n end",
"def show\n @reprogramacion = Reprogramacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reprogramacion }\n end\n end",
"def show\n @procurementitem = Procurementitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @procurementitem }\n end\n end",
"def show\n @rep = Rep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rep }\n end\n end",
"def show\n @relatorios = Relatorio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @relatorios }\n end\n end",
"def show\n @procurement = Procurement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @procurement }\n end\n end",
"def index\n @notas_reparaciones = NotaReparacion.all\n end",
"def show\n @recipe = Recipe.find(params[:id])\n @ingredients = @recipe.ingredients\n @instructions_domain = @recipe.instruction_url_split\n @nutrition_info = @recipe.nutrition_informations\n @health_labels = @recipe.health_labels\n end",
"def taken_promos\n respond_to do |format|\n @promos = Promo.get_taken_promos_for_user current_user\n format.html { render \"promos/content\" }\n end\n end",
"def display_pids(action)\n puts \"-----> Wonderful! What is the PID of the job you would like to #{action}?\"\n output = IO.read(\"jobs.txt\")\n puts \"#{output}\"\n job = gets.chomp.downcase\n make_call(\"pid\",action, job)\n end",
"def show\n @fab_process = FabProcess.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fab_process }\n end\n end",
"def show\n @pomodoro = find_pomodoro\n @timelines = @pomodoro.timelines.latest\n @task = @pomodoro.task\n end",
"def get_pdp_info\n wait_for_product_detail_div(TimeOut::WAIT_BIG_CONST * 2)\n\n # Get information on pdp page\n long_name = long_name_txt.text\n age = RspecEncode.remove_nbsp(age_txt.text.strip)\n description = description_txt.text\n moreinfo_lb = get_more_info[:moreinfo_lb].gsub(\"\\n\", '').gsub(/\\s+/, ' ') # Remove '\\n' and double space characters\n moreinfo_text = get_more_info[:moreinfo_txt].gsub(\"\\n\", '').gsub(/\\s+/, ' ')\n special_message = (has_special_message_txt?) ? special_message_txt.text : '' # If special message exist => return special text. Else, return ''\n legal_top = (has_legal_top_txt?) ? legal_top_txt.text : ''\n legal_bottom = (has_legal_bottom_txt?) ? legal_bottom_txt.text : ''\n learning_difference = (has_learning_difference_txt?(wait: TimeOut::WAIT_SMALL_CONST)) ? learning_difference_txt.text : ''\n review = has_review_box? # If Review box exist ->'true' else 'false'\n more_like_this = has_more_like_this? # If More Like this box exist ->'true' else 'false'\n write_a_review = has_write_a_review_div?(wait: TimeOut::WAIT_SMALL_CONST) # If 'Write a Review' box exist ->'true' else 'false'\n add_to_wishlist = has_add_to_wishlist_lnk? # If 'Add to Wishlist' button exist -> 'true' else 'false'\n\n # Get price:\n if has_strike_price_txt?(wait: TimeOut::WAIT_SMALL_CONST)\n price = strike_price_txt.text\n else\n price = (has_price_txt?(wait: TimeOut::WAIT_SMALL_CONST)) ? price_txt.text : ''\n end\n\n # Get attributes info\n content_type = ''\n curriculum = ''\n notable = ''\n work_with = ''\n publisher = ''\n size = ''\n attributes_div.each do |a|\n attr = a.text.split(':')\n content_type = attr[1].strip if attr[0].include?('Type')\n curriculum = attr[1].strip if attr[0].include?('Curriculum')\n notable = attr[1..-1].join(':').strip if attr[0].include?('Notable')\n work_with = attr[1].gsub(', ', ',').strip if attr[0].include?('Works With')\n publisher = attr[1].strip if attr[0].include?('Publisher')\n size = attr[1].strip if attr[0].include?('Size')\n end\n\n # Get trailer\n has_trailer = trailer?\n trailer_link = ''\n trailer_link = find('.video')['data-largeimage'].to_s.gsub('\"', '\\\"') if has_trailer_box?\n\n # Get teaches (Skills list)\n teaches = []\n teaches_txt.each do |teach|\n teaches.push(teach.text)\n end\n\n # Get product detail\n details = get_detail\n\n # get value of Add to Cart button: Add to Cart\n add_to_cart_val = ''\n\n if has_add_to_cart_btn?(wait: 0)\n add_to_cart_val = find(:xpath, \"(//input[contains(@value,'Add to Cart')])[1]\")[:value] if has_xpath?(\"//input[contains(@value,'Add to Cart')]\", wait: 0)\n add_to_cart_val = find(:xpath, \"(//*[contains(text(),'Add to Cart')])[1]\").text if has_xpath?(\"(//*[contains(text(),'Add to Cart')])[1]\", wait: 0)\n else\n add_to_cart_val = 'Not Available'\n end\n\n # get value of buy now button: Buy Now\n buy_now_btn = ''\n execute_script(\"$('#sub-nav-grnbar-btn').css('display', 'block');\")\n buy_now_btn = find('#sub-nav-grnbar-btn')[:value] if has_css?('#sub-nav-grnbar-btn', wait: 0)\n\n has_credits_link = has_credits_lnk?\n\n # Put all info into array\n { long_name: long_name,\n age: age,\n description: description,\n content_type: content_type,\n curriculum: curriculum,\n notable: notable,\n work_with: work_with,\n publisher: publisher,\n size: size,\n moreinfo_lb: moreinfo_lb,\n moreinfo_txt: moreinfo_text,\n special_message: special_message,\n legal_top: legal_top,\n price: price,\n details: details,\n learning_difference: learning_difference,\n legal_bottom: legal_bottom,\n teaches: teaches,\n has_trailer: has_trailer,\n trailer_link: trailer_link,\n has_credits_link: has_credits_link,\n review: review,\n more_like_this: more_like_this,\n write_a_review: write_a_review,\n add_to_wishlist: add_to_wishlist,\n add_to_cart_btn: add_to_cart_val,\n buy_now_btn: buy_now_btn }\n end",
"def processes\n request('getAllProcessInfo')\n end",
"def show\n @reparacion = Reparacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reparacion }\n end\n end",
"def show\n\n @notadecredito = Notadecredito.find(params[:notadecredito_id])\n @renglon_ndc_articulo = @notadecredito.renglon_ndc_articulos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def show\n @recommand = Recommand.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recommand }\n end\n end",
"def show\n @rg_task = RgTask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rg_task }\n end\n end",
"def show\n @respostum = Respostum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js # Ajax CRUD\n end\n end",
"def show\n @rp = RnaseqPipeline.find(params[:id])\n [email protected]\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rnaseq_pipeline }\n end\n\n flash[:notice]=''\n end",
"def show\n @noticia = Noticia.find(params[:id])\n @comment = Comment.new if logged_in? \n @page_description = @noticia.intro.to_s[0..300]\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @noticia }\n end\n end",
"def show\n @novel = Novel.find(params[:id])\n\n# @content=\"\"\n# File.new([email protected],\"r\")do|file|\n# file.each_line {|line|@content+=line}\n# end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @novel }\n end\n end",
"def process_text\n @receipt = current_user.receipts.find(params[:receipt_id])\n if @receipt.present?\n @receipt.process_text!\n render json: { receiptUrl: receipt_url(@receipt)}, status: 200\n else\n render json: {\n error: @receipt.errors.full_messages.first,\n }, status: 400\n end\n end",
"def show\n @respuestum = Respuestum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @respuestum }\n end\n end",
"def show\n @notes = @task.task_notes\n @tasks = @task.sub_tasks\n end",
"def show\n @notadedebito = Notadedebito.find(params[:notadecredito_id])\n @renglon_notadebito = @notadedebito.renglon_notadebitos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @renglon_notadebito }\n end\n end",
"def show\n @relogio = Relogio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relogio }\n end\n end",
"def show\n @recebimento = Recebimento.find(params[:id] )\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recebimento }\n end\n end",
"def pt_print\n @task = Task.includes(:assignment).find(params[:task_id])\n @assignment = @task.assignment\n @titles = Title.build_paragraph_title_collection(@task.id,current_user.id)\n end",
"def show\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @premio }\n end\n end",
"def show\n @title_view = 'Pre Registro de Patrimonio Cultural'\n @cultural_heritage_cultural_heritage_pre_register = CulturalHeritage::CulturalHeritagePreRegister.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cultural_heritage_cultural_heritage_pre_register }\n end\n end",
"def show\n #renders views/donors/show.html.erb automatically\n @charityReps = CharityRep.all\n @donor = current_user\n @displaydonations = Donor.find(current_user.id).donations\n end",
"def show\n raise RecipeNotComplete unless @recipe.complete?\n @beerxml = BeerxmlParser.new(@recipe.beerxml).recipe\n @presenter = RecipePresenter.new(@recipe, @beerxml)\n @brew_steps = BrewStepsPresenter.new(@recipe)\n @brewlog = @recipe.brew_logs.build\n @brewlogs = @recipe.brew_logs.ordered.persisted\n\n Recipe.unscoped do\n commontator_thread_show(@recipe)\n end\n\n respond_to do |format|\n format.html { render :show }\n format.json { render :layout => false }\n format.xml {\n send_data @recipe.beerxml, {\n type: 'application/xml',\n disposition: 'attachment',\n filename: \"#{@recipe.name}.xml\"\n }\n @recipe.increment!(:downloads)\n }\n end\n end",
"def show\n @poem = @user.poems.find(params[:id])\n @comments = Comment.all\n impressionist(@poem)\n\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @poem }\n end\n \n end",
"def description\n\t\"This task scrapes Hoovers for company info.\"\nend",
"def show\n @processed_datum = ProcessedDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @processed_datum }\n end\n end",
"def processed_promos\n respond_to do |format|\n @taken_promos = TakenPromo.get_taken_promos_for_user current_user\n format.html { }\n end\n end",
"def show\n @requisicion = Requisicion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @requisicion }\n end\n end",
"def show_job_details(job)\n @scraper.scrape_details(job)\n job.print_info\n job\n end",
"def index\n @repondres = Repondre.all\n end",
"def show\n @breadcrumb = 'read'\n @prereading = PreReading.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prereading }\n end\n end",
"def process_display(fields, interval)\n now = Time.now.strftime('%a %b %d %H:%M:%S %Y')\n cols = terminal_columns\n processes =\n `ps axww -o #{fields}`.grep(/mongrel_rails/).map do |line|\n line.strip!\n line.sub! /\\s+SHELL=.*$/, '' # weird MacOS X issue\n line.sub! /(?:ruby\\d*: )?mongrel_rails /, '' # remove $0 prefix\n line.sub! /\\(ruby\\d*\\)/, '' # remove (ruby) suffix\n line[0,cols].chomp\n end\n output = [\n (' ' * (cols - now.length)) + now + \"\\r\" +\n \"Mongrel Top (delay: #{interval})\",\n \"\",\n processes,\n \"\",\n \"#{processes.length} process(es)\"\n ]\n output.flatten.join(\"\\n\")\nend",
"def show\n @rpm = Rpm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rpm }\n end\n end",
"def content\n prepare_misapplied\n @misapplication_details\n end",
"def paper\n reviewer_recommendations_task.paper\n end",
"def show\n @pessoa_receber = PessoaReceber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pessoa_receber }\n end\n end",
"def show\n @periodo_para_ingresar = PeriodoParaIngresar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @periodo_para_ingresar }\n end\n end",
"def show\n @prizecount = Prizecount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prizecount }\n end\n end",
"def get_rover_details; end",
"def show\n @timeclocks = @job.time_clocks\n @expenses = @job.expenses\n end",
"def show\n @poblacionesespecial = Poblacionesespecial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @poblacionesespecial }\n end\n end",
"def index\n @reparations = Reparation.all\n end",
"def show\n \n @receipe = Receipe.find(params[:receipe_id])\n @receipe_category = ReceipeCategory.find_by(id: @receipe.receipe_category_id)\n @ingredients = @receipe.ingredients\n @cooking_steps = @receipe.cooking_steps\n end",
"def show\n @requisicao = Requisicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @requisicao }\n end\n end",
"def show\n @recuritment = SocietyRecuritment.find(params[:id])\n end",
"def show\n @round_robin_promo = RoundRobinPromo.find(params[:id])\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @round_robin_promo }\n end\n end",
"def display_resource(practice_content)\n \"PracticeContent ID:#{practice_content.id}\"\n end",
"def show\n @parish = Parish.find(params[:id])\n @vicariou = Vicariou.find(@parish.vicariou_id)\n @pastor = Pastor.find(@parish.pastor_id)\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @parish }\n end\n end",
"def show_resource_content\n resource_content\n end",
"def show\n @prize = Prize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prize }\n end\n end",
"def show\n @prize = Prize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @prize }\n end\n end",
"def show\n puts '>>>>>>>>>>>>>>>>>>>>>>>>>>>>> VAI MOSTRAR UMA PROMOCAO JA CADASTRADA...'\n \n @promotion = Promotion.find(params[:id])\n @client = @promotion.client\n @client_id = @client.id\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @promotion }\n end\n end",
"def show\n render :text=>\"PID is invalid\", status: :bad_request and return if !params[:pid].include?(\":\")\n\n #parse pid for item identity; format TS[B|M]:[id]\n pid_bits = params[:pid].split(\":\")\n id = pid_bits.last\n resource_type = pid_bits.first[2].upcase\n if resource_type == \"B\"\n object = Bibl.find(id)\n elsif resource_type == \"M\"\n object = MasterFile.find(id)\n else\n # see if it is an old-style PID\n object = Bibl.find_by(pid: params[:pid])\n if object.nil?\n object = MasterFile.find_by(pid: params[:pid])\n end\n render :text=>\"PID is invalid\", status: :bad_request and return if object.nil?\n end\n\n render :xml=> Hydra.solr(object)\n end",
"def show\n @rip = Rip.find params[:id]\n respond_to do |format|\n format.html\n format.xml { render :xml => @rip.to_xml }\n end\n end",
"def show\n @reputacao_motoristum = ReputacaoMotoristum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reputacao_motoristum }\n end\n end",
"def show\n @content_node = ContentNode.find(params[:id])\n @title = \"Viewing '#{@content_node.title}' \"\n end"
] | [
"0.5986838",
"0.5825962",
"0.57980335",
"0.5725084",
"0.5708898",
"0.5703657",
"0.5692648",
"0.5672974",
"0.5642449",
"0.5637775",
"0.5626918",
"0.56148046",
"0.5552034",
"0.55179405",
"0.5501017",
"0.54672235",
"0.5382549",
"0.53643584",
"0.5350572",
"0.53368783",
"0.53245074",
"0.5315785",
"0.5314246",
"0.53141844",
"0.53021866",
"0.5278662",
"0.5255336",
"0.52495176",
"0.524844",
"0.52467424",
"0.5242012",
"0.5241981",
"0.5241667",
"0.5238142",
"0.52341604",
"0.5228323",
"0.52256954",
"0.5212557",
"0.5204299",
"0.5202105",
"0.5200222",
"0.51869106",
"0.51813453",
"0.51805377",
"0.51785403",
"0.5174154",
"0.5173019",
"0.5163145",
"0.5159758",
"0.51569414",
"0.51519924",
"0.5145724",
"0.51389027",
"0.5138866",
"0.5131934",
"0.5131308",
"0.51286083",
"0.5124924",
"0.5122442",
"0.51189333",
"0.5114247",
"0.5100021",
"0.50976086",
"0.509543",
"0.50800025",
"0.5072792",
"0.506711",
"0.50613075",
"0.50606686",
"0.5060444",
"0.5058148",
"0.50503486",
"0.5048676",
"0.50474083",
"0.5047308",
"0.5045931",
"0.5043783",
"0.50344074",
"0.5031898",
"0.50299984",
"0.5029029",
"0.5027321",
"0.50210834",
"0.50184906",
"0.5018212",
"0.5015998",
"0.50127524",
"0.5009801",
"0.5008125",
"0.50045586",
"0.49970734",
"0.49953",
"0.49951017",
"0.49941033",
"0.49905008",
"0.49905008",
"0.49897623",
"0.4989",
"0.4987897",
"0.49872348",
"0.4982123"
] | 0.0 | -1 |
Register new rental and emails user | def create
@rent = @artwork.rents.new
if @rent.confirm(current_user)
Kunstmail.rent(current_user, @artwork).deliver
redirect_to root_url, notice: "Check your email for further instructions"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n existing_user = User.find_by(email_id: params[:user][:email_id])\n if existing_user != nil\n if existing_user.is_realtor == true\n redirect_to login_path, notice: 'You are already registered as an Realtor'\n else\n existing_user.is_realtor = true\n existing_user.password = params[:user][:password]\n if existing_user.save\n add_realtor = Realtor.new(realtor_params)\n add_realtor.users_id = existing_user.id\n if add_realtor.save\n redirect_to login_path, notice: 'Realtor was successfully created.'\n else\n redirect_to login_path, notice: 'Error saving realtor.'\n end\n else\n redirect_to login_path, notice: 'Error saving user.'\n end\n end\n else\n @realtor = Realtor.new(realtor_params)\n @user = User.new(user_params)\n @user.is_realtor = true\n respond_to do |format|\n if @user.save\n @realtor.users_id = @user.id\n if @realtor.save\n format.html {redirect_to login_path, notice: 'Realtor was successfully created.'}\n format.json {render :show, status: :created, location: @realtor}\n else\n format.html {redirect_to login_path, notice: 'Error creating realtor'}\n format.json {render json: @realtor.errors, status: :unprocessable_entity}\n end\n else\n format.html {redirect_to login_path, notice: 'Error creating user. Please check input.'}\n format.json {render json: @user.errors, status: :unprocessable_entity}\n end\n end\n end\n end",
"def after_create_action\n sign_up_lead_rescuer\n send_email_to_lead_rescuer\n end",
"def restaurant_create\n begin\n user_create('devise/registrations/restaurant_new', '0')\n rescue => e\n Rails.logger.error APP_CONFIG['error'] + \"(#{e.message})\" + \",From:app/controllers/registrations_controller.rb ,Action:restaurant_create\"\n flash.now[:alert] = '發生錯誤! 註冊失敗!'\n render 'devise/registrations/restaurant_new'\n end\n end",
"def create\n @recruiter = Recruiter.new(params[:recruiter])\n @user = User.new(params[:user]) do |u|\n u.rolable = @recruiter\n u.skip_password_validation = true\n u.is_admin = params[:user][:is_admin] if current_user.is_admin # is_admin is non accessible\n end\n \n valid = @user.valid? \n valid = @recruiter.valid? && valid\n \n if valid\n create_and_send_invitation(@user, @recruiter, \"Recruiter\")\n else\n respond_to do |format|\n format.html { render action: \"new\" }\n format.json { render json: @recruiter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rental_confirmation(user)\n @user = user\n \n mail to: @user.email_address, subject: \"Rental confirmation\"\n end",
"def create\n @user = User.new(user_params)\n\n # Ensure the email addres is not a duplicate\n # If blank? returns true, then there is no user in the\n # database that has the same email as the user being created\n if User.where(email_address: @user.email_address).blank?\n if @user.save\n init_recur_plates @user # Setup recurring plate entry\n log_in @user # log in user right after sign up\n flash[:success] = 'Welcome to the LatePlate-o-Tron 3000!'\n redirect_to user_url(@user) # handle successful signup\n else\n render 'new'\n end\n # Make the user retry if the email is already being used\n elsif !User.where(email_address: @user.email_address).blank?\n flash[:danger] = 'A user with this email address already exists!'\n redirect_to root_url\n end\n end",
"def create\n @user = current_restaurant.users.new(params[:user])\n\n respond_to do |format|\n if @user.signup!(params)\n @user.deliver_invited_activation_instructions!(current_restaurant)\n current_restaurant.users << @user\n current_restaurant.save\n flash[:notice] = t('users.create.success')\n format.html { redirect_to(@user) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @rental = Rental.new(params[:rental])\n @rental.user = \"#{session[:user].name}\"\n respond_to do |format|\n if @rental.save\n Thread.new do\n NoticeMailer.deliver_created(@rental)\n end\n format.html { redirect_to(rentals_url, :notice => 'Reservierung / Verleih erfolgreich angelegt') }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def registration(user)\n @user = user\n\n mail to: @user.email_id, subject: \"Successful Registration\"\n end",
"def Registered(user)\n @user = user\n @greeting = \"Hi\"\n \n mail to: @user.email, subject: 'upartner会員登録完了'\n end",
"def create\n # Create a new user from the registrant\n # Keep the email the same\n @user = User.new(user_params)\n @user.email = @registrant.email\n \n # If the user is valid and saves, then destroy the\n # registrant, log the user in, and redirect to the home page\n if @user.save\n @registrant.destroy\n session[:user_id] = @user.id\n redirect_to root_url, notice: \"Welcome to Track Yo' Gas!\"\n else\n # Else, rerender the form\n render :new\n end\n end",
"def register\n return render :json => 'Invalid email address or password', status: 401 unless params[:email_address]\n existing_treater_account = TreaterAccount.find_by_email_address(params[:email])\n existing_user = existing_treater_account ? existing_treater_account.user : nil\n\n if existing_user.nil? && existing_treater_account.nil?\n #TODO - Fix attr_accessible white list so we dont' have to build this manually...\n user = User.create(email_address: params[:email], name: params[:name],\n password: params[:password], password_confirmation: params[:password_confirmation])\n treater_account = TreaterAccount.create(user_id: user.id, identifier: user.id, name: params[:name], email: user.email_address, authenticated_at: Time.now)\n user.account_setup\n\n session[:user_id] = user.id\n session[:external_account_id] = treater_account.id\n\n result = {}\n result[:on_complete_url] = params[:on_complete_url]\n return render :json => result.to_json, status: 200\n elsif existing_user && existing_treater_account.nil?\n #TODO - Fix attr_accessible white list so we dont' have to build this manually...\n # - Move all this logic to account_setup\n treater_account = TreaterAccount.create(user_id: existing_user.id, identifier: existing_user.id, name: params[:name], email: existing_user.email_address, authenticated_at: Time.now)\n\n session[:user_id] = existing_user.id\n session[:external_account_id] = treater_account.id\n\n result = {}\n result[:on_complete_url] = params[:on_complete_url]\n return render :json => result.to_json, status: 200\n else\n #login failed\n return render :json => 'Some error...', status: 401\n end\n end",
"def registrar_usuario\n business_user = User.new\n business_user.email = self.email\n business_user.password = business_user.generar_password\n business_user.client_type = 'empresa'\n business_user.save\n update(user_id: business_user.id, user_created_id: business_user.id)\n #luego de registrar al usuario se almacena la contraseña en la tabla Historypassword\n #donde se almacenaran las 3 ultimas usadas\n password_business = HistoryPassword.new\n password_business.password = business_user.password\n password_business.user_id = business_user.id\n password_business.save\n end",
"def booker_create\n begin\n user_create('devise/registrations/booker_new', '1')\n rescue => e\n Rails.logger.error APP_CONFIG['error'] + \"(#{e.message})\" + \",From:app/controllers/registrations_controller.rb ,Action:booker_create\"\n flash.now[:alert] = '發生錯誤! 註冊失敗!'\n render 'devise/registrations/restaurant_new'\n end\n end",
"def register_create\n begin\n user_create('devise/registrations/register')\n rescue => e\n Rails.logger.error APP_CONFIG['error'] + \"(#{e.message})\" + \",From:app/controllers/registrations_controller.rb ,Action:restaurant_create\"\n flash.now[:alert] = '發生錯誤! 註冊失敗!'\n render 'devise/registrations/register'\n end\n end",
"def create\n rent = Rent.new(creation_params)\n return invalid_params(rent.errors) unless rent.save\n send_mail_on_creation(rent)\n render(json: rent, serializer: RentSerializer, status: :created)\n end",
"def registration_succeed(user)\n @user = user\n\n mail to: user.email, :subject => 'Welcome to Real Thematics'\n end",
"def register_user(org_id, user_id)\n # @greeting = \"Hi\"\n @organisation = Organisation.find(org_id)\n @user = User.find(user_id)\n mail(to: @organisation.contact_email, subject: 'An new organisation host in MOBEEAS is added, waiting for your approval.')\n end",
"def signup_notification(user)\n setup_email(user)\n @subject += I18n.t 'mailer.signup.subject'\n \n @body[:url] = \"http://www.dripplet.com/#{user.locale}/activate/#{user.activation_code}\"\n \n end",
"def save!\n User.transaction do\n user.save!\n user.create_setup!\n end\n MarketingMailer.user_has_registered(user).deliver\n end",
"def registration( new_user )\n @greeting = \"Launch 'n Dine\"\n mail to: new_user.email,\n subject: \"Launch 'n Dine Welcomes You\"\n end",
"def create\n\n if bday_not_valid\n puts \"BDAY NOT VALID\"\n respond_to do |format|\n flash[:danger] = \"Date of birth is invalid. Please re-submit the form.\"\n format.html { redirect_to signup_path }\n end\n return\n end\n\n @user = User.new(user_params)\n\n if email_not_unique(@user.email)\n puts \"EMAIL NOT UNIQUE\"\n respond_to do |format|\n flash[:danger] = \"Email address belongs to an existing account. Please log in as #{@user.email} or re-submit the Sign up form with a different email address.\"\n format.html { render 'new' }\n end\n return\n end\n\n respond_to do |format|\n if @user.save\n country = create_if_not_found @user.country_of_residence\n #we have the country\n rel = LivesIn.new(from_node: @user, to_node: country)\n #country.lives_in << @user \n rel.save\n\n @user.send_activation_email\n flash[:info] = \"Please check your email to activate your account.\"\n format.html { redirect_to root_url }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @corporate_user, password = User.create_corp_user(corporate_user_params)\n respond_to do |format|\n if @corporate_user.save\n admin_email = User.where(id: @corporate_user.parent_id).first.email\n InviteUser.corporate_user_confirmation(@corporate_user,admin_email,password).deliver\n format.html { redirect_to corporate_users_path, notice: \"#{APP_MSG['corporate_user']['create']}\" }\n format.json { render :show, status: :created, location: corporate_user_path }\n else\n format.html { render :new }\n format.json { render json: @corporate_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def registrar_usuario\n employee_user = User.new\n employee_user.email = self.email\n employee_user.password = employee_user.generar_password\n employee_user.username = asignar_username_con_opciones\n if asignar_username_con_opciones.present?\n employee_user.username = asignar_username_con_opciones\n else\n employee_user.username = self.usuario.downcase\n end\n employee_user.client_type = 'empleado'\n employee_user.save\n update(user_id: employee_user.id, user_created_id: employee_user.id) \n #luego de registrar al usuario se almacena la contraseña en la tabla Historypassword\n #donde se almacenaran las 3 ultimas usadas\n password_employee = HistoryPassword.new\n password_employee.password = employee_user.password\n password_employee.user_id = employee_user.id\n password_employee.save\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n @user.send_activation_email\n flash[:info] = \"Please check your email to activate your account.\"\n redirect_to signin_path\n else\n render 'new'\n end\n end",
"def create\n respond_to do |format|\n if @user.save\n @user.sendmail_register_notify_user!\n @user.sendmail_register_notify_admins!\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def register_validation(user)\n @user = user\n \n @activation_link = configatron.site_url #TODO: Add user email validation to system\n\n mail to: @user.email, :subject => configatron.site_name + ' Registration'\n end",
"def new_signup(user, email)\n @greeting = \"Hi\"\n @user = user\n @email = email\n mail to: @email, subject: \"Your Account has been created on blogApp\"\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n @user.send_activation_email\n flash[:info] = \"Please check your email to activate your account.\"\n redirect_to root_url\n else\n render 'new'\n end\nend",
"def create\n @user = User.new(user_params)\n if @user.save\n UserMailer.registration_confirmation(@user).deliver\n redirect_to root_url, notice: \"Thank-you for enrolling!\"\n else\n render \"new\"\n end\n end",
"def signup(new_user)\n mail(to: new_user.email, subject: \"Congratulations on Signing up!\")\n end",
"def new_registration(account)\n @account = account\n mail subject: \"#{APP::NAME}: new registration\"\n end",
"def create\n if User.where(:email => params[:user][:email]).count.zero?\n @invited_user = User.invite!(params[:user], current_user)\n \n params[:freight_train] = true\n params[:ft] = {:partial => \"users/user\"}\n respond_with(@invited_user)\n else\n show_error \"That email address is already taken\"\n end\n end",
"def registration\n @saas = SETTINGS['saas_registration_mode']\n @user = User.new\n initialize_registration_form\n @errors = {\n :general => [],\n :subjects => [],\n :policies => [],\n :purchase => []\n }\n end",
"def create_user\n user = User.where(email: user_email)\n if user.blank? # new user\n @user = create_new_user\n church = nil\n if affiliation.blank?\n church = create_affiliation_from_church\n else\n church = Affiliation.find(self.affiliation)\n end\n @user.affiliation = church\n church.users << @user\n @user.save\n\n guest = Role.find_by_name(\"Guest\").id \n @user.role_ids=[guest]\n self.user_id = @user.id\n end\n end",
"def create\n # puts params.inspect\n # puts realtor_params.inspect\n\n @realtor = Realtor.new(realtor_params)\n\n if (current_user.user_type != 1 and params['create_by_admin'] == 0) || realtor_params[:user_id] == nil #We do not want admins to automatically bind created users to account.\n @realtor.user = current_user\n else\n @realtor.user = User.find(realtor_params[:user_id])\n end\n\n @realtorExists = Realtor.where('user_id': @realtor.user.id)\n\n # puts @realtor.user.inspect\n\n if @realtorExists.empty?\n\n respond_to do |format|\n if @realtor.save\n format.html { redirect_to @realtor, notice: 'Realtor was successfully created.' }\n format.json { render :show, status: :created, location: @realtor }\n\n @realtor.user.user_type = 2 # set user type to realtor after creation\n @realtor.user.save # save realtor to current user\n else\n format.html { render :new }\n format.json { render json: @realtor.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to new_realtor_path, notice: 'Realtor account already exists for this user.' }\n format.json { head :no_content }\n end\n end\n\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n @user.send_activation_email\n flash[:info] = \"Please check your email to activate your account.\"\n redirect_to root_url\n else\n render \"users/new\"\n end\n end",
"def create\n @renter = Renter.new(params[:renter])\n @locals = User.where(:city => @buyer.city)\n @users = @locals.random(5)\n respond_to do |format|\n if @renter.save\n @users.each do |user|\n RenterMailer.registration_welcome(@renter, user).deliver\n Renter.increment_counter(\"times_forwarded\", @renter.id)\n end\n format.html { redirect_to :submitted_page, :notice => 'Seller was successfully created.' }\n format.json { render :json => @renter, :status => :created, :location => @renter }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @renter.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def adduser(email, password, first_name, last_name, slug)\n @user = User.invite!(:email => email, :slug => slug) do |u|\n u.skip_invitation = true\n end\n token = @user.instance_variable_get(:@raw_invitation_token)\n User.accept_invitation!(:invitation_token => token,\n :password => password,\n :password_confirmation => password,\n :first_name => first_name,\n :last_name => last_name,\n :slug => slug)\n\n puts \"Created User #{email} with password #{password}\"\n @user\n end",
"def post_signup(req)\n # Create account\n identity = Lynr::Model::Identity.new(@posted['email'], @posted['email'])\n # Create and Save dealership\n dealer = create_dealership(identity, nil)\n notify('dealership.created.demo', req, dealer)\n # Send to admin pages?\n send_to_next(req) || send_to_admin(req, dealer)\n rescue Lynr::Persist::MongoUniqueError\n attempt_signin(req)\n end",
"def signup\n\t\tbegin\n\t\t\t@new_user = false\n\t\t first = params[:first]\n\t\t \tlast = params[:last]\n\t\t \temail = params[:email]\n\t\t \tpassword = params[:password]\n\t\t \tapi_key = SecureRandom.hex\n\n\t\t \tuser = nil\n\t\t \te = User.where(\"email = ?\", email).first\n\t\t\tif e == nil\n\t\t\t\t@new_user = true\n\t\t\t\tputs \"User is new...saving\"\n\t\t\t\tuser = User.new(first: first, last: last, email: email, password: password, api_key: api_key)\n\t\t\telse\n\t\t\t\tp 'User already exists...updating'\n\t\t\t\tuser = e\n\t\t\t\tuser.first = first\n\t\t\t\tuser.last = last\n\t\t\t\tuser.email = email\n\t\t\t\tuser.password = password\n\t\t\tend\n\n\t\t\tuser.save(:validate => false)\n\t\t\tif !user.persisted?\n\t\t\t\tp 'Issue saving user...'\n\t\t\t\trender json: nil\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\tmgr_role = Role.where(\"name = ?\", \"manager\").first\n\n\t\t\tcheck = nil\n\t\t\tlm_check = nil\n\n\t\t\tif !@new_user\n\t\t\t\tcheck = UserRole.where(\"user_id = ? and role_id = ?\", user.id, mgr_role.id).first\n\t\t\t\tlm_check = LeagueManager.where(\"user_id = ?\", user.id).first\n\t\t\tend\n\n\t\t\tif check == nil\n\t\t\t\tp 'Creating manager user role'\n\t\t\t\tUserRole.create!(user_id: user[:id], role_id: mgr_role[:id])\n\t\t\telse\n\t\t\t\tp 'Manager role is existing...'\n\t\t\tend\n\n\t\t\tif lm_check == nil\n\t\t\t\tp 'Creating League Manager record'\n\t\t\t\tlm = LeagueManager.create(user_id: user[:id])\n\t\t\telse\n\t\t\t\tp 'League Manager is existing...'\n\t\t\tend\n\n\t\t\tif @new_user\n\t\t\t\t@email = email\n\t\t\t\t@first = first\n\t\t\t\t@api_key = api_key\n\t\t\t\t@email_content = 'confirm_email_mailer/confirm_email'\n\n\t\t\t \t@confirm_email_link = ENV['Admin_Domain'] + \"/#/pages/confirm_email?key=#{@api_key}\"\n\t\t\t\t \n\t\t\t\tclient = SendGrid::Client.new(api_key: ENV['SENDGRID'])\n\n\t\t\t\tmail = SendGrid::Mail.new do |m|\n\t\t\t\t\tm.to = @email\n\t\t\t\t\tm.from = '[email protected]'\n\t\t\t\t\tm.subject = 'Confirm your email address for EZ Sports'\n\t\t\t\t\tm.html = render_to_string(@email_content, :layout => false)\n\t\t\t\tend\n\n\t\t\t\tif send_email?\n\t\t\t\t\tp 'SENDING CONFIRM EMAIL'\n\t\t\t\t\tres = client.send(mail)\n\t\t\t\t\tputs res.code\n\t\t\t\t\tputs res.body\n\t\t\t\tend\n\t\t\tend\n\n\t\t\trender json: user\n\t\trescue => e\n\t\t\tHandleError(e)\n\t\t\trender json: nil\n\t\tend\n\tend",
"def create\n @residencial = Residencial.find(params[:residencial_id])\n @apartamento = Apartamento.find(params[:apartamento_id])\n @user = @apartamento.users.build(params[:user])\n\n role = Role.find_by_nome(\"condomino\")\n @user.roles << role\n password = (0...4).map{ ('a'..'z').to_a[rand(26)] }.join\n password << (0...4).map{ (0..9).to_a[rand(10)] }.join\n @user.password = password\n\n #@user = User.new(params[:residencial])\n\n respond_to do |format|\n if @user.save\n #format.html { redirect_to [@user.apartamento.residencial, @user.apartamento, @user], notice: 'User foi criado com sucesso.' }\n format.html { redirect_to residencial_apartamento_users_path, notice: 'User foi criado com sucesso.' }\n format.json { render json: @user, status: :created, location: @user }\n\n UserMailer.welcome_email(@user, password).deliver!\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(params[:user])\n # todo: generate reasonably secure random passwords\n @user.password = \"qweprojisa2398dsl\"\n @user.password_confirmation = \"qweprojisa2398dsl\"\n \n # Save without session maintenance to skip auto-login, since we require\n # activation first.\n if @user.save_without_session_maintenance\n @user.send_registration_instructions!\n redirect_to(users_url, :notice => 'Invitation sent.')\n else\n render(:action => 'new', :notice => 'There was an error creating the invitation.')\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save\n UserMailer.account_activation(@user).deliver_now\n flash[:info] = \"Proszę sprawdź swój email, aby aktywować konto\"\n redirect_to root_url\n else\n render 'new'\n end\n end",
"def user_new(user)\n @user = user\n\n mail to: \"[email protected]\" ,\n subject: \"New User Created!!\"\n end",
"def create\n @preregistration = Preregistration.new(preregistration_params)\n session[:email] = @preregistration.email\n respond_to do |format|\n if @preregistration.save\n format.html { redirect_to @preregistration, notice: \"Preregistration was successfully created.\" }\n format.json { render :show, status: :created, location: @preregistration }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @preregistration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def register(seller)\n @seller = seller \n mail(:to => seller.emailadd, :subject => \"Welcome to the Car Sales site\") \n\n end",
"def register(user)\n if user\n @user = user\n mail(to: user.email, subject: \"Welcome to AccomMate!\")\n end\n end",
"def create\n @rameur = Rameur.new(rameur_params)\n\n respond_to do |format|\n if @rameur.save\n sign_in @rameur\n # Tell the UserMailer to send a welcome Email after save\n UserMailer.welcome_email(@rameur).deliver\n\n format.html { redirect_to @rameur, notice: \"Vous êtes membre, félicitations!\" }\n format.json { render action: 'show', status: :created, location: @rameur }\n else\n format.html { render action: 'new' }\n format.json { render json: @rameur.errors, status: :unprocessable_entity }\n end\n end\n end",
"def transaction_created(user)\n @user = user\n mail to: user.email, subject: \"Sign Up Confirmation\"\n end",
"def create\n #User.transaction.do\n email = params[:email]\n logger.debug(email)\n generated_password = Devise.friendly_token.first(8)\n begin\n user = User.create!(:email => email, :password => generated_password)\n UserMailer.send_welcome_email(self).deliver\n flash[:notice] = \"Invitation sent.\" \n rescue\n flash[:error] = \"FUCK.\"\n end\n render 'results'\n #end\n end",
"def create\n @person = Person.new(person_params)\n # If saved succesfully should go back to root_url and output signed up.\n @person.location_id = params[:location_id]\n if @person.save\n @person.send_activation_email # Class method.\n flash[:info] = \"Please check your email to activate your account.\"\n redirect_to root_url\n else\n render 'new'\n end\n end",
"def create\n user = User.find_by_email params[:user][:email]\n if user.blank?\n @user = User.create(user_params.merge(guest: true, invitation_token: generate_token))\n link_to_property @user, params[:user][:property_id] unless params[:user][:property_id].blank?\n UsersMailer.delay.invite_new_user current_user, @user\n end\n redirect_to properties_path\n end",
"def create\n \t@user = User.new user_params\n if @user.save\n \tUserMailer.account_activation(@user).deliver\n flash[:success] = \"Please confirm your email address to continute!\"\n redirect_to root_url\n else\n \tflash[:danger] = \"Ooopppss !!! Some thing went wrong !!\"\n render :new\n end\n end",
"def new_account(user)\n @user = user\n @user_name = @user.full_name\n @user_email = @user.email\n\n mail(to: @user.email, subject: 'Welcome to the jungle')\n end",
"def register\n if request.get? then\n @user = User.new\n end\n # Запрос на создание нового пользователя\n if request.post? then\n @user = User.new(params[:user])\n # Если включена регистрация по инвайтам - проверяем правильность введённого кода\n if SiteGlobal.invite_reg && !Invite.valid?(params[:invite]) then\n @user.errors[:base] << \"Invalid invation code\"\n render :register and return\n end\n # Пользователь может создать только аккаунт студента или преподавателя\n render_403 and return unless User.in_user_group?(@user)\n # Если запись успешно создана\n if @user.save then\n # Создание записи в дополнительной таблице\n if @user.student? then\n Student.create(user_id: @user.id)\n elsif @user.lecturer? then\n Lecturer.create(user_id: @user.id, confirm_level: Lecturer::CONFIRM_LEVELS[:unconfirmed])\n end\n if SiteGlobal.invite_reg\n Invite.use(params[:invite])\n end\n login, password = params[:user][:login], params[:user][:password]\n session[:user_id] = User.authenticate(login, password).id\n if @user.lecturer? then\n redirect_to settings_lecturer_path(reg: 1)\n elsif @user.student? then\n redirect_to settings_student_path(reg: 1)\n else\n redirect_to :root\n end\n else\n render :register\n end\n end\n end",
"def new_user(user, password)\n @user = user\n @password = password\n\n mail to: user.email, subject: \"[IMD- UFRN] Nova Conta no Gerenciador de Espaço Físico\"\n end",
"def create\n @registrant.user = current_user\n\n respond_to do |format|\n if @registrant.save\n format.html { redirect_to registrant_registrant_expense_items_path(@registrant), notice: 'Registrant was successfully created.' }\n format.json { render json: @registrant, status: :created, location: @registrant }\n else\n @user = current_user\n add_breadcrumb \"New\"\n load_categories\n load_online_waiver\n format.html { render action: \"new\" }\n format.json { render json: @registrant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.invite!(user_params, current_user)\n\n if @user.errors.present?\n respond_failure I18n.t('integral.backend.users.notification.creation_failure'), 'new'\n else\n respond_successfully I18n.t('integral.backend.users.notification.creation_success'), backend_user_path(@user)\n end\n end",
"def register_admin(org_id, user_id)\n # @greeting = \"Hi\"\n @organisation = Organisation.find(org_id)\n @user = User.find(user_id)\n mail(to: @organisation.contact_email, subject: 'An new organisation host in MOBEEAS is added, waiting for your approval.')\n end",
"def create_account\n set_user\n set_payer\n set_user_sport\n save_account\n end",
"def create_extern\n\t\t@extern = User.new(params[:user])\n\t\[email protected]_confirmation = @extern.password\n\t\t@intern = User.new\n\t\[email protected] = @extern.email\n\t\[email protected] = Base64.encode64(Digest::SHA1.digest(\"#{rand(1<<64)}/#{Time.now.to_f}/#{Process.pid}/#{@extern.login}\"))[0..7]\n\t\[email protected]_confirmation = @extern.password\n\t\[email protected] = false\n\n\t\tif @extern.save\n flash[:success] = \"Account registered! Your password has been sent to your mailbox.\"\n\t\t\tNotifier.deliver_welcome_email(@extern, @extern.password)\n redirect_to register_path\n else\n render :action => :new\n end\n\tend",
"def create\n @user = User.new(user_params)\n @user.activation = false\n\n respond_to do |format|\n if @user.save\n# session[:login] = @user\n# session[:user_id] = @user.id\n secret = SecureRandom::hex(50)\n session[:secret] = secret\n UserEntry.semiRegistered(@user, secret).deliver\n format.html { redirect_to users_entry_mail_send_path, notice: 'User was successfully created.' }\n format.json { render action: 'show', status: :created, location: @user }\n else\n format.html { render action: 'new' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @employer = Employer.new(employer_params)\n\n respond_to do |format|\n if @employer.save\n UserNotifier.send_signup_email(@employer).deliver\n format.html { redirect_to @employer, notice: 'Employer was successfully created.' }\n format.json { render :show, status: :created, location: @employer }\n else\n format.html { render :new }\n format.json { render json: @employer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchase = Purchase.new purchase_attributes\n if @purchase.save\n @ok = true\n renewed = Purchase.find_by_id params[:renewed_id]\n if renewed\n renewed.users.each do |u|\n u.purchase_id = @purchase.id\n u.save\n Notification.send_to(\n u.id,\n I18n.t('notifications.account.renewed.title'),\n I18n.t('notifications.account.renewed.message', :expiration_date => TimeConvert.to_string(@purchase.expiration_date)),\n ''\n )\n end\n renewed.expiration_date = Time.zone.now\n renewed.save\n end\n else\n @ok = false\n @errors = @purchase.errors.messages.keys\n @errors << :ssn_code if @errors.include?(:base)\n end\n end",
"def registration\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end",
"def create\n if user\n user.regenerate_verification_token\n MinimalistAuthenticationMailer.update_password(user).deliver_now\n end\n # always display notice even if the user was not found to prevent leaking user emails\n redirect_to new_session_path, notice: \"Password reset instructions were mailed to #{email}\"\n end",
"def send_mail_on_creation(rent)\n RentMailer.success_rent_email(rent.id).deliver_later\n end",
"def create_patron_user\n\t branch = Nimbos::Branch.where(patron_id: self.id).first\n\t role = Nimbos::Role.find_or_create_by(name: \"admin\")\n\t user = self.users.new\n\t user.name = self.contact_name\n\t user.surname = self.contact_surname\n\t user.email = self.email\n\t user.language = self.language\n\t user.locale = self.locale\n\t user.mail_encoding = self.mail_encoding\n\t user.time_zone = self.time_zone\n\t user.branch_id = branch.id\n\t user.password = self.password\n\t user.password_confirmation = self.password\n\t user.firstuser = true\n\t user.role_ids = [role.id]\n\t user.save!\n\t #user.add_role :admin\n\t end",
"def devise_save(person, invite_code)\n\n User.transaction do\n build_resource(person)\n if resource.save\n if person['role'] == '0'\n result = restaurant_init(person['phone'], resource)\n if result[0] == false\n flash.now[:alert] = result[1]\n render 'devise/registrations/restaurant_new'\n raise ActiveRecord::Rollback\n #make_error = 1/0 # template solve the hack attack or man make error situation\n end\n end\n\n if !invite_code.blank?\n code_record = InviteCode.where(:code => invite_code).first\n code_record.user_id = resource.id\n code_record.save\n end\n\n if resource.active_for_authentication?\n set_flash_message :notice, :signed_up if is_navigational_format?\n sign_up(resource_name, resource)\n respond_with resource, :location => after_sign_up_path_for(resource)\n else\n set_flash_message :notice, :'signed_up_but_#{resource.inactive_message}' if is_navigational_format?\n expire_session_data_after_sign_in!\n @user_email = resource.email\n #redirect_to '/home/wait_confirm_email'\n render '/home/wait_confirm_email', layout: 'registration'\n return\n #respond_with resource, :location => after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n #respond_with resource\n error = resource.errors.first[1]\n flash.now[:alert] = error\n render 'devise/registrations/restaurant_new'\n end\n\n end\n end",
"def create\n @user = User.new(params[:user])\n if params[:reservation].nil?\n @company = Company.new(params[:company])\n else\n\t # user has been invited, company already exists\n\t @company = Company.find(params[:company][:id])\n\t @user.company = @company\n\t Reservation.find_by_token(params[:reservation][:token]).delete\n\t end\n\n respond_to do |format|\n if @user.save\n\t if params[:reservation].nil?\n\t\t # set company owner\n\t @company.owner = @user\n\t @company.save\n\t @company.create_default_infos\n\t @user.company = @company\n\t end\n\t @user.save\n format.html { redirect_to :users, notice: 'Registration successful.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n # UserMailer.registration_confirmation(@user).deliver\n # flash[:success] = \"Please confirm your email address to continue\"\n redirect_to root_url\n else\n flash[:error] = \"Ooooppss, something went wrong!\"\n render 'new'\n end\n \n end",
"def create\n @user = User.new(params[:user])\n respond_to do |format|\n if @user.save\n format.html {\n @user.generate_activation_token\n UserMailer.activation_token(@user).deliver\n flash[:success] = \"Benvingut a Rettiwet! ... T'hem enviat un mail per activar el teu account ... consulta'l en breu!\"\n redirect_to signin_path\n }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { \n @title = \"Sign Up\"\n render action: \"new\" \n }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invitation = Invitation.new(params[:invitation])\n @user = current_user\n @title = @user.name\n UserMailer.reseller_added(@invitation).deliver\n\n respond_to do |format|\n if @invitation.save\n format.html { redirect_to(@invitation, :notice => 'Thank you, your invitation has been sent.') }\n format.xml { render :xml => @invitation, :status => :created, :location => @invitation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @invitation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new_email(user)\n @user = user\n \n mail to: @user.email, subject: \"Create your ParDIY credentials\"\n end",
"def create\n @user = User.new(params[:user])\n\n if @user.save_without_session_maintenance\n @user.deliver_activation_instructions!\n flash[:notice] = \"Your account has been created. Please check your email for your account activation instructions!\"\n redirect_to root_url\n else\n render :action => :new\n end\n end",
"def registered(user)\n mail_to user, registered_subject\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n #Sends email to user when user is created.\n UserNotifier.send_signup_email(@user).deliver_now\n format.html { redirect_to @user }\n flash[:success] = 'Usuário criado com sucesso, os dados foram enviados para o email informado.'\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params) \n if @user.save\n # Send activation link as email (and SMS)\n # url = HTTParty.get(\"#{ENV['MVAAYOO_URL']}?user=#{ENV['MVAAYOO_USER']}:#{ENV['MVAAYOO_PASSWORD']}&senderID=TEST%20SMS&receipientno=#{@user.phone}&msgtxt=New verification for #{@college_ver.name}. Name: #{@verification_request.name}. Hallticket: #{@verification_request.hallticket_no}&state=4\")\n @user.send_activation_email\n flash[:info] = \"Please check your email to activate your account.\"\n redirect_to login_url\n else\n render 'new'\n end\n\n end",
"def create\n # @user holds values from submitted form\n @user = User.new(user_params)\n \n # attempt to save the new user, log the user in if successful and redirect\n # to user details page\n if @user.save\n @user.send_activation_email\n flash[:info] = \"Please check your email to activate your account.\"\n redirect_to root_url\n else\n # something went wrong, re-render the new user form with previously entered\n # information, errors will be displayed above form\n render 'new'\n end # if\n end",
"def create\n @user = User.new(user_params)\n politician = Politician.find(params[:politician_id])\n\n respond_to do |format|\n if @user.save\n NotificationMailer.notify(@user, politician.notifications.last).deliver\n # send_twilio(@user, politician.notifications.last)\n format.html { redirect_to root_path, notice: 'Agora você receberá as novidades desse candidato' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n @user.add_token\n @tempass = SecureRandom.hex(4)\n @user.password = @tempass\n @group = Group.find(params[:group_id])\n if @user.save\n @reviewer = Reviewer.create(user_id: @user.id, group_id: @group.id)\n @groupreview = GroupReview.find_by(group_id: @group.id)\n Review.create(title: \"\", body: \"\", user_id: @user.id, group_review_id: @groupreview.id )\n UserMailer.invite_mailer(@user, @tempass).deliver\n redirect_to '/'\n else\n flash[:empty] = \"Field cannot be empty!\"\n redirect_to new_group_user_path\n end\n end",
"def set_listener\n return unless self.controller_name == \"registrations\"\n user = User.find_for_authentication(:email => params[:user][:email])\n @listener.user_id = user.id\n user.listener = @listener\n @listener.save\n user.save\n end",
"def new\n # Create a new user with same email, then display form\n @user = User.new(email: @registrant.email)\n end",
"def send_post_registration_email\n IdealsMailer.account_registered(self).deliver_now\n end",
"def create\n @user.update_activation_digest\n @user.send_activation_email\n head 201\n end",
"def signup_confirmation_advisee(user)\n @user = user\n mail to: @user.email, subject: \"Advisee new registration\"\n end",
"def register\n\t\t@user = User.new(user_params)\n\n\t\trespond_to do |format|\n\t\t\tif @user.save\n\t\t\t\t# Send user welcome email\n\t\t\t\tUserNotification.welcome_email(@user).deliver\n\n\t\t\t\tformat.js { @errors = [] }\n\t\t\telse\n\t\t\t\tformat.js { @errors = @user.errors }\n\t\t\tend\n\t\tend\n\tend",
"def signup_activation(user)\n @user = user\n @url = 'http://localhost:3000/login'\n mail to: @user.email, subject: \"Match Point validate email\"\n end",
"def register\n if request.post?\n @user.update_attributes params['user']\n if @user.valid?\n after_register\n redirect_to welcome_path and return\n else\n if @user.errors[:email].include?(\"Already Taken\")\n # Look up the already-existing user, set the current tracker to that user, and send them along\n right_user = User.where(:email => @user.email).first\n @tracker.user_id = right_user.id\n cookies[:user_id] = right_user.id\n session[:email_pwd] = params['user']['email_password']\n @user = right_user\n @tracker.log(:existing_user_returned, \"Existing user #{@user.email} got into the landing path again.\")\n increment_page\n redirect_to welcome_path and return\n else\n @tracker.log(:failed_register, \"User creation failed with message: #{@user.errors.full_messages.join(\", \")}\")\n end\n end\n end\n render_path_page\n end",
"def create \n user = User.find_by(email: params[:email])\n if user\n if user.update(password_reset_token: unique_token, passwoord_reset_set_at: Time.zone.now)\n UserMailer.with(user: user).forgot_password_email.deliver_later \n end\n end\n redirect_to login_path, notice: \"If you have an account, you will get an email with instructions on how to reset your password.\"\n end",
"def create\n @user = User.new(params[:user])\n\n if @user.save\n UserMailer.activation_instructions(@user).deliver\n flash[:notice] = \"Your account has been created. Please check your e-mail for your account activation instructions! You may close this window and follor the link in your email to sign in.\"\n redirect_to root_url\n else\n flash[:notice] = \"There was a problem creating the user account\"\n render :action => :new\n end\nend",
"def create\n @user=User.new(params[:user])\n if [email protected]?\n pw_hash = Digest::MD5.hexdigest(@user.password)\n #if validation was ok we can update the user\n if @user.save\n #update pw with hash\n @new_user = User.find(@user.id)\n @new_user.password = pw_hash\n #set user status to inactive\n @new_user.status = false;\n #generate random token for confirmation mail\n uuid = UUID.new\n @new_user.registration_token = uuid.generate\n @new_user.save\n #send the mail\n Notifier.send_registration_confirmation(@new_user).deliver\n flash[:notice] = \"User was successfully created\"\n redirect_to :root\n else\n render :action => \"/new\"\n end\n\n else\n render :action => \"/new\"\n end\n\n end",
"def create\n\n @organizer = Organizer.new(organizer_params.except! 'type_of_user', 'password', 'password_confirmation')\n\n if !organizer_params[:user_id] && organizer_params[:type_of_user] === 'organizer'\n sign_up_params = {\n name: organizer_params[:name],\n email: organizer_params[:email],\n password: organizer_params[:password],\n password_confirmation: organizer_params[:password_confirmation],\n type_of_user: organizer_params[:type_of_user]\n }\n\n temp_user = User.new(sign_up_params)\n if temp_user.save\n sign_in temp_user, :bypass => true\n @organizer.user = temp_user\n else\n puts temp_user.errors.inspect\n flash[:errors] = temp_user.errors\n redirect_to organizer_welcome_path, notice: I18n.t('organizer-create-issue-message')\n return\n end\n end\n\n respond_to do |format|\n if @organizer.save\n if organizer_params[:email]\n sign_in_mailchimp organizer_params[:email]\n end\n format.html {\n if @organizer.mail_notification\n ContactMailer.notify(\"Uma nova conta de guia foi criada\").deliver_now\n OrganizerMailer.notify(@organizer, \"activate\").deliver_now\n end\n redirect_to organizer_path(@organizer), notice: I18n.t('organizer-create-success')\n\n }\n format.json { render :show, status: :created, location: @organizer }\n\n else\n format.html {\n flash[:errors] = @organizer.errors\n puts @organizer.errors.inspect\n redirect_to organizer_welcome_path, notice: I18n.t('organizer-create-issue-message')\n }\n format.json { render json: @organizer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(user_params)\n\n if @user.save\n @user.update_attribute(:token, SecureRandom.hex(6))\n RegistrationMailer.registration_confirmation(@user, new_email_confirmation_url(token: @user.token)).deliver\n if( @user.account == \"premium\")\n redirect_to new_charge_path :user, @user\n else\n redirect_to root_path, notice: \"An email has been sent to your account. Please click the link in the email to verify address and complete your registration.\"\n end\n else\n flash[:error] = \"Error creating new user. Please try again.\"\n render :new\n end\n\n end",
"def new_user(user_name, email)\n @user_name = user_name\n @email = email\n\n mail to: \"Susie Ye <[email protected]>\", subject: \"Free User: #{email}\"\n end",
"def create\n @renewal = Renewal.new(params[:renewal])\n\n respond_to do |format|\n if @renewal.save\n format.html { redirect_to(@renewal, :notice => 'Renewal was successfully created.') }\n format.xml { render :xml => @renewal, :status => :created, :location => @renewal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @renewal.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n if !session[:user_id]\n flash[:error] = \"You are not a valid user. Please Login to continue.\"\n redirect_to \"/home\"\n else\n ##Experiment\n# reminder.transaction do # start transaction. any AR class would do, it applies to the connection\n# @reminder = Reminder.new(params[:reminder])\n# @reminder.uid = @session[\"user_id\"]\n# end # end transaction\n \n @reminder = Reminder.new(params[:reminder])\n @reminder.user_id = session[:user_id]\n \n respond_to do |format|\n if @reminder.save\n flash[:notice] = 'Reminder was successfully created.'\n format.html { redirect_to(@reminder) }\n format.xml { render :xml => @reminder, :status => :created, :location => @reminder }\n else\n @show_header = true\n @show_footer = true\n format.html { render :action => \"new\" }\n format.xml { render :xml => @reminder.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def user_created(user)\n @user = user\n\n mail to: @user.email, subject: \"Bienvenue sur l'application Hotel Tycoon !\"\n end",
"def create\n @reseller = Reseller.new(reseller_params)\n\n respond_to do |format|\n if @reseller.save\n ResellerMailer.welcome_email(@reseller).deliver_now\n ResellerMailer.new_signup_email(@reseller).deliver_now\n format.html { redirect_to thankyou_path from: 'reseller' }\n format.json { render :show, status: :created, location: @reseller }\n else\n format.html { render :new }\n format.json { render json: @reseller.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.68424815",
"0.67359847",
"0.6661093",
"0.6655047",
"0.6631085",
"0.6596117",
"0.6583677",
"0.65198594",
"0.64620304",
"0.6457709",
"0.64526325",
"0.64458776",
"0.64231634",
"0.64189416",
"0.6413707",
"0.6392294",
"0.6354494",
"0.63520336",
"0.6331025",
"0.6329924",
"0.6314354",
"0.6291326",
"0.6286297",
"0.62858164",
"0.62744075",
"0.62736696",
"0.62709916",
"0.6242491",
"0.62403893",
"0.6231338",
"0.6227142",
"0.62255913",
"0.62233484",
"0.62193716",
"0.62161505",
"0.620624",
"0.62055135",
"0.6197169",
"0.6186022",
"0.6184629",
"0.61622846",
"0.6154028",
"0.61507547",
"0.61377573",
"0.6133629",
"0.61202264",
"0.6116428",
"0.6116206",
"0.6109937",
"0.61027235",
"0.61004937",
"0.6099203",
"0.6098986",
"0.6094514",
"0.608919",
"0.6088325",
"0.60726374",
"0.6071695",
"0.6070985",
"0.6070661",
"0.6065437",
"0.6065029",
"0.6064597",
"0.60642445",
"0.6058123",
"0.60545135",
"0.6051278",
"0.60497797",
"0.60461164",
"0.60456467",
"0.6043901",
"0.6042789",
"0.6039453",
"0.60394114",
"0.6028983",
"0.60251933",
"0.6022913",
"0.6021572",
"0.60193455",
"0.6018315",
"0.6016455",
"0.60163844",
"0.60140634",
"0.600756",
"0.600669",
"0.60055614",
"0.6005051",
"0.6004979",
"0.5998006",
"0.59970635",
"0.59894055",
"0.5988205",
"0.59815305",
"0.5979707",
"0.5975028",
"0.5974882",
"0.5970845",
"0.5967276",
"0.5966978",
"0.59657454"
] | 0.62248 | 32 |
=begin CONFIRM SALES RELATED =end | def confirm_production_repair_result
@production_repair_result = ProductionRepairResult.find_by_id params[:production_repair_result_id]
# add some defensive programming.. current user has role admin, and current_user is indeed belongs to the company
@production_repair_result.confirm( current_user )
@object = @production_repair_result
@parent = @object.template_sales_item
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confirm_sales_order\n @sales_order = SalesOrder.find_by_id params[:sales_order_id]\n # add some defensive programming.. current user has role admin, and current_user is indeed belongs to the company \n @sales_order.confirm( current_user ) \n end",
"def sell_confirmed\n end",
"def confirm_order\n end",
"def confirm_object(confirmation_datetime)\n return self if not self.confirmable?\n \n self.is_confirmed = true \n self.confirmed_at = confirmation_datetime\n self.save \n \n self.post_confirm_update_stock_mutation\n # self.post_confirm_update_price_mutation \n \n # po_detail =self.purchase_order_detail\n # po_detail.pending_receival -= self.quantity \n po_detail = self.purchase_order_detail \n po_detail.execute_receival( self.quantity ) \n end",
"def resend_confirmation_instructions; end",
"def redsys_confirm\n logger.info \"==== REDSYS#CONFIRM ==== order##{params[:order_id]} params# #{params.inspect}\"\n @order ||= Spree::Order.find_by_number!(params[:order_id])\n if check_signature\n unless @order.payments.any?(&:completed?)\n payment_upgrade\n @order.updater.update_payment_total\n end\n @order.next\n if @order.completed?\n flash.notice = Spree.t(:order_processed_successfully)\n flash[:order_completed] = true\n session[:order_id] = nil\n redirect_to completion_route(@order)\n else\n flash[:error] = @order.errors.full_messages.join(\"\\n\")\n redirect_to checkout_state_path(@order.state) and return\n end\n else\n flash[:alert] = Spree.t(:spree_gateway_error_flash_for_checkout)\n redirect_to checkout_state_path(@order.state)\n end\n end",
"def food_partner_confirmation_notice(enquiry)\n @enquiry = enquiry\n @food_partner = @enquiry.food_partner\n @customer = @enquiry.customer\n mail(subject: \"[team] #{@food_partner.company_name} confirmed order #{@enquiry.id}\")\n end",
"def transaction_fee_invoice\n NotificationsMailer.with(sports_centre: SportsCentre.first, amountPaid: 32.00, poliId: \"345678976543\").transaction_fee_invoice\n end",
"def rental_confirmation(user)\n @user = user\n \n mail to: @user.email_address, subject: \"Rental confirmation\"\n end",
"def reservation_confirmation(res_id, total_price)\n @total_price = total_price\n @reservation = Reservation.find(res_id)\n # @reservation[:check_in_date] = unsanitize_date @reservation[:check_in_date].to_s\n # @reservation[:check_out_date] = unsanitize_date @reservation[:check_out_date].to_s\n @kennel = Kennel.find(@reservation[:kennel_id])\n @hours_of_operation = HoursOfOperation.where(kennel_id: @kennel[:id]).first\n mail(to: @reservation[:customer_email], subject: 'PawBookings Reservation Receipt', bcc: [\"[email protected]\"])\n end",
"def confirm_pre_production_result\n @pre_production_result = PreProductionResult.find_by_id params[:pre_production_result_id]\n # add some defensive programming.. current user has role admin, and current_user is indeed belongs to the company \n @pre_production_result.confirm( current_user ) \n @object = @pre_production_result\n @parent = @object.template_sales_item \n end",
"def final_confirmation\n if session[:all_free_shipping]\n carrier = \"Free Shipping\"\n method = \"Free Shipping\"\n else\n order_id = params[:order][:id]\n carrier = params[:order][:carrier]\n method = params[:order][:shipping_method]\n end\n\n coupon_code = session[:coupon]\n\n @cart = find_cart\n @order = session[:order]\n\n @order.set_freight_ship_to session[:ship_to]\n @order.set_freight_options session\n\n if valid_coupon_code?(coupon_code, @order.totalize_items)\n @order.coupon = coupon_code\n end\n\n @order.carrier = carrier\n @order.taxes = round(@cart.totalize_products * state_tax(@order.billing_state)).to_f\n @order.shipping_method = shipping_method(method)\n @order.shipping_approx = shipping_approx(@order.carrier, method)\n session[:order] = @order\n end",
"def confirm!\n no_stock_of = self.order_items.select(&:validate_stock_levels)\n unless no_stock_of.empty?\n raise Shoppe::Errors::InsufficientStockToFulfil, :order => self, :out_of_stock_items => no_stock_of\n end\n \n run_callbacks :confirmation do\n # If we have successfully charged the card (i.e. no exception) we can go ahead and mark this\n # order as 'received' which means it can be accepted by staff.\n self.status = 'received'\n self.received_at = Time.now\n self.save!\n\n self.order_items.each(&:confirm!)\n\n # Send an email to the customer\n deliver_received_order_email\n end\n \n # We're all good.\n true\n end",
"def resend_receipt\n @order = Order.find(params[:id])\n #@order.cleanup_successful\n # Send success message\n @order.deliver_receipt\n redirect_to :action => 'show', :id => @order.id\n end",
"def external_unconfirm\n if not self.transaction_source_id.nil? \n self.errors.add(:generic_errors, \"Can't modify the automated generated transaction\")\n return self \n end\n \n self.is_confirmed = false \n if self.save\n self.update_affected_accounts_due_to_un_confirmation\n end\n end",
"def confirm_sales_return\n @sales_return = SalesReturn.find_by_id params[:sales_return_id]\n # add some defensive programming.. current user has role admin, and current_user is indeed belongs to the company \n @sales_return.confirm( current_user )\n @sales_return.reload \n # sleep 5 \n end",
"def confirmarCotizMesExp\n GeneradorCorreoMailer.confirmarCotizMesExp\n end",
"def confirm_purchase(purchase)\r\n purchase.confirm\r\n end",
"def subscriber_notice_awaiting_payment\n BrandMailer.subscriber_notice(\n brand: Brand.find_by(company_name: 'Brand Nine'),\n stage: 'awaiting_payment'\n )\n end",
"def fulfillment_new_invoice(invoice) \n @invoice = invoice\n sc = invoice.site.store_config\n mail(:to => sc.fulfillment_email, :subject => 'New Order')\n end",
"def custConfirmation\n ContactMailer.custConfirmation\n end",
"def call_create_saleorder_and_invoice(hotelres)\n hotelres.call(\"confirmed_reservation\",[hotelres.id])\n acm = eval(session[:database_name].to_s.upcase.to_s)::AccountMove.new\n acm.journal_id = eval(session[:database_name].to_s.upcase.to_s)::AccountJournal.search([['type','=','bank']])[0]\n acm.company_id = hotelres.company_id.id\n acm.ref = hotelres.reservation_no\n acm.save\n acm.reload\n acml = eval(session[:database_name].to_s.upcase.to_s)::AccountMoveLine.new\n acml.move_id = acm.id\n acml.name = hotelres.reservation_no\n acml.partner_id = hotelres.partner_id.id\n acml.account_id = hotelres.partner_id.property_account_receivable.id\n acml.credit = hotelres.total_cost1\n acml.debit = 0\n acml.status = 'draft'\n base_currency = ResCurrency.find(:all,:domain=>[['base','=',true]])[0]\n available_paypal_array = [\"AUD\",\"CAD\",\"CZK\",\"DKK\",\"EUR\",\"HKD\",\"HUF\",\"JPY\",\"NOK\",\"NZD\",\"PLN\",\"GBP\",\"SGD\",\"SEK\",\"CHF\"]\n if base_currency\n acml.currency_id = base_currency.id\n if available_paypal_array.include?(base_currency.name)\n acml.amount_currency = \"-\"+(hotelres.total_cost1).to_s\n elsif base_currency.name == \"USD\"\n acml.amount_currency = \"-\"+(hotelres.total_cost1).to_s\n else\n convertrateusd = ResCurrency.find(:all,:domain=>[['name','=','USD' ]])[0]\n acml.currency_id = convertrateusd.id\n acml.amount_currency = \"-\"+(hotelres.total_cost1 * convertrateusd.rate).to_s\n end\n else\n convertrateusd = ResCurrency.find(:all,:domain=>[['name','=','USD' ]])[0]\n acml.currency_id = convertrateusd.id\n acml.amount_currency = \"-\"+(hotelres.total_cost1 ).to_s\n end\n acml.save\n acml = eval(session[:database_name].to_s.upcase.to_s)::AccountMoveLine.new\n acml.move_id = acm.id\n acml.name = hotelres.reservation_no\n acml.partner_id = hotelres.partner_id.id\n acml.account_id = eval(session[:database_name].to_s.upcase.to_s)::AccountJournal.find(eval(session[:database_name].to_s.upcase.to_s)::AccountJournal.search([['type','=','bank']])[0]).default_debit_account_id.id\n acml.debit = hotelres.total_cost1\n acml.credit = 0\n if base_currency\n acml.currency_id = base_currency.id\n if available_paypal_array.include?(base_currency.name)\n acml.amount_currency = hotelres.total_cost1\n elsif base_currency.name == \"USD\"\n acml.amount_currency = hotelres.total_cost1\n else\n convertrateusd = ResCurrency.find(:all,:domain=>[['name','=','USD' ]])[0]\n acml.currency_id = convertrateusd.id\n acml.amount_currency = hotelres.total_cost1 * convertrateusd.rate\n end\n else\n default_cur = ResCurrency.find(:all,:domain=>[['name','=','USD' ]])[0]\n acml.currency_id = default_cur.id\n acml.amount_currency = hotelres.total_cost1\n end\n acml.status = 'draft'\n acml.save\n end",
"def resend_confirmation_email\n current_user.resend_confirmation_instructions\n respond_to do |format|\n format.html {redirect_to purchase_orders_path, notice: \"Confirmation Email has been re-sent\"}\n end\n end",
"def subscriber_notice_approval_alert\n BrandMailer.subscriber_notice(\n brand: Brand.find_by(company_name: 'Brand Nine'),\n stage: 'approval_alert'\n )\n end",
"def confirm\n @order.confirm_notes = params[:order][:confirm_notes]\n @order.approx_cost = (@order.approx_cost.to_f * 100.0).floor\n @order.confirm\n \n if @order.confirm_notes.present? \n OrderNote.create(:message => @order.confirm_notes, :order_id => @order.id, :author_id => @order.assigned_to.id) rescue nil \n end\n\n @order.approx_cost = (@order.approx_cost.to_f / 100.0).floor\n \n render 'status'\n end",
"def confirm_order\n @check = Ticket.where(table: session[:table_id]).last\n if @check.nil?\n puts(\"ticket not created yet!\")\n return\n end\n @items = OrderItem.where(:ticket_id => @check.id)\n @check.update(:subtotal => 0)\n\t # Add item totals\n\t comp = 0\n @items.each do |orderItem|\n menu_item = Menuitem.find_by(id: orderItem.item)\n @check.update(:subtotal => (@check.subtotal + menu_item.price))\n\t\tunless orderItem.compitem.nil?\n\t\t\tcomp = comp + orderItem.compitem.amount\n\t\tend\n end\n\n\t \n\t # check reward points\n\t if current_guestaccount\n\t\t # check points\n\t\t if current_guestaccount.points > 4\n\t\t\t @check.update(:subtotal => (@check.subtotal - 10.00))\n\t\t\t @check.update(:points => true)\n\t\t end\n\t\t # check birthday\n\t\t if (current_guestaccount.birthday.month == Time.now.month &&\n\t\t\t current_guestaccount.birthday.day == Time.now.day)\n\t\t\t @check.update(:birthday => true)\n\t\t end\n\t end\n\t \n\t # check birthday discount\n\t if @check.birthday\n\t\t @check.update(:subtotal => (@check.subtotal - 10.00))\n\t end\n\t \n\t # check coupon\n\t if @check.coupon\n\t\t @check.update(:subtotal => (@check.subtotal - 10.00))\n\t end\n\n\t #adjust subtotal for comp\n\t @check.update(:subtotal => (@check.subtotal - comp))\n unless @check.compticket.nil? \n @check.update(:subtotal => (@check.subtotal - @check.compticket.amount))\n end\n\n\t # subtotal cannot be negative\n\t if @check.subtotal < 0\n\t\t @check.update(:subtotal => 0)\n\t end\n\n\t # calculate tax\n\t @check.update(:tax => (@check.subtotal * 0.0825))\n\t \n\t unless @check.gratuity.nil?\n\t\t @check.update(:total => (@check.subtotal + @check.tax + @check.gratuity))\n\t else\n\t @check.update(:total => (@check.subtotal + @check.tax))\n\t end\n end",
"def buyer_confirmed\n end",
"def confirm_pre_production_history\n @pre_production_history = PreProductionHistory.find_by_id params[:pre_production_history_id]\n # add some defensive programming.. current user has role admin, and current_user is indeed belongs to the company \n @pre_production_history.confirm( current_user ) \n @object = @pre_production_history\n @parent = @object.sales_item \n end",
"def invoice\n if @invoice.should_be_delivered? then\n @invoice.set_delivered \n end\n \n respond_to do |wants|\n wants.html do\n redirect_to survey_report_path(@survey)\n end\n end\n end",
"def saveReceipt\n\t\tcurrent_time = DateTime.now\n\t\tReceipt.create!(:concept => params[:tipofactura],\n\t\t\t\t\t\t\t:subtotal => params[:subtotal],\n\t\t\t\t\t\t\t:total => params[:pagototal],\n\t\t\t\t\t\t\t:iva => params[:iva],\n\t\t\t\t\t\t\t:xml => params[:rawxml],\n\t\t\t\t\t\t\t:users_id => current_user.id,\n\t\t\t\t\t\t\t:created_at => current_time,\n\t\t\t\t\t\t\t:updated_at => current_time,\n\t\t\t\t\t\t\t:user_email => current_user.email,\n\t\t\t\t\t\t\t:emisor => params[:emisor],\n\t\t\t\t\t\t\t:rfcEmisor => params[:rfcemisor],\n\t\t\t\t\t\t\t:receptor => params[:receptor],\n\t\t\t\t\t\t\t:rfcReceptor => params[:rfcreceptor])\n\t\tredirect_to action: 'viewInvoices' , email: current_user.email\n\tend",
"def confirm(blank)\n @blank = blank\n if @blank.apply_type == \"ex_apply\"\n mail(to: @blank.email,\n subject: \"您的参展申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n content_type: \"text/html\",\n body: \"亲爱的参展商朋友:<br/>\n 恭喜您,您所提交的参展申请已经审核通过,请携带个人名片、身份证及以下参展确认号至展会现场媒体接待处领取参展证。\n <ul>\n <li><a href='http://121.41.26.127/stores/1'>1号馆 左边部分</a></li>\n <li><a href='http://121.41.26.127/stores/3'>9号馆上半部分</a></li>\n <li><a href='http://121.41.26.127/stores/4'>1号馆 右边部分</a></li>\n <li><a href='http://121.41.26.127/stores/5'>9号馆下半部分</a></li>\n </ul>\n 展览时间:
2015-06-25 至 2015-06-28 <br/>\n 展览地点:
深圳会展中心(1、9号馆)
<br/>\n 如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。
主办信息:
2015中国(深圳)国际钟表展览会
电话:0755-82945180
传真:0755-82941162
通信地址:深圳市福田保税区市花路福年广场B栋302室
邮箱:[email protected]\"\n )\n else\n mail( to: @blank.email,\n subject: \"您的记者证申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n body: \"亲爱的媒体朋友:\n恭喜您,您所提交的记者证申请已经审核通过,请携带个人名片、身份证及以下记者证确认号至展会现场媒体接待处领取记者证。\n\n展览时间:
2015-06-25 至 2015-06-28 \n
展览地点:
深圳会展中心(1、9号馆)
\n如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。
主办信息:
2015中国(深圳)国际钟表展览会
电话:0755-82945180
传真:0755-82941162
通信地址:深圳市福田保税区市花路福年广场B栋302室
邮箱:[email protected]\")\n end\n end",
"def confirm_all_pending_purchases\r\n self.pending_purchases.each{|purchase| purchase.confirm}\r\n end",
"def can_be_unconfirmed?\n \n if self.purchase_receival_entries.count != 0\n self.errors.add(:generic_errors, \"Tidak bisa unconfirm karena sudah ada penerimaan barang\")\n return false \n end\n \n if self.purchase_return_entries.count != 0 \n self.errors.add(:generic_errors, \"Tidak bisa unconfirm karena sudah ada pengembalian barang\")\n return false\n end\n\n \n \n reverse_adjustment_quantity = -1*quantity \n \n final_item_quantity = item.pending_receival + reverse_adjustment_quantity\n final_warehouse_item_quantity = warehouse_item.pending_receival + reverse_adjustment_quantity\n \n if final_item_quantity < 0 or final_warehouse_item_quantity < 0 \n msg = \"Tidak bisa unconfirm karena akan menyebabkan jumlah #{item.name} pending receival menjadi #{final_item_quantity} \" + \n \" dan jumlah item gudang menjadi :#{final_warehouse_item_quantity}\"\n self.errors.add(:generic_errors, msg )\n return false \n end\n \n return true \n end",
"def confirm!\n self.pending = false\n self.save\n self.createDebts\n end",
"def sell_pending\n end",
"def receipt\n end",
"def receipt\n end",
"def order_budget()\n \n @greeting = \"Hi\"\n\n mail :to => \"[email protected]\", :subject => 'Pragmatic Store Order Confirmation'\n end",
"def paypal_ipn\n notify = Paypal::Notification.new(request.raw_post)\n \n if notify.acknowledge\n transaction = Transaction.where(order_id: notify.params['invoice']).first\n if notify.complete? and transaction.gross_amount.to_s == notify.params['mc_gross']\n transaction.fee = notify.params['mc_fee']\n transaction.completed!\n else\n transaction.failed!\n end\n if transaction.save\n Mailatron4000::Orders.confirmation_email(transaction.order) rescue Rails.logger.warn(\"PayPal IPN: Order #{transaction.order.id} confirmation email failed to send\")\n end\n end\n\n render nothing: true\n end",
"def pending_confirmation_sales_orders\n self.sales_orders.joins(:client).where(:is_confirmed => false, :is_canceled => false )\n end",
"def confirm_delivery\n @delivery = Delivery.find_by_id params[:delivery_id]\n # add some defensive programming.. current user has role admin, and current_user is indeed belongs to the company \n @delivery.confirm( current_user ) \n @delivery.reload\n end",
"def franchisee_royalty_pay_slip\n \n end",
"def confirm_post_production_result\n @post_production_result = PostProductionResult.find_by_id params[:post_production_result_id]\n # add some defensive programming.. current user has role admin, and current_user is indeed belongs to the company \n @post_production_result.confirm( current_user ) \n @object = @post_production_result\n @parent = @object.template_sales_item \n end",
"def print_sales_receipt\n puts \"Successfully Booked - Show #{@show_no}\"\n puts \"Subtotal: Rs. #{@seats_price}\"\n puts \"Service Tax @14%: RS. #{@service_tax}\"\n puts \"Swachh Bharat Cess @0.5%: RS. #{@swach_bharath_cess}\"\n puts \"Krishi Kalyan Cess @0.5%: RS. #{@krishi_kalyan_cess}\"\n puts \"Total: Rs. #{$TOTAL_SALES.last.sum}\"\n end",
"def cleanup_successful\n\t\tself.order_status_code_id = 5\n self.new_notes=\"Order completed.\"\n self.product_cost = self.line_items_total\n self.account.clear_personal_information\n self.save\n\tend",
"def end_trial (company, recipient)\n # layout variables\n @title = \"Fin del período de prueba en AgendaPro\"\n @header = \"Aviso de fin del período de prueba. Si ya activaste tu cuenta, por favor ignora este correo.\"\n\n # view variables\n @chile = company.country.name == \"Chile\"\n @company = company\n @admin = @company.users.where(role_id: Role.find_by_name('Administrador General')).first\n sales_tax = company.country.sales_tax\n @plan_amount = company.company_plan_setting.base_price * company.computed_multiplier * (1 + sales_tax)\n\n mail(\n from: filter_sender(),\n reply_to: filter_sender(\"[email protected]\"),\n to: recipient,\n subject: @title,\n template_path: \"mailers/agendapro\"\n )\n end",
"def send_booking_confirmation_notifications\n\n notify_manager_confirmation\n notify_customer\n \n end",
"def recap_loan_confirm\n to = params['emailAddress']\n from = '[email protected]'\n confirm_bcc = APP_CONFIG[:recap_loan][:confirm_bcc]\n recap_subject = 'Offsite Pick-Up Confirmation'\n recap_subject += \" [#{params['titleIdentifier']}]\" if params['titleIdentifier']\n recap_subject += \" (#{Rails.env})\" if Rails.env != 'valet_prod'\n subject = recap_subject\n # Make params available within template by using an instance variable\n @params = params\n mail_params = {to: to, from: from, subject: subject}\n mail_params[:bcc] = confirm_bcc if confirm_bcc\n mail(mail_params)\n end",
"def order_confirmation(buyer)\n @order = Order.last\n @buyer = buyer\n\n mail to: @buyer, subject: \"Order Completed!\", cc: \"[email protected]\"\n end",
"def generate_receipts\n\t\t## and now display this.\n\t\tif self.finalize_order == YES\n\t\t\tself.reports.each do |report|\n\t\t\t\tif report.consider_for_processing?(self.history_tags)\n\t\t\t\t\t## ready for processing.\n\t\t\t\t\tif report.is_outsourced?\n\t\t\t\t\t\t#puts \"report is outsourced.\"\n\t\t\t\t\t\tif bill_direct_to_patient?\n\t\t\t\t\t\t\t#this will be true.\n\t\t\t\t\t\t\t#puts \"we are on bill direct to patient.\"\n\t\t\t\t\t\t\t#will be receipt to patient via organizaiton.\n\t\t\t\t\t\t\treceipt_to_patient(report.currently_held_by_organization,report)\n\t\t\t\t\t\t\t#(from_organization_id,report) \n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t#puts \"we are on double bill\"\n\t\t\t\t\t\t\treceipt_to_patient(self.organization.id.to_s,report)\n\t\t\t\t\t\t\treceipt_to_order_organization(report)\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\t\n\t\t\t\t\t\treceipt_to_patient(self.organization.id.to_s,report)\n\t\t\t\t\t\n\t\t\t\t\t\tunless self.outsourced_by_organization_id.blank?\n\t\t\t\t\t\t\treceipt_to_outsourced_organization(report)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def express\n items = current_order.line_items.map do |item|\n {\n :Name => item.product.name,\n :Quantity => item.quantity,\n :Amount => {\n :currencyID => current_order.currency,\n :value => item.price\n },\n :ItemCategory => \"Physical\"\n }\n end\n\n tax_adjustments = current_order.adjustments.tax\n shipping_adjustments = current_order.adjustments.shipping\n\n current_order.adjustments.eligible.each do |adjustment|\n next if (tax_adjustments + shipping_adjustments).include?(adjustment)\n items << {\n :Name => adjustment.label,\n :Quantity => 1,\n :Amount => {\n :currencyID => current_order.currency,\n :value => adjustment.amount\n }\n }\n end\n\n # Because PayPal doesn't accept $0 items at all.\n # See #10\n # https://cms.paypal.com/uk/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_ECCustomizing\n # \"It can be a positive or negative value but not zero.\"\n items.reject! do |item|\n item[:Amount][:value].zero?\n end\n\n pp_request = provider.build_set_express_checkout({\n :SetExpressCheckoutRequestDetails => {\n :ReturnURL => confirm_paypal_url(:payment_method_id => params[:payment_method_id]),\n :CancelURL => cancel_paypal_url,\n :PaymentDetails => [payment_details(items)]\n }})\n\n current_order.vwo_type = params['return_type'] #return type is being hooked into to pass vwo type\n current_order.save\n\n begin\n pp_response = provider.set_express_checkout(pp_request)\n if pp_response.success?\n redirect_to provider.express_checkout_url(pp_response)\n else\n flash[:error] = \"PayPal failed. #{pp_response.errors.map(&:long_message).join(\" \")}\"\n redirect_to checkout_state_path(:payment)\n end\n rescue SocketError\n flash[:error] = \"Could not connect to PayPal.\"\n redirect_to checkout_state_path(:payment)\n end\n end",
"def distribute_production_result\n return nil if self.is_confirmed == false \n \n ok_quantity = self.ok_quantity\n repairable_quantity = self.repairable_quantity\n broken_quantity = self.broken_quantity \n \n sales_item_subcription = self.sales_item_subcription\n \n if sales_item_subcription.pending_production_sales_items.count == 0 \n raise ActiveRecord::Rollback, \"Call tech support!\" \n return\n end\n \n \n total_pending = sales_item_subcription.pending_production ## aggregate over all shite \n \n sales_item_subcription.pending_production_sales_items.each do |sales_item| \n assigned_ok_quantity = 0\n assigned_repairable_quantity = 0 \n assigned_broken_quantity = 0 \n \n # if there is nothing else to distribute, just break. \n # stop the shit. and move on \n if ok_quantity == 0 and repairable_quantity == 0 and broken_quantity == 0 \n break \n end\n \n if sales_item.pending_production >= ok_quantity and ok_quantity != 0 \n assigned_ok_quantity = ok_quantity \n ok_quantity = 0 \n else\n assigned_ok_quantity = sales_item.pending_production \n ok_quantity = ok_quantity - sales_item.pending_production \n end\n \n # the post production order is assigned only once in the beginning\n if repairable_quantity != 0 \n assigned_repairable_quantity = repairable_quantity\n repairable_quantity = 0 \n end\n \n if broken_quantity != 0 \n assigned_broken_quantity = broken_quantity\n broken_quantity = 0 \n end\n \n ProductionHistory.create_history( sales_item_subcription, self, sales_item , {\n :ok_quantity => assigned_ok_quantity, \n :repairable_quantity => assigned_repairable_quantity, \n :broken_quantity => assigned_broken_quantity \n }) \n end\n end",
"def confirm\n if status == :pending_confirmation and\n not charges.select { |charge| charge.status == :done }.empty?\n transaction do\n self.status = :confirmed\n self.save\n # Assign available stock\n assign_available_stock if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'confirm_booking',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.confirmed_booking)\n end\n send_booking_confirmation_notifications\n else\n p \"Could not confirm booking #{id} #{status}\"\n end\n \n self\n end",
"def confirm_delivery\n if @order.complete!\n # update the owner with the refilled boxes\n owner = @order.owner # e.g. node\n current_quantity = owner.current_quantity # e.g. node current quantity\n owner.update(current_quantity: current_quantity + @order.quantity)\n\n render json: {}, status: :ok\n else\n render json: {errors: @order.errors.messages}, status: :bad_request\n end\n end",
"def confirm!\n return false if purchased?\n confirmed!\n end",
"def bearstor_confirm\n to = params[:patron_email]\n from = \"Barnard Remote Request Service <#{params[:staff_email]}>\"\n title = params[:bib_record].title\n subject = \"BearStor Request Confirmation [#{title}]\"\n mail(to: to, from: from, subject: subject)\n end",
"def confirm\r\n # Change user status to active\r\n update(status: :active)\r\n # Update all pending company_roles to active\r\n company_roles.update_all(status: 1)\r\n NotifyMailer.welcome_mail(self).deliver_later\r\n super\r\n end",
"def quantity_inflation_end_of_promotion\n ord_qty_hash = []\n variant = Spree::Variant.find(params[:variant_id])\n quantity_inflation = variant.quantity_inflations.where(:market_place_id=>params[:market_place_id]).try(:first)\n ord_qty_hash << quantity_inflation.end_of_promotion\n Spree::DataImportMailer::promotion_quantity_inflation_end(ord_qty_hash).deliver\n flash[:notice] = \"Promotion is ended for selected product and all respective marketplaces\"\n redirect_to :back\n end",
"def complete_xaction\n if valid?\n # For new records, certain types of transactions will be automatically set as completed.\n self.completed = true if new_record? && (to.is_account? && (from_id.nil? || from.is_account?))\n\n # If amount changes, we have to update the envelope amount if it's still pending; otherwise update just the account amount.\n if !new_record? && dirty_attributes.keys.include?(Xaction.properties[:amount])\n if completed\n # update the debited account\n diff = amount - Xaction.get(id).amount\n from.update_attributes(:actual_amount => from.actual_amount.to_f + diff)\n else\n # update the envelope amount\n diff = amount - Xaction.get(id).amount\n to.update_attributes(:actual_amount => to.actual_amount.to_f + diff)\n end\n end\n \n # Complete/Pending\n if dirty_attributes.keys.include?(Xaction.properties[:completed])\n # Envelope side\n if to && !to.is_account?\n if new_record? && !completed\n # credit the envelope\n to.update_attributes(:actual_amount => to.actual_amount.to_f + amount.to_f)\n end\n if !new_record?\n if completed\n # debit the envelope\n to.update_attributes(:actual_amount => to.actual_amount.to_f - amount.to_f)\n to.budget.update_attributes(:amount => amount.to_f < from.budget.amount.to_f ? to.budget.amount.to_f - amount.to_f : 0) # If spending, take it out of the current budget too.\n else\n # undo the debit\n to.update_attributes(:actual_amount => to.actual_amount.to_f + amount.to_f)\n to.budget.update_attributes(:amount => amount.to_f < to.budget.amount.to_f ? to.budget.amount.to_f + amount.to_f : 0) # If spending, take it out of the current budget too.\n end\n end\n end\n\n # Debiting from Account\n if from && from.is_account?\n if completed\n # debit the account\n from.update_attributes(:actual_amount => from.actual_amount.to_f - amount.to_f)\n elsif !new_record? && !completed\n # undo the debit\n from.update_attributes(:actual_amount => from.actual_amount.to_f + amount.to_f)\n end\n end\n\n # Crediting to Account\n if to && to.is_account?\n if completed\n # debit the account\n to.update_attributes(:actual_amount => to.actual_amount.to_f + amount.to_f)\n elsif !new_record? && !completed\n # undo the debit\n to.update_attributes(:actual_amount => to.actual_amount.to_f - amount.to_f)\n end\n end\n end\n end\n end",
"def confirmacionordenmesexp\n RemisorOrdenesCompraMailer.confirmacionordenmesexp\n end",
"def new4\n @order = Order.find( :first,\n :conditions => [\"user_id = ? and status = ? and id = ?\", self.current_user.id, \"incomplete\", params[:id]])\n begin\n @order.step = \"step4\"\n @order.status = \"ordered\"\n \n #Set status to confirmed, call show action\n #This is basically what the orignial create would do\n respond_to do |format|\n if @order.update_attributes(params[:order])\n # Remove ordered items from the cart \n @dels = Deliverable.find( :all, :conditions => [\"order_id = ?\", @order.id])\n @cart.cart_items.each do |c|\n @dels.each do |d|\n if c.listing_id == d.listing_id\n c.destroy\n end\n end \n end \n @user = User.find(@order.user_id)\n @seller = Seller.find(@order.seller_id)\n \n #Send confirmation email to buyer\n @deliverables = Deliverable.find(:all, :conditions => [\"order_id = ?\", @order.id])\n @shop = Shop.find(:first, :conditions => [\"seller_id = ?\", @seller.id])\n @seller_user = @seller.user\n logger.info @seller_user.id.to_s\n \n SystemMailer.deliver_ordered(@user, @seller, @order, @deliverables, @shop)\n \n current_language = session[:locale]\n I18n.locale = @seller.user.userpage.preferred_language\n SystemMailer.deliver_sale(@user, @seller_user, @seller, @order, @deliverables, @shop)\n I18n.locale = current_language\n \n \n format.html { redirect_to @order}\n format.xml { render @order }\n else\n flash[:notice_bad] = t(\"controllers.orders.s14\")\n format.html { render :controller => \"carts\", :action => \"show\" }\n end\n end\n rescue\n flash[:notice_bad] = t(\"controllers.orders.s15\")\n redirect_to orders_path\n else\n end\n end",
"def send_confirmation_email\n\t\tRentersConfirmationJob.perform_later self\n OwnersConfirmationJob.perform_later self\n\tend",
"def confirm!\n if status == :pending_confirmation\n transaction do\n update(:status => :confirmed)\n # Assign available stock\n assign_available_stock if SystemConfiguration::Variable.get_value('booking.assignation.automatic_resource_assignation', 'false').to_bool\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'confirm_booking',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.confirmed_booking)\n end\n send_booking_confirmation_notifications\n end\n self\n end",
"def confirm\n order = current_order || raise(ActiveRecord::RecordNotFound)\n order.payments.create!(\n {\n source: Spree::PaypalExpressCheckout.create(\n {\n token: params[:token],\n payer_id: params[:PayerID],\n payment_id: params[:paymentId]\n }\n ),\n amount: sprintf(\"%0.02f\", order.total),\n payment_method: payment_method\n }\n )\n order.next\n if order.complete?\n flash.notice = Spree.t(:order_processed_successfully)\n flash[:order_completed] = true\n session[:order_id] = nil\n redirect_to completion_route(order)\n else\n redirect_to checkout_state_path(order.state)\n end\n end",
"def declaration_repayment\n wizard_step(nil) { { next_step: :declaration_repayment_next_step } }\n end",
"def invoice_confirmation\n # Invoice Confirmation for WebMoney\n render text: WebMoney.invoice_confirmation(params[:LMI_MERCHANT_ID], params[:LMI_PAYMENT_AMOUNT], params[:ORDER_ID])\n end",
"def wholesale_approved(config, customer)\r\n\t\t@subject = \"Your wholesale account with #{config[:application][:name][:value]} is now ready\"\r\n\t\t@recipients = \"#{customer.to_s} <#{customer[:email]}>\"\r\n\t\t@from = \"#{config[:application][:name][:value]} <#{config[:emails][:default][:value]}>\"\r\n\t\t@sent_on = Time.now\r\n\t\t@body['name'] = customer.to_s\r\n\t\t@body['website'] = config[:application][:name][:value]\r\n\t\t@body['password'] = customer.password\r\n\t\t@body['team_name'] = config[:application][:team_name][:value]\r\n\t\t@body['url'] = config[:application][:url][:value]\r\n\tend",
"def subscriber_notice_subscription_paid\n BrandMailer.subscriber_notice(\n brand: Brand.find_by(company_name: 'Brand Nine'),\n stage: 'subscription_paid'\n )\n end",
"def calc_already_paid\n wizard_step(STEPS)\n end",
"def finalize_sales_order_single_package\n @sales_order = SalesOrder.find_by_id params[:sales_order_id]\n @project = @sales_order.projects.first \n @package = @project.package\n @deliverable_items = @project.deliverable_items.order(\"created_at DESC\")\n @new_deliverable_item = DeliverableItem.new \n \n @sales_order.confirm_sales_order( current_user, params[:sales_order] ) \n \n \n if @sales_order.is_confirmed == false \n render :file => \"sales_orders/single_package_sales_order_finalization\"\n else\n redirect_to single_package_sales_order_finalized_url(@sales_order)\n end\n end",
"def invoice\n raise \"override in purchase_order or sales_order\"\n end",
"def confirm_products_order\n unless @current_admin.is_super_admin\n unless @current_admin.privilages.include? '3'\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n end\n @users_sales=Array.new\n @customers_sales=Array.new\n @sales=Sale.where(\"is_delivered='f'\")\n\n @sales.each do |sale|\n if sale.customer\n @customers_sales.push(sale)\n else\n @users_sales.push(sale)\n end\n end\n puts \"user sale count:#{@users_sales.length}\"\n puts \"customer sale count:#{@customers_sales.length}\"\n end",
"def sales_order(record, _params)\n <<-XML\n\n <CustomerRef>\n <FullName>#{record['email']}</FullName>\n </CustomerRef>\n <TxnDate>#{Time.parse(record['placed_on']).to_date}</TxnDate>\n <RefNumber>#{record['id']}</RefNumber>\n <BillAddress>\n <Addr1>#{record['billing_address']['address1']}</Addr1>\n <Addr2>#{record['billing_address']['address2']}</Addr2>\n <City>#{record['billing_address']['city']}</City>\n <State>#{record['billing_address']['state']}</State>\n <PostalCode>#{record['billing_address']['zipcode']}</PostalCode>\n <Country>#{record['billing_address']['country']}</Country>\n </BillAddress>\n <ShipAddress>\n <Addr1>#{record['shipping_address']['address1']}</Addr1>\n <Addr2>#{record['shipping_address']['address2']}</Addr2>\n <City>#{record['shipping_address']['city']}</City>\n <State>#{record['shipping_address']['state']}</State>\n <PostalCode>#{record['shipping_address']['zipcode']}</PostalCode>\n <Country>#{record['shipping_address']['country']}</Country>\n </ShipAddress>\n #{cancel_order?(record)}\n XML\n end",
"def notify_final_delivery\n @reports = Reports.get_all_reports\n @delivery = Packages.get_all_packages\n if( @delivery != nil ) && ( @reports != nil )\n @reports.each do|t|\n @delivery.each do|s|\n if( ( t.reported_id == s.senders_id ) && ( s.finalDelivery == false ) && ( t.packages_id == s.id ) )\n @notification = Notifications.create(s.senders_id, \"You should confirm the final delivery\")\n end\n end\n end\n end\n return;\n end",
"def send_confirmation_instructions; end",
"def order_received(order)\n@order=order\nmail(:to => order.email, :subject => 'Pragmatic Toy Shop Order Confirmation')\nend",
"def subscriber_notice_subscription_renewal\n BrandMailer.subscriber_notice(\n brand: Brand.find_by(company_name: 'Brand Nine'),\n stage: 'subscription_renewal'\n )\n end",
"def commit_orders\r\n orders = @customer.open_orders.find_all_by_synchronized( false )\r\n sales_id = \"\"\r\n orders.each do |o| sales_id += \"'#{o.sales_id}', \" end \r\n @store_user.my_account_log(@customer,\"Commit Sales Order Updates: #{sales_id}\")\r\n\r\n if orders.empty? || ERP::SalesOrder.commit_orders( orders )\r\n flash.now[:message] = \"All changes have been commited.\"\r\n else\r\n flash.now[:message] = \"Operation Failed.\"\r\n end\r\n end",
"def update\n \n #Email and Fax actions, to actually resend the information\n if params[:status] == \"email\"\n if current_user.subscription.can_send_po \n if @purchase_order.status == \"draft\" then @purchase_order.update_attributes!(organize_purchase_order_params(purchase_order_params)) end\n PDFMailer.send_pdf(@purchase_order, @company, current_user).deliver\n @purchase_order.update_attribute(:status, \"open\")\n @purchase_order.write_history(params[:status]) \n flash[:notice] = \"Success, your PO has been sent by Email.\" if @purchase_order.save\n current_user.subscription.update_attribute(:monthly_po_count, current_user.subscription.monthly_po_count + 1)\n respond_with(@purchase_order) \n else\n flash[:notice] = 'You have reached your monthly PO limit. Please purchase more or upgrade to send more POs'\n respond_with(@purchase_order)\n end\n elsif params[:status] == \"fax\"\n if current_user.subscription.can_send_po \n if @purchase_order.status == \"draft\" then @purchase_order.update_attributes!(organize_purchase_order_params(purchase_order_params)) end\n @sent_fax = send_po_fax(@purchase_order)\n @successful_send = @sent_fax[\"success\"]\n if @successful_send\n current_user.subscription.update_attribute(:monthly_po_count, current_user.subscription.monthly_po_count + 1)\n @purchase_order.update_attribute(:status, \"open\")\n @purchase_order.write_history(params[:status])\n flash[:notice] = \"Success, your PO has been sent by Fax.\" if @purchase_order.save \n respond_with(@purchase_order)\n else \n flash[:notice] = @sent_fax[\"message\"]\n respond_with(@purchase_order)\n end\n else\n flash[:notice] = 'You have reached your monthly PO limit. Please purchase more or upgrade to send more POs'\n respond_with(@purchase_order)\n end\n\n #State transitions - Open, Closed, Cancelled, Deleted, Draft, Archived\n\n elsif params[:status] == \"open\"\n if @purchase_order.status == \"draft\" then @purchase_order.update_attributes!(organize_purchase_order_params(purchase_order_params)) end\n @purchase_order.update_attribute(:status, \"open\")\n @purchase_order.write_history(params[:status])\n flash[:notice] = \"Purchase Order was successfully Saved.\" if @purchase_order.save\n respond_with(@purchase_order)\n\n elsif params[:status] == \"save\"\n @purchase_order.update_attributes!(organize_purchase_order_params(purchase_order_params)) \n @purchase_order.save\n flash[:notice] = 'Success, your changes have been Saved.' if @purchase_order.save\n respond_with(@purchase_order)\n\n elsif params[:status] == \"cancel_changes\"\n flash[:notice] = \"Changes have been discarded.\"\n respond_with(@purchase_order)\n\n elsif params[:status] == \"closed\"\n @purchase_order.update_attribute(:status, \"closed\") \n flash[:notice] = \"Purchase Order has been Closed.\" if @purchase_order.save\n @purchase_order.write_history(params[:status])\n respond_with(@purchase_order)\n\n elsif params[:status] == \"cancelled\"\n @purchase_order.update_attribute(:status, \"cancelled\")\n flash[:notice] = \"Purchase Order has been Cancelled\" if @purchase_order.save\n @purchase_order.write_history(params[:status])\n respond_to do |format|\n format.html { redirect_to purchase_orders_path }\n end\n\n # stowaway methods - archive, delete, and undo archive, undo delete\n elsif params[:status] == \"deleted\"\n @purchase_order.update_attribute(:archived, false)\n @purchase_order.update_attribute(:was_deleted, true)\n @purchase_order.update_attribute(:last_deleted_on, DateTime.now)\n @purchase_order.update_attribute(:status, \"deleted\")\n flash[:notice] = \"Purchase Order has been Deleted.\" if @purchase_order.save\n @purchase_order.write_history(params[:status])\n respond_to do |format|\n format.html { redirect_to purchase_orders_path }\n format.json\n end\n elsif params[:status] == \"undelete\"\n @purchase_order.update_attribute(:was_deleted, false)\n @purchase_order.update_attribute(:status, \"cancelled\")\n flash[:notice] = \"Purchase Order has been Un-Deleted.\" if @purchase_order.save\n @purchase_order.write_history(params[:status])\n respond_with(@purchase_order)\n\n elsif params[:status] == \"archive\"\n @purchase_order.update_attribute(:archived, true)\n @purchase_order.update_attribute(:last_archived_on, DateTime.now)\n flash[:notice] = \"Purchase Order has been Archived.\" if @purchase_order.save\n @purchase_order.write_history(params[:status])\n respond_with(@purchase_order)\n\n elsif params[:status] == \"unarchive\"\n @purchase_order.update_attribute(:archived, false)\n flash[:notice] = \"Purchase order has been Un-Archived.\" if @purchase_order.save\n @purchase_order.write_history(params[:status])\n respond_with(@purchase_order)\n\n elsif params[:status] == \"print\"\n respond_with(@purchase_order)\n\n elsif params[:status] == \"duplicate\"\n @purchase_order.write_history(params[:status])\n @po = @company.purchase_orders.new\n @po.status = \"draft\"\n # @po.update_attributes!(description: @purchase_order.read_attribute(:description), vendor: @purchase_order.read_attribute(:vendor), address: @purchase_order.read_attribute(:address), number: generate_po_number, date_required: \"ASAP\", label: @purchase_order.read_attribute(:label))\n new_po_params = organize_purchase_order_params(:vendor => @purchase_order.read_attribute(:vendor), :address => @purchase_order.read_attribute(:address))\n @po.update_attributes!(vendor: new_po_params[:vendor], address: new_po_params[:address], description: @purchase_order.read_attribute(:description), number: generate_po_number, date_required: \"ASAP\", label: @purchase_order.read_attribute(:label))\n @purchase_order = @po\n flash[:notice] = \"Purchase Order Duplicated as New\" if @purchase_order.save\n respond_with(@purchase_order)\n\n elsif params[:status] == \"discard\"\n @purchase_order.destroy\n respond_to do |format|\n format.html { redirect_to purchase_orders_path, notice: 'Purchase order was successfully discarded.' }\n format.json { head :no_content }\n end\n else #NOTE - this is where label updates are handled\n @purchase_order.update(purchase_order_params)\n respond_to do |format|\n format.html { respond_with @purchase_order, notice: 'Label information was successfully updated' }\n format.json { head :no_content }\n end\n end\n end",
"def withdraw exit_date, estimated_return_date, pickup_company, pickup_company_contact, additional_comments, quantity, folio\n \n return self.status if cannot_withdraw?\n\n if quantity != '' and quantity < self.quantity.to_i\n self.quantity = self.quantity.to_i - quantity\n quantity_withdrawn = quantity\n else\n self.status = InventoryItem::OUT_OF_STOCK\n quantity_withdrawn = self.quantity\n self.quantity = 0\n end\n \n if self.save\n inventory_item = InventoryItem.where( 'actable_id = ? AND actable_type = ?', self.id, 'BulkItem' ).first\n if self.warehouse_locations?\n quantity_left = quantity\n if quantity != '' and quantity < ( self.quantity.to_i + quantity_withdrawn.to_i )\n item_location = self.item_locations.where( 'quantity >= ?', quantity ).first\n location = item_location.warehouse_location\n location.remove_quantity( inventory_item.id, quantity )\n elsif quantity != ''\n while quantity_left > 0\n item_location = self.item_locations.first\n location = item_location.warehouse_location\n if quantity_left >= item_location.quantity \n current_location_quantity = item_location.quantity \n location.remove_item( inventory_item.id )\n self.item_locations.delete( item_location )\n location.update_status\n else\n location.remove_quantity( inventory_item.id, quantity_left )\n end\n quantity_left = quantity_left - current_location_quantity\n end\n else\n item_location = self.item_locations.first\n location = item_location.warehouse_location\n location.remove_item( inventory_item.id )\n self.item_locations.delete( item_location )\n location.update_status\n end\n end\n CheckOutTransaction.create( :inventory_item_id => inventory_item.id, :concept => 'Salida granel', :additional_comments => additional_comments, :exit_date => exit_date, :estimated_return_date => estimated_return_date, :pickup_company => pickup_company, :pickup_company_contact => pickup_company_contact, :quantity => quantity_withdrawn, :folio => folio )\n return true\n end\n\n return false\n end",
"def booking_invoice\n NotificationsMailer.with(sports_centre: SportsCentre.first, order: Order.first).booking_invoice\n end",
"def withdraw(exit_date, estimated_return_date, pickup_company, pickup_company_contact, additional_comments, quantity_to_withdraw, folio = '-')\n return status if cannot_withdraw?\n\n if quantity_to_withdraw != '' && quantity_to_withdraw < quantity.to_i\n self.quantity = quantity.to_i - quantity_to_withdraw\n quantity_withdrawn = quantity_to_withdraw\n else\n self.status = InventoryItem::OUT_OF_STOCK\n quantity_withdrawn = quantity\n self.quantity = 0\n end\n\n save\n\n # Withdraw from WarehouseLocations\n withdraw_from_locations(quantity_withdrawn) if warehouse_locations?\n\n CheckOutTransaction.create(\n inventory_item_id: id,\n concept: 'Salida granel',\n additional_comments: additional_comments,\n exit_date: exit_date,\n estimated_return_date: estimated_return_date,\n pickup_company: pickup_company,\n pickup_company_contact: pickup_company_contact,\n quantity: quantity_withdrawn,\n folio: folio\n )\n true\n end",
"def order_receipt(user_name, user_email, order, total_amount)\n @user = user_name\n @order = order\n @total_amount = total_amount\n mail(to: user_email, subject: \"Thank you for your order ##{@order.id}\")\n end",
"def pyment_logic\n\t\t# @notification = ActiveMerchant::Billing::Integrations::Ccavenue::Notification.new(request.raw_post)\n\t\t# if @notification.payment_id.present?\n\t\t# \t@order = Course.find_by_order_id(@notification.payment_id)\n\t\t# \tif @notification.complete? and @notification.valid?\n\t\t# \t\[email protected]!\n\t\t# \telse\n\t\t# \t @order.reject!\n\t\t# \tend\n\t\t# end\n\tend",
"def order_confirmation (user, cart, product, customer, pickup)\n @user = user\n @cart = cart\n @product = product\n @customer = customer\n @pickup = pickup\n\n mail to: user.email, subject: \"A new order has been placed\"\n end",
"def email_confirm\n end",
"def confirm_course_payment\n\n\n tx_id = 123456789 # default tax_id we need to changes after latter\n @course = Course.find(params[:id])\n\n @price_detail = CoursePricing.find_by_course_id(@course.id)\n if @price_detail!=nil\n @price =@price_detail.price\n else\n @price=0.0\n end\n @discount=session[:coupon_price].to_f\n @subtotal=@price - @discount\n @tax = Course.tax_calculation(@course,@subtotal)\n @user = current_user\n if session[:payment_completed] ==nil\n if params[:coupon_code].present?\n @coupon = Coupon.find_coupon(params[:coupon_code], user_id = current_user.id, [email protected])\n Coupon.redeem(params[:coupon_code], @user.id, tx_id, @coupon.metadata)\n end\n\n enroll_student(@course, current_user)\n invoice = invoices_data(@course, params)\n invoice_generate_pdf(@course, params)\t\t\t\n session[:payment_completed]=true\n end\n end",
"def notify_final_delivery\n @reports = Reports.find( :all )\n @delivery = Packages.find( :all )\n if( @delivery != nil ) && ( @reports != nil )\n @reports.each do|t|\n @delivery.each do|s|\n if( ( t.reported_id == s.senders_id ) && ( s.finalDelivery == false ) && ( t.packages_id == s.id ) )\n @notification = Notifications.new\n @notification.users_id = s.senders_id\n @notification.description = \"You should confirm the delivery of the package\"\n @notification.save\n end\n end\n end\n end\n return;\n end",
"def sales_invoice?\n false\n end",
"def sales_invoice?\n false\n end",
"def deliver_confirmation_email_instructions!\n # TODO\n end",
"def confirm_post_production_history\n @post_production_history = PostProductionHistory.find_by_id params[:post_production_history_id]\n # add some defensive programming.. current user has role admin, and current_user is indeed belongs to the company \n @post_production_history.confirm( current_user ) \n @object = @post_production_history\n @parent = @object.sales_item \n end",
"def repayment_notification(user)\n @user = user\n\n mail to: user.email, subject: \"Scholarship Confirmation\"\n end",
"def confirm_for_fulfillment\n\n\t\t\tresult = PrintfulAPI.request( :POST, \"/orders/#{self.id}/confirm\", {} )\n\n\t\t\tself.load_data( result )\n\n\t\t\treturn true\n\n\t\tend",
"def nonprofit\n end",
"def confirm_sale\n @booking = Booking.find(params[:id])\n @booking.status = \"Ticket receivd\"\n @booking.save\n redirect_to bookings_path\n end",
"def notify_finalpayment\n @pack = Packages.find( :all, :conditions => {:finalDelivery => true} )\n @pay = Payment.find( :all )\n if( @pack != nil ) && ( @pay != nil )\n @pack.each do |t|\n @pay.each do |s|\n if( t.id == s.packages_id ) && ( t.carriers_id = s.users_id )\n @notification = Notifications.new\n @notification.users_id = t.carriers_id\n @notification.description = \"an amout has been added to your account and another amount has been deducted\"\n @notification.save\n end\n end\n end\n end\n return;\n end",
"def book_request_decline_confirm\n booking_staff = BookingStaff.find_by_confirm_token(params[:id])\n\n if booking_staff\n staff_id = booking_staff.id\n declined_status = STATUS_DECLINED\n\n if self.book_request_response(staff_id, declined_status)\n booking_staff.send_email_booking_declined\n booking_staff.update(:confirm_token => nil)\n render 'request_decline_confirm'\n return\n end\n end\n\n # NOTE - IF FOR WHATEVER REASON GETTING THE BookingStaff MODEL FAILS\n # WE SHOULD TELL THE USER TO TRY AGAIN ?\n end",
"def notify_finalpayment\n @pack = Packages.get_packages_final_payment\n @pay = Payment.get_all_payments\n if( @pack != nil ) && ( @pay != nil )\n @pack.each do |t|\n @pay.each do |s|\n if( t.id == s.packages_id ) && ( t.carriers_id = s.users_id )\n @notification = Notifications.create(t.carriers_id, \"as a carrier an amount has been added to your account and another amount has been deducted\")\n end\n end\n end\n end\n return;\n end",
"def make_the_payment_paypal\n #here i need to refresh the order because the total entry field is changed\n order=CompetitionsUser.find(session[:order].id)\n if order and order.invoices.last\n @invoice = order.generate_invoice_extra_entry(@current_user,{\"payment_medium\"=>\"paypal\"} )\n else\n @invoice = order.generate_invoice(@current_user, {\"payment_medium\"=>\"paypal\"}) \n end \t\n @invoice.validating(\"paypal\")\n session[:current_object].invoice = @invoice\n session[:current_object].save\n p session[:userid]\n if session[:userid].blank?\n invoice = Invoice.find(:last,:conditions=>[\"client_id = ? and purchasable_id = ?\",@current_user.id,order.id])\n \n else\n invoice = Invoice.find(:last,:conditions=>[\"client_id = ? and purchasable_id = ?\",session[:userid],order.id])\n \n end\n \n if order.instance_of? CompetitionsUser\n note = \"no note created\"\n note = order.competition.timing.note if order.competition.timing \n \n start_date = order.competition.timing.starting_date.strftime(\"%d %b %Y\")\n end_date = order.competition.timing.ending_date.strftime(\"%d %b %Y\")\n p \"the invoice is blank\"\n p invoice\n if invoice \n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,order.competition.title,invoice.final_amount.to_i,note,\"\",invoice.final_amount.to_i,false,end_date)\n else\n p \"i dont have invoice created\"\n end\n elsif order.instance_of? ExhibitionsUser\n note = \"no note created\"\n note = order.exhibition.timing.note if order.exhibition.timing \n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,order.exhibition.title,invoice.final_amount.to_i,note)\n end\n #QueuedMail.add('UserMailer', 'send_invoice',[@invoice,@current_user], 0, send_now=true)\t\n #QueuedMail.create(:mailer => 'UserMailer', :mailer_method => 'send_invoice',:args => [@current_user.profile.email_address,\"invoice#{invoice.id}\",\"An Invoice Is Send To Your Email For Your Payment\"],:priority => 0,:tomail=>@current_user.profile.email_address,:frommail=>\"[email protected]\")\n begin\n email= UserMailer.create_send_invoice(invoice,@current_user)\n UserMailer.deliver(email)\n rescue => e\n logger.info \"there is error while sending the email\"\n logger.info e\n end\n end"
] | [
"0.6186503",
"0.61625737",
"0.6122685",
"0.59879845",
"0.5955981",
"0.5955405",
"0.5941831",
"0.59390265",
"0.5933362",
"0.583504",
"0.5790174",
"0.5776659",
"0.5765615",
"0.5760621",
"0.57591045",
"0.57415",
"0.5684254",
"0.5667012",
"0.56591976",
"0.56505203",
"0.56490207",
"0.56472635",
"0.5645199",
"0.5638194",
"0.563745",
"0.5637311",
"0.56163406",
"0.56123435",
"0.5608691",
"0.560346",
"0.5602588",
"0.55966866",
"0.55943453",
"0.55733037",
"0.5571059",
"0.5571051",
"0.5571051",
"0.5563774",
"0.5550789",
"0.5538791",
"0.5534186",
"0.55289334",
"0.5526295",
"0.55230206",
"0.5501668",
"0.54951274",
"0.54881716",
"0.54586464",
"0.5454278",
"0.544021",
"0.5424369",
"0.54218566",
"0.54196614",
"0.54176086",
"0.5411164",
"0.54099053",
"0.5408238",
"0.5407738",
"0.54034996",
"0.54028016",
"0.5401919",
"0.5401484",
"0.5399091",
"0.53957677",
"0.53934836",
"0.5385879",
"0.53762895",
"0.53719145",
"0.53718346",
"0.53708535",
"0.5370556",
"0.53693247",
"0.53670645",
"0.5366218",
"0.5365923",
"0.5353023",
"0.5348192",
"0.53466916",
"0.53455985",
"0.5342962",
"0.53418314",
"0.5338144",
"0.5331324",
"0.53296417",
"0.5328458",
"0.53213924",
"0.5316813",
"0.5313542",
"0.53011435",
"0.53011435",
"0.52993625",
"0.52956814",
"0.52950794",
"0.52881813",
"0.5285624",
"0.5285313",
"0.52830875",
"0.5281268",
"0.52756786",
"0.52699554"
] | 0.5717416 | 16 |
Returns an ASCII or hashed filename that do not exists yet in the given subdirectory | def disk_filename(filename, directory=nil)
timestamp = DateTime.now.strftime("%y%m%d%H%M%S")
ascii = ''
if %r{^[a-zA-Z0-9_\.\-]*$}.match?(filename) && filename.length <= 50
ascii = filename
else
ascii = Digest::MD5.hexdigest(filename)
# keep the extension if any
ascii << $1 if filename =~ %r{(\.[a-zA-Z0-9]+)$}
end
directory = directory.to_s
result =
loop do
s3obj = RedmicaS3::Connection.object(File.join(directory, "#{timestamp}_#{ascii}"))
if s3obj.exists?
timestamp.succ!
else
# Avoid race condition: Create an empty S3 object
s3obj.put
break File.basename(s3obj.key)
end
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_free_name filename\n base_filename = filename ||= @filename\n\n number = 1\n\n while File.exist? filename do\n filename = \"#{base_filename}.#{number}\"\n number += 1\n end\n\n filename\n end",
"def get_unique_file_name fname\n 100.times do |i|\n suffix = \"%03d\" % i\n extn = File.extname(fname)\n base = File.basename(fname, extn)\n # f = fname + '.' + suffix\n f = base + suffix + extn\n return f unless File.exist?(f)\n end\n\n timestamp = Time.now.strftime('%Y%m%d-%H%M%S')\n return fname + '.' + timestamp\nend",
"def generate_basename(chunk)\n salt = nil\n while true\n filename = Digest::MD5.hexdigest(\"#{chunk.range_start}#{salt}\") + CHUNK_EXT\n return filename unless chunks_by_basename[filename]\n salt = (salt||0) + 1\n end\n end",
"def get_filename(key)\n\thash = hash(key)\n\n\tif File.exist?(File.join(@cache_dir, hash))\n\t return File.join(@cache_dir, hash)\n\telse\n\t return nil\n\tend\n end",
"def maildir_getfilename dir\n time=Time.now.to_f\n counter=0\n hostname=Socket::gethostname\n filename=nil\n loop do\n filename=File.join(dir,sprintf(\"%.4f.%d_%d.%s\",\n time,$$,counter,hostname))\n break if not File.exist?(filename)\n counter+=1\n end\n return filename\n end",
"def filename\n Dir[glob].first if exists?\n end",
"def versioned_filename(base, first_suffix='.00')\n suffix = nil\n filename = base\n while File.exists?(filename)\n suffix = (suffix ? suffix.succ : first_suffix)\n filename = base + suffix\n end\n return filename\n end",
"def basename_without_ext; end",
"def unique_file_name file_name\n count = 0\n name = file_name\n current_user = User.find(self.user_id)\n while Userfile.find_all_accessible_by_user(current_user).exists?(:name => name)\n count += 1\n extname = File.extname(name)\n name = \"#{File.basename(name,extname)}-#{count}#{extname}\"\n end\n return name\n end",
"def find_path_with_base(f)\n Dir.glob(f + \"*\").first || \"\" # don't return nil; makes for bad spec error messages\nend",
"def find_free_name(filename); end",
"def unique_path\n unique_name.split(\"/\") rescue [unique_name]\n end",
"def find_filename(name)\n return name if not File.exists?(name)\n\n new_name = name\n count = 0\n until not File.exists?(new_name)\n count += 1\n new_name = \"#{name}_#{count}\"\n end\n\n new_name\n end",
"def unique_dir\n taken_ints = taken_paths.map { |path| path.basename.to_s.to_i }\n (taken_ints.count > 0) ? (taken_ints.max + 1).to_s : 1.to_s\n end",
"def directory_name\n return @directory_name.to_s if @directory_name\n return local_path.basename.to_s if exist?\n return name\n end",
"def directory_basename\n File.basename(@directory)\n end",
"def get_correct_name(file_name, user_address)\n ext = File.extname(file_name) # get file extension\n base_name = File.basename(file_name, ext) # get file name without extension\n name = base_name + ext.downcase # get full file name\n index = 1\n\n while File.exist?(storage_path(name, user_address)) # if the file with such a name already exists in this directory\n name = base_name + ' (' + index.to_s + ')' + ext.downcase # add an index after its base name\n index = index + 1\n end\n\n name\n end",
"def filename\n [Digest::SHA1.hexdigest(file.read),file.extension].join('.') if original_filename\n end",
"def rootname filename\n if (last_dot_idx = filename.rindex '.')\n (filename.index '/', last_dot_idx) ? filename : (filename.slice 0, last_dot_idx)\n else\n filename\n end\n end",
"def find_existing(path)\n until File.directory?(path)\n path = File.dirname(path)\n end\n path\n end",
"def subdir_and_filename_for(entry)\n Pathname.new(entry).split\n end",
"def build_verification_dir(root_dir, dirname, uuid)\n return unless root_dir\n \"/#{root_dir}/#{dirname}-#{uuid}/#{dirname}\"\nend",
"def directoryname\n new_parts = @parts[0..-2]\n new_parts[0] = absolute_prefix + new_parts[0]\n FilePath.new(*new_parts).to_s\n end",
"def base(filename)\n filename.sub(/\\.[^.]*$/, '')\nend",
"def dirname\n (uid.path.split(\".\") << \"#{timestamp}-#{random}\").join(\"/\")\n end",
"def dirHash(directory, regexp)\n directory = Pathname.new(directory)\n contents = \"\"\n Dir.foreach(directory) {\n | entry |\n if entry =~ regexp\n contents += IO::read(directory + entry)\n end\n }\n return Digest::SHA1.hexdigest(contents)\nend",
"def extract_filename(full_path = T.unsafe(nil)); end",
"def check_file(filename,patchdir)\n if !filename.match(/\\//)\n patch_list = Dir.entries(patchdir)\n filename = patch_list.grep(/#{filename}/)[0].chomp\n filename = patchdir+\"/\"+filename\n end\n if !File.exist?(filename)\n puts \"File: \"+filename+\" does not exist\"\n exit\n else\n puts \"File: \"+filename\n end\n return filename\nend",
"def sha1\n RunLoop::Directory.directory_digest(path)\n end",
"def no_clobber(name)\n return name unless File.exists?(name)\n (1..255).each { |v| n = name.sub(/\\.jpg$/,\".#{v}.jpg\"); return n unless File.exists?(n) }\nend",
"def filename\n tmp_path = self.path\n if self.partial\n tmp_path.gsub(/([^\\/]+)\\z/, '_\\1')\n else\n tmp_path\n end\n end",
"def get_file_name_without_ext(full_name)\n return File.basename(full_name, File.extname(full_name))\n rescue Exception => exc\n puts exc\n return full_name\n end",
"def test_fallback_exists\n File.unstub :exist?\n tested 'fallback rms.jpg'\n\n files = Dir.glob(temp_dir('generated') + '/rms-35-?????????.webp')\n\n assert_equal 1, files.length\n end",
"def getfilename()\n current_time = Time.new.strftime(\"%Y-%m-%d\")\n \n # Create filename\n filename = current_time + \"_sprint_update_CS.html\"\n\n # Create folder with all file of sprint update\n foldername = \"History\"\n Dir.mkdir(foldername) unless File.exists?(foldername)\n\n return File.join(\".\", foldername, filename)\nend",
"def file_name_with_path\n root_path.dup + file_name\n end",
"def strict_file_exists?(path)\n directory = `dirname #{path}`.chomp\n name = `basename #{path}`.chomp\n !`find \"#{directory}\" -name \"#{name}\"`.empty?\n end",
"def find_filename_for_todo(id)\n for filename in Dir.entries(TODOS_DIRECTORY)\n if filename.start_with?(id)\n return filename\n end\n end\nend",
"def get_filename(text)\n if text =~ /[^\\w\\.\\-_]/\n Digest::SHA256.hexdigest(text)\n else\n text\n end\nend",
"def basename(suffix = T.unsafe(nil)); end",
"def find_available_name(path)\n return path unless bucket.objects[path].exists?\n ext = File.extname(path)\n base = path[0..-ext.size-1] + \"-1\"\n loop do\n path = base + ext\n return path unless bucket.objects[path].exists?\n base = base.next\n end\n end",
"def test_file_path(name)\n path = Rails.root + \"spec/files/#{name}\"\n raise \"non-existant sample file (#{name})\" unless File.exists?(path)\n path\nend",
"def collisionless_filename source, extension\n base_name = \"#{source}_scrape_#{Date.today.strftime('%Y-%m-%d')}.#{extension}\"\n unused_filename = base_name\n n = 1\n while File.file?(unused_filename) do\n unused_filename = \"#{base_name}_v#{n}.#{extension}\"\n n += 1\n end\n unused_filename\n end",
"def sanitized_path(base_directory, questionable_path); end",
"def sanitized_path(base_directory, questionable_path); end",
"def sanitized_path(base_directory, questionable_path); end",
"def sanitized_path(base_directory, questionable_path); end",
"def sanitized_path(base_directory, questionable_path); end",
"def sanitized_path(base_directory, questionable_path); end",
"def test_subdirectory_name\n tested('somedir/img.jpg')\n tested[:digest] = 'abc123'\n tested.write\n\n assert_path_exists temp_dir('somedir/img.jpg.json')\n end",
"def digest_dirname(file_path)\n slash_path(File.dirname(file_path)).sub(slash_path(source.path), \"\")\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 filename\n \"#{secure_token(10)}.#{file.extension}\" if original_filename.present?\n end",
"def filename_path(dir, filename)\n # we need to check .yaml, .yml, and .json versions\n filename = filename.to_s.sub(/\\.[^.]*$/, '')\n base = @options[:root] + @options[dir]\n %w[.yaml .yml .json .rb].map { |ext| base + (filename + ext) }.detect(&:exist?)\n end",
"def path_for(filename)\n return nil unless filename\n for dir in @dirs\n result = path_from_dir_for(dir,filename)\n return result if result\n end\n @logger.fatal(\"Failed to locate '#{filename}'\")\n return nil\n end",
"def fit_to_filesystem(candidate)\n return candidate if candidate.bytesize <= MIN_PATH_MAX\n ext = File.extname(candidate)\n base = File.basename(candidate, ext)\n tmp = Dir.tmpdir\n loop do\n begin\n candidate = base + ext\n try_file = File.join(tmp, candidate)\n FileUtils.touch try_file\n FileUtils.rm try_file\n return candidate\n rescue Errno::ENAMETOOLONG\n if base.length > 0\n base.chop!\n retry\n else\n raise\n end\n end\n end\n end",
"def basename_of(filename)\n filename.sub(/(\\.[a-z]+)*$/, '')\n end",
"def get_filename\n File.basename(url)[/(?:(?!\\?|#).)*/] || File.basename(url)\n end",
"def filename\n \"#{secure_token}.#{file.extension}\" if original_filename.present? \n end",
"def generate_uniq_filename_from(data)\n if data.respond_to?(:path)\n Digest::MD5.hexdigest(data.path)\n elsif data.respond_to?(:read)\n chunk = data.read(1024)\n data.rewind\n Digest::MD5.hexdigest(chunk)\n else\n Digest::MD5.hexdigest(data)\n end\n end",
"def generate_uniq_filename_from(data)\n if data.respond_to?(:path)\n Digest::MD5.hexdigest(data.path)\n elsif data.respond_to?(:read)\n chunk = data.read(1024)\n data.rewind\n Digest::MD5.hexdigest(chunk)\n else\n Digest::MD5.hexdigest(data)\n end\n end",
"def file_name_from_path(path)\n path.split(\"/\")[-1]\n end",
"def filename_without_extension\n filename.include?('.') ? filename.split('.')[0..-2].join('.') : filename\n end",
"def get_corresponding_file_base_name\n return File.basename(@URL)\n end",
"def file_name(dir: T.unsafe(nil), name: T.unsafe(nil), ext: T.unsafe(nil), directory_separator: T.unsafe(nil)); end",
"def tmp_filepath(filepath)\n # Note : This a md5 hash of the file in the same directory\n filepath = File.expand_path(filepath)\n extname = File.extname(filepath)\n dirname = File.dirname(filepath)\n md5 = Digest::MD5.hexdigest(filepath)\n File.join(dirname, '__html2pdf_tmp__' + md5 + extname)\n end",
"def file_name\n prefix = 'broken-links-in-'\n timestamp = Time.now.strftime('_%m-%d_%H-%M-%S')\n prefix + current_branch + timestamp\n end",
"def sha1_hash_directory_tree(directory, prefix='', hash={})\n Dir.entries(directory).each do |file|\n next if file =~ /^\\./\n pathname = File.join(directory,file)\n if File.directory?(pathname)\n sha1_hash_directory_tree(pathname, File.join(prefix,file), hash)\n else\n hash[File.join(prefix,file)] = Digest::SHA1.hexdigest(File.read(pathname))\n end\n end\n \n hash\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 filename_base\n return '_'+basename if is_type_partial?\n basename\n end",
"def file_name(at_path = nil)\n at_path ||= @full_path\n File.basename at_path, '.*'\n end",
"def file_name(at_path = nil)\n at_path ||= @full_path\n File.basename at_path, '.*'\n end",
"def digest_path\n logical_path.sub(/\\.(\\w+)$/) { |ext| \"-#{digest}#{ext}\" }\n end",
"def base_name\n File.basename(file_name)\n end",
"def temp_filename(basename, tmpdir='/tmp')\r\n n = 0\r\n begin\r\n tmpname = File.join(tmpdir, sprintf('%s%d.%d', basename, $$, n))\r\n lock = tmpname + '.lock'\r\n n += 1\r\n end while File.exist?(tmpname)\r\n tmpname\r\n end",
"def path_for_url(dir, subdir, url)\n path = url.gsub(/^[|[:alpha:]]+:\\/\\//, '')\n path.gsub!(/^[.\\/]+/, '')\n path.gsub!(/[^-_.\\/[:alnum:]]/, '_')\n File.join(dir, subdir, path)\n end",
"def file_exists?(filename, ref)\n return (not `cd #{@path}; git ls-tree #{ref} -- #{filename}`.chomp.strip.empty?)\n end",
"def safe_filepath\n filename.gsub!(/[\\?<>\\\\:\\*\\|\":]/, '_')\n full_path = File.join(root_path, filename)\n if(File.exists? full_path) && file_inside_root?(full_path)\n return full_path\n else\n raise 'Disallowed file requested'\n end\n end",
"def scrubbed_html_file_name\n self.mydirectory + \"scrubbed.html\"\n end",
"def basename(fn)\n split_filename(fn).last\n end",
"def filename\n @name ||= ActiveSupport::SecureRandom.hex\n\t\"#{@name}#{File.extname(original_filename).downcase}\" if original_filename\n end",
"def url_safe_name\n name == '/' ? \"root-dir--#{file_type}\" : \"#{name}--#{file_type}\"\n end",
"def filename\n \"#{Digest::SHA1.file(file.file).hexdigest}.png\" if original_filename\n end",
"def valid_new_filename(file)\n new_file = file\n counter = 0\n while File.exist?(new_file) do\n counter += 1\n ext = File.extname(file)\n basename = file.split(ext).first\n new_file = \"#{basename}_#{counter}#{ext}\"\n end\n new_file\n end",
"def canonical_file\n root + FILENAME\n end",
"def find_partial_name(file_path)\n return name = file_path.split('/').last.to_sym;\n end",
"def basename(fn)\n split_filename(fn).last\n end",
"def path_from_dir_for(dir,filename)\n # Can we do this the easy way?\n file = File.join(dir,filename)\n return file if File.exist?(file)\n \n # Didn't think so\n if File.exist?(dir)\n allFiles = Dir.entries(dir)\n foundDirs = allFiles.select { |f| \n fullPath = File.join(dir,f)\n File.exist?(fullPath) &&\n File.directory?(fullPath) &&\n f != '.' && f != '..' }\n foundDirs.each do | subdir |\n subdir_path = File.join(dir,subdir)\n result = path_from_dir_for( subdir_path, filename)\n return result if result\n end\n end\n return nil\n end",
"def extract_basename(input)\n input.to_s.gsub(/^.*\\/([^\\/\\?]+).*$/, '\\1')\n end",
"def tempdir_name\n dir = File.join(Dir.tmpdir, SecureRandom.uuid)\n refute(Dir.exists?(dir))\n dir\n end",
"def file_name\n @file_name ||= File.basename tree\n end",
"def directory_cache(digest)\n location = Global.directory_package_cache_directory + digest\n return location.exist? ? location : nil\n end",
"def image_fs_path(issue, basename)\n debugger\n dir_path = Rails.root.join('public', \"photos/#{@issue.date.strftime('%m-%d-%y')}\")\n if not File.exists?(dir_path)\n FileUtils.mkdir_p(dir_path)\n end\n \"#{dir_path}/#{basename}\"\nend",
"def base_part_of(file_name)\n name = File.basename(file_name)\n name.gsub(/[^\\w._-]/, '')\n end",
"def base_part_of(file_name)\n name = File.basename(file_name)\n name.gsub(/[^\\w._-]/, '')\n end",
"def dir_entry_exists(path)\n files = session.fs.dir.entries(path)\n rescue\n return nil\n else\n return path\n end",
"def filename\n DateTime.now.strftime('%Q') + Digest::MD5.hexdigest(original_filename) + original_filename if original_filename\n end",
"def short_filename\n return $1 if @filename =~ %r{.*/(.*/[^/]+)$}\n return @filename\n end",
"def short_filename\n return $1 if @filename =~ %r{.*/(.*/[^/]+)$}\n return @filename\n end",
"def 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 generate_filename(script)\n (Zlib::Inflate.inflate(script[2]) != '' ? \"#{fix_name(script[1])}.rb\" : 'EMPTY')\nend"
] | [
"0.6211263",
"0.61882174",
"0.6068681",
"0.6015111",
"0.5866165",
"0.5837125",
"0.5821857",
"0.58096826",
"0.57766235",
"0.57672167",
"0.57667696",
"0.5764727",
"0.5760986",
"0.5745331",
"0.57257015",
"0.5723154",
"0.57134527",
"0.57032204",
"0.568573",
"0.568529",
"0.56697094",
"0.5652404",
"0.5649687",
"0.55984366",
"0.5585844",
"0.55691487",
"0.5567238",
"0.5552327",
"0.5548978",
"0.5537517",
"0.5518507",
"0.5518163",
"0.5514859",
"0.5509066",
"0.5508733",
"0.5487893",
"0.54863244",
"0.54778165",
"0.5473985",
"0.5469578",
"0.5444899",
"0.54248536",
"0.5420417",
"0.5420417",
"0.5420417",
"0.5420417",
"0.5420417",
"0.5420417",
"0.53993666",
"0.53929424",
"0.5388978",
"0.53855926",
"0.53737074",
"0.53726494",
"0.5359374",
"0.53541005",
"0.5353959",
"0.5346727",
"0.5337323",
"0.5337323",
"0.53272676",
"0.5321278",
"0.53204894",
"0.53145653",
"0.53089327",
"0.53030944",
"0.5302705",
"0.53001624",
"0.5300123",
"0.5297457",
"0.5297457",
"0.528696",
"0.528576",
"0.528241",
"0.5273678",
"0.52692276",
"0.52652687",
"0.52547246",
"0.52539605",
"0.5252258",
"0.52520293",
"0.52510595",
"0.52505594",
"0.5233795",
"0.52271813",
"0.52250916",
"0.5223671",
"0.5222509",
"0.5221433",
"0.5218293",
"0.5212324",
"0.52106154",
"0.52073526",
"0.52073526",
"0.52000916",
"0.5198276",
"0.51934975",
"0.51934975",
"0.5190649",
"0.5187649"
] | 0.530597 | 65 |
Copies the temporary file to its final location and computes its MD5 hash | def files_to_final_location
if @temp_file
self.disk_directory = target_directory
self.disk_filename = Attachment.disk_filename(filename, disk_directory)
logger.info("Saving attachment '#{self.diskfile}' (#{@temp_file.size} bytes)") if logger
sha = Digest::SHA256.new
if @temp_file.respond_to?(:read)
buffer = ""
while (buffer = @temp_file.read(8192))
sha.update(buffer)
end
else
sha.update(@temp_file)
end
self.digest = sha.hexdigest
end
if content_type.blank? && filename.present?
self.content_type = Redmine::MimeType.of(filename)
end
# Don't save the content type if it's longer than the authorized length
if self.content_type && self.content_type.length > 255
self.content_type = nil
end
if @temp_file
raw_data =
if @temp_file.respond_to?(:read)
@temp_file.rewind
@temp_file.read
else
@temp_file
end
RedmicaS3::Connection.put(self.diskfile, self.filename, raw_data,
(self.content_type || 'application/octet-stream'),
{digest: self.digest}
)
end
ensure
@temp_file = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n Digest::MD5.hexdigest(abs_filepath)[0..5]\n end",
"def md5; Digest::MD5.file(fname).hexdigest; end",
"def create_md5(file, new_file)\n stdout = `md5 -q \"#{file}\" > \"#{new_file}.tif.md5\"`\n puts stdout\nend",
"def file_md5\n Digest::MD5.file(self).hexdigest\n end",
"def digest\n Digest::MD5.file(file).hexdigest\n end",
"def get_file_hash(fullPath)\n contents = File.read(fullPath)\n fileHash = Digest::MD5.hexdigest(contents)\n return fileHash\nend",
"def md5sum_file(file)\n return `md5sum #{file}`\n end",
"def get_md5(fname)\n Digest::MD5.hexdigest(File.read(fname))\nend",
"def md5\n Digest::MD5.file(@path).to_s\n end",
"def destination_shasum\n @destination_shasum ||= digest_directory(source_path, :sha256, source_options)\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 fetch_md5\n # Create a hash digest for the current file.\n digest = Digest::MD5.new\n File.open(@path, 'r') do |handle|\n while buffer = handle.read(1024)\n digest << buffer\n end\n end\n digest\n end",
"def get_md5sum(file)\n get_sum(file, 'md5')\n end",
"def md5file(file, task_ext, task_dep)\n task :this_task do\n if File.exists?(\"#{file}.tmp\")\n old_sum = File.read(\"#{file}.tmp\").chomp\n else\n old_sum = \"\"\n end\n new_sum = `md5sum #{file}`.chomp\n if old_sum != new_sum\n Rake::Task[task_dep].invoke\n File.open(\"#{file}.tmp\", \"w\") {|f| f.write(new_sum)}\n end\n end\n task task_ext => :this_task \nend",
"def digest\n assert_file!\n Digest::SHA256.hexdigest(@name + Digest::SHA256.file(@path).to_s)\n end",
"def regenerate_hash\n path = tempfile_path\n unless File.exist?(path)\n path = file_path\n end\n\n unless File.exist?(path)\n errors.add(:file, \"not found\")\n return false\n end\n\n hashes = Moebooru::Hasher.compute(path, [:crc32, :md5])\n\n self.md5 = hashes[:md5]\n self.crc32 = hashes[:crc32]\n end",
"def cached_gemfile_md5_path\n File.join(tmp_path, 'git_copy_bundle_gemfile_lock.md5')\n end",
"def writeMD5sum\n base = @basename.sub( /(.)\\.[^.]+$/ , '\\1')\n base += '.md5'\n File.open( File.join(@dirname,base) ,\"w\") { |f| \n f.printf(\"%s %s\\n\", File.join(@dirname,@basename), audioMD5sum ) # computes it if nil\n }\n @audioMD5sum\n end",
"def hash\r\n # TODO what if file is empty?\r\n @hash ||= Digest::SHA1.file(File.join(@directory, @filename)).hexdigest\r\n end",
"def checksum\n digest = @digest_klass.new\n buf = ''\n\n File.open(@path, \"rb\") do |f|\n while !f.eof\n begin\n f.readpartial(BUFFER_SIZE, buf)\n digest.update(buf)\n rescue EOFError\n # Although we check for EOF earlier, this seems to happen\n # sometimes anyways [GH-2716].\n break\n end\n end\n end\n\n digest.hexdigest\n end",
"def md5\n @md5 ||= digest(path, :md5)\n end",
"def digestmd5(file2md5)\n if not ::File.exists?(file2md5)\n raise \"File #{file2md5} does not exists!\"\n else\n require 'digest/md5'\n chksum = nil\n chksum = Digest::MD5.hexdigest(::File.open(file2md5, 'rb') { |f| f.read })\n return chksum\n end\n end",
"def save_checksum(username, target, checksum_path, destination)\n checksum = Digest::MD5.file(target).to_s\n\n temp_dir = File.join(File.dirname(target), File.dirname(checksum_path))\n temp_path = File.join(File.dirname(target), checksum_path)\n\n FileUtils.mkdir_p(temp_dir)\n FileUtils.chmod_R(0771, temp_dir) # need +x to others for File.exists? => true\n File.open(temp_path, \"w\") { |f| f.write(checksum) }\n\n change_owner(username, username, temp_dir)\n %x(sudo mv #{temp_dir} #{destination})\n rescue Exception => e\n STDERR.puts \"Failed to save checksum for #{username} profile\"\n STDERR.puts \"#{e.class.name}: #{e.message} - #{e.backtrace.first}\"\n Log.error(\"#{e.class.name}: #{e.message} - #{e.backtrace.first}\")\n end",
"def files_to_final_location\n if @temp_file && (@temp_file.size > 0)\n logger.info(\"Saving attachment '#{self.filename}' (#{@temp_file.size} bytes) to database\")\n md5 = Digest::MD5.new\n buffer = \"\"\n self.data = \"\"\n while (buffer = @temp_file.read(8192))\n md5.update(buffer)\n self.data << buffer\n end\n self.digest = md5.hexdigest\n end\n @temp_file = nil\n # Don't save the content type if it's longer than the authorized length\n if self.content_type && self.content_type.length > 255\n self.content_type = nil\n end\n end",
"def digest_file( x)\n path = requested_file( x[:request] )\n if File.exist?(path) && !File.directory?(path)\n Digest::MD5.hexdigest(File.read(path))\n else\n nil\n end\n end",
"def validate_image_md5sum\n result = true\n if upload_md5sum.present? && save_to_temp_file\n sum = File.open(upload_temp_file) do |f|\n Digest::MD5.hexdigest(f.read)\n end\n if sum == upload_md5sum\n result = true\n else\n errors.add(:image, :validate_image_md5_mismatch.\n t(actual: sum.split.first, expect: upload_md5sum))\n result = false\n end\n end\n result\n end",
"def file_remote_digestmd5(file_name)\n data = read_file(file_name)\n chksum = nil\n if data\n chksum = Digest::MD5.hexdigest(data)\n end\n return chksum\n end",
"def create_checksums\n # puts \"Ins: #{@basename}\"\n md5 = Digest::MD5.file(@fullname).to_s\n sha1 = Digest::SHA1.file(@fullname).to_s\n sha256 = Digest::SHA2.new(256).file(@fullname).to_s\n @pkgdb.query(\"insert into checksums values ( datetime('now'), '#{@basename}', '#{@suitename}', '#{@mtime.iso8601}', '#{md5}', '#{sha1}', '#{sha256}' )\")\n end",
"def md5sum(path)\n digest, buf = Digest::MD5.new, \"\"\n File.open(path) do |f|\n while f.read(4096, buf)\n digest.update(buf)\n end\n end\n digest.hexdigest\n end",
"def checksum\n Digest::SHA256.file(sample_dmg).hexdigest\nend",
"def compute_hash( path )\n res = '0'\n autorelease_pool { res = NSData.sha1FromContentsOfFile(path) }\n res\n end",
"def calculate_checksum(file)\n @lookup_checksums[file] = Digest::MD5.hexdigest(File.read(file, mode: \"rb\")) rescue \"\"\n end",
"def generate_dummy_checksum()\n file = Pedant::Utility.new_random_file\n checksum = Pedant::Utility.checksum(file)\n sandbox = create_sandbox([file])\n upload_to_sandbox(file, sandbox)\n sleep 2 #give s3 some time\n commit_sandbox(sandbox)\n checksum\n end",
"def file_checksum(file_path)\n Digest::SHA256.file(file_path).hexdigest\n end",
"def append_md5(file, digest, hashless: false)\n return file if hashless\n\n [[file.split(ex = File.extname(file)).first, digest].join('-'), ex].join\n end",
"def checksum_file(digest_class, path)\n digester = digest_class.new\n digester.file(path)\n digester.hexdigest\n end",
"def digest_md5(*files)\n files.flatten.collect { |file| \n File.exists?(file) ? Digest::MD5.hexdigest(File.read(file)) : nil\n }\n end",
"def target_shasum\n @target_shasum ||= digest_directory(project_dir, :sha256, source_options)\n end",
"def md5_sum(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n cmd = self.class.curr_host == host ?\n \"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print $1}' | sort | md5sum\" :\n \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print \\\\$1}' | sort | md5sum\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n r.to_s[0..31]\n end",
"def md5_sum(file_name)\n dst_path = \"#{self.path}#{file_name}\"\n cmd = self.class.curr_host == host ?\n \"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print $1}' | sort | md5sum\" :\n \"ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no #{self.host} \\\"find #{dst_path.shellescape} -type f -exec md5sum {} \\\\; | awk '{print \\\\$1}' | sort | md5sum\\\"\"\n r = `#{cmd} 2>&1`\n raise r if $?.exitstatus != 0\n r.to_s[0..31]\n end",
"def md5 path\n return unless File.file?(path)\n self.md5s[path] ||= Digest::MD5.file(path).hexdigest[0...8]\n end",
"def upstream_md5=( checksum )\n @digest = Crate::Digest.md5( checksum )\n end",
"def ssh_md5sum_file(file)\n df = \"\"\n Net::SSH.start(@ip, \"pipeline\") do |ssh|\n df = ssh.exec! \"md5sum #{file}\"\n end\n df\n end",
"def file_fingerprint(options=nil)\n temp_options(options) if options\n fingerprint = Digest::MD5.hexdigest(all_files.map! { |path| \"#{File.mtime(path).to_i}\" }.join + @options.to_s)\n reset_options if options\n fingerprint\n end",
"def checksum(file_path, hash_class, _bit_size)\n # Size of each chunk\n chunk_size = 2048\n # Hash that is the checksum function\n # when a bitsize was specified\n if _bit_size\n hash = hash_class.new(_bit_size)\n else\n hash = hash_class.new\n end\n # File handler\n file_object = File.open(file_path, 'r')\n # loop to update the hash\n while true\n content = file_object.read chunk_size\n # Break the loop if we don't get any byte\n unless content\n return hash.hexdigest\n end\n # Update the hash\n hash.update content\n end\nend",
"def checksum_handler(file_path, hash_db, hash_class, _bit_size, debugmode, samefolder)\n # Reference for hash banner to notice wat function is using\n reference_banner = {1 => \"SHA1\", 2 => \"SHA2-#{_bit_size}\", 5 => \"MD5\"}[hash_class]\n # returns path as the script was in the same folder\n if samefolder\n samefolder = getfolder file_path\n end\n # Puts hash class that is really a hash function that is going to be used\n if debugmode\n puts reference_banner\n end\n # Write to target if is stablished\n if hash_db.is_a? String\n # Handler for the next writes\n file_object = File.open hash_db, 'w'\n # Write the banner; useful for compare mode\n file_object.write \"#{reference_banner}\\n\"\n else\n # When not file is set\n file_object = nil\n end\n # Stablish the hash class\n hash_class = {1 => Digest::SHA1, 2 => Digest::SHA2, 5 => Digest::MD5}[hash_class]\n # Recursive mode also works with files\n recursive_checksum file_path, hash_class, _bit_size, file_object, debugmode, samefolder\n # If we are redirecting the hashes to a file finally close it\n if file_object\n file_object.close\n end\nend",
"def prefix\n @md5 ||= Digest::MD5.new\n @md5.update Dir.pwd\n end",
"def checksum\n\t\t@checksum ||= FileManager.checksum(@path)\n #\t\tif file?\n #\t\t\treturn FileManager.checksum(@path)\n #\t\tend\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 file_digest(file)\n # Get the actual file by #tempfile if the file is an `ActionDispatch::Http::UploadedFile`.\n Digest::SHA256.file(file.try(:tempfile) || file).hexdigest\n end",
"def hash_file(name, length)\n pieces = String.new\n file = ::File.open(name, 'r')\n pieces << Digest::SHA1.digest(file.read(length)) until file.eof?\n file.close\n pieces\n end",
"def findSmallHash(f)\r\n return Digest::SHA1.file(f).hexdigest()\r\nend",
"def grab_md5_from_file(file_path, cfile)\n Helpers::log(\"Checking #{file_path} for #{cfile} md5sum\")\n if File.exist?(file_path)\n md5 = \"\"\n File.open(file_path).each do |f|\n if /#{cfile}/.match(f)\n md5 = f\n end\n end\n md5\n else\n File.new(file_path,\"w\")\n \"\"\n end\n end",
"def md5sum\n @md5sum ||= Digest::MD5.hexdigest(self.to_checksum_string)\n end",
"def create_chksum_manifest\n chksum_manifest = {}\n files = Dir['*'].select{ |f| File.file? f }\n files.each do |file|\n chksum_manifest[file] = Digest::MD5.file(file).hexdigest\n end\n chksum_manifest\n end",
"def verifyMD5sum\n\n oldMD5sum = ''\n \n self.audioMD5sum if ! @audioMD5sum # compute MD5sum if it's not computed yet\n\n base = @basename.sub( /(.)\\.[^.]+$/ , '\\1') # remove suffix from audio-file\n base += '.md5' # add new suffix .md5\n md5name = File.join(@dirname,base)\n \n # if a MD5-file doesn't exist, we should create one and return TRUE ...\n if File.exists?(md5name)\n File.open( md5name ,\"r\") { |f| \n oldname,oldMD5sum = f.readline.split # read old MD5-sum\n }\n else\n oldMD5sum = self.writeMD5sum # create MD5-file and return true..\n end\n @audioMD5sum == oldMD5sum\n \n 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 create_temp_file\n copy_to_temp_file full_filename\n end",
"def generate_uniq_filename_from(data)\n if data.respond_to?(:path)\n Digest::MD5.hexdigest(data.path)\n elsif data.respond_to?(:read)\n chunk = data.read(1024)\n data.rewind\n Digest::MD5.hexdigest(chunk)\n else\n Digest::MD5.hexdigest(data)\n end\n end",
"def generate_uniq_filename_from(data)\n if data.respond_to?(:path)\n Digest::MD5.hexdigest(data.path)\n elsif data.respond_to?(:read)\n chunk = data.read(1024)\n data.rewind\n Digest::MD5.hexdigest(chunk)\n else\n Digest::MD5.hexdigest(data)\n end\n end",
"def hash_path(path)\n Digest::MD5.hexdigest(path)[0..5]\n end",
"def file_sha256\n Digest::SHA256.file(self).hexdigest\n end",
"def calculated_checksum\n send(\"#{@resource[:checksum_type]}_file\".to_sym, @resource[:path]) \n end",
"def file_digest(path)\n if stat = self.stat(path)\n self.stat_digest(path, stat)\n end\n end",
"def file_sha1\n Digest::SHA1.file(self).hexdigest\n end",
"def shasum\n @shasum ||= begin\n digest = Digest::SHA256.new\n\n update_with_string(digest, name)\n update_with_string(digest, install_dir)\n update_with_string(digest, FFI_Yajl::Encoder.encode(overrides))\n\n if filepath && File.exist?(filepath)\n update_with_file_contents(digest, filepath)\n else\n update_with_string(digest, \"<DYNAMIC>\")\n end\n\n digest.hexdigest\n end\n end",
"def gemfile_md5\n @_gemfile_md5 ||= Digest::MD5.file(File.join(repo_path, 'Gemfile.lock')).hexdigest rescue nil\n end",
"def hash_file path, hash_store\r\n\thexdigest = HASH_DIGEST.hexdigest(open(path, 'rb') { |io| io.read })\r\n\thash_store[hexdigest] << path\r\nend",
"def createMD5Hash(data)\n\t\treturn Digest::MD5.digest(data)\n\tend",
"def file_outdated?(path, expected_md5sum)\n return true unless File.exist?(path)\n\n md5 = Digest::MD5.new\n File.open(path, \"r\") do |file|\n while (chunk = file.read(1024))\n md5.update chunk\n end\n end\n md5.to_s != expected_md5sum\n end",
"def checksum(path)\n FileChecksum.new(path, Digest::SHA1).checksum\n end",
"def sha1\n RunLoop::Directory.directory_digest(path)\n end",
"def cached_gemfile_md5\n @_cached_gemfile_md5 ||= File.read(cached_gemfile_md5_path) rescue nil\n end",
"def md5_hash(data)\n md5 = Digest::MD5.new\n md5 << data\n md5.hexdigest\n end",
"def digest\n OpenSSL::Digest::SHA256.file(path).hexdigest\n end",
"def md5sum\n Digest::MD5.hexdigest(self)\n end",
"def data= x\n if @force_to_file\n File.unlink(@force_to_file.to_s) rescue nil\n @force_to_file = @file = nil\n end\n @md5sum = nil\n @data = x\n end",
"def filehash(filepath)\n sha1 = Digest::SHA1.new\n File.open(filepath) do|file|\n buffer = ''\n # Read the file 512 bytes at a time\n while not file.eof\n file.read(512, buffer)\n sha1.update(buffer)\n end\n end\n return sha1.to_s\n end",
"def fingerprint_header_file(file)\n\tsum = Digest::MD5.hexdigest(File.read(file))\n\text = File.extname(file)\n\tnew_file = [\"assets\", [File.basename(file, ext), \"-#{sum}\", ext].join].join(\"/\")\n\n\t# Copy to a new fingerprinted file\n\tFileUtils.cp file, new_file\n\n\t# Replace reference to file with our new filename\n\t`sed -i.tmp -e \"s|#{file}|#{new_file}|\" header.php`\n\n\t# Remove our temporary file\n\tFileUtils.rm \"header.php.tmp\", :force => true\n\n\tputs \"Fingerprinted #{new_file} and updated header.php\"\nend",
"def generate_sha(file)\n\n sha1 = Digest::SHA1.file file\n return sha1\n\nend",
"def calculate_unique_hash\n unique = ''\n unique += self.content if self.content.present?\n unique += self.summary if self.summary.present?\n unique += self.title if self.title.present?\n self.unique_hash = Digest::MD5.hexdigest unique\n end",
"def filename\n DateTime.now.strftime('%Q') + Digest::MD5.hexdigest(original_filename) + original_filename if original_filename\n end",
"def hexdigest\n self.class.hexdigest_for(path)\n end",
"def checksum\n source[digest_type]\n end",
"def genhash(absolute_filename)\n HDB.debug and puts \"Absolute filename #{absolute_filename}\"\n if File.file?(absolute_filename)\n HDB.debug and puts \"Digesting\"\n hash = Digest::SHA512.new\n # Save atime\n PRESERVE_ATIME and atime = File.stat(absolute_filename).atime\n File.open(absolute_filename, 'r') do |fh|\n while buffer = fh.read(BUFSIZE)\n hash << buffer\n end\n end\n # Reset atime, preserve mtime\n PRESERVE_ATIME and File.utime(atime, File.stat(absolute_filename).mtime, absolute_filename)\n return hash.to_s\n else\n HDB.debug and puts \"Not a file\"\n return NAHASH\n end\n end",
"def rm_md5_from_file(file_path, cfile)\n Helpers::log(\"#{cfile} md5sum doesn't match instrument. Removing from \" +\n \"#{file_path}.\")\n File.rename(file_path, \"#{file_path}.old\")\n file = File.open(file_path,\"w\")\n File.open(\"#{file_path}.old\").each do |f|\n next if /#{cfile}/.match(f)\n file.puts(f)\n end\n file.close\n File.delete(\"#{file_path}.old\")\n end",
"def md5?; @md5; end",
"def shasum\n @shasum ||= begin\n digest = Digest::SHA256.new\n\n log.info(log_key) { \"Calculating shasum\" }\n log.debug(log_key) { \"name: #{name.inspect}\" }\n log.debug(log_key) { \"install_dir: #{install_dir.inspect}\" }\n log.debug(log_key) { \"overrides: #{overrides.inspect}\" }\n\n update_with_string(digest, name)\n update_with_string(digest, install_dir)\n update_with_string(digest, JSON.fast_generate(overrides))\n\n if filepath && File.exist?(filepath)\n log.debug(log_key) { \"filepath: #{filepath.inspect}\" }\n update_with_file_contents(digest, filepath)\n else\n log.debug(log_key) { \"filepath: <DYNAMIC>\" }\n update_with_string(digest, '<DYNAMIC>')\n end\n\n shasum = digest.hexdigest\n\n log.debug(log_key) { \"shasum: #{shasum.inspect}\" }\n\n shasum\n end\n end",
"def checksums; end",
"def after_create\n super\n update(hash: md5_digest)\n end",
"def create\n @user=User.find(params[:user_id])\n @file_upload = @user.file_uploads.new(file_upload_params)\n\n respond_to do |format|\n if @file_upload.save\n format.html { redirect_to user_file_upload_path(@user,@file_upload), notice: 'File was successfully uploaded.' }\n format.json { render :show, status: :created, location: @file_upload }\n @md5 = Digest::MD5.file(@file_upload.attachment.path).hexdigest \n @file_upload[:hash_val]=@md5\n @file_upload.save\n\n else\n format.html { render :new }\n format.json { render json: @file_upload.errors, status: :unprocessable_entity }\n end\n end\n end",
"def md5(handle, offset, length, quick_hash)\n send_request(FXP_EXTENDED, :string, \"md5-hash-handle\", :int64, offset, :int64, length, :string, quick_hash)\n end",
"def checksum(file, digest=nil)\n return nil unless digest\n if FileTest.directory?(file)\n @null_string ||= digester(digest).hexdigest(\"\") # TODO use other means\n else\n digester(digest).hexdigest(File.read(file))\n end\n end",
"def checksum!\n self.checksum = compute_checksum\n end",
"def checksum!\n self.checksum = compute_checksum\n end",
"def mutate_md5(cell)\n cell ? Digest::MD5.base64digest(cell) : cell\n end",
"def fedora_shasum\n \"urn:sha1:#{Digest::SHA1.file(file_path)}\"\n end",
"def to_md5(pass)\r\n return Digest::MD5.hexdigest(pass)\r\nend",
"def copy_files\n require 'ftools'\n @files.inject({}) do |result, file|\n seed = (rand * 1000).to_i\n new_path = \"temp_uploads/#{seed}\" + file[1].path.split('/').last\n File.move(file[1].path, new_path, true)\n result[file[0].to_sym] = new_path\n result\n end\n end",
"def digest\n @digest ||= begin\n Digest::SHA1.hexdigest \"defaults-#{NilavuStylesheets.last_file_updated}\"\n end\n end"
] | [
"0.6927792",
"0.6898701",
"0.6628717",
"0.6586476",
"0.6566919",
"0.6516795",
"0.6424904",
"0.6371402",
"0.6345634",
"0.6327153",
"0.63042724",
"0.62904793",
"0.62884724",
"0.6284855",
"0.6250928",
"0.62365437",
"0.6213313",
"0.6158754",
"0.6142212",
"0.6121433",
"0.61095977",
"0.60857457",
"0.6045099",
"0.6019204",
"0.6017449",
"0.5990283",
"0.5971279",
"0.5935071",
"0.5918546",
"0.585452",
"0.5850118",
"0.5849418",
"0.58279026",
"0.58096653",
"0.5805143",
"0.57972795",
"0.57960635",
"0.57811815",
"0.57485014",
"0.57485014",
"0.5738728",
"0.5724233",
"0.57157266",
"0.57082343",
"0.57043594",
"0.5681305",
"0.56808716",
"0.5676457",
"0.56610215",
"0.5658388",
"0.5647075",
"0.5642058",
"0.5625805",
"0.5611269",
"0.56003594",
"0.55744815",
"0.5568079",
"0.55669266",
"0.5555373",
"0.5555373",
"0.55241466",
"0.54973346",
"0.5489843",
"0.5482875",
"0.5468602",
"0.5446527",
"0.5440284",
"0.54351956",
"0.5430479",
"0.5401618",
"0.53991157",
"0.53896993",
"0.5362646",
"0.53465503",
"0.53270954",
"0.53242266",
"0.5323903",
"0.5321513",
"0.53023064",
"0.52995664",
"0.52983385",
"0.52889943",
"0.5288235",
"0.5285643",
"0.52771986",
"0.52763635",
"0.526947",
"0.5241441",
"0.52282155",
"0.52094954",
"0.5201617",
"0.5200888",
"0.5188259",
"0.51859194",
"0.51859194",
"0.5183813",
"0.5178934",
"0.51734495",
"0.5171823",
"0.5169737"
] | 0.56158894 | 53 |
Returns the full path the attachment thumbnail, or nil if the thumbnail cannot be generated. | def thumbnail(options = {})
return if !readable? || !thumbnailable?
size = options[:size].to_i
if size > 0
# Limit the number of thumbnails per image
size = (size / 50.0).ceil * 50
# Maximum thumbnail size
size = 800 if size > 800
else
size = Setting.thumbnails_size.to_i
end
size = 100 unless size > 0
target = thumbnail_path(size)
diskfile_s3 = diskfile
begin
Redmine::Thumbnail.generate(diskfile_s3, target, size, is_pdf?)
rescue => e
Rails.logger.error "An error occured while generating thumbnail for #{diskfile_s3} to #{target}\nException was: #{e.message}"
return
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thumb_image_path\n begin\n self.attachment.url(:thumb) ? self.attachment.url(:thumb) : \"/public/no-image.png\"\n rescue\n \"/public/no-image.png\"\n end\n end",
"def thumbnail\n unless @thumbnail_url\n BabboBackend.get.request_thumbnail_url_for_identifier(@productIdentifier, sender:self)\n return nil\n end\n\n unless @thumbnail\n load_thumbnail(@thumbnail_url)\n return nil\n end\n\n return @thumbnail\n end",
"def thumbnail_url\n scribd_document ? scribd_document.thumbnail_url : nil\n end",
"def thumbnail_url\n (ipaper_document && ipaper_document.thumbnail_url) || public_filename(:thumb)\n end",
"def thumbnail_url\n is_processed ? \n FileSystem.url(thumbnail_path) :\n (orig_thumb_url.present? ? orig_thumb_url : orig_image_url)\n end",
"def thumbnail_path(options={})\n thumb = options[:thumb] || :thumb\n if has_thumbnail?\n public_filename(thumb)\n elsif !options[:no_default]\n content_icon\n end\n end",
"def thumbnail_url\n return self.endpoint.thumbnail_url(self.id)\n end",
"def thumbnail_url\n is_processed ? \n FileSystem.url(thumbnail_path) :\n orig_image_url\n end",
"def thumbnail_file\n scribd_document ? open(scribd_document.thumbnail_url).read : nil\n end",
"def thumbnail\n \tobject.file.url(:thumb)\n end",
"def thumbnail_url\n @thumbnail_url ||= Thumbnail.new(self).url\n end",
"def thumbnail_url\n return '' if self.variant_image_thumbnail.blank?\n self.variant_image_thumbnail.filename.url\n end",
"def get_thumbnail_url\n nil\n end",
"def path(thumbnail = nil)\n @asset.public_path(thumbnail)[1..-1]\n end",
"def thumbnail_url document\n document.derivative_paths[:thumbnail].relative_path.to_s\n end",
"def thumbnail_file(attribute)\n doc = scribd_document_for(attribute)\n\n if doc && doc.thumbnail_url\n open(doc.thumbnail_url).read\n else\n send(attribute).to_file(:thumb).open { |f| f.read }\n end\n rescue Errno::ENOENT, NoMethodError # file not found or nil thumb file\n nil\n end",
"def thumbnail_url\n return '' if self.image_url.empty? || self.product_images[0].product_image_thumbnail.blank?\n self.product_images[0].product_image_thumbnail.filename.url\n end",
"def thumbnail_url\n @thubnail_url ||= url_for_format('thumbnail', 'png')\n end",
"def image_path\n thumbnail_url\n end",
"def thumbnail_path\n \"t_\" + image_path\n end",
"def full_filename(thumbnail = nil)\n file_system_path = (thumbnail ? thumbnail_class : self).attachment_options[:file_system_path]\n File.join(RAILS_ROOT, file_system_path, tasty_attachment_path(filename), \"#{id}_#{user_id}_\" + thumbnail_name_for(thumbnail))\n end",
"def get_thumbnail_url\n thumb_filename = self.filename.split('.')[0] + \"_thumb_300.jpg\"\n thumbnail_url = Storage.get_file_url(ENV['AWS_S3_DIR_PAGES'], self.issue_id, thumb_filename )\n return thumbnail_url\n end",
"def full_filename(thumbnail = nil)\n File.join(base_path, thumbnail_name_for(thumbnail))\n end",
"def thumbnail_url(attribute)\n doc = scribd_document_for(attribute)\n\n (doc && doc.thumbnail_url) or self.send(attribute).url(:thumb)\n end",
"def thumb_url\n if object.photo_url(:thumb)\n BASE_URL + object.photo_url(:thumb)\n else\n MISSING_THUMB\n end\n end",
"def temp_document_thumb_url(document)\n if document.cloud_content_thumbnail.attached?\n document.cloud_content_thumbnail.service_url\n else\n 'application/processing.png'\n end\n end",
"def media_url\n if self.is_logo?\n self.structure.logo.url(:thumbnail_email_cropped)\n else\n media = Media.where(id: self.media_id).first\n return if media.nil?\n if media.type == 'Media::Video'\n media.thumbnail_url\n else\n media.image.url(:thumbnail_email_cropped)\n end\n end\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 thumbnail_url\n if video_processing\n \"\"\n else\n video.thumb.url\n end\n end",
"def attachment_path\n return unless attachment?\n\n case attachment.options[:storage]\n when :filesystem then attachment.path\n else attachment.url\n end\n end",
"def thumb_path(abs=false)\n !abs ? image_path_for(:thumb) : File.expand_path([Rails.root, 'public', image_path_for(:thumb) ].join('/'))\n end",
"def document_thumb_url(document)\n if document.cloud_content_thumbnail.attached?\n document.cloud_content_thumbnail.service_url\n else\n 'application/processing.png'\n end\n end",
"def thumbnail_url\n image_url(\"200x200-fix\") || image_url(\"224x148-fix\") || strip_url\n end",
"def full_filename(thumbnail = nil)\n [base_path, thumbnail_name_for(thumbnail)].join(\"/\")\n end",
"def attachment_url(resource, version = :thumb_64)\n uploader = if resource.respond_to?(:mount_on)\n resource\n else\n extract_uploader(resource)\n end\n\n uploader.present? ? uploader.url(version) : 'no-img-fallback.png'\n end",
"def thumbnail_url document\n return document.thumbnail_path if document.try(:thumbnail_path).present?\n if document.id == document.thumbnail_id\n representative_document = document\n else\n representative_document = ::SolrDocument.find(document.thumbnail_id)\n end\n\n thumbnail_file_id = representative_document.original_file_id\n if thumbnail_file_id\n Hyrax.config.iiif_image_url_builder.call(thumbnail_file_id, nil, '250,')\n else\n raise 'thumbnail_file_id is nil'\n end\n\n rescue\n image_path 'default.png'\n end",
"def get_attachment_url\n return self.attachment.url unless self.attachment.blank?\n end",
"def photo__thumb_path\r\n\r\nFile.join(FILES_DEST_PHOTO__THUMBS, File.basename(self.photo__path))\r\nend",
"def thumbnail_url\n album_cover ? album_cover.photo.photo_url_small : photos.size > 0 ? photos.first.photo_url_small : nil\n end",
"def image\n if attachment?\n attachment.url(:large)\n elsif filename?\n \"/images/menu/#{filename}\"\n else\n nil\n end\n end",
"def thumb_path\n \"#{PATH}/#{thumb_filename}\"\n end",
"def thumb_url\n image.url(:thumbnail)\n end",
"def thumb_url\n image.url(:thumbnail)\n end",
"def image\n if attachment?\n attachment.url(:large)\n elsif filename?\n \"/images/slides/#{filename}\"\n else\n \"/images/slides/default.jpg\"\n end\n end",
"def thumbnail_url\n company.image.url(:thumbnail)\n end",
"def thumb_url\n original = case file_data.ext.downcase\n when 'png', 'gif' ,'jpeg', 'jpg'\n file_data\n when 'pdf'\n file_data.thumb('568x', format: 'png', frame: 0).encode('png')\n # Dragonfly.app.fetch_file('public/pdf.png')\n when 'doc', 'docx'\n Dragonfly.app.fetch_file('attach_it/doc.png')\n end\n original.url\n end",
"def avatar_url\n attachment = @object.avatar_attachment\n return if attachment.nil?\n\n Rails.application.routes.url_helpers.rails_blob_url(attachment, only_path: true)\n end",
"def collection_thumb_url(document)\n if document.image == '/dlg_default_image.png'\n document.thumbnail\n else\n cache_server_image_link document.image\n end\n end",
"def thumbnail_web_url\n return @thumbnail_web_url\n end",
"def filename\n @filename ||= generate_thumbnail!\n end",
"def thumbnail_path\n \"t_#{image_path}\"\n end",
"def thumbnail_medium_url\n album_cover ? album_cover.photo.photo_url_medium : photos.size > 0 ? photos.first.photo_url_medium : nil\n end",
"def thumb_src(canvas = false)\n self.fb_thumb || \"/images/pending_video#{'_fb' if canvas}.png\"\n #FileTest.exists?(\"#{Rails.root.to_s}/public/#{thumb}\") ? thumb : \"#{DEFAULT_IMG_PATH}thumbnail.jpg\"\n end",
"def wp_get_attachment_thumb_file(post_id = 0)\n post_id = post_id.to_i\n post = get_post post_id\n return false if post.nil?\n\n imagedata = wp_get_attachment_metadata(post.id)\n return false unless imagedata.is_a? Hash\n imagedata.symbolize_keys!\n\n file = get_attached_file post.id\n\n unless imagedata[:thumb].blank?\n thumbfile = file.gsub(wp_basename(file), imagedata[:thumb])\n if thumbfile && File.exist?(thumbfile)\n # Filters the attachment thumbnail file path.\n return apply_filters('wp_get_attachment_thumb_file', thumbfile, post.id)\n end\n end\n return false\n end",
"def thumbnail_url\n # Just show defaults for now\n ActionController::Base.helpers.image_url 'default.png', host: public_site_url\n\n # Actual thumbnails are ready to go below.\n #if self.thumbnail.present?\n # Rails.application.routes.url_helpers.download_url(self.thumbnail.id, file: 'thumbnail')\n #else\n # ActionController::Base.helpers.image_url 'default.png'\n #end\n end",
"def thumbnail_url\n # Just show defaults for now\n ActionController::Base.helpers.image_url 'default.png', host: public_site_url\n\n # Actual thumbnails are ready to go below.\n #if self.thumbnail.present?\n # Rails.application.routes.url_helpers.download_url(self.thumbnail.id, file: 'thumbnail')\n #else\n # ActionController::Base.helpers.image_url 'default.png'\n #end\n end",
"def set_thumbnail\n dir_name = File.dirname(@path)\n\n if File.exists?(dir_name + '/thumbnails/' + @file_name)\n @thumbnail = dir_name + '/thumbnails/' + @file_name\n @relative_thumbnail_path = @thumbnail.sub(Home::CONTENT_ROOT_DIRECTORY_REGEXP, '')\n else\n @thumbnail = @path\n @relative_thumbnail_path = @relative_path\n end\n end",
"def get_thumb\n (self.logo.present?)? self.logo.thumb : 'assets/logo.png'\n end",
"def attachment_path\n return unless attachment.attached?\n\n attachment.service_url\n end",
"def full_filename(thumbnail = nil)\n File.join( *[ self.class.ssh_config[:directory],\n base_path(thumbnail ? thumbnail_class : self),\n thumbnail_name_for(thumbnail) ].compact )\n end",
"def thumb\n File.join folder, 'thumbs', file_path\n end",
"def thumb\n File.join folder, 'thumbs', file_path\n end",
"def cover_thumb_url\n images('thumb').first[:src]\n end",
"def thumb_url(size)\n image.file.thumb(size).url\n end",
"def get_media_filename\n \"#{@uuid}.#{get_thumbnail_extension}\"\n end",
"def latest_image\n attachments.present? ? attachments.last.document.url(:medium) : \"#{APP_URL}/images/missing.png\"\n end",
"def large\n attachments.first.file.url(:large)\n rescue StandardError => exc\n logger.error(\"Message for the log file while retrieving large preview #{exc.message}\")\n 'empty_file.png'\n end",
"def findThumbnailImageURL\n unless @doc.present?\n Rails.logger.info \"RecipeParser.findThumbnailImageURL: document not initialized\"\n return nil\n end\n\n # meta tags to tell social media which image to use for links in order of importance\n # Reference: https://moz.com/blog/meta-data-templates-123\n metaTagsLookingFor = [\"meta[property='og:image:secure_url']\", \"meta[property='og:image']\", \"meta[itemprop='image']\", \"meta[name='twitter:image:src']\", \"link[rel='image_src']\", \"a[rel='image_src']\"]\n\n metaTagsLookingFor.each do |metaTag|\n node = @doc.at_css(metaTag)\n if node != nil\n imageURL = node.attribute('content') || note.attribute('href')\n Rails.logger.info \"RecipeParser.findThumbnailImageURL: found image thumbnail #{imageURL}\"\n return imageURL\n end\n end\n\n #TODO: Find image if page does not use social media meta.\n\n Rails.logger.info \"RecipeParser.findThumbnailImageURL: unable to find thumbnail image URL\"\n return nil\n end",
"def thumb_url dimensions=\"100x100#\", jpg_quality=75\n return unless file\n return file.url if (file.ext.present? && file.ext.to_sym == :svg)\n\n file.thumb(dimensions).url\n end",
"def thumburl\n thumb_path\n end",
"def small\n attachments.first.file.url(:small)\n rescue StandardError => exc\n logger.error(\"Message for the log file while retrieving small preview #{exc.message}\")\n 'empty_file.png'\n end",
"def filesystem_path_for(object, thumbnail = nil)\n File.join(path_for(object.has_image_id), file_name_for(object.send(options[:column]), thumbnail))\n end",
"def thumbnail\n\t\t\t@data[\"thumbnail\"][\"source\"]\n\t\tend",
"def filename\n \"restaurant_thumbnail\" if original_filename\n end",
"def get_thumbnail(image)\n if File.exist? ( ( image.gsub /^#{@dirname}/, \"#{@thumbs}\" ) + @thumbext)\n image = ( image.gsub /^#{@dirname}/, \"#{@thumbslocal}\" ) + @thumbext\n else\n image = '../images/bigicons/image.jpg'\n end\n image\n end",
"def getThumbnailPath(itemName)\r\n\t\tif Rails.application.assets.find_asset THUMBNAIL_DIR + \"/#{itemName}.jpeg\"\r\n\t\t\treturn THUMBNAIL_DIR + \"/#{itemName}.jpeg\"\r\n\t\telsif Rails.application.assets.find_asset THUMBNAIL_DIR + \"/#{itemName}.png\"\r\n\t\t\treturn THUMBNAIL_DIR + \"/#{itemName}.png\"\r\n\t\telse\r\n\t\t\treturn THUMBNAIL_DIR + \"/no-image.jpeg\"\r\n\t\tend\r\n\tend",
"def file_url\n if paperclip_attachment_attached?\n object.send(attribute_name).url(image_style)\n elsif activestorage_attachment_attached?\n attachment = object.send(attribute_name)\n\n if attachment.representable?\n attachment.representation(resize: \"400x150>\")\n else\n attachment.service_url\n end\n end\n end",
"def thumbnail_class\n attachment_options[:thumbnail_class] = attachment_options[:thumbnail_class].constantize unless attachment_options[:thumbnail_class].is_a?(Class)\n attachment_options[:thumbnail_class]\n end",
"def thumbnail_source\n\t\t\t@data[\"thumbnail\"][\"source\"] if @data[\"thumbnail\"]\n\t\tend",
"def thumb_url\n self.source.thumb.url\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 wp_get_attachment_image_url(attachment_id, size = 'thumbnail', icon = false)\n image = wp_get_attachment_image_src(attachment_id, size, icon)\n if image.length >= 1\n image[0]\n else\n false\n end\n end",
"def avatar_url\n self.avatar.attachment.nil? ? '' :\n \"#{Rails.configuration.api_url}#{Rails.application.routes.url_helpers.rails_blob_path(self.avatar, only_path: true)}\"\n end",
"def url_for(attachment, thumbnail = nil, options = nil)\n options = options ? @options.merge(options) : @options\n if options.key?(:expires_in) || options.key?(:auth) || options.key?(:authenticated)\n S3Object.url_for(attachment.s3.path(thumbnail), options[:bucket_name], options.slice(:expires_in, :use_ssl))\n else\n File.join(protocol(options) + hostname(options) + port_string(options), bucket_name(options), attachment.s3.path(thumbnail))\n end\n end",
"def preview\n attachments.first.file.url(:preview)\n rescue StandardError => exc\n logger.error(\"Message for the log file while retrieving preview #{exc.message}\")\n 'empty_file.png'\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 avatar_url\n self.avatar.attachment.nil? ? '' :\n \"#{Rails.configuration.api_url}#{Rails.application.routes.url_helpers.rails_blob_path(self.avatar, only_path: true)}\"\n end",
"def thumbnail_src(default: 'default_collection.svg')\n self.class.thumbnail_src(self.solr_document, default: default)\n end",
"def resized_image_path(size, crop_if_required=true)\n return path if size.nil? || size == :original\n sized_path = File.join(@record.site.attachments_directory, relative_directory_path, \"#{size}.jpg\")\n crop_image unless File.exist?(sized_path) || !crop_if_required\n sized_path\n end",
"def file_system_path\n path_prefix = (thumbnail ? thumbnail_class : self).attachment_options[:path_prefix].to_s\n [path_prefix, self.parent_type.underscore, attachment_path_id.to_s, self.id.to_s] + partitioned_path(thumbnail_name_for(thumbnail))\n end",
"def image_url\n product.images.first.try(:attachment).try(:url)\n end",
"def get_thumbnail_extension\n return \"png\" if (@parent.type != \"com.apple.notes.gallery\" and !(@parent.parent and @parent.parent.type == \"com.apple.notes.gallery\"))\n return \"jpg\"\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 thumbnail_builder\n ::ManifestBuilder::ThumbnailBuilder\n end",
"def thumbprint\n return @thumbprint\n end",
"def find_thumbnail_file\n map_set = MapSet.find(geo_work.id)\n image_work = map_set.thumbnail\n return unless image_work\n image_work_presenter = ImageWorkShowPresenter.new(SolrDocument.new(image_work.to_solr), nil)\n file_set_id = image_work_presenter.solr_document.representative_id\n @file_set = image_work_presenter.geo_file_set_presenters.find { |presenter| presenter.id == file_set_id }\n end",
"def thumbnail\n feedItem = FeedItem.where(\"id = ?\", params[:id]).limit(1).first rescue nil\n\n if (feedItem)\n # Generate a thumbnail image if none exists\n feedItem.generate_thumbnail if feedItem.image.blank?\n\n if feedItem.image.blank?\n return redirect_to \"file:///\" \n else\n return redirect_to feedItem.image\n end\n else\n return redirect_to \"file:///\"\n end\n end",
"def get_thumbnail\n puts \"id:\", id\n if File.exists?(\"app/assets/images/project_#{id}/page_index.png\")\n \"/assets/project_#{id}/page_index.png\"\n else\n \"/assets/default.jpg\"\n end\n end",
"def item_thumb_url(document)\n if sound_type_item?(document)\n asset_path 'file-audio.png'\n else\n \"https://dlg.usg.edu/thumbnails/#{document['repository_slug_ss']}/#{document['collection_slug_ss']}/#{document['record_id_ss']}.jpg\"\n end\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"
] | [
"0.7820355",
"0.7723328",
"0.748421",
"0.7377993",
"0.72754675",
"0.7239288",
"0.7186934",
"0.7162568",
"0.7160545",
"0.69872826",
"0.6987037",
"0.6986065",
"0.698517",
"0.69777006",
"0.6955584",
"0.6947559",
"0.6936676",
"0.69139504",
"0.6831298",
"0.6812293",
"0.6798306",
"0.6795787",
"0.6795786",
"0.6784973",
"0.67555237",
"0.6749207",
"0.6737693",
"0.67272514",
"0.6707781",
"0.67063457",
"0.66764164",
"0.6660731",
"0.66530806",
"0.6650102",
"0.6646939",
"0.66436845",
"0.66238236",
"0.66097",
"0.6607547",
"0.66020536",
"0.65971726",
"0.65546423",
"0.65546423",
"0.65315455",
"0.65230995",
"0.6517123",
"0.6502352",
"0.64927083",
"0.6486911",
"0.6452668",
"0.6439308",
"0.6435277",
"0.6433389",
"0.64321744",
"0.64178693",
"0.64178693",
"0.6407773",
"0.63674545",
"0.63317496",
"0.63258743",
"0.63011825",
"0.63011825",
"0.62953043",
"0.62926173",
"0.62748843",
"0.6274068",
"0.6269503",
"0.62660444",
"0.62630874",
"0.62630755",
"0.62562156",
"0.62507886",
"0.62277466",
"0.62012327",
"0.6200508",
"0.61882174",
"0.6130944",
"0.61220855",
"0.61145765",
"0.6107833",
"0.61027217",
"0.6084965",
"0.60813993",
"0.60765606",
"0.60513675",
"0.6050137",
"0.6049412",
"0.6031567",
"0.60233885",
"0.60206425",
"0.601694",
"0.60152304",
"0.59869987",
"0.59812945",
"0.5972441",
"0.5971883",
"0.59452987",
"0.59440964",
"0.5924836",
"0.5919317"
] | 0.5983245 | 93 |
Returns true if the file is readable | def readable?
disk_filename.present? && self.s3_object(false).exists?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_readable?(path)\n File.exists? path and File.readable? path\n end",
"def is_readable?\n return @readable\n end",
"def readable?(path)\n info = Private.info_with(path, GLib::G_FILE_ATTRIBUTE_ACCESS_CAN_READ)\n GLib.g_file_info_get_attribute_boolean(info, GLib::G_FILE_ATTRIBUTE_ACCESS_CAN_READ)\n end",
"def is_readable?\n any?(&:readable?)\n end",
"def can_read?(file)\n if !File.exist?(file)\n fail \"ERROR: File #{file} does not exists\"\n elsif !File.readable?(file)\n fail \"ERROR: File #{file} is not readable\"\n end\n end",
"def readable?\n transient? || (filename && filename.readable?)\n end",
"def readable?\n true\n end",
"def readable?\n true\n end",
"def readable?\n return options[:readable] if options.has_key?(:readable)\n true\n end",
"def readable?\n current_user_role_names.each do |role_name|\n return true if Filesystem.test_dir role_name, self, :read\n end\n false\n end",
"def readable?(path)\n raise \"`readable?' method does not support Windows systems\" if session.platform == 'windows'\n\n cmd_exec(\"test -r '#{path}' && echo true\").to_s.include? 'true'\n end",
"def readable_file\n CSV.read(@file)\n\n true\n rescue CSV::MalformedCSVError\n false\n end",
"def readable?\n true\n end",
"def readable_file\n\tputs File.readable?(\"test.txt\")\n\tputs File.writable?(\"test.txt\")\n\tputs File.executable?(\"test.txt\")\nend",
"def is_file?\n path = self.to_abs_path\n ((File.exist?(path)) &&\n (File.readable?(path)))\n end",
"def can_read?\n can?('r')\n end",
"def valid?\n File.exist?(path) && File.readable?(path)\n end",
"def readable?() end",
"def file_is_readable\n unless self.parser.readable?\n self.errors.add(:evaluation_file, I18n.t('evaluation.errors.file_not_readable'))\n end\n end",
"def check_for fn\n File.readable?( fn ) && fn\n end",
"def is_file_open?\n (@file_handle != nil)\n end",
"def is_file_open?\n (@file_handle != nil)\n end",
"def read?\n [email protected]?\n end",
"def readable?\n (mode & P_USR_R) != 0 || (mode & P_GRP_R) != 0 || (mode & P_OTH_R) != 0\n end",
"def can_open?\n @netcdf_elmt.canOpen(@file_name)\n end",
"def readable?\n status_flag?(:kSecReadPermStatus)\n end",
"def accessible?\n workdir.executable? && workdir.readable?\n end",
"def loadable?(path)\n return false unless File.exists? path\n\n @stat = File.stat path\n @stat.file? and @stat.readable?\n end",
"def exist?\n filepath.file? and filepath.readable?\n end",
"def readable?\n return @access_mode != Pho::UNAVAILABLE\n end",
"def wait_readable\n ::IO.select([@io], [], [])\n true\n rescue IOError\n false\n end",
"def accesible(f)\n begin\n File.open(f,\"r\")\n true\n rescue\n false\n end\nend",
"def readable?(base)\n info = nil\n\n begin\n info = query(base)\n rescue\n end\n\n if ((info != nil) &&\n (info['Available'] == false) &&\n (info['Protect'] & PROT_READ == PROT_READ))\n return true\n end\n\n return false\n end",
"def read?\n status.read?\n end",
"def read?\n (status == READ)\n end",
"def valid_read_file!(file)\n raise IOError, \"Unable to read #{file}\" unless File.file?(file) and File.readable?(file)\n file\n end",
"def file_exists(file_path)\n s = read_file(file_path)\n if s and s.length\n return true\n end\n return false\n end",
"def valid_file_path?(path)\n path && File.exist?(path) && File.readable?(path)\n end",
"def is_read\n return @is_read\n end",
"def readable_format?\n @data_chunk_reader.readable_format\n end",
"def readable_format?\n @data_chunk_reader.readable_format\n end",
"def file?\n !!@file ||= false\n end",
"def file?\n [email protected]?\n end",
"def file?\n self.file.file?\n end",
"def check_file(file)\n begin\n file_read = File.open(file, 'r')\n rescue SystemCallError\n puts \"#{file} does not exist\"\n return false\n end\n file_read\n end",
"def writable?\n transient? || (filename && filename.writable?)\n end",
"def read?\n self.status == 'read'\n end",
"def open?\n @data_bytes[1] != 0\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def readable_after_eof?\n true\n end",
"def file?() end",
"def is_readable_by?(agent = nil)\n true\n end",
"def open?(filename); end",
"def writable?(path)\n info = Private.info_with(path, GLib::G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE)\n GLib.g_file_info_get_attribute_boolean(info, GLib::G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE)\n end",
"def readable?(_user)\n true\n end",
"def filecheck\n return file.nil? ? false : File.exist?(file)\n end",
"def readable_after_eof?\n false\n end",
"def readable_after_eof?\n false\n end",
"def test_file(f)\n\treturn (File.file?(f) and File.readable?(f) and File.size?(f).to_i < C_max_filesize*1024*1024 and not (File.socket?(f) or File.blockdev?(f) or File.chardev?(f)))\nend",
"def readable?\n return false if @socket.closed?\n r,_,_ = Kernel.select([@socket], nil, nil, @timeout) rescue nil\n return !(r.nil? or r.empty?)\n end",
"def readable?\n (status & (1 << 1)).nonzero?\n end",
"def writeable?\n return @access_mode == Pho::READ_WRITE\n end",
"def check_file?(file)\n file_methods = [:size, :tempfile, :content_type, :original_filename,]\n file_methods.each do |method_name|\n unless file.respond_to?(method_name)\n logger.error \"basic_files doesn't support #{method_name} method\"\n return false\n end\n end\n true\n end",
"def validFile? filename\n if !filename.kind_of? String\n return false\n elsif File.exists? filename\n return File.readable? filename\n else\n return false\n end\nend",
"def writable?(path)\n begin\n return if (File.stat(path).mode & 0200) != 0200\n\n rescue Errno::ENOENT\n # pass\n end\n\n yield(path) if block_given?\n true\n end",
"def writable?(path)\n begin\n return if (File.stat(path).mode & 0200) != 0200\n\n rescue Errno::ENOENT\n # pass\n end\n\n yield(path) if block_given?\n true\n end",
"def writable?(path)\n raise \"`writable?' method does not support Windows systems\" if session.platform == 'windows'\n\n cmd_exec(\"test -w '#{path}' && echo true\").to_s.include? 'true'\n end",
"def file?\n !!@pointer['realpath']\n end",
"def is_my_file?(file)\n return true if File.exist?(file) && File.symlink?(file) && File.readlink(file).start_with?(working_dir)\n return false\n end",
"def file?(f)\n File.file? f\n end",
"def exist?\n @metadata_file_path.file? and @metadata_file_path.readable?\n end",
"def readable?(timeout)\n readable, writable, errors = IO.select([@socket], nil, nil, timeout)\n return !readable.nil?\n end",
"def read_file name\n return false if name.nil?\n if File.exists?(name)\n File.open(name){|f| f.readlines.join }\n else\n false\n end\n end",
"def locked?\n !!read\n end",
"def file?\n File.exist?(path) && File.directory?(path)\n end",
"def file?(path)\n ::File.file?(prefixed(path))\n end",
"def file?\n kind == NODE_FILE\n end",
"def is_to_be_read?\n any?(&:is_to_be_read?)\n end",
"def check_files\n @files.each do |f|\n stat = File.stat f rescue next\n raise RDoc::Error, \"file '#{f}' not readable\" unless stat.readable?\n end\n end",
"def attempt_read\n # Return false if we have nothing else to read\n return false if @native_channel.eof\n\n # Attempt to read from stdout/stderr\n @session.blocking_call { read_stream(STREAM_DATA) }\n @session.blocking_call { read_stream(STREAM_EXTENDED_DATA) }\n\n # Return true always\n true\n end",
"def attachment?\n attachment.present? && attachment.readable?\n end",
"def file?(path)\n File.file?(path_of(path))\n end",
"def reading?\n status.received?\n end",
"def filecheck\n file.nil? ? false : File.exist?(file)\n end",
"def poll_readable?\n true\n end",
"def read?\n !(%w(seen read) & flags).empty?\n end",
"def file_input?\n @io.class == FileInputMethod\n end",
"def read?\n not write?\n end",
"def watched_file?(filename)\n false\n end",
"def open?\n end",
"def readable?\n (getsockopt(::XS::EVENTS) & ::XS::POLLIN) == ::XS::POLLIN\n end",
"def readable?\n (options.events & Poller::ZMQ::POLLIN).positive?\n end",
"def found?\n File.exist?(request_path) and (stat.directory? or stat.file?) and stat.readable?\n end",
"def challenge_readable?\n cryptography_provider.respond_to? :decrypt\n end"
] | [
"0.8212343",
"0.8161086",
"0.78762025",
"0.77147126",
"0.76957786",
"0.7691621",
"0.761723",
"0.7590317",
"0.73902774",
"0.7337719",
"0.72673255",
"0.7266669",
"0.72391534",
"0.72068334",
"0.7107648",
"0.70344156",
"0.70265645",
"0.6982086",
"0.69439274",
"0.68249595",
"0.6815135",
"0.6813739",
"0.6725624",
"0.6698072",
"0.6691689",
"0.6665928",
"0.6648266",
"0.6646005",
"0.66180915",
"0.66135114",
"0.65625495",
"0.65373576",
"0.65060484",
"0.6504802",
"0.6431601",
"0.6412178",
"0.6304565",
"0.6298931",
"0.6253743",
"0.62463856",
"0.62463856",
"0.621308",
"0.6209449",
"0.62071514",
"0.62028486",
"0.61993927",
"0.61919135",
"0.619102",
"0.61448824",
"0.61448824",
"0.61448824",
"0.61397946",
"0.61397946",
"0.61397946",
"0.61397946",
"0.61397946",
"0.6136254",
"0.6105829",
"0.60817087",
"0.606754",
"0.6066512",
"0.605765",
"0.60408556",
"0.60408556",
"0.6023472",
"0.6022078",
"0.6009325",
"0.59903014",
"0.5977233",
"0.59481204",
"0.5947757",
"0.5947757",
"0.5939986",
"0.5930099",
"0.5923002",
"0.59094167",
"0.5901492",
"0.58974636",
"0.58855885",
"0.58823174",
"0.5880624",
"0.5879285",
"0.5869518",
"0.58617246",
"0.5859548",
"0.5847302",
"0.5832364",
"0.58294594",
"0.5826052",
"0.5819203",
"0.5813066",
"0.577717",
"0.57770824",
"0.577664",
"0.5772705",
"0.576887",
"0.57667917",
"0.57632446",
"0.5762132",
"0.57542026"
] | 0.66972655 | 24 |
Moves an existing attachment to its target directory | def move_to_target_directory!
return if new_record? || !readable?
src = diskfile
self.disk_directory = target_directory
dest = diskfile
return if src == dest
if !RedmicaS3::Connection.move_object(src, dest)
Rails.logger.error "Could not move attachment from #{src} to #{dest}"
return
end
update_column :disk_directory, disk_directory
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_to_path(target_path)\n move_to(cotta.dir(target_path))\n end",
"def move_to!(dest)\n Pow(dest).parent.create_directory\n move_to(dest)\n end",
"def move_file\n\n end",
"def move_to(target)\n target.parent.mkdirs\n factory.system.move_dir(@path, target.path)\n end",
"def move!(entry, dest_path)\n src_path = Wide::PathUtils.relative_to_base(base_path, entry.path)\n dest_path = Wide::PathUtils.relative_to_base(base_path, dest_path)\n\n cmd = cmd_prefix.push('mv', src_path, dest_path)\n shellout(Escape.shell_command(cmd))\n\n begin\n if($? && $?.exitstatus != 0)\n entry.move!(dest_path);\n end\n rescue\n raise CommandFailed.new(\"Failed to move file #{src_path} to #{dest_path} in the Mercurial repository in #{base_path}\")\n end\n end",
"def discard_path!(new_path)\n discarded_path = \"#{new_path}-#{Time.current.utc.to_i}\"\n\n logger.info(\"Moving existing empty attachments folder from '#{new_path}' to '#{discarded_path}', (PROJECT_ID=#{project.id})\")\n FileUtils.mv(new_path, discarded_path)\n end",
"def move_to dir=\"\"\n #TODO chmod!!!, работа с флагами\n return false if dir.empty?\n \n filename_target = File.join(dir, @name_target+@extention)\n\n begin\n FileUtils.mv(@filename, filename_target) \n rescue StandardError => e\n add_error e.full_message(@name+@extention) \n return false \n else\n @filename = filename_target\n @name = @name_target\n return true\n end\n end",
"def mv srcpath, dstpath\n end",
"def mv(from_location, to_location)\n @client.file_move(from_location, to_location)\n rescue\n puts $! if @@verbose\n nil\n end",
"def move_to(new_path)\n self.path = new_path\n self.save\n end",
"def move\n display_change\n File.move(@real_path, new_path, false)\n end",
"def move!(new_path)\n if exists?\n FileUtils.mv(path, new_path) unless File.identical?(new_path, path)\n else\n File.open(new_path, \"wb\") { |f| f.write(read) }\n end\n end",
"def set_move_target cf=current_file\n ff = expand_path(cf)\n return unless File.directory? ff\n\n @move_target = ff\n message \"Move target set to #{cf}.\"\nend",
"def project_mv(src_file, dst_file, options)\n if src_file.path.directory?\n # Process all children first\n children = src_file.path.children.map { |c| c.directory? ? Group.new(c) : File.new(c) }\n children.each do |src_child|\n dst_child = src_child.with_dirname(dst_file.path)\n project_mv(src_child, dst_child, options)\n end\n else\n # Remove old destination file reference if it exists\n dst_file.remove_from_project if dst_file.pbx_file\n\n # Add new destination file reference to the new xcodeproj\n dst_file.create_file_reference\n dst_file.add_to_targets(options[:targets], options[:headers])\n end\n\n # Remove original directory/file from xcodeproj\n if src_file.pbx_file\n src_file.remove_from_project\n else\n warn(\"⚠️ Warning: #{src_file.path.basename} not found in #{src_file.project.path.basename}, moving anyway...\")\n end\n end",
"def move_to(path)\n raise CommandError, 'Destination exists' if File.exist?(expand path)\n FileUtils.mkdir_p(File.dirname(expand path))\n FileUtils.mv(@working_dir, expand(path))\n end",
"def shift_from(other)\n raise ArgumentError.new(other) unless other.kind_of?(self.class)\n unless File.ftype(other.path) == \"file\"\n raise ArgumentError.new(other)\n end\n dir = @path.dirname\n dir.mkpath unless dir.exist?\n FileUtils.mv(other.path, @path)\n end",
"def mv( dst, options = {} )\n # what does FileUtils.rm actually return? Glancing an the source, it\n # seems to only throw errors.\n FileUtils.mv( self, dst, **options )\n end",
"def rename_file\n return unless filename_changed?\n\n old_full_filename = [base_path, filename_was].join(\"/\")\n\n object = self.class.bucket.objects.find(old_full_filename)\n new_object = object.copy(:key => full_filename, :acl => attachment_options[:acl])\n object.destroy\n true\n end",
"def move(from, to)\n @ctx.mv(@path + from, @path + to)\n end",
"def mv(srcpath,dstpath)\n FileUtils.mv(srcpath,dstpath)\n end",
"def move_epub\n origin = manifest.filename\n target = preview? ? origin + '-preview' : origin\n FileUtils.mv(File.join('epub', \"#{origin}.epub\"),\n File.join('ebooks', \"#{target}.epub\"))\n end",
"def mv(target, create = nil)\n if create\n if @aug.match(target).size == 0\n aug.mv(@path, create)\n else\n aug.mv(@path, target)\n end\n else\n @aug.mv(@path, target)\n end\n end",
"def test_move_file_in_subdirectory\n `touch ../harness/test/new/foo`\n nd = TestDirectory.new \"../harness/test/new\"\n assert(nd.files.find \"foo\")\n @td.move(:foo, :new, :unclassified)\n assert(File.exist?(\"../harness/test/unclassified/foo\"))\n assert(!File.exist?(\"../harness/test/new/foo\"))\n end",
"def move_file(src, dest)\n FileUtils.mv(src, dest, force: false)\nrescue Errno::EACCES\n FileUtils.cp_r(src, dest)\n FileUtils.rm_rf(src)\nend",
"def rename_file\n return unless @old_filename and @old_filename != full_filename\n start_ssh do |ssh|\n if save_attachment?\n ssh.exec!(\"rm #{e @old_filename}\")\n else\n ssh.exec!(\"mv #{e @old_filename} #{e full_filename}\")\n end\n end\n @old_filename = nil\n true\n end",
"def move_directory(directory,target)\n log_new(\"move directory -> #{File.basename(directory)}\")\n \n if File.exists? \"#{target}/#{File.basename(directory)}\"\n log(\"warning dst directory exists: \\'#{File.basename(directory)}\\'\")\n else \n # if the directory does not exist it is created\n FileUtils.mkdir_p(target,$options) if not File.directory? target\n FileUtils.mv(directory,target,$options) if ( (File.dirname directory) != target.gsub(/\\/$/,'')) \n symlink_on_move(directory,target)\n end\nend",
"def move(*args)\n \t# Sending destination path\n \tputs \"MOVING\"\n \tmove_entity(*args[0].public_path)\n \tsuper\n end",
"def execute()\r\n FileUtils.mv(@OldFilePath, @NewFilePath)\r\n end",
"def mv orig, dest, rm = true\n rm_rf dest unless !rm\n execute(\"mv #{orig} #{dest}\")\n end",
"def move_package(name, new_dir)\n Autoproj.workspace.manifest.move_package(name, new_dir)\nend",
"def file_move(from_path, to_path)\n params = {\n \"root\" => @root,\n \"from_path\" => format_path(from_path, false),\n \"to_path\" => format_path(to_path, false),\n }\n response = @session.do_post build_url(\"/fileops/move\", params)\n parse_response(response)\n end",
"def move_to_trash!(remove_empty_dir: true)\n curr_path, = file_path_and_role_name\n unless curr_path\n raise FsException::Action, \"Move to trash not allowed. File not accessible with current roles: #{curr_path}\"\n end\n\n dt = DateTime.now.to_i\n new_file_name = \"#{file_name}--#{dt}\"\n move_to trash_path, new_file_name\n\n return unless curr_path && is_a?(ArchivedFile) && remove_empty_dir\n\n NfsStore::Archive::Mounter.remove_empty_archive_dir(curr_path)\n end",
"def move(src, dst)\n # Move should copy first then delete after copying is successfull!\n #FileUtils.cp_r(src, dst, :remove_destination => true).nil?\n FileUtils.rm_rf(src) if FileUtils.cp_r(src, dst, :remove_destination => true).nil?\n rescue Exception => e\n log 3, e\n end",
"def move_file (new_directory_path,file)\n FileUtils.mkdir_p new_directory_path if not File.exist? new_directory_path\n if File.exist? file and File.file? file\n if File.exist? new_directory_path + file\n puts \"# - File #{file} already exists. Skipping...\"\n FileUtils.rm file\n else\n puts \"# - Moving the file: #{file} to #{new_directory_path}...\" \n FileUtils.mv file, new_directory_path\n end\n else\n raise \"Error while moving file to #{LOG_OLD_DIR}\"\n end\nend",
"def mv!(to)\n files.map{|file| file.mv! to }\n end",
"def mv(src, dst)\n FileUtils.mv(src, dst, :verbose => verbose?)\n end",
"def rename_mp4_to_mp3\n\n file_path = attachment.path\n\n if (current_format = File.extname(self.attachment.path)) =~ /mp4/\n new_attachment_file_name = File.basename(self.attachment_file_name, File.extname(self.attachment_file_name)) + EXTNAME_FOR_RENAME\n file_path = File.join(File.dirname(self.attachment.path), File.basename(self.attachment.path, current_format)+EXTNAME_FOR_RENAME)\n\n FileUtils.mv(self.attachment.path, file_path)\n update_column(:attachment_file_name, new_attachment_file_name)\n end\n\n file_path\n end",
"def move_to(target, options = {})\n copy_to(target, options)\n delete\n end",
"def move(d)\n\n\t\t# Validate target directory\n\t\traise \"Target directory not found, #{d}\" unless File.directory?(d)\n\t\tdname = File.expand_path(d)\n\n\t\t# Construct target pathnames\t\t\n\t\tmetanew = File.join( dname, @metafile )\n\t\tdatanew = File.join( dname, @datafile )\n\t\t\n\t\t# Move the pair to new directory\n\t\tbegin\n\t\t\tFileUtils.move( @metafull, metanew ) if has_meta?\n\t\t rescue\n\t\t\traise \"Move failed for #{@metafull} to #{metanew}: $!\"\n\t\t end\n\t\t\n\t\tbegin\n\t\t\tFileUtils.move( @datafull, datanew )\n\t\t rescue\n\t\t\traise \"Move failed for #{@datafull} to #{datanew}: $!\"\n\t\t end\n\n\t\t# Update instance variables\n\t\t@dirname = dname\n\t\t@metafull = metanew\n\t\t@datafull = datanew\n\t\t\n\tend",
"def move(command)\n src = clean_up(command[1])\n dest = clean_up(command[2])\n pp @client.files.move(src, dest)\n end",
"def move (source_path, dest_path)\n \"mv '#{source_path}' '#{dest_path}'\"\n end",
"def rename_file\n return unless @old_filename && @old_filename != full_filename\n if save_attachment? && File.exists?(@old_filename)\n FileUtils.rm @old_filename\n elsif File.exists?(@old_filename)\n FileUtils.mv @old_filename, full_filename\n end\n @old_filename = nil\n true\n end",
"def move(file, new_basename = nil, pathtype: :tree)\n filename = new_basename || File.basename(file)\n path = store_path(filename)\n FileUtils.mv File.expand_path(file), path\n file_path path, pathtype\n end",
"def move(dest, overwrite = false)\n\n # ディレクトリなら末尾に「/」をつける。\n # (dstにもともと「/」が付いているかどうか、クライアントに依存している)\n # CarotDAV : 「/」が付いていない\n # TeamFile : 「/」が付いている\n dest.collection! if collection?\n\n src = @bson['filename']\n dst = dest.file_path\n exists = nil\n\n @collection.find({:filename => /^#{Regexp.escape(src)}/}).each do |bson|\n src_name = bson['filename']\n dst_name = dst + src_name.slice(src.length, src_name.length)\n\n exists = @collection.find_one({:filename => dst_name}) rescue nil\n\n # http://mongoid.org/docs/persistence/atomic.html\n # http://rubydoc.info/github/mongoid/mongoid/master/Mongoid/Collection#update-instance_method\n @collection.update({'_id' => bson['_id']}, {'$set' => {'filename' => dst_name}}, :safe => true)\n \n @collection.remove(exists) if exists\n end\n\n collection? ? Created : (exists ? NoContent : Created)\n end",
"def move_to_directory(dir)\n p = File.join(dir, self.filename)\n if copy_file(p)\n @path = p\n end\n end",
"def post_move(filename,src_repo,data)\n curl_post(\"#{self.host}/api2/repos/#{src_repo}/file/?p=#{filename}\",data).body_str\n end",
"def move(from_path, to_path, ctype=nil, recursive=false, replace=false)\n copy(from_path, to_path, ctype, recursive, replace)\n remove(from_path, ctype, recursive)\n end",
"def rename_uploaded_file\r\n return unless @uploaded_file.nil?\r\n if file_exists? and full_path != full_path_from_current_attributes\r\n ensure_directory_exists\r\n File.rename(full_path, full_path_from_current_attributes)\r\n remove_empty_directory\r\n @saved_full_path = full_path_from_current_attributes\r\n end\r\n end",
"def move_to(new_path, permissions=nil, directory_permissions=nil, keep_filename=false)\n return if self.empty?\n new_path = File.expand_path(new_path)\n\n mkdir!(new_path, directory_permissions)\n move!(new_path)\n chmod!(new_path, permissions)\n self.file = {tempfile: new_path, filename: keep_filename ? original_filename : nil, content_type: declared_content_type}\n self\n end",
"def smove(source, destination, member); end",
"def smove(source, destination, member); end",
"def mv!( from_path, to_path )\r\n got = @ndev.rpc.command( \"file rename #{from_path} #{to_path}\" )\r\n return true if got.nil? # got no error\r\n raise IOError, got.text\r\n end",
"def move_multimedia_files_to_trash\n if self.multimedia_path\n\n FileUtils.mkdir_p(dir_for_deleted)\n FileUtils.mv(Dir.glob(File.join(class_multimedia_path, self.multimedia_path, \"*.*\")), dir_for_deleted)\n\n logger.info \"Moviendo #{File.join(class_multimedia_path, self.multimedia_path, \"*.*\")} a #{dir_for_deleted}\"\n\n FileUtils.rm_rf(File.join(class_multimedia_path, self.multimedia_path))\n\n # Los videos de la webtv dejarán de funcionar porque están en el mismo directorio\n self.webtv_videos.update_all(\"published_at=NULL, document_id=NULL\") if self.respond_to?('webtv_videos')\n self.gallery_photos.update_all(\"document_id=NULL\") if self.respond_to?('gallery_photos')\n self.album.update_attributes(:document_id => nil, :draft => true) if self.respond_to?('album') && self.album\n end\n return true\n end",
"def move_to(new_path, new_file_name = nil)\n res = false\n new_file_name ||= file_name\n current_user_role_names.each do |role_name|\n curr_path = file_path_for role_name: role_name\n next unless File.exist?(curr_path)\n\n self.path = new_path if new_path\n self.file_name = new_file_name\n self.valid_path_change = true\n\n transaction do\n move_from curr_path\n save!\n res = true\n end\n break\n end\n\n raise FsException::Action, \"Failed to move file to #{new_path}/#{new_file_name}\" unless res\n\n res\n end",
"def move_origional_file\n if File.exist? @origional_file\n $logger.info \" moving previous (orig->processed)\\n #{@origional_file} ->\\n #{processed_file}\"\n FileUtils.mkdir_p(File.dirname(processed_file))\n FileUtils.mv @origional_file, processed_file\n end\n end",
"def fix\n path = Rails.root.join(\"public/system/files/#{self.id}/original/#{self.file_file_name}\")\n Formatador.display_line(\"Uploading file at: [green]#{path}[/]\")\n if File.exists?(path)\n self.attached_file.store!(File.open(path))\n self.update_attribute(:attached_file, self.file_file_name)\n Formatador.display_line(\"[yellow]Done![/]\")\n else\n Formatador.display_line(\"[red]ERROR: [/]File does not exist!\")\n end\n end",
"def move(from_path, to_path, opts = {})\n input_json = {\n from_path: from_path,\n to_path: to_path,\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/move\", input_json)\n Dropbox::API::File.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end",
"def mv(from_path, to_path, replace=false)\n move(from_path, to_path, nil, true, replace)\n end",
"def google_move_file(client)\n notify \"Command : Google move file\"\n # result : error message\n # google treat folders as files\n src_files = move_copy_file_source\n dest_path = CGI::unescape(@fields[:dst_path].to_s)\n result = client.move_files(src_files,dest_path)\n\n end",
"def upload(local_path, dest_path)\n local_file_name = File.basename local_path\n dest_dir_name = File.dirname dest_path\n ssh.send_file local_path, \"/tmp/#{local_file_name}\"\n ssh.exec! \"mkdir --parents #{dest_dir_name}\", sudo: true\n ssh.exec! \"mv /tmp/#{local_file_name} #{dest_path}\", sudo: true\n return dest_path\n end",
"def archive_or_delete(message, delete_processed_messages, archive_folder)\n delete_processed_messages ? message.delete! : message.move_to(archive_folder)\n rescue RExchange::RException => e\n log.warn \"There was a problem moving or deleting a message in Exchange: \" + e.message + \"\\n\" + e.backtrace.join(\"\\n\")\n end",
"def undo\n\t\tif Dir.exist?(\"#{parent_directory}/#{newname}\")\n\t\t\tif Dir.exist?(filePath)\n\t\t\t\tputs \"-'#{name_of_subject}' already exists in this directory\"\n\t\t\telse\n\t\t\t\tFile.rename(\"#{parent_directory}/#{newname}\", filePath)\n\t\t\t\tputs \"-'#{newname}' was renamed '#{name_of_subject}' \\n\"\n\t\t\tend\n\t\telse\n\t\t\tputs \"-'#{newname}' does not exist in this directory \\n\"\n\t\tend\n\tend",
"def test_post_move_file\n\n src = 'folder1/FileTest.pdf'\n dest = 'folder3/folder1/FileTest.pdf'\n versionId = nil\n storage = 'First Storage'\n destStorage = 'First Storage'\n request = PostMoveFileRequest.new(src, dest, versionId, storage, destStorage)\n\n result = @storage_api.post_move_file(request)\n assert result.code == 200, 'Error while moving document'\n\n end",
"def sudo_upload(file_path, to)\n filename = File.basename(to)\n to_directory = File.dirname(to)\n execute \"mkdir -p /tmp/cap_upload\"\n upload! file_path, \"/tmp/cap_upload/#{filename}\"\n execute \"sudo mv /tmp/cap_upload/#{filename} -f #{to_directory}\"\nend",
"def move(dest_path, overwrite=false)\n NotImplemented\n end",
"def copy_or_move(original, target)\n if(@delete_original_file)\n begin\n FileUtils.move(original, target)\n rescue Errno::EACCES\n # Workaround for File.rename bug with JRuby (jira.codehaus.org/browse/JRUBY-3381),\n # based on the code from Lenny Marks 03/Jun/10.\n safe_copy original, target\n FileUtils.rm original\n end\n else\n # Delay can be enabled through enviroment\n if(delay_copies)\n DelayedCopier.cp(original, target)\n else\n safe_copy original, target\n end\n end\n end",
"def move(*args)\n result = copy(*args)\n delete if [Created, NoContent].include?(result)\n result\n end",
"def move(dest)\n copy(dest)\n delete\n end",
"def move_dirs\n \n end",
"def mv_p(from, to, options={})\n mkdir_p File.dirname(to), options\n mv_f from, to, options\n end",
"def copy_to(new_path)\n res = conn.put(new_path) do |req|\n req.headers = {\n \"X-Upyun-Copy-Source\" => \"/#{@uploader.upyun_bucket}/#{path}\",\n \"Content-Length\" => 0,\n \"Mkdir\" => \"true\"\n }\n end\n\n check_put_response!(res)\n\n File.new(@uploader, @base, new_path)\n rescue ConcurrentUploadError\n retry\n end",
"def move_to_folder\n return @move_to_folder\n end",
"def move_image_upload( image_id )\n image_id = image_id.to_s.upcase\n upload_key = UPLOAD_PATH % image_id\n hires_key = HIRES_PATH % image_id\n upload = bucket.object(upload_key)\n\n upload.copy_to(\n bucket.object(hires_key) ) if upload.exists?\n end",
"def mv(src, dest, force: nil, noop: nil, verbose: nil, secure: nil)\n fu_output_message \"mv#{force ? ' -f' : ''} #{[src,dest].flatten.join ' '}\" if verbose\n return if noop\n fu_each_src_dest(src, dest) do |s, d|\n destent = Entry_.new(d, nil, true)\n begin\n if destent.exist?\n if destent.directory?\n raise Errno::EEXIST, d\n end\n end\n begin\n File.rename s, d\n rescue Errno::EXDEV,\n Errno::EPERM # move from unencrypted to encrypted dir (ext4)\n copy_entry s, d, true\n if secure\n remove_entry_secure s, force\n else\n remove_entry s, force\n end\n end\n rescue SystemCallError\n raise unless force\n end\n end\n end",
"def move_to_trash\n source_dir = Item.new(Path.new(params[:source_dir]))\n dest_dir_path = Pathname.new(source_dir.path.dirname.to_s + \"/RESTARTED/RESTARTED_\" + source_dir.path.basename.to_s)\n\n dest_dir_string = dest_dir_path.to_s\n dir_found = false\n i = 1\n while(!dir_found)\n dest_dir = Item.new(Path.new(dest_dir_string))\n if dest_dir.exist?\n dest_dir_string = dest_dir_path.to_s + \"_#{i}\"\n i += 1\n else\n dir_found = true\n end\n end\n\n response = {}\n if !source_dir.exist?\n response[:msg] = \"No folder at location, nothing to do\"\n render json: response, status: 200\n elsif source_dir.move_to(dest_dir)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 422\n end\n end",
"def remove_target(target)\n if perms_for(target)[:rm] == false\n @response[:error] ||= 'Some files/directories were unable to be removed'\n @response[:errorData][target.basename.to_s] = \"Access Denied\"\n return\n end\n# create trash folder if it doesn't exist\n trash_dir = File.join(@root,'.trash/')\n FileUtils.mkdir(trash_dir) unless File.exist?(trash_dir)\n# \n begin\n FileUtils.mv(target, trash_dir, :force => true )\n if !target.directory?\n if @options[:thumbs] && (thumbnail = thumbnail_for(target)).file?\n FileUtils.mv(thumbnail, trash_dir, :force => true )\n end\n end\n rescue\n @response[:error] ||= 'Some files/directories were unable to be removed'\n @response[:errorData][target.basename.to_s] = \"Remove failed\"\n end\nend",
"def move(*args)\n begin\n move_no_cleanup(*args)\n rescue Orp::MovementAlreadyComplete\n warn \"Attempted to complete already completed movement\"\n nil\n rescue\n delete\n raise\n end\n end",
"def move_temp_to_destination\n if !File.exist? temp_file\n $logger.info \"no moving, transcode didn't complete\"\n return\n end\n $logger.info \" moving (temp->destination)\\n #{temp_file} ->\\n #{destination_file}\"\n FileUtils.mv temp_file, destination_file\n end",
"def move( rdn )\n\t\tself.log.debug \"Asking the directory to move me to an entry called %p\" % [ rdn ]\n\t\tself.directory.move( self, rdn )\n\t\tself.clear_caches\n\n\t\treturn self\n\tend",
"def delete_uploaded_file(new_file)\n if version_name.blank? && Refinery::PhotoGallery.delete_uploaded_file\n filename_to_delete = File.join(Rails.root.to_s,Refinery::PhotoGallery.photo_gallery_dir_relative_to_root, store_dir, filename )\n File.delete(filename_to_delete)\n end\n end",
"def move_file\n source_file = Item.new(Path.new(params[:source_file]))\n dest_file = Item.new(Path.new(params[:dest_file]))\n\n response = {}\n if source_file.path.to_s == dest_file.path.to_s\n response[:msg] = \"Same file\"\n render json: response, status: 200\n return\n end\n\n response[:source_file] = source_file\n response[:dest_file] = dest_file\n if source_file.move_to(dest_file)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end",
"def moveFileToDoneFolder(file, dest, logkey='')\n\tMcmlln::Tools.moveFile(file, dest)\nrescue => logstring\nensure\n\tMcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def move_file(file, destination)\n return nil if file.blank? || destination.blank?\n\n FileUtils.mv(file, destination, force: true) if file_exists?(file)\n end",
"def swap(other)\n unless File.ftype(other) == \"file\"\n raise ArgumentError.new(other)\n end\n dir = @path.dirname\n dir.mkpath unless dir.exist?\n FileUtils.mv(other, @path)\n FileUtils.symlink(@path, other)\n end",
"def save_attachment(file, name = '')\n unless name.blank?\n basename = name.scorify\n else\n basename = File.basename(file[:filename]).scorify\n end\n \n ext = File.extname(file[:filename])\n \n # calculate file path\n new_file = File.join(attachment_dir, basename + ext)\n\n # create directory\n FileUtils.mkdir_p(attachment_dir) unless File.exists?(attachment_dir)\n \n # write file\n File.open(new_file, 'w') { |f| file[:tempfile]; f.write(file[:tempfile].read) }\n\n # commit changes\n commit_message = \"uploaded #{filename} for #{@basename.wikify}\"\n begin\n $repo.add(new_file)\n $repo.commit(commit_message)\n rescue\n nil\n end\n end",
"def move(path, new_path)\n cleanup(path)\n new_client.move(path, new_path)\n rescue\n false\n else\n true\n end",
"def into(dir)\n @target_dir = dir.to_s\n @target = nil\n self\n end",
"def destroy_attachment\n a = Attachment.find(1) rescue nil\n if !a.nil?\n a.destroy\n end\n end",
"def mv(from, to, mode: :default, &block)\n target_file = scope.get(from)\n InvalidStore.raise! {!target_file}\n\n dest_dirname = Utils.dir to\n dest_file = scope.get(to)\n dest_dir = scope.get(dest_dirname) || self.mkdir(dest_dirname)\n\n params = make_params :name => Utils.tokenize(to).last,\n :dir_id => dest_dir.try(:id)\n\n resolve_conflict(params, dest_file, mode) do |params, rename|\n target_file.update_attributes params;\n block.call(target_file) if block_given?\n target_file\n end\n end",
"def moveFileToDoneFolder(file, dest, logkey='')\n\tMcmlln::Tools.moveFile(file, dest)\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend",
"def mv(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['mv']\r\n fu_output_message \"mv#{options[:force] ? ' -f' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n fu_each_src_dest(src, dest) do |s, d|\r\n destent = Entry_.new(d, nil, true)\r\n begin\r\n if destent.exist?\r\n if destent.directory?\r\n raise Errno::EEXIST, dest\r\n else\r\n destent.remove_file if rename_cannot_overwrite_file?\r\n end\r\n end\r\n begin\r\n File.rename s, d\r\n rescue Errno::EXDEV\r\n copy_entry s, d, true\r\n if options[:secure]\r\n remove_entry_secure s, options[:force]\r\n else\r\n remove_entry s, options[:force]\r\n end\r\n end\r\n rescue SystemCallError\r\n raise unless options[:force]\r\n end\r\n end\r\n end",
"def mv(src, dest, options = {})\r\n fu_check_options options, OPT_TABLE['mv']\r\n fu_output_message \"mv#{options[:force] ? ' -f' : ''} #{[src,dest].flatten.join ' '}\" if options[:verbose]\r\n return if options[:noop]\r\n fu_each_src_dest(src, dest) do |s, d|\r\n destent = Entry_.new(d, nil, true)\r\n begin\r\n if destent.exist?\r\n if destent.directory?\r\n raise Errno::EEXIST, dest\r\n else\r\n destent.remove_file if rename_cannot_overwrite_file?\r\n end\r\n end\r\n begin\r\n File.rename s, d\r\n rescue Errno::EXDEV\r\n copy_entry s, d, true\r\n if options[:secure]\r\n remove_entry_secure s, options[:force]\r\n else\r\n remove_entry s, options[:force]\r\n end\r\n end\r\n rescue SystemCallError\r\n raise unless options[:force]\r\n end\r\n end\r\n end",
"def delete\n model.delete_attachment(@path)\n end",
"def move_document\n Dir.mkdir(target_dir) if (!File.directory?(target_dir))\n # Only want to move the .html, .css, .png and .js files, not the .haml templates.\n html_css_files = temp_dir(\"*.{html,css,js,png}\")\n Dir[html_css_files].each { |f| mv f, target_dir }\n mv temp_dir + \"/resources\", target_dir, :force => true if (File.directory?(temp_dir + \"/resources\"))\n mv temp_dir + \"/assets\", target_dir, :force => true if (File.directory?(temp_dir + \"/assets\"))\n end",
"def mv(src, dst, **_opts)\n full_src = full_path(src)\n full_dst = full_path(dst)\n\n mkdir_p File.dirname(full_dst)\n sh! %(mv -f #{Shellwords.escape(full_src)} #{Shellwords.escape(full_dst)})\n rescue CommandError => e\n e.status == 1 ? raise(BFS::FileNotFound, src) : raise\n end",
"def move(cloud_file, to_path, root=\"auto\")\n payload = {\n root: root,\n from_path: cloud_file.path,\n to_path: to_path\n }\n\n connexion = Dropbox.start(:move, access_token)\n res = connexion.post do |req|\n req.url \"fileops/move\"\n req.body = payload\n end\n\n response = format_response(res)\n #tree_cache(response)\n end",
"def remove_attachment(id)\n \n transaction do |t|\n file_attachment = FileAttachment.get(id)\n file_attachment.destroy\n save\n t.commit\n end\n\n end",
"def save_to_storage\n if save_attachment?\n start_ssh do |ssh|\n ssh.exec!(\"mkdir -p #{e File.dirname(full_filename)}\")\n ssh.scp.upload!(temp_path, full_filename)\n ssh.exec!( \"chmod #{attachment_options.fetch(:chmod, '0644')}\" +\n \" #{e full_filename}\" )\n end\n end\n @old_filename = nil\n true\n end",
"def mv(name, from = DirConfig::OPEN, to = DirConfig::DEPLOY)\n agency = options[:agency]\n ::Taxi::SFTP.new(agency).move_glob(name, from, to)\n end",
"def save_to_storage\n if save_attachment?\n # TODO: This overwrites the file if it exists, maybe have an allow_overwrite option?\n FileUtils.mkdir_p(File.dirname(full_filename))\n File.cp(temp_path, full_filename)\n File.chmod(attachment_options[:chmod] || 0644, full_filename)\n end\n @old_filename = nil\n true\n end"
] | [
"0.6403506",
"0.6348001",
"0.6257209",
"0.6237689",
"0.6198515",
"0.6142221",
"0.6127432",
"0.6096149",
"0.60808796",
"0.6074945",
"0.60710275",
"0.59910333",
"0.5947841",
"0.5944923",
"0.5939825",
"0.5934065",
"0.59334517",
"0.5912414",
"0.5912376",
"0.58944285",
"0.5880901",
"0.58499104",
"0.58477646",
"0.582739",
"0.5822875",
"0.5819146",
"0.58132297",
"0.5794494",
"0.5790184",
"0.5783757",
"0.5771709",
"0.57711345",
"0.5729602",
"0.5723426",
"0.5716112",
"0.57138914",
"0.5670541",
"0.56683433",
"0.5656989",
"0.5646052",
"0.56363755",
"0.5636201",
"0.5602802",
"0.56012034",
"0.5599434",
"0.5593624",
"0.5592767",
"0.55922925",
"0.55773646",
"0.5573434",
"0.5573434",
"0.55723214",
"0.5569905",
"0.5567102",
"0.5533666",
"0.550742",
"0.5494333",
"0.54742974",
"0.5472279",
"0.5459526",
"0.5457406",
"0.5437454",
"0.5428075",
"0.54247355",
"0.54187953",
"0.541361",
"0.5412023",
"0.5410858",
"0.5399141",
"0.53873265",
"0.5361389",
"0.53513354",
"0.5349515",
"0.5341195",
"0.5332518",
"0.5331464",
"0.5328741",
"0.53267145",
"0.53189945",
"0.53176975",
"0.5317132",
"0.53097796",
"0.5296201",
"0.5292368",
"0.52874714",
"0.52765787",
"0.52726257",
"0.52713895",
"0.5269673",
"0.5268862",
"0.5268153",
"0.5268153",
"0.52629465",
"0.5255173",
"0.5253561",
"0.5245087",
"0.52429634",
"0.5240704",
"0.52358806",
"0.5233638"
] | 0.74365443 | 0 |
Updates attachment digest to SHA256 | def update_digest_to_sha256!
return unless readable?
object = self.s3_object
sha = Digest::SHA256.new
sha.update(object.get.body.read)
new_digest = sha.hexdigest
unless new_digest == object.metadata['digest']
object.copy_from(object,
content_disposition: object.content_disposition,
content_type: object.content_type,
metadata: object.metadata.merge({'digest' => new_digest}),
metadata_directive: 'REPLACE'
)
end
unless new_digest == self.digest
update_column :digest, new_digest
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(**args)\n @digest = args[:digest] if args.key?(:digest)\n end",
"def update!(**args)\n @sha256_fingerprint = args[:sha256_fingerprint] if args.key?(:sha256_fingerprint)\n end",
"def digest\n OpenSSL::Digest::SHA256.file(path).hexdigest\n end",
"def update_digest\n\n path = self.bundle_dir\n sha = Digest::SHA2.new\n bundle_sha = Digest::SHA2.new\n\n digests = []\n Dir.glob(\"#{path}/**/*\").sort.each do |f|\n next if File.directory?(f) || File.basename(f) == \"digest\" || f =~ /^#{path}\\/test/\n bundle_sha.file(f)\n sha.reset()\n digests << { :file => f.gsub(/#{path}\\//, ''), :digest => sha.file(f).hexdigest() }\n end\n\n @digest = { :digest => bundle_sha.hexdigest(), :files => digests }\n File.open(path+\"/digest\", 'w'){ |f|\n f.write(MultiJson.dump(@digest, :pretty => true, :adapter => :json_gem) + \"\\n\")\n }\n\n end",
"def digest\n assert_file!\n Digest::SHA256.hexdigest(@name + Digest::SHA256.file(@path).to_s)\n end",
"def digest(data); end",
"def update(message)\n self.class.auth_hmacsha256_update(@state, message, message.bytesize)\n self.class.auth_hmacsha256_final(@state.clone, @authenticator)\n\n hexdigest\n end",
"def digest\n Digest::MD5.digest(blob)\n end",
"def update!(**args)\n @sha256 = args[:sha256] if args.key?(:sha256)\n end",
"def hexdigest\n # Read bytes in chunks of the optimal digest size.\n while (chunk = @io.read(@digest.block_length))\n @digest.update(chunk)\n end\n @digest.hexdigest\n end",
"def digest\n @digest ||= Digest::SHA1.new.update(version.to_s)\n @digest.dup\n end",
"def update(string)\n check_valid\n string_ptr = FFI::MemoryPointer.from_string(string)\n OpenSSL::LibCrypto.EVP_DigestUpdate(self, string_ptr, string.length)\n self\n end",
"def sha256\n @sha256 ||= digest(path, :sha256)\n end",
"def update\n respond_to do |format|\n\n if @file_upload.update(file_upload_params)\n format.html { redirect_to user_file_upload_path, notice: 'File was successfully updated.' }\n format.json { render :show, status: :ok, location: @file_upload }\n @md5 = Digest::MD5.file(@file_upload.attachment.path).hexdigest \n @file_upload[:hash_val]=@md5\n @file_upload.save\n else\n format.html { render :edit }\n format.json { render json: @file_upload.errors, status: :unprocessable_entity }\n end\n end\n end",
"def digest\n Digest::MD5.file(file).hexdigest\n end",
"def file_sha256\n Digest::SHA256.file(self).hexdigest\n end",
"def digest\n Digest::SHA2.new\n end",
"def digest!()\n #This is a stub, used for indexing\n end",
"def update_signature!; end",
"def update_signature!; end",
"def update_file_metadata(data)\n update_attributes!( :file_size => data.bytesize, :file_hash => Digest::SHA1.hexdigest( data ) )\n end",
"def sha256; end",
"def update!(**args)\n @sha256_checksum = args[:sha256_checksum] if args.key?(:sha256_checksum)\n @uri = args[:uri] if args.key?(:uri)\n end",
"def update!(**args)\n @bytes_to_sign = args[:bytes_to_sign] if args.key?(:bytes_to_sign)\n end",
"def update!(**args)\n @bytes_to_sign = args[:bytes_to_sign] if args.key?(:bytes_to_sign)\n end",
"def digest\n @digest ||= DEFAULT_DIGEST_PROC\n end",
"def digest_class\n Digest::SHA256\n end",
"def digest_class\n Digest::SHA256\n end",
"def digest_key(digest)\n \"asset-uri-digest:#{compressed_path}:#{digest}\"\n end",
"def digest\n metadata[:digest]\n end",
"def digest(message)\n OpenSSL::HMAC.digest SHA256, @secret, message\n end",
"def add_digest(item)\n add_lock_prefix(item)\n add_lock_args(item)\n add_lock_digest(item)\n\n item\n end",
"def digest\n digest = ''\n @entries.each { |entry| digest << entry.digest << ' ' }\n digest\n end",
"def finish\n check_valid\n d_len = self.md.md_size\n string_ptr = FFI::MemoryPointer.new(:char, d_len)\n OpenSSL::LibCrypto.EVP_DigestFinal_ex(self, string_ptr, nil)\n string_ptr.read_string(d_len)\n end",
"def update!(**args)\n @fingerprint = args[:fingerprint] if args.key?(:fingerprint)\n end",
"def update!(**args)\n @fingerprint = args[:fingerprint] if args.key?(:fingerprint)\n end",
"def update!(**args)\n @fingerprint = args[:fingerprint] if args.key?(:fingerprint)\n end",
"def update!(**args)\n @fingerprint = args[:fingerprint] if args.key?(:fingerprint)\n end",
"def update_fingerprint\n data = self.attributes.merge({endpoint: transaction_endpoint.name})\n write_attribute(:fingerprint, Transaction.fingerprint(data))\n end",
"def hexdigest\n @digest.unpack('H*'.freeze).first\n end",
"def digest\n @digest ||= begin\n Digest::SHA1.hexdigest \"defaults-#{NilavuStylesheets.last_file_updated}\"\n end\n end",
"def file_digest(path)\n if stat = self.stat(path)\n self.stat_digest(path, stat)\n end\n end",
"def hexdigest\n DigestUtils.pack_hexdigest(digest)\n end",
"def digest\n ''\n end",
"def digest\n ''\n end",
"def checksum\n source[digest_type]\n end",
"def file_digest(file)\n # Get the actual file by #tempfile if the file is an `ActionDispatch::Http::UploadedFile`.\n Digest::SHA256.file(file.try(:tempfile) || file).hexdigest\n end",
"def dave(new_str)\r\n new_hash = Digest::SHA256.hexdigest new_str\r\n return new_hash\r\nend",
"def digest(*args)\n return @digest if args.empty?\n\n self.type = :digest\n @digest = args.flatten.compact\n end",
"def digest( str )\n Digest::SHA1.hexdigest( str )\n end",
"def change_sha\n DeliveryGolang::Helpers.change_sha(node)\n end",
"def update!(**args)\n @attachment_sha1 = args[:attachment_sha1] if args.key?(:attachment_sha1)\n @cosmo_id = args[:cosmo_id] if args.key?(:cosmo_id)\n @cosmo_name_space = args[:cosmo_name_space] if args.key?(:cosmo_name_space)\n @encrypted_id = args[:encrypted_id] if args.key?(:encrypted_id)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n @share_scope = args[:share_scope] if args.key?(:share_scope)\n end",
"def digest\n Digest::SHA1.hexdigest(self)\n end",
"def update!(**args)\n @sha256 = args[:sha256] if args.key?(:sha256)\n @sha384 = args[:sha384] if args.key?(:sha384)\n @sha512 = args[:sha512] if args.key?(:sha512)\n end",
"def fingerprint(attachment, _style_name)\n attachment.fingerprint\n end",
"def digest\n decode[:digest]\n end",
"def digest\n image.ident\n end",
"def digest()\n @stomach.clear\n end",
"def base64digest\n DigestUtils.pack_base64digest(digest)\n end",
"def digest_card_data\n @sha256 = self.class.set_digest\n\n self.card_number = @sha256.base64digest(@card_number_undigest) if @card_number_undigest.present?\n self.cvv = @sha256.base64digest(@cvv_undigest) if @cvv_undigest.present?\n\n @cvv_undigest = nil\n @card_number_undigest = nil\n end",
"def hexdigest!()\n #This is a stub, used for indexing\n end",
"def checksum\n digest = @digest_klass.new\n buf = ''\n\n File.open(@path, \"rb\") do |f|\n while !f.eof\n begin\n f.readpartial(BUFFER_SIZE, buf)\n digest.update(buf)\n rescue EOFError\n # Although we check for EOF earlier, this seems to happen\n # sometimes anyways [GH-2716].\n break\n end\n end\n end\n\n digest.hexdigest\n end",
"def hexdigest\n self.class.hexdigest_for(path)\n end",
"def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.payload_hash\n\t\tdigest << self.proof.to_s\n\t\tdigest << self.previous_hash\n\t\t\n\t\treturn digest.hexdigest\n\tend",
"def of_update_attachment\n if !$attachment.nil?\n $attachment.destroy\n $attachment = Attachment.new\n end\n $attachment_changed = true\n $attachment.avatar = params[:file]\n $attachment.id = 1\n $attachment.save!\n if $attachment.save\n render json: { \"image\" => $attachment.avatar }\n else\n render json: { \"image\" => \"\" }\n end\n end",
"def reset\n check_valid\n OpenSSL::LibCrypto.EVP_DigestInit_ex(self, self.md, nil)\n self\n end",
"def pack_base64digest(bin)\n [bin].pack('m0')\n end",
"def pack_base64digest(bin)\n [bin].pack('m0')\n end",
"def digest\n @digest ||= Digest::MD5.hexdigest(self.attributes[self.class.config[:digest]])[0, 8]\n end",
"def checksum\n Digest::SHA256.file(sample_dmg).hexdigest\nend",
"def digest(obj)\n build_digest(obj).digest\n end",
"def after_create\n super\n update(hash: md5_digest)\n end",
"def checksum_file(digest_class, path)\n digester = digest_class.new\n digester.file(path)\n digester.hexdigest\n end",
"def file_digest_key(stat)\n \"file_digest:#{compressed_path}:#{stat}\"\n end",
"def cc_update_attachment\n if !$attachment.nil?\n $attachment.destroy\n $attachment = Attachment.new\n end\n $attachment.avatar = params[:file]\n $attachment.id = 1\n #$attachment.save!\n if $attachment.save\n render json: { \"image\" => $attachment.avatar }\n else\n render json: { \"image\" => \"\" }\n end\n end",
"def update!(**args)\n @image_bytes = args[:image_bytes] if args.key?(:image_bytes)\n end",
"def digest_file( x)\n path = requested_file( x[:request] )\n if File.exist?(path) && !File.directory?(path)\n Digest::MD5.hexdigest(File.read(path))\n else\n nil\n end\n end",
"def si_update_attachment\n if !$attachment.nil?\n $attachment.destroy\n $attachment = Attachment.new\n end\n $attachment_changed = true\n $attachment.avatar = params[:file]\n $attachment.id = 1\n $attachment.save!\n if $attachment.save\n render json: { \"image\" => $attachment.avatar }\n else\n render json: { \"image\" => \"\" }\n end\n end",
"def append_md5(file, digest, hashless: false)\n return file if hashless\n\n [[file.split(ex = File.extname(file)).first, digest].join('-'), ex].join\n end",
"def update!(**args)\n @digest = args[:digest] if args.key?(:digest)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @url = args[:url] if args.key?(:url)\n end",
"def sha\n Digest::SHA2.new.update(self.source).to_s\n end",
"def digest(string)\n @digest_class.new(string).digest\n end",
"def digest\n case @signature_method\n when \"HMAC-SHA256\" then OpenSSL::Digest.new(\"sha256\")\n when \"HMAC-SHA1\" then OpenSSL::Digest.new(\"sha1\")\n else\n fail InvalidSignatureMethodError\n end\n end",
"def update!(**args)\n @signature = args[:signature] if args.key?(:signature)\n end",
"def update!(**args)\n @attachment_data_ref = args[:attachment_data_ref] if args.key?(:attachment_data_ref)\n end",
"def digest_byte_code(byte_code)\n abc = ARuby::SWF::ABC.new\n abc.unserialize(ByteBuffer.new(byte_code))\n end",
"def file_remote_digestsha2(file_name)\n data = read_file(file_name)\n chksum = nil\n if data\n chksum = Digest::SHA256.hexdigest(data)\n end\n return chksum\n end",
"def ti_update_attachment\n if !$attachment.nil?\n $attachment.destroy\n $attachment = Attachment.new\n end\n $attachment.avatar = params[:file]\n $attachment.id = 1\n $attachment.save!\n if $attachment.save\n render json: { \"image\" => $attachment.avatar }\n else\n render json: { \"image\" => \"\" }\n end\n end",
"def hexdigest(value)\n Digest::SHA256.new.update(value).hexdigest\n end",
"def digest\n OpenSSL::HMAC.digest(\n OpenSSL::Digest.new('sha1'),\n secret,\n document\n )\n end",
"def uri_digest(image_uri)\n digest = SimpleEncryptor.encrypt(image_uri, Config.secret_key, Config.public_iv)\n Config.urls_memo[digest] = image_uri\n\n digest\n end",
"def digest\n Digest::SHA1.hexdigest(@pub.to_der)\n end",
"def populate_hash\n self.orig_image_url_hash = Digest::SHA1.hexdigest orig_image_url\n end",
"def digest_length\n check_valid\n md.md_size\n end",
"def co_update_attachment\n if !$attachment.nil?\n $attachment.destroy\n $attachment = Attachment.new\n end\n $attachment.avatar = params[:file]\n $attachment.id = 1\n #$attachment.save!\n if $attachment.save\n render json: { \"image\" => $attachment.avatar }\n else\n render json: { \"image\" => \"\" }\n end\n end",
"def file_digest(pathname)\n key = pathname.to_s\n if @digests.key?(key)\n @digests[key]\n else\n @digests[key] = super\n end\n end",
"def update_checksum\n hh = header(\" \" * 8)\n @checksum = oct(calculate_checksum(hh), 6)\n end",
"def update!(**args)\n @attachment_id = args[:attachment_id] unless args[:attachment_id].nil?\n @data = args[:data] unless args[:data].nil?\n @size = args[:size] unless args[:size].nil?\n end",
"def upstream_md5=( checksum )\n @digest = Crate::Digest.md5( checksum )\n end",
"def getHash element\n\tfile = File.new(element)\n\thash = Digest::SHA256.file file\n\tfile.close\n\treturn hash.hexdigest \n\tend"
] | [
"0.68261296",
"0.65919334",
"0.64462334",
"0.6438088",
"0.63679403",
"0.62825465",
"0.62335134",
"0.62332696",
"0.6175101",
"0.61477673",
"0.6091481",
"0.60665935",
"0.6051113",
"0.60375136",
"0.6027281",
"0.60187125",
"0.59736866",
"0.5967593",
"0.5942377",
"0.5942377",
"0.5874409",
"0.58696276",
"0.5867179",
"0.5856837",
"0.5856837",
"0.5827809",
"0.58197844",
"0.58197844",
"0.5787563",
"0.5779559",
"0.57704943",
"0.57697546",
"0.5766395",
"0.5752037",
"0.5742877",
"0.5742877",
"0.5742877",
"0.5742877",
"0.5739332",
"0.57262415",
"0.57223004",
"0.571761",
"0.5717579",
"0.57003087",
"0.57003087",
"0.56991684",
"0.5672652",
"0.56655824",
"0.56652695",
"0.56631947",
"0.5659558",
"0.56566304",
"0.5651272",
"0.5641719",
"0.5640837",
"0.5626294",
"0.5610754",
"0.5608243",
"0.5585639",
"0.5552532",
"0.55494124",
"0.5542827",
"0.5528156",
"0.551639",
"0.55114824",
"0.5500572",
"0.54953504",
"0.54953504",
"0.5488353",
"0.54867274",
"0.54849464",
"0.5484619",
"0.5483546",
"0.54749024",
"0.54745775",
"0.5470512",
"0.54686236",
"0.5467444",
"0.54646474",
"0.5457192",
"0.54555494",
"0.5442764",
"0.5433918",
"0.54322004",
"0.5418442",
"0.54174984",
"0.541073",
"0.5409027",
"0.54053134",
"0.5400765",
"0.5392112",
"0.5391929",
"0.539",
"0.53742296",
"0.5373157",
"0.5357639",
"0.53459907",
"0.53451395",
"0.53370017",
"0.53333473"
] | 0.7091695 | 0 |
Physically deletes the file from the file system | def delete_from_disk!
if disk_filename.present?
diskfile_s3 = diskfile
Rails.logger.debug("Deleting #{diskfile_s3}")
RedmicaS3::Connection.delete(diskfile_s3)
end
Redmine::Thumbnail.batch_delete!(
thumbnail_path('*').sub(/\*\.thumb$/, '')
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_file\n File.unlink file\n end",
"def delete_file\n File.unlink file\n end",
"def destroy_file\n File.delete full_file_path\n rescue\n end",
"def del\n File.delete(@file)\n end",
"def delete\n @file = nil\n # file.delete\n end",
"def delete!\n safe_close\n File.delete(@file_path)\n end",
"def destroy\n file&.delete\n end",
"def delete\n ::File.unlink(@path)\n end",
"def destroy_file\n FileUtils.rm(full_filename) if File.exists?(full_filename)\n end",
"def delete(filename); end",
"def delete\n File::unlink @path+\".lock\" rescue nil\n File::unlink @path+\".new\" rescue nil\n File::unlink @path rescue Errno::ENOENT\n end",
"def delete!\n exist!\n File.unlink @path\n @path = nil\n end",
"def destroy\n File.unlink(@resource[:path])\n Puppet.debug \"deleted file #{@resource[:path]}\"\n end",
"def delete\n File.delete(file_name)\n rescue\n # ignore\n end",
"def smb_file_rm(file)\n fd = smb_open(file, 'ro')\n fd.delete\nend",
"def destroy_dirty_file!(file)\n system(\"trashtrash #{file}\")\n end",
"def delete\n @lock.synchronize do\n ::File.unlink(@tmpfile) if ::File.exist?(@tmpfile)\n end\n end",
"def delete\n File::unlink @path+\".lock\" rescue nil\n File::unlink @path+\".new\" rescue nil\n File::unlink @path rescue nil\n end",
"def delete_file\n @file = []\n end",
"def destroy_file\n FileUtils.rm full_filename\n # remove directory also if it is now empty\n Dir.rmdir(File.dirname(full_filename)) if (Dir.entries(File.dirname(full_filename))-['.','..']).empty?\n rescue\n logger.info \"Exception destroying #{full_filename.inspect}: [#{$!.class.name}] #{$1.to_s}\"\n logger.warn $!.backtrace.collect { |b| \" > #{b}\" }.join(\"\\n\")\n end",
"def delete\n Modeles::File.delete @fileInTable.id\n @errors = nil\n @fileInTable = nil\n @path = nil\n @user = nil\n @group = nil\n @userRights = nil\n @groupRights = nil\n @othersRights = nil\n end",
"def remove_storage_file\n FileUtils.rm(file_path)\n end",
"def delete_file(file)\n delete_attachment(file)\n end",
"def delete_from_disk; end",
"def delete_file\n begin\n File.delete(stored_file_path)\n rescue => e\n logger.error(\"Could not delete #{stored_file_path}. Ignored.\")\n logger.error(e)\n end\n end",
"def delete\n FileUtils.rm(self.path) if exists?\n end",
"def delete_file(basepath = MP3_STORAGE_PATH)\n FileUtils.rm_rf(\"#{basepath}/#{id}\")\n end",
"def destroy_file\n Qiniu::RS.delete(qiniu_config[:bucket_name], full_filename)\n end",
"def delete(filename)\n File.delete File.join(@base_path, filename)\n end",
"def destroy_file\n db_file.destroy if db_file\n end",
"def delete_file \n #pp \"deleting file_asset: path is\" + full_filepath\n File.delete(full_filepath) if File.exists?(full_filepath)\n end",
"def delete!\n return true unless File.exist?(path)\n FileUtils.rm(path)\n end",
"def delete_uploaded_file\r\n return unless file_exists?\r\n File.delete(full_path)\r\n remove_empty_directory\r\n @saved_full_path = nil\r\n end",
"def remove_content\n File.unlink(filename) if File.exist?(filename)\n end",
"def rm!( path )\r\n got = @ndev.rpc.file_delete( :path => path )\r\n return true if got.nil? # got no error\r\n # otherwise, there was an error, check output\r\n raise IOError, got.text\r\n end",
"def deleteFile(file_path)\n puts \"Delete file: \" + file_path.to_s\n File.delete(file_path) if File.exist?(file_path)\nend",
"def destroy\n File.delete(temp_path)\n end",
"def destroy_file\n object = self.class.bucket.objects.find(full_filename)\n object.destroy\n end",
"def cleanup\n FileUtils.rm_f(@path)\n delete\n end",
"def delete\n begin\n uy_connection.delete(@path)\n true\n rescue Exception => e\n # If the file's not there, don't panic\n nil\n end\n end",
"def close\n FileUtils.rm_r(path)\n end",
"def drop\n File.unlink @file if File.exist?(@file)\n self\n end",
"def delete\n path = @p.path\n File::unlink path\n end",
"def remove(filename); end",
"def purge\n ::FileUtils.rm(@fname)\n end",
"def remove!\n with_callbacks(:remove) do\n delete_file\n @file = nil\n @cache_id = nil\n end\n end",
"def rm_file(file)\n @files.delete(file.path)\n end",
"def rm\n FileUtils.rm path if File.exist?(path)\n end",
"def delete_file(filename)\r\n DeleteFile.new(filename)\r\n end",
"def destroy_file\n start_ssh do |ssh|\n ssh.exec!(\"rm #{e full_filename}\")\n dir = File.dirname(full_filename)\n ssh.exec!(\"find #{e dir} -maxdepth 0 -empty -exec rm -r {} \\\\;\")\n dir = File.dirname(dir)\n ssh.exec!(\"find #{e dir} -maxdepth 0 -empty -exec rm -r {} \\\\;\")\n end\n end",
"def delete_file\n return false if !@file\n FileUtils.rm @file if File.file? @file\n return true\n end",
"def rm_file(file)\n @files.delete(file.path)\n end",
"def delete_file(path)\n \n puts \"Sending path via MCollective Files client\"\n @mc.delete(:path => path)\n printrpcstats\n \n end",
"def remove file\n file.delete\n @files -= [file]\n end",
"def delete\n File.delete(header_file_full_path)\n File.delete(data_file_full_path)\n end",
"def delete_file(no_raise: true)\n __debug_items(binding)\n return if destroyed? || attached_file.nil?\n file_attacher.destroy\n file_attacher.set(nil)\n rescue => error\n log_exception(error, __method__)\n re_raise_if_internal_exception(error)\n raise error unless no_raise\n end",
"def rm(file)\n cmd_exec(\"rm -rf #{file}\")\n end",
"def delete\n FileUtils.remove_entry_secure(@directory)\n ObjectSpace.undefine_finalizer(self)\n rescue Errno::ENOENT\n end",
"def delete(name)\n File.delete(path(name))\n end",
"def deleteFile(path)\n File.delete(path) if File.exist?(path)\nend",
"def destroy\n remove_files(@path + \"*\")\n end",
"def deleteUploadFile\n\n filepath = Rails.root.join(path, file_name)\n\n if File.exist? filepath \n File.delete filepath\n end\n\n end",
"def delete_file( path )\n # removes a file at path\n connection.delete( path )\n last_ftp_command_ok?\n end",
"def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend",
"def file_delete(node, file)\n _out, _local, _remote, code = node.test_and_store_results_together(\"rm #{file}\", 'root', 500)\n code\nend",
"def delete_firmware_file(file)\n response = request(:delete, \"/devmgr/v2/firmware/upload/#{file}\")\n status(response, 204, 'Failed to delete firmware file')\n end",
"def rm path\n end",
"def destroy\n Rails.logger.debug {\"destroying gridfs file #{@id}\"}\n if persisted?\n Photo.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\n end\n end",
"def delete_file(filename)\n begin\n File.delete(filename)\n rescue Exception => e\n puts e.message\n end\n end",
"def remove_file(path)\n FileUtils.rm_f(path)\n end",
"def remove_file(path)\n FileUtils.rm_f(path)\n end",
"def remove_created_file(file_path)\n if file_path && File.exists?(file_path)\n File.delete(file_path)\n end\nend",
"def destroy(file=@file)\n if self.legacy?\n return unless @password.send(:rm_file, self) \n end\n super\n end",
"def delete_file name\n filename = \"#{RAILS_ROOT}/#{@@dir}/#{name}\" \n File.delete filename if File.exists? filename\n end",
"def RenDeletingFiles\n\t#arquivo = File.new(\"arquivo1.txt\", \"w\")\n\t#arquivo.close()\n\t#File.delete(\"arquivo1.txt\")\nend",
"def remove_file!\n begin\n super\n rescue Fog::Storage::Rackspace::NotFound\n self.file = nil\n self.send(:write_attribute, :file, nil)\n end\n end",
"def destroy\n\t\tFile.delete @filepath\n\t\t@data_base = nil\n\t\t@data_base.freeze\n\t\tself.freeze\n\tend",
"def remove_file\n\n @source_files_id = params[:source] + '_files'\n @source = TaliaCore::Source.find(N::URI.from_encoded(params[:source]))\n\n TaliaFile.find(params[:talia_file_uri]).destroy\n end",
"def unlock!\n FileUtils.rm_f @path\n end",
"def _delete(uploaded_file, context)\n remove(uploaded_file, context)\n end",
"def remove_file(file)\n File.delete(file) if File.exist?(file)\nend",
"def remove_created_file(file_path)\n File.delete(file_path) if file_path && File.exist?(file_path)\nend",
"def _delete(path)\n forbidden unless is_allowed? path\n not_found unless File.exists? path\n forbidden unless File.file? path\n File.delete path\n ok\n rescue SystemCallError => e\n logger.error e.message\n internal_server_error\n end",
"def delete (fei)\n\n fei_path = compute_file_path(fei)\n\n #ldebug { \"delete() for #{fei.to_debug_s} at #{fei_path}\" }\n\n File.delete(fei_path)\n end",
"def delete\n if stat.directory?\n FileUtils.rm_rf(file_path)\n else\n ::File.unlink(file_path)\n end\n ::File.unlink(prop_path) if ::File.exist?(prop_path)\n @_prop_hash = nil\n NoContent\n end",
"def delete\n FileUtils.rm_rf(to_s)\n self\n end",
"def delete_file storage_file_path\n @bucket.file(storage_file_path).delete if @bucket.file storage_file_path\n end",
"def delete_file storage_file_path\n @bucket.file(storage_file_path).delete if @bucket.file storage_file_path\n end",
"def deleteFile(filePath, dryRun)\n #N Without this, the deletion command won't be run at all\n sshAndScp.deleteFile(filePath, dryRun)\n end",
"def unlink\n self.class.unlink(@path)\n end",
"def deleteEssence\n \n begin\n \n # Gets @filename and @path\n getPathAndFilename \n name = @filename \n filepath = @path\n puts \"filepath: \" + filepath \n puts \"filename: \" + name\n \n # Find the device \n device = User.find_by_username(params[:username]).devices.find_by_dev_name(params[:devicename])\n \n # Essence can't be deleted from a virtual container\n if device.dev_type == \"virtual_container\"\n render :text => \"Error: Essence can't be deleted from a virtual container'\", :status => 409\n return \n end\n \n file = nil\n if device != nil\n file = device.devfiles.find(:first, :conditions => [\"name = ? and path = ?\", name, filepath])\n if file == nil\n puts \"FILE NOT FOUND: \" + name\n render :text => \"Error. File's metadata can not be found.\", :status => 404\n return\n end\n \n if params[:blob_hash]\n blob = file.blobs.find(:first, :conditions => [\"blob_hash = ?\", params[:blob_hash]])\n else\n blob = file.blobs.find_by_follower_id(nil)\n end\n end\n \n # Checks that the file's and it's version's metadata can be found in database.\n if file == nil or blob == nil\n puts \"Blob not found for file: \" + name\n render :text => \"Error. File's metadata can not be found.\", :status => 404\n return\n end\n \n if blob.uploaded == false\n render :text => \"Error: Essence of the file was not on the server.\", :status => 409\n return\n end\n \n # Remove the fileupload entry\n fup = Fileupload.find_by_blob_id(blob.id)\n if fup != nil\n fup.destroy\n end\n \n # Update blob not to be uploaded and upload_requested to nil\n blob.update_attribute(:uploaded, false)\n blob.update_attribute(:upload_requested, nil)\n \n \n # Remove the actual essence\n deletepath = \"public/devfiles/\" + file.device_id.to_s + \"/\" + blob.blob_hash + \"_\" + file.name\n \n if File.exists?(deletepath)\n FileUtils.rm_f(deletepath)\n puts \"deleted the essence...\"\n else\n puts \"Essence not found and could not be deleted...\"\n end\n \n rescue => exp\n putsE(exp)\n render :text => \"There was an error when trying to delete the essence from the server\", :status => 409\n return\n end\n \n render :text => \"Essence of the file deleted from the server\", :status => 200\n return\n end",
"def destroy\n @file_version.destroy\n head :no_content\n end",
"def delete(id)\n file = get_file(id)\n delete_file(file) unless file.nil?\n end",
"def destroy!\r\n self.class.service_instance.delete_blob(path)\r\n end",
"def delete_rdf_file\n public_path = public_rdf_storage_path\n private_path = private_rdf_storage_path\n FileUtils.rm(public_path) if File.exist?(public_path)\n FileUtils.rm(private_path) if File.exist?(private_path)\n end",
"def remove!\n FileUtils.rm(File.join(remote_path, remote_file))\n end",
"def delete_file(f)\n #return false if !f.kind_of?(Fog::Storage::AWS::File) || !storage_provider.eql?(:aws)\n log \"Deleting: #{f.key}\"\n return f.destroy\n end",
"def cleanup\n File.delete(temp_file_path)\n end",
"def destroy\n @cell_automaton.destroy\n file_path = Rails.root.join(\"public\", \"cell_automatons\", \"#{current_user.id}\")\n file_name = file_path.to_s + \"/\" + @cell_automaton.id.to_s\n File.delete(\"#{file_name}.rb\")\n \n redirect_to cell_automatons_url, notice: 'Cell automaton was successfully destroyed.'\n end",
"def destroy\n @repo = Repository.find(params[:id])\n\n\t\t#REMOVE FILE FROM FILE SYSTEM AND DO A GIT commit\n\t\tif(FileUtils.rm(params[:path]))\n\t\t\t@git = GitHelper.init(@repo.path, current_user.email, current_user.name)\n\t\t\tGitHelper.commitAll(@git, \"Removed file :: #{params[:path]}\")\n\t\tend\n end",
"def deleteFile(filePath, dryRun)\n #N Without this, the required ssh command to delete a file won't be (optionally) executed.\n ssh(\"rm #{filePath}\", dryRun)\n end"
] | [
"0.8291966",
"0.8291966",
"0.8290286",
"0.8187562",
"0.8182364",
"0.8110053",
"0.8081748",
"0.8028514",
"0.78758156",
"0.78121144",
"0.76438564",
"0.7617306",
"0.7608394",
"0.76077527",
"0.75995857",
"0.7590742",
"0.7566985",
"0.75545263",
"0.74984485",
"0.7456708",
"0.7441654",
"0.7439378",
"0.74379766",
"0.7431566",
"0.74150455",
"0.7392359",
"0.7364883",
"0.7355727",
"0.73497605",
"0.7338732",
"0.7335005",
"0.73342746",
"0.7326359",
"0.7321085",
"0.7308251",
"0.7287524",
"0.7257893",
"0.7244802",
"0.7231275",
"0.7218445",
"0.72152215",
"0.7202046",
"0.71932334",
"0.7186028",
"0.71851057",
"0.71817166",
"0.71742",
"0.71542937",
"0.71445334",
"0.7133032",
"0.7124454",
"0.7110907",
"0.7066015",
"0.70611054",
"0.7050507",
"0.70497996",
"0.70466113",
"0.7036066",
"0.70342714",
"0.7008102",
"0.6999928",
"0.6999328",
"0.6991393",
"0.69754153",
"0.69754153",
"0.697536",
"0.6972241",
"0.6972175",
"0.6968708",
"0.69621676",
"0.69621676",
"0.6960143",
"0.694337",
"0.6931809",
"0.6898412",
"0.6888967",
"0.68866014",
"0.6879767",
"0.6878053",
"0.6857829",
"0.6855193",
"0.68473864",
"0.68351674",
"0.68242663",
"0.6815944",
"0.6811774",
"0.68078685",
"0.68078685",
"0.6797978",
"0.67901677",
"0.67815423",
"0.67805696",
"0.6766772",
"0.67558944",
"0.67472285",
"0.6746411",
"0.67242026",
"0.6719648",
"0.67152226",
"0.6711501",
"0.6705472"
] | 0.0 | -1 |
Extract the connection string for the rabbitmq service from the service information provided by Cloud Foundry in an environment variable. | def amqp_url
if not ENV['VCAP_SERVICES']
return {
:host => "localhost",
:port => 5672,
:username => "guest",
:password => "guest",
:vhost => "/",
}
end
services = JSON.parse(ENV['VCAP_SERVICES'], :symbolize_names => true)
url = services.values.map do |srvs|
srvs.map do |srv|
if srv[:label] =~ /^rabbitmq-/
srv[:credentials]
srv[:credentials][:heartbeat] = 20
return srv[:credentials]
else
[]
end
end
end.flatten!.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def amqp_url\n if not ENV['VCAP_SERVICES']\n return {\n :host => \"172.16.32.11\",\n :port => 5672,\n :username => \"guest\",\n :password => \"guest\",\n :vhost => \"/\",\n }\n end\n\n services = JSON.parse(ENV['VCAP_SERVICES'], :symbolize_names => true)\n url = services.values.map do |srvs|\n srvs.map do |srv|\n if srv[:label] =~ /^rabbitmq-/\n srv[:credentials]\n else\n []\n end\n end\n end.flatten!.first\nend",
"def myservices_environment_details_host\n ENV['ENV_DETAILS'].nil? ? 'esu2v871:9080' : ENV['ENV_DETAILS']\n end",
"def url\n @@url ||= (ENV[\"AMQP_URL\"] || \"amqp://guest:guest@localhost/\")\n end",
"def pull_request_host\n\t\tpull_request_where == 'jackrabbit' ? ALF_CFG['host'] : ALF_CFG[\"cedar_host\"]\n\tend",
"def bc_client_id\n ENV['BC_CLIENT_ID']\nend",
"def connection_string\n return @connection_params.values.compact.join(';')\n end",
"def read_env_address_and_port\n @sensu_address = ENV['SENSU_SOCKET_ADDRESS'] \\\n if ENV.key?('SENSU_SOCKET_ADDRESS')\n @sensu_port = ENV['SENSU_SOCKET_PORT'].to_i \\\n if ENV.key?('SENSU_SOCKET_PORT')\n end",
"def config\n uri = URI.parse(url)\n {\n :vhost => uri.path,\n :host => uri.host,\n :user => uri.user,\n :port => (uri.port || 5672),\n :pass => uri.password\n }\n rescue Object => e\n raise(\"invalid AMQP_URL: #{uri.inspect} (#{e})\")\n end",
"def container_env(engine)\n env = if @cluster.env_variables['PLATFORM'].include?('aws')\n {\n 'KUBECONFIG' => '/kubeconfig',\n\n 'BRIDGE_AUTH_USERNAME' => @cluster.config_file.admin_credentials[0],\n 'BRIDGE_AUTH_PASSWORD' => @cluster.config_file.admin_credentials[1],\n 'BRIDGE_BASE_ADDRESS' => 'https://' + @cluster.tectonic_console_url,\n 'BRIDGE_BASE_PATH' => '/'\n }\n else\n {\n 'KUBECONFIG' => '/kubeconfig',\n\n 'BRIDGE_AUTH_USERNAME' => @cluster.tectonic_admin_email,\n 'BRIDGE_AUTH_PASSWORD' => @cluster.tectonic_admin_password,\n 'BRIDGE_BASE_ADDRESS' => 'https://' + @cluster.tectonic_console_url,\n 'BRIDGE_BASE_PATH' => '/'\n }\n end\n\n return env.map { |k, v| \"-e #{k}='#{v}'\" }.join(' ').chomp if engine == 'docker'\n return env.map { |k, v| \"--set-env #{k}='#{v}'\" }.join(' ').chomp if engine == 'rkt'\n raise 'unknown container engine'\n end",
"def env_str\n @env_str ||= begin\n env = Rails.env\n env.include?('production') ? '' : env\n end\n end",
"def env_str\n @env_str ||= begin\n env = Rails.env\n env.include?('production') ? '' : env\n end\n end",
"def host\n ENV['CA_HOST'] || DEFAULT_HOST\n end",
"def connection_info\n ENV['DATABASE_URL']\n end",
"def haystack\n ENV['HUBBLE_ENDPOINT'] || config['haystack']\n end",
"def get_connection_string(url)\n conn = Utils.parse_connection_url(url)\n str = \"host=#{conn[:host]} dbname=#{conn[:db]}\"\n str << \" port=#{conn[:port]}\" if conn[:port].present?\n str << \" user=#{conn[:user]}\" if conn[:user].present?\n str << \" password=#{conn[:pass]}\" if conn[:pass].present?\n str\n end",
"def get_env_var key\n key = key.to_s\n exec(Beaker::Command.new(\"env | grep ^#{key}=\"), :accept_all_exit_codes => true).stdout.chomp\n end",
"def get_env_info\n sub = nil\n\n if ENV['AZURE_MANAGEMENT_CERTIFICATE'] ||\n ENV['AZURE_MANAGEMENT_ENDPOINT'] ||\n ENV['AZURE_SUBSCRIPTION_ID']\n then\n sub = Subscription.new\n sub.subscription_id = ENV['AZURE_SUBSCRIPTION_ID']\n sub.management_certificiate = ENV['AZURE_MANAGEMENT_CERTIFICATE']\n sub.management_endpoint = ENV['AZURE_MANAGEMENT_ENDPOINT']\n sub.source = \"environment variables\"\n end\n\n sub\n end",
"def calculate_dbhost\n owncloud_cookbook_config['dbhost'] =\n [\n owncloud_cookbook_config['dbhost'], owncloud_cookbook_config['dbport']\n ].join(':')\n end",
"def connection_url(connection)\n user_pass = connection.user ? \"#{connection.user}:XXXXXX@\" : \"\"\n protocol = params[\"ssl\"] ? \"amqps\" : \"amqp\"\n \"#{protocol}://#{user_pass}#{connection.host}:#{connection.port}#{connection.vhost}\"\n end",
"def connection_url(connection)\n user_pass = connection.user ? \"#{connection.user}:XXXXXX@\" : \"\"\n protocol = params[\"ssl\"] ? \"amqps\" : \"amqp\"\n \"#{protocol}://#{user_pass}#{connection.host}:#{connection.port}#{connection.vhost}\"\n end",
"def service\n URI.parse(@config.split('<')[0].split('->')[1])\n end",
"def envvar\n CircleCi.request(conf, \"#{base_path}/envvar\").get\n end",
"def read_rabbit_mq_service(opts = {})\n data, _status_code, _headers = read_rabbit_mq_service_with_http_info(opts)\n return data\n end",
"def storage_queue_host\n ENV['AZURE_STORAGE_QUEUE_HOST']\n end",
"def determine_url\n ENV[\"DATABASE_URL\"] || database_url_from_database_yml\n end",
"def storage_queue_host\n ENV[\"AZURE_STORAGE_QUEUE_HOST\"]\n end",
"def shell_environment\n { 'HOME' => ENV.fetch('HOME', '/var/lib/rabbitmq') }\nend",
"def config_for(environment=:development)\n if self.config.present?\n env_config = self.config[environment.to_s]\n else\n env_config = {\n 'host' => ENV['RIAK_HOST'],\n 'http_port' => ENV['RIAK_HTTP_PORT'],\n 'pb_port' => ENV['RIAK_PB_PORT']\n }\n end\n env_config\n end",
"def remote_database_config(db)\n env = rails_env || db\n config = capture \"cat #{latest_release}/config/database.yml\"\n database = YAML::load(config)\n return database[\"#{env}\"]['username'], database[\"#{env}\"]['password'], database[\"#{env}\"]['database'], database[\"#{env}\"]['host']\n end",
"def service_uri\n \"#{host}#{service_path}\"\n end",
"def db_config\n @db_config ||= begin \n raise \"ENV['#{env_prefix}_DATABASE_URL'] expected but not found!\" unless ENV[\"#{env_prefix}_DATABASE_URL\"]\n config = parse_db_uri(ENV[\"#{env_prefix}_DATABASE_URL\"])\n \n if ENV[\"#{env_prefix}_DATABASE_CA\"]\n config.merge!(db_configuration({\n :sslca => ENV[\"#{env_prefix}_DATABASE_CA\"],\n :sslcert => ENV[\"#{env_prefix}_DATABASE_CERT\"],\n :sslkey => ENV[\"#{env_prefix}_DATABASE_KEY\"],\n }))\n end\n \n config\n end\n end",
"def sql_database_management_endpoint\n ENV['AZURE_SQL_DATABASE_MANAGEMENT_ENDPOINT'] || \"#{SERVICE_MANAGEMENT_ENDPOINT}:8443/\"\n end",
"def test_url_from_environment\n pool_config = resolve_db_config :production, \"production\" => \"abstract://foo?encoding=utf8\"\n\n assert_equal({\n adapter: \"abstract\",\n host: \"foo\",\n encoding: \"utf8\"\n }, pool_config.configuration_hash)\n end",
"def getEnvVar\n if ENV['ENV'].nil?\n UI.user_error!(\"No 'ENV' environment variable set. Set it using `awsenv` config file. Must contain 'dev', 'qa' or 'prod' in value.\")\n end\n\n env_raw = /(dev|qa|prod)/.match(ENV.fetch('ENV', nil))[1]\n UI.important(\"ENVIRONMENT: #{env_raw}\")\n\n if env_raw.nil? || env_raw.length == 0\n UI.user_error!(\"Your 'ENV' environment variable is set but doesn't contain 'dev', 'qa' or 'prod' as value.\")\n end\n\n return env_raw\nend",
"def config\n $VHOST.config\n end",
"def host; config[:host]; end",
"def storage_connection_string\n ENV[\"AZURE_STORAGE_CONNECTION_STRING\"]\n end",
"def find_local\n find_connection(\"#{BackgrounDRb::BDRB_CONFIG[:backgroundrb][:ip]}:#{BackgrounDRb::BDRB_CONFIG[:backgroundrb][:port]}\")\n end",
"def configured_hostname\n running_config.scan(/hostname\\s*(\\S+)/).flatten.first\n end",
"def host\n @host ||= Chimps.config[:catalog][:host]\n end",
"def connection_string\n instance.primary_ip.split('://')[0] == 'unix' ? instance.primary_ip : \"tcp://#{instance.primary_ip}:2376\"\n end",
"def db_uri\n unless @db_uri # get the config from command line\n @db_uri = self.conf['db_url']\n end\n @db_uri\n end",
"def redis_host_name\n if is_zz?\n return app_config[:redis_host]\n end\n\n return @redis_host_name if @redis_host_name != nil\n\n instances = ey['environment']['instances']\n # assume solo machine\n @redis_host_name = this_host_name\n\n # not solo so see if we are db_master which\n # is where we host redis\n instances.each do |instance|\n if instance['role'] == 'db_master'\n @redis_host_name = instance['private_hostname']\n break\n end\n end\n @redis_host_name\n end",
"def bc_api_url\n ENV['BC_API_ENDPOINT'] || 'https://api.bigcommerce.com'\nend",
"def lookup_service_host\n # Allow manual overrides\n return config[:lookup_service_host] unless config[:lookup_service_host].nil?\n\n # Retrieve SSO service via RbVmomi, which is always co-located with the Lookup Service.\n vim = RbVmomi::VIM.connect @connection_options\n vim_settings = vim.serviceContent.setting.setting\n sso_url = vim_settings.select { |o| o.key == \"config.vpxd.sso.sts.uri\" }&.first&.value\n\n # Configuration fallback, if no SSO URL found for some reason\n ls_host = sso_url.nil? ? config[:vcenter_host] : URI.parse(sso_url).host\n debug(\"Using Lookup Service at: \" + ls_host)\n\n ls_host\n end",
"def uri_info\n services.map do |s|\n opts = s[:connection].connection\n {\n host: opts[:host],\n port: opts[:port],\n scheme: 'redis'\n }\n end\n end",
"def client_config\n cc = Settings.dig(:connection, connection_type)\n return cc unless host\n\n uhost = URI(host)\n cc.host = uhost.hostname\n cc.port = uhost.port\n cc.scheme = uhost.scheme\n cc\n end",
"def envvar\n CircleCi.request(@conf, \"/project/#{username}/#{project}/envvar\").get\n end",
"def get_config(config_name)\n raise ConfigNotFound, \"Environment variable #{config_name} not found !\" unless ENV[config_name]\n ENV[config_name]\n end",
"def env\n image = options[:image] || app\n config = api.get_config_vars(app).body\n\n config.keys.sort.each do |key|\n puts \"#{key}=#{config[key]}\"\n end\n end",
"def subdomain\n env[\"SERVER_NAME\"].match(/(.+)\\.#{::Service.this.domain}/)\n $1\n rescue Vidibus::Service::ConfigurationError\n unless env['PATH_INFO'] == '/connector'\n raise(ServiceError, 'This service has not been configured yet')\n end\n end",
"def docker_compose_container\n get_config(:docker_compose_container).to_s\n end",
"def environment_name(url = nil)\n url ||= self.url\n uri = URI(url)\n\n if (uri.host == 'localhost')\n if uri.port.nil?\n uri.host;\n else\n \"#{uri.host}:#{uri.port}\"\n end\n else\n name = case uri.host\n when /(?:origin-)?www\\d?(?:\\.pos)?(?:\\.siteb)?\\.([^\\.]+)(?:\\.fds)?\\.com/,\n /(?:m|m2qa1|mdev1|mockmacys|local)\\.([^\\.]+)(?:\\.fds)?\\.com/, # mobile env\n /([^\\.]+)\\.\\w+\\.\\w+\\.griddynamics\\.net/, # partial env\n /([^\\.]+)\\.stage2\\.cistages\\.fds/, # stage 2 env\n /([^\\-]+)-staging.bloomingdales\\.com/, #BCOM Heroku Staging Env\n /([^\\.]+).bloomingdales\\.com/, #BCOM Heroku Production Env\n /([^\\.]+)\\.cistages\\.fds/,\n /([^\\.]+)\\.macysbackstage\\.com/,\n /([^\\.]+)\\.herokuapp\\.com/,\n /([^\\.]+)\\.c4d\\.devops\\.fds\\.com/,\n /sstportal/\n Regexp.last_match.captures.first\n else\n raise URI::InvalidURIError, \"URI was not recognized: '#{url}'.\"\n end\n name\n end\n end",
"def environment\n @environment ||= ENV['HUBBLE_ENV'] || ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'\n end",
"def config\n system_config.send(service_name.to_sym) || []\n end",
"def get_environment ()\n service_data = query_for_services()\n return service_data[\"environment\"]\n end",
"def service_name\n if settings && settings[\"service_name\"].present?\n settings[\"service_name\"]\n else\n APP_CONFIG.global_service_name || \"Sharetribe\"\n end\n end",
"def service_name\n if settings && settings[\"service_name\"].present?\n settings[\"service_name\"]\n else\n APP_CONFIG.global_service_name || \"Sharetribe\"\n end\n end",
"def rabbitmq_id\n name\n end",
"def sb_namespace\n ENV['AZURE_SERVICEBUS_NAMESPACE']\n end",
"def env_config; end",
"def env_config; end",
"def env_config; end",
"def env_config; end",
"def get_environment\n if @environment.empty?\n \":\"\n else\n env = @environment.map { |key, value| %(#{key}=\"#{value}\") }\n \"export #{env.join(' ')}\"\n end\n end",
"def remote_database_config( db )\n remote_config = capture(\"cat #{shared_path}/config/database.yml\")\n database = YAML::load( remote_config )\n return database[\"#{db}\"]['username'], database[\"#{db}\"]['password'], database[\"#{db}\"]['database'], database[\"#{db}\"]['host']\n end",
"def setup_database_url_env\n ENV[\"DATABASE_URL\"] ||= begin\n # need to use a dummy DATABASE_URL here, so rails can load the environment\n scheme =\n if gem_is_bundled?(\"pg\")\n \"postgres\"\n elsif gem_is_bundled?(\"mysql\")\n \"mysql\"\n elsif gem_is_bundled?(\"mysql2\")\n \"mysql2\"\n elsif gem_is_bundled?(\"sqlite3\") || gem_is_bundled?(\"sqlite3-ruby\")\n \"sqlite3\"\n end\n \"#{scheme}://user:[email protected]/dbname\"\n end\n end",
"def get\n unless key = shift_argument\n error(\"Usage: heroku config:get KEY\\nMust specify KEY.\")\n end\n validate_arguments!\n\n vars = api.get_config_vars(app).body\n key, value = vars.detect {|k,v| k == key}\n if options[:shell] && value\n out = $stdout.tty? ? Shellwords.shellescape(value) : value\n display(\"#{key}=#{out}\")\n else\n display(value.to_s)\n end\n end",
"def get_env(key)\n\n end",
"def ca_cert_string\n @ca_cert_string ||= begin\n return nil if ENV['VCAP_SERVICES'].blank?\n\n JSON.parse(ENV['VCAP_SERVICES'])['a9s-elasticsearch'].first['credentials']['cacrt']\n end\n end",
"def env(key) \n str = key.to_s \n env?(str) ? ENV[str] : nil\n end",
"def get_remote_database(print_to_stdout)\n cleardb = api.get_config_vars(app).body[\"CLEARDB_DATABASE_URL\"]\n jawsdb = api.get_config_vars(app).body[\"JAWSDB_URL\"]\n\n if @@db == 'cleardb'\n puts \"Using ClearDB\" if print_to_stdout\n return cleardb\n elsif @@db == 'jawsdb'\n puts \"Using JawsDB\" if print_to_stdout\n return jawsdb\n elsif jawsdb && cleardb\n puts \"Error. Both CLEARDB_DATABASE_URL and JAWSDB_URL config vars are found. Please indicate which database to use with the --db parameter (values accepted: cleardb or jawsdb)\"\n return nil\n elsif cleardb\n puts \"Using ClearDB\" if print_to_stdout\n return cleardb\n elsif jawsdb\n puts \"Using JawsDB\" if print_to_stdout\n return jawsdb\n end\n\n return nil\n end",
"def drb_host\n instance.options[:drb_host]\n end",
"def drb_host\n instance.options[:drb_host]\n end",
"def get_information(env)\n connection_info = read_from_yaml_file(env)\n\n # is the user owns a hosting account, then use his credentials\n # to create a new site.\n if connection_info.nil? && env == 'hosting'\n connection_info = read_from_hosting\n end\n\n if connection_info.nil?\n raise \"No #{env.to_s} environment found in the config/deploy.yml file\"\n end\n\n connection_info = connection_info.with_indifferent_access\n\n if connection_info[:ssl] && !connection_info[:host].start_with?('https')\n connection_info[:host] = 'https://' + connection_info[:host]\n end\n\n connection_info\n end",
"def get_connection_hash\n case ENV.fetch(\"FUZZILY_ADAPTER\", \"sqlite3\")\n when \"postgresql\"\n {\n adapter: \"postgresql\",\n database: \"fuzzily_test\",\n host: \"127.0.0.1\",\n min_messages: \"warning\",\n username: \"postgres\",\n password: \"postgres\",\n }\n when \"mysql\"\n {\n adapter: \"mysql2\",\n database: \"fuzzily_test\",\n host: \"127.0.0.1\",\n username: \"root\"\n }\n when \"sqlite3\"\n {\n adapter: \"sqlite3\",\n database: DATABASE.to_s\n }\n end\nend",
"def consumer_nsqds\n @consumer_nsqds ||= ENV.fetch(\"NSQD_CONSUMERS\", \"\").split(/, ?|\\s+/).map(&:strip)\n end",
"def client_port\n host_settings['client_port']\nend",
"def docker_compose_project_name\n compose_project_name = ENV['COMPOSE_PROJECT_NAME']\n if compose_project_name.nil? || compose_project_name.empty?\n compose_project_name = \"rhd_#{ENV['rhd_test']}_testing\"\n end\n compose_project_name\n end",
"def docker_compose_project_name\n compose_project_name = ENV['COMPOSE_PROJECT_NAME']\n if compose_project_name.nil? || compose_project_name.empty?\n compose_project_name = \"rhd_#{ENV['rhd_test']}_testing\"\n end\n compose_project_name\n end",
"def get_box_hostname_from_config(node_config)\n \n box_hostname = concat_array( \n [\n node_config['lib']['key'],\n node_config['lib']['namespace'],\n node_config['variables'] && node_config['variables']['domain'] ? node_config['variables']['domain'] : ''\n ]\n )\n return box_hostname\nend",
"def get_value_from_dotenv(var)\n line=open('./.env') { |f| f.lines.find { |line| line.include?(var) } }\n line=line.chomp\n return line.split(\"=\").last.split(' ').first.tr('\"','')\nend",
"def remote_database_config(db)\n remote_config = capture(\"cat #{shared_path}/config/#{fetch(:db_file, 'mongoid.yml')}\")\n database = YAML::load(remote_config)\n return database[\"#{db}\"]['clients']['default']['username'], database[\"#{db}\"]['clients']['default']['password'], database[\"#{db}\"]['clients']['default']['database'], database[\"#{db}\"]['clients']['default']['hosts'][0]\n end",
"def get_client_name\n client_name = nil\n if env.present?\n Webmetrics::Config.client_matchers.each do |key, matcher|\n if matcher.respond_to?(:call) and matcher.call(env)\n client_name = key\n break\n end\n end\n end\n\n # return client name\n client_name || Webmetrics::Config.default_client\n end",
"def get_host\n @host\n end",
"def get(key)\n key = key.to_s\n %w(local_config app_config m2mhub_config).each do |config_key|\n if (config = @yaml_config[config_key])\n if config_key == 'app_config'\n next unless config = config[Rails.env.downcase]\n end\n if config.member?(key)\n return config[key]\n end\n end\n end\n nil\n end",
"def remote_database_config(db = rails_env)\n remote_config = capture(\"cat #{sync_db_remote_config}\")\n database = YAML::load(remote_config)\n database and database[\"#{db}\"]\n end",
"def env_key; end",
"def kestrel_config_by_name(name)\n connections = swiftype_config['kestrel_brokers'] || {}\n config = connections[name]\n critical(\"Unknown Kestrel broker: #{name}\") unless config\n return config.symbolize_keys\n end",
"def zookeeper_helper(url)\n # z = Zookeeper.new(\"149.165.170.7:2181\")\n # host_details= z.get(:path => url)\n # host_details=host_details[:data]\n # host_details=host_details.split(\":\")\n host_details=[ENV[\"RECOENGINE_SERVICE_PORT_8001_TCP_ADDR\"], ENV[\"RECOENGINE_SERVICE_PORT_8001_TCP_PORT\"]]\n host_details\n end",
"def get_docker_ip_address\n # first try to get the ip from docker-ip env\n if !ENV['DOCKER_IP'].to_s.empty?\n return ENV['DOCKER_IP']\n end\n\n if !ENV['DOCKER_HOST'].to_s.empty?\n \t\t# dockerhost set\n \t\thost = ENV['DOCKER_HOST'].dup\n \t\thost.gsub!(/tcp:\\/\\//, '')\n \t\thost.gsub!(/:\\d+/,'')\n\n \t\treturn host\n else\n return '127.0.0.1'\n \tend\n end",
"def host\n return @@nfg_urls['sandbox']['host'] if @use_sandbox\n @@nfg_urls['production']['host']\n end",
"def host\n @config.db_hostname\n end",
"def get_binding(keyset)\n environment = $environment\n myPublicIp = $myPublicIp\n myRoot = $myRoot\n myAZ = $myAZ\n myRegion = $myRegion\n myAppName = $myAppName\n credentials = @default_credentials ? @default_credentials : \"default\"\n\n# return MU::Config.global_bindings[keyset] if MU::Config.global_bindings[keyset]\n MU::Config.global_bindings[keyset] = binding\n MU::Config.global_bindings[keyset]\n end",
"def get_db_conf(env='development')\n Rails.configuration.database_configuration[env]\nend",
"def host\n conf['api']['host']\n end",
"def get_env(format, app, node = self.node)\n return '' unless node.attribute?(app)\n\n if node[app]['env'].nil?\n Chef::Log.info(\"Attribute 'env' for application '#{app}' is not defined!\")\n return ''\n end\n\n appenv = streamline_appenv(node[app]['env'])\n generate_config_part(format, 'settings', appenv)\n end",
"def node_environment(node_config)\n env = node_config['environment']\n (env.nil? || env.empty?) ? 'production' : env\nend",
"def config_value_for(key)\n heroku = get_heroku config_value_str(key), hide_stderr: true\n value = `#{heroku.command}`.strip\n value = nil if value == ''\n value\n end",
"def concierge_host\n context[:host]\n end"
] | [
"0.744864",
"0.64117",
"0.60329986",
"0.5871954",
"0.58560705",
"0.57894254",
"0.57065386",
"0.5627882",
"0.55615014",
"0.5546482",
"0.5546482",
"0.55334806",
"0.55314684",
"0.55079055",
"0.5474078",
"0.54584104",
"0.544193",
"0.54413456",
"0.542486",
"0.542486",
"0.54162025",
"0.53938746",
"0.53937805",
"0.53807044",
"0.5378692",
"0.5351806",
"0.5341503",
"0.5329901",
"0.5323146",
"0.5309613",
"0.52988595",
"0.5290769",
"0.5279869",
"0.5274314",
"0.5271219",
"0.5255788",
"0.5249704",
"0.52365315",
"0.52007025",
"0.51945525",
"0.51937574",
"0.5187434",
"0.5186652",
"0.51788133",
"0.5166912",
"0.51543933",
"0.51514333",
"0.51384676",
"0.51342374",
"0.51295114",
"0.50990224",
"0.5082804",
"0.5079894",
"0.5076858",
"0.5072085",
"0.5057948",
"0.5054015",
"0.5054015",
"0.50480956",
"0.504182",
"0.5037762",
"0.5037762",
"0.5037762",
"0.5037762",
"0.5025813",
"0.5024832",
"0.50227",
"0.5011131",
"0.50098246",
"0.5002398",
"0.49989486",
"0.49978018",
"0.4996163",
"0.4996163",
"0.49867636",
"0.49848464",
"0.4983812",
"0.49825305",
"0.49715048",
"0.49706998",
"0.49685428",
"0.49667335",
"0.49614653",
"0.49457577",
"0.4943211",
"0.4941748",
"0.4940697",
"0.49371535",
"0.49349356",
"0.49321568",
"0.49318907",
"0.49317923",
"0.49184874",
"0.491699",
"0.49168438",
"0.4912033",
"0.49049908",
"0.48965514",
"0.48958856",
"0.48952046"
] | 0.7228656 | 1 |
Opens a client connection to the RabbitMQ service, if one isn't already open. This is a class method because a new instance of the controller class will be created upon each request. But AMQP connections can be longlived, so we would like to reuse the connection across many requests. | def client
unless $client
u = amqp_url
conn = Bunny.new(u)
conn.start
$client = conn.create_channel
# We only want to accept one un-acked message
$client.prefetch(1)
end
$client
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client\n set_connection unless @client\n @client\n end",
"def connect\n @client = @client_class.new\n @client.connect\n \n begin\n yield\n ensure\n @client.close\n ActiveRecord::Base.verify_active_connections!\n end\n end",
"def client\n unless $client\n u = amqp_url\n puts u\n c = Bunny.new(u)\n c.start\n $client = c\n\n # We only want to accept one un-acked message\n $client.qos :prefetch_count => 1\n end\n $client\nend",
"def connect\n # backwards compatible code\n @host ||= ::Ragnar::Config.host\n @port ||= ::Ragnar::Config.port\n @connection = ::AMQP.connect({:host => @host, :port => @port})\n end",
"def start\n @stopped = false\n Thread.new(connect(read_loop_thread: false)) do |conn|\n Thread.abort_on_exception = true # Raising an unhandled exception is a bug\n loop do\n break if @stopped\n\n conn ||= connect(read_loop_thread: false)\n Thread.new do\n # restore connection in another thread, read_loop have to run\n conn.channel(1) # reserve channel 1 for publishes\n @subscriptions.each do |queue_name, no_ack, prefetch, wt, args, blk|\n ch = conn.channel\n ch.basic_qos(prefetch)\n ch.basic_consume(queue_name, no_ack: no_ack, worker_threads: wt, arguments: args, &blk)\n end\n @connq << conn\n end\n conn.read_loop # blocks until connection is closed, then reconnect\n rescue Error => e\n warn \"AMQP-Client reconnect error: #{e.inspect}\"\n sleep @options[:reconnect_interval] || 1\n ensure\n conn = nil\n end\n end\n self\n end",
"def connection\r\n @connectoin ||= HTTPClient.new\r\n end",
"def open(options={}, &block)\n begin\n # Call the appropriate client's open method.\n if self.client\n self.client.open(options)\n else\n if self.uri\n raise Retrieve::NoClientError,\n \"No client was registered to handle the \" +\n \"'#{self.uri.scheme}' scheme.\"\n else\n raise Retrieve::NoClientError,\n \"Cannot find a client without a URI scheme.\"\n end\n end\n if block\n # If we were supplied a block, yield to it, then close.\n yield self\n else\n self\n end\n ensure\n # Make sure we close if there's a block.\n self.close if block rescue nil\n end\n end",
"def client\n @client ||= client_for_host(brine_root_url || 'http://localhost:8080',\n logging: ENV['BRINE_LOG_HTTP'])\n end",
"def amqp_connect\n\n ocon = opt('connection')\n\n if BOSS.connection && ( ! ocon)\n BOSS.connection\n else\n Bunny.new(Ruote.keys_to_sym(ocon || {}))\n end\n end",
"def connect_amqp!\n username = config['rabbitmq']['username']\n password = config['rabbitmq']['password']\n host = config['rabbitmq']['host']\n port = config['rabbitmq']['port']\n vhost = config['rabbitmq']['vhost']\n\n puts \"connecting to amqp://#{username}:#{password}@#{host}:#{port}/#{vhost}\"\n connection = AMQP.connect(\"amqp://#{username}:#{password}@#{host}:#{port}/#{vhost}\")\n self.channel = AMQP::Channel.new(connection)\n\n # RingBase -> Invoca control queue\n control_channel_queue_name = config['control_channel_queue_name']\n self.control_queue = channel.queue(control_channel_queue_name, auto_delete: true)\n\n\n # Invoca -> RingBase update exchange\n update_exchange_name = config['update_exchange_name']\n self.update_exchange = channel.fanout(update_exchange_name)\n self.update_queue = channel.queue('', exclusive: true)\n update_queue.bind(update_exchange)\n end",
"def initialize\n @connection = Bunny.new(ENV['CLOUDAMQP_URL'] || ENV['AMQP_HOST'])\n @connection.start\n @channel = connection.create_channel\n @exchange = channel.topic(ENV['AMQP_EXCHANGE'] || ENV['SERVICE_NAME'])\n end",
"def client\n @client ||= Client.new\n end",
"def http_connection\n if @in_session\n establish_shared_connection\n else\n create_http_connection\n end\n end",
"def connection\n client.send(:connection)\n end",
"def client\n @@client ||= Orchestrate::Application::Connect.client\n end",
"def client\n @client || Client.connection\n end",
"def connection\n @connection = create_connection! unless connected?\n @connection\n end",
"def aquire_connection\n conn = if @connection_pool\n @connection_pool.aquire_connection\n else\n @connection\n end\n @status = nil unless conn.connected?\n conn\n end",
"def connection\n @connection ||= RestClient::Resource.new(api_uri.to_s)\n end",
"def create_channel\n AMQP::Channel.new(@amqp_client)\n end",
"def connect opts={}\n unless EM.reactor_running?\n Thread.new { EventMachine.run }\n sleep 0.5\n end\n @connection = AMQP.connect(opts)\n end",
"def start\n return if active?\n begin\n @subject.start\n rescue Errno::ECONNRESET\n raise EventSource::Protocols::Amqp::Error::ConnectionError,\n \"Connection failed. network error to: #{connection_params}\"\n rescue Bunny::TCPConnectionFailed\n raise EventSource::Protocols::Amqp::Error::ConnectionError,\n \"Connection failed to: #{connection_params}\"\n rescue Bunny::PossibleAuthenticationFailureError\n raise EventSource::Protocols::Amqp::Error::AuthenticationError,\n \"Likely athentication failure for account: #{@subject.user}\"\n rescue StandardError\n raise EventSource::Protocols::Amqp::Error::ConnectionError,\n \"Unable to connect to: #{connection_params}\"\n else\n sleep 1.0\n logger.info \"Connection #{connection_uri} started.\" if active?\n active?\n end\n end",
"def new_connection\n Connection.new(Backburner.configuration.beanstalk_url) { |conn| Backburner::Hooks.invoke_hook_events(self, :on_reconnect, conn) }\n end",
"def connect\n rabbit.transaction_short do\n choose_queue\n yield\n end\n end",
"def run\n logger.debug \"[Cottontail] Connecting to client\"\n @client = Bunny.new( *settings(:client) )\n @client.start\n\n logger.debug \"[Cottontail] Declaring exchange\"\n exchange = @client.exchange( *settings(:exchange) )\n\n logger.debug \"[Cottontail] Declaring queue\"\n queue = @client.queue( *settings(:queue) )\n\n routes.keys.each do |key| \n logger.debug \"[Cottontail] Binding #{key.inspect} to exchange\"\n queue.bind( exchange, :key => key )\n end\n\n logger.debug \"[Cottontail] Entering subscribe loop\"\n subscribe! queue\n rescue => e\n @client.stop if @client\n reset!\n\n logger.error \"#{e.class}: #{e.message}\\n\\t#{e.backtrace.join(\"\\n\\t\")}\"\n\n # raise when no retries are defined\n raise( e, caller ) unless settings(:retries)\n\n logger.debug \"[Cottontail] Going to retry in #{settings(:delay_on_retry)} seconds...\"\n sleep settings(:delay_on_retry) if settings(:delay_on_retry)\n retry\n end",
"def connection\n @connection ||= make_connection\n end",
"def connect\n connection = Bunny.new(connection_attributes.\n merge(:pass => connection_attributes[:password]))\n connection.start\n \n # NOTE: This is a super undocumented feature that you will probably know\n # about only from reading AMQP specs. If we want to subscribe, but abort\n # subscription before all messages are read, we need to turn this on,\n # otherwise the server will go on and deliver all remaining messages in\n # turn. See also the :ack => true flag in ServerTransport... 23Dez09, ksc\n connection.qos\n\n connection\n end",
"def connection\n # Establish connection (if not established yet).\n if not @conn then\n # Connect.\n @conn =\n if use_secure_connection? then Socket_IO.open(\"https://socketio.mtgox.com/socket.io\")\n else Socket_IO.open(\"http://socketio.mtgox.com/socket.io\"); end\n # Subscribe to ticker.\n @conn.send Socket_IO::JSONMsg[\n \"op\" => \"mtgox.subscribe\",\n \"type\" => \"ticker\"\n ]\n end\n #\n return @conn\n end",
"def client\n @client ||= Client.new(configuration)\n end",
"def attempt_connection\n @connection_future = Concurrent::Future.new do\n Roby::DRoby::Logfile::Client.new(host, port)\n end\n connection_future.execute\n end",
"def client\n @client ||= self.class.client\n end",
"def connect\n @connection_pool.get_connection\n end",
"def conn\n @conn ||= connect\n if block_given?\n yield @conn\n else\n @conn\n end\n rescue *HttpExceptions\n @conn = connect\n return if defined?(once)\n once = true && retry\n end",
"def connect\n Connection.new\n end",
"def client\n @client = Gluby::Client.instance unless @client\n @client\n end",
"def client\n @client ||= Client.current\n end",
"def open_connection\n if @sslca then\n @db = Mysql2::Client.new(\n host: @host, \n username: @username, \n password: @password, \n port: @port, \n database: @database_name,\n sslca: @sslca)\n else\n @db = Mysql2::Client.new(\n host: @host, \n username: @username, \n password: @password, \n port: @port, \n database: @database_name)\n end\n end",
"def connection\n @connection ||= begin\n Faraday.new(:url => \"http://#{configuration.server}:#{configuration.port}\", &connection_block)\n end\n end",
"def http_connection\n (@shared_tcp_connection ||\n (@in_session && establish_shared_connection) ||\n create_http_connection)\n end",
"def open\n @socket = TCPSocket.new(@uri.host, @uri.port)\n\n @ssl = OpenSSL::SSL::SSLSocket.new(@socket, @ssl_context)\n @ssl.sync_close = true\n @ssl.hostname = @uri.hostname\n @ssl.connect\n\n @http = HTTP2::Client.new\n @http.on(:frame) do |bytes|\n @ssl.print(bytes)\n @ssl.flush\n end\n\n @main_queue = Threading::DispatchQueue.new\n @work_queue = Threading::DispatchQueue.new\n @requests = Threading::Counter.new\n @exceptions = Queue.new\n @worker_thread = start_worker_thread!\n end",
"def connection_for(client_name)\n connect unless connection\n return nil if client_name == :all\n @clients[client_name] ||= case client_name\n when :resque\n connect_for_resque\n else\n connect_for_any\n end\n end",
"def prepare_connection(env)\n env.trace 'init connection'\n @env = env\n init_queue\n initialize_connection env # Defined in each endpoint\n @application.stat_connection_open\n @channel = env.params['channel']\n logger.debug \"Connected to channel #{@channel}\"\n subscribe @channel\n end",
"def ensure_connected\n client = @connection.client(self)\n \n # If this connection has expired somehow, try to get another one.\n unless connected?(client)\n @connection.drop(self)\n client = @connection.client(self)\n end\n\n fail \"Bad Connection\" unless connected?(client)\n\n client\n end",
"def establish_connection\n end",
"def connection\n @connection ||= if authenticated?\n RestClient::Resource.new(api_uri.to_s, @username, @password)\n else\n RestClient::Resource.new(api_uri.to_s)\n end\n end",
"def request(*args, &blk)\n (@client ||= connect).request(*args, &blk)\n end",
"def set_up_channel\n amqp_conn = Bunny.new\n amqp_conn.start\n channel = amqp_conn.create_channel\nend",
"def client\n Exchange::GemLoader.new('redis').try_load unless defined?(::Redis)\n @client ||= ::Redis.new(:host => config.host, :port => config.port)\n end",
"def connection\n client.connection\n end",
"def spawn_connection\n connect\n end",
"def connection\n @connection ||= Faraday.new(url: PriceHubble.configuration.base_url,\n &method(:configure))\n end",
"def get_client(client_class = ::Elarian::BaseClient)\n @default_client ||= client_class.new(connection_credentials)\n on_error = lambda do |error|\n puts \"Error occurred #{error}\"\n disconnect_and_stop_loop\n end\n @default_client.on(:error, on_error)\n connect(@default_client)\n @default_client\n end",
"def initialize(prefetch: nil, connection_name: nil)\n @configuration = Pwwka.configuration\n connection_options = {automatically_recover: false}.merge(configuration.options)\n connection_options = {client_properties: {connection_name: connection_name}}.merge(connection_options) if connection_name\n\n begin\n @connection = Bunny.new(configuration.rabbit_mq_host, connection_options)\n @connection.start\n rescue => e\n logf \"ERROR Connecting to RabbitMQ: #{e}\", at: :error\n\n @connection.close if @connection\n raise e\n end\n\n begin\n @channel = @connection.create_channel\n @channel.on_error do |ch, method|\n logf \"ERROR On RabbitMQ channel: #{method.inspect}\"\n end\n rescue => e\n logf \"ERROR Opening RabbitMQ channel: #{e}\", at: :error\n @connection.close if @connection\n raise e\n end\n\n if prefetch\n @channel.prefetch(prefetch.to_i)\n end\n end",
"def connect\n @connection_manager.connect\n return self\n end",
"def initialize(params = {})\n @params = params\n @bunny_options = RabbitMQOptions.new(params)\n @rabbit = RabbitMQClient.new(@bunny_options.to_hash)\n\n end",
"def connection_manager\n @connection_manager ||= TOAMQP::ConnectionManager.new\n end",
"def connect\n @connection.open\n end",
"def open_connection\n # FIXME il timeout serve solamente nella versione tcp\n # FIXME perchè utilizzare un'istanza di classe? non sarebbe meglio avere un metodo che genera il transport\n # e successivamente viene utilizzato sempre quello?\n Timeout.timeout @timeout do\n case @transport\n when :tcp\n @connection = KonoEppClient::Transport::TcpTransport.new(server, port)\n when :http\n @connection = KonoEppClient::Transport::HttpTransport.new(server, port,\n ssl_version: ssl_version,\n cookie_file: \"#{@tag.downcase}.cookies.pstore\"\n )\n end\n end\n end",
"def connect\n EM.run do\n client = Faye::WebSocket::Client.new(@url)\n reconnect_url = nil\n\n client.on :message do |msg|\n message_received(client, msg)\n end\n\n client.on :open do |e|\n OutputLogger.logger.info 'Connection Opened!'\n end\n\n client.on :close do |e|\n OutputLogger.logger.info 'Connection closed, trying to reconnect.'\n\n reconnect\n end\n\n client.on :error do |e|\n OutputLogger.logger.error e.inspect\n end\n\n client.on 'transport:down' do |e|\n OutputLogger.logger.info 'Connection down.'\n end\n\n client.on 'transport:up' do |e|\n OutputLogger.logger.info 'Connection back up, trying to reconnect.'\n\n reconnect\n end\n end\n end",
"def connect!\n start_em\n @client.ensure_connect\n end",
"def conn\n @conn ||= Faraday.new(:url => uri.to_s) do |builder|\n builder.adapter self.class.adapter\n end\n end",
"def client\n @client ||= Client.new(config[:credentials], config[:end_point])\n end",
"def new\n @client = Client.new\n end",
"def new\n @client = Client.new\n end",
"def new\n @client = Client.new\n end",
"def with_connection\n connection_id = current_connection_id\n fresh_connection = true unless active_connection?\n yield connection\n ensure\n release_connection(connection_id) if fresh_connection\n end",
"def open(handler)\n puts '! Connection established' if handler.bot.debug\n end",
"def with_connection\n connection_id = current_connection_id\n fresh_connection = true unless active_connection?\n yield connection\n ensure\n release_connection(connection_id) if fresh_connection\n end",
"def with_connection\n connection_id = current_connection_id\n fresh_connection = true unless active_connection?\n yield connection\n ensure\n release_connection(connection_id) if fresh_connection\n end",
"def connection\n @connection ||= Bunny.new RabidMQ::Config.load_config\n end",
"def open()\n begin\n @my = Mysql.connect(@host, @user, @pw, @db)\n # Set the MySQL 'reconnect' flag -> Connection to the database will be\n # automatically maintained even if the Server closes it due to timed-out idle period\n @my.reconnect = true\n debug \" - Open Connection to MYSQL server - reconnect=#{@my.reconnect}\"\n @connected = true\n rescue MysqlError => e\n debug \"SQL error message: #{e.error}.\"\n end\n end",
"def client\r\n @client ||= APIController.new config\r\n end",
"def attempt_connection\n @connection_future = Concurrent::Future.new do\n connection_method.call\n end\n connection_future.execute\n end",
"def client_connection\n if respond_to?(:valid_raw_connection)\n valid_raw_connection\n elsif instance_variable_defined?(:@raw_connection)\n @raw_connection\n else\n @connection\n end\n end",
"def client\n @@client\n end",
"def on_open client\n c = controller(client)\n c.instance_variable_set(CLIENT_NAME, client)\n if client.protocol == :sse\n c.on_sse\n else\n c.on_open\n end\n end",
"def connection\n reconnect unless connected?\n if block_given?\n begin\n yield conn\n rescue Errno::ECONNRESET\n reconnect\n yield conn\n end\n else\n conn\n end\n end",
"def with(&client_block)\n @connection_block.call(client_block)\n end",
"def client\n @client_ ||= Libmagellan.new(MAGELLAN_HTTP_SERVER,\n consumer_key: MAGELLAN_CONSUMER_KEY,\n consumer_secret: MAGELLAN_CONSUMER_SECRET,\n client_version: MAGELLAN_CLIENT_VERSION,\n mqtt_host: MAGELLAN_MQTT_SERVER_HOST,\n mqtt_port: MAGELLAN_MQTT_SERVER_PORT)\n end",
"def connection\n @connection ||= Connection.new(nil)\n end",
"def new_connection; end",
"def connection\n @connection.connect\n end",
"def connection\n @connection ||= build_connection\n end",
"def open()\n begin\n @my = Mysql.connect(@host, @user, @pw, @db)\n # Set the MySQL 'reconnect' flag -> Connection to the database will be \n # automatically maintained even if the Server closes it due to timed-out idle period\n @my.reconnect = true\n debug \" - Open Connection to MYSQL server - reconnect=#{@my.reconnect}\"\n rescue MysqlError => e\n debug \"SQL error message: #{e.error}.\"\n end\t\n end",
"def init_client(uri, &on_init)\n connection = nil\n @connections_lock.synchronize {\n connection = @connections.find { |c|\n c.url == uri\n }\n if connection.nil?\n connection = EventMachine::WebSocketClient.connect(uri)\n connection.callback do\n on_init.call(connection)\n end\n @connections << connection\n # TODO sleep until connected?\n else\n on_init.call(connection)\n end\n }\n connection\n end",
"def client\n @client ||= Curl::Easy.new\n end",
"def connect\r\n if @opts[:threadsafe]\r\n @conns = Knj::Threadhandler.new\r\n \r\n @conns.on_spawn_new do\r\n self.spawn\r\n end\r\n \r\n @conns.on_inactive do |data|\r\n data[:obj].close\r\n end\r\n \r\n @conns.on_activate do |data|\r\n data[:obj].reconnect\r\n end\r\n else\r\n @conn = self.spawn\r\n end\r\n end",
"def recreate_client\n @http.close\n create_client\n end",
"def connect\n connection.tap do |c|\n c.start\n end\n end",
"def session(&block)\n raise ArgumentError, \"#{self.class}#shared_connection must be passed a block\" unless block_given?\n\n # Immediately open a TCP connection to the server and leave it open for\n # multiple requests.\n begin\n t0 = Time.now\n @in_session = true\n establish_shared_connection\n block.call\n rescue Timeout::Error\n elapsed = Time.now - t0\n ::NewRelic::Agent.logger.warn \"Timed out opening connection to collector after #{elapsed} seconds. If this problem persists, please see http://status.newrelic.com\"\n raise\n ensure\n @in_session = false\n close_shared_connection\n end\n end",
"def websocket_client\n @websocket_client ||= Faye::WebSocket::Client.new(rtm_start.websocket_url)\n end",
"def connect\n require 'osc-ruby' unless defined?(::OSC)\n port = additional_params[:port] || 3333\n @client = OSC::Server.new(port)\n super\n end",
"def connect(options = {})\n @connection ||= ::RbRouting::Connection.new(options)\n end",
"def new\n\t\t@client = Client.new\n\tend",
"def connect\n rabbit.transaction_short do\n @publisher = Rabbit::Publisher::Admin.new(rabbit.channel)\n yield\n end\n end",
"def connection(&blk)\n @connection ||= Connection.build endpoint.secret, &blk\n end",
"def open_connection\n # DataObjects::Connection.new(uri) will give you back the right\n # driver based on the DataObjects::URI#scheme\n connection = connection_stack.last || DataObjects::Connection.new(normalized_uri)\n connection_stack << connection\n connection\n end",
"def connection\n @connection || Connection.new\n end",
"def connection\n raise ConnectionNotEstablished unless @@connection\n return @@connection\n end",
"def create_tcp_client_channel(params)\n begin\n channel = SocketSubsystem::TcpClientChannel.open(client, params)\n if channel != nil\n return channel.lsock\n end\n return nil\n rescue ::Rex::Post::Meterpreter::RequestError => e\n case e.code\n when 10000 .. 10100\n raise ::Rex::ConnectionError.new\n end\n raise e\n end\n end"
] | [
"0.6548404",
"0.64997256",
"0.64857477",
"0.60641325",
"0.5975623",
"0.5912363",
"0.59114003",
"0.5911384",
"0.58854485",
"0.58396304",
"0.58234626",
"0.5794034",
"0.57795596",
"0.57611126",
"0.5743635",
"0.5731797",
"0.57183796",
"0.5711126",
"0.56997025",
"0.5653327",
"0.564179",
"0.563978",
"0.56366146",
"0.5631756",
"0.56227857",
"0.5605738",
"0.5601605",
"0.56011444",
"0.5592688",
"0.55803466",
"0.5565675",
"0.5565252",
"0.5564292",
"0.5561907",
"0.5559921",
"0.55523604",
"0.5540439",
"0.5536573",
"0.5536463",
"0.55176365",
"0.5515905",
"0.551412",
"0.5501736",
"0.5497874",
"0.5493878",
"0.54905015",
"0.54882693",
"0.54876655",
"0.5485247",
"0.5478965",
"0.5476352",
"0.5469366",
"0.5440159",
"0.54362595",
"0.5435695",
"0.5432155",
"0.5431082",
"0.54303056",
"0.54267037",
"0.5424896",
"0.5417303",
"0.5415604",
"0.54098207",
"0.54098207",
"0.54098207",
"0.540744",
"0.540323",
"0.5401605",
"0.5401605",
"0.53932077",
"0.5391905",
"0.5384814",
"0.53806436",
"0.53699774",
"0.5366484",
"0.5354365",
"0.53457797",
"0.5345483",
"0.53437704",
"0.53400946",
"0.5339798",
"0.53372294",
"0.5325941",
"0.5323936",
"0.53231496",
"0.53212863",
"0.5316787",
"0.5316779",
"0.5316074",
"0.5314144",
"0.5308576",
"0.53064585",
"0.5290384",
"0.5288775",
"0.52884865",
"0.5277563",
"0.5276183",
"0.5270838",
"0.5267649",
"0.52664524"
] | 0.6635481 | 0 |
Return the "nameless exchange", predefined by AMQP as a means to send messages to specific queues. Again, we use a class method to share this across requests. | def nameless_exchange
$nameless_exchange ||= client.default_exchange
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exchange\n @exchange ||= Exchange.new(@channel, :direct, AMQ::Protocol::EMPTY_STRING, :key => name)\n end",
"def exchange\n @exchange ||= channel.fanout(QUEUE_NAME)\n end",
"def exchange_naming\n @exchange_naming ||= if @worker_class\n Hightops::Naming::CommonExchange.new\n else\n Hightops::Naming::SharedExchange.new(tag: @tag)\n end\n end",
"def exchange\n Delayed::Job.tomqueue_manager.channel.exchange(@name,\n :type => @type,\n :auto_delete => @auto_delete,\n :durable => @durable\n )\n end",
"def exchange\n @exchange ||= Hightops.connection.channel.exchange(exchange_naming.to_s, type: exchange_type, durable: true)\n end",
"def rmq_exchange\n rabbitmq_conn = Helper.rabbitmq_connect\n rabbitmq_conn.create_channel.direct('amq.topic')\n end",
"def queue_name(name = nil)\n name || self.class.to_s.gsub('Consumer', '')\n end",
"def exchange\n @exchange ||= channel.topic(topic_name, durable: true)\n end",
"def exchange\n @exchange ||= produce_exchange\n end",
"def define_exchange(name, options = {})\n options = {\n durable: true,\n }.merge(options)\n @exchange = @channel.topic(name, options)\n end",
"def exchange\n @exchange ||= channel.fanout(exchange_name, durable: true)\n end",
"def exchange_name\n \"#{worker_class_name}_#{job_method}\".downcase\n end",
"def queue_key\n queue_name.is_a?(Proc) ? default_queue_key : queue_name.to_sym\n end",
"def exchange\n @exchange ||= channel.direct(exchange_name,\n durable: !Proletariat.test_mode?,\n auto_delete: Proletariat.test_mode?)\n end",
"def exchange\n @exchange ||= channel.topic(Proletariat.exchange_name,\n durable: !Proletariat.test_mode?)\n end",
"def exchange_type\n @exchange_type ||= @worker_class ? :direct : :topic\n end",
"def exchange\n\n opt('exchange') || [ 'direct', '', {} ]\n #\n # defaults to the \"default exchange\"...\n end",
"def instantiate_exchange\n\n Thread.current['_boss_amqp_exchange'] ||= begin\n\n exc = exchange\n type, name, options = exc\n\n raise ArgumentError.new(\n \"couldn't determine exchange from #{exc.inspect}\"\n ) unless name\n\n exchange_opts = (options || {}).each_with_object({}) { |(k, v), h|\n h[k.to_sym] = v\n }\n\n Bunny::Exchange.new(channel, type.to_sym, name, exchange_opts)\n end\n end",
"def name\n @queue_string\n end",
"def bind(exchange, opts = {}, &block)\n @channel.once_open do\n self.once_name_is_available do\n queue_bind(exchange, (opts[:key] || opts[:routing_key] || AMQ::Protocol::EMPTY_STRING), (opts[:nowait] || block.nil?), opts[:arguments], &block)\n end\n end\n\n self\n end",
"def queue( name )\n Qup::Adapter::Kestrel::Queue.new( @addr, name )\n end",
"def queue(queue_name)\n @queues[queue_name]\n end",
"def name\n @queue.name\n end",
"def queue_name\n raise 'queue_name must be ovewritten by the child class'\n end",
"def queue_name\n raise 'queue_name must be ovewritten by the child class'\n end",
"def name\n @queue.queue_name\n end",
"def bind_queue_to_exchange\n queue.bind(exchange)\n end",
"def sqs_queue(queue_name)\n SQSQueue.new(queue_name)\n end",
"def bind_exchange_to_queue(channel, exchange_in_name, queue_name)\n exchange_source = channel.fanout(exchange_in_name)\n queue_output = channel.queue(queue_name) \n queue_output.bind(exchange_source)\n return queue_output\nend",
"def queue\n @queue ||= channel.queue(queue_name)\n end",
"def sender(queue_name, opts={}, &blk)\n create(queue_name, :sender, opts, &blk)\n end",
"def queue\n @queue ||= channel.queue(generate_queue_name, exclusive: true)\n end",
"def exchange_name\n \"#{Proletariat.exchange_name}_retry\"\n end",
"def queue_for(method, queue_name)\n @_queue_names ||= {}\n @_queue_names[method] = queue_name\n end",
"def queue( name, &block )\n destination( name, :queue, @queues, &block )\n end",
"def define_sending_method(name)\n self.class.send(:define_method, name) do |*args|\n @queue.send_message build_method_call(name, *args)\n end\n end",
"def bind_exchange_to_exchange(channel, exchange_in_name, queue_name, exchange_out_name)\n exchange_source = channel.fanout(exchange_in_name)\n queue_current = channel.queue(queue_name)\n queue_current.bind(exchange_source)\n exchange_output = channel.fanout(exchange_out_name)\n return queue_current, exchange_output\nend",
"def bind_queue(name, options = {})\n raise Traffiq::NoExchangeError.new if @exchange.nil?\n\n options = {\n durable: true,\n auto_delete: false,\n }.merge(options)\n\n @channel.queue(name, options)\n .bind(@exchange, routing_key: name)\n end",
"def register_exchange(name, options={})\n name = name.to_s\n raise ConfigurationError.new(\"exchange #{name} already configured\") if exchanges.include?(name)\n exchanges[name] = options.symbolize_keys.merge(:type => :topic, :durable => true, :queues => [])\n end",
"def queue\n\n @queue ||= channel.queue(*(opt('queue') || [ '' ]))\n end",
"def find_exchange(name)\n @exchanges[name]\n end",
"def queue(name)\n if @@reset_next\n Aws.empty_connection_pools!\n @sqs = nil\n @@reset_next = false\n @sqs_queues = {}\n end\n\n @sqs_queue_urls[name] ||= sqs.get_queue_url(queue_name: name).queue_url\n @sqs_queues[name] ||= Aws::SQS::Queue.new(url: @sqs_queue_urls[name], client: sqs)\n end",
"def with_queue_control\n TorqueBox::ServiceRegistry.lookup(\"jboss.messaging.default\") do |server|\n yield server.management_service.get_resource(\"jms.queue.#{_dump(nil)}\")\n end\n end",
"def mock_queue(name=nil)\n MockQueue.new(name || \"anonymous-#{rand(2**32).to_s(16)}\")\n end",
"def create_queues\n queue\n exchange\n end",
"def queue_key\n result = queue_name\n result = try(:arguments).presence && result.call if result.is_a?(Proc)\n result&.to_sym\n end",
"def delivery_method\n @delivery_method || @default_delivery_method || :thread_queue\n end",
"def exchange_alias\n return @exchange_alias\n end",
"def job_queue_name\n 'email'\n end",
"def job_queue_name\n 'email'\n end",
"def send_message(queue_name_or_url, msg)\n Adapter.send_message queue_url(queue_name_or_url), msg\n end",
"def queue\n # Probably should be a UUID in the real world\n @queue ||= channel.queue(self.object_id.to_s)\n end",
"def queue(queue = 'default')\n get_queue(queue)\n end",
"def exchange(name, type, durable: true, auto_delete: false, internal: false, arguments: {})\n @exchanges.fetch(name) do\n with_connection do |conn|\n conn.channel(1).exchange_declare(name, type, durable: durable, auto_delete: auto_delete,\n internal: internal, arguments: arguments)\n end\n @exchanges[name] = Exchange.new(self, name)\n end\n end",
"def handle_mq_transport(input_name, policy) # :nodoc:\n if policy[:transport] == TRANSPORT_MQ\n if !Orocos::MQueue.available?\n raise InvalidMQTransportSetup, \"cannot select the MQueue transport as it is not built into the RTT\"\n end\n # Go on to the validation steps\n elsif !Orocos::MQueue.available?\n return policy.dup\n elsif !Orocos::MQueue.auto?\n return policy.dup\n elsif policy[:transport] != 0\n return policy.dup # explicit transport chosen, and it is not MQ\n end\n\n Orocos.info do\n \"#{full_name} => #{input_name}: using MQ transport\"\n end\n updated_policy = Hash[size: 0, data_size: 0].\n merge(policy).\n merge(transport: TRANSPORT_MQ)\n\n queue_length, message_size = updated_policy.values_at(:size, :data_size)\n if queue_length == 0\n queue_length = MQ_RTT_DEFAULT_QUEUE_LENGTH\n end\n\n if Orocos::MQueue.auto_sizes? && message_size == 0\n size = max_marshalling_size\n if !size\n if policy[:transport] == TRANSPORT_MQ\n raise InvalidMQTransportSetup, \"MQ transport explicitely selected, but the message size cannot be computed for #{self}\"\n end\n\n if Orocos::MQueue.warn?\n Orocos.warn \"the MQ transport could be selected, but the marshalling size of samples from the output port #{full_name}, of type #{type.name}, is unknown, falling back to auto-transport\"\n end\n return policy.dup\n end\n\n Orocos.info do\n \"#{full_name} => #{input_name}: MQ data_size == #{size}\"\n end\n message_size = size\n end\n\n if Orocos::MQueue.validate_sizes?\n valid = Orocos::MQueue.valid_sizes?(queue_length, message_size) do\n \"#{full_name} => #{input_name} of type #{type.name}: \"\n end\n\n if !valid\n if policy[:transport] == TRANSPORT_MQ\n raise InvalidMQTransportSetup, \"MQ transport explicitely selected, but the current system setup does not allow to create a MQ of #{queue_length} messages of size #{message_size}\"\n end\n\n if Orocos::MQueue.warn?\n Orocos.warn \"the MQ transport could be selected, but the marshalling size of samples (#{policy[:data_size]}) is invalid, falling back to auto-transport\"\n end\n return policy.dup\n end\n end\n\n updated_policy[:data_size] = message_size\n updated_policy\n end",
"def queue\n @handle.queue_name if @handle\n end",
"def queue(queue_name, &block)\n q = create_queue(queue_name)\n block.call(q) if block\n q\n end",
"def queue_key\n super || default_queue_key\n end",
"def item_name\n \"#{queue_name},#{h_or_s},#{center.center}\"\n end",
"def exchange\n raise \"This is an abstract class. Override exchange method in descendant class\"\n end",
"def queue(*args)\n @queue = args.first unless args.empty?\n (@queue || :default).to_s\n end",
"def stub_retrieving_named_queues\n allow_any_instance_of(AWS::SQS::QueueCollection).to receive(:named).with(an_instance_of(String)).and_return(mocked_queue)\n end",
"def queue\n @queue ||= QueueManager.fetch(@name,@visibility)\n end",
"def messages_queue\n $messages_queue ||= client.queue(\"messages\", :durable => true, :auto_delete => false)\nend",
"def request_queue_name(name)\n \"fluffle.requests.#{name}\"\n end",
"def publish(msg, exchange_name, routing={})\n ch = @connection.create_channel\n exchange = MarchHare::Exchange.new(ch, exchange_name, symbolize(@opts[:exchanges][exchange_name])) \n exchange.publish(msg, routing_key: routing[:routing_key], properties: { persistent: @opts[:message_persistent] }) if @connection.open?\n ch.close\n end",
"def bind_exchange(exchange_name, async_api_subscribe_operation)\n operation_bindings =\n async_api_subscribe_operation.bindings.amqp.symbolize_keys || {}\n channel_proxy.bind_queue(\n @subject.name,\n exchange_name,\n { routing_key: operation_bindings[:routing_key] }\n )\n logger.info \"Queue #{@subject.name} bound to exchange #{exchange_name}\"\n rescue Bunny::NotFound => e\n raise EventSource::Protocols::Amqp::Error::ExchangeNotFoundError,\n \"exchange #{name} not found. got exception #{e}\"\n end",
"def queue(queue_name, create = true, visibility = nil, &block)\n queues(queue_name) do |queues|\n queue = queues.map do |queue|\n queue.name == queue_name ? queue : nil\n end.compact.first\n if queue\n block.call(queue)\n else\n if queue.nil?\n if create\n req_hash = @interface.generate_request(\n 'CreateQueue', \n 'QueueName' => queue_name,\n 'DefaultVisibilityTimeout' => RightAws::SqsGen2Interface::DEFAULT_VISIBILITY_TIMEOUT\n )\n \n EventMachineAWS.async_http_request(req_hash, RightAws::SqsGen2Interface::SqsCreateQueueParser) do |result|\n #TODO: <?xml version=\\\"1.0\\\"?>\\n<ErrorResponse xmlns=\\\"http://queue.amazonaws.com/doc/2008-01-01/\\\"><Error><Type>Sender</Type><Code>AWS.SimpleQueueService.QueueDeletedRecently</Code><Message>You must wait 60 seconds after deleting a queue before you can create another with the same name.</Message><Detail/></Error><RequestId>5c70ccd9-d3a0-4f90-9161-8c50ee0fc4e8</RequestId></ErrorResponse>\"\n block.call(Queue.new(self, result))\n end\n else\n block.call(nil)\n end\n else\n block.call(queue)\n end\n end\n end\n end",
"def zeromq_request name,\n endpoint = \"ipc://#{IPCDIR}/#{name}.ipc\",\n **opts,\n &block\n h = grand_pusher ZMQ::REQ, name, endpoint, **opts, &block\n end",
"def publish_to(exname, message, opts={})\n EventMachine.schedule {\n ex = amq.exchanges[exname] || raise(\"Undefined exchange name : #{exname}\")\n case ex.type\n when :topic\n unless opts.has_key? :key\n opts[:key] = '*'\n end\n end\n ex.publish(Serializer.instance.marshal(message), opts)\n }\n end",
"def channel\n\n Thread.current['_boss_amqp_channel'] ||= amqp_connect.create_channel\n end",
"def overload_amqp\n require MOQUEUE_ROOT + \"moqueue/overloads\"\n end",
"def method_name(queue)\n queue.split(\"__\").last\n end",
"def register_binding(queue_name, options={})\n name = queue_name.to_s\n opts = options.symbolize_keys\n exchange = (opts[:exchange] || name).to_s\n key = (opts[:key] || name).to_s\n (bindings[name] ||= []) << {:exchange => exchange, :key => key}\n register_exchange(exchange) unless exchanges.include?(exchange)\n queues = exchanges[exchange][:queues]\n queues << name unless queues.include?(name)\n end",
"def rabbitmq_id\n name\n end",
"def request(exchange_name, value)\n exchange_name = \"amq.topic\"\n\n key = value.delete(:routing_key)\n msg = YAML.dump(value)\n exchange = @amq.topic(exchange_name)\n exchange.publish(msg, :routing_key => key)\n end",
"def mock_queue(queue_name)\n data[queue_name]\n end",
"def waiting_queue_name\n @waiting_queue_name\n end",
"def default_queue\n @queues[nil]\n end",
"def mock_exchange(opts={})\n MockExchange.new(opts)\n end",
"def queue_bind(exchange, routing_key = AMQ::Protocol::EMPTY_STRING, nowait = false, arguments = nil, &block)\n nowait = true unless block\n exchange_name = if exchange.respond_to?(:name)\n exchange.name\n else\n\n exchange\n end\n\n @connection.send_frame(AMQ::Protocol::Queue::Bind.encode(@channel.id, @name, exchange_name, routing_key, nowait, arguments))\n\n if !nowait\n self.append_callback(:bind, &block)\n @channel.queues_awaiting_bind_ok.push(self)\n end\n\n # store bindings for automatic recovery, but BE VERY CAREFUL to\n # not cause an infinite rebinding loop here when we recover. MK.\n binding = { :exchange => exchange_name, :routing_key => routing_key, :arguments => arguments }\n @bindings.push(binding) unless @bindings.include?(binding)\n\n self\n end",
"def [](name)\n delivery_methods[name.to_sym]\n end",
"def exchange_server\n return @exchange_server\n end",
"def bind(exchange, routing_key = AMQ::Protocol::EMPTY_STRING, nowait = false, arguments = nil, &block)\n nowait = true unless block\n exchange_name = if exchange.respond_to?(:name)\n exchange.name\n else\n\n exchange\n end\n\n @connection.send_frame(Protocol::Queue::Bind.encode(@channel.id, @name, exchange_name, routing_key, nowait, arguments))\n\n if !nowait\n self.append_callback(:bind, &block)\n\n # TODO: handle channel & connection-level exceptions\n @channel.queues_awaiting_bind_ok.push(self)\n end\n\n self\n end",
"def queue_for(num)\n \"#{queue}.#{num}\"\n end",
"def publish(message, name)\n logger.debug \"AMQP publishing `#{message}` to exchange `#{name}`\"\n publish_channel.fanout(name, :auto_delete => true).publish(message)\n end",
"def set_exchangeName (exchangeName)\n\t\texchangeMarketNames = {\"nasdaq\" => \"NMS\", \"dowjones\" => \"DJI\", \"sp\" => \"SNP\"}\n\t\texchangeMarketSymbols = {\"NMS\" => \"^IXIC\", \"DJI\" => \"^DJI\", \"SNP\" => \"^GSPC\"}\n\t\tself.exchangeName = exchangeName\n\t\tself.exchangeSymbol = exchangeMarketSymbols[exchangeMarketNames[exchangeName]]\n\tend",
"def queues\n @channel.queues\n end",
"def exchange_names(*names)\n @_exchange_names ||= []\n @_exchange_names += names.flatten.map(&:to_s)\n\n if @_exchange_names.empty?\n return [ ::ActionSubscriber.config.default_exchange ]\n else\n return @_exchange_names.compact.uniq\n end\n end",
"def create_queue(messenger, priority, options)\n name = create_queue_name(@logical_queue_name, priority)\n unless channel = AMQP::Channel.new(messenger.connection,\n DEFAULT_CHANNEL_OPTS.\n merge({prefetch: DEFAULT_PREFETCH}))\n raise AgniError,\n \"Unable to obtain a channel from AMQP instance at #{amqp_url}\"\n end\n # Get a handle to the default exchange. The default exchange\n # automatically binds messages with a given routing key to a\n # queue with the same name, eliminating the need to create\n # specific direct bindings for each queue.\n queue = channel.queue(name, DEFAULT_QUEUE_OPTS.\n merge(options))\n\n exchange = channel.default_exchange\n # Each 'queue' in the queue array is a hash. Here's how each\n # hash is laid out:\n {\n priority: priority,\n name: name,\n channel: channel,\n queue: queue,\n exchange: exchange\n }\n end",
"def personal_queue\n unless (local_queues = self.queues).empty?\n local_queues[0]\n end\n end",
"def subscribe_queue(name, opts = {})\n # TBD: here and analogously; only push in self and dynamically call native_client?(:mq)\n R8QueueMQ.new(self, name, opts)\n end",
"def message_delivered(name)\n fail NotImplementedError\n end",
"def [](queue_name_or_url)\n self.new queue_url(queue_name_or_url)\n end",
"def default_sender\n DEFAULT_SENDER\n end",
"def url_for queue_name, options = {}\n client_opts = {}\n client_opts[:queue_name] = queue_name\n client.get_queue_url(client_opts.merge(options))[:queue_url]\n 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 mock_queue!(queue_name)\n mock_queue(queue_name) or raise NotFound.new\n end",
"def name\n ClassMailer.name\n end",
"def queue_deliver(queue, msg_or_msgs, options = {})\n raise NotImplementedError\n end"
] | [
"0.71571606",
"0.69197667",
"0.69132215",
"0.6878598",
"0.67331624",
"0.66694117",
"0.6640302",
"0.65081716",
"0.6435617",
"0.63132995",
"0.63131285",
"0.6174846",
"0.6174287",
"0.61472934",
"0.61418843",
"0.61348796",
"0.6104031",
"0.60709494",
"0.60395527",
"0.60332364",
"0.602058",
"0.6008105",
"0.59781",
"0.5961131",
"0.5961131",
"0.59357256",
"0.5931424",
"0.59227425",
"0.59132165",
"0.5889495",
"0.58179414",
"0.5815705",
"0.5796881",
"0.579149",
"0.5780885",
"0.57560015",
"0.5746082",
"0.5738668",
"0.57325107",
"0.56827605",
"0.56736267",
"0.56374073",
"0.5631966",
"0.55738986",
"0.5565805",
"0.5563546",
"0.55573875",
"0.5529214",
"0.5522131",
"0.5522131",
"0.5494678",
"0.54911476",
"0.5488209",
"0.548489",
"0.54718006",
"0.54633904",
"0.5449648",
"0.5448689",
"0.54406416",
"0.5437745",
"0.5427758",
"0.5425421",
"0.5400254",
"0.53895444",
"0.53807664",
"0.5366999",
"0.5346986",
"0.5343982",
"0.534219",
"0.5326356",
"0.53244334",
"0.5316279",
"0.53135985",
"0.53132033",
"0.5290578",
"0.52844566",
"0.5280807",
"0.5277535",
"0.52772576",
"0.52688247",
"0.52394265",
"0.5238354",
"0.5235508",
"0.52293664",
"0.52278775",
"0.52231836",
"0.520888",
"0.5204951",
"0.5188441",
"0.51675576",
"0.5158183",
"0.5157659",
"0.5148479",
"0.5147973",
"0.51456606",
"0.5137566",
"0.51360655",
"0.513543",
"0.5114719",
"0.50902253"
] | 0.6661251 | 6 |
Return a queue named "messages". This will create the queue on the server, if it did not already exist. Again, we use a class method to share this across requests. | def messages_queue
$messages_queue ||= client.queue("messages", :durable => true, :auto_delete => false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_message_counting_queue\n\t\t@queue ||= begin\n\t\t\tself.log.debug \"Creating the message-counting queue.\"\n\t\t\tchannel = Symphony::Queue.amqp_channel\n\t\t\tchannel.queue( self.task_class.queue_name, passive: true, prefetch: 0 )\n\t\tend\n\n\t\tunless @queue.channel.open?\n\t\t\tself.log.info \"Message-counting queue's channel was closed: resetting.\"\n\t\t\tSymphony::Queue.reset\n\t\t\t@queue = nil\n\t\tend\n\n\t\treturn @queue\n\trescue Bunny::NotFound, Bunny::ChannelAlreadyClosed\n\t\tself.log.info \"Child hasn't created the queue yet; deferring\"\n\t\tSymphony::Queue.reset\n\n\t\treturn nil\n\tend",
"def queue\n @queue ||= channel.queue(queue_name)\n end",
"def queue\n @queue ||= channel.queue(generate_queue_name, exclusive: true)\n end",
"def message_queue\n @message_queue ||= Hash.new do |hash, key|\n hash[key] = []\n end\n end",
"def queue( name )\n Qup::Adapter::Kestrel::Queue.new( @addr, name )\n end",
"def sqs_queue(queue_name)\n SQSQueue.new(queue_name)\n end",
"def queue(queue = 'default')\n get_queue(queue)\n end",
"def queue\n @queue ||= QueueManager.fetch(@name,@visibility)\n end",
"def set_message_queue\n @message_queue = MessageQueue.find(params[:id])\n end",
"def queue\n\n @queue ||= channel.queue(*(opt('queue') || [ '' ]))\n end",
"def queued_message\n @queued_message ||= self.id ? QueuedMessage.where(:message_id => self.id, :server_id => @database.server_id).first : nil\n end",
"def queue(queue_name)\n @queues[queue_name]\n end",
"def queue\n # Probably should be a UUID in the real world\n @queue ||= channel.queue(self.object_id.to_s)\n end",
"def personal_queue\n unless (local_queues = self.queues).empty?\n local_queues[0]\n end\n end",
"def create_message(queue_name, message_text, options = {})\n query = {}\n\n unless options.empty?\n query[\"visibilitytimeout\"] = options[:visibility_timeout] if options[:visibility_timeout]\n query[\"messagettl\"] = options[:message_ttl] if options[:message_ttl]\n query[\"timeout\"] = options[:timeout].to_s if options[:timeout]\n end\n\n uri = messages_uri(queue_name, query)\n body = Serialization.message_to_xml(message_text, options[:encode])\n\n response = call(:post, uri, body, {}, options)\n Serialization.queue_messages_from_xml(response.body, options[:decode])\n end",
"def create_or_find_queue(sqs, name)\n sqs.queues.named(name)\n rescue AWS::SQS::Errors::NonExistentQueue\n sqs.queues.create(name)\n end",
"def index\n @message_queues = MessageQueue.all\n end",
"def peek_messages(queue_name, options = {})\n number_of_messages = 1\n number_of_messages = options[:number_of_messages] if options[:number_of_messages]\n\n query = { \"peekonly\" => \"true\", \"numofmessages\" => number_of_messages.to_s }\n query[\"timeout\"] = options[:timeout].to_s if options[:timeout]\n\n options[:request_location_mode] = Azure::Storage::Common::RequestLocationMode::PRIMARY_OR_SECONDARY\n uri = messages_uri(queue_name, query, options)\n response = call(:get, uri, nil, {}, options)\n\n messages = Serialization.queue_messages_from_xml(response.body, options[:decode])\n messages\n end",
"def queue(message); end",
"def create_queues\n queue\n exchange\n end",
"def with_queue_control\n TorqueBox::ServiceRegistry.lookup(\"jboss.messaging.default\") do |server|\n yield server.management_service.get_resource(\"jms.queue.#{_dump(nil)}\")\n end\n end",
"def mock_queue(name=nil)\n MockQueue.new(name || \"anonymous-#{rand(2**32).to_s(16)}\")\n end",
"def setup_queue\n queue = Queue.find self.queue_name\n unless queue\n queue = Queue.create _id: self.queue_name\n end\n end",
"def queues(options = {})\n Azure::Queue::QueueService.new(default_client(options))\n end",
"def queue\n @queue ||= Queue.new\n end",
"def queue(name)\n if @@reset_next\n Aws.empty_connection_pools!\n @sqs = nil\n @@reset_next = false\n @sqs_queues = {}\n end\n\n @sqs_queue_urls[name] ||= sqs.get_queue_url(queue_name: name).queue_url\n @sqs_queues[name] ||= Aws::SQS::Queue.new(url: @sqs_queue_urls[name], client: sqs)\n end",
"def get_messages(queue_name, options = {})\r\n raise WAZ::Queues::OptionOutOfRange, {:name => :num_of_messages, :min => 1, :max => 32} if (options.keys.include?(:num_of_messages) && (options[:num_of_messages].to_i < 1 || options[:num_of_messages].to_i > 32))\r\n raise WAZ::Queues::OptionOutOfRange, {:name => :visibility_timeout, :min => 1, :max => 7200} if (options.keys.include?(:visibility_timeout) && (options[:visibility_timeout].to_i < 1 || options[:visibility_timeout].to_i > 7200))\r\n content = execute(:get, \"#{queue_name}/messages\", options, {:x_ms_version => \"2009-09-19\"})\r\n doc = REXML::Document.new(content)\r\n messages = []\r\n REXML::XPath.each(doc, '//QueueMessage/') do |item|\r\n message = { :message_id => REXML::XPath.first(item, \"MessageId\").text,\r\n :message_text => REXML::XPath.first(item, \"MessageText\").text,\r\n :dequeue_count => REXML::XPath.first(item, \"DequeueCount\").nil? ? nil : REXML::XPath.first(item, \"DequeueCount\").text.to_i,\r\n :expiration_time => Time.httpdate(REXML::XPath.first(item, \"ExpirationTime\").text),\r\n :insertion_time => Time.httpdate(REXML::XPath.first(item, \"InsertionTime\").text) }\r\n\r\n # This are only valid when peek-locking messages\r\n message[:pop_receipt] = REXML::XPath.first(item, \"PopReceipt\").text unless REXML::XPath.first(item, \"PopReceipt\").nil?\r\n message[:time_next_visible] = Time.httpdate(REXML::XPath.first(item, \"TimeNextVisible\").text) unless REXML::XPath.first(item, \"TimeNextVisible\").nil?\r\n messages << message\r\n end\r\n return messages\r\n end",
"def enqueue(queue_name, message_payload, ttl = 604800)\r\n payload = \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?><QueueMessage><MessageText>#{message_payload}</MessageText></QueueMessage>\"\r\n execute(:post, \"#{queue_name}/messages\", { :messagettl => ttl }, { 'Content-Type' => 'application/xml', :x_ms_version => \"2009-09-19\"}, payload)\r\n end",
"def build_queue(queue_name)\n QC::Queue.new(queue_name)\n end",
"def queue_name(name = nil)\n name || self.class.to_s.gsub('Consumer', '')\n end",
"def create_queue(queue_name, default_visibility_timeout=nil)\n self.new\\\n Adapter.create_queue(\n queue_name,\n default_visibility_timeout\n )['CreateQueueResponse']['CreateQueueResult']['QueueUrl']\n end",
"def name\n @queue_string\n end",
"def create_queue(name)\n params = {}\n params['QueueName'] = name\n result = make_request('CreateQueue', nil, params)\n\n unless result.include?('Error')\n queue_url = result['CreateQueueResult'][0]['QueueUrl'][0]\n return AWS::SQS::Queue.new(name, queue_url, self)\n else\n raise Exception, \"Amazon SQS Error Code: \" + result['Error'][0]['Code'][0] +\n \"\\n\" + result['Error'][0]['Message'][0]\n end\n end",
"def getMessagesFromSQS()\n sqs = Aws::SQS::Client.new\n queue = sqs.create_queue({:queue_name=>@queuename})\n \n poller = Aws::SQS::QueuePoller.new(queue.queue_url)\n poller.poll(idle_timeout: 20) do |msg|\n @queue << msg\n while(true)\n if(@queue.length() < @noOfThreads)\n break\n end\n end\n end\n @run = false\nend",
"def queue(queue_name, create = true, visibility = nil, &block)\n queues(queue_name) do |queues|\n queue = queues.map do |queue|\n queue.name == queue_name ? queue : nil\n end.compact.first\n if queue\n block.call(queue)\n else\n if queue.nil?\n if create\n req_hash = @interface.generate_request(\n 'CreateQueue', \n 'QueueName' => queue_name,\n 'DefaultVisibilityTimeout' => RightAws::SqsGen2Interface::DEFAULT_VISIBILITY_TIMEOUT\n )\n \n EventMachineAWS.async_http_request(req_hash, RightAws::SqsGen2Interface::SqsCreateQueueParser) do |result|\n #TODO: <?xml version=\\\"1.0\\\"?>\\n<ErrorResponse xmlns=\\\"http://queue.amazonaws.com/doc/2008-01-01/\\\"><Error><Type>Sender</Type><Code>AWS.SimpleQueueService.QueueDeletedRecently</Code><Message>You must wait 60 seconds after deleting a queue before you can create another with the same name.</Message><Detail/></Error><RequestId>5c70ccd9-d3a0-4f90-9161-8c50ee0fc4e8</RequestId></ErrorResponse>\"\n block.call(Queue.new(self, result))\n end\n else\n block.call(nil)\n end\n else\n block.call(queue)\n end\n end\n end\n end",
"def create\n @message_queue = MessageQueue.new(message_queue_params)\n\n respond_to do |format|\n if @message_queue.save\n format.html { redirect_to @message_queue, notice: 'Message queue was successfully created.' }\n format.json { render :show, status: :created, location: @message_queue }\n else\n format.html { render :new }\n format.json { render json: @message_queue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_queue\n return @queue unless @queue.nil?\n\n Domo::Queue::Redis::JobQueue.active_queue(@redis_client, @dataset_id, @stream_id, pipeline_id)\n end",
"def [](queue_name_or_url)\n self.new queue_url(queue_name_or_url)\n end",
"def get_current_queue\n log_everything(\"Get current queue\")\n craft_firebase_command(\"minesweeper/queue.json\")\nend",
"def queue\n @queue ||= SizedQueue.new @queue_size\n end",
"def set_queue\n self.add_queue(queue_name) do |metadata, payload|\n log.info(\"Message received with the routing key: #{metadata.routing_key}\")\n log.debug(\"Processing message with routing key: '#{metadata.routing_key}' and payload: #{payload}\")\n s2_resource = s2_resource(payload)\n route_message(metadata, s2_resource)\n end\n end",
"def messages\n @messages ||= EbanqApi::Messages.new(self)\n end",
"def create_queue(messenger, priority, options)\n name = create_queue_name(@logical_queue_name, priority)\n unless channel = AMQP::Channel.new(messenger.connection,\n DEFAULT_CHANNEL_OPTS.\n merge({prefetch: DEFAULT_PREFETCH}))\n raise AgniError,\n \"Unable to obtain a channel from AMQP instance at #{amqp_url}\"\n end\n # Get a handle to the default exchange. The default exchange\n # automatically binds messages with a given routing key to a\n # queue with the same name, eliminating the need to create\n # specific direct bindings for each queue.\n queue = channel.queue(name, DEFAULT_QUEUE_OPTS.\n merge(options))\n\n exchange = channel.default_exchange\n # Each 'queue' in the queue array is a hash. Here's how each\n # hash is laid out:\n {\n priority: priority,\n name: name,\n channel: channel,\n queue: queue,\n exchange: exchange\n }\n end",
"def mq(server=@server)\n @mqs[server] ||= MQ.new(amqp_connection).prefetch(1)\n end",
"def retrieve_message(q)\n WMQ::QueueManager.connect(@connection_options) do |qmgr|\n qmgr.open_queue(:q_name => q.name, :mode => :input) do |queue|\n\n get_options = q.get_options.dup\n wmq_message = WMQ::Message.new\n \n if queue.get(get_options.merge(:message => wmq_message))\n return Message.new(wmq_message, q.name)\n else \n return nil\n end\n end\n end\n end",
"def get_messages(project_id, queue_name, opts = {})\n \n # verify the required parameter 'project_id' is set\n raise \"Missing the required parameter 'project_id' when calling get_messages\" if project_id.nil?\n \n # verify the required parameter 'queue_name' is set\n raise \"Missing the required parameter 'queue_name' when calling get_messages\" if queue_name.nil?\n \n\n # resource path\n path = \"/{project_id}/queues/{queue_name}/messages\".sub('{format}','json').sub('{' + 'project_id' + '}', project_id.to_s).sub('{' + 'queue_name' + '}', queue_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'n'] = opts[:'n'] if opts[:'n']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['oauth_token']\n response = Swagger::Request.new(:GET, path, @host, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :token => token}).make.body\n obj = MessageList.new() and obj.build_from_hash(response)\n end",
"def fetch_mail_queue(options = {})\n server.perform_request('fetch_mail_queue', options.merge(:\"api.version\" => 1))\n end",
"def action(queue_name)\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n -f #{[Conn[:host_api], 'queues', Conn[:vhost], queue_name].join('/')} | jq '.messages_ready'`\n end",
"def callback_queue\n @callback_queue ||= MessageQueue.new.tap do\n @queue_id = SecureRandom.uuid\n ObjectSpace.define_finalizer(@queue_id, proc do\n cleanup_callback_queue\n end)\n end\n end",
"def create_queue(name, options = {})\n request({\n 'Action' => 'CreateQueue',\n 'QueueName' => name,\n :parser => Fog::Parsers::AWS::SQS::CreateQueue.new\n }.merge!(options))\n end",
"def create_queue(name, options = {})\n request({\n 'Action' => 'CreateQueue',\n 'QueueName' => name,\n :parser => Fog::Parsers::AWS::SQS::CreateQueue.new\n }.merge!(options))\n end",
"def name\n @queue.name\n end",
"def default_queue\n @queues[nil]\n end",
"def monitor_queue\n @monitor_queue ||= sqs.queue('monitor')\n return @monitor_queue\n end",
"def queues\n @channel.queues\n end",
"def queue\n @queue ||= produce_queue\n end",
"def queues(prefix = nil, &block)\n req_hash = @interface.generate_request('ListQueues', 'QueueNamePrefix' => prefix)\n EventMachineAWS.async_http_request(req_hash, RightAws::SqsGen2Interface::SqsListQueuesParser) do |result|\n block.call(result.map{|name| Queue.new(self, name)})\n end\n end",
"def queue\n @handle.queue_name if @handle\n end",
"def queue\n JenkinsApi::Client::BuildQueue.new(self)\n end",
"def queue\n JenkinsApi::Client::BuildQueue.new(self)\n end",
"def create\n if is_runasdomain\n profile = \"--profile=#{@resource[:profile]}\"\n else\n profile = ''\n end\n entries = @resource[:entries].join '\", \"'\n if not entries.empty?\n entries = '[\"%s\"]' % entries\n else\n raise \"Array of entries can not be empty\"\n end\n durable = ToBooleanConverter.new(@resource[:durable]).to_bool\n extcmd = \"/extension=org.jboss.as.messaging\"\n if not execute(\"#{extcmd}:read-resource()\")[:result]\n bringUp \"Extension - messaging\", \"#{extcmd}:add()\"\n end\n syscmd = compilecmd \"/subsystem=messaging\"\n if not execute(\"#{syscmd}:read-resource()\")[:result]\n bringUp \"Subsystem - messaging\", \"#{syscmd}:add()\"\n end\n hornetcmd = compilecmd \"/subsystem=messaging/hornetq-server=default\"\n if not execute(\"#{hornetcmd}:read-resource()\")[:result]\n bringUp \"Default HornetQ\", \"#{hornetcmd}:add()\"\n end\n cmd = \"jms-queue #{profile} add --queue-address=#{@resource[:name]} --entries=#{entries} --durable=#{durable.to_s}\"\n bringUp \"JMS Queue\", cmd\n end",
"def enqueue_received_message(message,queue=received_message_queue)\n enqueue(message,queue)\n end",
"def href\n \"#{PATH_BASE}/#{@queue.name}/messages/#{@id}\"\n end",
"def subscribe_queue(name, opts = {})\n # TBD: here and analogously; only push in self and dynamically call native_client?(:mq)\n R8QueueMQ.new(self, name, opts)\n end",
"def list_queues()\n result = make_request('ListQueues')\n\n if result['ListQueuesResult']\n value = result['ListQueuesResult']\n elsif result['ListQueuesResponse']\n value = result['ListQueuesResponse']['ListQueuesResult']\n else\n value = nil\n end\n\n unless value.nil?\n return value\n else\n raise Exception, \"Amazon SQS Error Code: \" + result['Error'][0]['Code'][0] +\n \"\\n\" + result['Error'][0]['Message'][0]\n end\n end",
"def get_queues\n @gem_queue = get_queue 'gem'\n @md5_queue = get_queue 'md5'\n @sha512_queue = get_queue 'sha512'\n end",
"def messages\n @zk.children(full_queue_path)\n end",
"def request_queue_name(name)\n \"fluffle.requests.#{name}\"\n end",
"def bg_messages\n messages = bg_queue.listMessagesAsJSON('')\n logger.warn(\"messages = #{messages}\")\n messages\n end",
"def queues\n\t\t\t@queues ||= {}\n\t\tend",
"def receive_message(params={}, *attrs)\n self.class.receive_message(queue_url, params, *attrs).map do |val|\n Message.new self, val\n end\n end",
"def queue(queue_name, &block)\n q = create_queue(queue_name)\n block.call(q) if block\n q\n end",
"def create\n @message = Message.new(message_params)\n create_q(@message)\n end",
"def queue( name, &block )\n destination( name, :queue, @queues, &block )\n end",
"def create name, options = {}\n\n # SQS removed the default prefix to the visibility timeout option\n # in the 2011-10-01 update -- this allows us to not break existing\n # customers.\n if options[:default_visibility_timeout]\n options[:visibility_timeout] = \n options.delete(:default_visibility_timeout)\n end\n\n if policy = options[:policy]\n options[:policy] = policy.to_json unless policy.is_a?(String)\n end\n\n client_opts = {}\n client_opts[:queue_name] = name\n unless options.empty?\n client_opts[:attributes] = options.inject({}) do |attributes,(k,v)|\n attributes.merge(Core::Inflection.class_name(k.to_s) => v.to_s)\n end\n end\n\n response = client.create_queue(client_opts)\n\n Queue.new(response[:queue_url], :config => config)\n\n end",
"def receive_message(queue_name_or_url, params={}, *attrs)\n doc = Adapter.receive_message(\n queue_url(queue_name_or_url),\n params,\n *attrs\n )['ReceiveMessageResponse']['ReceiveMessageResult']\n doc ? doc['Message'] : []\n end",
"def find_available(worker_name, limit = 5, max_run_time = Worker.max_run_time)\n Delayed::Worker.queues.each_with_index do |queue, index|\n message = sqs.queues.named(queue_name(index)).receive_message\n\n return [Delayed::Backend::Sqs::Job.new(message)] if message\n end\n []\n end",
"def create_amqp_queue( prefetch_count=DEFAULT_PREFETCH )\n\t\texchange = self.class.amqp_exchange\n\t\tchannel = self.class.amqp_channel\n\t\tcreated_queue = false\n\t\tqueue = nil\n\n\t\tbegin\n\t\t\tqueue = channel.queue( self.name, passive: true )\n\t\t\tchannel.prefetch( prefetch_count )\n\t\t\tself.log.info \"Using pre-existing queue: %s\" % [ self.name ]\n\t\trescue Bunny::NotFound => err\n\t\t\tself.log.info \"%s; creating a new queue instead.\" % [ err.message ]\n\t\t\tcreated_queue = true\n\t\t\tchannel = self.class.reset_amqp_channel\n\t\t\tchannel.prefetch( prefetch_count )\n\n\t\t\tqueue = channel.queue( self.name, auto_delete: !self.persistent )\n\t\tend\n\n\t\tif self.always_rebind? || created_queue\n\t\t\tself.routing_keys.each do |key|\n\t\t\t\tself.log.info \" binding queue %s to the %s exchange with topic key: %s\" %\n\t\t\t\t\t[ self.name, exchange.name, key ]\n\t\t\t\tqueue.bind( exchange, routing_key: key )\n\t\t\tend\n\t\tend\n\n\t\treturn queue\n\tend",
"def relative_queue\n gcp_task\n .name\n .match(%r{/queues/([^/]+)})\n &.captures\n &.first\n &.sub(/^#{self.class.config.gcp_queue_prefix}-/, '')\n end",
"def queue_by_name(name)\n matched = nil\n queues.each_value { |queue| matched = queue if queue.name == name }\n matched\n end",
"def queue(blog_name, options = {})\n validate_options([:limit, :offset], options)\n get(blog_path(blog_name, 'posts/queue'), options)\n end",
"def queue() = @queue ||= CommandQueue.new",
"def list_queues(prefix=nil)\n doc = Adapter.list_queues(prefix)\\\n ['ListQueuesResponse']['ListQueuesResult']\n if doc\n doc['QueueUrl'].map do |val|\n self.new(val)\n end\n else\n []\n end\n end",
"def next_message_from(queue)\n delivery_info, properties, body = queue.pop\n return nil if body.nil?\n Bunny::Message.new(delivery_info, properties, body)\n end",
"def instance_queue\n @instance_queue ||= sqs.queue(instance_id)\n return @instance_queue\n end",
"def list_messages(queue_name, visibility_timeout, options = {})\n number_of_messages = 1\n number_of_messages = options[:number_of_messages] if options[:number_of_messages]\n\n query = { \"visibilitytimeout\" => visibility_timeout.to_s, \"numofmessages\" => number_of_messages.to_s }\n query[\"timeout\"] = options[:timeout].to_s if options[:timeout]\n\n uri = messages_uri(queue_name, query)\n response = call(:get, uri, nil, {}, options)\n\n messages = Serialization.queue_messages_from_xml(response.body, options[:decode])\n messages\n end",
"def queue_for(method, queue_name)\n @_queue_names ||= {}\n @_queue_names[method] = queue_name\n end",
"def add_queue(queue_name)\n queue = MockQueue.new(queue_name)\n data[queue_name] = queue\n queue\n end",
"def create\n profile = calc_profile\n entries = @resource[:entries].join '\", \"'\n raise 'Array of entries can not be empty' if entries.empty?\n entries = format('[\"%s\"]', entries)\n durable = ToBooleanConverter.new(@resource[:durable]).to_bool\n ensure_default_hornetq\n cmd = \"jms-queue #{profile} add --queue-address=#{@resource[:name]} \" \\\n \"--entries=#{entries} --durable=#{durable}\"\n bring_up 'JMS Queue', cmd\n end",
"def queued(options={})\n url_params = options.empty? ? '' : \"?locator=#{locator(options)}\"\n response = get(\"buildQueue#{url_params}\")\n response['build']\n end",
"def name\n @queue.queue_name\n end",
"def queue\n @queue ||= []\n end",
"def queue_message(id, args=nil)\n @send_q.push Message.new(id, args)\n end",
"def setup_queue\n callback = ContextRequestSubscriber.fetch_queue_callback\n if callback\n exchange, queue = callback.call(self)\n else\n channel = create_channel(@session_params)\n exchange = fetch_exchange(channel, @exchange_type, @exchange_name,\n @exchange_opts)\n queue = bind_queue(channel, exchange)\n end\n [exchange, queue]\n end",
"def queue(\n queue_name,\n url: nil,\n method: nil,\n reservation_sid: nil,\n post_work_activity_sid: nil,\n **keyword_args\n )\n append(Queue.new(\n queue_name,\n url: url,\n method: method,\n reservation_sid: reservation_sid,\n post_work_activity_sid: post_work_activity_sid,\n **keyword_args\n ))\n end",
"def message(id)\n Message.new(request(:get, \"messages/#{id}\"))\n end",
"def receive\n raise \"No subscription to receive messages from\" if (@queue_names.nil? || @queue_names.empty?)\n start = @current_queue\n while true\n @current_queue = ((@current_queue < @queue_names.length-1) ? @current_queue + 1 : 0)\n sleep(@connection_options[:poll_interval]) if (@current_queue == start)\n q = @queues[@queue_names[@current_queue]]\n unless q.nil?\n message = retrieve_message(q)\n return message unless message.nil?\n end\n end\n end",
"def stub_retrieving_named_queues\n allow_any_instance_of(AWS::SQS::QueueCollection).to receive(:named).with(an_instance_of(String)).and_return(mocked_queue)\n end",
"def message(id)\n Message.new(request(:get, \"messages/#{id.to_s}\"))\n end",
"def mock_queue(queue_name)\n data[queue_name]\n end"
] | [
"0.6965326",
"0.6934442",
"0.6900829",
"0.68643856",
"0.669572",
"0.6582891",
"0.6572753",
"0.64675933",
"0.6448573",
"0.64448285",
"0.6387933",
"0.6336",
"0.6335639",
"0.6327123",
"0.63090515",
"0.6302529",
"0.62941766",
"0.6272013",
"0.6270611",
"0.619088",
"0.616224",
"0.61580175",
"0.6149234",
"0.6131894",
"0.61075944",
"0.6104424",
"0.6101652",
"0.60980713",
"0.6091672",
"0.6089688",
"0.60532993",
"0.6049714",
"0.6049015",
"0.6032602",
"0.6022937",
"0.6020597",
"0.5998563",
"0.5984099",
"0.59722704",
"0.59495664",
"0.5948718",
"0.59408987",
"0.59362805",
"0.59298736",
"0.59243643",
"0.59226865",
"0.5884074",
"0.58710444",
"0.58512044",
"0.5850554",
"0.5850554",
"0.5835482",
"0.58346564",
"0.58204234",
"0.58179957",
"0.58162284",
"0.58093673",
"0.5798084",
"0.5797538",
"0.5797538",
"0.57943803",
"0.5779648",
"0.57670337",
"0.57621896",
"0.57488644",
"0.5746381",
"0.5740116",
"0.5739328",
"0.5718302",
"0.5710617",
"0.5701748",
"0.5688571",
"0.56863296",
"0.56842715",
"0.56633645",
"0.56633025",
"0.56619924",
"0.56560415",
"0.5655638",
"0.5642756",
"0.5638649",
"0.5637159",
"0.56369644",
"0.5630093",
"0.56168807",
"0.5607633",
"0.55970985",
"0.5594943",
"0.5585087",
"0.55777115",
"0.55704266",
"0.5554594",
"0.55479246",
"0.5547836",
"0.55181044",
"0.55132836",
"0.5511962",
"0.55100894",
"0.55006236",
"0.5492311"
] | 0.71517956 | 0 |
If all gates are hidden, the sation must be hidden, if one is visible, station must be visible. | def check_station_visibility
station.update(hidden: station.access_control_gates.where.not(id: id).pluck(:hidden).push(hidden).uniq.all?) if hidden_changed?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hidden?\n not visible\n end",
"def hidden?\n hidden_at?\n end",
"def hidden?\n hidden_at?\n end",
"def hidden?\n hidden_at?\n end",
"def is_hidden?\n\t\tself.hidden\n\tend",
"def visible=(vis)\n if vis\n show\n else\n hide\n end\n end",
"def visible?; \n\t\t@visible = true if @visible == nil\n\t\t@visible\n\tend",
"def hidden?()\n not visible?()\n end",
"def hidden?\n @hidden\n end",
"def is_visible?\n visibility && ( visibility > 0 )\n end",
"def visible_corporations\n if @par_rag\n @game.sorted_corporations.select { |c| c == @game.rag }\n else\n @game.sorted_corporations.reject(&:closed?)\n end\n end",
"def not_hidden?\n not hidden\n end",
"def hidden_ships_grid\n hidden = Array.new(@grid.size) { [] }\n ([email protected]).each do |i|\n ([email protected]).each do |j|\n chit = self[[i, j]] == :S ? :N : self[[i, j]]\n hidden[i] << chit\n end\n end\n hidden\n end",
"def visible?\n end",
"def visible?\n\t\t\t@visible\n\t\tend",
"def visible?\n @visible\n end",
"def visible?\n @visible\n end",
"def visible?\n true\n end",
"def plot_visible_only=(v) Axlsx.validate_boolean(v); @plot_visible_only = v; end",
"def visa_check?\n schengen_overstay? == false && visa_overstay? == false\n end",
"def is_visible?\n setup.show_all? || Date.today >= start_at\n end",
"def hidden?\n return @hidden\n end",
"def hidden?\n end",
"def st_vis\n Visibility.new(header.st_other & 0x7)\n end",
"def visible=(visibility)\n end",
"def visible=(visible)\n @visible = visible\n @ucActStates.visible = visible\n @ucHpStat.visible = visible\n @cHpStatGauge.visible = visible\n @ucMpStat.visible = visible\n @cMpStatGauge.visible = visible\n @ucAtkStat.visible = visible\n @ucDefStat.visible = visible\n @ucSpiStat.visible = visible\n @ucAgiStat.visible = visible\n @ucEvaStat.visible = visible\n @ucHitStat.visible = visible\n @ucCriStat.visible = visible\n end",
"def hidden?\n false\n end",
"def visible?\n @style.display != 'none'\n end",
"def hide_floating(graph)\n graph.nodes.each_value do |node|\n if node.edges.none? { |e| e.props[:kind] == 'control' }\n node.props[:hidden] = true\n end\n end\n end",
"def hidden?\n false\n end",
"def hidden?\n false\n end",
"def hidden?\n return @hidden\n end",
"def visible?\n !value.nil?\n end",
"def visible(value = true)\n boolean = value ? true : false\n\n model.visible = boolean\n end",
"def switch_visibility(params = {})\n @visible = params[:visible] || !@visible\n reset_visiblility_counters\n end",
"def any_mines_detonated?(state = false)\n state\n end",
"def visibility?\n @visibility || true\n end",
"def visibility_changed?\n !(@old_visible_value == visible)\n end",
"def hidden?\n @params[:hidden] == true\n end",
"def invisible?\n false\n end",
"def invisible?\n false\n end",
"def invisible?\n false\n end",
"def no_option_in_stations?(selected)\n selected > Station.all.length || selected < 1\n end",
"def srss?\n lat != 0.0 && long != 0.0 #there should not be an airfield, somewhere in the ocean\n end",
"def make_hidden\n @linkage_vis = :hidden\n end",
"def visible=(visible)\n @visible = visible\n @ucStat.visible = visible\n @ucCompareStat.visible = visible\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 validate_visible\n visible = params[:visible] || params[:program][:visible]\n\n if visible && visible.to_s != \"true\" && visible.to_s != \"false\"\n raise ExceptionTypes::BadRequestError.new(\"Invalid format for visible: #{visible}, must be boolean true or false\")\n end\n end",
"def none?\n self.display_on == \"none\"\n end",
"def hidden!\n @hidden = true\n self\n end",
"def visible=(visible)\n @visible = visible\n @cEquipKind.visible = visible\n @ucIcon.visible = visible\n @cEquipName.visible = visible\n end",
"def hidden?(*)\n false\n end",
"def forFriendfunctions\n @status = false\n self.hide\n showElements\n end",
"def hidden?; self[:hidden] ||= false; end",
"def hidden_ships_grid \n @grid.map do |row|\n row.map do |ele|\n if ele == :S \n :N \n else\n ele\n end\n end\n end\n end",
"def hide?\n @hide\n end",
"def hidden?\n classes.include?('hidden')\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 visa_overstay?\n visa_date_overstay? || visa_entry_overstay?\n end",
"def hide_frame_state(graph)\n graph.nodes.each_value do |node|\n if FRAME_STATE_NODES.include?(node.props.dig(:node_class, :node_class))\n node.props[:hidden] = true\n end\n end\n 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 devolver_grasas_saturadas \n return @saturadas\n end",
"def hidden_ships_grid\n @grid.map do\n |row|\n row.map do\n |el|\n if el == :S\n :N\n else\n el\n end\n end\n end\n end",
"def all_hidden(&block)\n @all_hidden = true\n yield\n ensure\n @all_hidden = nil\n end",
"def visibilities; end",
"def functional?\n not self.schedules.empty? and self.schedules.first.is_pickup_stop? and self.schedules.last.is_drop_stop?\n end",
"def visible(value)\n @ole.Visible = value\n nil\n end",
"def visible(value)\n @ole.Visible = value\n nil\n end",
"def valid?\n\t\treturn !(self.show.empty? or self.season.zero? or self.episode.zero?)\n\tend",
"def should_appear_on_map?\n data['visibility'] == 'PUBLIC' && timeslots.any?\n end",
"def visible\n @ole.Visible\n end",
"def visible\n @ole.Visible\n end",
"def visible\n @ole.Visible\n end",
"def visible\n @ole.Visible\n end",
"def showable?\n hidden? && hidden_origin.blank?\n end",
"def showable?\n hidden? && hidden_origin.blank?\n end",
"def show_hidden_data\n @show_hidden_data = true\n end",
"def show_hidden_data\n @show_hidden_data = true\n end",
"def visible=(bool)\n make_visible !!bool\n end",
"def contact_forces_visible=(state)\n @debug_contact_forces = state ? true : false\n sim = MSPhysics::Simulation.instance\n sim.contact_forces_visible = @debug_contact_forces if sim\n end",
"def hide_elements\n true\n end",
"def toggle\n if visible?\n hide\n\n else\n show\n\n end\n end",
"def visibility; end",
"def visibility; end",
"def visibility; end",
"def visibility; end",
"def visibility; end",
"def hidden=(hidden)\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 visibility(b)\n @is_visible = b\n return self\n end",
"def visible=(visible)\n @visible = visible\n @ucActStates.visible = visible\n @cCharImage.visible = visible\n @cCharName.visible = visible\n @ucCharLvl.visible = visible\n @ucHpStat.visible = visible\n @cHpStatGauge.visible = visible\n @ucMpStat.visible = visible\n @cMpStatGauge.visible = visible\n @ucExp.visible = visible\n @cExpGauge.visible = visible\n end",
"def toggle_visible\n @seller.toggle(:visible)\n\n respond_to do |format|\n if @seller.save\n format.html { redirect_to admin_sellers_path(@list_type), notice: \"Seller #{@seller.name}'s visibility is now set to #{@seller.visible?}\" }\n else\n flash[:error] = \"Seller #{@seller.name} failed to set visible to #{[email protected]}. Error: #{@seller.errors.full_messages}\"\n format.html { redirect_to admin_sellers_path(@list_type) }\n end\n end\n end",
"def hidden?\n self.privacy == HIDDEN\n end",
"def hide_unused_nodes(graph)\n loop do\n modified = false\n graph.nodes.each_value do |node|\n next unless node.outputs.all? { |edge| edge.to.props[:hidden] } &&\n node.inputs.none? { |edge| edge.props[:kind] == 'control' } &&\n node.inputs.none? { |edge| edge.props[:name] == 'anchor' }\n\n unless node.props[:hidden]\n node.props[:hidden] = true\n modified = true\n end\n end\n break unless modified\n end\n end",
"def has_ships_still_floating?\n end",
"def visible=(visible)\n @visible = visible\n @ucHpCompareStat.visible = visible\n @ucMpCompareStat.visible = visible\n @ucAtkCompareStat.visible = visible\n @ucDefCompareStat.visible = visible\n @ucSpiCompareStat.visible = visible\n @ucAgiCompareStat.visible = visible\n @ucEvaCompareStat.visible = visible\n @ucHitCompareStat.visible = visible\n @ucCriCompareStat.visible = visible\n end",
"def hometown_show d\n if (venue.city == band)\n true\n else\n false\n end\n end",
"def visible=(visible)\n @visible = visible\n @ucEncounters.visible = visible\n @ucDefeated.visible = visible\n @ucEscaped.visible = visible\n @ucExp.visible = visible\n @ucGold.visible = visible\n end",
"def visible=(visible)\n @visible = visible\n @ucIcon.visible = visible\n @cSkillName.visible = visible\n @cSkillMpCost.visible = visible\n end",
"def visible?\n @a.nonzero?\n end"
] | [
"0.59830505",
"0.5975337",
"0.5975337",
"0.5975337",
"0.58056545",
"0.57636184",
"0.5762808",
"0.5742529",
"0.57018614",
"0.5693261",
"0.5692501",
"0.56769437",
"0.5599049",
"0.5597899",
"0.556726",
"0.5563838",
"0.5563838",
"0.5510256",
"0.55089086",
"0.5505045",
"0.55018234",
"0.5467485",
"0.5466563",
"0.546502",
"0.5459085",
"0.5456878",
"0.5433425",
"0.5428948",
"0.54260224",
"0.5424241",
"0.5424241",
"0.5406898",
"0.54036736",
"0.5382201",
"0.5374772",
"0.5347295",
"0.53290004",
"0.53202826",
"0.53141534",
"0.5308509",
"0.5305459",
"0.5305459",
"0.52964234",
"0.52858806",
"0.527649",
"0.5264668",
"0.52586883",
"0.524966",
"0.5238029",
"0.5234197",
"0.52243596",
"0.52123684",
"0.5203684",
"0.5188383",
"0.51808983",
"0.5178802",
"0.51674163",
"0.516536",
"0.5165317",
"0.5160365",
"0.5157521",
"0.5147047",
"0.51414037",
"0.51249534",
"0.5119656",
"0.5114065",
"0.5113642",
"0.5113642",
"0.51128334",
"0.5111369",
"0.5107772",
"0.5107772",
"0.5107772",
"0.5107772",
"0.50952566",
"0.50952566",
"0.50889766",
"0.50889766",
"0.50888306",
"0.5086333",
"0.5079584",
"0.507798",
"0.50763214",
"0.50763214",
"0.50763214",
"0.50763214",
"0.50763214",
"0.507423",
"0.50738907",
"0.50531596",
"0.5044851",
"0.5030628",
"0.5028776",
"0.5028146",
"0.5022218",
"0.5015171",
"0.501266",
"0.5012377",
"0.5012042",
"0.50038743"
] | 0.7611455 | 0 |
Create a status record if one does not exist | def check_create_status
if self.v_status.nil?
status = VStatus.new
status.v_project = self
status.v_user_data = self.v_user_data
self.v_status = status
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_status(Status status)\n Status.create(group_id: @group_id, status: status)\n end",
"def status\n s = statuses.find(:first, :order => \"updated_at DESC\")\n if s.nil?\n s = statuses.create :organization_quarter_status_type_id => OrganizationQuarterStatusType.find_or_create_by_title(\"Needs Contact\").id\n s.type.sequence = 0; s.type.save;\n end\n s\n end",
"def create\n ActiveRecord::Base.transaction do\n @status = Status.new(status_params)\n\n respond_to do |format|\n if @status.save\n format.html { redirect_to @status, notice: 'El Estado se creó exitosamente.' }\n format.json { render :show, status: :created, location: @status }\n else\n format.html { render :new }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @status = current_user.statuses.new(params[:status])\n\n respond_to do |format|\n if @status.save\n current_user.create_activity(@status, 'created')\n format.html { redirect_to profile_path(current_user), notice: 'Status was successfully created.' }\n format.json { render json: @status, status: :created, location: @status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def duplicate_workflow_status\r\n return if self.workflow_statuses.none?\r\n self.workflow_statuses.create(workflow_status_template_id: self.workflow_statuses.last.workflow_status_template_id)\r\n end",
"def add_if_not_exists()\n\tif record_exists()\n\t\tprintf(\"EXISTS %s\\n\",self.digest)\n\t\treturn 0\n\tend\n\tsave()\n\treturn 1\nend",
"def status\n if self.status_id && !self.status_id.empty?\n self.status_id\n else\n \"new\"\n end\n end",
"def create\n @record_status = RecordStatus.new(params[:record_status])\n\n respond_to do |format|\n if @record_status.save\n format.html { redirect_to @record_status, notice: 'Record status was successfully created.' }\n format.json { render json: @record_status, status: :created, location: @record_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @record_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_status status\n\t\n\t\[email protected] @type, status\n\t\n\tend",
"def create\n @status_record = StatusRecord.new(params[:status_record])\n\n respond_to do |format|\n if @status_record.save\n format.html { redirect_to @status_record, notice: 'Status record was successfully created.' }\n format.json { render json: @status_record, status: :created, location: @status_record }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @status = Status.new(status_params)\n\n if @status.save\n render json: @status\n else\n render json: @status.errors, status: :unprocessable_entity\n end\n end",
"def created?\n @data[:status_code] == '201'\n end",
"def store_status(id, status, expiration = nil)\n store_for_id id, {status: status}, expiration\n end",
"def set_status\n\t \t#establecer status en BD\n\t \tself.status = \"created\"\n\t \tself.save #para que se guarde\n\t end",
"def create_from_status! (status)\n # Create a document only if geocords are available\n # TODO: relook this logic later, other options available\n if status['geo'] && status['geo']['type'] == 'Point'\n create! do |t|\n t.status_id = status['id_str']\n t.text = status['text']\n t.user_handle = status['user']['screen_name']\n t.user_avatar_url = status['user']['profile_image_url']\n t.location = status['geo']['coordinates'] # returns [-77.423456, 42.989259]\n t.place_name = status['place']['full_name'] if status['place']\n t.time = Time.parse(status['created_at']) # returns \"Wed Mar 28 21:28:55 +0000 2012\"\n end\n end\n end",
"def create\n @status = Status.new(params[:status])\n\n respond_to do |format|\n if @status.save \n @user = @status.user\n @user.view_status = @status.view_status\n @user.save\n \n if @user.view_status == 'live' && @user.teacher?\n Innsights.report(\"Maestro aceptado\", :user => current_user, :group => current_network).run\n elsif @user.teacher?\n Innsights.report(\"Maestro suspendido\", :user => current_user, :group => current_network).run\n end\n\n format.html { redirect_to :back, notice: 'El status ha sido agregado correctamente al usuario' }\n format.json { render json: :back , status: :created, location: @status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @status = Status.new(params[:status])\n\n respond_to do |format|\n if @status.save\n flash[:notice] = 'Status was successfully created.'\n format.html { redirect_to status_url(@status) }\n format.xml { head :created, :location => status_url(@status) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @status.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end",
"def create_statuses\n end",
"def create_statuses\n end",
"def add_status(timestamp, status, message=nil)\n # creates a status entry\n timestamp = timestamp.to_i\n entry = StatusEntry.new(timestamp, status, message)\n\n # sets the status_entry in the redis status hash\n redis.zadd(key(:uuid, @uuid), timestamp, encode(entry.to_h))\n\n # set/reset expiration on status hash\n if Status.expire_after\n redis.expire(key(:uuid, @uuid), Status.expire_after)\n end\n\n # Add entry to index if necessary.\n # We only score using the creation timestamp this way.\n if redis.zscore(key(:uuid_index), @uuid).nil?\n redis.zadd(key(:uuid_index), timestamp, @uuid)\n end\n end",
"def create\n s = Spooge.new()\n create_status = s.save\n n = generate_random_name\n s.name = n\n s.email = \"#{n}@gmail.com\"\n s.touch_date = DateTime.now\n s.status = STATUS[rand(STATUS.length)]\n\n resp = {:create_status => create_status, :record => s}\n render :json => resp\n end",
"def create_record_for_not_found_response; end",
"def create\n @status = Status.new(status_params)\n\n respond_to do |format|\n if @status.save\n format.html { redirect_to @status, notice: 'Status was successfully created.' }\n format.json { render :show, status: :created, location: @status }\n else\n format.html { render :new }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @status = Status.new(params[:status])\n @status.save\n\n redirect_to @status, notice: 'Status was successfully created.'\n end",
"def create\n @status = Status.new(status_params)\n\n respond_to do |format|\n if @status.save\n format.html { redirect_to @status, notice: 'Status was successfully created.' }\n format.json { render action: 'show', status: :created, location: @status }\n else\n format.html { render action: 'new' }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @request_status = RequestStatus.new(params[:request_status])\n\n respond_to do |format|\n if @request_status.save\n format.html { redirect_to @request_status, notice: 'Request status was successfully created.' }\n format.json { render json: @request_status, status: :created, location: @request_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @request_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = current_user\n @status = @user.statuses.build(status_params)\n\n #@status = Status.new(status_params)\n respond_to do |format|\n if @status.save\n format.html { redirect_to @status, notice: 'Status was successfully created.' }\n format.json { render :show, status: :created, location: @status }\n else\n format.html { render :new }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_starting_statuses\n new_status_attributes = { :public_title => \"New\",\n :application_status_type => ApplicationStatusType.find_or_create_by_name(\"new\"),\n :disallow_user_edits => 0,\n :disallow_all_edits => 0,\n :allow_application_edits => 1 }\n statuses.create(new_status_attributes)\n in_progress_status_attributes = { :public_title => \"In Progress\",\n :application_status_type => ApplicationStatusType.find_or_create_by_name(\"in_progress\"),\n :disallow_user_edits => 0,\n :disallow_all_edits => 0,\n :allow_application_edits => 1 }\n statuses.create(in_progress_status_attributes)\n submitted_status_attributes = { :public_title => \"Submitted\",\n :application_status_type => ApplicationStatusType.find_or_create_by_name(\"submitted\"),\n :disallow_user_edits => 1,\n :disallow_all_edits => 0,\n :allow_application_edits => 0 }\n statuses.create(submitted_status_attributes)\n end",
"def create\n\t\t\n\t\t@employment_status = EmploymentStatus.find_or_create_by_title_and_company_permalink_and_person_permalink(params[:employment_status])\n\t\t\n\t\t respond_to do |format|\n\t\t \n\t\t if @employment_status.save\n\t\t \n\t\t format.json { render json: @employment_status }\n\t\t \n\t\t else\n\t\t format.html { render action: \"new\" }\n\t\t format.json { render json: @employment_status.errors, status: :unprocessable_entity }\n\t\t end\n\t \n\t end\n\tend",
"def create\n @new_status = NewStatus.new(params[:new_status])\n\n respond_to do |format|\n if @new_status.save\n format.html { redirect_to @new_status, notice: 'New status was successfully created.' }\n format.json { render json: @new_status, status: :created, location: @new_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @new_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @status = Status.new(params[:status])\n\n respond_to do |format|\n if @status.save\n format.html { redirect_to(@status, :notice => 'Status was successfully created.') }\n format.xml { render :xml => @status, :status => :created, :location => @status }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @status.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def ensure_status\n context.status ||= :ok\n end",
"def check_status!\n if (created_at + 48.hours).past?\n update_status(10)\n return false\n end\n return true\n\n end",
"def create\n @status = Status.new(params[:status])\n @status.user = current_user\n \n respond_to do |format|\n if @status.save\n flash[:notice] = 'Status was successfully created.'\n format.html { redirect_to(statuses_path) }\n format.xml { render :xml => @status, :status => :created, :location => @status }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @status.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new_record?(workstation_status)\n workstation_status.saved_change_to_id?\n end",
"def check_status_change\n if self.status_id != @current_status\n sc = StatusChange.new\n sc.submission_id = self.id\n sc.status_id = self.status_id\n sc.changed_at = @current_time\n sc.comments = status_comments\n sc.save\n #give sub a global id if approved\n if self.status.eq?('approved')\n self.guid = generate_guid(@current_time)\n end\n end\n end",
"def create\n @status = Status.new(params[:status])\n\n respond_to do |format|\n if @status.save\n flash[:notice] = 'Status Type was successfully created.'\n format.html { redirect_to(@status) }\n format.xml { render :xml => @status, :status => :created, :location => @status }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @status.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @breadcrumb = 'create'\n @order_status = OrderStatus.new(params[:order_status])\n @order_status.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @order_status.save\n format.html { redirect_to @order_status, notice: crud_notice('created', @order_status) }\n format.json { render json: @order_status, status: :created, location: @order_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @status = Status.last || Status.new(available: \"unavailable\", created_at: DateTime.now)\n end",
"def create_status(name, description, level, image)\n response = @client.post(\"/api/v1/statuses\", { \"name\" => name, \"description\" => description, \"level\" => level, \"image\" => image })\n return JSON.parse(response.body)\n end",
"def create(record)\n result = self.class.post(worksheet_url,\n :body => { \"fields\" => record.fields }.to_json,\n :headers => { \"Content-type\" => \"application/json\" }).parsed_response\n if result.present? && result[\"id\"].present?\n record.override_attributes!(result_attributes(result))\n record\n else # failed\n false\n end\n end",
"def create?\n @record.present?\n end",
"def save!\n create_or_update or raise RecordNotSaved\n end",
"def create\n create_params = status_params\n create_params[:username] = current_user.username\n create_params[:time_submit] = Time.now\n create_params[:result] = t(\"status.results.waiting\")\n create_params[:ipaddr] = request.remote_ip\n create_params[:jnum] = 0\n create_params[:contest_belong] = 0 if @contest && @contest.ended?\n\n @status = Status.new(create_params)\n if @status.save\n begin\n send_socket_message(\n runid: @status.runid,\n vname: @problem.vname,\n type: OJ_CONFIG[\"contact\"][\"string\"][\"submit\"])\n @problem.total_submit = @problem.total_submit + 1\n @problem.save\n current_user.total_submit = current_user.total_submit + 1\n current_user.save\n rescue\n end\n render json: { msg: t(\"status.prompts.submitted\") }, status: :created\n else\n render json: { msg: @status.errors }, status: :unprocessable_entity\n end\n end",
"def create_if_not_exists\n args = [\n [available_list_key(), taken_hash_key(), created_at_key()],\n [@resource_count, @expiration, Time.now.to_f()]\n ]\n $redis.eval(create_script(), *args)\n end",
"def create_or_update(report)\n id = report[\"id\"].to_s\n if exist_with_id?(id)\n update_where({ id: id }, row(report: report))\n else\n table.insert row(report: report, insert_created_at: true)\n end\n end",
"def conflicting_or_created_record\n conflict || create\n end",
"def build_status(key, options = {})\n build_statuses_resource.find(key, options)\n rescue Tinybucket::Error::NotFound\n nil\n end",
"def create\n @app_status = AppStatus.new(app_status_params)\n\n respond_to do |format|\n if @app_status.save\n format.html { redirect_to @app_status, notice: 'App status was successfully created.' }\n format.json { render :show, status: :created, location: @app_status }\n else\n format.html { render :new }\n format.json { render json: @app_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n begin\n create_or_update\n rescue ActiveRecord::RecordInvalid\n false\n end\n end",
"def create\n @reqstatus = Reqstatus.new(reqstatus_params)\n\n respond_to do |format|\n if @reqstatus.save\n format.html { redirect_to @reqstatus, notice: 'Reqstatus was successfully created.' }\n format.json { render action: 'show', status: :created, location: @reqstatus }\n else\n format.html { render action: 'new' }\n format.json { render json: @reqstatus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project_status = Project::Status.new(project_status_params)\n\n respond_to do |format|\n if @project_status.save\n format.html { redirect_to @project_status, notice: 'Status was successfully created.' }\n format.json { render :show, status: :created, location: @project_status }\n else\n format.html { render :new }\n format.json { render json: @project_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_or_update record\n db_name = database_name_for(record)\n coll_name = collection_name_for(record)\n id = id_for(record)\n pointer = \"/#{db_name}/#{coll_name}/#{id}\"\n if id\n res = collection_for(record).update({:_id => id}, interpret(record), :upsert => true)\n case\n when res['error']\n log.error(res['error'])\n when res['updatedExisting']\n log.debug(\"Updated #{pointer}\")\n else\n log.debug(\"Inserted #{pointer}\")\n end\n else\n res = collection_for(record).insert(interpret(record))\n log.info(\"Inserted #{pointer}#{res}\")\n end\n end",
"def save\n create_or_update\n _id.present?\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 _create\n true\n end",
"def create\n @db_job_status = DbJobStatus.new(db_job_status_params)\n authorize! :create, @db_job_status\n\n respond_to do |format|\n if @db_job_status.save\n format.html { redirect_to @db_job_status, notice: 'Db job status was successfully created.' }\n format.json { render :show, status: :created, location: @db_job_status }\n else\n format.html { render :new }\n format.json { render json: @db_job_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @status = current_user.statuses.new(status_params)\n\n if current_user.state_facebook? && @status.content?\n current_user.facebook(current_user).put_wall_post(@status.content)\n end\n\n if current_user.state_twitter? && @status.content?\n current_user.twitter(current_user).update(@status.content)\n end\n \n respond_to do |format|\n if @status.save\n format.html { redirect_to statuses_url, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @status }\n else\n format.html { redirect_to statuses_url }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def persist status\n\t\[email protected]_status status\n\tend",
"def create_object(to, data)\n return to if @@redis.set(@@alert_name, self.default(to, data).to_json) == \"OK\"\n raise StandardError.new(\"Status `#{to}` could not be saved\")\n end",
"def create\n params[:kf_status][:status_type] = params[:status_type] unless params[:status_type].blank?\n params[:kf_status][:relation_id] = params[:relation_id] unless params[:relation_id].blank?\n params[:kf_status][:count_type] = params[:count_type] unless params[:count_type].blank?\n @kf_status = Kf::Status.new(params[:kf_status])\n\n respond_to do |format|\n if @kf_status.save\n format.html { redirect_to \"/kf/statuses?page=#{params[:page]}&relation_id=#{params[:relation_id]}&status_type=#{params[:status_type]}&count_type=#{params[:count_type]}\",notice: 'Status was successfully created.' }\n format.json { render json: @kf_status, status: :created, location: @kf_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kf_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @application_status = ApplicationStatus.new(params[:application_status])\n\n respond_to do |format|\n if @application_status.save\n format.html { redirect_to application_statuses_path, notice: 'Application status was successfully created.' }\n format.json { render json: @application_status, status: :created, location: @application_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @application_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_status(status)\n self.status = status\n self.save! validate: false\n end",
"def create\n @breadcrumb = 'create'\n @work_order_status = WorkOrderStatus.new(params[:work_order_status])\n @work_order_status.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @work_order_status.save\n format.html { redirect_to @work_order_status, notice: crud_notice('created', @work_order_status) }\n format.json { render json: @work_order_status, status: :created, location: @work_order_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @work_order_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n create_or_update\n end",
"def create\n create_or_update\n end",
"def create\n @invite_status = InviteStatus.new(params[:invite_status])\n\n respond_to do |format|\n if @invite_status.save\n format.html { redirect_to @invite_status, notice: 'Invite status was successfully created.' }\n format.json { render json: @invite_status, status: :created, location: @invite_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_attempted?\n create_attempted\n end",
"def add_status(service, status)\n @status_mutex.synchronize { @statuses[\"#{service}\"] = status }\n end",
"def add_status(service, status)\n @status_mutex.synchronize { @statuses[\"#{service}\"] = status }\n end",
"def exists?\n status.exists? name\n end",
"def defaults_for_new\n self.status = 0\n end",
"def create\n @status_activity = StatusActivity.new(status_activity_params)\n\n respond_to do |format|\n if @status_activity.save\n format.html { redirect_to @status_activity, notice: 'Status activity was successfully created.' }\n format.json { render :show, status: :created, location: @status_activity }\n else\n format.html { render :new }\n format.json { render json: @status_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_or_update\n raise ReadOnlyRecord if readonly?\n result = new_record? ? create_record : update_record\n result != false\n end",
"def create\n @itemstatus = Itemstatus.new(params[:itemstatus])\n\n respond_to do |format|\n if @itemstatus.save\n format.html { redirect_to @itemstatus, notice: 'Itemstatus was successfully created.' }\n format.json { render json: @itemstatus, status: :created, location: @itemstatus }\n else\n format.html { render action: \"new\" }\n format.json { render json: @itemstatus.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @store_status = StoreStatus.new(store_status_params)\n\n respond_to do |format|\n if @store_status.save\n format.html { redirect_to @store_status, notice: 'Store status was successfully created.' }\n format.json { render action: 'show', status: :created, location: @store_status }\n else\n format.html { render action: 'new' }\n format.json { render json: @store_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @active_status = ActiveStatus.new(params[:active_status])\n\n respond_to do |format|\n if @active_status.save\n flash[:notice] = 'ActiveStatus was successfully created.'\n format.html { redirect_to(@active_status) }\n format.xml { render :xml => @active_status, :status => :created, :location => @active_status }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @active_status.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def rollup_status\n with_lock do\n stats = children.pluck(:status)\n return if stats.include?(PENDING) || stats.include?(PERFORMING)\n return fail! if stats.include?(FAILURE)\n success!\n end\n end",
"def save(*)\n create_or_update\n rescue RecordInvalid\n false\n end",
"def add_status( thing, statusArray )\n data = {\n token: @applicationToken,\n thing_id: thing.id,\n id: 'null',\n status_array: statusArray\n }\n @httpHelper.post_data( 'status', data )\n end",
"def exists!\n @exists = true\n end",
"def create\n @posts_status = Posts::Status.new(posts_status_params)\n\n respond_to do |format|\n if @posts_status.save\n format.html { redirect_to @posts_status, notice: 'Status was successfully created.' }\n format.json { render :show, status: :created, location: @posts_status }\n else\n format.html { render :new }\n format.json { render json: @posts_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create!\n raise \"#{self.inspect} failed to save\" unless self.create\n end",
"def create\n PaymentNotification.create!(params: params, status: params[:payment_status], transaction_id: params[:txn_id])\n render :nothing => true\n end",
"def create_crf_records(sub)\n\n if sub.subject_id != nil and sub.enrolled == 1\n CRF_TO_CREATE.each do |crf|\n if crf.exists?(subject_id: sub.subject_id)\n #do nothing\n else\n crf.create(subject_id: sub.subject_id)\n end\n end \n end\n end",
"def create\n @project_status = ProjectStatus.new(params[:project_status])\n\n respond_to do |format|\n if @project_status.save\n format.html { redirect_to(@project_status, :notice => 'Project status was successfully created.') }\n format.xml { render :xml => @project_status, :status => :created, :location => @project_status }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project_status.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def creating?\n state == :CREATING\n end",
"def creating?\n state == :CREATING\n end",
"def creating?\n state == :CREATING\n end",
"def creating?\n state == :CREATING\n end",
"def creating?\n state == :CREATING\n end",
"def save\n if exists?\n update_attributes\n else\n if !create.nil?\n true\n else\n false\n end\n end\n end",
"def initialize(status)\n @status = status\n @created_at = Time.new\n end",
"def initialize(status)\n @status = status\n @created_at = Time.new\n end",
"def create\n @status_request = StatusRequest.new(status_request_params)\n\n respond_to do |format|\n if @status_request.save\n format.html { redirect_to @status_request, notice: 'Status request was successfully created.' }\n format.json { render :show, status: :created, location: @status_request }\n else\n format.html { render :new }\n format.json { render json: @status_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_status\n @status = Status.find params[:id]\n rescue ActiveRecord::RecordNotFound\n flash[:alert] = \"The status you are looking for cannot be found.\"\n redirect_to root_path\n end",
"def create\n @current_statuses = CurrentStatus.new(current_statuses_params)\n\n respond_to do |format|\n if @current_statuses.save\n format.html { redirect_to @current_statuses, notice: 'Current Statuses was successfully created.' }\n format.json { render :show, status: :created, location: @current_statuses }\n else\n format.html { render :new }\n format.json { render json: @current_statuses.errors, status: :unprocessable_entity }\n end\n end\n end",
"def insert_record_if_new(name, type, ttl, content)\n record = records_table.filter(:domain_id => domain.id, :name => name, :type => type, :content => content).first\n insert_record(name, type, ttl, content) unless record\n end",
"def create\n @project_status = ProjectStatus.new(project_status_params)\n\n respond_to do |format|\n if @project_status.save\n format.html { redirect_to project_status_url(@project_status), notice: \"Project status was successfully created.\" }\n format.json { render :show, status: :created, location: @project_status }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @project_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def exist?\n @created\n end"
] | [
"0.7206832",
"0.64852256",
"0.6247204",
"0.6198068",
"0.6172983",
"0.617294",
"0.61392707",
"0.61080515",
"0.60675484",
"0.6065306",
"0.60581666",
"0.60264796",
"0.60083133",
"0.5981415",
"0.5973524",
"0.5959304",
"0.59199077",
"0.59189254",
"0.59189254",
"0.59052587",
"0.5872138",
"0.5863336",
"0.58605164",
"0.5824079",
"0.58178824",
"0.5813667",
"0.5794901",
"0.5768105",
"0.5752566",
"0.5749973",
"0.57492024",
"0.5738258",
"0.5734955",
"0.57311463",
"0.57105416",
"0.568733",
"0.56867546",
"0.56703836",
"0.56662285",
"0.5651502",
"0.56493556",
"0.5643891",
"0.56067324",
"0.5599875",
"0.55995005",
"0.55975777",
"0.5593851",
"0.55714726",
"0.55427676",
"0.55291146",
"0.5525756",
"0.55231315",
"0.55162615",
"0.55157745",
"0.5512774",
"0.55023587",
"0.5501144",
"0.5491835",
"0.5490583",
"0.54876274",
"0.54847145",
"0.54676616",
"0.54666203",
"0.54635704",
"0.54606557",
"0.54606557",
"0.5454816",
"0.54459345",
"0.5445682",
"0.5445682",
"0.54393905",
"0.5433375",
"0.54300535",
"0.54295135",
"0.5416125",
"0.54154813",
"0.5412494",
"0.54041475",
"0.54005116",
"0.5395473",
"0.5392768",
"0.53899413",
"0.53849113",
"0.5374795",
"0.5370448",
"0.5369707",
"0.53644544",
"0.53644544",
"0.53644544",
"0.53644544",
"0.53644544",
"0.53644186",
"0.5362631",
"0.5362631",
"0.5361759",
"0.5357619",
"0.53513324",
"0.53435946",
"0.53423256",
"0.53384995"
] | 0.7056659 | 1 |
Now that I've added a is_not_user?/may_not_be_user? method to simply_authorized using this cleaner and clearer method. used in roles_controller | def may_not_be_user_required
current_user.may_not_be_user?(@user) || access_denied(
"You may not be this user to do this", user_path(current_user))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_authorized?(user)\n user == current_user || is_admin?\n end",
"def authorized?(user)\n true\n end",
"def authorize_user\n # simple authorization: kick out anonymous users from backend actions\n=begin\n if !current_user\n redirect_back_or_default(home_page) and return if action_name =~ /index|edit|update|destroy/\n \n # skip checking permission if user is an admin\n elsif !current_user.has_role?('Admin')\n unless current_user.has_permission?(controller_name, action_name, params)\n flash[:warning] = 'Access Denied'\n redirect_back_or_default(home_page) and return\n end\n end\n=end\n end",
"def authorize\n if !current_user.has_role? :admin\n render plain:\"No access for you!\"\n end\n end",
"def authorized?(user)\n current_user == user\nend",
"def authorize\n if !current_user.has_role? :admin\n render text:\"No Access For You!!!\"\n end\n end",
"def authorize\n redirect_to('/login') unless @current_user\n end",
"def authorized\n\t\tif current_user\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend",
"def authorize(user=\"no\")\n if user.nil?\n not_authorized(\"User not found.\")\n false\n elsif user == 'no'\n require_login\n !!current_user\n else\n if user_authorized?(user)\n true\n else\n not_authorized\n false\n end\n end\n end",
"def authorize?(user)\n true\n #user.login == \"administrador\"\n end",
"def authorize_user\n\t if !current_user.admin_user? then\n\t redirect_to '/', notice: 'You have attempted to access a function that is not available for basic users.'\n\t end\n\tend",
"def authorize?(user)\n user && user.admin?\n end",
"def authorize?(user)\n true\n end",
"def authorize_patron\n if is_admin? or is_authorized? \n return true\n elsif !current_user.nil?\n render 'user_sessions/unauthorized_patron'\n else\n redirect_to login_url unless performed?\n end\n end",
"def authorize?(_user)\n true\n end",
"def authorize?(_user)\n true\n end",
"def authorized?\n @authorized ||= current_user.present? # TODO: Check for authorization\n end",
"def authorized?\n true\n end",
"def check_authorization\n if current_user && current_user.admin_role.present?\n return true\n end\n render nothing: true, status: :unauthorized\n false\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorized_user?\n role = user_with_role.role\n unless role\n request.env[\"HTTP_REFERER\"] = logout_path\n return false\n end\n\n h = send(:\"#{role}_hash\")\n\n if h[controller_sym].is_a?(Hash)\n h[controller_sym][action_sym]\n else\n !!h[controller_sym]\n end\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def check_authorization\n unless @user and @user.role.name == 'admin'\n flash[:notice] = \"Not authorized!\"\n redirect_to root_path\n end\n end",
"def authorize!(user)\n redirect '/not_authorized' unless authorized?(user)\nend",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorized?\n current_user.login == \"Admin\"\n end",
"def authorized?\n logged_in? && current_user.login == \"ej0c\"\n end",
"def authorize_author\n redirect_to '/login' unless self.user_access > 1 || current_user.access == 3\n end",
"def authorized_for_roles(*args)\n # From: http://stackoverflow.com/a/6076035/999973\n # args.any? { |role_name| ROLES.include? role_name }\n # ROLES = %w[admin moderator editor author banned] in user model\n # calling it:\n # before_filter(only: [:edit, :update, :destroy]) {|c| c.authorized_for_roles \"admin\", \"editor\"}\n \n # args.any? { |role_name| current_user.role == role_name }\n \n\n unless signed_in?\n self.current_user = User.create( name: \"Guest\" )\n redirect_to(root_path) unless args.any? { |role_name| current_user.role == role_name }\n self.current_user = nil\n return\n end\n\n redirect_to(root_path) unless args.any? { |role_name| current_user.role == role_name }\n end",
"def authorize\n\t\tredirect_to '/login' unless current_user\n\tend",
"def authorized?\n if logged_in? || posing_as_logged_out?\n super_user || current_user.admin?\n end\n end",
"def authorization_checking\n authorize!(:authorization_checking,current_user) unless current_user.role?(:livia_admin) || current_user.role?(:lawfirm_admin)\n end",
"def authorized?(type=Admin)\n user = current_user\n if user.nil?\n return false\n end\n return user.is_a?(type)\n end",
"def authorized?(type=Admin)\n user = current_user\n if user.nil?\n return false\n end\n return user.is_a?(type)\n end",
"def authorize_users\n authorize :user\n end",
"def authorize_user\n if !current_user.admin_user? then\n redirect_to '/', notice: 'You have attempted to access a function that is not available for basic users.'\n end\n end",
"def authorize_user\n if !current_user.admin_user? then\n redirect_to '/', notice: 'You have attempted to access a function that is not available for basic users.'\n end\n end",
"def authorized?\nlogged_in?\nend",
"def authorized?(tmp_user)\n user == tmp_user\n end",
"def login_required\n not_authorized unless current_user\n end",
"def authorized(m)\n m.user == current_user\n end",
"def authorised\n if self.roles.size > 0\n true\n end\n end",
"def authorized?\n render nothing: true, status: :forbidden if !current_account\n end",
"def authorized?\n true\n end",
"def authorized?\n !current_user.nil? || current_user.is_a?(Administrator)\n end",
"def authorized_user!\n unless user_logged_in?\n redirect_to root_path\n end\n end",
"def authorize\n redirect_to login_url, alert: \"Not authorized\" if !current_user\n end",
"def authorize_admin!\n redirect_to login_path unless current_user\n end",
"def authorized?\n\n current_user && current_user.is_admin?\n end",
"def view_authorized(current_user)\n return self.public? || self.edit_authorized(current_user)\n end",
"def authorize\n if !session[:user_id]\n redirect_to root_path\n end\n if session[:user_id]\n if User.find_by(id: session[:user_id]).access != \"admin\"\n redirect_to root_path\n end\n end\n end",
"def authorized?(user, action)\n\t\ttrue\n\tend",
"def authorized\n redirect_to new_user_session_path unless logged_in?\n end",
"def authorized_by(user)\n user.id == self.id\n end",
"def authorize_user\n if @user.present?\n # Pass the object @user to Pundit to check against @current_user\n authorize @user\n else\n authorize_users\n end\n end",
"def authorize_admin\n redirect_to root_path unless current.user.immortal?\n end",
"def correct_user\n render_forbidden unless current_user?(@user)\n end",
"def require_admin_roles\r\n if logged_in? and not current_user.has_admin_roles?\r\n not_authorized\r\n end\r\n end",
"def _admin_or_self\n not_authorizaed unless current_user.admin? || current_user == @user\n end",
"def authorize_user\n if @user.id != current_user.id\n redirect_to \"/\", notice: 'You are not allowed the given operation' and return\n end\n end",
"def authorized\n\t unless admin?\n\t redirect_to root_path\n\t end\n end",
"def authorize # we can call it anything\n redirect_to '/login' unless current_user # if there is a current user then it will never redirect\n end",
"def login_required\nauthorized? || access_denied\nend",
"def authorized?\n\n if session[:current_user] != nil\n true\n else\n redirect '/not_authorized'\n end\n\n end",
"def authorize_user\n if !user_signed_in? || !current_user.admin?\n raise ActionController::RoutingError.new(\"Not Found\")\n end\n end",
"def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end",
"def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end",
"def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end",
"def authorized?\n logged_in?\n end",
"def authorized?\n logged_in?\n end",
"def require_user\n if current_user?\n if (is_admin?||is_manager_for?(@account.account_resource_id))\n true\n else\n render :text => \"unauthorized!\", :status => 401\n return\n end\n else\n redirect_to \"/sso/login?return_to=#{request.url}\"\n false\n end\n end",
"def authorised?\n if current_user.role === 'SUPERVISOR' || current_user.role === 'ENGINEER'\n respond_to do |f|\n f.html { redirect_to root_path, alert: 'You are not authorised to access this page.' }\n end\n end\n end",
"def authorize\n (render :json => { :error => \"Authentication error\" }, :status => :unauthorized and return) unless User.current.present?\n authorized ? true : deny_access\n end",
"def authorize\n if current_user.role !='admin'\n redirect_to users_profile_path ,notice: 'You are not admin.'\n end\n end",
"def authorize\n if current_user.nil? || current_user.tipo_usuario == \"Empleado\"\n redirect_to login_url, notice: \"No esta autorizado para ver esto. Por favor ingrese al sistema o reingrese como administrador.\"\n end\n end",
"def authorization_check\n if session[:current_user] == nil\n redirect '/not_authorized'\n else\n return true\n end\nend",
"def authorized_user\n @user = Post.find(params[:id]).user\n redirect_to(root_url) unless logged_in? && (current_user?(@user) || current_user.admin?)\n end",
"def authorized?\n authorized = nil\n user && user.role_symbols.each do |role|\n (permissions[role] || {}).each do |act, opt|\n if act == action\n break if (authorized = opt.any? ? eval_expr(opt) : true)\n end\n end\n break if authorized\n end\n authorized\n end",
"def user_authorized\n redirect_to \"/\" unless session[:user_id]\n end",
"def customize_authorized?\n authorized_for?(:action => :read)\n end",
"def authorize\n redirect_to new_session_path unless current_user #call method curent_user in sessions_helper\n end",
"def authorized\n redirect_to \"/login\" unless logged_in? \n end",
"def authorize_user!\n if !current_user.present?\n render json: {error: 'No user error'}\n end\n end",
"def authorized?\n current_user.logged_in?\n end",
"def authorize\n return if current_user\n\n redirect_to login_url\n end",
"def authorize?(person)\n person.is_admin?\n end",
"def authorizeAdmin\n redirect_to '/adminlogin' unless admin_user\n end",
"def require_login\n not_authorized(\"Please sign up or log in above to access this resource.\") unless current_user\n end",
"def authorized?(username)\n raise NotImplementedError.new(\"#{self.class.name}#authorized?\")\n end",
"def authorize\n # First check if user is already logged in\n if (session[:user_id].nil? || session[:user_id] == \"\")\n redirect_to :controller => 'user', :action => 'login'\n return\n end\n end",
"def authorized?(user_id)\n logged_in_user_id == user_id\n end",
"def authorize\n @logged_in_user = User.find(session[:user_id])\n rescue\n reset_session\n @logged_in_user = nil\n if User.find(:all).length > 0\n session[:jumpto] = request.parameters\n redirect_to :controller => 'authentication', :action => 'login' and return false\n else\n redirect_to :controller => 'authentication', :action => 'create_admin' and return false\n end\n end",
"def check_is_login_required\n authorized_denied unless logged_in?\n end",
"def authorize_admin\n redirect_to '/librarians/denied' unless current_user && current_user.admin?\n end"
] | [
"0.75830764",
"0.7553303",
"0.72632784",
"0.7240715",
"0.7225903",
"0.719599",
"0.718179",
"0.71809864",
"0.7178979",
"0.7178643",
"0.7157452",
"0.71340257",
"0.7113883",
"0.71114707",
"0.71047413",
"0.71047413",
"0.7077355",
"0.7076527",
"0.7057629",
"0.7044429",
"0.7043815",
"0.7028256",
"0.7028256",
"0.7028256",
"0.7028256",
"0.7028256",
"0.7028256",
"0.7028256",
"0.7028256",
"0.70175284",
"0.69958067",
"0.6982358",
"0.69787097",
"0.697298",
"0.6970514",
"0.6956141",
"0.6949255",
"0.6921451",
"0.6919057",
"0.69129616",
"0.69129616",
"0.69117075",
"0.69063425",
"0.69063425",
"0.69046485",
"0.69040996",
"0.6901054",
"0.6891812",
"0.6890588",
"0.68844754",
"0.6880135",
"0.68788314",
"0.68753356",
"0.68515307",
"0.6850386",
"0.6848574",
"0.68379194",
"0.6836112",
"0.6835402",
"0.6829074",
"0.6824533",
"0.682444",
"0.68222266",
"0.6820272",
"0.6805066",
"0.6804475",
"0.68040735",
"0.679907",
"0.6792167",
"0.6788787",
"0.6785752",
"0.6774076",
"0.67677295",
"0.67677295",
"0.67677295",
"0.6761971",
"0.6761971",
"0.67607284",
"0.6759416",
"0.67581016",
"0.67496836",
"0.6743632",
"0.6739831",
"0.6735611",
"0.67293",
"0.67248064",
"0.6720632",
"0.6719125",
"0.6717062",
"0.6715409",
"0.6713532",
"0.67088294",
"0.66990846",
"0.6698187",
"0.6698031",
"0.6697804",
"0.66930157",
"0.6692168",
"0.6685781",
"0.66687626",
"0.6664513"
] | 0.0 | -1 |
GET /maintenance_schedules/1 GET /maintenance_schedules/1.xml | def show
@maintenance_schedule = MaintenanceSchedule.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @maintenance_schedule }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @schedules = Schedule.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @schedules }\n end\n end",
"def maintenance_list(statuspage_id)\n request :method => :get,\n :url => @url + 'maintenance/list/' + statuspage_id\n end",
"def show\n @schedule = schedule\n respond_to do |format|\n format.html do\n @broadcasts = schedule.broadcasts_and_gaps(Time.now.utc, 1.day.from_now.utc) \n # renders show.html.erb\n end\n format.xml do \n except = [:id, :created_at, :updated_at]\n render :xml => @schedule.to_xml(:except => except)\n end\n end\n end",
"def show\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @schedule }\n end\n end",
"def show\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @schedule }\n end\n end",
"def new\n @maintenance_schedule = MaintenanceSchedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @maintenance_schedule }\n end\n end",
"def show\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.haml\n format.xml { render :xml => @schedule }\n end\n end",
"def index\n @schedules = get_all_schedules\n\n respond_to do |format|\n format.html\n end\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 maintenance_list_by_id(statuspage_id)\n request :method => :get,\n :url => @url + 'maintenances/' + statuspage_id\n end",
"def show\n @class_schedule = ClassSchedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @class_schedule }\n end\n end",
"def maintenance_schedule(statuspage_id, maintenance_name, maintenance_details, infrastructure_affected,\n date_planned_start, time_planned_start, date_planned_end, time_planned_end,\n automation = \"0\", all_infrastructure_affected = \"0\",\n maintenance_notify_now = \"0\", maintenance_notify_1_hr = \"0\",\n maintenance_notify_24_hr = \"0\", maintenance_notify_72_hr = \"0\", message_subject = \"Maintenance Notification\")\n data = {}\n data['statuspage_id'] = statuspage_id\n data['maintenance_name'] = maintenance_name\n data['maintenance_details'] = maintenance_details\n data['infrastructure_affected'] = infrastructure_affected\n data['all_infrastructure_affected'] = all_infrastructure_affected\n data['date_planned_start'] = date_planned_start\n data['time_planned_start'] = time_planned_start\n data['date_planned_end'] = date_planned_end\n data['time_planned_end'] = time_planned_end\n data['automation'] = automation\n data['maintenance_notify_now'] = maintenance_notify_now\n data['maintenance_notify_1_hr'] = maintenance_notify_1_hr\n data['maintenance_notify_24_hr'] = maintenance_notify_24_hr\n data['maintenance_notify_72_hr'] = maintenance_notify_72_hr\n data['message_subject'] = message_subject\n\n request :method => :post,\n :url => @url + 'maintenance/schedule',\n :payload => data\n end",
"def maintenance_schedule\n if maintenance_schedules\n maintenance_schedules.first\n else\n nil\n end\n end",
"def index\n @maintenance_requests = MaintenanceRequest.all\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 new\n respond_to do |format|\n format.xml { render :xml => @schedule }\n end\n end",
"def show\n @interview_session_schedule = InterviewSessionSchedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @interview_session_schedule }\n end\n end",
"def show\n @ptschedule = Ptschedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ptschedule }\n end\n end",
"def index\n @admin_schedules = Clapme::Schedule.all\n end",
"def show\n @scheduled_class = ScheduledClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @scheduled_class }\n end\n end",
"def index\n @my_schedules = MySchedule.all\n end",
"def get_maintenances()\n results = @zabbix.raw_api(\"maintenance.get\", {\"output\" => \"extend\", \"selectHosts\" => \"extend\", \"selectGroups\" => \"extend\"} )\n pp results\n end",
"def schedule\n @schedules = ReportSchedule.all\n\n respond_to do |format|\n format.html\n format.json { render json: @schedules }\n end\n end",
"def create\n @maintenance_schedule = MaintenanceSchedule.new(params[:maintenance_schedule])\n\n respond_to do |format|\n if @maintenance_schedule.save\n format.html { redirect_to(@maintenance_schedule, :notice => 'Maintenance schedule was successfully created.') }\n format.xml { render :xml => @maintenance_schedule, :status => :created, :location => @maintenance_schedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @maintenance_schedule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @maintenance_schedule = MaintenanceSchedule.find(params[:id])\n @maintenance_schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(maintenance_schedules_url) }\n format.xml { head :ok }\n end\n end",
"def index\n @dj_schedules = DjSchedule.all\n end",
"def index\n @schedules = Schedule.all\n end",
"def index\n @schedules = Schedule.all\n end",
"def index\n @schedules = Schedule.all\n end",
"def index\n @schedules = Schedule.all\n end",
"def index\n @schedules = Schedule.all\n end",
"def index\n @schedules = Schedule.all\n end",
"def index\n @schedules = Schedule.all\n end",
"def index\n @schedules = Schedule.all\n end",
"def index\n @schedules = Schedule.all\n end",
"def index\n @schedules = Schedule.all\n end",
"def index\n @nfl_schedules = NflSchedule.all\n end",
"def schedulers(params = {})\n scope 'default'\n get('schedule/schedulers/', params)\n end",
"def reports_schedule\n \n @schedule = ReportSchedule.find(params[:schedule_id])\n \n respond_to do |format|\n format.html\n format.json { render json: @schedule }\n end\n end",
"def index\n @schedules = Schedule.paginate :page => params[:page], :order => \"created_at DESC\", :per_page => 10\n @apps = App.find(:all)\n \n respond_to do |format|\n format.html # index.haml\n format.xml { render :xml => @schedules }\n end\n end",
"def index\n @dis_nfi_schedules = DisNfiSchedule.all\n end",
"def show\n @weeklytimetable = Weeklytimetable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @weeklytimetable }\n end\n end",
"def index\n @work_schedules = WorkSchedule.all\n end",
"def index\n @maintenances = @vehicle.maintenances.order('date desc').page(params[:page])\n end",
"def index\n @commission_days = CommissionDay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @commission_days }\n end\n end",
"def show\n @preventive_maintenance = PreventiveMaintenance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @preventive_maintenance }\n end\n end",
"def index\n @maintenances = Maintenance.order(date_start: :desc).page(params[:page])\n \n end",
"def set_maintenance_schedule\n @schedule = MaintenanceSchedule.find_by_object_key(params[:maintenance_schedule_id])\n end",
"def index\n @dates_schedules = DatesSchedule.all\n end",
"def get_schedule\n Log.add_info(request, params.inspect)\n\n @date = Date.parse(params[:date])\n\n @schedules = Schedule.get_user_day(@login_user, @date)\n\n render(:partial => 'schedule', :layout => false)\n end",
"def index\n log_request(\"Show All Schedules\")\n\n @schedules = Schedule.all\n\n @response = {\n \tevents: @schedules\n }\n\n respond_to do |format|\n format.html { @schedules }\n format.json { render :json => @response }\n end\n end",
"def index\n @mail_schedules = MailSchedule.all\n end",
"def get_schedule\n response = @client.full_game_schedule(@options[:season])\n parse_schedule_response(response)\n end",
"def update\n @maintenance_schedule = MaintenanceSchedule.find(params[:id])\n\n respond_to do |format|\n if @maintenance_schedule.update_attributes(params[:maintenance_schedule])\n format.html { redirect_to(@maintenance_schedule, :notice => 'Maintenance schedule was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @maintenance_schedule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule }\n end\n end",
"def rss\n @logs = RssLog.includes(:name, :species_list, observation: :name).\n where(\"datediff(now(), updated_at) <= 31\").\n order(updated_at: :desc).\n limit(100)\n\n render_xml(layout: false)\n end",
"def index\n @schedule_actions = ScheduleAction.all\n end",
"def index\n @crew_big_sonu_schedules = Crew::BigSonuSchedule.all\n end",
"def show\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def new\n @schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule }\n end\n end",
"def index\n @delivery_times = DeliveryTime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @delivery_times }\n end\n end",
"def show\n @scheduler = Scheduler.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scheduler }\n end\n end",
"def show\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schedule }\n end\n end",
"def show\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schedule }\n end\n end",
"def show\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schedule }\n end\n end",
"def show\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schedule }\n end\n end",
"def index\n @scheduled_tasks = ScheduledTask.paginate(\n :per_page => 20,\n :page => params[:page]\n )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scheduled_tasks }\n end\n end",
"def index\n @best_laps = BestLap.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @best_laps }\n end\n end",
"def index\n permission_denied if !is_adm?\n @maintenance_requests = MaintenanceRequest.where(\"app_status = 0\")\n end",
"def index\n @countdowns = Countdown.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @countdowns }\n end\n end",
"def get_current_tenant_maintenance_window \n get(\"/tenants.json/maintenance\")\nend",
"def show\r\n @route_schedule = RouteSchedule.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @route_schedule }\r\n end\r\n end",
"def schedule_detail access_key\n params = init_params\n request_url = UrlGenerator.url_for(\"schedules\", access_key)\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 new\n @schedule = Schedule.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule }\n end\n end",
"def index\n @schedulers = Scheduler.all\n end",
"def index\n @schedulers = Scheduler.all\n end",
"def index\n @maintenances = Maintenance.not_expired\n end",
"def show\n @reminder_task_list = ReminderTaskList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reminder_task_list }\n end\n end",
"def show\n @doctorsheduling = Doctorsheduling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @doctorsheduling }\n end\n end",
"def index\n @agent_schedules = AgentSchedule.all\n end",
"def schedule(uri); end",
"def get_report_schedule_list(params = {})\n response = get(\"/\", {\"Action\" => \"GetReportScheduleList\"}.merge(params))\n GetReportScheduleListResponse.format(response)\n end",
"def show\n @schedule_item_level = ScheduleItemLevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @schedule_item_level }\n end\n end",
"def show\n @schedule = Schedule.find_by_id(params[:id])\n if @schedule\n #schedule_appointments = @schedule.appointments\n render json: @schedule,status: :ok\n else\n render json: {errorMessage:\"no schedule with id: #{params[:id]}\"}, status: :not_found\n end\n end",
"def maintenances\n @project = Project.find(params[:id])\n @trackers = @project.trackers\n @issue_categories = @project.issue_categories\n @versions = @project.versions\n @issue_statuses = IssueStatus.all\n @issue_priorities = Enumeration.find_all_by_opt(\"IPRI\")\n result = {'trackers' => @trackers, 'statuses' => @issue_statuses, 'versions' => @versions,\n 'categories' => @issue_categories, 'priorities' => @issue_priorities}\n\n respond_to do |format|\n format.html\n format.xml { render :xml => result, :status => :ok}\n format.json { render :json => result }\n end\n\n end",
"def index\n @lookup_scantasks = LookupScantask.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_scantasks }\n end\n end",
"def get_exam_schedules(course_id)\r\n relative_url = Path::COURSES_EXAMSCHEDULES % [course_id]\r\n get(relative_url)\r\n end",
"def show\n @interviewer = Interviewer.find(params[:id])\n\n now = DateTime.now\n\n @next_sched = @interviewer.schedules.where([\"sched_start > ?\", now]) #.find(:conditions=>[\"sched_start < ?\", now])\n @prev_sched = @interviewer.schedules.where([\"sched_start < ?\", now]) #.find(:conditions=>[\"sched_start < ?\", now])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @interviewer }\n end\n end",
"def show\n @daily_grr = DailyGrr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @daily_grr }\n end\n end",
"def rss # :nologin:\n @logs = RssLog.all(conditions: \"datediff(now(), updated_at) <= 31\",\n order: \"updated_at desc\", limit: 100,\n include: [:name,\n :species_list,\n { observation: :name }\n ])\n render_xml(layout: false)\n end",
"def show\n @scheduled_task = ScheduledTask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scheduled_task }\n end\n end",
"def index\n @counter_schedules = CounterSchedule.all\n end",
"def index\n @traffics = Traffic.find(:all, :order => \"created_at\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @traffics }\n end\n end",
"def maintenance_status\n get \"/setup/api/maintenance\", password_hash\n end",
"def index\n @user_schedules = UserSchedule.all\n end",
"def index\n @shift_schedules = ShiftSchedule.all\n end",
"def index\n @schedules = Schedule.where(start: params[:start]..params[:end])\n end",
"def index\n @classroom_laboratory_schedules = ClassroomLaboratorySchedule.all\n end",
"def show\n respond_to do |format|\n format.html do\n @date = Date.parse(params[:date]) rescue Date.today\n @date = Date.today if [email protected]_gregorian_date?\n\n raise ActiveRecord::RecordNotFound if params[:date].present? && [email protected]_items.date_in_range?(@date)\n\n @calendar_items = @calendar.calendar_items.find_all_for_month_of(@date).group_by { |ci| ci.start_time.mday }\n end\n format.any(:rss, :atom) do\n @calendar_items = @calendar.calendar_items.accessible.all(:include => :node, :order => 'start_time', :conditions => [ 'nodes.ancestry = ? ', @calendar.node.child_ancestry ])\n render :layout => false\n end\n format.xml { render :xml => @calendar }\n end\n end",
"def index\n @staff_shifts = StaffShift.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @staff_shifts }\n end\n end"
] | [
"0.6799355",
"0.67379797",
"0.66771525",
"0.6662656",
"0.661458",
"0.65610164",
"0.6522342",
"0.6514605",
"0.64728725",
"0.6445298",
"0.6423056",
"0.63741785",
"0.6374074",
"0.6298707",
"0.62879014",
"0.62817985",
"0.62353796",
"0.6233531",
"0.6213049",
"0.6212554",
"0.6194988",
"0.61886173",
"0.6074128",
"0.60292464",
"0.6015009",
"0.59818983",
"0.5977555",
"0.5977555",
"0.5977555",
"0.5977555",
"0.5977555",
"0.5977555",
"0.5977555",
"0.5977555",
"0.5977555",
"0.5977555",
"0.595818",
"0.5938623",
"0.59326893",
"0.5927819",
"0.58871657",
"0.5886974",
"0.58868307",
"0.58831275",
"0.5848475",
"0.5842265",
"0.5839935",
"0.5839928",
"0.5836386",
"0.5835864",
"0.5833509",
"0.58196014",
"0.5807746",
"0.58003837",
"0.57962656",
"0.5781692",
"0.57792765",
"0.5772293",
"0.57662576",
"0.57643145",
"0.576255",
"0.5762369",
"0.57578415",
"0.57578415",
"0.57578415",
"0.57578415",
"0.5753349",
"0.57399553",
"0.57391346",
"0.57384026",
"0.572251",
"0.5722474",
"0.57216793",
"0.57177883",
"0.57162523",
"0.57162523",
"0.5705802",
"0.56905466",
"0.5688316",
"0.567881",
"0.5678045",
"0.56723094",
"0.56705314",
"0.566905",
"0.5667465",
"0.56634235",
"0.5661791",
"0.5661108",
"0.5659912",
"0.5653819",
"0.5653339",
"0.56415707",
"0.5632347",
"0.5627117",
"0.56230366",
"0.56223506",
"0.5620729",
"0.5608626",
"0.56065",
"0.5599994"
] | 0.74508256 | 0 |
GET /maintenance_schedules/new GET /maintenance_schedules/new.xml | def new
@maintenance_schedule = MaintenanceSchedule.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @maintenance_schedule }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n respond_to do |format|\n format.xml { render :xml => @schedule }\n end\n end",
"def new\n @schedule = Schedule.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule }\n end\n end",
"def new\n @schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule }\n end\n end",
"def new\n @schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule }\n end\n end",
"def create\n @maintenance_schedule = MaintenanceSchedule.new(params[:maintenance_schedule])\n\n respond_to do |format|\n if @maintenance_schedule.save\n format.html { redirect_to(@maintenance_schedule, :notice => 'Maintenance schedule was successfully created.') }\n format.xml { render :xml => @maintenance_schedule, :status => :created, :location => @maintenance_schedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @maintenance_schedule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @class_schedule = ClassSchedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @class_schedule }\n end\n end",
"def new\n @ptschedule = Ptschedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptschedule }\n end\n end",
"def create\n respond_to do |format|\n if @schedule.save\n flash[:notice] = 'Schedule was successfully created.'\n format.html { redirect_to(@schedule) }\n format.xml { render :xml => @schedule, :status => :created, :location => @schedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @schedule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @schedule = Schedule.new\n @apps = App.find(:all)\n @tags = Contact.get_tags\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @schedule }\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 new\n @schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @schedule }\n end\n end",
"def new\n @schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @schedule }\n end\n end",
"def new\r\n @route_schedule = RouteSchedule.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @route_schedule }\r\n end\r\n end",
"def new\n @scheduled_class = ScheduledClass.new\n @scheduled_class.instructor = \"TBD\"\n @scheduled_class.location = \"Live Anywhere\"\n @scheduled_class.start_date = Date.today\n @scheduled_class.end_date = Date.today + 7\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @scheduled_class }\n end\n end",
"def show\n @maintenance_schedule = MaintenanceSchedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @maintenance_schedule }\n end\n end",
"def new\n @manage_schedule = Schedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manage_schedule }\n end\n end",
"def new\n @rssnew = Rssnews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rssnew }\n end\n end",
"def create\n @class_schedule = ClassSchedule.new(params[:class_schedule])\n\n respond_to do |format|\n if @class_schedule.save\n flash[:notice] = 'ClassSchedule was successfully created.'\n format.html { redirect_to(@class_schedule) }\n format.xml { render :xml => @class_schedule, :status => :created, :location => @class_schedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @class_schedule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @ptdo = Ptdo.new(:ptschedule_id => params[:ptschedule_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ptdo }\n end\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 new\n @staff_shift = StaffShift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @staff_shift }\n end\n end",
"def create\n @ptschedule = Ptschedule.new(params[:ptschedule])\n\n respond_to do |format|\n if @ptschedule.save\n flash[:notice] = t('ptschedule.title')+\" \"+t('created')\n format.html { redirect_to(@ptschedule) }\n format.xml { render :xml => @ptschedule, :status => :created, :location => @ptschedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ptschedule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @scheduler = Scheduler.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scheduler }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @schedule_item_level = ScheduleItemLevel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @schedule_item_level }\n end\n end",
"def new\n @event_schedule = EventSchedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event_schedule }\n end\n end",
"def new\n @time_task = TimeTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @time_task }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @calendar = Calendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendar }\n end\n end",
"def new\n @daily_grr = DailyGrr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @daily_grr }\n end\n end",
"def new\n @lookup_scantask = LookupScantask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_scantask }\n end\n end",
"def new\n authorize! :new, Schedule, :message => 'Not authorized as an administrator.'\n @schedule = Schedule.new(key: params[:key])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @schedule }\n end\n end",
"def new\n @workperiod = Workperiod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @workperiod }\n end\n end",
"def new\n @commission_day = CommissionDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @commission_day }\n end\n end",
"def create\n @rssnew = Rssnews.new(params[:rssnew])\n\n respond_to do |format|\n if @rssnew.save\n flash[:notice] = 'Rssnew was successfully created.'\n format.html { redirect_to(@rssnew) }\n format.xml { render :xml => @rssnew, :status => :created, :location => @rssnew }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rssnew.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @pending_month = PendingMonth.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pending_month }\n end\n end",
"def new\n @page_title = \"Task List New\"\n @task_list = TaskList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task_list }\n end\n end",
"def create\n @admin_schedule = Clapme::Schedule.new(admin_schedule_params)\n\n respond_to do |format|\n if @admin_schedule.save\n format.html { redirect_to admin_schedule_url(@admin_schedule.id), notice: 'Schedule was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_schedule }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_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 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 new\n @sleep_log = SleepLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sleep_log }\n end\n end",
"def create\n @nfl_schedule = NflSchedule.new(nfl_schedule_params)\n\n respond_to do |format|\n if @nfl_schedule.save\n format.html { redirect_to @nfl_schedule, notice: 'Nfl schedule was successfully created.' }\n format.json { render :show, status: :created, location: @nfl_schedule }\n else\n format.html { render :new }\n format.json { render json: @nfl_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @task = Task.new\n @sprint = Sprint.find(params[:id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end",
"def new\n @sprint = Sprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint }\n end\n end",
"def new\n @sprint = Sprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint }\n end\n end",
"def create\n @maintenance = Maintenance.new(maintenance_params)\n respond_to do |format|\n if @maintenance.save\n format.html { redirect_to @maintenance, notice: (t 'maintenances.title')+(t 'actions.created') }\n format.json { render action: 'show', status: :created, location: @maintenance }\n else\n format.html { render action: 'new' }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @doctorsheduling = Doctorsheduling.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @doctorsheduling }\n end\n end",
"def new\n\t\tlogger.debug(\"/routes/new params[:route] : #{params[:route].inspect}\")\n\t\t@route = Route.new(params[:route])\n\t\t@sports = Sport.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @route }\n\t\tend\n\tend",
"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 new\n @scheduled_task = ScheduledTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scheduled_task }\n end\n end",
"def new\n @sprint = Sprint.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sprint }\n end\n end",
"def new\n @workflow = Workflow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @workflow }\n end\n end",
"def new\n @scheduled_service = ScheduledService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scheduled_service }\n end\n end",
"def new\n @dailyreport = Dailyreport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dailyreport }\n end\n end",
"def new\n @polling_station = PollingStation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @polling_station }\n end\n end",
"def new\n @occurence = Occurence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @occurence }\n end\n end",
"def new\n @availability_day = AvailabilityDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @availability_day }\n end\n end",
"def new\n @shift = Shift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shift }\n end\n end",
"def new\n @shift = Shift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shift }\n end\n end",
"def new\n @shift = Shift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shift }\n end\n end",
"def new\n @vehicle_daily = VehicleDaily.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vehicle_daily }\n end\n end",
"def maintenance_schedule(statuspage_id, maintenance_name, maintenance_details, infrastructure_affected,\n date_planned_start, time_planned_start, date_planned_end, time_planned_end,\n automation = \"0\", all_infrastructure_affected = \"0\",\n maintenance_notify_now = \"0\", maintenance_notify_1_hr = \"0\",\n maintenance_notify_24_hr = \"0\", maintenance_notify_72_hr = \"0\", message_subject = \"Maintenance Notification\")\n data = {}\n data['statuspage_id'] = statuspage_id\n data['maintenance_name'] = maintenance_name\n data['maintenance_details'] = maintenance_details\n data['infrastructure_affected'] = infrastructure_affected\n data['all_infrastructure_affected'] = all_infrastructure_affected\n data['date_planned_start'] = date_planned_start\n data['time_planned_start'] = time_planned_start\n data['date_planned_end'] = date_planned_end\n data['time_planned_end'] = time_planned_end\n data['automation'] = automation\n data['maintenance_notify_now'] = maintenance_notify_now\n data['maintenance_notify_1_hr'] = maintenance_notify_1_hr\n data['maintenance_notify_24_hr'] = maintenance_notify_24_hr\n data['maintenance_notify_72_hr'] = maintenance_notify_72_hr\n data['message_subject'] = message_subject\n\n request :method => :post,\n :url => @url + 'maintenance/schedule',\n :payload => data\n end",
"def new\n @reminder_task_list = ReminderTaskList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reminder_task_list }\n end\n end",
"def new\n @workflow_task = WorkflowTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @workflow_task }\n end\n end",
"def new\n @task_priority = TaskPriority.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @task_priority }\n end\n end",
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end",
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end",
"def new\n @best_lap = BestLap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @best_lap }\n end\n end",
"def new\n @delivery_time = DeliveryTime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @delivery_time }\n end\n end",
"def new\n @traffic = Traffic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @traffic }\n end\n end",
"def new\n @flight_schedule = FlightSchedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flight_schedule }\n end\n end",
"def new\n @tstat = Tstat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tstat }\n end\n end",
"def new\n @track_calendar = TrackCalendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @track_calendar }\n end\n end",
"def new\n @reservation = Reservation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reservation }\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.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\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 new\n @countdown = Countdown.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @countdown }\n end\n end",
"def new\n @user_schedule = UserSchedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_schedule }\n end\n end",
"def new\n @calendario = Calendario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @calendario }\n end\n end",
"def new\n @station = Station.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @station }\n end\n end",
"def create_one\n @laxid = params[:laxid]\n \tCreateScheduleService.new.scrape_team_schedule(@laxid)\n redirect_to \"/schedule/show?laxid=#{@laxid}\"\n end",
"def create\n # Logic to createa record\n @maintenance = Maintenance.new(params[:maintenance])\n\n respond_to do |format|\n if @maintenance.save\n format.html { redirect_to @maintenance, notice: 'Maintenance was successfully created.' }\n format.json { render json: @maintenance, status: :created, location: @maintenance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @production = Production.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @production }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end",
"def new\n @delay = Delay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @delay }\n end\n end",
"def new\n @today_activity = TodayActivity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @today_activity }\n end\n end",
"def new\n @work_day = WorkDay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @work_day }\n end\n end",
"def create\n @scheduled_class = ScheduledClass.new(params[:scheduled_class])\n\n respond_to do |format|\n if @scheduled_class.save\n format.html { redirect_to(@scheduled_class, :notice => 'ScheduledClass was successfully created.') }\n format.xml { render :xml => @scheduled_class, :status => :created, :location => @scheduled_class }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @scheduled_class.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @news_update = NewsUpdate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news_update }\n end\n end",
"def new\n @dashboard = Dashboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dashboard }\n end\n end",
"def new\n @dashboard = Dashboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dashboard }\n end\n end",
"def create\n @maintenance = Maintenance.new(maintenance_params)\n\n respond_to do |format|\n if @maintenance.save\n format.html { redirect_to @maintenance, notice: 'Maintenance was successfully created.' }\n format.json { render :show, status: :created, location: @maintenance }\n else\n format.html { render :new }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @menu_calendar = MenuCalendar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @menu_calendar }\n end\n end",
"def new\n @dailyreport_job = DailyreportJob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dailyreport_job }\n end\n end",
"def new\n @scheduled_facility = ScheduledFacility.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scheduled_facility }\n end\n end",
"def new\n @quartz = Quartz.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @quartz }\n end\n end",
"def new\n @route_rule = RouteRule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route_rule }\n end\n end",
"def new\n @tournament = @resource_finder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tournament }\n end\n end"
] | [
"0.7685377",
"0.7409408",
"0.7407814",
"0.73829937",
"0.73501813",
"0.72707444",
"0.7183455",
"0.6852251",
"0.6832066",
"0.6758014",
"0.66073716",
"0.6599364",
"0.65242624",
"0.65040135",
"0.64763653",
"0.6439372",
"0.6435777",
"0.64250743",
"0.6356924",
"0.6353907",
"0.63486475",
"0.6337932",
"0.63295496",
"0.6328975",
"0.6324083",
"0.6297219",
"0.6272545",
"0.62695956",
"0.62695956",
"0.62695956",
"0.62695956",
"0.62695956",
"0.6265234",
"0.6255822",
"0.62524486",
"0.6249315",
"0.62450093",
"0.62384987",
"0.6236074",
"0.6228557",
"0.62255335",
"0.6223167",
"0.62214303",
"0.6221253",
"0.62176913",
"0.621218",
"0.621218",
"0.6207521",
"0.6190239",
"0.6190189",
"0.61865145",
"0.6185816",
"0.6182619",
"0.61700034",
"0.616639",
"0.6155252",
"0.61536664",
"0.6150533",
"0.615",
"0.61405313",
"0.61405313",
"0.61405313",
"0.61394995",
"0.61374",
"0.6134292",
"0.61278677",
"0.6121049",
"0.6119148",
"0.6119148",
"0.61178756",
"0.61171395",
"0.6113639",
"0.61066467",
"0.610162",
"0.61003923",
"0.60990363",
"0.60982555",
"0.6093137",
"0.608491",
"0.60843074",
"0.6078247",
"0.60770464",
"0.60754025",
"0.60738033",
"0.6066138",
"0.60645056",
"0.60632354",
"0.60630506",
"0.6062942",
"0.6061822",
"0.6058886",
"0.60586464",
"0.60586464",
"0.605681",
"0.60559076",
"0.6055116",
"0.6052532",
"0.60507864",
"0.60489136",
"0.6048743"
] | 0.79876274 | 0 |
POST /maintenance_schedules POST /maintenance_schedules.xml | def create
@maintenance_schedule = MaintenanceSchedule.new(params[:maintenance_schedule])
respond_to do |format|
if @maintenance_schedule.save
format.html { redirect_to(@maintenance_schedule, :notice => 'Maintenance schedule was successfully created.') }
format.xml { render :xml => @maintenance_schedule, :status => :created, :location => @maintenance_schedule }
else
format.html { render :action => "new" }
format.xml { render :xml => @maintenance_schedule.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maintenance_schedule(statuspage_id, maintenance_name, maintenance_details, infrastructure_affected,\n date_planned_start, time_planned_start, date_planned_end, time_planned_end,\n automation = \"0\", all_infrastructure_affected = \"0\",\n maintenance_notify_now = \"0\", maintenance_notify_1_hr = \"0\",\n maintenance_notify_24_hr = \"0\", maintenance_notify_72_hr = \"0\", message_subject = \"Maintenance Notification\")\n data = {}\n data['statuspage_id'] = statuspage_id\n data['maintenance_name'] = maintenance_name\n data['maintenance_details'] = maintenance_details\n data['infrastructure_affected'] = infrastructure_affected\n data['all_infrastructure_affected'] = all_infrastructure_affected\n data['date_planned_start'] = date_planned_start\n data['time_planned_start'] = time_planned_start\n data['date_planned_end'] = date_planned_end\n data['time_planned_end'] = time_planned_end\n data['automation'] = automation\n data['maintenance_notify_now'] = maintenance_notify_now\n data['maintenance_notify_1_hr'] = maintenance_notify_1_hr\n data['maintenance_notify_24_hr'] = maintenance_notify_24_hr\n data['maintenance_notify_72_hr'] = maintenance_notify_72_hr\n data['message_subject'] = message_subject\n\n request :method => :post,\n :url => @url + 'maintenance/schedule',\n :payload => data\n end",
"def schedule\n POST \"https://www.googleapis.com/calendar/v3/calendars/#{calendar_id}/events\"\n render \"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.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 set_maintenance_schedule\n @schedule = MaintenanceSchedule.find_by_object_key(params[:maintenance_schedule_id])\n end",
"def create\n @dates_schedule = DatesSchedule.new(dates_schedule_params)\n\n respond_to do |format|\n if @dates_schedule.save\n format.html { redirect_to @dates_schedule, notice: 'Dates schedule was successfully created.' }\n format.json { render :show, status: :created, location: @dates_schedule }\n else\n format.html { render :new }\n format.json { render json: @dates_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def maintenance_start(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/start',\n :payload => data\n end",
"def create\n respond_to do |format|\n if @schedule.save\n flash[:notice] = 'Schedule was successfully created.'\n format.html { redirect_to(@schedule) }\n format.xml { render :xml => @schedule, :status => :created, :location => @schedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @schedule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @maintenance = Maintenance.new(maintenance_params)\n\n respond_to do |format|\n if @maintenance.save\n format.html { redirect_to @maintenance, notice: 'Maintenance was successfully created.' }\n format.json { render :show, status: :created, location: @maintenance }\n else\n format.html { render :new }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_schedule = Clapme::Schedule.new(admin_schedule_params)\n\n respond_to do |format|\n if @admin_schedule.save\n format.html { redirect_to admin_schedule_url(@admin_schedule.id), notice: 'Schedule was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_schedule }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nfl_schedule = NflSchedule.new(nfl_schedule_params)\n\n respond_to do |format|\n if @nfl_schedule.save\n format.html { redirect_to @nfl_schedule, notice: 'Nfl schedule was successfully created.' }\n format.json { render :show, status: :created, location: @nfl_schedule }\n else\n format.html { render :new }\n format.json { render json: @nfl_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dis_nfi_schedule = DisNfiSchedule.new(dis_nfi_schedule_params)\n\n respond_to do |format|\n if @dis_nfi_schedule.save\n format.html { redirect_to @dis_nfi_schedule, notice: 'Dis nfi schedule was successfully created.' }\n format.json { render :show, status: :created, location: @dis_nfi_schedule }\n else\n format.html { render :new }\n format.json { render json: @dis_nfi_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @maintenance = Maintenance.new(maintenance_params)\n respond_to do |format|\n if @maintenance.save\n format.html { redirect_to @maintenance, notice: (t 'maintenances.title')+(t 'actions.created') }\n format.json { render action: 'show', status: :created, location: @maintenance }\n else\n format.html { render action: 'new' }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def maintenance_params\n params.require(:maintenance).permit(:name, :date_start, :date_end, :contact_id, :maintenance_ressource_id)\n end",
"def create\n @weekly_schedule = WeeklySchedule.new(weekly_schedule_params)\n\n respond_to do |format|\n if @weekly_schedule.save\n format.html { redirect_to @weekly_schedule, notice: 'Weekly schedule was successfully created.' }\n format.json { render :show, status: :created, location: @weekly_schedule }\n else\n format.html { render :new }\n format.json { render json: @weekly_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 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 new\n @maintenance_schedule = MaintenanceSchedule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @maintenance_schedule }\n end\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 schedule_params\n params.require(:schedule).permit(:content, :action_type, :start_time, :termination_time)\n end",
"def create\n @inspection_schedule = InspectionSchedule.new(inspection_schedule_savable_params)\n\n respond_to do |format|\n if @inspection_schedule.save\n format.html { redirect_to @inspection_schedule, notice: 'InspectionSchedule was successfully created.' }\n format.json { render :show, status: :created, location: @inspection_schedule }\n else\n format.html { render :new }\n format.json { render json: @inspection_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dj_schedule = DjSchedule.new(dj_schedule_params)\n\n respond_to do |format|\n if @dj_schedule.save\n format.html { redirect_to @dj_schedule, notice: 'Dj schedule was successfully created.' }\n format.json { render :show, status: :created, location: @dj_schedule }\n else\n format.html { render :new }\n format.json { render json: @dj_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: 'スケジュールの登録が正常に行われました。' }\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 destroy\n @maintenance_schedule = MaintenanceSchedule.find(params[:id])\n @maintenance_schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(maintenance_schedules_url) }\n format.xml { head :ok }\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 maintenance_finish(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/finish',\n :payload => data\n end",
"def create\n @mail_schedule = MailSchedule.new(mail_schedule_params)\n\n respond_to do |format|\n if @mail_schedule.save\n format.html { redirect_to @mail_schedule, notice: 'Mail schedule was successfully created.' }\n format.json { render :show, status: :created, location: @mail_schedule }\n else\n format.html { render :new }\n format.json { render json: @mail_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 @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 schedule(subperiod,year,gs,expiry_date)\n #URL della servlet\n url = URI.parse(CONFIG['servlet']['address'])\n #impostazione del metodo POST\n req = Net::HTTP::Post.new(url.path)\n #parametri di autenticazione\n #req.basic_auth 'jack', 'pass'\n #dati da inviare op = ScheduleJob\n if expiry_date\n data = expiry_date.date\n day = data.day.to_i\n if day < 10\n day = \"0\" + day.to_s\n else\n day = day.to_s\n end\n month = data.mon.to_i\n if month < 10\n month = \"0\" + month.to_s\n else\n month = month.to_s\n end\n date = day + \"-\" + month + \"-\" + data.year.to_s\n req.set_form_data({'op'=>'sj', 'graduate_course' => gs.id.to_s,\n 'year' => year,\n 'subperiod' => subperiod.to_s,\n 'date'=> date\n }, '&')\n else\n req.set_form_data({'op'=>'sj', 'graduate_course' => gs.id.to_s,\n 'year' => year,\n 'subperiod' => subperiod.to_s\n }, '&')\n #connessione alla servlet\n end\n res = Net::HTTP.new(url.host, url.port).start {\n |http| http.request(req)\n }\n #controllo del codice di errore\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n return true\n when Net::HTTPNotAcceptable\n #parametri non corretti.. riportare alla form\n return false\n else\n #errore connessione.. riprovare\n return false\n end\n end",
"def create\n @interview_session_schedule = InterviewSessionSchedule.new(params[:interview_session_schedule])\n\n respond_to do |format|\n if @interview_session_schedule.save\n format.html { redirect_to(@interview_session_schedule, :notice => 'Interview session schedule was successfully created.') }\n format.xml { render :xml => @interview_session_schedule, :status => :created, :location => @interview_session_schedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @interview_session_schedule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @class_schedule = ClassSchedule.new(params[:class_schedule])\n\n respond_to do |format|\n if @class_schedule.save\n flash[:notice] = 'ClassSchedule was successfully created.'\n format.html { redirect_to(@class_schedule) }\n format.xml { render :xml => @class_schedule, :status => :created, :location => @class_schedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @class_schedule.errors, :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.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 @agent_schedule = AgentSchedule.new(agent_schedule_params)\n\n respond_to do |format|\n if @agent_schedule.save\n format.html { redirect_to @agent_schedule, notice: 'Agent schedule was successfully created.' }\n format.json { render :show, status: :created, location: @agent_schedule }\n else\n format.html { render :new }\n format.json { render json: @agent_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Logic to createa record\n @maintenance = Maintenance.new(params[:maintenance])\n\n respond_to do |format|\n if @maintenance.save\n format.html { redirect_to @maintenance, notice: 'Maintenance was successfully created.' }\n format.json { render json: @maintenance, status: :created, location: @maintenance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ptschedule = Ptschedule.new(params[:ptschedule])\n\n respond_to do |format|\n if @ptschedule.save\n flash[:notice] = t('ptschedule.title')+\" \"+t('created')\n format.html { redirect_to(@ptschedule) }\n format.xml { render :xml => @ptschedule, :status => :created, :location => @ptschedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ptschedule.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 @schedule.save\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 maintenance_schedule\n if maintenance_schedules\n maintenance_schedules.first\n else\n nil\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\n @schedule_action = ScheduleAction.new(schedule_action_params)\n\n respond_to do |format|\n if @schedule_action.save\n format.html { redirect_to @schedule_action, notice: 'Schedule action was successfully created.' }\n format.json { render :show, status: :created, location: @schedule_action }\n else\n format.html { render :new }\n format.json { render json: @schedule_action.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @schedule = @applicant.schedules.new(schedule_params)\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to @location, notice: 'Schedule was successfully created.' }\n format.json { render :show, status: :created, location: @location }\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 if params[:schedule][\"start_time(1i)\"] > params[:schedule][\"end_time(1i)\"]\n redirect_to \"/find\"\n return\n end\n\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 schedule_params\n params.require(:schedule).permit(:week, :dayOfWeek, :beginHour, :endHour, :status)\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 schedule_params\n params.require(:schedule).permit(:schedule_id, :state, :device_id, :date, :time, :repetition, :interval)\n end",
"def update\n @maintenance_schedule = MaintenanceSchedule.find(params[:id])\n\n respond_to do |format|\n if @maintenance_schedule.update_attributes(params[:maintenance_schedule])\n format.html { redirect_to(@maintenance_schedule, :notice => 'Maintenance schedule was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @maintenance_schedule.errors, :status => :unprocessable_entity }\n end\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 create\n @maintenance = @vehicle.maintenances.build(maintenance_params)\n\n respond_to do |format|\n if @maintenance.save\n format.html { redirect_to [@vehicle, :maintenances], notice: 'Maintenance was successfully created.' }\n format.json { render :show, status: :created, location: @maintenance }\n else\n format.html { render :new }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def schedule_params\n\t\tparams.require(:schedule).permit(:schedule_date,:diagnose,:surgery_location_id,:surgery)\n\tend",
"def create\n @schedule = current_user.schedules.new(schedule_params)\n\n respond_to do |format|\n if @schedule.save\n format.html {redirect_to root_url, notice: 'スケジュールが作成されました'}\n format.json {render :show, status: :created, location: @schedule}\n else\n @action_type = @schedule.action_type\n format.html {render :new}\n format.json {render json: @schedule.errors, status: :unprocessable_entity}\n end\n end\n end",
"def schedule_params\n params.require(:schedule).permit(:bustrain, :routeid, :starttime, :endtime, :days)\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 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 create\n @crew_big_sonu_schedule = Crew::BigSonuSchedule.new(crew_big_sonu_schedule_params)\n\n respond_to do |format|\n if @crew_big_sonu_schedule.save\n format.html { redirect_to @crew_big_sonu_schedule, notice: 'Big sonu schedule was successfully created.' }\n format.json { render :show, status: :created, location: @crew_big_sonu_schedule }\n else\n format.html { render :new }\n format.json { render json: @crew_big_sonu_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @work_schedule = WorkSchedule.new(work_schedule_params)\n\n respond_to do |format|\n if @work_schedule.save\n format.html { redirect_to @work_schedule, notice: 'Work schedule was successfully created.' }\n format.json { render :show, status: :created, location: @work_schedule }\n else\n format.html { render :new }\n format.json { render json: @work_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @maintenance_requests = MaintenanceRequest.all\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 @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 @class_schedule = ClassSchedule.new(class_schedule_params)\n\n respond_to do |format|\n if @class_schedule.save\n format.html { redirect_to class_schedules_path, notice: 'Розклад занять був успішно доданий.' }\n format.json { render :index, status: :created, location: @class_schedule }\n else\n format.html { render :new }\n format.json { render json: @class_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def schedule_action_params\n params.require(:schedule_action).permit(:description, :start_date, :end_date, :schedule_id)\n end",
"def schedule\n @schedules = ReportSchedule.all\n\n respond_to do |format|\n format.html\n format.json { render json: @schedules }\n end\n end",
"def schedule_params\n params.require(:schedule).permit(:construction_datum_id, :content_name, :estimated_start_date, :estimated_end_date, :work_start_date, :work_end_date)\n end",
"def new\n respond_to do |format|\n format.xml { render :xml => @schedule }\n end\n end",
"def send_schedule\n team = Team.find(params[:id])\n authorize! :manage, team\n\n # used to send out the schedule.\n # now removed, as we send out weekly schedules instead/updates within 7 days\n\n render json: { schedule_sent: true }\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 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_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 @schedule = Schedule.new(schedule_params)\n respond_to do |format|\n if @block && @schedule.save\n student_class_conflict_on_create\n format.html { redirect_to admins_backoffice_schedules_path, notice: @notice }\n format.json { render 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_params\n params.require(:schedule).permit(:name, :body, :sch_type)\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 create\n @doctorsheduling = Doctorsheduling.new(params[:doctorsheduling])\n\n respond_to do |format|\n if @doctorsheduling.save\n format.html { redirect_to(@doctorsheduling, :notice => 'Doctorsheduling was successfully created.') }\n format.xml { render :xml => @doctorsheduling, :status => :created, :location => @doctorsheduling }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @doctorsheduling.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @runschedule = Runschedule.new(runschedule_params)\n\n respond_to do |format|\n if @runschedule.save\n format.html { redirect_to @runschedule, notice: 'Runschedule was successfully created.' }\n format.json { render :show, status: :created, location: @runschedule }\n else\n format.html { render :new }\n format.json { render json: @runschedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event_schedule = EventSchedule.new(params[:event_schedule])\n\n respond_to do |format|\n if @event_schedule.save\n format.html { redirect_to @event_schedule, notice: 'Event schedule was successfully created.' }\n format.json { render json: @event_schedule, status: :created, location: @event_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @counter_schedule = CounterSchedule.new(counter_schedule_params)\n\n respond_to do |format|\n if @counter_schedule.save\n format.html { redirect_to @counter_schedule, notice: 'Counter schedule was successfully created.' }\n format.json { render :show, status: :created, location: @counter_schedule }\n else\n format.html { render :new }\n format.json { render json: @counter_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @scheduler = Scheduler.new(scheduler_params)\n\n respond_to do |format|\n if @scheduler.save\n format.html { redirect_to @scheduler, notice: 'Scheduler was successfully created.' }\n format.json { render :show, status: :created, location: @scheduler }\n else\n format.html { render :new }\n format.json { render json: @scheduler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\tschedule = current_user.schedules.create(schedule_params)\n\t\t# updating the patient_id after scheduled created\n\t\tschedule.update_attributes(patient_id: params[:patient_id]) if !params[:patient_id].nil?\n\t\t# after schedule creation redirect to the schedules index page \n\t\tredirect_to schedules_path\n\tend",
"def schedule_params\n params.require(:schedule).permit(:start_at, :end_at)\n end",
"def create\n @interviewscheduler = Interviewscheduler.new(interviewscheduler_params)\n\n respond_to do |format|\n @interviewscheduler.update(:status => \"Assessment Scheduled\")\n if @interviewscheduler.save\n format.html { redirect_to @interviewscheduler, notice: 'Interviewscheduler was successfully created.' }\n format.json { render action: 'show', status: :created, location: @interviewscheduler }\n else\n format.html { render action: 'new' }\n format.json { render json: @interviewscheduler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_architect_schedules(opts = {})\n data, _status_code, _headers = post_architect_schedules_with_http_info(opts)\n return data\n end",
"def create\n @user_schedule = UserSchedule.new(params[:user_schedule])\n\n respond_to do |format|\n if @user_schedule.save\n format.html { redirect_to @user_schedule, notice: 'User schedule was successfully created.' }\n format.json { render json: @user_schedule, status: :created, location: @user_schedule }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_schedule.errors, status: :unprocessable_entity }\n end\n end\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 maintenance_params\n params.require(:maintenance).permit(:date, :cost, :description, :warranty, :mileage, :vehicle_id, :warranty_status, :maintenance_type)\n end",
"def schedule_params\n params.require(:schedule).permit(:title, :description, :start, :end)\n end",
"def schedule_params\n params.require(:schedule).permit(:doctor_id, :dow, :weeks, :start_time, :end_time)\n end",
"def admin_schedule_params\n params.require(:schedule).permit(:name, :concurrent_events_enable, :clapme_stages_id)\n end",
"def create\r\n\r\n @schedule = Schedule.new(params[:schedule])\r\n @schedule.event_id = params[:id]\r\n @schedule.date = params[:date]\r\n respond_to do |format|\r\n if @schedule.save\r\n # format.html { redirect_to new_schedule_path(params[:id],params[:date]), notice: 'Schedule was successfully created.' }\r\n format.html { redirect_to event_path(params[:id]), notice: 'Schedule was successfully created.' }\r\n\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @scheduled_class = ScheduledClass.new(params[:scheduled_class])\n\n respond_to do |format|\n if @scheduled_class.save\n format.html { redirect_to(@scheduled_class, :notice => 'ScheduledClass was successfully created.') }\n format.xml { render :xml => @scheduled_class, :status => :created, :location => @scheduled_class }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @scheduled_class.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def schedule_params\n params.require(:schedule).permit(:title, :date_range, :start, :end)\n end",
"def schedule_params\n params.require(:schedule).permit(:activity_id, :_id, :start, :end)\n end",
"def create\n @scheduler = Scheduler.new(params[:scheduler])\n\n respond_to do |format|\n if @scheduler.save\n format.html { redirect_to @scheduler, notice: 'Scheduler was successfully created.' }\n format.json { render json: @scheduler, status: :created, location: @scheduler }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scheduler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def schedule_params\n params.require(:schedule).permit(:term_from, :term_to, :target,\n :achievement, :body, :destination, :action_plan_id,\n :activity_setup, :activity_interview, :activity_inspection,\n :activity_presentation, :activity_engagement,\n { customer_ids: [] })\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 post_architect_schedules(body, opts = {})\n data, _status_code, _headers = post_architect_schedules_with_http_info(body, opts)\n return data\n end",
"def schedule_params\n params.require(:schedule).permit(:weeks)\n end",
"def schedule_params\n params.require(:schedule).permit(:shift_id, :employee, :date, :schedule_id, :start, :end)\n end",
"def create\n @maintenance_request = current_user.maintenance_requests.build(maintenance_request_params)\n\n respond_to do |format|\n if @maintenance_request.save\n @stations = Station.all\n @maintenance_requests = MaintenanceRequest.all\n\n format.html { redirect_to @maintenance_request, notice: 'Maintenance request was successfully created.' }\n format.json { render :show, status: :created, location: @maintenance_request }\n format.js\n else\n format.html { render :new }\n format.json { render json: @maintenance_request.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def has_maintenance_schedules?\n maintenance_schedules.count > 0\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 @classroom_laboratory_schedule = ClassroomLaboratorySchedule.new(classroom_laboratory_schedule_params)\n\n respond_to do |format|\n if @classroom_laboratory_schedule.save\n format.html { redirect_to @classroom_laboratory_schedule, notice: 'Classroom laboratory schedule was successfully created.' }\n format.json { render action: 'show', status: :created, location: @classroom_laboratory_schedule }\n else\n format.html { render action: 'new' }\n format.json { render json: @classroom_laboratory_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @maintreport = Maintreport.new(params[:maintreport])\n @maintenance = Maintenance.find(params[:maintreport][:maintenance_id])\n \n respond_to do |format|\n if @maintreport.save\n if params[:plan]\n update_next_date_hour\n update_partqty\n format.html { render :action => \"show\" }\n format.xml { render :xml => @maintreport, :status => :created, :location => @maintreport }\n elsif params[:unplan]\n update_work_status\n update_partqty\n format.html { render :action => \"show_up\" }\n format.xml { render :xml => @maintreport, :status => :created, :location => @maintreport }\n end\n else\n if params[:plan]\n format.html { render :action => \"new\" }\n format.xml { render :xml => @maintreport.errors, :status => :unprocessable_entity }\n elsif params[:unplan]\n format.html { render :action => \"new_up\" }\n format.xml { render :xml => @maintreport.errors, :status => :unprocessable_entity }\n end\n end\n end\n end"
] | [
"0.7592277",
"0.61357504",
"0.60902613",
"0.6038409",
"0.6036109",
"0.6004008",
"0.5988473",
"0.5984874",
"0.59486353",
"0.59261113",
"0.59167206",
"0.5914411",
"0.59142184",
"0.5912462",
"0.5911313",
"0.5902852",
"0.5888488",
"0.58406913",
"0.5836415",
"0.58203983",
"0.58186716",
"0.58183557",
"0.58180434",
"0.58102584",
"0.5793524",
"0.57867634",
"0.5786125",
"0.57770383",
"0.5765466",
"0.5764256",
"0.57627404",
"0.5762565",
"0.57465214",
"0.57460207",
"0.5738753",
"0.57019275",
"0.5700424",
"0.5699517",
"0.5698523",
"0.5697368",
"0.5695023",
"0.5686042",
"0.56837636",
"0.5682636",
"0.5661758",
"0.565888",
"0.56489533",
"0.5647817",
"0.56468153",
"0.56245",
"0.56208014",
"0.5619418",
"0.5618756",
"0.56178564",
"0.5616742",
"0.56119424",
"0.5591549",
"0.5590699",
"0.55863667",
"0.5583717",
"0.55823",
"0.5580684",
"0.5578709",
"0.5569891",
"0.55620253",
"0.55536526",
"0.55523086",
"0.555157",
"0.55490875",
"0.55490357",
"0.55368394",
"0.55289954",
"0.5499983",
"0.5494749",
"0.54947466",
"0.548943",
"0.5489354",
"0.548439",
"0.54820853",
"0.5479565",
"0.54795146",
"0.5477924",
"0.54753995",
"0.54704285",
"0.5469673",
"0.5463873",
"0.54619265",
"0.54619193",
"0.5457573",
"0.54541445",
"0.5451934",
"0.5451911",
"0.5451719",
"0.54432243",
"0.5441262",
"0.54389626",
"0.5430838",
"0.5430093",
"0.5420602",
"0.54193854"
] | 0.70385146 | 1 |
PUT /maintenance_schedules/1 PUT /maintenance_schedules/1.xml | def update
@maintenance_schedule = MaintenanceSchedule.find(params[:id])
respond_to do |format|
if @maintenance_schedule.update_attributes(params[:maintenance_schedule])
format.html { redirect_to(@maintenance_schedule, :notice => 'Maintenance schedule was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @maintenance_schedule.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n format.html { redirect_to(@schedule, :notice => 'Schedule was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @schedule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_maintenance_schedule\n @schedule = MaintenanceSchedule.find_by_object_key(params[:maintenance_schedule_id])\n end",
"def maintenance_schedule(statuspage_id, maintenance_name, maintenance_details, infrastructure_affected,\n date_planned_start, time_planned_start, date_planned_end, time_planned_end,\n automation = \"0\", all_infrastructure_affected = \"0\",\n maintenance_notify_now = \"0\", maintenance_notify_1_hr = \"0\",\n maintenance_notify_24_hr = \"0\", maintenance_notify_72_hr = \"0\", message_subject = \"Maintenance Notification\")\n data = {}\n data['statuspage_id'] = statuspage_id\n data['maintenance_name'] = maintenance_name\n data['maintenance_details'] = maintenance_details\n data['infrastructure_affected'] = infrastructure_affected\n data['all_infrastructure_affected'] = all_infrastructure_affected\n data['date_planned_start'] = date_planned_start\n data['time_planned_start'] = time_planned_start\n data['date_planned_end'] = date_planned_end\n data['time_planned_end'] = time_planned_end\n data['automation'] = automation\n data['maintenance_notify_now'] = maintenance_notify_now\n data['maintenance_notify_1_hr'] = maintenance_notify_1_hr\n data['maintenance_notify_24_hr'] = maintenance_notify_24_hr\n data['maintenance_notify_72_hr'] = maintenance_notify_72_hr\n data['message_subject'] = message_subject\n\n request :method => :post,\n :url => @url + 'maintenance/schedule',\n :payload => data\n end",
"def update\n @schedule = Schedule.find(params[:id])\n\n if @schedule.update(params[:schedule])\n head :no_content\n else\n render json: @schedule.errors, status: :unprocessable_entity\n end\n end",
"def update\n @schedule = Schedule.find(params[:id])\n \n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n\t expire_page :action => 'show', :id => params[:id]\n flash[:notice] = 'Schedule was successfully updated.'\n format.html { redirect_to(@schedule) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @schedule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n format.html { redirect_to @schedule, :notice => 'Schedule was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @schedule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @schedule.update(schedule_params)\n end",
"def update\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n format.html { redirect_to schedules_path, notice: 'Agendamento atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @schedule.update(schedule_params)\n render text: \" \"\n end",
"def update\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n flash[:notice] = 'Schedule was successfully updated.'\n format.html { redirect_to(schedule_path(@schedule)) }\n format.xml { head :ok }\n else\n @apps = App.find(:all)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @schedule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @class_schedule = ClassSchedule.find(params[:id])\n\n respond_to do |format|\n if @class_schedule.update_attributes(params[:class_schedule])\n flash[:notice] = 'ClassSchedule was successfully updated.'\n format.html { redirect_to(@class_schedule) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @class_schedule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n data = schedule_params\n data[:update_at] = Time.now\n if @schedule.update(data)\n format.html { redirect_to @schedule, notice: 'Schedule ha sido actualizado.' }\n format.json { render :index, status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule,\n notice: 'Schedule was successfully updated.' }\n format.json { render :show, status: :ok,\n location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def update\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n if @schedule.update_attributes(format(params))\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @route_schedule = RouteSchedule.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @route_schedule.update_attributes(params[:route_schedule])\r\n format.html { redirect_to @route_schedule, notice: 'Route schedule 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: @route_schedule.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: 'スケジュールの更新が正常に行われました。' }\n format.json { render :show, status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: '스케쥴이 수정되었습니다' }\n format.json { render action: 'show', status: :ok, location: @schedule }\n else\n format.html { render action: 'edit' }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_schedule.update(admin_schedule_params)\n format.html { redirect_to admin_schedule_url(@admin_schedule.id), notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @agent_schedule.update(agent_schedule_params)\n format.html { redirect_to @agent_schedule, notice: 'Agent schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @agent_schedule }\n else\n format.html { render :edit }\n format.json { render json: @agent_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ptschedule = Ptschedule.find(params[:id])\n\n respond_to do |format|\n if @ptschedule.update_attributes(params[:ptschedule])\n flash[:notice] = t('ptschedule.title')+\" \"+t('updated')\n format.html { redirect_to(@ptschedule) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ptschedule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @interview_session_schedule = InterviewSessionSchedule.find(params[:id])\n\n respond_to do |format|\n if @interview_session_schedule.update_attributes(params[:interview_session_schedule])\n format.html { redirect_to(@interview_session_schedule, :notice => 'Interview session schedule was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interview_session_schedule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @maintenance_schedule = MaintenanceSchedule.new(params[:maintenance_schedule])\n\n respond_to do |format|\n if @maintenance_schedule.save\n format.html { redirect_to(@maintenance_schedule, :notice => 'Maintenance schedule was successfully created.') }\n format.xml { render :xml => @maintenance_schedule, :status => :created, :location => @maintenance_schedule }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @maintenance_schedule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @manage_schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n if @manage_schedule.update_attributes(params[:manage_schedule])\n format.html { redirect_to @manage_schedule, notice: 'Schedule was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @manage_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @schedule = Schedule.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @schedule.update_attributes(params[:schedule])\r\n format.html { redirect_to event_path(@schedule.event_id), notice: 'Schedule 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: @schedule.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @my_schedule.update(my_schedule_params)\n format.html { redirect_to @my_schedule, notice: 'My schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_schedule }\n else\n format.html { render :edit }\n format.json { render json: @my_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event_schedule = EventSchedule.find(params[:id])\n\n respond_to do |format|\n if @event_schedule.update_attributes(params[:event_schedule])\n format.html { redirect_to @event_schedule, notice: 'Event schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @nfl_schedule.update(nfl_schedule_params)\n format.html { redirect_to @nfl_schedule, notice: 'Nfl schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @nfl_schedule }\n else\n format.html { render :edit }\n format.json { render json: @nfl_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def updateschedule(scid,params)\r\n scrbslog(\"======Begin to update a schedule======\")\r\n @schedule = Schedule.find(scid)\r\n @user = User.find(@schedule.user_id)\r\n scrbslog(\"Author:\" + @user.name)\r\n room_id = Room.find_by_room_name(params[\"room_name\"]).id\r\n @schedule.update_attributes(:schedule_day=>params[\"schedule_day\"],:start_time=>params[\"start_time\"],:end_time=>params[\"end_time\"],:comment=>params[\"comment\"],:room_id => room_id,:title =>params[\"title\"] )\r\n Status.create(:room_name=>params[\"room_name\"],:schedule_day=>params[\"schedule_day\"],:start_time=>params[\"start_time\"],:end_time=>params[\"end_time\"],:scheduleid=>scid)\r\n scrbslog(params)\r\n scrbslog(\"======End to update a schedule======\")\r\n end",
"def destroy\n @maintenance_schedule = MaintenanceSchedule.find(params[:id])\n @maintenance_schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(maintenance_schedules_url) }\n format.xml { head :ok }\n end\n end",
"def update\n respond_to do |format|\n if @schedule_action.update(schedule_action_params)\n format.html { redirect_to @schedule_action, notice: 'Schedule action was successfully updated.' }\n format.json { render :show, status: :ok, location: @schedule_action }\n else\n format.html { render :edit }\n format.json { render json: @schedule_action.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @weekly_schedule.update(weekly_schedule_params)\n format.html { redirect_to @weekly_schedule, notice: 'Weekly schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @weekly_schedule }\n else\n format.html { render :edit }\n format.json { render json: @weekly_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @schedule.update(schedule_params)\n redirect_to schedules_path\n end\n end",
"def update\n @user_schedule = UserSchedule.find(params[:id])\n\n respond_to do |format|\n if @user_schedule.update_attributes(params[:user_schedule])\n format.html { redirect_to @user_schedule, notice: 'User schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dates_schedule.update(dates_schedule_params)\n format.html { redirect_to @dates_schedule, notice: 'Dates schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @dates_schedule }\n else\n format.html { render :edit }\n format.json { render json: @dates_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dis_nfi_schedule.update(dis_nfi_schedule_params)\n format.html { redirect_to @dis_nfi_schedule, notice: 'Dis nfi schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @dis_nfi_schedule }\n else\n format.html { render :edit }\n format.json { render json: @dis_nfi_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @location, notice: 'Schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @counter_schedule.update(counter_schedule_params)\n format.html { redirect_to @counter_schedule, notice: 'Counter schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @counter_schedule }\n else\n format.html { render :edit }\n format.json { render json: @counter_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @crew_big_sonu_schedule.update(crew_big_sonu_schedule_params)\n format.html { redirect_to @crew_big_sonu_schedule, notice: 'Big sonu schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @crew_big_sonu_schedule }\n else\n format.html { render :edit }\n format.json { render json: @crew_big_sonu_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scheduled_class = ScheduledClass.find(params[:id])\n\n respond_to do |format|\n if @scheduled_class.update_attributes(params[:scheduled_class])\n format.html { redirect_to(@scheduled_class, :notice => 'ScheduledClass was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @scheduled_class.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @scheduler.update(scheduler_params)\n format.html { redirect_to @scheduler, notice: 'Scheduler was successfully updated.' }\n format.json { render :show, status: :ok, location: @scheduler }\n else\n format.html { render :edit }\n format.json { render json: @scheduler.errors, status: :unprocessable_entity }\n end\n end\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 update\n authorize! :update, Schedule, :message => 'Not authorized as an administrator.'\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n if @schedule.update_attributes(params[:schedule])\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scheduler = Scheduler.find(params[:id])\n\n respond_to do |format|\n if @scheduler.update_attributes(params[:scheduler])\n format.html { redirect_to @scheduler, notice: 'Scheduler was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scheduler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @schedule = Schedule.find(params[:id])\n auth! :action => :update, :object => @schedule.screen\n\n respond_to do |format|\n if @schedule.update_attributes(schedule_params)\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.update', :owner => current_user, :action => 'update')\n\n format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # respond_to do |format|\n # if @schedule.update(schedule_params)\n # format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: 'edit' }\n # format.json { render json: @schedule.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def update\n respond_to do |format|\n if @block && @schedule.update(schedule_params)\n format.html { redirect_to admins_backoffice_schedules_path, notice: @notice }\n format.json { render status: :ok, location: @schedule }\n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @schedule = Schedule.find(params[:id])\n\n respond_to do |format|\n\n # First create jobkey with existing name,group\n key = JobKey.new(@schedule.name, @schedule.group)\n\n if @schedule.update_attributes(params[:schedule])\n\n # reload schedule to refresh attributes\n @schedule.reload\n\n # Also update schedule in Quartz, if it already exists\n if RemoteJobScheduler.instance.scheduler.check_exists(key)\n RemoteJobScheduler.instance.update_schedule_trigger(@schedule)\n end\n\n format.html { redirect_to(@schedule, :notice => 'Schedule was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @schedule.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to session.delete(:return_to), notice: \"Schedule was successfully updated.\" }\n format.json { render :show, status: :ok, location: @schedule }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dj_schedule.update(dj_schedule_params)\n format.html { redirect_to @dj_schedule, notice: 'Dj schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @dj_schedule }\n else\n format.html { render :edit }\n format.json { render json: @dj_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @class_schedule.update(class_schedule_params)\n format.html { redirect_to class_schedules_path, notice: 'Розклад занять був успішно оновлений.' }\n format.json { render :index, status: :ok, location: @class_schedule }\n else\n format.html { render :edit }\n format.json { render json: @class_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scheduled_task = ScheduledTask.find(params[:id])\n\n respond_to do |format|\n if @scheduled_task.update_attributes(params.require(:scheduled_task).permit!)\n format.html { redirect_to @scheduled_task, notice: 'Scheduled task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scheduled_task.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_schedule.update(user_schedule_params)\n format.html { redirect_to @user_schedule, notice: 'User schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to @schedule, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bus_schedule.update(bus_schedule_params)\n format.html { redirect_to @bus_schedule, notice: 'Bus schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @bus_schedule }\n else\n format.html { render :edit }\n format.json { render json: @bus_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @work_schedule.update(work_schedule_params)\n format.html { redirect_to @work_schedule, notice: 'Work schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @work_schedule }\n else\n format.html { render :edit }\n format.json { render json: @work_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @maintenance_schedule = MaintenanceSchedule.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @maintenance_schedule }\n end\n end",
"def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to [:admin, @schedule], notice: '赛程更新成功' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n format.html { redirect_to [:admin, @schedule], notice: '赛程更新成功' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @interviewscheduler.update(interviewscheduler_params)\n format.html { redirect_to @interviewscheduler, notice: 'Interviewscheduler was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @interviewscheduler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # Logic to update a record\n @maintenance = Maintenance.find(params[:id])\n\n respond_to do |format|\n if @maintenance.update_attributes(params[:maintenance])\n format.html { redirect_to @maintenance, notice: 'Maintenance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @maintenance.update(maintenance_params)\n format.html { redirect_to @maintenance, notice: (t 'maintenances.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flight_schedule = FlightSchedule.find(params[:id])\n\n respond_to do |format|\n if @flight_schedule.update_attributes(params[:flight_schedule])\n format.html { redirect_to @flight_schedule, notice: 'Flight schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flight_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @maintenance.update(maintenance_params)\n format.html { redirect_to @maintenance, notice: 'Maintenance was successfully updated.' }\n format.json { render :show, status: :ok, location: @maintenance }\n else\n format.html { render :edit }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @maintenance.update(maintenance_params)\n format.html { redirect_to @maintenance, notice: 'Maintenance was successfully updated.' }\n format.json { render :show, status: :ok, location: @maintenance }\n else\n format.html { render :edit }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @schedule.update(schedule_params)\n #format.html { redirect_to @schedule, notice: 'Schedule was successfully updated.' }\n #format.json { render :show, status: :ok, location: @schedule }\n\t\t\n\t\tformat.html {redirect_to schedule_path(@schedule, :construction_id => params[:construction_id], \n :move_flag => params[:move_flag])}\n\t\t \n else\n format.html { render :edit }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mail_schedule.update(mail_schedule_params)\n format.html { redirect_to @mail_schedule, notice: 'Mail schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @mail_schedule }\n else\n format.html { render :edit }\n format.json { render json: @mail_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @maintenance = @vehicle.maintenances.find(params[:id])\n respond_to do |format|\n if @maintenance.update(maintenance_params)\n format.html { redirect_to vehicle_maintenances_path(@vehicle), notice: 'Maintenance was successfully updated.' }\n format.json { render :show, status: :ok, location: @maintenance }\n else\n format.html { render :edit }\n format.json { render json: @maintenance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classroom_laboratory_schedule.update(classroom_laboratory_schedule_params)\n format.html { redirect_to @classroom_laboratory_schedule, notice: 'Classroom laboratory schedule was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @classroom_laboratory_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inspection_schedule.update(inspection_schedule_savable_params)\n format.html { redirect_to @inspection_schedule, notice: 'InspectionSchedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @inspection_schedule }\n else\n format.html { render :edit }\n format.json { render json: @inspection_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @schedule_entry = ScheduleEntry.find(params[:id])\n\n respond_to do |format|\n if @schedule_entry.update_attributes(params[:schedule_entry])\n format.html { redirect_to @schedule_entry, notice: 'Schedule entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @schedule_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # Protect from non-admin access\n admin_only do\n params[:weeklyday] = nil if params[:weeklyday] = ''\n @test = RecurringSchedule.find(params[:id])\n if @test.update(schedule_params)\n log_action('Update', current_user ? current_user.username : 'Anonymous', params[:id], 'RecurringSchedule')\n if params[:weeklyday].nil?\n @test.reload\n @test.weeklyday = nil\n @test.save\n end\n redirect_to action: \"show\", id: @test.id\n else\n render 'edit'\n end\n end\n end",
"def update\n respond_to do |format|\n if @scheduler.update(scheduler_params)\n format.html { redirect_to job_scheduler_path(@job, @scheduler), notice: 'Scheduler was successfully updated.' }\n format.json { render :show, status: :ok, location: @scheduler }\n else\n format.html { render :edit }\n format.json { render json: @scheduler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @interviewscheduler = Interviewscheduler.new(interviewscheduler_params)\n\n respond_to do |format|\n @interviewscheduler.update(:status => \"Assessment Scheduled\")\n if @interviewscheduler.save\n format.html { redirect_to @interviewscheduler, notice: 'Interviewscheduler was successfully created.' }\n format.json { render action: 'show', status: :created, location: @interviewscheduler }\n else\n format.html { render action: 'new' }\n format.json { render json: @interviewscheduler.errors, status: :unprocessable_entity }\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 update\n respond_to do |format|\n if @trip_schedule.update(trip_schedule_params)\n format.html { redirect_to @trip_schedule, notice: 'Trip schedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip_schedule }\n else\n format.html { render :edit }\n format.json { render json: @trip_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @runschedule.update(runschedule_params)\n format.html { redirect_to @runschedule, notice: 'Runschedule was successfully updated.' }\n format.json { render :show, status: :ok, location: @runschedule }\n else\n format.html { render :edit }\n format.json { render json: @runschedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_maintenance\n @maintenance = Maintenance.find(params[:id])\n end",
"def update\n @scheduled_service = ScheduledService.find(params[:id])\n\n respond_to do |format|\n if @scheduled_service.update_attributes(params.require(:scheduled_service).permit(:mileage, :sdate, :service_schedule_id))\n format.html { redirect_to scheduled_services_url,\n notice: 'ScheduledService was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scheduled_service.errors, status: :unprocessable_entity }\n end\n end\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 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"
] | [
"0.66244733",
"0.6582157",
"0.65461344",
"0.6512493",
"0.6391176",
"0.63862675",
"0.63702404",
"0.6367937",
"0.63517505",
"0.6341044",
"0.62997496",
"0.62910575",
"0.62886566",
"0.6260788",
"0.62589717",
"0.6247493",
"0.6247493",
"0.6247493",
"0.6247493",
"0.6247493",
"0.6247493",
"0.6247493",
"0.62407994",
"0.6234402",
"0.62147725",
"0.6186227",
"0.6178353",
"0.6176012",
"0.6174013",
"0.61634535",
"0.61603767",
"0.6156917",
"0.61505103",
"0.61465746",
"0.61460924",
"0.6141628",
"0.61293924",
"0.61195326",
"0.6103119",
"0.6092968",
"0.60819066",
"0.60781026",
"0.60758996",
"0.60721314",
"0.6062593",
"0.60367537",
"0.60323775",
"0.59911305",
"0.59878486",
"0.5981579",
"0.59699327",
"0.59596825",
"0.59578294",
"0.59551805",
"0.5953929",
"0.59504867",
"0.5933465",
"0.59145254",
"0.5898805",
"0.58939475",
"0.58906853",
"0.5880626",
"0.58802354",
"0.5870388",
"0.585015",
"0.5840204",
"0.5840204",
"0.58381397",
"0.5826876",
"0.58253586",
"0.5820709",
"0.58123493",
"0.58123493",
"0.579771",
"0.57771176",
"0.5776275",
"0.57635427",
"0.5763403",
"0.57292664",
"0.57131094",
"0.57106894",
"0.56923306",
"0.5689536",
"0.5689536",
"0.5689536",
"0.5689536",
"0.5689536",
"0.56833345",
"0.5673513",
"0.5673301",
"0.5658436",
"0.56507254",
"0.56449974",
"0.56449974",
"0.56449974",
"0.56449974",
"0.56449974",
"0.56449974",
"0.56449974",
"0.56449974"
] | 0.719088 | 0 |
DELETE /maintenance_schedules/1 DELETE /maintenance_schedules/1.xml | def destroy
@maintenance_schedule = MaintenanceSchedule.find(params[:id])
@maintenance_schedule.destroy
respond_to do |format|
format.html { redirect_to(maintenance_schedules_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(schedules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(schedules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(schedules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(schedules_url) }\n format.xml { head :ok }\n end\n end",
"def maintenance_delete(statuspage_id, maintenance_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['maintenance_id'] = maintenance_id\n\n request :method => :post,\n :url => @url + 'maintenance/delete',\n :payload => data\n end",
"def deleteschedule(scid)\r\n scrbslog(\"======Begin to delete a schedule======\")\r\n @schedule = Schedule.find(scid)\r\n @user = User.find(@schedule.user_id)\r\n scrbslog(\"Author:\" + @user.name)\r\n @status = Status.find_by_scheduleid(@schedule.id)\r\n scrbslog(@schedule.title + \" \" + @schedule.schedule_day + \" \" + @schedule.start_time + \" \" + @schedule.end_time + \" \" + @schedule.comment + \" \" + @schedule.room_id.to_s)\r\n @status.delete\r\n @schedule.delete \r\n scrbslog(\"======Begin to delete a schedule======\")\r\n end",
"def destroy\n @schedule = Schedule.find(params[:id])\n\n @schedule.destroy\n\n key = JobKey.new(@schedule.name, @schedule.group)\n if RemoteJobScheduler.instance.scheduler.check_exists(key)\n RemoteJobScheduler.instance.remove_schedule(key)\n end\n\n respond_to do |format|\n format.html { redirect_to(schedules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n head :no_content\n end",
"def destroy\n @class_schedule = ClassSchedule.find(params[:id])\n @class_schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(class_schedules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ptschedule = Ptschedule.find(params[:id])\n @ptschedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(ptschedules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @admin_schedule.destroy\n respond_to do |format|\n format.html { redirect_to admin_schedules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @interview_session_schedule = InterviewSessionSchedule.find(params[:id])\n @interview_session_schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to(interview_session_schedules_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @doctorsheduling = Doctorsheduling.find(params[:id])\n @doctorsheduling.destroy\n\n respond_to do |format|\n format.html { redirect_to(doctorshedulings_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @maintenance.destroy\n respond_to do |format|\n format.html { redirect_to maintenances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @route_schedule = RouteSchedule.find(params[:id])\r\n @route_schedule.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to route_schedules_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @daily_grr = DailyGrr.find(params[:id])\n @daily_grr.destroy\n\n respond_to do |format|\n format.html { redirect_to(scaffold_daily_grrs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n # Logic to delete a record\n @maintenance = Maintenance.find(params[:id])\n @maintenance.destroy\n\n respond_to do |format|\n format.html { redirect_to maintenances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: 'スケジュールの削除が正常に行われました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weekly_schedule.destroy\n respond_to do |format|\n format.html { redirect_to weekly_schedules_url, notice: 'Weekly schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @schedule = Schedule.find(params[:id])\r\n @schedule.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to schedules_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_cron_request.destroy\n respond_to do |format|\n format.html { redirect_to admin_cron_requests_url, notice: I18n.t('admin.cron_requests.destroy.message.success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule.destroy\n respond_to do |format|\n format.html {redirect_to root_url, notice: 'スケジュールが削除されました'}\n format.json {head :no_content}\n end\n end",
"def destroy\n @nfl_schedule = NflSchedule.find(params[:id])\n @nfl_schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to nfl_schedules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule.destroy\n redirect_to schedules_url\n end",
"def destroy\n @manage_schedule = Schedule.find(params[:id])\n @manage_schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to manage_schedules_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to admins_backoffice_schedules_path, notice: 'Horário foi deletado com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scheduled_class = ScheduledClass.find(params[:id])\n @scheduled_class.destroy\n\n respond_to do |format|\n format.html { redirect_to(scheduled_classes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: 'Schedule ha sido eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dj_schedule.destroy\n respond_to do |format|\n format.html { redirect_to dj_schedules_url, notice: 'Dj schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @maintenance.destroy\n\n respond_to do |format|\n format.html { redirect_to maintenances_url, notice: \"Maintenance was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @maintenance.destroy\n respond_to do |format|\n format.html { redirect_to maintenances_url, notice: 'Maintenance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to admin_schedules_url, notice: '赛程删除成功' }\n format.json { head :no_content }\n end\n end",
"def delete\n admin_only do\n \t# get the schedule object to be deleted.\n handle_recurring_schedule_failure 'remove', 'removed' do\n @test = get_test_with_rescue\n @test.destroy!\n flash[:success] = \"Recurring Test Run Removed\"\n end\n redirect_to action: \"index\"\n end\n end",
"def destroy\n @scheduler = Scheduler.find(params[:id])\n @scheduler.destroy\n\n respond_to do |format|\n format.html { redirect_to schedulers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule.destroy\n end",
"def destroy\n @dis_nfi_schedule.destroy\n respond_to do |format|\n format.html { redirect_to dis_nfi_schedules_url, notice: 'Dis nfi schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dates_schedule.destroy\n respond_to do |format|\n format.html { redirect_to dates_schedules_url, notice: 'Dates schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @agent_schedule.destroy\n respond_to do |format|\n format.html { redirect_to agent_schedules_url, notice: 'Agent schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event_schedule = EventSchedule.find(params[:id])\n @event_schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to event_schedules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stop = Stop.find(params[:id])\n @stop.destroy\n \n respond_to do |format|\n format.html { format.html { redirect_to('/admin/schedule') } }\n format.xml { head :ok }\n end\n end",
"def destroy\n @schedule_action.destroy\n respond_to do |format|\n format.html { redirect_to schedule_actions_url, notice: 'Schedule action was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ac_maintenance.destroy\n respond_to do |format|\n format.html { redirect_to ac_maintenances_url, notice: 'Ac maintenance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @maintenance_request.destroy\n respond_to do |format|\n format.html { redirect_to maintenance_requests_url, notice: 'Maintenance request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @downtime.destroy\n respond_to do |format|\n format.html { redirect_to downtimes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_schedule.destroy\n respond_to do |format|\n format.html { redirect_to my_schedules_url, notice: 'My schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle_daily = VehicleDaily.find(params[:id])\n @vehicle_daily.destroy\n\n respond_to do |format|\n format.html { redirect_to(vehicle_dailies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @schedule = Schedule.find(params[:id])\n auth! :action => :update, :object => @schedule.screen\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.destroy', :owner => current_user, :action => 'destroy')\n @schedule.destroy\n \n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mail_schedule.destroy\n respond_to do |format|\n format.html { redirect_to mail_schedules_url, notice: 'Mail schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nfl_schedule.destroy\n respond_to do |format|\n format.html { redirect_to nfl_schedules_url, notice: 'Nfl schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @delivery_time = DeliveryTime.find(params[:id])\n @delivery_time.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_delivery_times_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url,\n notice: 'Schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weeklytimetable = Weeklytimetable.find(params[:id])\n @weeklytimetable.destroy\n\n respond_to do |format|\n format.html { redirect_to(weeklytimetables_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @weeklytimetable = Weeklytimetable.find(params[:id])\n @weeklytimetable.destroy\n\n respond_to do |format|\n format.html { redirect_to(weeklytimetables_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: 'Schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: 'Schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: 'Schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: 'Schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: 'Schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: 'Schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: 'Schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n send_calendar_request(\"/#{@id}\", :delete)\n end",
"def destroy\n @maintenance_event.destroy\n notify_user(:notice, \"The service record was successfully removed.\")\n respond_to do |format|\n format.html { redirect_to inventory_maintenance_events_url(@asset) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end",
"def destroy\n @quartz = Quartz.find(params[:id])\n @quartz.destroy\n\n respond_to do |format|\n format.html { redirect_to(quartzs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: \"Schedule was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule.destroy\n respond_to do |format|\n format.html { redirect_to schedules_url, notice: \"Schedule was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @req_breakdown = ReqBreakdown.find(params[:id])\n @req_breakdown.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_req_breakdowns_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @maintenance_ressource.destroy\n\n respond_to do |format|\n format.html { redirect_to maintenance_ressources_url, notice: \"Maintenance ressource was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scheduler.destroy\n respond_to do |format|\n format.html { redirect_to schedulers_url, notice: 'Scheduler was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dailyreport = Dailyreport.find(params[:id])\n @dailyreport.destroy\n\n respond_to do |format|\n format.html { redirect_to(dailyreports_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @counter_schedule.destroy\n respond_to do |format|\n format.html { redirect_to counter_schedules_url, notice: 'Counter schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sleep_log = SleepLog.find(params[:id])\n @sleep_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(sleep_logs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @flight_schedule = FlightSchedule.find(params[:id])\n @flight_schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to flight_schedules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to @schedule.patient }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crew_big_sonu_schedule.destroy\n respond_to do |format|\n format.html { redirect_to crew_big_sonu_schedules_url, notice: 'Big sonu schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @interviewscheduler.destroy\n respond_to do |format|\n format.html { redirect_to interviewschedulers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @schedule = Schedule.find_by_id(params[:id])\n if @schedule\n @schedule.destroy\n @schedules = Schedule.all\n render json: @schedules\n else\n render json: {errorMessage:\"no schedule with id: #{params[:id]}\"}, status: :not_found\n end\n end",
"def destroy\n @time_task = TimeTask.find(params[:id])\n @time_task.destroy\n\n respond_to do |format|\n format.html { redirect_to(time_tasks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @schedule_block = ScheduleBlock.find(params[:id])\n @schedule_block.destroy\n\n respond_to do |format|\n format.html { redirect_to period_schedule_path(@period, @schedule) }\n format.json { head :ok }\n end\n end",
"def delete\n client_opts = {}\n client_opts[:scheduled_action_name] = name\n client_opts[:auto_scaling_group_name] = auto_scaling_group_name\n client.delete_scheduled_action(client_opts)\n nil\n end",
"def destroy\n @user_schedule = UserSchedule.find(params[:id])\n @user_schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to user_schedules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datetime.destroy\n\n respond_to do |format|\n format.html { redirect_to request.env['HTTP_REFERER'] }\n format.xml { head :ok }\n end\n end",
"def destroy\n @maintenance.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_maintenances_path(@vehicle), notice: 'Maintenance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @heartbeat.destroy\n\n head :no_content\n end",
"def destroy\n @availability_day = AvailabilityDay.find(params[:id])\n @availability_day.destroy\n\n respond_to do |format|\n format.html { redirect_to(availability_days_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @schedule_entry = ScheduleEntry.find(params[:id])\n @schedule_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to edit_schedule_entry_path(1) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @runschedule.destroy\n respond_to do |format|\n format.html { redirect_to runschedules_url, notice: 'Runschedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :destroy, Schedule, :message => 'Not authorized as an administrator.'\n @schedule = Schedule.find(params[:id])\n @schedule.destroy\n\n respond_to do |format|\n format.html { redirect_to schedules_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mailing_schedule.destroy\n respond_to do |format|\n format.html { redirect_to mailing_schedules_url, notice: 'Mailing schedule was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.71289223",
"0.711882",
"0.711882",
"0.711882",
"0.69836265",
"0.69667125",
"0.6863063",
"0.67685264",
"0.6731389",
"0.6713114",
"0.6693143",
"0.66671944",
"0.66583836",
"0.66100526",
"0.6592417",
"0.6592277",
"0.6559888",
"0.655949",
"0.65569353",
"0.6556303",
"0.6544897",
"0.6541035",
"0.6541035",
"0.6541035",
"0.6541035",
"0.6541035",
"0.65250474",
"0.65171194",
"0.6510807",
"0.650835",
"0.6503599",
"0.64933705",
"0.64929146",
"0.64929146",
"0.64929146",
"0.64929146",
"0.64929146",
"0.64837134",
"0.6463197",
"0.6462371",
"0.64619726",
"0.6450184",
"0.6444565",
"0.64424807",
"0.64309853",
"0.6429847",
"0.64159733",
"0.64006",
"0.6368581",
"0.6366496",
"0.6354008",
"0.63538504",
"0.63505954",
"0.6346286",
"0.6343451",
"0.6343372",
"0.6335985",
"0.63207394",
"0.6320291",
"0.6319693",
"0.6318681",
"0.6314339",
"0.6309177",
"0.6309177",
"0.6305615",
"0.6305615",
"0.6305615",
"0.6305615",
"0.6305615",
"0.6305615",
"0.6305615",
"0.630337",
"0.6299963",
"0.6299311",
"0.6298731",
"0.62967306",
"0.62967306",
"0.62830126",
"0.62579966",
"0.6255177",
"0.6253267",
"0.62373596",
"0.62297434",
"0.6195624",
"0.6190515",
"0.6188037",
"0.6186604",
"0.61830145",
"0.61807543",
"0.6168828",
"0.6161942",
"0.6157747",
"0.61520696",
"0.6150202",
"0.61472964",
"0.61429936",
"0.6129637",
"0.61292",
"0.6122436",
"0.61215454"
] | 0.7805734 | 0 |
Returns [ "system_sys/ingeconf/.", ... ] | def get_scms(system)
Dir.glob("#{system}/*/.").
reject {|d| /(build|admin|CVS|telium_platform|u32_platform)/ =~ d }.
reject {|d| /ssade\// =~ d }.
# "the basename of the dirname":
# we first drop "/." using dirname, then only use last component
map {|v| File.basename(File.dirname(v)) }
# same with regex:
# map {|v| /.*?([^\/]+)(\/?.?)$/ =~ v && $1 }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paths\n Array(config.path).map(&:to_s)\n end",
"def list_path\n File.expand_path(\"../config/domains.txt\", File.dirname(__FILE__))\n end",
"def desired_contents\n @environments.map {|env| env.dirname }\n end",
"def getConfigPath\n if @conf[:config_name].index('/')\n return @conf[:config_name] if File.file?(@conf[:config_name])\n else \n @conf[:config_dirs].each {|i|\n r = Pathname.new(i) + @conf[:config_name]\n return r if File.file?(r)\n }\n end\n\n CliUtils.warnx \"no config file '#{@conf[:config_name]}' found\" if @conf[:verbose] >= 2\n return nil\n end",
"def config_path\n etc+\"php/\"\n end",
"def global_config_path\n linux_cfg = '/etc/openshift/' + conf_name\n File.exists?(linux_cfg) ? linux_cfg : File.join(File.expand_path(File.dirname(__FILE__) + \"/../../conf\"), conf_name)\n end",
"def list_path\n File.join(config_path,\"domains.txt\")\n end",
"def config_files\n @config_files\n end",
"def configdir\n\t\tetc/\"cpu-sentinel\"\n\tend",
"def path_boot\n case node['platform']\n when \"exherbo\", \"ubuntu\", \"arch\"\n return \"/etc/modules-load.d/#{new_resource.name}.conf\"\n when \"debian\", \"ubuntu\"\n return \"/etc/modules\"\n end\nend",
"def find_config_path\n path = Pathname(Pathname.pwd).ascend{|d| h=d+config_filename; break h if h.file?}\n end",
"def get_possible_config_file_names(file_name_prefix='default')\n names = []\n # give priority to environment setting.\n names << ENV['GGB_CONFIG_FILE'] unless ENV['GGB_CONFIG_FILE'].nil?\n # add standard locations.\n names.concat [\"/usr/local/ctools/app/ctools/tl/home/#{file_name_prefix}.yml\", \"./#{file_name_prefix}.yml\", './default.yml']\nend",
"def all_configs(path)\n # 005010/X221 HP835 Health Care Claim Payment Advice\n path = Pathname.new(path).relative_path_from(@root)\n name = path.each_filename.to_a[1]\n\n case name\n when /^(X\\d{3})/\n imp = parts(path)\n std = parts(path).tap{|xs| xs[1] = \"Standards\" }\n [mkconfig(*imp), mkconfig(*std)]\n\n when /^[A-Z]{2}\\d{3}/\n [mkconfig(*parts(path))]\n else\n []\n end.map{|c| path.cons(c) }\n end",
"def config_path\n if result = chef_api_config_path\n Pathname(result).expand_path\n else\n Pathname(\"\")\n end\n end",
"def component_paths platform\n @component_paths||={} \n @component_paths['pc']||=FileList[\"#{@current_dir}/**/build.cfg\"].exclude(/\\/gen\\//,/\\/dsl\\//,/\\/programs\\//,/\\/mocks\\//,/\\/common/).pathmap('%d')\n @component_paths['common']||=FileList[\"#{@current_dir}/**/build.cfg\"].exclude(/\\/gen\\//,/\\/dsl\\//,/\\/programs\\//,/\\/mocks\\//).pathmap('%d')\n return @component_paths[platform]+@component_paths['common']\n end",
"def k8s_config_map(path)\n \"|\\n\" +\n ERB.new(File.read(Pathname(@_curr_file).dirname + path)).result(binding).split(\"\\n\").map do |line|\n \" \" + line + \"\\n\"\n end.join('')\n end",
"def rc_dirs; end",
"def bare_d\n home.join('bare.conf.d')\n end",
"def app_config_path\n Pathname.new('.').join('config')\n end",
"def gempaths\n\t\t\treturn Gem.path\n\t\tend",
"def path_components\n [configuration_name]\n end",
"def get_string_list(path)\n raise Hocon::ConfigError::ConfigBugOrBrokenError, \"subclasses of `Config` must implement `get_string_list` (#{self.class})\"\n end",
"def init_paths\n drive = session.sys.config.getenv('SystemDrive')\n\n files =\n [\n 'unattend.xml',\n 'autounattend.xml'\n ]\n\n target_paths =\n [\n \"#{drive}\\\\\",\n \"#{drive}\\\\Windows\\\\System32\\\\sysprep\\\\\",\n \"#{drive}\\\\Windows\\\\panther\\\\\",\n \"#{drive}\\\\Windows\\\\Panther\\Unattend\\\\\",\n \"#{drive}\\\\Windows\\\\System32\\\\\"\n ]\n\n paths = []\n target_paths.each do |p|\n files.each do |f|\n paths << \"#{p}#{f}\"\n end\n end\n\n # If there is one for registry, we add it to the list too\n reg_path = get_registry_unattend_path\n paths << reg_path unless reg_path.empty?\n\n return paths\n end",
"def whereami() [__FILE__] end",
"def config\n system_config.send(service_name.to_sym) || []\n end",
"def getconf(target)\n\t\[email protected] \"--util.rb : util.getconf(\" + target + \") \"\n\t\tFile.foreach(@config_file) do |line|\n\t\t#File.foreach(\"../../config.txt\") do |line|\n\t\t\tconf = line.chomp\n\t\t\tif(conf.index(target)) then\n\t\t\t\[email protected] \"return \" + conf.split[1]\n\t\t\t\treturn conf.split[1]\n\t\t\tend\n\t\tend\n\tend",
"def configuration_file_path; end",
"def base_config_path\n BASE_CONFIG_PATH\n end",
"def get_all_path\n # some default directories\n env_paths = []\n env_paths << \"/bin\"\n env_paths << \"/usr/bin\"\n env_paths << \"/usr/local/bin\"\n env_paths << \"/sbin\"\n env_paths << \"/usr/sbin\"\n env_paths << \"/usr/local/sbin\"\n env_paths << \"/opt/bin\"\n env_paths += cmd_exec(\"echo $PATH\").split(\":\")\n env_paths.uniq\n end",
"def modules_paths\n puppet_environment.full_modulepath\n end",
"def config_directory\n \"C:\\\\chef\"\n end",
"def paths\n configuration.paths\n end",
"def component_names platform\n @component_names={}\n @component_names['pc']||=FileList[\"#{@current_dir}/**/build.cfg\"].exclude(/\\/gen\\//,/\\/dsl\\//,/\\/programs\\//,/\\/mocks\\//,/\\/common/).pathmap('%-2d')\n @component_names['common']||=FileList[\"#{@current_dir}/**/build.cfg\"].exclude(/\\/gen\\//,/\\/dsl\\//,/\\/programs\\//,/\\/mocks\\//,/\\/pc/).pathmap('%-2d')\n return @component_names[platform]+@component_names['common']\n end",
"def path_pri\n puts \"\\nPrint Paths:\"\n @apks.each do |apk|\n puts apk.path\n end\n end",
"def modules_paths\n puppet_environment.full_modulepath\n end",
"def config_path(svc_name)\n # strip st2 prefix\n noprefix_name = svc_name.sub(/^st2/, '')\n config_name = ['logging', noprefix_name, 'conf'].compact.join('.')\n File.join([spec[:conf_dir], config_name])\n end",
"def paths\n self.config[:paths]\n end",
"def cfg_dir\n File.join(@full_path, CONFIG_DIR)\n end",
"def paths_s\n \"['#{paths.join(\"','\")}']\"\n end",
"def app_config_file(filename)\n File.read(File.dirname(__FILE__)+\"/../../app/config/\" + filename).split(\"\\n\")\nend",
"def base\n [location, Puppet[:ldapbase]].join(\",\")\n end",
"def scanDir()\n suffix = \".config.json\"\n Dir.glob(\"#{@logBaseDir}/*/*#{suffix}\") {|path|\n #basename = File.basename(path, \".config.json\") ;\n basename = path.gsub(/^#{@logBaseDir}\\//,'').gsub(/#{suffix}$/,'') ;\n p [:basename, basename] ;\n @basenameList.push(basename) ;\n }\n @basenameList.sort!() ;\n return @basenameList ;\n end",
"def config_files\n @config_files ||= []\n end",
"def config_files\n @config_files ||= []\n end",
"def current_texte_path\n config = File.open('./.config.msh','rb'){|f|Marshal.load(f)}\n config[:last_file_path]\n end",
"def conf\n home.join('nginx.conf')\n end",
"def path\n @path ||= File.dirname @config_file\n end",
"def all_config_files\n #files = Dir[File.join(path, \"_config.yml\")]\n files = Dir[File.join(path, \"_*.yml\")]\n return files\n end",
"def module_config\r\n []\r\n end",
"def read_conf(conf)\n File.open(conf).readlines.map {|line|\n line.chomp!\n if /@include (.*)/ =~ line\n line = read_conf($1)\n end\n line\n }.flatten\nend",
"def extension_conf_files\n manifest.grep( /extconf.rb\\Z/ )\n end",
"def find_config_file\n\n root_directory = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))\n app_config = File.join(root_directory, CONFIG_FILE_NAME)\n global_config = File.join('/etc', CONFIG_FILE_NAME)\n\n [app_config, global_config].each do |config_file|\n return config_file if File.exists?(config_file)\n end\n\n nil\n\n end",
"def global_name\n @appl_settings[:global_dir]\n end",
"def config_path\n Gym.cache[:config_path] ||= \"#{Tempfile.new('gym_config').path}.plist\"\n return Gym.cache[:config_path]\n end",
"def base_paths\n [Pkg::Config.yum_repo_path, Pkg::Config.apt_repo_staging_path, Pkg::Config.apt_repo_path, '/opt/downloads'].compact\n end",
"def get_config_data()\n return @evroots_config_data if !@evroots_config_data.nil?\n \n @evroots_config_data = \"\"\n File.open(@evroots_config_path, \"r\") do |file|\n file.each do |line|\n line.gsub!(/^#.*\\n/, '')\n next if line.empty?\n line.gsub!(/^\\s*\\n/, '')\n next if line.empty?\n @evroots_config_data += line\n end\n end\n @evroots_config_data\n end",
"def path\n @paths.each do |name, path|\n raise Exceptions::BadlyConfigured.new(name) unless path.size > 1\n end\n @paths\n end",
"def sapi_directory(sapi)\n \"#{node['php']['conf_dir']}/#{sapi}/conf.d\"\n end",
"def config_path\n Gym.cache[:config_path] ||= \"/tmp/gym_config_#{Time.now.to_i}.plist\"\n return Gym.cache[:config_path]\n end",
"def global_config_dir\n '/etc/vgh'\n end",
"def empty_config_file_path\n ::File.expand_path '../../../support/empty_resolv.conf', __FILE__\n end",
"def default_authoritative_config_directory\n case node['platform_family']\n when 'debian'\n '/etc/powerdns'\n when 'rhel'\n '/etc/pdns'\n end\nend",
"def list_path\n if ENV['GMAN_STUB_DOMAINS']\n File.expand_path '../test/fixtures/domains.txt', File.dirname(__FILE__)\n else\n File.expand_path 'domains.txt', config_path\n end\n end",
"def find_config(file); end",
"def chef_config_path\n Berkshelf.root.join(\"spec/config/knife.rb\").to_s\n end",
"def kernel_config\n return unless cmd_exec('test -r /boot/config-`uname -r` && echo true').include? 'true'\n\n output = cmd_exec(\"cat /boot/config-`uname -r`\").to_s.strip\n\n return if output.empty?\n\n config = output.split(\"\\n\").map(&:strip).reject(&:empty?).reject {|i| i.start_with? '#'}\n\n return if config.empty?\n\n config\n rescue\n raise 'Could not retrieve kernel config'\n end",
"def app_config_content\n buf = []\n buf << 'class AppConfig'\n buf << \" APP_NAME='#{@project_name.camel_case}'\"\n buf << \" APP_CONTROLLERS=%w(#{@parser.descriptions.collect{|model| model.singularize.snake_case.pluralize}.join(' ')})\"\n buf << 'end'\n buf.join(\"\\n\")\n end",
"def getAntList(group)\n cmd = \"/home/obs/ruby/bin/fxconf.rb sals #{group}\";\n return `#{cmd}`.chomp.gsub(\" \", \",\");\nend",
"def resource_default_config_path\n type_string = instance_variable_defined?(:@new_resource) ? new_resource.declared_type.to_s : resource_name.to_s\n config_path = Array(type_string.gsub(/(grafana_)(config_)?/, '').split('_').join('.'))\n\n Chef::Log.debug(\"resource_default_config_path: Generated config path #{config_path}\")\n raise if nil_or_empty?(config_path)\n\n config_path\n end",
"def config_file\n File.join(@path, %w[ application config application.php ])\n end",
"def config_list(regex)\n\t\tcmd = \"git config -f #{@config_file} \" +\n\t\t \"--get-regexp 'environment.#{@env}.#{regex}'\"\n\n\t\tbegin\n\t\t\t@command.\n\t\t\t run_command_stdout(cmd).\n\t\t\t split(\"\\n\").\n\t\t\t map { |l| l.split(/\\s+/, 2) }.\n\t\t\t map { |item|\t[item[0].gsub(\"environment.#{@env}.\", ''), item[1]] }\n\t\trescue Giddyup::CommandWrapper::CommandFailed => e\n\t\t\tif e.status.exitstatus == 1\n\t\t\t\t# \"Nothing found\", OK then\n\t\t\t\treturn []\n\t\t\telse\n\t\t\t\traise RuntimeError,\n\t\t\t\t \"Failed to get config list environment.#{@env}.#{regex}\"\n\t\t\tend\n\t\tend\n\tend",
"def interfaces\n if @current_dir=~/\\/interfaces.*$/\n @interfaces||=FileList[\"#{@current_dir}/**/build.cfg\"].pathmap(\"%d\")\n else\n @interfaces||=FileList[\"#{@current_dir}/**/interfaces/**/build.cfg\"].pathmap(\"%d\")\n end\n return @interfaces\n end",
"def conf_folder\n conf['conf_folder'] || '.'\n end",
"def ruby_path\n File.join(%w(bindir RUBY_INSTALL_NAME).map{|k| RbConfig::CONFIG[k]})\n end",
"def maillist_dev_file\n Origen.app.root.to_s + '/config/maillist_dev.txt'\n end",
"def config_inherit_string(agent)\n if %r{solaris-10}.match?(agent['platform'])\n \"inherit => '/sbin'\"\n else\n ''\n end\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 system_path\n @system_path ||= Pathname.new(__FILE__).dirname.dirname.expand_path.to_s\n end",
"def config_file\n CONFIG_FILE\n end",
"def shell_installed(home)\n @logger.info(\"Searching for config in home #{home}\")\n @config_paths.each do |path|\n config_file = File.join(home, path)\n if File.exists?(config_file)\n @logger.info(\"Found config file #{config_file}\")\n return config_file\n end\n end\n return nil\n end",
"def test_config_work\n result = [File.join(Dir.pwd,'.config'), File.join(Dir.pwd,'config')]\n assert_equal(result, XDG.config.work)\n end",
"def maillist_prod_file\n Origen.app.root.to_s + '/config/maillist_prod.txt'\n end",
"def applications_path\n Pathname.new('apps')\n end",
"def config_root\n @config_root ||= root / 'config'\n end",
"def get_config_file\n\t\tconfig_paths =\n\t\t\t[\n\t\t\t\t\"C:\\\\ProgramData\\\\Dyn\\\\Updater\\\\\", #Vista\n\t\t\t\t\"C:\\\\Documents and Settings\\\\All Users\\\\Application Data\\\\Dyn\\\\Updater\\\\\" #XP and else\n\t\t\t]\n\n\t\t# Give me the first match\n\t\tconfig_file = nil\n\t\tconfig_paths.each do |p|\n\t\t\ttmp_path = p + \"config.dyndns\"\n\t\t\tbegin\n\t\t\t\tf = session.fs.file.stat(tmp_path)\n\t\t\t\tconfig_file = tmp_path\n\t\t\t\tbreak #We've found a valid one, break!\n\t\t\trescue\n\t\t\tend\n\t\tend\n\n\t\treturn config_file\n\tend",
"def get_puppet_config\n system_config = %x{puppet config print}\n\n config_hash = Hash.new\n\n system_config.each_line do |line|\n k,v = line.split('=')\n config_hash[k.strip] = v.strip\n end\n\n return config_hash\nend",
"def sites_to_load\n @appl_settings[:registered_config_modules]\n end",
"def product_locations\n case Aspera::Environment.os\n when Aspera::Environment::OS_WINDOWS; return [{\n :expected =>PRODUCT_CONNECT,\n :app_root =>File.join(ENV['LOCALAPPDATA'],'Programs','Aspera','Aspera Connect'),\n :log_root =>File.join(ENV['LOCALAPPDATA'],'Aspera','Aspera Connect','var','log'),\n :run_root =>File.join(ENV['LOCALAPPDATA'],'Aspera','Aspera Connect')\n },{\n :expected =>PRODUCT_CLI_V1,\n :app_root =>File.join('C:','Program Files','Aspera','cli'),\n :log_root =>File.join('C:','Program Files','Aspera','cli','var','log'),\n },{\n :expected =>PRODUCT_ENTSRV,\n :app_root =>File.join('C:','Program Files','Aspera','Enterprise Server'),\n :log_root =>File.join('C:','Program Files','Aspera','Enterprise Server','var','log'),\n }]\n when Aspera::Environment::OS_X; return [{\n :expected =>PRODUCT_CONNECT,\n :app_root =>File.join(Dir.home,'Applications','Aspera Connect.app'),\n :log_root =>File.join(Dir.home,'Library','Logs','Aspera_Connect'),\n :run_root =>File.join(Dir.home,'Library','Application Support','Aspera','Aspera Connect'),\n :sub_bin =>File.join('Contents','Resources'),\n },{\n :expected =>PRODUCT_CLI_V1,\n :app_root =>File.join(Dir.home,'Applications','Aspera CLI'),\n :log_root =>File.join(Dir.home,'Library','Logs','Aspera')\n },{\n :expected =>PRODUCT_ENTSRV,\n :app_root =>File.join('','Library','Aspera'),\n :log_root =>File.join(Dir.home,'Library','Logs','Aspera'),\n },{\n :expected =>PRODUCT_DRIVE,\n :app_root =>File.join('','Applications','Aspera Drive.app'),\n :log_root =>File.join(Dir.home,'Library','Logs','Aspera_Drive'),\n :sub_bin =>File.join('Contents','Resources'),\n }]\n else; return [{ # other: Linux and unix family\n :expected =>PRODUCT_CONNECT,\n :app_root =>File.join(Dir.home,'.aspera','connect'),\n :run_root =>File.join(Dir.home,'.aspera','connect')\n },{\n :expected =>PRODUCT_CLI_V1,\n :app_root =>File.join(Dir.home,'.aspera','cli'),\n },{\n :expected =>PRODUCT_ENTSRV,\n :app_root =>File.join('','opt','aspera'),\n }]\n end\n end",
"def paths_from_software_gems\n @paths_from_software_gems ||=\n Array(Config.software_gems).inject([]) do |array, name|\n if (spec = Gem::Specification.find_all_by_name(name).first)\n array << File.expand_path(spec.gem_dir)\n end\n\n array\n end\n end",
"def discover_cfgs\n Dir.glob(\"**/*/*.cfg\") \n end",
"def ReadGlobalConfig()\n\n # Load config file\n begin\n conf = YAML.load_file(\"#{$confdir}/#{$globalConfFile}\")\n rescue\n puts \"Unable to locate #{$confdir}/#{$globalConfFile}\"\n conf = {}\n end\n\n Dir.glob(\"#{$confdir}/#{$globalConfDir}/*.yaml\") {|f|\n begin\n conf.merge!(YAML.load_file(f))\n rescue\n puts \"Unable to locate #{f}\"\n conf = {}\n end\n }\n\n $sections.each {|o|\n conf[o] = [] if conf[o].nil?\n }\n conf[:globalConfFile] = \"#{$confdir}/#{$globalConfFile}\"\n conf[:globalConfDir] = \"#{$confdir}/#{$globalConfDir}\"\n\n altConfFile = \"#{$curdir}/.rake/#{$globalConfFile}\"\n if File.exists?(altConfFile)\n begin\n puts \"Reading local config file #{altConfFile}\" if $verbose\n c = YAML.load_file(altConfFile)\n raise \"Invalid yaml file\" if not c\n\n # surcharge d'options\n $sections.each {|s|\n next if c[s].nil?\n if $sections_uniq.include?(s)\n # remove then add option\n c[s].each {|o|\n o2 = o.gsub(/=.*/, \"=\")\n conf[s].delete_if {|o3| o3.start_with?(o2)}\n conf[s].push o\n }\n else\n c[s].each {|o|\n if o[0] == \"!\"\n # delete option\n conf[s].delete o[1..-1]\n else\n # just add option\n conf[s].push o\n end\n }\n end\n }\n rescue\n puts \"Error loading #{altConfFile}\"\n end\n end\n \n conf.each {|k,v|\n if v.class == Array\n conf[k].each_index {|i|\n conf[k][i].gsub!(/%B/, $basedir) if conf[k][i].class == String\n conf[k][i].gsub!(/%b/, $confdir) if conf[k][i].class == String\n }\n else\n conf[k].gsub!(/%B/, $basedir) if conf[k].class == String\n conf[k].gsub!(/%b/, $confdir) if conf[k].class == String\n end\n }\n\n return conf\nend",
"def package_config\n File.join @proj_path_base, 'packages.config'\n end",
"def hiera_configpath(hiera)\n File.join('config', 'hieras', hiera, 'hiera.yaml')\nend",
"def search_paths\n if Facter::Util::Config.is_windows?\n ENV['PATH'].split(File::PATH_SEPARATOR)\n else\n # Make sure facter is usable even for non-root users. Most commands\n # in /sbin (like ifconfig) can be run as non priviledged users as\n # long as they do not modify anything - which we do not do with facter\n ENV['PATH'].split(File::PATH_SEPARATOR) + [ '/sbin', '/usr/sbin' ]\n end\n end",
"def path\n @path || File.expand_path(ENV['NEXUS_CONFIG'] || DEFAULT_FILE)\n end",
"def lookup_paths\n if list = ENV['RUBY_LIBRARY']\n list.split(/[:;]/)\n #elsif File.exist?(path_file)\n # File.readlines(path_file).map{ |x| x.strip }.reject{ |x| x.empty? || x =~ /^\\s*\\#/ }\n elsif ENV['GEM_PATH']\n ENV['GEM_PATH'].split(/[:;]/).map{ |dir| File.join(dir, 'gems', '*') }\n elsif ENV['GEM_HOME']\n ENV['GEM_HOME'].split(/[:;]/).map{ |dir| File.join(dir, 'gems', '*') }\n else\n warn \"No Ruby libraries.\"\n []\n end\n end",
"def combined_app_root_glob(include_gen_root=true)\n \"{#{combined_app_root(include_gen_root).join(',')}}\"\n end",
"def conf_root(root = nil)\n Pathname(File.expand_path(root || Environment::CONFROOT || ENV['MIKUTTER_CONFROOT'] || '~/.mikutter'))\n rescue\n Pathname(File.expand_path(ENV['MIKUTTER_CONFROOT'] || '~/.mikutter'))\n end",
"def prefix\n (platform_family?('windows') ? 'C:/Chef/' : '/etc/chef/')\nend",
"def [](path)\n parts = path.to_s.split('.')\n result = @configuration\n\n parts.each do |k|\n result = result[k]\n\n break if result.nil?\n end\n\n result\n end"
] | [
"0.64382106",
"0.6112599",
"0.6111854",
"0.6070428",
"0.60597396",
"0.6038927",
"0.59924155",
"0.5984867",
"0.5970387",
"0.59595084",
"0.5950088",
"0.59435534",
"0.5933283",
"0.5887004",
"0.58679944",
"0.58664936",
"0.58411294",
"0.5838853",
"0.58301604",
"0.5820462",
"0.5819914",
"0.58148706",
"0.5808394",
"0.5803372",
"0.58013904",
"0.57939523",
"0.57895637",
"0.577499",
"0.5743166",
"0.57408494",
"0.57386065",
"0.5737857",
"0.5711954",
"0.56990284",
"0.5681722",
"0.5656303",
"0.5649019",
"0.5646869",
"0.56401396",
"0.5633854",
"0.56328595",
"0.55894035",
"0.5586319",
"0.5586319",
"0.5579178",
"0.5579015",
"0.55755776",
"0.5563372",
"0.55618316",
"0.55599415",
"0.5544673",
"0.5541374",
"0.5538334",
"0.55372137",
"0.5536623",
"0.55280435",
"0.55122787",
"0.5506831",
"0.54980487",
"0.5488365",
"0.5469939",
"0.54599977",
"0.5454998",
"0.5451718",
"0.54408985",
"0.5440496",
"0.5434163",
"0.54264146",
"0.54165596",
"0.5416183",
"0.5414661",
"0.5414445",
"0.5411514",
"0.54100215",
"0.54041743",
"0.54018015",
"0.53946346",
"0.53937644",
"0.5390944",
"0.5387371",
"0.5386455",
"0.5383479",
"0.53780675",
"0.5372948",
"0.53678966",
"0.53664184",
"0.536318",
"0.5359903",
"0.5351126",
"0.53494847",
"0.5344995",
"0.5334948",
"0.5327406",
"0.53190947",
"0.5317087",
"0.530561",
"0.5304218",
"0.53021115",
"0.5301173",
"0.5300556"
] | 0.5726123 | 32 |
Check that all arguments are probabilites i.e. the are numbers between 0.0 and 1.0 | def assert_probability *args
assert_floatable(*args)
args.each do |var|
assert do
var >= 0.0 &&
var <= 1.0
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validates_probability_constraints\n if project_state\n if (project_state.name == 'lead') && (probability >= 1.0)\n errors.add(:base,\n \"Probability of #{probability} is not allowed for the project state #{project_state.name}\")\n end\n\n if (project_state.name == 'offered') && (probability >= 1)\n errors.add(:base,\n \"Probability of #{probability} is not allowed for the project state #{project_state.name}\")\n end\n\n if (project_state.name == 'won') && (probability < 1)\n errors.add(:base,\n \"Probability of #{probability} is not allowed for the project state #{project_state.name}\")\n end\n\n if (project_state.name == 'running') && (probability < 1)\n errors.add(:base,\n \"Probability of #{probability} is not allowed for the project state #{project_state.name}\")\n end\n\n if (project_state.name == 'lost') && (probability > 0)\n errors.add(:base,\n \"Probability of #{probability} is not allowed for the project state #{project_state.name}\")\n end\n\n if (project_state.name == 'closing') && (probability < 1)\n errors.add(:base,\n \"Probability of #{probability} is not allowed for the project state #{project_state.name}\")\n end\n\n if (project_state.name == 'permanent') && (probability < 1)\n errors.add(:base,\n \"Probability of #{probability} is not allowed for the project state #{project_state.name}\")\n end\n end\n end",
"def test_arg_check_prospectors_valid\n ret = arg_check_prospectors '1'\n assert_equal ret, 0\n end",
"def probability (user_age, year_born, garlic_bread, insurance)\n if user_age <= 120 && year_born >= 1897 && garlic_bread == \"yes\" && insurance == \"yes\"\n p \"Probably not a vampire.\"\n elsif user_age >= 120 && year_born <= 1897 && (garlic_bread == \"no\" || insurance == \"no\")\n p \"Probably a vampire\"\n elsif user_age >= 120 && year_born <= 1897 && garlic_bread == \"no\" && insurance == \"no\"\n p \"Almost certainly a vampire\"\n else\n p \"Results inconclusive\"\n end\nend",
"def test_zero_prospectors\n\t\tassert check_args([1, 0])\n\tend",
"def test_exercise_115\n verify_method :exercise_115,\n :with => [{param: [0.8, 0.8], expect: true},\n {param: [0.1, 0.1], expect: true},\n {param: [0.9, 0.9], expect: true},\n {param: [1, 1], expect: false},\n {param: [0, 0], expect: false}]\n end",
"def conditional_probability\nend",
"def test_neg_prospectors\n\t\trefute check_args([1, -1])\n\tend",
"def test_check_num_args_valid\n args = CheckNumArgs.new\n assert_equal true, args.check_args([1,1,1])\n end",
"def test_check_num_args_invalid_negative\n args = CheckNumArgs.new\n assert_equal false, args.check_args([0,-1,-1])\n end",
"def test_positive\r\n args = Args.new\r\n assert_equal false, args.check_args(6)\r\n end",
"def should_invent?\n rand(100) < @probability * 100\n end",
"def test_check_num_args_invalid_zero\n args = CheckNumArgs.new\n assert_equal false, args.check_args([0,0,0])\n end",
"def distribution_valid?(d)\n # regardless of uncertainty description the following must be defined\n raise 'No distribution defined for variable' unless d.key? :type\n raise 'No minimum defined for variable' unless d.key? :minimum\n raise 'No maximum defined for variable' unless d.key? :maximum\n raise 'No mean/mode defined for variable' unless d.key? :mode\n\n if d[:type] =~ /uniform/\n # Do we need to tell the user that we don't really need the mean/mode for uniform ?\n elsif d[:type] =~ /discrete/\n # require min, max, mode\n raise 'No values passed for discrete distribution' unless d[:values] || d[:values].empty?\n if d[:weights]\n raise 'Weights are not the same length as values' unless d[:values].size == d[:weights].size\n raise 'Weights do not sum up to one' unless d[:weights].reduce(:+).between?(0.99, 1.01) # allow a small error for now\n else\n fraction = 1 / d[:values].size.to_f\n d[:weights] = [fraction] * d[:values].size\n end\n elsif d[:type] =~ /integer_sequence/\n d[:weights] = 1\n d[:values] = 1\n elsif d[:type] =~ /triangle/\n # requires min, max, mode\n elsif d[:type] =~ /normal/ # both normal and lognormal\n # require min, max, mode, stddev\n raise 'No standard deviation for variable' unless d[:standard_deviation]\n end\n\n true\n end",
"def test_arg_check_prospectors_decimal\n def exit(x); 1; end\n ret = arg_check_prospectors '1.6'\n assert_equal ret, -3\n end",
"def test_check_args_false\n c = Checker.new\n assert_equal false, c.check_args([1, 1, 1, 1])\n assert_equal false, c.check_args([1,1])\n assert_equal false, c.check_args(['something', 111])\n assert_equal false, c.check_args([1, -1, 1])\n assert_equal false, c.check_args([1, 1, -1])\n end",
"def probability_exact\n\t\t str_format=\"%0#{nr}b\"\n\t\t combinations=2**nr\n\t\t #p str_format\n\t\t total_w=combinations.times.map do |i|\n comb=sprintf(str_format,i)\n w_local=comb.length.times.inject(0) do |ac,j|\n sgn=comb[j]==\"0\" ? -1 : 1\n\t\t\t\t ac+(j+1)*sgn\n end\n\t\t end.sort\n\n \t\t total_w.find_all do |v| \n if @tails==:both\n v<=-w.abs or v>=w.abs\n elsif @tails==:left\n v<=w\n elsif @tails==:right\n \t\t\t\t v>=w\n end\n \t\t end.count/(combinations.to_f)\n end",
"def params_checked(params)\n \tparams.each do |key, value|\n \t\tif !is_number?(value)\n \t\t\treturn false\n \t\tend\n \tend\n \treturn true\n end",
"def initialize_probabilities\n @probabilities = (0..9).map{Array.new(16, @default_probability)}\n end",
"def test_positive\n args = Arguments.new\n assert_equal false, args.check_args(5)\n end",
"def has_chances?(chances)\n return false if(chances==0)\n return true\nend",
"def anti_prime?(targ)\n amount = num_factors(targ)\n (1...targ).all? { |i| amount > num_factors(i) }\nend",
"def aprobado?(nota1, nota2)\n promedio = (nota1 + nota2)/2\n promedio >= 5? true : false #IF ternario\nend",
"def test_check_num_args_valid2\n args = CheckNumArgs.new\n args.check_args([1,1,1])\n assert_kind_of Integer, 1\n end",
"def arguments_valid?\n return false if @arguments.length != 2\n @number = @arguments[0].to_i\n @value = @arguments[1].to_i\n true if (@number > 0 && @value > (@number-1) && @value < (@number*6+1)) \n end",
"def valid_num_values?(num, values)\n num == :many || (num == :one && values.length == 1)\n end",
"def get_probabilities()\n # If there is no value set at the moment, set it to [0.5, 0.25, 0.15, 0.1].\n if @metadata[:probabilities] == nil\n self.probabilities([0.5, 0.25, 0.15, 0.1])\n end\n return @metadata[:probabilities]\n end",
"def to_be_a_factor?\n return false if @factor_percentage.nil? || @factor_of.nil?\n Random.new().rand(1..100) <= @factor_percentage\n end",
"def test_check_num_args_invalid3\n args = CheckNumArgs.new\n assert_equal false, args.check_args([1, 2])\n end",
"def test_check_num_args_invalid2\n args = CheckNumArgs.new\n assert_equal false, args.check_args([1])\n end",
"def test_args_check_less\n\t\targs_checker = ArgsChecker::new\n\t\tarr = []\n\t\tassert_raises(\"I need one number bud, try again\") { args_checker.check_args arr }\n\tend",
"def get_perlin_bool_1d(x, chance=1, outof=2)\n throw Exception.new(\"chance must be less than outof\") if chance >= outof\n get_perlin_int_1d(x, 1, outof) <= chance\n end",
"def get_perlin_bool_1d(x, chance=1, outof=2)\n throw Exception.new(\"chance must be less than outof\") if chance >= outof\n get_perlin_int_1d(x, 1, outof) <= chance\n end",
"def all_votes_specified?\n # if at least one value is nil, return false\n return false if (pro.nil? or pro == \"\") or\n (con.nil? or con == \"\") or\n (abs.nil? or abs == \"\")\n # otherwise return true\n return true\n end",
"def all_votes_specified?\n # if at least one value is nil, return false\n return false if (pro.nil? or pro == \"\") or\n (con.nil? or con == \"\") or\n (abs.nil? or abs == \"\")\n # otherwise return true\n return true\n end",
"def test_check_args_valid\n args = CheckArgs.new\n assert_equal true, args.check_args([-5, 2, 3])\n end",
"def assert_floatable *args\n args.each do |var|\n assert do\n var.not_nil? && var.is_a?(Numeric)\n end\n end\n end",
"def test_one_ints\n args = Arguments.new\n assert_equal false, args.check_args([1])\n end",
"def test_exercise_1127\n @rec_calls = 0\n binomial(10, 4, 0.25)\n predicate = Proc.new { |actual|\n Math.log10(actual).truncate == Math.log10(@rec_calls).truncate\n }\n\n params = [10, 4]\n verify_method :exercise_1127,\n :with => [{params: params, predicate: predicate}]\n end",
"def bi_prime?(num)\n primers = prime_factors(num)\n primers.any? do |a|\n b = num / a * 1.0\n primers.include?(b)\n end\n\nend",
"def probA0(bit)\n\n # not quite zero, to avoid paying infinitely large\n # penalty when calculating score (div by zero)\n if bit == 0\n return 0.999999\n else #bit == 1\n # This value can be used to tweak coverage vs\n # exclusivity of modules\n return 0.000005\n end\nend",
"def test_check_args_invalid_zero\n args = CheckArgs.new\n assert_equal false, args.check_args([2, 0, 0])\n end",
"def test_args_check_greater\n\t\targs_checker = ArgsChecker::new\n\t\tarr = [2, 4]\n\t\tassert_raises(\"I need one number bud, try again\") { args_checker.check_args arr }\n\tend",
"def has_argument_variations?\n @variations.size > 1\n end",
"def check_parameter_constraints\n check_constraints_for_a if (@repository.parameters[:all])\n check_constraints_for_c if (@repository.parameters[:coord])\n check_constraints_for_d if (@repository.parameters[:delta])\n check_constraints_for_r if (@repository.parameters[:range])\n\n # check mandatory parameter combination\n check_parameter_occurrence\n \n # check mandatory file parameter\n check_mandatory_parameter(:file)\n end",
"def probA1(bit, sampleSum, remainingSamples, geneSum, remainingGenes, mutsRemaining, bitsRemaining)\n\n ar = sampleSum.to_f/remainingSamples.to_f\n ac = geneSum.to_f/remainingGenes.to_f\n a = mutsRemaining.to_f/bitsRemaining.to_f\n\n prob = nil\n if a == 1 #avoid division by zero problem in prob calculation\n prob = 1\n else\n prob = (ar*ac)/(a*(((1-ar)*(1-ac)/(1-a))+(ar*ac/a)))\n end\n\n #avoid division by zero problem in d calculation\n if prob == 1 \n prob = 0.999999\n elsif prob == 0\n prob = 0.000001\n end\n\n if bit == 1 \n return prob\n end\n return 1-prob\nend",
"def initialize (trials, prob)\n if trials <= 0\n raise ArgumentError.new(\"Error: trials must be greater than 0\")\n end\n @n = trials\n if prob < 0.0 || prob > 1.0\n raise ArgumentError.new(\"prob must be between 0 and 1\")\n end\n @p = prob\n end",
"def check_args(args)\n args.count == 2 && args[0].to_i > 0 && args[1].to_i > 0\n rescue StandardError\n false\n end",
"def param_is_valid?\n robot_facings = @robot.class.const_get(:AVAIABLE_FACING).map(&:to_s)\n\n !(@args =~ /^\\d+,\\d+,(#{robot_facings.join('|').upcase})+$/).nil?\n end",
"def check_args(args)\n begin\n results = [Integer(args[0]), Integer(args[1])] \n rescue ArgumentError, TypeError\n puts 'Invalid input.' \n end\n args.count == 2 && results[1] >= 1\nrescue StandardError\n false\nend",
"def probability m, n\r\n\t\t\treturn 1.0 * combination( @p, m ) * combination( @q, ( n - m ) ) / combination( ( @p + @q ), n )\r\n\t\tend",
"def param_check_nb(param, value)\n value = (param[:type] == 'int' ? value.to_i : value.to_f)\n if value < param[:min_value] || value > param[:max_value]\n write_output \"the value cannot be < #{param[:min_value]} or > #{param[:max_value]} for #{param[:string]} (#{param[:id]})\"\n return false\n end\n param_exec_value_change(param, value)\n end",
"def anti_prime?(num)\n num_facts = count_facts(num)\n (1...num).all? { |i| num_facts > count_facts(i) }\nend",
"def validate_numarg (num) \n raise NonNumericArgumentError if !num.numeric?\n num\nend",
"def is_divisible(n ,*arg)\n arg.all? { |x| n % x == 0 }\nend",
"def probability\n rand(1..100)\n end",
"def arguments_valid?\n # TO DO - implement your real logic here\n true if (1..2).include? @arguments.length \n end",
"def is_factor_of(small_num, big_num)\n\nend",
"def check_arguments(exp_num, args, cond=nil)\n cond = Proc.new{|n| !n.nil?} if cond.nil?\n return exp_num == args.select{|n| cond.call(n)}.size\n end",
"def test_promedio_edades\n n=5\n print validate(23.2, promedio_edades(n)) \nend",
"def test_invalid_coup_params\n #scooters too big\n assert_false(CoupChallenge.new(scooters: Array.new(101), c: 1, p: 1).check_inputs)\n \n #scooters too small\n assert_false(CoupChallenge.new(scooters: [], c: 1, p: 1).check_inputs)\n \n #c too big\n assert_false(CoupChallenge.new(scooters: [1], c: 1000, p: 1).check_inputs)\n \n #c too small\n assert_false(CoupChallenge.new(scooters: [1], c: 0, p: 1).check_inputs)\n \n #p too big\n assert_false(CoupChallenge.new(scooters: [1], c: 1, p: 1001).check_inputs)\n \n #p too small\n assert_false(CoupChallenge.new(scooters: [1], c: 1, p: 0).check_inputs)\n \n #scooters[i] too big\n assert_false(CoupChallenge.new(scooters: [1001], c: 1, p: 1001).check_inputs)\n \n #scooters[i] too small\n assert_false(CoupChallenge.new(scooters: [-1], c: 1, p: 1001).check_inputs)\n end",
"def probabilities(prob)\n # Must be length 4 and must add up to 1.\n if prob.length == 4\n sum = Rational(0)\n prob.map { |x| sum += Rational(x.abs.to_s) }\n if sum == Rational(1)\n @metadata[:probabilities] = prob\n else\n raise \"Probabilities do not add up to 1.\"\n end\n else\n raise \"Four probabilities not given.\"\n end\n return self\n end",
"def check_nums(num1, num2)\r\n\r\nend",
"def arguments_valid?\n true \n # to do\n end",
"def test_two_valid_arguments\n\t\tc = Check.new\n\t\trefute c.check_arguments([1,1])\n\tend",
"def test_zero\r\n args = Args.new\r\n assert_equal false, args.check_args(0)\r\n end",
"def evaluate_param(x); (x.is_a?(Range) ? rand(x) : x).to_f; end",
"def check_args(arguments)\r\n if arguments.length != 3\r\n puts 'There must be exactly three arguments: *seed*, *num_prospectors*, *num_turns*'\r\n return false\r\n elsif arguments[1].to_i.negative? || arguments[2].to_i.negative?\r\n puts 'Usage:'\r\n puts 'ruby ruby_rush.rb *seed* *num_prospectors* *num_turns*'\r\n puts '*seed* should be an integer'\r\n puts '*num_prospectors* should be a non-negative integer'\r\n puts '*num_turns* should be a non-negative integer'\r\n return false\r\n end\r\n true\r\nend",
"def ptest(*args)\n ptest?(*args) ? ONE : ZERO\n end",
"def bi_prime?(num)\n prime_factor_candidates = (2...num).to_a.select {|n| num % n == 0}\n prime_factors = prime_factor_candidates.select {|n| prime?(n)}\n prime_factors.each {|n| return true if prime_factors.include?(1.0*num/n)}\n false\nend",
"def check_params(x,y)\n if (x.to_i > self.table_size_x || x.to_i < 0) || (y.to_i > self.table_size_y || y.to_i < 0)\n return false\n else\n return true\n end\n end",
"def prob_within(column, range)\n col_type = schema.type column\n Veritable::Util.check_datatype(col_type, \"Probability within -- \")\n if col_type == 'boolean' or col_type == 'categorical'\n count = distribution.inject(0) {|memo, row|\n if range.include? row[column]\n memo + 1 \n else\n memo\n end\n }\n count.to_f / distribution.size\n elsif col_type == 'count' or col_type == 'real'\n mn = range[0]\n mx = range[1]\n count = distribution.inject(0) {|memo, row|\n v = row[column]\n if (mn.nil? or v >= mn) and (mx.nil? or v <=mx)\n memo + 1 \n else\n memo\n end\n }\n count.to_f / distribution.size\n end\n end",
"def test_nonzero_arguments\n args_checker = ArgsChecker.new\n arr = [1]\n assert_equal false, args_checker.check_mode(arr)\n end",
"def test_two_ints\n args = Arguments.new\n assert_equal false, args.check_args([1, 2])\n end",
"def validate_params\n validate_size\n validate_mine_density\n validate_first_click\n type_specific_checks\n end",
"def check_params; true; end",
"def probability_of_success_given(title)\n features = FEATURES.select { |feature| send(feature, title) }\n p_features = features.map { |feature| @probability_of_feature[feature] }.inject(1, :*)\n p_feature_given_successes = features.map { |feature| @probability_of_feature_given_success[feature] }.inject(1, :*)\n p_feature_given_successes * @probability_of_success / p_features\n end",
"def test_check_invalid_prospectors\n assert_equal check_valid([2, 0, 1]), [1, nil, nil, nil]\n end",
"def prob(x, u, o)\n f = (1/(Math.sqrt(2*Math::PI)*o.to_f))*(Math::E)**((((x.to_f - u.to_f)**2)/(2*o.to_f**2))*-1)\nend",
"def prob(x, u, o)\n f = (1/(Math.sqrt(2*Math::PI)*o.to_f))*(Math::E)**((((x.to_f - u.to_f)**2)/(2*o.to_f**2))*-1)\nend",
"def probability_of_success\n experience / 5.0\n end",
"def all_negatives?(nums)\n nums.each { |element| return false if element >= 0 }\n true\nend",
"def test_multiples_of_three_are_not_prime\n mults_of_three = (6..100).step(3).to_a\n\n mults_of_three.each do |x|\n assert_equal(false, @primes_container.is_prime?(x), \"#{x} caused failure\")\n end \n end",
"def arguments_valid?\n true \n end",
"def test_three_ints\n args = Arguments.new\n assert_equal true, args.check_args([1, 2, 3])\n end",
"def pass?(num)\n (2..20).each do |factor|\n return false unless (num % factor).zero?\n end\n true\nend",
"def test_double_argument\n\t\tc = Check.new\n\t\tassert c.check_arguments([1,1.2,1])\n\tend",
"def abundant?(num)\n\nend",
"def abundant?(num)\n\nend",
"def check_arguments\n convert_boolean_strings\n check_output\n check_log_level\n check_input_entry\n check_input_types\n end",
"def test_numbers_less_than_one_are_not_prime\n assert_equal(false, @primes_container.is_prime?(0))\n end",
"def equals(values, *outcomes)\n if values.instance_of?(Range)\n values.each do |val|\n @possibilities << Possibility.new(outcomes, :== => val)\n end\n else\n @possibilities << Possibility.new(outcomes, :== => values)\n end\n end",
"def test_zero\n args = Arguments.new\n assert_equal false, args.check_args(0)\n end",
"def abundant?(num)\nend",
"def test_arg_check_prospectors_negative\n def exit(x); 1; end\n ret = arg_check_prospectors '-1'\n assert_equal ret, -3\n end",
"def profile_complete?\n\t\tparameters_with_values = generate_array_of_param_with_value\n\n\t\tparameters_with_values.each do |p|\n\t\t\treturn false if !p\n\t\tend\n\n\t\treturn true\n\tend",
"def test_costo_cafe\n print validate(177.56, costo_cafe(100.0,7))\n print validate(1537.30, costo_cafe(1000.0,5)) \n print validate(363.0, costo_cafe(300.0,2)) \nend",
"def prob(n)\n n = n\n x = n/2\n as, ae = fact_sig_exp(n)\n bs, be = fact_sig_exp(x)\n bs *= bs\n be *= 2\n cs, ce = power_sig_exp(2, n)\n\n s = as / bs / cs\n e = ae - be - ce\n s*10**e\nend",
"def probability(a)\n total=0\n\n for j in 0..9\n if(a[j]==nil)\n next\n end\n total += a[j]\n end\n for i in 0..9\n if(a[i]==nil)\n next\n end\n puts 'P(' + i.to_s + ') = '+ (a[i]/total).to_s\n end\n max(a,total)\nend",
"def check\n\tprint_or_not \"Value of @N = #{@N}\", 4\n\tprint_or_not \"Value of @t = #{@t}\", 4\n\tprint_or_not \"Value of @m = #{@m}\", 4\nend",
"def test_cantidad_cuotas\n print validate(36, cantidad_cuotas(16,1900.0))\n print validate(24, cantidad_cuotas(29,2100.0)) \n print validate(12, cantidad_cuotas(19,700.0)) \n print validate(6, cantidad_cuotas(20,1000.0))\n print validate(3, cantidad_cuotas(15,3200.0)) \nend"
] | [
"0.66886836",
"0.61350894",
"0.61068773",
"0.60648835",
"0.59587735",
"0.59119785",
"0.588656",
"0.57861376",
"0.5775112",
"0.5772532",
"0.5768143",
"0.57274085",
"0.57232666",
"0.56961894",
"0.5673697",
"0.5658413",
"0.56407744",
"0.56374884",
"0.56367",
"0.56323916",
"0.5626067",
"0.5614178",
"0.5597749",
"0.55881315",
"0.55819505",
"0.55766094",
"0.55756354",
"0.5567384",
"0.55482495",
"0.5543338",
"0.55325586",
"0.55325586",
"0.55184174",
"0.55184174",
"0.5507954",
"0.5506171",
"0.5498221",
"0.5461968",
"0.5380667",
"0.53703797",
"0.536978",
"0.5366238",
"0.5351243",
"0.534577",
"0.534231",
"0.5340112",
"0.533283",
"0.533049",
"0.53284454",
"0.5325349",
"0.53195775",
"0.5318004",
"0.53144944",
"0.53068334",
"0.5305607",
"0.5304945",
"0.5282279",
"0.527949",
"0.5279253",
"0.5273134",
"0.5262025",
"0.52605313",
"0.525599",
"0.52483004",
"0.524603",
"0.52323925",
"0.52271223",
"0.5224886",
"0.5224811",
"0.5224254",
"0.52203894",
"0.5217163",
"0.5217144",
"0.5212631",
"0.52115333",
"0.5207591",
"0.52074283",
"0.5198184",
"0.5198184",
"0.5191721",
"0.51910305",
"0.5184459",
"0.5182629",
"0.5181404",
"0.51805747",
"0.5174429",
"0.5168437",
"0.5168437",
"0.5164033",
"0.5162425",
"0.5156453",
"0.51555103",
"0.5150889",
"0.51502246",
"0.5149758",
"0.51375",
"0.5136862",
"0.5135931",
"0.51331025",
"0.5128491"
] | 0.76469076 | 0 |
Checks that all arguments are float or can be converted to a float. | def assert_floatable *args
args.each do |var|
assert do
var.not_nil? && var.is_a?(Numeric)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def are_floats?(x,y)\n return x.is_a?(Float) && y.is_a?(Float)\n end",
"def float3?(input)\n Float(input) rescue false\nend",
"def float?\n !!Float(self)\n rescue ArgumentError, TypeError\n false\n end",
"def expect_float(value, field, subfield)\n return true if value.blank?\n return true if value.is_a?(Float)\n errors.add(field, \"#{subfield} must be a float if present\")\n false\n end",
"def validate_float(inFloat) \n\t returnValue = []\n\t if nil == inFloat\n\t\t returnValue << \"cannot be null \"\n\t else\n\t\t begin \n\t\t\t Float(inFloat)\n\t\t\t returnValue = nil \n\t\t rescue Exception => err \n\t\t\t returnValue = \" #{err.message }\" \n\t\t end \n\t end\n\t returnValue\n end",
"def is_float?(input)\n input.to_f.to_s == input\nend",
"def float?(object)\n return true if Float(object)\n rescue \n return false\nend",
"def is_float(answer)\n float_answer = answer.to_f\n if float_answer == 0.0\n float_answer = nil\n end\n [float_answer, \"#{answer} must be a valid float.\"]\nend",
"def numeric_check(first_num)\n Float(first_num) != nil rescue false\nend",
"def valid_float_number?(num)\n num.to_f.to_s == num\nend",
"def check_number_operands(operator, left, right)\n unless left.is_a?(Float) && right.is_a?(Float)\n raise LoxRuntimeError.new(operator, \"Operands must be numbers.\")\n end\n end",
"def check_real(field_info, field)\n if should_be_float?(field_info, field) && !float?(field)\n add_float_message_to_errors(field)\n end\n end",
"def is_valid_float_param(param_name)\n # this is the equivalent one-liner ruby-style\n # true if Float params[param_name] rescue false\n begin\n Float(params[param_name])\n return true\n rescue\n return false\n end\n end",
"def check_float(a, b)\n tolerance = Math::TOLERANCE\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend",
"def check_float(a, b)\n tolerance = Math::TOLERANCE\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend",
"def float?\n type == \"FLOAT\" || type == \"FLOAT64\"\n end",
"def valid_num?(input)\n integer?(input) || float?(input)\nend",
"def should_be_float?(field_info, field)\n field_info[\"type\"] == \"REAL\"\n end",
"def isFloat?\n !!Float(exp) rescue false\n end",
"def is_float?\n\t\tFloat(self) != nil rescue false\n\tend",
"def check_float(a, b)\n #tolerance = 1e-12\n tolerance = 1e-2\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\n end",
"def expect_integer_or_float(value, field, subfield)\n return true if value.blank?\n return true if value.is_a?(Integer) || value.is_a?(Float)\n errors.add(field, \"#{subfield} must be an integer or float if present\")\n false\n end",
"def valid_number?(num)\n integer?(num) || float?(num)\nend",
"def check_float(param, default, options = {})\n min = (options[:min] ? param.to_f >= options[:min] : true)\n max = (options[:max] ? param.to_f <= options[:max] : true)\n\n if (param && param.strip =~ /^-?[0-9]+(\\.[0-9]+)?$/ && min && max)\n param.to_f\n else\n default\n end\n end",
"def check_float(a, b)\n tolerance = 1e-12\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend",
"def is_float?\n self.to_f.to_s == self\n end",
"def is_numeric?(val)\n Float val rescue false\n end",
"def float_val?(val)\n !!(val =~ /\\A[-+]?\\d+(\\.\\d+)?\\z/)\n end",
"def numeric?(object)\n true if Float(object) rescue false\nend",
"def numeric?(input)\n !Float(input).nil?\n rescue\n false\n end",
"def test_002_convert_float2\r\n\tresult = convert_float( '')\r\n\tassert close_enough( 0.0, result )\r\n end",
"def numeric?(num)\n !!Float(num) rescue false\nend",
"def float2?(input)\n /\\d/.match(input) && /^-?\\d*\\.?\\d*$/.match(input)\nend",
"def valid_float_str?(str)\n str =~ /^[+\\-]?[\\d\\.]*$/ # optional sign, then only digits OR '.'\n end",
"def float?(num)\n num.to_f.to_s == num\nend",
"def float?(string)\n b = Float(string.tr(',', '.'))\n return b\nrescue ArgumentError\n return false\nend",
"def is_number(num)\n true if Float(num) rescue false\nend",
"def valid_number?(num)\n valid_integer?(num) || valid_float?(num)\nend",
"def float?(field)\n self.send(field).is_a? Float\n end",
"def valid?(num)\n num.to_f.positive? && (valid_int?(num) || valid_float?(num))\nend",
"def float?(str)\n true if Float(str) rescue false\n end",
"def is_digit?(input)\n !!Float(input) rescue false\nend",
"def numeric?; float?; end",
"def float?(num)\n num.to_f().to_s()==num\nend",
"def is_f?\n !!(self =~ /^[-+]?[0-9,]+\\.[0-9]+$/)\n end",
"def to_Float\n begin\n fl = Float stripn\n return fl\n rescue ArgumentError\n return false\n end\n end",
"def float?\n @kind == :float_lit || @kind == :float_exp_lit\n end",
"def verifica(numero)\n true if (Float(numero)) && (Float(numero) > 1.0) rescue false\nend",
"def float?\n !!strip.match(/^-?\\d+\\.\\d+$/)\n end",
"def float_check(num)\n\tif num.include?(\".\")\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend",
"def float_check(num)\n\tif num.include?(\".\")\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend",
"def check_number_operand(operator, operand)\n unless operand.is_a?(Float)\n raise LoxRuntimeError.new(operator, \"Operand must be a number.\")\n end\n end",
"def numeric?\n !!Float(self) rescue false\n end",
"def float?(num)\n num == num.to_f.to_s\nend",
"def float?\n self.class.float?(self)\n end",
"def apply_validations_for_float\n flex_column_class.validates field_name, :numericality => true, :allow_nil => true\n end",
"def float?(num)\n /\\d/.match(num) && /^-?\\d*\\.?\\d*$/.match(num) ? true : false\nend",
"def is_numeric?\n begin Float(self)\n true \n end\n rescue\n false\n end",
"def is_a_number?(num)\n is_integer?(num) || is_float?(num)\nend",
"def is_numeric?(value)\n !!Float(value) rescue false \n end",
"def numeric(x)\n true if Float(x) rescue false\n end",
"def float_valid?(input)\n temp = input.to_s\n true_num = true\n #invalid input if there are more than one \".\"\n #and start with \".\"\n dot_num = temp.count(\".\") \n if dot_num != 0\n if dot_num > 1\n true_num = false\n end\n if temp.index(\".\") == 0\n true_num = false\n end\n end\n #invalid input if there are more than one \"-\"\n #and not start with \"-\"\n minus_num = temp.count(\"-\")\n if minus_num != 0\n if minus_num > 1\n true_num = false\n end\n if temp.index(\"-\") != 0\n true_num = false\n end\n end\n \n #invalid input if there are other symbols\n temp.each_char do |r|\n flag = (45..57).cover?(r.ord) && r.ord != 47\n if !flag\n true_num = false\n end\n end\n return true_num\n end",
"def has_floats(*attrs)\n options = attrs.extract_options!\n attrs.each do |attr|\n\n attr_reader attr\n define_reader_with_options(attr,options)\n\n define_method(\"#{attr.to_s}=\") do |val|\n instance_variable_set(\"@#{attr}\", val.to_f)\n attributes[attr] = val\n val\n\n end\n end\n end",
"def check_type (num)\n # convert to float if validated number contains a decimal\n if num =~ /\\./\n return num = Float(num)\n else\n return num = Integer(num)\n end\nend",
"def valid_float(input)\n while true\n if input =~ /^(\\d)*(.)?(\\d)+$/ && input.to_f > 0\n return input.to_f\n else\n puts \"Try again! Only use numbers\"\n input = gets.chomp\n end\n end\nend",
"def match_float( val )\n\t\treturn Float( val ) rescue nil\n\tend",
"def float(limit = nil)\n Validation.new { |d| d.is_a?(Float) && in_range?(d, limit) }\n end",
"def is_num_float(num_string)\n !(num_string !~ /^\\s*[+-]?((\\d+_?)*\\d+(\\.(\\d+_?)*\\d+)?|\\.(\\d+_?)*\\d+)(\\s*|([eE][+-]?(\\d+_?)*\\d+)\\s*)$/)\nend",
"def value_is_float?(string)\n return false if string.scan(/\\./).length != 1\n sides = string.split('.')\n return sides[0].numeric? && sides[1].numeric? && sides[1].to_i >= 0\n end",
"def is_number(str)\n true if Float(str)\nrescue StandardError\n false\nend",
"def number?(num)\n integer?(num) || float?(num)\nend",
"def numeric(input)\n return Float(input) != nil rescue false\n end",
"def is_number?(input)\n true if Float(input) rescue false\n end",
"def numeric?(object)\n \t\ttrue if Float(object) rescue false\n\tend",
"def like_f?\n return false unless self.to_f?\n\n num = self.without_leading_zeros\n (num.to_i != num.to_f) || num.include?(\".\")\n end",
"def is_number?(i)\n true if Float(i) rescue false\nend",
"def is_number?(i)\n true if Float(i) rescue false\nend",
"def check_for_float(company)\n float(company) unless\n company.floated? ||\n (initial_offering.percentage_owned(company) > BigDecimal.new('0.5'))\n end",
"def is_invalid?(num_1, num_2, num_3)\r\n\tflatlined = false\r\n\r\n\tif num_2 == num_1 || num_2 == num_3 || num_2.to_f.nan? || num_2 == 0 || !num_2.valid_float?\r\n\t\tflatlined = true\r\n\tend\r\n\r\n\treturn flatlined\r\nend",
"def operand?(str)\n\t\ttrue if Float(str) rescue false\n end",
"def to_float!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n type = TO_FLOAT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 313:11: 'float:'\n match( \"float:\" )\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__, 11 )\n\n end",
"def is_num(num)\n #First convert num to float or integer . If it is not a number, result will be 0.0. Convert that back in to string to confirm that it matches\n num.to_f.to_s == num || num.to_i.to_s == num\nend",
"def is_number?(string)\n true if Float(string) rescue false #need to understand this\nend",
"def apply_validations_for_decimal\n apply_validations_for_float\n end",
"def is_number? string\n true if Float(string) rescue false\nend",
"def check_number( num )\n if num.to_f != 0 || [\"0\", \"0.0\"].include?(num)\n is_float = false\n if num.include? \".\"\n is_float = true\n end\n if is_float\n as_number = num.to_f\n else\n as_number = num.to_i\n end\n return {number_ok: true, as_number: as_number}\n else\n return {number_ok: false}\n end\nend",
"def test_NilClass_InstanceMethod_to_f\n\t\tassert_equal(0.0, nil.to_f)\n\tend",
"def float?(num)\n num.to_f.to_s == num # converts num to interger and back to string and then compares this with num.\n\n #num.match(/\\d/) # this asks is input num has any letters in it.\nend",
"def float?(num)\n num.to_f.to_s == num # converts num to interger and back to string and then compares this with num.\n\n #num.match(/\\d/) # this asks is input num has any letters in it.\nend",
"def _is_numeric?(str)\n Float(str) != nil rescue false\n end",
"def is_numeric?(s)\n !!Float(s) rescue false\n end",
"def float?(word)\n (word.to_f.to_s != word) && word\n end",
"def numeric?(object)\n true if Float(object) rescue false\n end",
"def is_number(string)\r\n\ttrue if Float(string) rescue false\r\nend",
"def type_float!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 35 )\n\n\n\n type = TYPE_FLOAT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 211:13: 'float'\n match( \"float\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 35 )\n\n\n end",
"def is_number?\n is_float? || is_integer?\n end",
"def is_numeric?(s)\n !!Float(s) rescue false\n end",
"def is_valid_cost?(cost)\n return cost.class == Float && cost >= 0.0\n end",
"def is_numeric?(s)\n begin\n Float(s)\n rescue\n false # not numeric\n else\n true # numeric\n end\nend",
"def validates_numeric(atts, opts={})\n validatable_attributes(atts, opts) do |a,v,m|\n begin\n Kernel.Float(v.to_s)\n nil\n rescue\n m || 'is not a number'\n end\n end\n end"
] | [
"0.7191555",
"0.7092259",
"0.7052646",
"0.6985228",
"0.69429123",
"0.6911194",
"0.68796366",
"0.6865836",
"0.68004644",
"0.6793842",
"0.6787838",
"0.67493224",
"0.6737424",
"0.6661897",
"0.6661897",
"0.6627653",
"0.6617286",
"0.6613689",
"0.6613377",
"0.6606092",
"0.65955573",
"0.6587164",
"0.6507698",
"0.6475818",
"0.6473588",
"0.6440375",
"0.6407104",
"0.6394267",
"0.6366776",
"0.6339034",
"0.6329631",
"0.6325984",
"0.6325496",
"0.63092256",
"0.6308103",
"0.63066566",
"0.6289879",
"0.62720853",
"0.62652",
"0.6254968",
"0.62477255",
"0.6237469",
"0.6217061",
"0.6209591",
"0.620446",
"0.6203385",
"0.6202513",
"0.6192035",
"0.6190218",
"0.6175515",
"0.6175515",
"0.6173548",
"0.6159251",
"0.61570454",
"0.6128695",
"0.6106607",
"0.60997003",
"0.60903794",
"0.6088579",
"0.6071138",
"0.6038312",
"0.6035216",
"0.6032777",
"0.60302067",
"0.60297006",
"0.60272485",
"0.60254574",
"0.6019259",
"0.60137403",
"0.6009872",
"0.6000363",
"0.5990016",
"0.5982197",
"0.59492004",
"0.59464943",
"0.59461755",
"0.59461755",
"0.59445757",
"0.5934756",
"0.59205055",
"0.5917844",
"0.58914363",
"0.58503896",
"0.5833823",
"0.58291996",
"0.5774327",
"0.575467",
"0.57521594",
"0.57521594",
"0.57502156",
"0.57469356",
"0.57462656",
"0.57382894",
"0.5730526",
"0.5725276",
"0.5695131",
"0.5693927",
"0.5682944",
"0.5680733",
"0.566208"
] | 0.74273723 | 0 |
Checks that all arguments are symbols. | def assert_symbol *args
args.each{|a| assert{a.is_a?(Symbol)}}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def only_symbols?(*args)\n symbols = args.select { |_| _.is_a? Symbol }\n if symbols.length == args.length\n return true\n end\n false\n end",
"def no_symbols?(*args)\n symbols = args.select { |_| _.is_a? Symbol }\n if symbols.length > 0\n return false\n end\n true\n end",
"def check_arguments(params, *args)\n contains = true\n args.each do |arg|\n contains = false unless params.key? arg.to_sym\n end\n contains\n end",
"def arg_sym_check op\n raise TypeError, \"#{op} is not a symbol nor a string\", \"my_inject\" unless\n op.is_a?(Symbol) || op.is_a?(String)\n op\n end",
"def valid_symbol?(symbol)\n return false if [].include?(symbol)\n true\n end",
"def check_feature_is_not_symbol(feature)\n raise ArgumentError, \"#{feature} is not a symbol\" unless feature.instance_of?(Symbol)\n end",
"def has_characters?(*args)\n characters = args.select { |_| not _.is_a? Symbol }.join('')\n if characters.empty?\n return false\n end\n true\n end",
"def only_symbols?(text)\n text.is_a?(String) && text.present? && text.remove(SYMBOLS).blank?\n end",
"def valid_symbol s\n s = s.strip\n return false if s =~ /^\\d+$/ # drop all digit id's\n $stderr.print \"Symbol contains a space! <\"+s+\">\\n\" if s =~ /\\s/\n true\nend",
"def symbols?\n sort == ::SYMBOLS\n end",
"def methods_accepting_symbol; end",
"def check_arg_structure(args)\n valid = true\n valid &&= args.class == Array\n \n args.each do |a|\n valid &&= a.class == Array \n valid &&= a.size == 2\n a.each do |s|\n valid &&= s.class == String\n end\n end\n\n raise \"Imported function arguments in invalid form\" unless valid\n end",
"def check_arg_structure(args)\n valid = true\n valid &&= args.class == Array\n \n args.each do |a|\n valid &&= a.class == Array \n valid &&= a.size == 2\n a.each do |s|\n valid &&= s.class == String\n end\n end\n\n raise \"Imported function arguments in invalid form\" unless valid\n end",
"def is_space_arg? c = \"x\"\n is_arg? and space_seen and c !~ /\\s/\n end",
"def allow_currency_symbols(*args)\n # Obviously US-centric, I need to make it international or customizable.\n # Some international symbols '¢£¥€ƒ$,'\n add_equal_method CURRENCY_CHARS, args \n end",
"def valid?()\n (@invalid_reason.nil? && !(@hops.find { |h| h.is_a?(Symbol) or h.is_a?(String) }))\n end",
"def arguments_valid?\n true \n end",
"def verify_args(method, args)\n matches = Chassis.signatures[method].select do |key|\n args[key]\n end\n \n misses = Chassis.signatures[method] - matches\n \n unless misses.empty?\n raise \"Required arguments missing for '#{method}': #{misses.join(\", \")}\"\n end\n end",
"def has_symbol?(sym)\n\t\t\[email protected]?(sym) or @species.key?(sym)\n\t\tend",
"def check_arguments arguments\n arguments.each_with_index do |argument, index|\n next if argument.is_a? Numeric\n next if argument.is_a? String\n next if argument.is_a? Symbol\n next if argument.is_a? Hash\n next if argument.is_a? NilClass\n next if argument.is_a? TrueClass\n next if argument.is_a? FalseClass\n\n raise ArgumentError, \"Cannot send complex data for block argument #{index + 1}: #{argument.class.name}\"\n end\n\n arguments\n end",
"def arguments_valid?\n true\n end",
"def empty?() @symbols.empty? end",
"def validate_args (args)\n\t# todo\nend",
"def is_one_of?(*syms)\n syms.flatten.include?(to_sym)\n end",
"def labels_have_symbols!\n end",
"def parse_symbol_arg_space no, tk # :nodoc:\n args = []\n\n unget_tk tk\n if tk = parse_symbol_in_arg\n args.push tk\n return args if no and args.size >= no\n end\n\n loop do\n skip_tkspace_without_nl\n\n tk1 = get_tk\n if tk1.nil? || :on_comma != tk1[:kind] then\n unget_tk tk1\n break\n end\n\n skip_tkspace_comment\n if tk = parse_symbol_in_arg\n args.push tk\n break if no and args.size >= no\n end\n end\n\n args\n end",
"def is_symbol\n <<-CODE\n t1 = stack_pop();\n stack_push(SYMBOL_P(t1) ? Qtrue : Qfalse);\n CODE\n end",
"def arguments_valid?\n true\n end",
"def test_arg_check_3string\n \t@args = ArgumentCheck.new\n \tassert_equal(false, @args.arg_check(['poop', 'poopy', 'poopypoop']))\n end",
"def check_symbol(param, default, options = {})\n allowed = options[:allowed]\n if (param && !param.empty? && allowed.class == Regexp && param =~ allowed)\n param.to_sym\n elsif (param && !param.empty? && allowed.class == Array && allowed.map { |a| a.to_sym }.include?(param.to_sym))\n param.to_sym\n elsif (param && !param.empty? && (allowed.class == String || allowed.class == Symbol) && allowed.to_sym == param.to_sym)\n param.to_sym\n else\n default\n end\n end",
"def parse_symbol_in_arg\n tk = get_tk\n if :on_symbol == tk[:kind] then\n tk[:text].sub(/^:/, '')\n elsif :on_tstring == tk[:kind] then\n tk[:text][1..-2]\n elsif :on_dstring == tk[:kind] or :on_ident == tk[:kind] then\n nil # ignore\n else\n warn(\"Expected symbol or string, got #{tk.inspect}\") if $DEBUG_RDOC\n nil\n end\n end",
"def to_sym?(value); end",
"def check_args(hash)\n if !hash.include? :hostname\n raise ArgumentError, \"You must provide a hostname\"\n elsif !hash.include? :service_name\n raise ArgumentError, \"You must provide a service name\"\n elsif !hash.include? :return_code\n raise ArgumentError, \"You must provide a return code\"\n elsif !hash.include? :status\n raise ArgumentError, \"You must provide a status\"\n end\n end",
"def arguments_valid?\n begin\n @validoptions = BoilermakerOptions.new(options)\n @validoptions.validate\n # pp @validoptions.args\n return @validoptions.args\n rescue => error\n # pp x.args\n puts error.message + \"\\n\"\n exit\n end\n end",
"def symbols; end",
"def check_operator_symbol(symbol)\n \n symbol_array = ['+', '-', '*', '/']\n \n symbol_array.each do |sym|\n if symbol.to_s.split('').include?(sym) == true\n return true\n break\n else\n return false\n end\n end\nend",
"def validate_arguments(args={})\n return if args.count == 1 && args.keys.include?(:all)\n only_options = args[:only] || Set.new\n except_options = args[:except] || Set.new\n skip_options = args[:skip] || Set.new\n unless (only_options & except_options).empty? &&\n (only_options & skip_options).empty?\n raise IncorrectArgumentException.new(nil, 'The same arguments shouldn\\'t be used with different keys excluding except and skip')\n end\n if args[:skip] == 'all' && args.count > 1\n raise IncorrectArgumentException.new(nil, 'Option \\'skip\\' with argument \\'all\\' shouldn\\'t be used with another options')\n end\n end",
"def is_useful_non_terminal?(symbol)\n [ :program, :statement ].include?(symbol)\n end",
"def check_arguments\n convert_boolean_strings\n check_output\n check_log_level\n check_input_entry\n check_input_types\n end",
"def validate_arguments(args={})\n return if args.count == 1 && args.key?(:all)\n\n only_options = args[:only] || Set.new\n except_options = args[:except] || Set.new\n skip_options = args[:skip] || Set.new\n\n unless (only_options & except_options).empty? &&\n (only_options & skip_options).empty?\n\n raise IncorrectArgumentException.new(\n nil,\n <<-TXT\n The same arguments shouldn't be used\n with different keys excluding except and skip\n TXT\n )\n end\n\n if args[:skip] == 'all' && args.count > 1\n raise IncorrectArgumentException.new(\n nil,\n <<-TXT\n Option 'skip' with argument 'all' shouldn't be used\n with another options\n TXT\n )\n end\n end",
"def test_symbolize_keys_raise_argument_error\n e = assert_raises ::Appium::Core::Error::ArgumentError do\n ::Appium.symbolize_keys('no hash value')\n end\n\n assert_equal 'symbolize_keys requires a hash', e.message\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def test_string\n args = Arguments.new\n assert_equal false, args.check_args(\"puppy\")\n end",
"def arguments_valid?\n true if @commands.length > 0\n end",
"def test_in_symbols_on_examples\n assert_equal(['c'], @small_dfa.in_symbols(0,true))\n assert_equal(['a','c'], @small_dfa.in_symbols(1,true))\n assert_equal(['b'], @small_dfa.in_symbols(2,true))\n assert_equal(['a'], @small_dfa.in_symbols(3,true))\n\n assert_equal(['a'], @small_nfa.in_symbols(0,true))\n assert_equal([nil,'a'], @small_nfa.in_symbols(1,true))\n assert_equal(['b'], @small_nfa.in_symbols(2,true))\n assert_equal(['b','c'], @small_nfa.in_symbols(3,true))\n end",
"def have_all_types?\n @args.each do |a|\n unless @argtype.has_key? a\n return false\n end\n end\n true\n end",
"def valid_params?(*args)\n args.map { |a| return false if a.nil? || a.to_s.gsub(/\\s/, '').empty? }\n true\n end",
"def test_arg_check_2string\n \t@args = ArgumentCheck.new\n \tassert_equal(false, @args.arg_check(['poop', 'poopy']))\n end",
"def validate_hashes\n super unless BYPASS_COMMANDS.include?(command)\n end",
"def hash_or_parameter?(args)\n args.is_a?(Hash) || args.respond_to?(:to_unsafe_h)\n end",
"def any_symbol\n (any_string :min => 2, :max => 20).to_sym\n end",
"def verify_sanity_of_arguments!(hash)\n return if hash.is_a?(self.class)\n\n if hash.nil? || (!hash.respond_to?(:to_i) && (!hash.respond_to?(:keys) && !hash.respond_to?(:values)))\n raise ArgumentError.new(\"Expected Number, Hash or Economic::Entity::Handle - got #{hash.inspect}\")\n end\n\n if hash.respond_to?(:keys)\n unknown_keys = hash.keys - [:id, :id1, :id2, :number, \"Number\", \"Id\", \"Id1\", \"Id2\"]\n raise ArgumentError.new(\"Unknown keys in handle: #{unknown_keys.inspect}\") unless unknown_keys.empty?\n\n not_to_iable = hash.select { |k, v| !v.respond_to?(:to_i) }\n raise ArgumentError.new(\"All values must respond to to_i. #{not_to_iable.inspect} didn't\") unless not_to_iable.empty?\n end\n end",
"def mapping_name_is_valid?(mapping_name)\n mapping_name.class == Symbol\n end",
"def parse_symbol_arg(no = nil)\n skip_tkspace_comment\n\n tk = get_tk\n if tk[:kind] == :on_lparen\n parse_symbol_arg_paren no\n else\n parse_symbol_arg_space no, tk\n end\n end",
"def parse_symbol_arg_paren no # :nodoc:\n args = []\n\n loop do\n skip_tkspace_comment\n if tk1 = parse_symbol_in_arg\n args.push tk1\n break if no and args.size >= no\n end\n\n skip_tkspace_comment\n case (tk2 = get_tk)[:kind]\n when :on_rparen\n break\n when :on_comma\n else\n warn(\"unexpected token: '#{tk2.inspect}'\") if $DEBUG_RDOC\n break\n end\n end\n\n args\n end",
"def verify_signature\n super unless BYPASS_COMMANDS.include?(command)\n end",
"def arguments_valid?\n true \n # to do\n end",
"def validate_order_args(args)\n args.each do |arg|\n next unless arg.is_a?(Hash)\n arg.each do |_key, value|\n raise ArgumentError, \"Direction \\\"#{value}\\\" is invalid. Valid \" \\\n \"directions are: #{VALID_DIRECTIONS.inspect}\" unless VALID_DIRECTIONS.include?(value)\n end\n end\n end",
"def test_args_check_less\n\t\targs_checker = ArgsChecker::new\n\t\tarr = []\n\t\tassert_raises(\"I need one number bud, try again\") { args_checker.check_args arr }\n\tend",
"def normalize_pending_arguments(arguments)\n self.table = valid_argument_list!(arguments, Symbol)\n end",
"def test_check_args_invalid_string\n args = CheckArgs.new\n assert_equal false, args.check_args(['HI'])\n end",
"def check_params *required\n required.each{|p|\n params[p].strip! if params[p] and params[p].is_a? String\n if !params[p] or (p.is_a? String and params[p].length == 0)\n return false\n end\n }\n true\nend",
"def check_params *required\n required.each{|p|\n params[p].strip! if params[p] and params[p].is_a? String\n if !params[p] or (p.is_a? String and params[p].length == 0)\n return false\n end\n }\n true\nend",
"def arguments_valid?\n true # no required arguments\n end",
"def test_check_args_invalid_string2\n args = CheckArgs.new\n assert_equal false, args.check_args(['HI', 4, 'There'])\n end",
"def arguments_valid?\n true if ['install','list','uninstall'].include?(@arguments[0])\n end",
"def test_empty\r\n args = Args.new\r\n assert_equal false, args.check_args(\" \")\r\n end",
"def req_params_present? sym_array = []\n return sym_array.all? {|k| params.has_key? k}\n end",
"def shop_param_legit?(symbol, arr1, arr2)\n validate_param(:shop_param_legit?, :symbol, symbol => Symbol)\n validate_param(:shop_param_legit?, :arr1, arr1 => { Array => Integer })\n validate_param(:shop_param_legit?, :arr2, arr2 => { Array => Integer })\n return true\n end",
"def arguments_valid?\n # TO DO - implement your real logic here\n true if @arguments.length == 2\n end",
"def known_symbol?(s)\n @@known_symbols_by_glass[glass] && @@known_symbols_by_glass[glass].member?(s)\n end",
"def test_space_args_cmd\n assert_parses(\n s(:send, nil, :fun,\n s(:begin, s(:send, nil, :f, s(:lvar, :bar)))),\n %q{fun (f bar)})\n end",
"def test_string_argument\n\t\tc = Check.new\n\t\tassert c.check_arguments([1,'1',1])\n\tend",
"def ensure_strict_args(keys, required, allowed)\n missing = required - keys\n unless missing.empty?\n raise ArgumentError, \"missing keywords: #{missing.join(', ')}\"\n end\n unknown = keys - (required + allowed)\n unless unknown.empty?\n raise ArgumentError, \"extra keywords: #{unknown.join(', ')}\"\n end\n end",
"def arguments_valid?\n ret = false\n ret = true unless (@options.action == nil)\n end",
"def test_missing_argument_invalid_argument\n\t\tc = Check.new\n\t\trefute c.check_arguments([1,1,'s'])\n\tend",
"def valid_args?(args={})\n valid = false\n arguments.each do |name, argument|\n if argument[:required]\n return false if args[name] == nil\n end\n valid = argument.valid_input?(args[name])\n end\n return valid\n end",
"def arguments_valid?\n # TO DO - implement some real logic here\n true if @arguments.length == 1 \n end",
"def test_symbols_cannot_be_concatenated\n # Exceptions will be pondered further down the path\n ##assert_raise(___) do\n assert_raise(NoMethodError) do\n :cats + :dogs\n end\n\n # Because you can't concatenate symbols, trying to use the \"+\" operator on them returns the NoSuchMethod exception\n end",
"def arguments_valid?\n # TO DO - implement your real logic here\n true if (1..2).include? @arguments.length \n end",
"def test_check_args_false\n c = Checker.new\n assert_equal false, c.check_args([1, 1, 1, 1])\n assert_equal false, c.check_args([1,1])\n assert_equal false, c.check_args(['something', 111])\n assert_equal false, c.check_args([1, -1, 1])\n assert_equal false, c.check_args([1, 1, -1])\n end",
"def arguments_valid?\n # TO DO - implement your real logic here\n true if @arguments.length == 1 \n end",
"def verify_sanity_of_arguments!(hash)\n return if hash.is_a?(self.class)\n\n if hash.nil? || (!hash.respond_to?(:to_i) && (!hash.respond_to?(:keys) && !hash.respond_to?(:values)))\n raise ArgumentError.new(\"Expected Number, Hash or Economic::Entity::Handle - got #{hash.inspect}\")\n end\n\n if hash.respond_to?(:keys)\n unknown_keys = hash.keys - id_properties.keys - id_properties.values\n raise ArgumentError.new(\"Unknown keys in handle: #{unknown_keys.inspect}\") unless unknown_keys.empty?\n end\n end",
"def validate_search_args!(args)\n unless args.is_a?(Hash)\n if args.respond_to?(:to_hash)\n args = args.to_hash\n else\n raise \"Invalid parameter: #{args}. Search args must respond to :to_hash.\"\n end\n end\n\n args\n end",
"def check_params; true; end",
"def has_splat_args?\n !!(args && @args[-1] && @args[-1][0][/^\\*/])\n end",
"def process_arguments\n # clean unsupport symbols, e.g. JieFang;\n # or error argument due to option typo, e.g. '-list' will put 'ist' into the array in this src.\n @support_newspapers = Array.new #TODO: move to elsewhere\n @support_newspapers << :XM\n @support_newspapers << :WHB\n @support_newspapers << :YZ\n # ATTENTION: command line input is an array of string, to be consistent, internally I use only symbol when using this symbol\n @options.newspapers = @options.newspapers.collect { | item | item.to_sym } & @support_newspapers\n \n if @options.newspapers.size == 0\n @support_newspapers.each do | sym |\n @options.newspapers << sym\n end\n end\n end",
"def test_double_argument\n\t\tc = Check.new\n\t\tassert c.check_arguments([1,1.2,1])\n\tend",
"def has_arg name\n raise \"has_arg #{name}.#{name.class}\" unless name.is_a? Symbol\n self.arg_names.index_of name\n end",
"def test_check_num_args_string2\n args = CheckNumArgs.new\n assert_equal false, args.check_args(['HELLO', 'THERE'])\n end",
"def arguments_valid?\n true if @arguments.size > 1\n end",
"def arguments_valid?\n # TODO - implement your real logic here\n true # if @arguments.length == 1\n end",
"def is_useful_terminal?(symbol)\n symbol.is_a?(Bolverk::ASM::Token) and !([ :eof, :comma ].include?(symbol.type))\n end",
"def objects_and_symbols; end",
"def argument_types?(*value)\n true\n end",
"def validate(args)\n error = nil\n hash = nil\n required_keys = [:entropy, :salt, :iterations]\n if args.is_a? Array\n hash = Hash[required_keys.zip(args)]\n elsif args.is_a? Hash\n hash = args\n end\n # validate hash\n unless (hash.keys - required_keys).empty?\n error = \"Invalid: args must contain, #{required_keys.join(', ')}\"\n end\n unless hash[:entropy] =~ /([a-f0-9]{2}){128}/\n error = \"Invalid: entropy must be hexadecimal string (128 bytes)\"\n end\n unless hash[:salt] =~ /([a-f0-9]{2}){32}/\n error = \"Invalid: salt must be hexadecimal string (32 bytes)\"\n end\n unless hash[:iterations] >= 0\n error = \"Invalid: entropy must positive integer\"\n end\n raise ArgumentError.new(error) if error\n hash\n end",
"def check_no_extra_args!\n if @argv.length > 0\n Braid::Command.handle_error(\n Braid::BraidError.new('Extra argument(s) passed to command.'))\n end\n end",
"def test_two_valid_arguments\n\t\tc = Check.new\n\t\trefute c.check_arguments([1,1])\n\tend",
"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 valid_name!(name)\n not_empty!(name)\n unless [String, Symbol].include?(name.class)\n coercion_error!\n end\n name\n end"
] | [
"0.77265733",
"0.74199957",
"0.6752929",
"0.6687441",
"0.6634704",
"0.62949455",
"0.6239125",
"0.6207252",
"0.61717194",
"0.61463135",
"0.6138728",
"0.6074802",
"0.6074802",
"0.58708584",
"0.58428615",
"0.5813767",
"0.57811606",
"0.5779471",
"0.57729316",
"0.5757847",
"0.5747803",
"0.57463884",
"0.5725641",
"0.5695403",
"0.5678358",
"0.5667391",
"0.5661347",
"0.5643843",
"0.5603194",
"0.5601088",
"0.5598053",
"0.5595115",
"0.55915254",
"0.55799824",
"0.5575048",
"0.55714977",
"0.5565832",
"0.5564431",
"0.5561601",
"0.5543641",
"0.554307",
"0.55295277",
"0.5515433",
"0.55090195",
"0.5508738",
"0.550602",
"0.5502783",
"0.5500581",
"0.54727066",
"0.54700315",
"0.54675794",
"0.5463528",
"0.5458227",
"0.5457512",
"0.54563093",
"0.54525787",
"0.5448514",
"0.54475766",
"0.5441911",
"0.54208094",
"0.5415224",
"0.5414491",
"0.54142195",
"0.5397903",
"0.53920496",
"0.53918177",
"0.5390696",
"0.5385212",
"0.5384132",
"0.53758234",
"0.53690636",
"0.5367686",
"0.5363916",
"0.5363045",
"0.5356014",
"0.5348625",
"0.5329228",
"0.5327783",
"0.53205055",
"0.5319812",
"0.53048587",
"0.52926856",
"0.52906936",
"0.5275866",
"0.52668524",
"0.52559114",
"0.5254072",
"0.52489823",
"0.5248473",
"0.52456117",
"0.52411664",
"0.52409184",
"0.52399564",
"0.5239172",
"0.52332217",
"0.5230936",
"0.52203244",
"0.52107763",
"0.5208407",
"0.5207453"
] | 0.74488574 | 1 |
Checks that all arguments are a Proc object or +nil+. | def assert_proc_or_nil *args
args.each{|a| assert{a.nil? || a.is_a?(Proc)}}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_proc?(p)\n p.is_a?(Proc) || p.is_a?(Method)\n end",
"def any_args?\n @any_args\n end",
"def any_args?\n @any_args\n end",
"def callable_with?(args, callable=nil)\n signatures = @func.dispatcher.to_type\n callables = signatures.is_a?(Puppet::Pops::Types::PVariantType) ? signatures.types : [signatures]\n\n return true if callables.any? {|t| t.callable_with?(args) }\n return false unless block_given?\n args_type = Puppet::Pops::Types::TypeCalculator.singleton.infer_set(callable.nil? ? args : args + [callable])\n error_message = Puppet::Pops::Types::TypeMismatchDescriber.describe_signatures(@func.name, @func.signatures, args_type)\n yield error_message\n false\n end",
"def check_arguments arguments\n arguments.each_with_index do |argument, index|\n next if argument.is_a? Numeric\n next if argument.is_a? String\n next if argument.is_a? Symbol\n next if argument.is_a? Hash\n next if argument.is_a? NilClass\n next if argument.is_a? TrueClass\n next if argument.is_a? FalseClass\n\n raise ArgumentError, \"Cannot send complex data for block argument #{index + 1}: #{argument.class.name}\"\n end\n\n arguments\n end",
"def not_empty!(*args)\n if args.any?{|arg| arg.nil? or arg.to_s.empty?}\n coercion_error!\n end\n args\n end",
"def create_proc_with_params\n proc = Proc.new { |a| puts a * 2 }\n #on check on numbers of paramaters\n proc.call(4,6)\n proc.call(5)\nend",
"def not_nil!(*args)\n if args.any?{|arg| arg.nil?}\n coercion_error!\n end\n args\n end",
"def __typedeaf_validate_positionals(parameters, args)\n if parameters.size != args.size\n raise ArgumentError,\n \"wrong number of arguments (#{args.size} for #{parameters.size})\"\n end\n return nil\n end",
"def callable?(callable, args)\n callable.is_a?(PAnyType) && callable.callable?(args)\n end",
"def validate_unarity(proc, method_name)\n if ![1, -1].include?(proc.arity)\n raise ConfigError, \"Proc for #{@name.inspect}'s ##{method_name} has an \" +\n \"arity of #{proc.arity} when it should be 1.\"\n end\n end",
"def test procArg1, procArg2\n\tProc.new do |arg|\n\t\tprocArg2.call(procArg1.call(arg))\n\tend\nend",
"def any?\n required? || defaults? || splat? || block_arg?\n end",
"def validate_props\n if x = n_prop(:on_image_uploaded)\n if !x.is_a?(ProcEvent)\n puts \"#{self} of #{self.class} - :on_image_uploaded optional prop was\n passed, that should be of ProcEvent instance, but was not\n got #{props.on_image_uploaded.class} instead\"\n end\n end\n end",
"def proc_lamda_dif_one\n p = Proc.new { |num1, num2| \n num3= num1+num2 \n puts \"\\nProc executes even if it has less or more number of parameters\\n\"\n } \n p.call 50, 55, 60\n\n print \"\\n\\nFollowing Error with lamda if it has more or less no of arguments\"\n print \" than no of parameters it is catching showing the difference between \"\n print \" proc and lamda: \\n\\n\"\n l = lambda { |num1, num2| puts num1+num2 } \n l.call 50, 55, 60\nend",
"def validate_args (args)\n\t# todo\nend",
"def check_arg_structure(args)\n valid = true\n valid &&= args.class == Array\n \n args.each do |a|\n valid &&= a.class == Array \n valid &&= a.size == 2\n a.each do |s|\n valid &&= s.class == String\n end\n end\n\n raise \"Imported function arguments in invalid form\" unless valid\n end",
"def check_arg_structure(args)\n valid = true\n valid &&= args.class == Array\n \n args.each do |a|\n valid &&= a.class == Array \n valid &&= a.size == 2\n a.each do |s|\n valid &&= s.class == String\n end\n end\n\n raise \"Imported function arguments in invalid form\" unless valid\n end",
"def have_all_types?\n @args.each do |a|\n unless @argtype.has_key? a\n return false\n end\n end\n true\n end",
"def adjustable?(object)\n case object\n when Proc\n object.arity == 1\n else\n if object.respond_to?(:to_proc)\n object.to_proc.arity == 1\n else\n false\n end\n end\n end",
"def primitive?\n Proc === @body\n end",
"def argument_types?(*value)\n true\n end",
"def preconditions arr\n arr.each {|i|\n if (i.is_bool? && i==false) || (i.is_a?(Proc) && (i.call==false))\n return false\n end\n }\n return true\nend",
"def takes_a_proc( p )\n p.call\nend",
"def arg_required(*args)\n args.each{|obj| raise ArgumentError, \"Argument cannot be nil\" if obj.nil? }\n end",
"def handle_proc(pr, *a)\n case pr\n when Proc, Method\n pr.call(*a)\n else\n pr\n end\n end",
"def lazy_proc?(value)\n value.kind_of?(::Proc) && !self.type_class.ancestors.include?(::Proc)\n end",
"def check_call call\n args = process call[3]\n if args.length <= 1 #empty new()\n false\n elsif hash? args[1]\n #Still should probably check contents of hash\n false\n else\n true\n end\n end",
"def ensure_params(*args)\n return catch(:truthy) {\n args.each do |arg|\n throw(:truthy, false) unless ensure_param(arg)\n end\n\n throw(:truthy, true)\n }\n end",
"def valid_arguments?\n arguments_passed? && right_type?\n end",
"def one_of_type? *args\n args.any? {|x| is_a? x}\n end",
"def one_of_type? *args\n args.any? {|x| is_a? x}\n end",
"def lock_args_method_valid?\n [NilClass, TrueClass, FalseClass].none? { |klass| lock_args_method.is_a?(klass) }\n end",
"def valid_callback?(callback)\n callback.respond_to?(:call) || callback.is_a?(Symbol)\n end",
"def arguments?\n arguments.any?\n end",
"def arguments_valid?\n true if @arguments.size >= 1 \n end",
"def check_arguments(params, *args)\n contains = true\n args.each do |arg|\n contains = false unless params.key? arg.to_sym\n end\n contains\n end",
"def arg_check(args, types = nil, server = nil)\n return args unless types\n\n args.each_with_index.map do |arg, i|\n next arg if types[i].nil? || types[i] == String\n\n if types[i] == Integer\n begin\n Integer(arg, 10)\n rescue ArgumentError\n nil\n end\n elsif types[i] == Float\n begin\n Float(arg)\n rescue ArgumentError\n nil\n end\n elsif types[i] == Time\n begin\n Time.parse arg\n rescue ArgumentError\n nil\n end\n elsif types[i] == TrueClass || types[i] == FalseClass\n if arg.casecmp('true').zero? || arg.downcase.start_with?('y')\n true\n elsif arg.casecmp('false').zero? || arg.downcase.start_with?('n')\n false\n end\n elsif types[i] == Symbol\n arg.to_sym\n elsif types[i] == Encoding\n begin\n Encoding.find arg\n rescue ArgumentError\n nil\n end\n elsif types[i] == Regexp\n begin\n Regexp.new arg\n rescue ArgumentError\n nil\n end\n elsif types[i] == Rational\n begin\n Rational(arg)\n rescue ArgumentError\n nil\n end\n elsif types[i] == Range\n begin\n if arg.include? '...'\n Range.new(*arg.split('...').map(&:to_i), true)\n elsif arg.include? '..'\n Range.new(*arg.split('..').map(&:to_i))\n end\n rescue ArgumentError\n nil\n end\n elsif types[i] == NilClass\n nil\n elsif [Discordrb::User, Discordrb::Role, Discordrb::Emoji].include? types[i]\n result = parse_mention arg, server\n result if result.instance_of? types[i]\n elsif types[i] == Discordrb::Invite\n resolve_invite_code arg\n elsif types[i].respond_to?(:from_argument)\n begin\n types[i].from_argument arg\n rescue StandardError\n nil\n end\n else\n raise ArgumentError, \"#{types[i]} doesn't implement from_argument\"\n end\n end\n end",
"def check(obj)\n check_proc.call(obj)\n end",
"def arguments_valid?\n true \n end",
"def validate_inputs(env, rec, args)\n # check size\n return false unless inputs.size == args.size\n\n # check type\n inputs.each_with_index do |input, i|\n input = get_type(env, input, rec)\n unless input.match(env, args[i])\n return false\n end\n end\n return true\n end",
"def arguments_valid?\n # Should be no remaining arguments\n true if @arguments.length == 0\n end",
"def arguments_valid?\n # TO DO - implement your real logic here\n true if @arguments.length == 1 \n end",
"def arguments_valid?\n # TO DO - implement some real logic here\n true if @arguments.length == 1 \n end",
"def test_nil_args\n refute check_args(nil)\n end",
"def arguments_valid?\n true if @commands.length > 0\n end",
"def arguments?\n arguments.any?\n end",
"def arguments_valid?\n true\n end",
"def arguments_valid?\n true if @arguments.size > 1\n end",
"def hash_or_parameter?(args)\n args.is_a?(Hash) || args.respond_to?(:to_unsafe_h)\n end",
"def no_symbols?(*args)\n symbols = args.select { |_| _.is_a? Symbol }\n if symbols.length > 0\n return false\n end\n true\n end",
"def valid_params?(*args)\n args.map { |a| return false if a.nil? || a.to_s.gsub(/\\s/, '').empty? }\n true\n end",
"def validate(sym_or_proc=nil, &block)\n @validator = get_proc(:validate, sym_or_proc, block)\n self\n end",
"def arguments_valid?\n # TODO - implement your real logic here\n true # if @arguments.length == 1\n end",
"def arguments_valid?\n true \n # to do\n end",
"def create_proc_with_return\n proc = Proc.new { return puts \"I am a proc with return\" }\n #on check on numbers of paramaters\n proc.call()\n # will not be executed!\n puts \"I am behind proc's call that with a return \"\nend",
"def valid_args?(args={})\n valid = false\n arguments.each do |name, argument|\n if argument[:required]\n return false if args[name] == nil\n end\n valid = argument.valid_input?(args[name])\n end\n return valid\n end",
"def check_arguments\n convert_boolean_strings\n check_output\n check_log_level\n check_input_entry\n check_input_types\n end",
"def is_param_defined(params)\n yield if !params.is_a?(Struct) \n end",
"def arguments_valid?\n\t\t # TO DO - implement your real logic here\n\t\t true if @arguments.length == 1\n\t\tend",
"def my_all?(arr, &prc)\n arr.each do |ele|\n return false if !prc.call(ele)\n end\n true\nend",
"def validate!\n unless self.lambda or self.block\n raise ArgumentError.new(\"Missing Argument: each_record must take a block/lambda as an argument (#{self.inspect})\")\n end\n\n [self.lambda, self.block].each do |proc|\n # allow negative arity, meaning variable/optional, trust em on that.\n # but for positive arrity, we need 1 or 2 args\n if proc\n unless proc.is_a?(Proc)\n raise NamingError.new(\"argument to each_record must be a block/lambda, not a #{proc.class} #{self.inspect}\")\n end\n if (proc.arity == 0 || proc.arity > 2)\n raise ArityError.new(\"block/proc given to each_record needs 1 or 2 arguments: #{self.inspect}\")\n end\n end\n end\n end",
"def validate!\n unless self.lambda or self.block\n raise ArgumentError.new(\"Missing Argument: each_record must take a block/lambda as an argument (#{self.inspect})\")\n end\n\n [self.lambda, self.block].each do |proc|\n # allow negative arity, meaning variable/optional, trust em on that.\n # but for positive arrity, we need 1 or 2 args\n if proc\n unless proc.is_a?(Proc)\n raise NamingError.new(\"argument to each_record must be a block/lambda, not a #{proc.class} #{self.inspect}\")\n end\n if (proc.arity == 0 || proc.arity > 2)\n raise ArityError.new(\"block/proc given to each_record needs 1 or 2 arguments: #{self.inspect}\")\n end\n end\n end\n end",
"def empty?(*args, **_arg1, &block); end",
"def arguments_valid?\n true\n end",
"def validate_presence_of(*args)\n class_eval %{\n def is_exist?\n #{args}.all? { |x| eval(x.to_s) }\n end\n }\n end",
"def validate(*args, &block)\n end",
"def send_all_or_no_args(callable, *args, &block)\n callable.call(*[nil, args][clamp(callable.arity, min: 0, max: 1)], &block)\n end",
"def can_fire?(object, requirements = T.unsafe(nil)); end",
"def validate!(options)\n raise ArgumentError, 'from is missing.' if options[:from].nil?\n raise ArgumentError, 'to is missing.' if options[:to].nil?\n if !(options[:func].nil? || options[:func].is_a?(Symbol) || options[:func].is_a?(Proc))\n raise ArgumentError, 'func should be a symbol or proc.'\n end\n true\n end",
"def process_arguments\n if arguments_valid? \n process_command\n else\n raise ArgumentError\n end\n end",
"def variadic?\n @type.variadic?\n end",
"def canonicalise_args(fun)\n procpars = fun[:params] || {}\n if procpars.size == 0 && @args_named.size > 0\n set_error 999, \"Parameters passed to method declared to take none.\"\n return\n end\n # Go through the declared arglist and populate the positional arglist\n procpars.each_with_index do |pp, i|\n argname = pp[:name]\n argtype = pp[:type]\n arg_named = @args_named.delete argname\n arg_numbered = @args_named.delete i.to_s\n set_error(999, \"You cannot set the parameter #{argname} both by name and position\") and return if arg_named && arg_numbered\n arg = @args_pos[i] || arg_named || arg_numbered\n # Type-check arg\n case argtype\n when 'bit'\n set_error(999, \"The arg #{argname} must be literally true or false (was #{arg.to_json})\") and return unless arg == true || arg == false\n when 'num'\n if !arg.is_a?(Numeric)\n if arg.is_a?(String) && (arg_conv = arg.to_i rescue nil).to_s == arg\n arg = arg_conv\n elsif arg.is_a?(String) && (arg_conv = arg.to_f rescue nil).to_s == arg\n arg = arg_conv\n else\n set_error(999, \"The arg #{argname} must be numeric (was #{arg.to_json})\") \n return\n end\n end\n when 'str'\n if !arg.is_a?(String)\n if arg.is_a?(Numeric)\n arg = arg.to_s\n else\n set_error(999, \"The arg #{argname} must be a string (was #{arg.to_json})\")\n return\n end\n end\n when 'arr'\n set_error(999, \"The arg #{argname} must be an array (was #{arg.to_json})\") and return unless arg.is_a?(Array)\n when 'obj'\n set_error(999, \"The arg #{argname} must be a JSON object (was #{arg.to_json})\") and return unless arg.is_a?(Hash)\n end\n # Set the positional arg\n @args_pos[i] ||= arg\n end\n # The positional arglist should now be populated. The named arglist should be exhausted.\n set_error(999, \"Excess parameters passed (#{@args_named.to_json})\") and return unless @args_named.size == 0\n end",
"def procTest\n\t# Create a new Proc\n\tmultiplesOfThree = Proc.new { |n| n % 3 == 0 }\n\n\t# (1..100).to_a gives an array of integers from 1 to 100\n\t# \"Array.select\" selects only the items for which the original block returned true\n\ta = (1..100).to_a\n\ta.select!(&multiplesOfThree)\n\ta.each { |value| puts \"#{value} \" }\n\n\t# Calling a Proc\n\thello = Proc.new { puts \"Hello!\" }\n\thello.call\nend",
"def require_any_of(*keys)\n args_def.require_any_of(*keys)\n end",
"def has_splat_args?\n !!(args && @args[-1] && @args[-1][0][/^\\*/])\n end",
"def test_args_check_nil\n\t\targs_checker = ArgsChecker::new\n\t\tarr = nil\n\t\tassert_raises(\"I need one number bud, try again\") { args_checker.check_args arr }\n\tend",
"def call(*args)\n if to_proc.arity == 0\n to_proc.call\n else\n to_proc.call(*args)\n end\n end",
"def unresolved_call?\n callees.include?(\"__any__\")\n end",
"def arguments_valid?\n num = 0\n num += 1 if @options.stats\n num += 1 if @options.attach\n num += 1 if @options.detach\n return false if num > 1\n return true\n end",
"def my_all?(proc=nil)\n self.my_each do |item|\n if block_given?\n return false if !yield(item)\n else\n return false if !proc.call(item)\n end\n end\n true\n end",
"def my_all?(proc=nil)\n self.my_each do |item|\n if block_given?\n return false if !yield(item)\n else\n return false if !proc.call(item)\n end\n end\n true\n end",
"def are_nil?(*args)\r\n result = false\r\n args.each do |arg|\r\n result = result || arg == nil\r\n end\r\n result\r\n end",
"def single_param_validation(param_name, value, functions)\n functions = [functions] unless functions.kind_of? Array\n functions.collect do |f|\n case f\n when Proc\n f.(param_name, value)\n when Symbol\n send(f, param_name, value) unless f == :optional # [:optional].include? f\n else\n Logger.error(\"Not supported validator type: #{f} -> #{f.class}\")\n end\n end\n end",
"def inside?(*args)\n\t\tsignature_error = \"Specify a point(two floats, or one Point), line(two Point), or rectangle(one Rectangle).\"\n\t\t\n\t\traise \"Wrong arity. \" + signature_error unless args.length == 1 or args.length == 2\n\t\t\n\t\t\n\t\t\n\t\tcase args.length\n\t\t\twhen 1\n\t\t\t\tif klass.is_a? Point\n\t\t\t\t\tself.inside_p *args\n\t\t\t\telsif klass.is_a? Rectangle\n\t\t\t\t\tself.inside_r *args\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Will have exited by this point, unless there was an error.\n\t\t\t\traise \"One argument given. Expected Point or Rectangle, but recieved #{args[0].class.inspect} instead. \" + signature_error\n\t\t\twhen 2\n\t\t\t\tif args[0].class == args[1].class\n\t\t\t\t\tklass = args.first.class\n\t\t\t\t\tif klass.is_a? Point\n\t\t\t\t\t\t# a line, specified by two points\n\t\t\t\t\t\tself.inside_pp *args\n\t\t\t\t\telsif klass.is_a? Float\n\t\t\t\t\t\t# a point in space, specified by two floats\n\t\t\t\t\t\tself.inside_xy *args \n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Will have exited by this point, unless there was an error.\n\t\t\t\traise \"Two arguments given. Expected both to be Point or both to be Float, but recieved #{[args[0].class, args[1].class].inspect} instead. \" + signature_error\n\t\tend\n\tend",
"def confirm(args = T.unsafe(nil)); end",
"def try args\n # the argument conditions matched\n @blk.call *args if match? args\n end",
"def my_any?(arr, &prc)\n arr.each do |ele|\n return true if prc.call(ele)\n end\n false\nend",
"def arguments_valid?\n true # no required arguments\n end",
"def determine_arguments\n s = Marshal.load(Marshal.dump(self)) # sexp handling is not clean cut\n raise \"what is this?\" unless s.sexp.sexp_type == :iter && s.sexp[1].sexp_type == :call && s.sexp[1][1] == nil && s.sexp[1][2] == :proc && s.sexp[1][3].sexp_type == :arglist\n\n block_args = s.sexp[2]\n if block_args\n if block_args[0]==:lasgn\n # single argument\n args = [block_args[1]]\n elsif block_args[0]==:masgn\n # multiple arguments\n args = block_args[1]\n raise \"unsupported argument type #{args}\" unless args[0]==:array\n args = args[1..-1].map{ |arg|\n raise \"unsupported argument type #{arg}\" unless arg[0]==:lasgn\n arg[1]\n }\n else\n raise \"unsupported argument type #{args}\"\n end\n end\n\n # maybe we can fix the input so we don't have to repair it here?\n @args = @args[-args.size..-1] if args and args.size != @args.size\n\n @named_args = Hash[*args.zip(@args[-args.size..-1]).flatten] if args\n @named_args ||= {}\n end",
"def arguments_given?\n [email protected]?\n end",
"def function(argument1, argument2, *splat)\n puts argument1\n puts argument2\n #Is there a better way to detect an empty splat argument?\n if splat == []\n puts \"empty splat!\"\n else\n #Iterate over a variable number of arguments.\n splat.each { |splat_n| puts splat_n }\n end\nend",
"def visitProcedureCall(procedurecall,args=nil) \n say \"visitProcedureCall\"\n indent\n procedurecall.name.accept(self,nil)\n procedurecall.actualParams.accept(self,nil) if procedurecall.actualParams\n desindent\n end",
"def proc_call(arg)\n [1,2,3].each { |x| arg.call(x) }\nend",
"def my_none?(arr, &prc)\n arr.each do |ele|\n return false if prc.call(ele)\n end\n true\nend",
"def arguments_valid?\n begin\n @validoptions = BoilermakerOptions.new(options)\n @validoptions.validate\n # pp @validoptions.args\n return @validoptions.args\n rescue => error\n # pp x.args\n puts error.message + \"\\n\"\n exit\n end\n end",
"def pass_proc1 (proc1, proc2, number, proc3)\n proc1.call\n proc2.call\n proc3.call \n Proc.new { puts \"#{number} procs have been passed as arguments to the currently executing method #{__method__.to_s}\" }.call\n proc5 = Proc.new {puts \"A proc can be output from a method. This is the second property of higher-order functions\"} \nend",
"def my_all?(*args)\n arr = self\n is_all = true\n if !args[0].nil?\n arr.my_each do |x|\n if args[0].is_a?(Class)\n is_all = false unless x.is_a?(args[0])\n elsif args[0].is_a?(Regexp)\n is_all = false unless args[0].match?(x)\n else\n is_all = false unless args[0] == x\n end\n end\n elsif block_given?\n arr.my_each do |x|\n is_all = false unless yield(x)\n end\n else\n arr.my_each do |x|\n is_all = false unless x\n end\n end\n is_all\n end",
"def maybe_append_block! args, blk\n return false unless @has_proc_contract && !blk &&\n (@args_contract_index || args.size < args_contracts.size)\n\n args << nil\n true\n end",
"def check!\n super()\n \n if @params.kind_of? Array and (not @params.all? { |v| v.type != JsonRpcObjects::V11::GenericTypes::Nil })\n raise Exception::new(\"Nil return type isn't allowed for parameters.\")\n end\n end"
] | [
"0.6297956",
"0.6170972",
"0.6170972",
"0.5925793",
"0.57466346",
"0.56804603",
"0.56517655",
"0.564564",
"0.56393903",
"0.56253296",
"0.56065905",
"0.55867416",
"0.5580973",
"0.5560038",
"0.5558509",
"0.5510403",
"0.5493208",
"0.5493208",
"0.5469272",
"0.5432577",
"0.5421892",
"0.54025716",
"0.53441876",
"0.53426456",
"0.53179336",
"0.530774",
"0.5304396",
"0.5274358",
"0.52607507",
"0.52524",
"0.52191865",
"0.52191865",
"0.51878417",
"0.5186571",
"0.51723474",
"0.5151299",
"0.5139101",
"0.5134034",
"0.5124719",
"0.5119712",
"0.5117471",
"0.5110105",
"0.51070976",
"0.5100967",
"0.50849915",
"0.5083445",
"0.50796384",
"0.5077351",
"0.50768155",
"0.50744474",
"0.5066922",
"0.5066852",
"0.5063476",
"0.50593406",
"0.5055511",
"0.50539446",
"0.5051833",
"0.50492376",
"0.50465906",
"0.5041599",
"0.5039679",
"0.50288016",
"0.50288016",
"0.5023983",
"0.50098825",
"0.5008131",
"0.5007998",
"0.50060797",
"0.4998282",
"0.49803457",
"0.49780437",
"0.49764916",
"0.49593264",
"0.49588555",
"0.4948525",
"0.49451217",
"0.49295032",
"0.4926811",
"0.49266377",
"0.49258104",
"0.49206066",
"0.49206066",
"0.49122798",
"0.49109706",
"0.49104908",
"0.49062476",
"0.49053252",
"0.48936632",
"0.48908904",
"0.48841172",
"0.4881271",
"0.48776406",
"0.4876626",
"0.4864501",
"0.4863874",
"0.4863784",
"0.4841074",
"0.4837929",
"0.4830919",
"0.48281062"
] | 0.7289663 | 0 |
chf edit 20160627 it takes too long to load the full page of all transfers after doing this stuff. note redirect_to :back will be deprecated in rails 5 | def accept
@proxy_deposit_request.transfer!(params[:reset])
if params[:sticky]
current_user.can_receive_deposits_from << @proxy_deposit_request.sending_user
end
redirect_to :back, notice: "Transfer complete"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def student_transfer2\n flash[:notice] = t('batch_transfer')\n redirect_to transfer_batch_transfer_path(@batch)\n end",
"def transfers\n @transfers = TransferHelper.transfers_for_user(user:current_user)\n\n render :partial => 'home/transfers'\n end",
"def inventory_transfer2\n flash[:success] = \"Successfully Transfered\"\n redirect_to inventories_path\n end",
"def index\n @breadcrumbs = [['Transfers']]\n @transfers = @transfers.includes(:from_warehouse, :to_warehouse, :batch)\n transfers = TransferDecorator.decorate_collection(@transfers.order('id DESC'))\n @transfers = Kaminari.paginate_array(transfers).page(params[:page])\n end",
"def back; end",
"def back; end",
"def back; end",
"def transfer; end",
"def transfer; end",
"def payment_history\n check_history_permissions\n @back_button_url = determinate_back_link_url\n rescue BaseApi::Error400Exception\n return redirect_to payment_history_path unless page_number == 1\n end",
"def index\n @transfers = Transfer.all\n end",
"def index\n @transfers = Transfer.all\n end",
"def index\n @transfers = Transfer.all\n end",
"def index\n @transfers = Transfer.all\n end",
"def index\n @page = params[\"page\"]\n @transfers = Transfer.order(\"created_at desc\").all.paginate(:page => @page)\n end",
"def index\n redirect_to :action => 'request_bill'\n end",
"def index\n @transfers = @bank_account.transfers.all\n end",
"def transfer_funds\n @organizer = Organizer.find(params[:id])\n @amount = raw_price(params[:amount])\n @current = raw_price(params[:current])\n\n if params[:amount].nil?\n @status = \"danger\"\n @message_status = \"Você não especificou um valor\"\n return\n end\n\n @bank_account_active_id = @organizer.marketplace.bank_account_active.own_id\n if @bank_account_active_id.nil?\n @status = \"danger\"\n @message_status = \"Você não tem nenhuma conta bancária ativa no momento\"\n else\n if @amount <= @current\n bank_transfer_data = {\n \"amount\" => @amount,\n \"transferInstrument\" => {\n \"method\" => \"BANK_ACCOUNT\",\n \"bankAccount\" => {\n \"id\" => @bank_account_active_id,\n }\n }\n }\n response_transfer = RestClient.post(\"#{Rails.application.secrets[:moip_domain]}/transfers\", bank_transfer_data.to_json, :content_type => :json, :accept => :json, :authorization => \"OAuth #{@organizer.marketplace.token}\"){|response, request, result, &block|\n case response.code\n when 401\n @status = \"danger\"\n @message_status = \"Você não está autorizado a realizar esta transação\"\n @response_transfer_json = JSON.load response\n when 400\n @status = \"danger\"\n @message_status = \"Não foi possíel realizar a transferência\"\n @response_transfer_json = JSON.load response\n when 200\n @status = \"danger\"\n @message_status = \"Não foi possível realizar a transferência\"\n @response_transfer_json = JSON.load response\n when 201\n @status = \"success\"\n @message_status = \"Solicitação de transferência realizada com sucesso\"\n @response_transfer_json = JSON.load response\n MarketplaceMailer.transfer(@organizer, friendly_price(@response_transfer_json[\"amount\"]), l(@response_transfer_json[\"updatedAt\"].to_datetime, format: '%d de %B de %Y as %Hh%M')).deliver_now\n else\n @activation_message = \"Não conseguimos resposta do MOIP para a transferência soliticata, verifique os dados novamente.\"\n @activation_status = \"danger\"\n @response_transfer_json = JSON.load response\n end\n }\n else\n @status = \"danger\"\n @message_status = \"Você não tem fundos suficientes para realizar esta transferência\"\n end\n end\n\n end",
"def redirect\n # Request the ChargeBee server about the Update Card Hosted Page status \n # and provides details about the subscripton and customer.\n \n if \"succeeded\" == params[\"state\"]\n result = ChargeBee::HostedPage.retrieve(params[\"id\"])\n hosted_page = result.hosted_page\n if hosted_page.state != \"succeeded\"\n redirect_to \"/400\"\n return\n end\n \n \n id = hosted_page.content.customer.id\n redirect_to \"/update_card/profile?customer_id=#{URI.escape(id)}&updated=#{URI.escape(\"true\")}\"\n \n else\n redirect_to \"/400\"\n end\n end",
"def index\n redirect_to @trip\n end",
"def redirect_back \n\t\tredirect_to request.env['HTTP_REFERER']\n\tend",
"def redirects; end",
"def welcome_back\n @univ_choice = University.find(params[:univ_id])\n\n if request.post?\n\n begin \n params[:terms] = true # cust already accepted once!\n\n # find order\n #\n oo = Order.for_cust(@customer).for_univ(@univ_choice.id).last\n raise \"error - no #{@univ_choice.name} univ for customer #{@customer.email}!\" unless oo\n \n # set cc\n #\n card = CreditCard.secure_setup(params[\"credit_card\"], @customer)\n card_success = card.save\n raise \"problem w CC\" unless card_success\n \n # set addr\n #\n addr_success = private_addr_do\n raise \"problem w addr\" unless addr_success\n\n # test CC\n #\n charge_amount = 0.01\n success, msg = ChargeEngine.charge_credit_card(card, charge_amount, oo.id, \"test charge\") \n raise \"we tested your credit card and had a problem: #{msg}\" unless success\n \n # apply 1 month credit\n #\n @customer.add_account_credit(0, nil, 1) if @customer.credit_months <= 0\n\n # reenable univ\n #\n oo.reinstate\n\n session[:reinstated_univ_id] = oo.id\n return redirect_to :univstore_welcome_back_done, :flash => { :message => \"success!\" }\n\n rescue Exception => e\n\n return redirect_to :back, :flash => { :message => e.message }\n end\n end\n\n end",
"def index\n redirect_to :back\n rescue ActionController::RedirectBackError\n redirect_to root_path\n end",
"def transfer\n\t\t\t\[email protected]\n\t\t\tend",
"def incomplete\n redirect_to ladders_url\n end",
"def go_back\n redirect_to '/account/property-syndication'\n end",
"def fine_print_return\n redirect_back key: :fine_print_return_to\n end",
"def success\n authorize! :view_sofort_thankyou_page, @order\n @address = @order.address\n @product = @order.product.decorate\n return render 'signup/orders/show' if @order.confirmed?\n transaction = ::Sofort::FinishTransaction.new(@order)\n transaction.run do\n @order.status = :paid\n @order.confirm\n return render 'signup/orders/show'\n end\n # customer opens success-page, but transaction is not complete\n flash.now[:notice] = t(:transaction_no_confirmation)\n render 'signup/orders/show'\n end",
"def index\n @transfers = Transfer.all.limit(5)\n \n end",
"def redirect_to_overview\n if current_order.confirming?\n redirect_to wizard_path(:overview) and return unless step == :overview\n end\n end",
"def create\n @advance_search = AdvanceSearch.new(advance_search_params)\n\n respond_to do |format|\n if @advance_search.save\n if request.env['HTTP_REFERER'].include? overview_url\n format.html { redirect_to overview_url(:id=>@advance_search), notice: 'Search was successful'}\n else\n format.html { redirect_to spendings_url(:id=>@advance_search), notice: 'Advance search was successfully created.'}\n end\n # format.html { redirect_to :back,params:{:id=>@advance_search}, notice: 'Advance search was successfully created.' }\n format.json { render action: 'show', status: :created, location: @advance_search }\n else\n format.html { render action: 'new' }\n format.json { render json: @advance_search.errors, status: :unprocessable_entity }\n end\n end\n end",
"def back_click\n back\nend",
"def new\n redirect_to(:back)\n #render :action => 'new'\n end",
"def return_url\n @transaction = Bancard::Transaction.find(params[:id])\n if params[:status] == \"payment_fail\"\n flash[:error] = \"Error al recibir el pago\"\n redirect_to @transaction.failure_url\n else\n flash[:notice] = \"Pagado exitosamente\"\n redirect_to @transaction.success_url\n end\n end",
"def index\n redirect_to campaign_path(@campaign)\n end",
"def payment_transfers\n authorize :report\n\n @transfers = company.transfers(start_param, end_param)\n # @transfers = company.transfers(300.days.ago.to_s, Date.current.to_s)\n\n respond_to do |format|\n format.json\n format.pdf { render '/companies/report' }\n end\n end",
"def go_to_agencies\n if params[:back]\n session[:back] = true\n else\n session[:back] = false\n redirect_to agencies_url(:clear=>true)\n end\n end",
"def index\n redirect_to my_deliverables_path(current_user)\n end",
"def index\n render json: serializer_class.new(paginate(ecf_transfers), params: { cpd_lead_provider: current_user }).serializable_hash.to_json\n end",
"def new\n @page_title = \"New Transaction\"\n @transaction = Transaction.new\n @td = @global_company.transaction_details.first\n \n \n \n respond_to do |format|\n format.html {\n if @global_company.transactions_ended?\n redirect_to \"/\"\n end\n }\n format.json { render json: @transaction }\n end\n end",
"def show\n redirect_back(fallback_location: root_path)\n end",
"def show\n redirect_to base_home_loan_banks_url\n end",
"def index\n redirect_to orders_path\n\n end",
"def cancel_and_redirect\r\n redirect_back\r\n end",
"def find_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def complete\n handle_callback_params!\n redirect_to redirect_path(@payment.try(:order))\n end",
"def new_wizard_conversion\n init_variables_from_sessions\n @property_channel.skip_rate_conversion_multiplier = true\n\n if params[:back_button]\n redirect_to new_wizard_selection_property_channels_path\n else\n if @property_channel.valid?\n # do nothing\n else\n put_model_errors_to_flash(@property_channel.errors, 'redirect')\n redirect_to new_wizard_setting_property_channels_path\n end\n end\n end",
"def bank_to_order\n # Set active_tab to use in view filters\n session[:active_tab] = \"banks-tab\"\n\n client_payments_ids = params[:bank_to_order][:client_payments_ids].split(\",\")\n by_invoice = params[:bank_to_order][:by_invoice] == \"1\" ? true : false\n # redirect_to client_payments_path + \"#tab_banks\", alert: by_invoice and return\n bank_account_id = params[:bank_to_order][:bank_account_id]\n scheme_type_id = params[:bank_to_order][:scheme_type_id]\n presentation_date = params[:bank_to_order][:presentation_date]\n charge_date = params[:bank_to_order][:charge_date]\n\n # client_payments = ClientPayment.where(id: client_payments_ids)\n client_payments = by_invoice == true ? ClientPayment.where(id: client_payments_ids) : ClientPayment.by_bill_for_bank_order(client_payments_ids)\n bank_account = CompanyBankAccount.find(bank_account_id)\n scheme_type = SepaSchemeType.find(scheme_type_id)\n\n # Process only if there is unconfirmed payments\n if !client_payments.count.blank? && !bank_account.blank? && !scheme_type.blank?\n time_now = Time.new\n\n # SEPA Creditor Id\n creditor_id = bank_account.sepa_id\n if creditor_id.blank? || bank_account.bank_suffix.blank? || bank_account.holder_fiscal_id.blank?\n redirect_to client_payments_path + \"#tab_banks\", alert: \"¡Error!: Imposible remesar factura/s o plazo/s: Datos bancarios incorrectos.\" and return\n end\n\n # Instantiate class\n sepa = Ag2Gest::SepaOrder.new(client_payments, by_invoice)\n\n # Initialize class attributes\n sepa.identificacion_fichero = \"PRE\" + time_now.strftime(\"%Y%m%d%H%M%S%L\") + \"00\" +\n bank_account.bank_suffix.strip + bank_account.holder_fiscal_id.strip\n sepa.fecha_hora_confeccion = time_now.strftime(\"%Y-%m-%d\") + \"T\" + time_now.strftime(\"%H:%M:%S\")\n sepa.process_date_time = Date.today\n # sepa.numero_total_adeudos = client_payments.count\n # sepa..to_d = en_formatted_number_without_delimiter(client_payments.sum('amount+surcharge'), 2)\n sepa.nombre_presentador = bank_account.sanitized_company_name\n sepa.identificacion_presentador = creditor_id\n sepa.tipo_esquema = scheme_type.name\n sepa.identificacion_info_pago = creditor_id + time_now.strftime(\"%Y%m%d%H%M%S%L\") + \"00\"\n sepa.fecha_cobro = charge_date.to_date.strftime(\"%Y-%m-%d\")\n sepa.cuenta_acreedor = bank_account.right_iban\n sepa.time_now = time_now\n\n # Generate XML object\n xml = sepa.write_xml\n # xml = by_invoice == true ? sepa.write_xml : sepa.write_xml_by_bill\n\n # Created by\n created_by = !current_user.nil? ? current_user.id : nil\n # Bank order (remesa)\n remesa = sepa.remesa\n\n # Write & Upload XML file\n file_name = sepa.identificacion_fichero + \".xml\"\n file_path = \"/uploads/\" + sepa.identificacion_fichero + \".xml\"\n upload_xml_file(file_name, xml)\n\n # Catalogs the processed file\n processed_file = catalog_processed_file(file_name, ProcessedFileType::BANK_ORDER,\n ProcessedFile::OUTPUT, created_by,\n '', sepa.process_date_time)\n if !processed_file.save\n redirect_to client_payments_path + \"#tab_banks\",\n alert: (I18n.t('ag2_gest.client_payments.index.bank_to_order_no_catalog') +\n \" #{view_context.link_to I18n.t('ag2_gest.bills_to_files.index.go_to_target', var: file_name, var1: remesa), file_path, download: file_name}\"\n ).html_safe\n end\n\n # Notify successful ending\n # redirect_to client_payments_path, notice: \"Factura/s y plazo/s remesados sin incidencias.\"\n redirect_to client_payments_path + \"#tab_banks\",\n notice: (I18n.t('ag2_gest.client_payments.index.bank_to_order_ok') +\n \" #{view_context.link_to I18n.t('ag2_gest.bills_to_files.index.go_to_target', var: file_name, var1: remesa), file_path, download: file_name}\"\n ).html_safe\n end\n\n rescue\n redirect_to client_payments_path + \"#tab_banks\", alert: I18n.t('ag2_gest.client_payments.index.bank_to_order_error')\n end",
"def view_handler\n index = params[:index].to_i\n url = params[:url]\n msg = params[:msg]\n if index == 0 #backword\n session[:page_step] -= 1 #step_back\n url = session[('page' + session[:page_step].to_s).to_sym] \n else #forward\n session[:page_step] += 1 \n session[('page' + session[:page_step].to_s).to_sym] = url\n end\n\n #redirect to the page by url \n if msg.nil? \n redirect_to url\n else\n redirect_to url, :notice => msg\n end \n end",
"def create\n @transfer = Transfer.request(transfer_params, @user.name, @friend.name)\n @from_account = Account.find_by_acct_number(params[:transfer][:from])\n if @transfer.nil? || @transfer.amount < 0\n flash[:danger] = \"Invalid Transfer Amount\"\n\t redirect_to :back\n\t return\n elsif @transfer.amount >= @from_account.balance\n\t\tflash[:danger] = \"Insufficient Balance\"\n\t\tredirect_to :back\n\t\treturn\n\tend\n \n if @transfer.to.nil? || @transfer.to == \"\"\n flash[:danger] = \"Invalid Transfer: No Participant\"\n redirect_to \"/transfers/new\"\n return\n end\n \n respond_to do |format|\n if @transfer.save\n\t\t@to_account = Account.find_by_acct_number(params[:transfer][:to])\n\t\tnew_balance = @to_account.balance += @transfer.amount\n\t\tAccount.where(acct_number: @transfer.to).update_all(balance: new_balance)\n\t\t@to_account.save\n\t\t\n\t\t@from_account = Account.find_by_acct_number(params[:transfer][:from])\n\t\tnew_balance2 = @from_account.balance -= @transfer.amount\n\t\tAccount.where(acct_number: @transfer.from).update_all(balance: new_balance2)\n\t\t@from_account.save\n\t\t\t \n\t\tflash[:success] = \"Approved Transfer\"\n format.html { redirect_to @transfer, notice: 'Your transfer has been successfully processed.' }\n format.json { render :show, status: :created, location: @transfer }\n else\n format.html { render :new }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def dashboard\n redirect_to teams_url and return unless current_user.setting.teams?\n redirect_to sprint_import_url(@team.board_id) and return if @team.no_sprint?\n redirect_to kanban_import_issues_url(@team.board_id) and return if @team.no_kanban?\n redirect_to sprint_path(@team.sprint) and return if @team.kanban?\n end",
"def index\n @transicion_estado_arts = TransicionEstadoArt.all\n respond_to do |format|\n format.html { redirect_to :root }\n end\n end",
"def redirect_back\n RedirectBack.new self\n end",
"def upload\n @u_logger.info {\"===NEW UPLOAD===\"}\n @u_logger.info { \"Email: \" + @email + \" Bitshares Account: \" + @bitshares_account }\n # Validations of params should have been done before this action started \n # Save uploaded file on disk to /storage/upload \n uploaded_io_full_path = save_stack_file(@uploaded_io)\n @u_logger.info {\"Stack file location: \" + uploaded_io_full_path.to_s }\n @u_logger.info {\"File size: \" + File.stat(uploaded_io_full_path).size.to_s }\n if (File.stat(uploaded_io_full_path).size > 210944)\n @u_logger.error { \"File too big (> 210944 Bytes)\" }\n redirect_to deposit_index_url, alert: \"File is too big. You should upload a file smaller than 206 KB\"\n return\n end\n \n # Get the file content\n uploaded_io_content = File.read(uploaded_io_full_path)\n\n # Send file to online depository via deposit one stack\n # and get the receipt id\n receipt_id = send_to_depository(uploaded_io_content)\n @u_logger.info { \"Receipt ID: \" + receipt_id }\n\n # Do not proceed if receipt id is blank.\n # redirect_to called in send_to_depository\n if receipt_id.blank?\n @u_logger.fatal { \"Receipt ID is blank\" }\n return \n end\n\n @u_logger.info { \"Full receipt URL: https://bank.cloudcoin.global/service/get_receipt?rn=\" + receipt_id + \"&account=***\"}\n # Get full receipt from get receipt service\n full_receipt = get_receipt_json(receipt_id)\n # Do not proceed if full_receipt is blank.\n # redirect_to called in send_to_depository\n if full_receipt.blank?\n @u_logger.fatal { \"Full Receipt is blank\" }\n return\n end\n\n # Calculate value of uploaded cloud coins\n deposit_amount = get_authentic_coins_value(full_receipt)\n @u_logger.info { \"Deposit amount: \" + deposit_amount.to_s }\n\n # Call the Issue bitshares service with the account name and amount\n if deposit_amount > 0\n did_send = send_to_bitshares(@bitshares_account, deposit_amount)\n end\n\n # Send an email to the user\n if deposit_amount > 0\n if did_send\n NotificationMailer.deposit_email(@email, @bitshares_account, deposit_amount).deliver_later\n # Remove the file from local disk\n FileUtils.remove_file(uploaded_io_full_path, force: true)\n @u_logger.info {\"Transfer to Bitshares: SUCCESS\"}\n flash[:notice] = \"Your coins will be transferred to bitshares. An email has been sent to #{@email} for your records.\"\n else\n # logger.warn {@email + \" tried to upload \" + deposit_amount.to_s + \" CloudCoin(s) to bitshares account \" + @bitshares_account}\n @u_logger.info {\"Transfer to Bitshares: FAIL\"}\n redirect_to deposit_index_url, alert: \"Transfer failed! Your CloudCoins were lost\"\n return\n end\n else\n # logger.warn \"nothing to transfer\"\n # logger.warn {@email + \" has 0 CloudCoins to upload to their bitshares account, \" + @bitshares_account + \".\"}\n @u_logger.warn { \"Nothing to transfer\" }\n flash[:alert] = \"Nothing to transfer\"\n end\n\n redirect_to controller: :deposit,\n action: :completed, \n receipt_id: receipt_id,\n email: @email,\n bitshares_account: @bitshares_account\n \n end",
"def transfer\n @purchase = Purchase.find_by(invoice_id: params[:invoice_id])\n @bank_account = BankAccount.first\n end",
"def returning_action\n if params[:id].nil?\n render 'ausleihe/returning_form' and return\n end\n\n @old_lend_out = OldLendOut.find_by_id(params[:id])\n if @old_lend_out.nil?\n flash[:warning] = \"#{Time.new}: Ordner wurde bereits zurückgenommen.\"\n redirect_to ausleihe_path and return\n end\n\n @old_lend_out.receivingTime = Time.new\n\n OldLendOut.transaction do\n # First, we update old_lend_out for validation\n # Then, we update all folder_instances so that they are not lent anymore\n @old_lend_out.update!(old_lend_out_params)\n folder_instance_archive_copies = @old_lend_out.old_folder_instances\n .map { |i| FolderInstanceArchiveCopy.new(folder_title: i.old_folder.title, barcode_id: i.barcodeId) }\n\n @old_lend_out.old_folder_instances.each do |i|\n i.old_lend_out = nil\n i.save!\n end\n\n # After updating everything in place, we archive the lend_out\n archive(@old_lend_out, folder_instance_archive_copies)\n\n flash[:notice] = \"#{Time.new}: Ordner erfolgreich zurückgenommen\"\n redirect_to ausleihe_path and return\n end\n\n end",
"def index\n @transfers = Transfer.where user: @user\n end",
"def send_to_redirect\n redirect_to @short_url.redirect\n end",
"def index\n @transfers = Transfer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transfers }\n end\n end",
"def index\n @transicion_estado_pedidos = TransicionEstadoPedido.all\n respond_to do |format|\n format.html { redirect_to :root }\n end\n end",
"def transactions\n\n @response = CompanyApi::Request::Economy.new(\n CompanyApi::Response::Formatter::Economy,\n request.cookies,\n {\"User-Agent\" => http_user_agent}\n ).fetch_transaction_kinds_details\n\n # Check if error present or not?\n unless @response.success?\n render_error_response(@response)\n return\n end\n\n @presenter_obj = ::WebPresenter::Economy::TransactionKind.new(@response, params)\n unless @presenter_obj.client_token.step_three_done?\n redirect_to :planner, status: GlobalConstant::ErrorCode.temporary_redirect\n return\n end\n\n end",
"def index\n @shop_stripe_transfers = Shop::StripeTransfer.all\n end",
"def inback\n # if current_user.admin?\n platika_id = params[:platika_id]\n phone = params[:phone]\n amount = params[:amount]\n corporation_phone = params[:corporation_phone]\n\n if !AbonentPayment.where(:platika_id => platika_id).first.nil?\n @abonent_payment = AbonentPayment.where(:platika_id => platika_id).first\n\n if @abonent_payment.created_at.to_date == Date.current\n if @abonent_payment.destroy\n result = 0\n else\n result = 3 # => Операция удаления не прошла\n pay_id = 0\n end\n else\n result = 0\n pay_id = 0\n end\n else\n result = 5 # => Платежа с таким platika_id нет в биллинге\n pay_id = 0\n end\n\n @pay = {\n :command => \"inback\",\n :date => DateTime.current,\n :platika_id => platika_id,\n :corporation_phone => corporation_phone,\n :phone => phone,\n :amount => params[:amount],\n :result => result\n }\n\n respond_to do |format|\n format.xml { render xml: @pay, status: :created, location: @abonent_payment }\n end\n # else\n # redirect_to :root\n # end\n \n end",
"def transfer\n\t\tattributes = super\n\t\tself.last_backup_date = Date.today\n\t\tset_next_backup_date\n\t\tself.save\n\t\tlog_transfer(attributes)\n\tend",
"def index\n redirect_to toil_requests_path\n end",
"def index\n redirect_to toil_requests_path\n end",
"def redirect_handler\n id = params['id']\n result = ChargeBee::HostedPage.retrieve(id)\n if result.hosted_page.state == \"succeeded\"\n redirect_to \"/ssp/subscription\"\n else \n redirect_to \"/400\"\n end\n end",
"def gringotts_redirect_to(url)\n # save url for redirecting back after we verify\n flash[:gringotts_next_url] = request.original_url\n \n # keep other flash items (e.g., success messages)\n flash.keep\n \n # last but not least ... redirect\n redirect_to url\n end",
"def perform!\n super\n transfer!\n cycle!\n end",
"def redirect\n \n if \"succeeded\" == params[\"state\"]\n # Acknowledge the update payment method hosted page id passed in return URL. \n # The response will have customer and their masked payment details.\n result = ChargeBee::HostedPage.acknowledge(params[\"id\"])\n hosted_page = result.hosted_page\n \n \n id = hosted_page.content.customer.id\n redirect_to \"/update_payment_method/profile?customer_id=#{URI.escape(id)}&updated=#{URI.escape(\"true\")}\"\n \n else\n redirect_to \"/400\"\n end\n end",
"def index\n @transfers = Transfer.all\n render json: @transfers\n end",
"def index\n redirect_to :root\n return\n @transactions = Transaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transactions }\n end\n end",
"def index; redirect_to :action => 'list'; end",
"def transfer\n @purchase = Purchase.find_by(invoice_id: params[:invoice_id])\n authorize(@purchase)\n @bank_account = BankAccount.first\n end",
"def show\n @user = User.find(session[:user_id])\n @transaction = Transaction.find(params[:id])\n if (@transaction.payer_id != session[:user_id] && @transaction.receiver_id != session[:user_id] )\n redirect_to :root\n return\n end\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @transaction }\n end\n end",
"def index\n @transfers = []\n if current_user.admin?\n @transfers = Transfer.all\n else\n @transfers = Transfer.where(from: current_accounts.collect{|x| x.acct_number}) + Transfer.where(to: current_accounts.collect{|x| x.acct_number}) \n end\n end",
"def invalid_page\n redirect_to(:back)\n end",
"def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url }\n format.json { head :no_content }\n end\n end",
"def new4\n @order = Order.find( :first,\n :conditions => [\"user_id = ? and status = ? and id = ?\", self.current_user.id, \"incomplete\", params[:id]])\n begin\n @order.step = \"step4\"\n @order.status = \"ordered\"\n \n #Set status to confirmed, call show action\n #This is basically what the orignial create would do\n respond_to do |format|\n if @order.update_attributes(params[:order])\n # Remove ordered items from the cart \n @dels = Deliverable.find( :all, :conditions => [\"order_id = ?\", @order.id])\n @cart.cart_items.each do |c|\n @dels.each do |d|\n if c.listing_id == d.listing_id\n c.destroy\n end\n end \n end \n @user = User.find(@order.user_id)\n @seller = Seller.find(@order.seller_id)\n \n #Send confirmation email to buyer\n @deliverables = Deliverable.find(:all, :conditions => [\"order_id = ?\", @order.id])\n @shop = Shop.find(:first, :conditions => [\"seller_id = ?\", @seller.id])\n @seller_user = @seller.user\n logger.info @seller_user.id.to_s\n \n SystemMailer.deliver_ordered(@user, @seller, @order, @deliverables, @shop)\n \n current_language = session[:locale]\n I18n.locale = @seller.user.userpage.preferred_language\n SystemMailer.deliver_sale(@user, @seller_user, @seller, @order, @deliverables, @shop)\n I18n.locale = current_language\n \n \n format.html { redirect_to @order}\n format.xml { render @order }\n else\n flash[:notice_bad] = t(\"controllers.orders.s14\")\n format.html { render :controller => \"carts\", :action => \"show\" }\n end\n end\n rescue\n flash[:notice_bad] = t(\"controllers.orders.s15\")\n redirect_to orders_path\n else\n end\n end",
"def index\n #redirect_to(:action => 'addtribe')\n render(\"addtribe\")\n end",
"def index\r\n @stock_transfers = StockTransfer.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @stock_transfers }\r\n end\r\n end",
"def redirect\n redirect_to @goto_url\n end",
"def create\n @transfer = new_transfer\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to transfers_path, notice: \"#{t(:transfer_transaction)} #{t(:was_successfully_created)}\" }\n # format.json { render action: 'show', status: :created, location: @transfer }\n else\n init\n format.html { render action: 'new' }\n # format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fwd\n\n url_id = params[:id]\n \n if !url_id.nil? && !url_id.empty?\n link_id = Base32::Crockford.decode(url_id)\n else\n # It will be catched by the next block now\n link_id = -1\n end\n \n begin\n link = Link.find(link_id)\n redirect_to_full_url(link.url, 301)\n rescue ActiveRecord::RecordNotFound\n redirect_to :controller => \"links\", :action => \"new\"\n end\n\n end",
"def index\n @cartridge_transfers = CartridgeTransfer.all\n end",
"def create\n @band = Band.new(params[:band])\n\n respond_to do |format|\n if @band.save\n @client = @band.client\n @nav = AdditionalInformationNav.new(@client)\n @step = @nav.nav\n\n if !params[:back_button]\n case @step\n when 'corporation'\n format.html { redirect_to new_corporation_path(:client_id=>@client, :from=>'band') }\n when 'charity'\n format.html { redirect_to new_charity_path(:client_id=>@client, :from=>'band') }\n else\n flash[:notice] = 'Band information saved'\n format.html { redirect_to @client }\n end\n format.json { render json: @band, status: :created, location: @band }\n else\n if session[:from] == 'corporation'\n @corporation = @band.client.corporation\n format.html { redirect_to edit_corporation_path(@corporation.id)}\n end\n if session[:from] == 'client'\n format.html { redirect_to @client }\n end\n end\n \n else\n format.html { render action: \"new\" }\n format.json { render json: @band.errors, status: :unprocessable_entity }\n end\n end\n end",
"def view_invoice\n invoice = BitPayInvoice.find(params[:source_id]).find_invoice\n redirect_to (invoice[\"url\"] + '&view=iframe')\n end",
"def redirect_back(format, url, message)\n format.html { redirect_to url, notice: message }\n format.json { head :no_content }\n end",
"def index\n redirect_to :action => \"edit\" and return\n end",
"def preview\n @referral = ReferralCategory.order(\"id ASC\")\n @title_page = \"More Info\"\n if order.items.select{|i| i.premium? }.blank?\n redirect_to premium_manage_orders_path\n elsif order.total.to_i < 1\n redirect_to dashboard_path\n end\n\n if current_user && order\n customer_profile = order.orderable ? order.orderable.profile : nil\n if customer_profile\n customer_profile.referal_id = current_user.code \n customer_profile.referal = current_user.referral_category.name if current_user.referral_category\n else\n redirect_to new_customer_manage_orders_path\n end\n end\n end",
"def redirect_from_hop\n if session[:pay_post_made]\n if current_user and current_user.orders.order('created_at DESC').first\n order = current_user.orders.order('created_at DESC').first\n if order.paid?\n flash[:success] = \"You successfully purchased, \" # + fill in what user purchased\n else\n flash[:fail] = \"Uh oh, your purchase was not completed. Your credit card was not charged. Your cart will retain the items you original wanted to purchase.<br><br><b>Please verify that you entered your credit card information correctly and try again.</b> If the Problem persists please contact the administrator.\".html_safe\n end\n end\n session[:pay_post_made] = nil\n end\n #redirect to index of all payments\n redirect_to payments_path\n end",
"def index \n\t\tif params[:code]\n\n\t\t\t@trackback = Trackback.first( :session_id => session[:session_id])\n\n\t\t\t# If trackback exists and matches code\n\t\t\tif @trackback && @trackback.trackback_code_name == params[:code]\n\t\t\t\tif params[:order_number] && params[:order_amount]\n\t\t\t\t\tif create_page_view && create_payable_action(Order)\n\t\t\t\t\t\trender_success(:trackback => { :action => \"ORDER\" })\n\t\t\t\t\telse\n\t\t\t\t\t\trender_error(\"Unable to create order\")\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tcreate_page_view\n\t\t\t\t\trender_success(:trackback => { :action => \"UPDATE\" })\n\t\t\t\tend\n\n\t\t\t# If it's a new trackback\n\t\t\telse\n\t\t\t\t# Find the trackback code\n\t\t\t\t@trackback_code = TrackbackCode.first( :name => params[:code] )\n\t\t\t\tif @trackback_code\n\t\t\t\t\tcreate_trackback\n\t\t\t\t\tcreate_page_view\n\t\t\t\t\trender_success(:trackback => { :action => \"NEW\" })\n\n\t\t\t\t# If no trackback code found\n\t\t\t\telse\n\t\t\t\t\trender_error(\"Affiliate code was not found\", :status => 404)\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\trender_error(\"Affiliate code not present\")\n\t\tend\n\tend",
"def view_invoice\n invoice = BitPayInvoice.find(params[:source_id]).find_invoice\n redirect_to (invoice[\"url\"] + '&view=iframe')\n end",
"def index\n @admin_advertises = Admin::Advertise.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 12)\n\n session[:urlBack] = request.original_url\n end",
"def set_transfer\n @transfer = current_user.transfers.find(params[:id])\n end",
"def show\n\n call_back\n \n if params[:path] == \"payments\" # only for payments notification\n \n Payment.create!(:params => params, :cart_id => params[:invoice], :status => params[:payment_status], :transaction_id => params[:txn_id])\n render :nothing => true\n \n elsif # find child page and redirect\n @page = Page.find(\"#{params[:path]}/#{params[:id]}\".split('/').last)\n \n if @page.try(:live?) || (refinery_user? && current_user.authorized_plugins.include?(\"refinery_pages\"))\n # if the admin wants this to be a \"placeholder\" page which goes to its first child, go to that instead.\n if @page.skip_to_first_child && (first_live_child = @page.children.order('lft ASC').live.first).present?\n redirect_to first_live_child.url and return\n elsif @page.link_url.present?\n redirect_to @page.link_url and return\n end\n else\n error_404\n end\n end\n \n end",
"def redirect_back\n send_to = session[:return_to]\n session[:return_to] = nil\n redirect_to(send_to || root_path)\n end",
"def transaction\n add_breadcrumb \"Merchants\", epsadmin_merchants_path\n add_breadcrumb \"#{@transc_merchant.first_name}\", epsadmin_merchant_path(@transc_merchant.merchant_uniq_id)\n @epsadmin_transaction_list = @transc_merchant.transactions.order(\"created_at DESC\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @epsadmin_transaction_list }\n end\n end",
"def redirect?; end"
] | [
"0.64794594",
"0.63546926",
"0.617864",
"0.6164741",
"0.61556786",
"0.61556786",
"0.61556786",
"0.6128049",
"0.6128049",
"0.6085847",
"0.6017177",
"0.6017177",
"0.6017177",
"0.6017177",
"0.59669363",
"0.5957006",
"0.5954926",
"0.5943125",
"0.59204555",
"0.5885888",
"0.5879737",
"0.5866204",
"0.5852172",
"0.58249104",
"0.5822016",
"0.5796707",
"0.57964",
"0.57715577",
"0.5754808",
"0.5752545",
"0.5735036",
"0.57222444",
"0.57149065",
"0.5702432",
"0.56951153",
"0.5667262",
"0.56639117",
"0.5630432",
"0.5624189",
"0.562243",
"0.562028",
"0.5619846",
"0.5617465",
"0.5614003",
"0.56115204",
"0.56069124",
"0.5606358",
"0.56056714",
"0.56053114",
"0.56021094",
"0.5597654",
"0.55973345",
"0.5588239",
"0.5580259",
"0.5578074",
"0.5576994",
"0.55753374",
"0.5573233",
"0.5562293",
"0.5555638",
"0.55421305",
"0.5541774",
"0.5538637",
"0.55347836",
"0.5533157",
"0.55310065",
"0.55310065",
"0.5529611",
"0.552696",
"0.55256855",
"0.5515003",
"0.55143464",
"0.55137336",
"0.5509703",
"0.5508704",
"0.5507836",
"0.5506434",
"0.55024964",
"0.55002004",
"0.54994375",
"0.54984826",
"0.5494097",
"0.5489564",
"0.54871875",
"0.5473398",
"0.5470209",
"0.5469537",
"0.5467598",
"0.54626876",
"0.5459863",
"0.545871",
"0.54400903",
"0.5430051",
"0.542827",
"0.54273254",
"0.5420057",
"0.54178274",
"0.5417277",
"0.5412796",
"0.5412257"
] | 0.55651855 | 58 |
GET /urls GET /urls.json | def index
@urls = Url.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @urls = Url.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @urls }\n end\n end",
"def index\n @urls = @site.urls.paginate(:page => params[:page])\n render json: @urls\n end",
"def url_list\n urls = current_user.mini_urls\n if urls.count > 0\n render json: {urls: urls}, status: 200\n else\n raise Exceptions::EmptyObjectError.new('No URL found.')\n end\n rescue Exceptions::EmptyObjectError => e\n render json: {error: e}, status: 404\n end",
"def index\n @urls = ShortenedUrl.order(\"updated_at ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @urls }\n end\n end",
"def get_urls( search_url )\n urls = []\n result_json = parse_json( search_url )\n result_json['items'].each do |item|\n urls << item['url']\n end\n\n return urls\nend",
"def all\n render json: Url.all\n end",
"def index\n @urls = Url.get_top(25)\n # render json: @urls\n end",
"def get(url); end",
"def fetch_json_from_url(url_of_search)\n Net::HTTP.get(URI.parse(url_of_search))\n end",
"def show\n render json: @url\n end",
"def show\n\t\trender json: @url, status: 200\n\tend",
"def rest_get(url)\n JSON.parse(RestClient.get(url))\n end",
"def json_get(url)\n get url, :parse=>true\n end",
"def index\n @urls = Url.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @urls}\n format.json { render json: @urls }\n end\n end",
"def links\n response = Clever.request :get, url\n response[:links]\n end",
"def show\n @url = Url.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @url }\n end\n end",
"def get_tags_by_url\n url = Url.find_by(id: params[:id])\n tags = url.tags\n render json: {code: 200, tags: tags}\n end",
"def index\n render json: {\n status: :success,\n urls: ShortUrl::top_100\n }\n end",
"def urls\n @urls ||= extract_urls('url')\n end",
"def getUrl(url)\n puts url if @options[\"show-url\"]\n RestClient.get(url)\n end",
"def index\n render json: @links\n end",
"def index\n @crawl_requests = CrawlRequest.includes(:urls)\n\n render json: @crawl_requests, :include => :urls\n end",
"def index\n @content_urls = ContentUrl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_urls }\n end\n end",
"def index\n @url_connectors = UrlConnector.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @url_connectors }\n end\n end",
"def get_json( url )\n JSON.parse( get_url( url ){ |f| f.read } )\nend",
"def getJson(url)\n\t\tencoded_url = URI.encode(\"https://cryptic-mountain-56365.herokuapp.com/api/v1\"+url)\n\t\turi = URI.parse(encoded_url)\n\t\tjson = Net::HTTP.get(uri)\n\tend",
"def show\n\t\t@url = UrlGenerator.find_by(encoded_url:params[:id])\n\t\tif @url.nil?\n\t\t\trender json:{error:\"not found\"}\n\t\telse\n\t\t\trender json:{orginal_url:@url.url}\n\t\tend\n\tend",
"def paths\n\t\tresponse = self.server.run_with_json_template( :paths )\n\t\treturn response.each_with_object({}) do |entry, hash|\n\t\t\thash[ entry[:name].to_sym ] = URI( entry[:url] )\n\t\tend\n\tend",
"def json_at(url)\n JSON.parse(open(url).read, symbolize_names: true)[:objects]\nend",
"def readJSONFromUrl(url)\n # use GET request to retrieve the json\n uri = URI(url)\n response = Net::HTTP.get(uri)\n json = JSON.parse(response)\n return json\nend",
"def showJSON\n\n\t\trender json: UrlDataModel.find(params[:id])\n\n\tend",
"def api_fetch(url)\n JSON.parse(RestClient.get url)\nend",
"def get_json_url(url) \n useragent = \"NotubeMiniCrawler/0.1\"\n u = URI.parse url\n\n req = Net::HTTP::Get.new(u.request_uri,{'User-Agent' => useragent})\n\n begin\n\n res = Net::HTTP.new(u.host, u.port).start {|http|http.request(req) }\n\n end\n j = nil\n begin\n j = JSON.parse(res.body)\n rescue OpenURI::HTTPError=>e\n case e.to_s\n when /^404/\n raise 'Not Found'\n when /^304/\n raise 'No Info'\n end\n end\n return j\n end",
"def get_json(url, args = {})\n response = adapter.get(url, args) do |req|\n req.headers['Content-Type'] = 'application/json'\n req.headers['Accept'] = 'application/json'\n end\n body = response.body\n JSON.parse(body)\n end",
"def index\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { @url_shorts = UrlShort.all }\n end\n end",
"def index\n links = all_links\n render json: { success: true, links: links }\n end",
"def handle_links(json) end",
"def get_json(url)\n r = RestClient.get url, request_options\n JSON.parse(r)\n end",
"def get_inf(url)\n\turi = URI.parse(url)\n\tresponse = Net::HTTP.get_response(uri)\n\tJSON.parse(response.body)\nend",
"def get_vacancies( urls )\n vacancies = []\n urls.each do |url|\n vacancies << parse_json( url )\n end\n\n return vacancies\nend",
"def get(url)\n call(url: url)\n end",
"def urls\n keys\n end",
"def url_hash(url)\n response_string = RestClient.get(url)\n JSON.parse(response_string)\nend",
"def get(url, headers = {})\n http :get, \"#{url}.json\", headers\n end",
"def getJson(url)\r\n request_uri = url\r\n request_query = ''\r\n url = \"#{request_uri}#{request_query}\"\r\n result = getJsonFromUrl(url)\r\n return result\r\nend",
"def realtime\n render :json=>WebUrl.all.map(&:url).to_json\n end",
"def show\n @crawl_request = CrawlRequest.includes(:urls).find(params[:id])\n\n render json: @crawl_request, :include => :urls\n end",
"def get_json(url)\n JSON.parse(get(url, :json, :json))\n end",
"def index\n @urls = Url.all\n\n \n\n end",
"def api_fetch(url)\n JSON.parse(URI.open(url).read)\nend",
"def list\n get('/')\n end",
"def url\n response[\"url\"]\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def get(urls)\n if urls.nil? or urls.empty? then\n return {}\n end\n\n urls = [urls] if not urls.kind_of? Array\n urls.each_with_index do |url, i|\n @reqs[i] = url.to_s\n end\n\n results = perform()\n\n ret = []\n (0..results.size-1).each do |i|\n ret << results[i]\n end\n\n return ret\n end",
"def get url, params={}, headers={}\n uri = URI.parse(url)\n path = uri.path + \"?\" + query_string(default_params.merge(params))\n response = http(uri.host, uri.port).get(path, default_headers.merge(headers))\n JSON.parse(response.body)\n end",
"def top_urls\n if valid_params?(top_urls_params)\n render json: PageView.top_urls(top_urls_params),\n each_serializer: PageView::TopUrlsSerializer\n else\n render json: { message: invalid_params_message }\n end\n end",
"def index\n @url = Url.all\n end",
"def get_json(url)\n @response = RestClient.get url\n while @response.nil? do\n if @response.code == 200\n @response = RestClient.get url\n end\n end\n @json_file = JSON.parse(@response)\n end",
"def json_url\n \"#{REDDIT_URL_PREFIX}#{permalink}.json\"\n end",
"def index\n if user_signed_in?\n @urls = current_user.urls\n else\n @urls = Url.all\n end\n end",
"def urls\n each_url.to_set\n end",
"def get(url)\n faraday = Faraday.new(url) do |faraday|\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n\n response = faraday.get do |request|\n request.url(url)\n end\n response.body\nend",
"def urls\n @@urls\n end",
"def call\n fail(WordpRSS::InvalidURLError.new(\"#{url} is not a valid URL\")) unless url =~ URI::regexp\n\n RestClient.get(url)\n end",
"def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend",
"def get(url)\n request(:get, url, {}, nil)\n end",
"def get_json(url, options = {}) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize\n conn = Faraday.new(url: url) do |faraday|\n faraday.request :url_encoded\n faraday.use FaradayMiddleware::FollowRedirects\n if defined?(Rails) # && Rails.env.development?\n faraday.response :logger, Rails.logger\n else\n faraday.response :logger\n end\n\n faraday.adapter :net_http\n end\n\n begin\n r = conn.get do |req|\n req.headers['Accept'] = 'application/json'\n req.params.merge! options\n end\n\n raise \"Failed to read from #{url}: #{r.status.inspect}\" unless (200..207).cover?(r.status)\n JSON.parse(r.body)\n end\n end",
"def index\n @page = Page.find(params[:page_id])\n @urls = Url.where(page_id: params[:page_id])\n end",
"def url\n data['url']\n end",
"def urls\n info.map(&:value).select { |u| u.match %r{\\Ahttps?://} }\n end",
"def get(url)\n self.class.get(url)\n end",
"def json(url)\n Rails.logger.info \"Retrieving json for url: #{url}\"\n r = response(url).body\n JSON.parse(r)\n end",
"def get(url, args = {})\r\n make_request(:get, url, args)\r\n end",
"def list\n @urls = Url.all\n @admin = ADMIN\n end",
"def look_up(url)\n all = RestClient.get(url)\n hash = JSON.parse(all)\nend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend",
"def index\n @urls = current_user.urls\n end",
"def get_url(url)\n myurl = URI.parse(url)\n req = Net::HTTP::Get.new(url)\n res = Net::HTTP.start(myurl.host, myurl.port) { |http|\n http.request(req)\n }\n \n res.body # return\n end",
"def index\n @known_urls = KnownUrl.all\n end",
"def apartments_urls(url)\n JSON(Net::HTTP.get(URI(url)))['apartments'].map { |value| value['url'] }\n #Net::HTTP.get(URI(url)).scan(/https\\:\\\\\\/\\\\\\/r\\S{10,}.s\\\\\\/\\d{4,7}/).map { |val| val.gsub(\"\\\\\", \"\") }\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def index\n @articles = Article.all.sort_by(&:url)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articles }\n end\n end",
"def show\n @url_connector = UrlConnector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @url_connector }\n end\n end",
"def get(url)\n begin\n # Start by creating a new `RestCLient::Resource` authenticated with\n # the `@project` name and `@password`.\n resource = RestClient::Resource.new(url) \n # `GET` the resource\n resource.get {|response, request, result, &block|\n case response.code\n when 200\n JSON.parse(response.body)\n else\n response.return!(request, result, &block)\n end\n }\n rescue => e\n # Rescue and reraise with the current `@url` for debugging purposes \n raise \"Problem fetching #{@url} because #{e.message}\"\n end\n end",
"def get\n JSON.parse(self.class.get(url).response.body)\n end",
"def find_by_url\n @postings = SlashdotPosting.includes(:urls).where(urls: { target_url: params[:url] })\n render json: @postings\n end",
"def get(url, opts = {})\n response = RestClient::Request.new(\n method: :get,\n url: \"#{ENDPOINT_URL}/#{url}\",\n verify_ssl: false,\n headers: {\n 'Content-Type' => 'application/json',\n 'Authorization' => \"Basic #{authorization_hash}\",\n 'client-id' => client_id,\n 'access-token' => access_token\n },\n payload: opts\n ).execute\n\n JSON.parse(response)\n end",
"def get(url)\n raise \"Needs to be implemented\"\n end",
"def request(args = {})\n response = @client.get(args[:url],\n argument_hash(args[:args] || {},\n args[:symbols] || []))\n JSON.parse(response.body)\n end",
"def index\n @url = Url.new\n @urls = Url.recent.page(params[:page]).per(25)\n end",
"def download\n URI.extract(json, ['http', 'https']).each do |url|\n get_asset(url)\n end\n\n json\n end",
"def index\n @links = Link.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @links }\n end\n end",
"def show\n @url = ShortenedUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @url }\n end\n end",
"def index\n @urlitems = Urlitem.all\n end",
"def show url\n function = ''\n \n params = {}\n params[:url] = url\n\n request(@resource, function, params)\n end",
"def get(path, redirect_limit=5)\n parse_json do |parser|\n @http_client.get(path, redirect_limit) {|chunk| parser << chunk }\n end\n end",
"def list_endpoints\n render json: @endpoints, status: 200\n end",
"def index\n render_or_error do\n short_codes = ShortUrl.order(click_count: :desc).limit(100).map(&:short_code)\n\n { urls: short_codes }\n end\n end"
] | [
"0.72622925",
"0.70533806",
"0.6914229",
"0.6791078",
"0.6790144",
"0.6723092",
"0.6704383",
"0.66312903",
"0.6551795",
"0.65379965",
"0.6494516",
"0.64851487",
"0.64801353",
"0.6451444",
"0.6408628",
"0.64008194",
"0.63861555",
"0.6346339",
"0.63178754",
"0.6289575",
"0.62870747",
"0.6269454",
"0.624835",
"0.62224174",
"0.61876386",
"0.61689794",
"0.6139019",
"0.6136582",
"0.6130184",
"0.61192536",
"0.6114477",
"0.6098115",
"0.60712236",
"0.60611355",
"0.6054894",
"0.6045222",
"0.6042121",
"0.6034976",
"0.6026163",
"0.60237175",
"0.60154104",
"0.6012193",
"0.59972787",
"0.59907985",
"0.5986189",
"0.59691",
"0.5958032",
"0.5937952",
"0.5936416",
"0.5927531",
"0.5921276",
"0.59194744",
"0.59157467",
"0.5909652",
"0.59058666",
"0.59052616",
"0.5893767",
"0.5886441",
"0.5857888",
"0.58554924",
"0.5848307",
"0.5829891",
"0.58104146",
"0.57999396",
"0.57946426",
"0.5789986",
"0.57876813",
"0.5776188",
"0.5773135",
"0.5771604",
"0.5759876",
"0.57595456",
"0.5751382",
"0.5745563",
"0.57396066",
"0.5737798",
"0.5735142",
"0.5731214",
"0.57272774",
"0.5727066",
"0.572603",
"0.572603",
"0.57174474",
"0.57116973",
"0.5709903",
"0.5704603",
"0.5699436",
"0.5697474",
"0.56947863",
"0.56894547",
"0.5686916",
"0.5679499",
"0.5676516",
"0.56645495",
"0.5660534",
"0.5655401",
"0.5647516",
"0.5642777",
"0.56402856"
] | 0.62464184 | 24 |
GET /urls/1 GET /urls/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @urls = Url.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @urls }\n end\n end",
"def index\n @urls = ShortenedUrl.order(\"updated_at ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @urls }\n end\n end",
"def show\n @url = Url.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @url }\n end\n end",
"def get(url); end",
"def index\n @urls = Url.get_top(25)\n # render json: @urls\n end",
"def show\n\t\trender json: @url, status: 200\n\tend",
"def show\n render json: @url\n end",
"def json_get(url)\n get url, :parse=>true\n end",
"def url_list\n urls = current_user.mini_urls\n if urls.count > 0\n render json: {urls: urls}, status: 200\n else\n raise Exceptions::EmptyObjectError.new('No URL found.')\n end\n rescue Exceptions::EmptyObjectError => e\n render json: {error: e}, status: 404\n end",
"def show\n\t\t@url = UrlGenerator.find_by(encoded_url:params[:id])\n\t\tif @url.nil?\n\t\t\trender json:{error:\"not found\"}\n\t\telse\n\t\t\trender json:{orginal_url:@url.url}\n\t\tend\n\tend",
"def index\n @urls = @site.urls.paginate(:page => params[:page])\n render json: @urls\n end",
"def json_at(url)\n JSON.parse(open(url).read, symbolize_names: true)[:objects]\nend",
"def getUrl(url)\n puts url if @options[\"show-url\"]\n RestClient.get(url)\n end",
"def index\n render json: {\n status: :success,\n urls: ShortUrl::top_100\n }\n end",
"def rest_get(url)\n JSON.parse(RestClient.get(url))\n end",
"def all\n render json: Url.all\n end",
"def fetch_json_from_url(url_of_search)\n Net::HTTP.get(URI.parse(url_of_search))\n end",
"def get(url)\n call(url: url)\n end",
"def get_json( url )\n JSON.parse( get_url( url ){ |f| f.read } )\nend",
"def api_fetch(url)\n JSON.parse(RestClient.get url)\nend",
"def showJSON\n\n\t\trender json: UrlDataModel.find(params[:id])\n\n\tend",
"def index\n @urls = Url.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @urls}\n format.json { render json: @urls }\n end\n end",
"def show\n @url = ShortenedUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @url }\n end\n end",
"def show\n @sampled_url = SampledUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sampled_url }\n end\n end",
"def getJson(url)\r\n request_uri = url\r\n request_query = ''\r\n url = \"#{request_uri}#{request_query}\"\r\n result = getJsonFromUrl(url)\r\n return result\r\nend",
"def api_fetch(url)\n JSON.parse(URI.open(url).read)\nend",
"def readJSONFromUrl(url)\n # use GET request to retrieve the json\n uri = URI(url)\n response = Net::HTTP.get(uri)\n json = JSON.parse(response)\n return json\nend",
"def get_json(url)\n @response = RestClient.get url\n while @response.nil? do\n if @response.code == 200\n @response = RestClient.get url\n end\n end\n @json_file = JSON.parse(@response)\n end",
"def get_json_url(url) \n useragent = \"NotubeMiniCrawler/0.1\"\n u = URI.parse url\n\n req = Net::HTTP::Get.new(u.request_uri,{'User-Agent' => useragent})\n\n begin\n\n res = Net::HTTP.new(u.host, u.port).start {|http|http.request(req) }\n\n end\n j = nil\n begin\n j = JSON.parse(res.body)\n rescue OpenURI::HTTPError=>e\n case e.to_s\n when /^404/\n raise 'Not Found'\n when /^304/\n raise 'No Info'\n end\n end\n return j\n end",
"def url_hash(url)\n response_string = RestClient.get(url)\n JSON.parse(response_string)\nend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend",
"def get_urls( search_url )\n urls = []\n result_json = parse_json( search_url )\n result_json['items'].each do |item|\n urls << item['url']\n end\n\n return urls\nend",
"def index\n render json: @links\n end",
"def getJson(url)\n\t\tencoded_url = URI.encode(\"https://cryptic-mountain-56365.herokuapp.com/api/v1\"+url)\n\t\turi = URI.parse(encoded_url)\n\t\tjson = Net::HTTP.get(uri)\n\tend",
"def show\n @crawl_request = CrawlRequest.includes(:urls).find(params[:id])\n\n render json: @crawl_request, :include => :urls\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def index\n @urls = Url.all\n end",
"def index\n @urls = Url.all\n end",
"def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend",
"def get(url, headers = {})\n http :get, \"#{url}.json\", headers\n end",
"def get_json(url, args = {})\n response = adapter.get(url, args) do |req|\n req.headers['Content-Type'] = 'application/json'\n req.headers['Accept'] = 'application/json'\n end\n body = response.body\n JSON.parse(body)\n end",
"def get_tags_by_url\n url = Url.find_by(id: params[:id])\n tags = url.tags\n render json: {code: 200, tags: tags}\n end",
"def index\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { @url_shorts = UrlShort.all }\n end\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def get_inf(url)\n\turi = URI.parse(url)\n\tresponse = Net::HTTP.get_response(uri)\n\tJSON.parse(response.body)\nend",
"def show\n @url_connector = UrlConnector.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @url_connector }\n end\n end",
"def get(url)\n self.class.get(url)\n end",
"def url\n response[\"url\"]\n end",
"def get(url)\n request(:get, url, {}, nil)\n end",
"def index\n @url_connectors = UrlConnector.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @url_connectors }\n end\n end",
"def index\n @crawl_requests = CrawlRequest.includes(:urls)\n\n render json: @crawl_requests, :include => :urls\n end",
"def get_url(url)\n myurl = URI.parse(url)\n req = Net::HTTP::Get.new(url)\n res = Net::HTTP.start(myurl.host, myurl.port) { |http|\n http.request(req)\n }\n \n res.body # return\n end",
"def json_url\n \"#{REDDIT_URL_PREFIX}#{permalink}.json\"\n end",
"def realtime\n render :json=>WebUrl.all.map(&:url).to_json\n end",
"def get(url)\n raise \"Needs to be implemented\"\n end",
"def get_json(url)\n r = RestClient.get url, request_options\n JSON.parse(r)\n end",
"def index\n @content_urls = ContentUrl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @content_urls }\n end\n end",
"def handle_links(json) end",
"def api_get url_suffix\n url = URI::encode \"#{@@oauth_info[:api_url]}/gems/#{url_suffix}\"\n data = {:client_id => @@oauth_info[:client_id]}\n headers = {:Authorization => \"Bearer #{@access_token}\"}\n\n conn = get_conn url\n #Try request 3 times\n for i in 1..3\n res = conn.get(url, data, headers)\n if res.status == 200 then return JSON.parse(res.body) end\n sleep 1\n end\n raise OAuthSessionError, \"GET Failed. Status: #{res.status}. Body: #{res.body}\"\n end",
"def get url\n url = URI url\n request = HTTP::Get.new url.path\n\n dispatch request, to: url\n end",
"def show url\n function = ''\n \n params = {}\n params[:url] = url\n\n request(@resource, function, params)\n end",
"def look_up(url)\n all = RestClient.get(url)\n hash = JSON.parse(all)\nend",
"def get_json(url)\n JSON.parse(get(url, :json, :json))\n end",
"def show\n @base_url = BaseUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @base_url }\n end\n end",
"def get(url)\n faraday = Faraday.new(url) do |faraday|\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n\n response = faraday.get do |request|\n request.url(url)\n end\n response.body\nend",
"def call\n fail(WordpRSS::InvalidURLError.new(\"#{url} is not a valid URL\")) unless url =~ URI::regexp\n\n RestClient.get(url)\n end",
"def get(url)\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n\n response = http.get(\"#{uri.path}?auto\")\n\n unless response.code == \"200\"\n puts \"Failed to retrieve #{url}: #{response.code}\"\n exit 3\n end\n\n response.body\nend",
"def index\n @url = Url.all\n end",
"def json_url\n # \"#{REDDIT_URL_PREFIX}#{permalink}#{@self_id}.json\"\n end",
"def get url, params={}, headers={}\n uri = URI.parse(url)\n path = uri.path + \"?\" + query_string(default_params.merge(params))\n response = http(uri.host, uri.port).get(path, default_headers.merge(headers))\n JSON.parse(response.body)\n end",
"def get(url)\n begin\n # Start by creating a new `RestCLient::Resource` authenticated with\n # the `@project` name and `@password`.\n resource = RestClient::Resource.new(url) \n # `GET` the resource\n resource.get {|response, request, result, &block|\n case response.code\n when 200\n JSON.parse(response.body)\n else\n response.return!(request, result, &block)\n end\n }\n rescue => e\n # Rescue and reraise with the current `@url` for debugging purposes \n raise \"Problem fetching #{@url} because #{e.message}\"\n end\n end",
"def swapi_fetch(url)\n JSON.parse(open(url).read)\nend",
"def get(url, args = {})\r\n make_request(:get, url, args)\r\n end",
"def index\n @urls = Url.all\n\n \n\n end",
"def get(url)\n uri = URI(url)\n Net::HTTP.get(uri)\nend",
"def url\n data['url']\n end",
"def call_poke_url(url)\n JSON.parse(\n HTTP\n .get(URI(url))\n )\nend",
"def show\n @url = Url.find(params[:id])\n \n respond_to do |format|\n format.html\n end\n end",
"def get(url, options={})\n resp = RestClient.get url, rest_client_options(options)\n Representation.new self, MultiJson.load(resp)\n end",
"def do_get url\n\t\turi = URI.parse(url)\n\t\tNet::HTTP.get_response(uri)\n\tend",
"def json(url)\n Rails.logger.info \"Retrieving json for url: #{url}\"\n r = response(url).body\n JSON.parse(r)\n end",
"def index\n links = all_links\n render json: { success: true, links: links }\n end",
"def show\n @content_url = ContentUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @content_url }\n end\n end",
"def get_url\n heroku_app = options[:heroku_app]\n uriString = \"https://api.heroku.com/apps/#{heroku_app}/releases\"\n accept = '\"Accept: application/vnd.heroku+json; version=3\"'\n order = '\"Range: version ..; order=desc, max=10;\"'\n uri = URI(uriString)\n puts \"URI: #{uri}\"\n\n res = `curl -n --silent #{uriString} -H #{accept} -H #{order}`\n\n result = JSON.parse(res)\n\n id = nil\n ver = nil\n hash = nil\n result.each { |i|\n puts i\n if !id && i[\"slug\"] && i[\"slug\"][\"id\"] && i[\"slug\"][\"id\"] != \"\"\n id = i[\"slug\"][\"id\"]\n ver = i[\"version\"]\n hash = i[\"description\"]\n end\n }\n\n #puts id if id\n if id != nil\n\n uriStringSlug = \"https://api.heroku.com/apps/#{heroku_app}/slugs/#{id}\"\n uriSlug = URI(uriStringSlug)\n\n resSlug = `curl -n --silent #{uriStringSlug} -H #{accept}`\n resultSlug = JSON.parse(resSlug)\n p \"--------------------------------\"\n p \"Version: #{ver}\"\n p \"Hash: #{hash}\"\n p resultSlug[\"blob\"][\"url\"]\n p \"--------------------------------\"\n end\n end",
"def show\n respond_to do |format|\n format.json { render json: @uri, status: 200 }\n end\n end",
"def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end",
"def get(url, opts = {})\n response = RestClient::Request.new(\n method: :get,\n url: \"#{ENDPOINT_URL}/#{url}\",\n verify_ssl: false,\n headers: {\n 'Content-Type' => 'application/json',\n 'Authorization' => \"Basic #{authorization_hash}\",\n 'client-id' => client_id,\n 'access-token' => access_token\n },\n payload: opts\n ).execute\n\n JSON.parse(response)\n end",
"def [](url)\n rget key_for url\n end",
"def [](url)\n rget key_for url\n end",
"def url\n \"/#{self.class.rest_name}s/#{id}\"\n end",
"def new\n @page_title = 'New URL'\n @url = ShortenUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end",
"def http( *args )\n p http_get( *args )\n end",
"def shorten_link(url)\n uri = URI.parse(\"http://localhost:3000/shorten\")\n params = {\"url\": url}\n uri.query = URI.encode_www_form(params)\n JSON.parse(Net::HTTP.get(uri))\nend",
"def get(path, redirect_limit=5)\n parse_json do |parser|\n @http_client.get(path, redirect_limit) {|chunk| parser << chunk }\n end\n end",
"def new\n @url = ShortenedUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @url }\n end\n end",
"def request(args = {})\n response = @client.get(args[:url],\n argument_hash(args[:args] || {},\n args[:symbols] || []))\n JSON.parse(response.body)\n end",
"def load_from_url!(url)\n uri = URI(url)\n req = Net::HTTP::Get.new(uri)\n req['Accept'] = 'application/json'\n\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request(req)\n end\n\n # TODO: handle redirects\n raise IOError, \"Unable to load URL #{url}\" unless res.is_a?(Net::HTTPOK)\n\n load_from_json!(res.body)\n end",
"def get_json(uri)\n start = Time.now\n attempt = 0\n begin\n res = @http.get(\n uri,\n 'Accept' => 'text/plain',\n 'User-Agent' => user_agent,\n 'Accept-Encoding' => ''\n )\n raise Error, \"Failed to retrieve #{uri} (#{res.code}): #{res.body}\" unless res.code == '200'\n info(\"GET #{uri}: #{res.code}/#{res.body.length}b in #{age(start)}\")\n JSON.parse(res.body)\n rescue StandardError => e\n attempt += 1\n raise e if attempt >= @attempts\n retry\n end\n end",
"def show\n json = self.as_json(only: [:created_at, :version])\n json['url'] = doi_url\n json\n end",
"def index\n @url = Url.new\n end"
] | [
"0.6885968",
"0.66887754",
"0.66787374",
"0.66593164",
"0.6529249",
"0.6509962",
"0.64914274",
"0.6448754",
"0.64453053",
"0.6409037",
"0.64083",
"0.6267918",
"0.6236266",
"0.6223829",
"0.6216287",
"0.62162524",
"0.620276",
"0.6169882",
"0.6138518",
"0.6119957",
"0.61180186",
"0.6108202",
"0.61003846",
"0.60605735",
"0.60550773",
"0.60468984",
"0.6046129",
"0.60417986",
"0.60299844",
"0.60294175",
"0.6014244",
"0.60016876",
"0.5995629",
"0.5992139",
"0.5985687",
"0.5968342",
"0.5968342",
"0.5954984",
"0.5954984",
"0.59509933",
"0.59451306",
"0.5941038",
"0.59368545",
"0.593176",
"0.59266025",
"0.5914046",
"0.5906366",
"0.5902448",
"0.59023285",
"0.5901168",
"0.58992666",
"0.5893455",
"0.58678144",
"0.5833601",
"0.5820917",
"0.58192194",
"0.58189905",
"0.5810175",
"0.58061785",
"0.5801068",
"0.57873946",
"0.578485",
"0.5782201",
"0.5777008",
"0.5762652",
"0.5752454",
"0.57425886",
"0.57424617",
"0.573629",
"0.5732209",
"0.5729212",
"0.57290244",
"0.57191604",
"0.57189447",
"0.571705",
"0.5697322",
"0.56949914",
"0.5687519",
"0.56830966",
"0.5678516",
"0.5667808",
"0.5666167",
"0.5661877",
"0.5658962",
"0.5647116",
"0.56451553",
"0.56437135",
"0.56405675",
"0.56367886",
"0.56367886",
"0.5606693",
"0.5605289",
"0.56031066",
"0.56021976",
"0.5592379",
"0.5589913",
"0.55875146",
"0.5580259",
"0.55762273",
"0.5562687",
"0.5551767"
] | 0.0 | -1 |
POST /urls POST /urls.json | def create
@url = Url.new(url_params)
respond_to do |format|
if @url.save
format.html { redirect_to @url, notice: 'Url was successfully created.' }
format.json { render action: 'show', status: :created, location: @url }
wordcount
else
format.html { render action: 'new' }
format.json { render json: @url.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n params[:url_list].each do |url|\n WebUrl.new(:url => url).save\n end\n render :json=>params[:url_list].to_json\n end",
"def create_api\n\n @url = Url.new(:url => params[:url])\n\n if @url.save\n url_hash = Hash.new\n\n url_hash[:short_url] = root_url.to_s() + \"urls_api/\" + (@url.id).to_s(36)\n url_hash[:url] = @url.url\n\n render :json => url_hash.to_json\n end\n\n end",
"def create\n @url = current_user.urls.new(params[:url])\n\n respond_to do |format|\n if @url.save\n format.html { redirect_to urls_path, notice: 'Url was successfully created.' }\n format.json { render json: @url, status: :created, location: @url }\n else\n format.html { render action: \"new\" }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @url = Url.new(url_params.merge({user: current_user}))\n\n if @url.save\n render_jsonapi_response(@url)\n else\n render json: {errors: @url.errors}, status: :unprocessable_entity\n end\n end",
"def create url\n function = ''\n \n post_data = {}\n post_data[:url] = url\n\n request(@resource, function, nil, 'post', post_data)\n end",
"def create\n\n @url = Url.new(url_params)\n @url.user = current_user\n @url.unique_key = @url.generate_unique_key\n\n #save data\n if @url.save\n response = {:status => 'success',\n :mgs => short_url(@url.unique_key)}\n else\n response = {:status => 'fail',\n :mgs => 'Not a valid URL.'}\n end\n\n #send response\n respond_to do |format|\n format.json { render json: response }\n end\n end",
"def create_batch urls\n function = 'batch/'\n\n post_data = {}\n post_data[:urls] = urls.join(',')\n\n request(@resource, function, nil, 'post', post_data)\n end",
"def create\n \t@url = Url.build(params[:link],request.base_url) \t\n \trender json: @url.to_json\n end",
"def create\n @url = Url.new(url_params)\n respond_to do |format|\n if @url.save\n #format.html { redirect_to @url, notice: 'Url was successfully created.' }\n FetchUrlWorker.perform_async(@url.id)\n format.json { render json: {\n short_url: \"#{request.protocol}#{request.host_with_port}/#{@url.short_url}\",\n status: :created,\n location: @url }\n }\n else\n # format.html { render :new }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(url, args = {})\r\n make_request(:post, url, args)\r\n end",
"def create\n \turl = Url.create(params[:url])\n \t\n \tredirect_to urls_path\n end",
"def create\n @url = Url.new(url_params)\n\n\n respond_to do |format|\n if @url.save\n format.html { redirect_to @url, notice: 'Url was successfully created.' }\n format.json { render :show, status: :created, location: @url }\n else\n format.html { render :new }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend",
"def create\n @crawl_request = CrawlRequest.new(crawl_request_params)\n\n if @crawl_request.save\n render json: @crawl_request, status: :created, location: @crawl_request, :include => :urls\n else\n render json: @crawl_request.errors, status: :unprocessable_entity\n end\n end",
"def create\n puts '---------------'\n puts params\n puts '---------------'\n # We made users, and urls need a user_id\n # so for demo we are going to generature the URL for\n # our First user in our database....\n url = User.first.urls.new(url_params)\n url.save\n redirect_to '/urls'\n end",
"def post_json(url, data)\n JSON.parse(post(url, data, :json, :json))\n end",
"def create\n @url = Url.new(url_params)\n\n Url.transaction do\n @url.save\n #write base 62 method\n @url.short_url = generate_base62_short_url(@url.id)\n if @url.save\n render json: @url, status: :created, root: :url\n else\n render json: @url.errors, status: :unprocessable_entity\n end\n end\n end",
"def post(path, **args); end",
"def create\n @url = request.format.json? ? Url.new(original_link: params[:original_link]) : Url.new(url_params)\n\n respond_to do |format|\n if @url.save\n format.html { redirect_to @url, notice: 'URL was successfully created.' }\n format.json { render :show, status: :created, location: @url }\n else\n format.html { render :new }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(url, payload = {}, headers = {})\n http :post, \"#{url}.json\", payload.to_json, headers\n end",
"def create\n url = ShortenedUrl.find_by_long_url(shortened_urls_params[:long_url])\n \n if url\n render json: {shortUrl: url[:short_url]}\n else\n shortened_url = ShortenedUrl.new(shortened_urls_params)\n \n if shortened_url.save\n short_url = shortened_url.generate_short_url\n shortened_url.update_attribute(\"short_url\", short_url)\n \n render json: { shortUrl: shortened_url[:short_url], success: true }\n else\n render json: { error: true }\n end\n end\n end",
"def create\n response = @page.parse_url\n render json: response\n end",
"def create\n @url = ShortenedUrl.new(surl_params)\n\n respond_to do |format|\n if @url.save\n format.html { redirect_to @url, :notice => 'Shortened url was successfully created.' }\n format.json { render :json => @url, :status => :created, :location => @url }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @url.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def http_post(url, data)\n\turi = URI(url)\n\treq = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json'})\n req.body = data.to_json\n response = Net::HTTP.new(uri.host, uri.port).start {|http| http.request(req) }\n return response\nend",
"def post(url, post_vars={})\n send_request url, post_vars, 'POST'\n end",
"def post_request(url,args)\n uri = URI.parse(url)\n req = Net::HTTP::Post.new(uri.path)\n req.set_form_data(args)\n request(uri,req)\n end",
"def create\n @url = Url.new(url_params)\n @url = Url.get_from_long(@url.long) if @url.duplicate?\n\n respond_to do |format|\n if not @url.new_record?\n format.html { redirect_to root_path, notice: 'URL already existed.' }\n format.json { render action: 'show', status: :ok, location: @url }\n elsif @url.save\n format.html { redirect_to root_path, notice: 'Url was successfully created.' }\n format.json { render action: 'show', status: :created, location: @url }\n else\n format.html do\n @urls = Url.recent.page(params[:page]).per(25)\n render action: 'index'\n end\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @url = Url.new(url_params)\n \n set_url_host_model\n \n respond_to do |format|\n if @url.save\n format.html { redirect_to @url, notice: 'Url was successfully created.' }\n format.json { render :show, status: :created, location: @url }\n else\n format.html { render :new }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @urls = params[:domain].split(\"\\r\\n\")\n\n @urls.each do |url|\n @whitelist_url = WhitelistUrl.new(:domain => url)\n @whitelist_url.save\n end\n\n redirect_to whitelist_urls_url\n\n # respond_to do |format|\n # if @whitelist_url.save\n # format.html { redirect_to @whitelist_url, notice: 'Whitelist url was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @whitelist_url }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @whitelist_url.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def post url\n Timeout.timeout(60) do\n puts \"POST: #{url}\" if config[:debug]\n \n tags = (Hpricot(open(\"http://del.icio.us/url/check?url=#{CGI.escape(url)}\"))/\n '#top-tags'/'li')[0..10].map do |li| \n (li/'span').innerHTML[/(.*?)<em/, 1]\n end.join(\" \")\n puts \"POST-TAGS: #{tags}\" if config[:debug]\n \n description = begin\n Timeout.timeout(5) do \n (((Hpricot(open(url))/:title).first.innerHTML or url) rescue url)\n end\n rescue Timeout::Error\n puts \"POST: URL timeout\" if config[:debug]\n url\n end\n \n query = { :url => url, :description => description, :tags => tags, :replace => 'yes' }\n\n http = Net::HTTP.new('api.del.icio.us', 443) \n http.use_ssl = true \n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n response = http.start do |http|\n post_url = '/v1/posts/add?' + query.map {|k,v| \"#{k}=#{CGI.escape(v)}\"}.join('&')\n puts \"POST: post url #{post_url}\" if config[:debug]\n req = Net::HTTP::Get.new(post_url, {\"User-Agent\" => \"Kirby\"})\n req.basic_auth config[:delicious_user], config[:delicious_pass]\n http.request(req)\n end.body\n\n puts \"POST: #{response.inspect}\" if config[:debug]\n end\n rescue Exception => e\n puts \"POST: #{e.inspect}\" if config[:debug]\n end",
"def test_should_create_link_via_API_JSON\r\n get \"/logout\"\r\n post \"/links.json\", :api_key => 'testapikey',\r\n :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response :created\r\n link = JSON.parse(response.body)\r\n check_new_link(link) \r\n end",
"def create\n @shortened_url = Url.new(:url => params[:url])\n \n \n respond_to do |format|\n if @shortened_url.save\n @num=\"\"\n flash[:shortened_id] = @shortened_url.id\n ( @shortened_url.id..(@shortened_url.id)).each do |i|\n @num=hashing(i)+@num\n end\n @shortened_url.shorturl=url_url(@num) \n @shortened_url.save \n \n format.html {redirect_to new_url_url}\n format.xml { render xml: @urls}\n format.json { render json: @shortened_url, status: :created }\n else\n format.json { render json: @shortened_url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @listing = Listing.new(params[:listing])\n @listing.urls.append params[:url]\n\n respond_to do |format|\n if @listing.save\n format.html { redirect_to @listing, notice: 'Listing was successfully created.' }\n format.json { render json: @listing, status: :created, location: @listing }\n else\n format.html { render action: \"new\" }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n url_match = params[:url][:url] =~ /\\Ahttp(s?):\\/\\//i\n params[:url][:url] = \"http://\" << params[:url][:url] if url_match.nil?\n \n # find existing url\n @existing_url = Url.find_by_url(params[:url][:url])\n \n if @existing_url.nil?\n @url = Url.new(params[:url])\n id = Url.last.id unless Url.last.nil?\n @url.short_url = Shorten::Base62.to_s(id.nil? ? 1 : id+1)\n p @url\n else\n @url = @existing_url\n end\n\n respond_to do |format|\n if !@existing_url.nil? or @url.save\n format.html { redirect_to @url, notice: 'Url was successfully shortened.' }\n format.json { render json: @url, status: :created, location: @url }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def handle_links(json) end",
"def add_new_urls(urls)\n return if urls.length == 0\n @db[LINKS_COLLECTION_NAME].insert(urls.map {|u| {'_id' => hash_url(u)}})\n end",
"def url_params\n params.require(:url).permit(:url, :unique_key, :hits)\n end",
"def post(url, payload, headers={})\n payload = MultiJson.encode(payload)\n headers = headers.merge({:content_type => 'application/json'})\n request(:post, url, payload, headers)\n end",
"def create\n @url_list = UrlList.new(url_list_params)\n\n respond_to do |format|\n if @url_list.save\n format.html { redirect_to @url_list, notice: 'Url list was successfully created.' }\n format.json { render :show, status: :created, location: @url_list }\n else\n format.html { render :new }\n format.json { render json: @url_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @urls = Url.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @urls }\n end\n end",
"def create\n @url = Url.new(url_params)\n @page = Page.find(params[:page_id])\n respond_to do |format|\n if @url.save\n @url.capture # 新規作成したとき、ここで、キャプチャ\n format.html { redirect_to edit_page_url_url(@page,@url), notice: 'URLを追加しました。' }\n format.json { render :show, status: :created, location: @url }\n else\n format.html { render :new }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post url, object = nil\n request url, HTTP::Post, object\n end",
"def post(endpoint, url, args, version = 'v1')\n qs = build_qs(args)\n req_url = \"#{url}/api/#{version}/#{endpoint}?#{qs}\"\n\n request(req_url, :POST)\n end",
"def entries_to_http entries, url, http = Atom::HTTP.new\n coll = Atom::Collection.new url, http\n\n entries.each { |entry| coll.post! entry }\n end",
"def index\n @urls = ShortenedUrl.order(\"updated_at ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @urls }\n end\n end",
"def post_json(url, ls_data)\n uri = URI.parse(url)\n request = Net::HTTP::Post.new(uri.request_uri, HEADER_JSON)\n request.body = ls_data\n request.basic_auth(@nsx_user, @nsx_password)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true,\n :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https|\n https.request(request)\n end\n return JSON.parse(response.body)['id'] \\\n if check_response(response, 201)\n end",
"def post(url, key)\n _request(url, :POST, key)\n end",
"def post_json(url, body = nil, headers = nil)\n body = body.to_json\n headers = (headers || {}).merge('Content-Type' => 'application/json')\n post(url, body, headers)\n end",
"def create\n referrer = Rails.application.routes.recognize_path(request.referrer)\n \n @url = Url.new(url_params)\n @error = nil\n result_url = Url.find_by(:long_url => @url[:long_url])\n\n respond_to do |format|\n if result_url.nil?\n max_id = Url.maximum(:id) || 0\n num = START_OFFSET + max_id + 1\n short_key = encode(num) \n @url[:short_url] = short_key\n\n if @url.save\n @new_url = @url\n @url = Url.new(:long_url => @new_url[:long_url], :short_url => @new_url[:short_url])\n if referrer[:action] == 'index'\n format.html { render :index }\n else\n format.html { redirect_to @new_url, notice: \"URL was successfully created.\"}\n end\n else\n @error = @url.errors.full_messages\n if referrer[:action] == 'index'\n format.html { render :index }\n else\n format.html { render :new }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n else\n if referrer[:action] == 'index'\n @url[:short_url] = result_url[:short_url]\n format.html { render :index }\n else\n format.html { redirect_to result_url, notice: \"Existing URL. No URL is created.\" }\n end\n end\n end\n end",
"def create\n @urlitem = Urlitem.new(urlitem_params)\n\n respond_to do |format|\n if @urlitem.save\n format.html { redirect_to @urlitem, notice: 'Urlitem was successfully created.' }\n format.json { render :show, status: :created, location: @urlitem }\n else\n format.html { render :new }\n format.json { render json: @urlitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def http_post(*args)\n url = args.shift\n c = Curl::Easy.new url\n yield c if block_given?\n c.http_post *args\n c\n end",
"def post(*args)\n request :post, *args\n end",
"def create\n @visited_url = VisitedUrl.new(visited_url_params)\n\n respond_to do |format|\n if @visited_url.save\n format.html { redirect_to @visited_url, notice: 'Visited url was successfully created.' }\n format.json { render :show, status: :created, location: @visited_url }\n else\n format.html { render :new }\n format.json { render json: @visited_url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sampled_url = SampledUrl.new(params[:sampled_url])\n\n respond_to do |format|\n if @sampled_url.save\n format.html { redirect_to @sampled_url, notice: 'Sampled url was successfully created.' }\n format.json { render json: @sampled_url, status: :created, location: @sampled_url }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sampled_url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @url_identifier = params[:new_identifier]\n @url = Url.new(url_params)\n @url.group = current_user.context_group\n @empty_url = Url.new\n\n respond_to do |format|\n if @url.save\n format.html do\n redirect_to urls_path, notice: 'URL was successfully created.'\n end\n format.js { render :create }\n else\n format.js { render :new }\n end\n end\n end",
"def create\n\t@doi = Doi.find params[:doi_id]\n @url = @doi.urls.new(url_params)\n\n\tif @url.save\n\tredirect_to doi_urls_url(@doi) , notice: 'URL was successfuly created'\n\telse\n\trender :new\n\tend\n end",
"def index\n @urls = @site.urls.paginate(:page => params[:page])\n render json: @urls\n end",
"def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end",
"def urls_params\n params.permit(urls: []).dig(:urls) || ParallelFetcher::DEFAULT_URLS\n end",
"def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end",
"def post(url, body = {})\n call(url: url, action: :post, body: body)\n end",
"def create\n submitted_url = url_params[:original_url]\n\n @url = Url.where(original_url: [submitted_url, \"http://#{submitted_url}\",\"http://www.#{submitted_url}\"]).first_or_initialize\n @url.assign_attributes(url_params)\n\n respond_to do |format|\n if @url.persisted?\n format.html {redirect_to @url, notice: \"We've already redirected this url. Check out the shortened url below.\"}\n format.json { render action: 'show', status: 200, location: @url }\n elsif @url.save\n format.html { redirect_to @url, notice: 'Url was successfully created.' }\n format.json { render action: 'show', status: :created, location: @url }\n else\n format.html { render action: 'new' }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n response = http.start {|http| http.request(request) }\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend",
"def post(url, data, headers = {})\n request(:post, url, headers, :data => data)\n end",
"def create\n @known_url = KnownUrl.new(known_url_params)\n\n respond_to do |format|\n if @known_url.save\n format.html { redirect_to @known_url, notice: 'Known url was successfully created.' }\n format.json { render action: 'show', status: :created, location: @known_url }\n else\n format.html { render action: 'new' }\n format.json { render json: @known_url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\nend",
"def url_params\n params.permit(:url)\n end",
"def url_params\n params.permit(:url)\n end",
"def post(url)\n response = RestClient::Request.new(\n method: :post,\n url: \"#{ENDPOINT_URL}/#{url}\",\n verify_ssl: false,\n headers: {\n 'Content-Type' => 'application/json',\n 'Authorization' => \"Basic #{authorization_hash}\"\n },\n payload: {user: user, pwd: password}.to_json\n ).execute\n\n # Parse the response to Ruby objects\n JSON.parse(response)\n end",
"def post(url_variables:, body:)\n ensure_service_document\n\n end",
"def create\n # decode url to remove duplicacy in case of same url encoded and decoded\n url = URI.decode(params[:url])\n # check if url already exists in db\n mini_url = MiniUrlHelper.check_existing_url(url, current_user)\n unless mini_url\n mini_url = MiniUrl.new\n mini_url.url = url\n # a check to handle invalid expiry time\n begin\n mini_url.expiry = DateTime.parse(params[:expiry])\n rescue ArgumentError => e\n logger.error \"Invalid expiry time.\"\n end\n mini_url.user = current_user if current_user\n # call method to generate unique code and save into db\n # raise exception in case of some error\n unless mini_url.generate_unique_code\n raise Exceptions::SavingError.new(mini_url.errors)\n end\n end\n short_url = \"#{BASE_URL}/#{mini_url.url_code}\"\n render json: {short_url: short_url}, status: 201\n rescue Exceptions::SavingError => e\n render json: {error: e}, status: 400\n end",
"def post(*args)\n request(:post, *args)\n end",
"def create\n @url_mapper = UrlMapper.new(url_mapper_params)\n\n respond_to do |format|\n if @url_mapper.save\n format.html { redirect_to @url_mapper, notice: 'Url mapper was successfully created.' }\n format.json { render :show, status: :created, location: @url_mapper }\n else\n format.html { render :new }\n format.json { render json: @url_mapper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(url, params = {})\n client.post(url, params).body\n end",
"def create\n @url = Url.new(url_params)\n\n respond_to do |format|\n @url.user = current_user\n if @url.save\n format.html { redirect_to polymorphic_url([:short], short: \"#{@url.short}+\"), notice: 'Url was successfully shortened.' }\n format.json { render action: 'show', status: :created, location: @url }\n else\n format.html { render action: 'new' }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_data(url_list)\n urls = []\n url_list.each do |url|\n begin\n parsed_url = URI.parse(url)\n main_url = parsed_url.scheme + '://' + parsed_url.host + parsed_url.path\n query = URI::decode_www_form(parsed_url.query).to_h rescue nil\n insert_in_table({url: main_url, query: query})\n rescue Exception => e\n puts \"BAD URL = #{e.message}, url = #{url}\"\n end\n end\n puts urls\n end",
"def create\n @url = Url.create_update_with(url_params)\n @short_url = \"#{request.host_with_port}/#{@url.short_url}\"\n redirect_to root_path(short_url: @short_url)\n end",
"def post endpoint, data\n do_request :post, endpoint, data\n end",
"def url_params\n params.require(:url).permit(:url)\n end",
"def create\n @feed_url = current_account.feed_urls.new(feed_url_params)\n\n respond_to do |format|\n if @feed_url.save\n format.html { redirect_to feed_urls_path, notice: 'Feed url was successfully created.' }\n format.json { render :show, status: :created, location: @feed_url }\n else\n format.html { render :new }\n format.json { render json: @feed_url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @urlshortner = Urlshortner.new(urlshortner_params)\n\n respond_to do |format|\n if @urlshortner.save\n format.html { redirect_to @urlshortner, notice: 'Urlshortner was successfully created.' }\n format.json { render action: 'show', status: :created, location: @urlshortner }\n else\n format.html { render action: 'new' }\n format.json { render json: @urlshortner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def http_post(uri, data)\n RestClient.post uri, data\n end",
"def create\n @link = Link.new(params[:link])\n\n respond_to do |format|\n if @link.save\n @response = { url: \"#{request.protocol}#{request.host_with_port}/#{Link.encode(@link.id)}\" }\n format.json { render json: @response, status: :created, location: @link }\n else\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @url_connector = UrlConnector.new(params[:url_connector])\n\n respond_to do |format|\n if @url_connector.save\n format.html { redirect_to @url_connector, notice: 'Url connector was successfully created.' }\n format.json { render json: @url_connector, status: :created, location: @url_connector }\n else\n format.html { render action: \"new\" }\n format.json { render json: @url_connector.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{uri}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend",
"def post_json(path, body)\n uri = build_uri(path)\n #puts \"🤖 POST #{path}\"\n #puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n #puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n #puts result[:result]\n result\nend",
"def add_url(teamsiteId:, name:, url:, **args)\n request.post(\n \"#{teamsites_url}/#{teamsiteId}/urls\",\n body: { url: url, name: name, **args }\n )\n end",
"def create\n @url = params[:url]\n token = SecureRandom.hex(4)\n @tiny_token = Url.create(\n url: @url,\n token: token,\n domain: \"#{ENV['HOSTNAME']}/#{token}\" \n )\n redirect_to url_path(token)\n \n end",
"def post(url, resource_name, options = {})\n build_response(resource_name) do\n connection.post do |req|\n req.url url\n req.body = options.to_json\n end\n end\n end",
"def submit\n\t\tset_post_data\n get_response @url\n parse_response\n\tend",
"def post_json(path, body)\n uri = build_uri(path)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n result = JSON.parse(response.body)\n puts result\n result\nend",
"def create\n if @link.save\n render json: @link, status: :created, location: @link\n else\n render json: @link.errors, status: :unprocessable_entity\n end\n end",
"def create\n @url_link = UrlLink.new(url_link_params)\n\n respond_to do |format|\n if @url_link.save\n format.html { redirect_to @url_link, notice: 'Url link was successfully created.' }\n format.json { render :show, status: :created, location: @url_link }\n else\n format.html { render :new }\n format.json { render json: @url_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @url = Url.new(url_params)\n @url.sanitize\n @url.current_ip = request.remote_ip\n if @url.new_url?\n respond_to do |format|\n if @url.save\n format.html { redirect_to shortened_path(@url.short_url), notice: 'Url was successfully created.' }\n format.json { render :show, status: :created, location: @url }\n else\n format.html { render :new }\n format.json { render json: @url.errors, status: :unprocessable_entity }\n end\n end\n else\n flash[:notice] = \"A short link for this URL is already in our database\"\n redirect_to shortened_path(@url.find_duplicate.short_url)\n end\n \n end",
"def autoname_url(url)\n request('POST', @uri.request_uri, url)\n end",
"def create\n @short_url = @user.short_urls.new(short_url_params)\n\n if @short_url.save\n short_url = @short_url\n short_url.shorty = \"http://www.my-domain.com/#{@short_url.shorty}\"\n render json: short_url, status: :created\n else\n render json: {errors: @short_url.errors}, status: :unprocessable_entity\n end\n end",
"def urls_params\n params.require(:url).permit(:long_url)\n end",
"def post(object, url, headers={})\n do_request(\"post\", url, object, headers)\n end",
"def create\n normalized_url = Link.normalize_url(params[:url])\n if normalized_url.nil?\n render json: LinkResponse.new(ERROR_INVALID_URL, params[:code]), status: 422\n else\n begin\n link = Link.find_or_create(normalized_url, params[:type])\n render json: LinkResponse.new(SUCCESS, link.code), status: 200\n rescue => error\n render json: LinkResponse.new(ERROR_INVALID_URL, params[:code]), status: 500\n end\n end\n end",
"def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend"
] | [
"0.66614103",
"0.6225674",
"0.62237",
"0.6133381",
"0.6110082",
"0.60986954",
"0.60519725",
"0.60070646",
"0.5954528",
"0.59431005",
"0.5926763",
"0.58907574",
"0.5872233",
"0.58240664",
"0.58098954",
"0.57900316",
"0.57866234",
"0.5748828",
"0.57442534",
"0.571095",
"0.5702256",
"0.5697739",
"0.56848264",
"0.56669545",
"0.5665943",
"0.5658442",
"0.56583846",
"0.5633092",
"0.5632965",
"0.5608323",
"0.5604932",
"0.56031066",
"0.5576357",
"0.5569383",
"0.5564657",
"0.5558423",
"0.55470204",
"0.5534048",
"0.5531006",
"0.5498041",
"0.5487107",
"0.54843044",
"0.5453987",
"0.54337716",
"0.54286295",
"0.5413775",
"0.5413754",
"0.5412093",
"0.5392093",
"0.53916115",
"0.5389826",
"0.5387794",
"0.53822106",
"0.5369843",
"0.5353218",
"0.535303",
"0.5348782",
"0.53303796",
"0.5322968",
"0.5322768",
"0.532178",
"0.53170955",
"0.53169143",
"0.53091943",
"0.52959967",
"0.5293572",
"0.52903783",
"0.52903783",
"0.52888346",
"0.52807444",
"0.5280107",
"0.5279515",
"0.5269916",
"0.5269777",
"0.5268436",
"0.5266615",
"0.52525795",
"0.52402246",
"0.52348644",
"0.52343255",
"0.5234164",
"0.5230838",
"0.5230364",
"0.52200544",
"0.5214429",
"0.52129567",
"0.5211464",
"0.5194285",
"0.5193844",
"0.5193401",
"0.51877755",
"0.51843965",
"0.51804554",
"0.51742077",
"0.51726294",
"0.51524436",
"0.5146588",
"0.5140739",
"0.5138498",
"0.51369053"
] | 0.58478326 | 13 |
Use callbacks to share common setup or constraints between actions. | def set_url
@url = Url.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_handler\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def before_dispatch(env); end",
"def process_action(...)\n send_action(...)\n end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def action\n end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def config(action, *args); end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def before_action \n end",
"def action\n end",
"def setup\n # override this if needed\n end",
"def matt_custom_action_begin(label); end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def setup_signals; end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def lookup_action; end",
"def around_hooks; end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def action_target()\n \n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def setup(&blk)\n @setup_block = blk\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def callback_phase\n super\n end",
"def advice\n end",
"def call\n setup_context\n super\n end",
"def _handle_action_missing(*args); end",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def duas1(action)\n action.call\n action.call\nend"
] | [
"0.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.5328757",
"0.5310255",
"0.5300339",
"0.5298796",
"0.5295774",
"0.5256034",
"0.5243039",
"0.5236007",
"0.5235239",
"0.5235239",
"0.5235239",
"0.5235239",
"0.5235239",
"0.52321917",
"0.5227032",
"0.52216744",
"0.5216349",
"0.52161187",
"0.5210265",
"0.5207244",
"0.5177388",
"0.5177142",
"0.51747334",
"0.516293",
"0.51629275",
"0.5155534",
"0.51540613",
"0.515197",
"0.5151636",
"0.5145279",
"0.51380795",
"0.5135777",
"0.5117378",
"0.5115066",
"0.5115066",
"0.5110235",
"0.5106418",
"0.50917816",
"0.50909185",
"0.50855017",
"0.5082105",
"0.506359",
"0.5055345",
"0.50546116",
"0.50523037",
"0.50523037",
"0.50327307",
"0.5024364",
"0.5021113",
"0.50174654",
"0.50163317",
"0.5000553",
"0.50002855",
"0.49991882",
"0.49905527",
"0.49905527",
"0.49849054",
"0.4982546",
"0.4980941",
"0.4979153",
"0.49693102",
"0.4967172",
"0.49594432",
"0.49564302",
"0.49552485",
"0.49533385",
"0.49506924",
"0.49452737",
"0.49442786",
"0.49347955",
"0.49341312",
"0.49295264",
"0.49261844",
"0.4925649",
"0.49251428",
"0.4920729",
"0.49177617",
"0.4916373",
"0.49158472",
"0.4915794",
"0.49156648"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def url_params
params.require(:url).permit(:url)
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 |
GET /employees_roles GET /employees_roles.json | def index
@employees_role = EmployeesRole.new()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_roles\n @roles = @user.roles.pluck(:name)\n render json: @roles\n end",
"def get_roles_list()\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['apiSecret'] = @api_secret\n\n resource_path = 'identity/v2/manage/role'\n get_request(resource_path, query_parameters, nil)\n end",
"def index\n authorize Role\n\n respond_to do |format|\n format.json { render json: @roles }\n end\n end",
"def list_employee_roles_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V1EmployeesApi.list_employee_roles ...\"\n end\n if opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order'])\n fail ArgumentError, 'invalid value for \"order\", must be one of ASC, DESC'\n end\n if !opts[:'limit'].nil? && opts[:'limit'] > 200\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling V1EmployeesApi.list_employee_roles, must be smaller than or equal to 200.'\n end\n\n # resource path\n local_var_path = \"/v1/me/roles\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'batch_token'] = opts[:'batch_token'] if !opts[:'batch_token'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<V1EmployeeRole>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V1EmployeesApi#list_employee_roles\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def roles\n response[\"roles\"]\n end",
"def list_employee_roles(order: nil,\n limit: nil,\n batch_token: nil)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v1/me/roles'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'order' => order,\n 'limit' => limit,\n 'batch_token' => batch_token\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.get(\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 roles_path\n @roles_path ||= '/api/v2/roles'\n end",
"def index\n @company = Company.find(params[:company_id])\n @roles = Role.where(:company_id => @company.id)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @roles }\n end\n end",
"def roles\n self.dig_for_array(\"roles\")\n end",
"def index\n @roles = Role.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @roles }\n end\n end",
"def list\n # We don't use pagination here since we want to display the roles in a\n # nice tree. Additionally, there won't be more than ~100 roles in a\n # normal scenario anyway - far less!\n @roles = Role.find(:all)\n end",
"def list_roles(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'ListRoles'\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? :marker\n\t\t\targs[:query]['Marker'] = optional[:marker]\n\t\tend\n\t\tif optional.key? :max_items\n\t\t\targs[:query]['MaxItems'] = optional[:max_items]\n\t\tend\n\t\tself.run(args)\n\tend",
"def index\n @roles = Rol.all\n end",
"def get_roles(options = {})\n request_params = {\n per_page: options.fetch(:per_page, nil),\n page: options.fetch(:page, nil),\n include_totals: options.fetch(:include_totals, nil),\n name_filter: options.fetch(:name_filter, nil)\n }\n get roles_path, request_params\n end",
"def roles(options = {})\n headers = extract_headers!(options)\n json = client.list(\"/v1/auth/approle/role\", options, headers)\n return Secret.decode(json).data[:keys] || []\n rescue HTTPError => e\n return [] if e.code == 404\n raise\n end",
"def get_external_roles\n get(\"#{url_base}/external_role_map/all?#{dc}\")[\"data\"]\n end",
"def index\n @entity_roles = EntityRole.all\n end",
"def index\n client_application_id = current_user.client_application_id.to_s\n @roles = Role.where(client_application_id: client_application_id)\n end",
"def show\n @roles = Role.all\n end",
"def list\n\n @roles = Role.find(:all, :order => 'name')\n\n end",
"def index\n @roles = @client.roles\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @roles }\n end\n end",
"def index\n @movie_roles = @movie.roles\n end",
"def index\n @roles = Role.all\n end",
"def index\n @roles = Role.all\n end",
"def index\n @roles = Role.all\n end",
"def index\n @roles = Role.all\n end",
"def index\n @roles = Role.all\n end",
"def index\n @roles = Role.all\n end",
"def roles\n roles_from_users\n end",
"def index\n @roles = Role.all\n \n respond_to do |format|\n format.html { render :layout => 'application' } # use client application's layout\n format.xml { render :xml => @roles }\n end\n end",
"def index\n @app_roles = AppRole.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @app_roles }\n end\n end",
"def roles\n client.user_roles(id)\n end",
"def roles\n client.user_roles(id)\n end",
"def index\n @user_roles = UserRole.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def getRole\n @users = User.where(\"role = ?\", params[:role]).NameOrder\n render json: @users\n end",
"def roles!(access = {})\n json = Api::Request.new do |request|\n request[:access] = access\n request[:method] = :GET\n request[:path] = '/mgmt/{{client_id}}/roles'\n end.execute!\n\n json[:roles]\n end",
"def index\n @users = User.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @user_roles }\n end\n end",
"def GetRole id\n\n APICall(path: \"custom_roles/#{id}.json\")\n\n end",
"def index\n @roles = Role.order(\"name\").all\n @user_list = User.order(\"email\").all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @roles }\n end\n end",
"def list_roles(options={})\n request({\n 'Action' => 'ListRoles',\n :parser => Fog::Parsers::AWS::IAM::ListRoles.new\n }.merge!(options))\n end",
"def index\n @roles = record.roles.includes(:resource)\n render jsonapi: @roles, include: %i[users groups resource]\n end",
"def index\n @org_roles = OrgRole.all\n end",
"def index\n @roles = System::Role.all\n end",
"def index\n\t\t#@data = {name: '角色', path: '/managers/roles'}\n\t\t@roles = Role.page(params[:page]).per(params[:rows])\n\t\trespond_with({rows: @roles, total: @roles.total_count}) \n\tend",
"def show\n if can?(:read, User)\n @user = User.find(params[:id])\n @roles = \"\"\n\n @user.roles.each do |role|\n if @roles == \"\"\n @roles += role.name\n else\n @roles += \", \" + role.name\n end\n end\n end\n\n respond_to do |format|\n format.json { render :json => @user }\n format.xml { render :xml => @user }\n format.html \n end\n\n rescue ActiveRecord::RecordNotFound\n respond_to_not_found(:json, :xml, :html)\n end",
"def index\n @users_roles = UsersRole.all\n end",
"def index\n\t\tparamsr\n\t\tglobal\n\t\t# render json: @roles, each_serializer: RoleSerializer, root: false\n\tend",
"def claims\n get_all_roles\n end",
"def claims\n get_all_roles\n end",
"def index\n @all_roles = Role.all\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @roles }\n end\n end",
"def index\n @roles = Role.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @roles }\n format.json { render :json => @roles.to_json(:only => [:id, :code, :name, :definition]) }\n format.js { render (:update){ |page| page[dom_id_nested(:index)].replace :file => \"admin/roles/index\" } }\n end\n end",
"def employee_details\n if current_user.role == \"SuperAdmin\"\n @employees = Employee.all\n \n render :status => 200,\n :json => { :success => true,\n \n :data => {:employees => @employees} }\n else\n render :status => 201,\n :json => { :success => false,\n \n :data => {:error => \"You dont have authority!\" }}\n end\n \nend",
"def index\n @team_user_roles = TeamUserRole.all\n end",
"def index\n authorize Role\n @roles = Role.all\n end",
"def role_data(id)\n @conn.get(\"/api/v1/roles/#{id}\")\n end",
"def edit_role\n @user = User.find(params[:id])\n @roles = Role.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def list\n @roles = Role.all(:include => [:groups, :users])\n end",
"def index\n\t\tindex_\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @roles }\n\t\tend\n\tend",
"def display_all_roles\n # Interface method\n end",
"def startup_roles(id, options={})\n get(\"1/startups/#{id}/roles\", options)\n end",
"def index\n @sulabh_user_roles = SulabhUserRole.all\n end",
"def role\n # get all the employee's role\n # binding.pry\n Role.all.select{|role| role.employee == self}\n end",
"def all\n data = []\n conn = @ec2_main.environment.iam_connection\n if conn != nil\n begin\n response = conn.list_roles()\n if response.status == 200\n data = response.body[\"Roles\"]\n end\n rescue\n puts \"ERROR: getting all roles #{$!}\"\n end\n end\n return data\n end",
"def index\n @roles = Role.page params[:page]\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @roles}\n end\n end",
"def index\n @roles = Role.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @roles }\n end\n end",
"def employees\n Employee.all.select{|employee| employee.role == self}\n \n end",
"def index\n @employees_rols = EmployeesRol.all\n end",
"def roles\n tmp = client.get @json['user']['links']['roles']\n tmp['associatedRoles']['roles'].pmap do |role_uri|\n role = client.get role_uri\n client.factory.create(GoodData::ProjectRole, role)\n end\n end",
"def index\n render json: [UserRole.find_by(user_id: params[:user_id],\n role_id: params[:role_id])],\n each_serializer: UserRoleSerializer\n end",
"def list_review_roles\n\n @review_roles = Role.get_review_roles\n\n end",
"def edit\n @user = User.find(params[:id])\n if can?(:update, @user)\n @roles = \"\"\n\n @user.roles.each do |role|\n if @roles == \"\"\n @roles += role.name\n else\n @roles += \", \" + role.name\n end\n end\n else\n @user = nil\n end\n\n respond_to do |format|\n format.json { render :json => @user } \n format.xml { render :xml => @user }\n format.html\n end\n\n rescue ActiveRecord::RecordNotFound\n respond_to_not_found(:json, :xml, :html)\n end",
"def display_roles\n \n @active_roles = Role.find_all_active\n \n render(:layout => false)\n \n end",
"def admin_for_companies\n get(\"/organizationalEntityAcls?q=roleAssignee&role=ADMINISTRATOR&state=APPROVED&count=100\")\n end",
"def show\n render json: @role\n end",
"def index\n @user = User.find( params[:user_id] )\n @roles = Role.all\n\n respond_to do |format|\n format.js { render :roles }\n end\n end",
"def index\n @roles = policy_scope(Role).page(pagination[:page]).per(pagination[:per])\n end",
"def roles\r\n @roles ||= user_roles.map(&:name)\r\n end",
"def show\n @user = User.find(params[:id])\n @roles = @user.roles\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def index\n @roles = Role.page params[:page]\n end",
"def role_select\n @@Roles.list\n end",
"def retrieve_employee_role(role_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v1/me/roles/{role_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'role_id' => { 'value' => role_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.get(\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 index\n @cms_roles = Cms::Role.all\n end",
"def test_role_features\n\n # get members of role with guid 4\n get '/role/3/members'\n assert (last_response.status == 200), \"Get all members of role id 3: response is not 200\"\n\n # get available role attributes\n get '/role/attributes'\n assert (last_response.body.size > 50), \"Get available role attributes: response to small for valid data\"\n\n # get all roles\n get '/role'\n assert (last_response.body.size > 50), \"Get all roles: response to small for valid data\"\n\n # get role with guid \"3\"\n get '/role/3'\n assert (last_response.body.size > 50), \"Get role with id 3: response to small for valid data\"\n end",
"def get_roles_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UserApi.get_roles ...'\n end\n # resource path\n local_var_path = '/api/3/roles'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ResourcesRole')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UserApi#get_roles\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @employees = []\n if current_user.user_type <= 1\n @employees = Employee.all\n elsif current_user.user_type == 3 # manager\n @employees = Employee.where(department_id: current_user.role.department_id)\n end\n end",
"def list_customers_manager\n @manager = User.find(params[:id])\n @employees = @manager.employee\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end",
"def list_employee_roles(opts = {})\n data, _status_code, _headers = list_employee_roles_with_http_info(opts)\n return data\n end",
"def list(options = {})\n @raw = send_get_request(@conn_no_err, ['/v1/acl/roles'], options)\n raise Diplomat::AclNotFound if @raw.status == 403\n\n parse_body\n end",
"def index\n @job_roles = JobRole.all\n end",
"def index\n role = Role.find_by_name('Admin')\n @users = role.users\n end",
"def index\n @program_roles = ProgramRole.all\n end",
"def roles\n @users = User.order(\"user_name\").all\n end",
"def edit\n @user = User.find(params[:id],include: :roles)\n @roles = Role.all\n respond_to do |format|\n format.html\n end\n end",
"def get_roles(opts = {})\n data, _status_code, _headers = get_roles_with_http_info(opts)\n data\n end",
"def show\n @role = @client.roles.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @role }\n end\n end",
"def roles\n @roles = Role.order(\"name\")\n\t@rights = Right.order(\"name\").map {|r| [r.name, r.id] }\n end",
"def edit_users\n @user = User.find(params[:id])\n @role = @user.roles.first.name\n end",
"def associated_roles\n data[:associated_roles]\n end",
"def associated_roles\n data[:associated_roles]\n end",
"def show\n @roles_and_permission = @roles.roles_and_permission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @roles_and_permission }\n end\n end"
] | [
"0.7573759",
"0.70972234",
"0.7097008",
"0.7073955",
"0.70428145",
"0.7024727",
"0.6975401",
"0.6956922",
"0.6892282",
"0.688904",
"0.6878822",
"0.6861661",
"0.68243915",
"0.6807193",
"0.6805941",
"0.6790079",
"0.6789559",
"0.67667943",
"0.6763699",
"0.6755896",
"0.6697902",
"0.66777045",
"0.6676613",
"0.6676613",
"0.6676613",
"0.6676613",
"0.6676613",
"0.6676613",
"0.6675906",
"0.6673955",
"0.66637516",
"0.665574",
"0.665574",
"0.6648089",
"0.6625824",
"0.66143674",
"0.6606406",
"0.6599867",
"0.65707487",
"0.6569053",
"0.6548823",
"0.65428996",
"0.65240747",
"0.6521641",
"0.6460767",
"0.6460537",
"0.6423769",
"0.641057",
"0.641057",
"0.6407718",
"0.64068633",
"0.63975286",
"0.63767374",
"0.6375154",
"0.63741404",
"0.6351547",
"0.63510156",
"0.6345819",
"0.6338653",
"0.6330512",
"0.6329147",
"0.632127",
"0.63160306",
"0.6285186",
"0.6283607",
"0.6270696",
"0.62686014",
"0.62635654",
"0.626225",
"0.62365663",
"0.62346023",
"0.62252814",
"0.6217709",
"0.6214097",
"0.6211998",
"0.62084526",
"0.6207085",
"0.6205491",
"0.62037283",
"0.61939347",
"0.6193024",
"0.61749667",
"0.6142894",
"0.61411095",
"0.61264014",
"0.6110457",
"0.61074257",
"0.610157",
"0.6101501",
"0.6093232",
"0.60930306",
"0.6091297",
"0.6089944",
"0.60829914",
"0.6070352",
"0.60668117",
"0.60574687",
"0.6054834",
"0.6054834",
"0.60515517"
] | 0.6228877 | 71 |
POST /employees_roles POST /employees_roles.json | def create
@employees_role = EmployeesRole.create(employees_role_params)
redirect_to employees_roles_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_employee_role(body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v1/me/roles'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.post(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"def CreateRole params = {}\n \n APICall(path: 'custom_roles.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n chef_server_rest.post(\"roles\", self)\n self\n end",
"def post_role(role)\n role = {\n \"id\"=>nil,\n \"name\"=>nil, \n \"description\"=>\"\", \n \"sessionTimeout\"=>\"60\",\n \"roles\"=>[],\n \"privileges\"=>[]\n }.merge(role);\n post(\"#{url_base}/roles\", {\"data\"=>role})[\"data\"]\n end",
"def save_roles user\n user.add_role(params[:role_name])\n end",
"def create_roles\n Role.create_roles(self)\n end",
"def create_roles(roles_model)\n if roles_model.blank?\n raise LoginRadius::Error.new, getValidationMessage('roles_model')\n end\n\n query_parameters = {}\n query_parameters['apiKey'] = @api_key\n query_parameters['apiSecret'] = @api_secret\n\n resource_path = 'identity/v2/manage/role'\n post_request(resource_path, query_parameters, roles_model)\n end",
"def create\n if !grant_access(\"edit_roles\", current_user)\n head(403)\n end\n @role = Role.new(role_params)\n @role.user_id = current_user.id\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @employees_role = EmployeesRole.new()\n end",
"def create\n @user = User.new(user_params)\n\n if roles = params[:user][:roles]\n roles.map { |r| r.downcase }.each do |role|\n unless role.empty?\n @user.roles << Role.new(type: role)\n\n if role == \"admin\"\n respond_to do |format|\n if @user.save\n format.html { redirect_to (flash[:redirect] || :attendees), notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end\n\n if role == \"staff\"\n redirect_to get_staff_list_path\n end\n\n end\n end\n end\n end",
"def create\n @role = @company.roles.new(safe_params)\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to [@company, @role], notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def employees_role_params\n params.require(:employees_role).permit!\n end",
"def create\n @role = Role.new(params[:role])\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to admin_roles_path, notice: 'Role was successfully created.' }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entity_role = EntityRole.new(entity_role_params)\n\n respond_to do |format|\n if @entity_role.save\n format.html { redirect_to @entity_role, notice: 'Entity role was successfully created.' }\n format.json { render :show, status: :created, location: @entity_role }\n else\n format.html { render :new }\n format.json { render json: @entity_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n \t @employee = User.new\n @roles = Role.all\n puts \"ROLES ARE GOING NOW\"\n end",
"def create_roles\n ['admin', 'lector', 'jefe_calidad', 'jefe_bodega', 'op_bodega'].each do |role_name|\n Role.create!(name: role_name)\n end\nend",
"def create\n @employees_rol = EmployeesRol.new(employees_rol_params)\n\n respond_to do |format|\n if @employees_rol.save\n format.html { redirect_to @employees_rol, notice: 'Employees rol was successfully created.' }\n format.json { render :show, status: :created, location: @employees_rol }\n else\n format.html { render :new }\n format.json { render json: @employees_rol.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(role_params)\n\n respond_to do |format|\n if role.save\n current_user.add_role :admin, role\n format.html { redirect_to admin_role_path(role), notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: role }\n else\n format.html { render :new }\n format.json { render json: role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n abilities = []\n client_application = current_user.client_application_id.to_s\n @abilities = Role.get_method_names.sort\n @role = Role.new(role_params)\n params[:role][:role_abilities].each do |ability|\n abilities << ability.to_sym\n end\n @role.role_abilities = [{\"action\"=> abilities, \"subject\"=>[:api]}]\n @role.client_application_id = client_application\n respond_to do |format|\n if @role.save\n format.html { redirect_to roles_path, notice: 'Role was successfully created.' }\n format.json { render :index, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def modify_roles(email, role)\n\t\tresponse = @client.execute(api_method: @service.acl.insert,\n\t\t\t\t\t parameters: {'calendarId' => ENV['NSCS_Calendar_ID']}, body: JSON.dump({role: role, scope: {type: \"user\", \"value\": email}}))\n\tend",
"def create\n error = ''\n \n if params[:roles]\n params[:roles].each do |role|\n @role = Role.new(role) unless role[:title].blank?\n error << model_errors(@role) unless @role.save\n end\n else\n @role = Role.new(params[:roles])\n error << model_errors(@role) unless @role.save\n end\n \n respond_to do |format|\n format.html do\n if error.blank?\n flash[:notice] = \"#{params[:roles].nil? ? 'Role has' : 'Roles have'} been created.\"\n redirect_back_or_default roles_path\n else\n flash[:error] = 'Oops, something went wrong.'\n @role.nil? ? render(:action => 'edit') : redirect_back_or_default(roles_path)\n end\n end\n \n format.js do\n if error.blank?\n flash.now[:notice] = \"#{params[:roles].nil? ? 'Role has' : 'Roles have'} been created.\"\n get_models\n render :action => 'index', :layout => false\n else\n flash.now[:error] = 'Oops, something went wrong.'\n render :action => 'edit', :layout => false\n end\n end\n end\n end",
"def create_employee_role_with_http_info(employee_role, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V1EmployeesApi.create_employee_role ...\"\n end\n # verify the required parameter 'employee_role' is set\n fail ArgumentError, \"Missing the required parameter 'employee_role' when calling V1EmployeesApi.create_employee_role\" if employee_role.nil?\n # resource path\n local_var_path = \"/v1/me/roles\".sub('{format}','json')\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\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(employee_role)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'V1EmployeeRole')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V1EmployeesApi#create_employee_role\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def save\n begin\n chef_server_rest.put(\"roles/#{@name}\", self)\n rescue Net::HTTPClientException => e\n raise e unless e.response.code == \"404\"\n\n chef_server_rest.post(\"roles\", self)\n end\n self\n end",
"def create\n @company = Company.find(params[:company_id])\n @role = Role.new(params[:role])\n @role.company_id = @company.id\n respond_to do |format|\n if @role.save\n format.html { redirect_to company_role_path(@company, @role), notice: 'El rol fue creado exitosamente.' }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def seed_roles\n\tdata = ActiveSupport::JSON.decode(File.read('db/seeds/roles.json'))\n\tdata.each do |d|\n\t\tRole.create!(d)\n\tend\nend",
"def create\n @users_role = UsersRole.new(users_role_params)\n\n respond_to do |format|\n if @users_role.save\n format.html { redirect_to @users_role, notice: 'Users role was successfully created.' }\n format.json { render :show, status: :created, location: @users_role }\n else\n format.html { render :new }\n format.json { render json: @users_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n authorize Role\n\n respond_to do |format|\n format.json { render json: @roles }\n end\n end",
"def create\n @role = Role.new(role_params) \n @role.permissions = []\n @role.set_permissions(params[:permissions]) if params[:permissions]\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def render_create_success\n render json: @resource, include: [:roles], show_roles: true\n end",
"def create\n @role = Role.new(role_params)\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(role_params)\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(role_params)\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_role(role_name, params = {})\n change_role_access(role_name, user_emails_to_ids(params), :post)\n end",
"def create\n @role = Role.new(params[:role])\n\n respond_to do |format|\n if @client.roles << @role\n flash[:notice] = 'Role was successfully created.'\n format.html { redirect_to client_role_url(@client, @role) }\n format.xml { render :xml => @role, :status => :created, :location => [@client, @role] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @team_role = TeamRole.new(team_role_params)\n\n respond_to do |format|\n if @team_role.save\n format.html { redirect_to lab_team_roles_path(@lab), notice: 'Team role was successfully created.' }\n format.json { render action: 'show', status: :created, location: @team_role }\n else\n format.html { render action: 'new' }\n format.json { render json: @team_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_role = RoleUser.new(params[:role_user])\n\n respond_to do |format|\n if @admin_role.save\n format.html { redirect_to @role_users_path, notice: 'Role was successfully created.' }\n format.json { render json: @admin_role, status: :created, location: @admin_role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(params[:role])\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(params[:role])\n \n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_role(auth, server_id, name, color, hoist, mentionable, permissions, reason = nil)\n MijDiscord::Core::API.request(\n :guilds_sid_roles,\n server_id,\n :post,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/roles\",\n { color: color, name: name, hoist: hoist, mentionable: mentionable, permissions: permissions }.to_json,\n Authorization: auth,\n content_type: :json,\n 'X-Audit-Log-Reason': reason\n )\n end",
"def addEmployee\n\n @employee = User.new(people_params)\n\n \n \n if @employee.save\n UserMailer.account_activation(@employee, current_user).deliver_now\n flash[:success] = \"Added employee\"\n redirect_to people_url\n else\n @roles = Role.all\n render 'new'\n end\n end",
"def create\n @role = Role.new(params[:role])\n @role.save\n respond_with(@role)\n end",
"def create_employee\n user = User.new(first_name: \"Nelson\", last_name: \"Muntz\", username: \"nmuntz\", email: \"[email protected]\", password: 'muffins1', password_confirmation: 'muffins1', job_title: 'Worker Guy')\n company_domain = \"cryptographi.com\"\n team = Team.find_by(domain_name: company_domain)\n if !team\n create_manager\n team = Team.find_by(domain_name: company_domain)\n end\n user.team = team\n manager = User.find_by(email: '[email protected]')\n user.manager_id = manager.id\n if user.save\n user.add_role :employee\n end\n end",
"def create\n if signed_in? && current_user.role_id == 2\n @employee = Employee.new(employee_params)\n @religions = Religion.all\n\n respond_to do |format|\n if @employee.save\n emp_name = @employee.full_name\n format.html { redirect_to @employee, notice: emp_name + ' was successfully created.' }\n format.json { render action: 'show', status: :created, location: @employee }\n else\n format.html { render action: 'new' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n else\n restricted_access\n end\n end",
"def create\n @roles = Role.paginate :page => params[:page],\n :per_page => 15,\n :order => sort_order('name')\n @role= Role.new(params[:role])\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to(roles_url, :notice => 'New User role successfully added.') }\n format.xml { render :xml => @role, :status => :created, :location => @role }\n else\n format.html { render :action => \"index\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @role.save\n format.html { redirect_to user_roles_path(@user), notice: I18n.t('controller.create_success_notice', model: '角色') }\n format.json { render action: 'show', status: :created, location: @role }\n else\n format.html { render action: 'new' }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(params[:role])\n\n if @role.save\n redirect_to admin_roles_url\n else\n render :action => \"new\"\n end\n end",
"def new\n \n @roles_and_permission = @roles.roles_and_permission.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @roles_and_permission }\n end\n end",
"def create\n @manage_admin = Manage::Admin.new(manage_admin_params)\n @admin_roles= @manage_admin.roles\n respond_to do |format|\n if @manage_admin.save\n\n # 保存角色信息\n roles_id=params[:roles]\n @manage_admin.roles_in_id=roles_id\n\n format.html { redirect_to @manage_admin, notice: \"成功创建管理员#{@manage_admin.nickname}.\" }\n\n format.json { render :show, status: :created, location: @manage_admin }\n else\n format.html { render :new }\n format.json { render json: @manage_admin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(role_params)\n @role.save\n \n if @role.has_pool\n \n @role.default_assignee_id = 1000000 + @role.id \n @person = Person.new\n @person.id = 1000000 + @role.id\n \n if @role.pool_display_name.length() > 0\n @person.first_name = @role.pool_display_name\n else\n @person.first_name = @role.code + \" Pool\"\n end\n @person.last_name = \"\"\n @person.save\n \n @people_role = PeopleRole.new\n @people_role.role_id = @role.id\n @people_role.person_id = 1000000 + @role.id\n @people_role.save\n end\n \n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_user_roles\n @roles = @user.roles.pluck(:name)\n render json: @roles\n end",
"def create\n @role = Role.new(role_params)\n\n respond_to do |format|\n if @role.save\n format.html {\n redirect_to dashboard_path\n flash[:success] = @role.name+' was successfully created.' }\n format.json { render json: @role.to_json }\n else\n format.html { render action: 'new' }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def employee_details\n if current_user.role == \"SuperAdmin\"\n @employees = Employee.all\n \n render :status => 200,\n :json => { :success => true,\n \n :data => {:employees => @employees} }\n else\n render :status => 201,\n :json => { :success => false,\n \n :data => {:error => \"You dont have authority!\" }}\n end\n \nend",
"def assign_roles(role_ids)\n selected_roles = !role_ids.to_a.empty? ? Role.find(:all, :conditions => [\"id IN (#{role_ids.to_a.uniq.join(', ')})\"]) : []\n self.employee_roles.each do |e_l|\n if selected_roles.map{|l| l.id}.include?(e_l.role_id)\n selected_roles.delete_if{|sl| sl.id == e_l.role_id}\n else\n self.employee_roles.delete(e_l)\n end\n end\n self.roles << selected_roles\n end",
"def create\n\n @roles_and_permission = @roles.roles_and_permission.new(params[:roles_and_permission])\n \n respond_to do |format|\n if @roles_and_permission.save\n format.html { redirect_to [@roles, @roles_and_permission ], notice: 'Roles and permission was successfully created.' }\n format.json { render json: @roles_and_permission, status: :created, location: @roles_and_permission }\n else\n format.html { render action: \"new\" }\n format.json { render json: @roles_and_permission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_roles\r\n self.roles.create(:title => \"admin\")\r\n if self.name.eql? \"Grandor Eldoran\"\r\n self.roles.create(:title => \"admin\")\r\n elsif self.name.eql? \"Test2 Test2\"\r\n self.roles.create(:title => \"member\")\r\n end\r\n end",
"def create\n @personnel = User.new\n @personnel.first_name = params[\"first_name\"]\n @personnel.last_name = params[\"last_name\"]\n @personnel.phone_number = params[\"phone_number\"]\n @personnel.title = params[\"title\"]\n @personnel.email = params[\"email\"]\n @personnel.password = params[\"email\"]\n @personnel.admin_name = current_user.fullname\n @personnel.admin_update_time = DateTime.now\n if params[\"is_verified\"].nil?\n @personnel.is_verified = false\n else\n @personnel.is_verified = true\n end\n\n\n respond_to do |format|\n if @personnel.save\n @personnel.user_roles.create(:role_id => params[\"user_role\"][\"user_role_id\"])\n format.html { redirect_to personnel_path(@personnel), notice: 'Personnel was successfully created.' }\n format.json { render :show, status: :created, location: @personnel }\n else\n format.html { render :new }\n format.json { render json: @personnel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(params[:role])\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to edit_role_path(@role), :notice => t('hurricane.notice.create_record_success', :type => t_type) }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @org_role = OrgRole.new(org_role_params)\n\n respond_to do |format|\n if @org_role.save\n format.html { redirect_to @org_role, notice: 'Org role was successfully created.' }\n format.json { render :show, status: :created, location: @org_role }\n else\n format.html { render :new }\n format.json { render json: @org_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n if request.get?\n @role = Role.new\n else\n @role = Role.new(params[:role])\n\n # assign parent role\n if not params[:role][:parent].to_s.empty?\n @role.parent = Role.find(params[:role][:parent].to_i)\n end\n\n if @role.save\n # set the roles's static permissions to the static permission from the parameters \n params[:role][:static_permissions] = [] if params[:role][:static_permissions].nil?\n @role.static_permissions = params[:role][:static_permissions].collect { |i| StaticPermission.find(i) }\n\n # the above should be successful if we reach here; otherwise we \n # have an exception and reach the rescue block below\n flash[:success] = 'Role has been created successfully.'\n redirect_to :action => 'show', :id => @role.id\n else\n render :action => 'create'\n end\n end\n \n rescue ActiveRecord::RecordNotFound\n flash[:error] = 'You sent an invalid request.'\n redirect_to :action => 'list'\n end",
"def create\r\n @role = Role.new(role_params)\r\n @role.save\r\n end",
"def grant_role\n @user = User.find_by_email(params[:email])\n @user.roles.append(Role.find_by_name(params[:role]))\n @user.save\n redirect_to action: :user_list\n end",
"def create_role(client:, **data)\n create_object(type: 'Role', root: url_for(client), data: data)\n end",
"def create\n @lab_role = LabRole.new(params[:lab_role])\n\n respond_to do |format|\n if @lab_role.save\n format.html { redirect_to @lab_role, notice: 'Lab role was successfully created.' }\n format.json { render json: @lab_role, status: :created, location: @lab_role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lab_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(attrs, user = @@default_user)\n @attributes = send_request(\n \"organizations/#{attrs[:organization_id] || attrs['organization_id']}/roles\", :post\n ) do |req|\n req.body = {\n auth_token: user.auth_token\n }.merge(attrs.except(:organization_id, 'organization_id'))\n end\n end",
"def UpdateRole params = {}\n \n APICall(path: 'custom_roles.json',method: 'PUT',payload: params.to_json)\n \n end",
"def add_role\n\n\t\t@roles = Role.new(role_params)\n\t\tif @roles.save\n\t\t\tredirect_to '/details'\n\t\telse\n\t\t\trender 'index'\n\t\tend\n\n\tend",
"def create_role(token, server_id)\n request(\n __method__,\n :post,\n \"#{api_base}/guilds/#{server_id}/roles\",\n nil,\n Authorization: token\n )\n end",
"def create\n @opportunity_role = OpportunityRole.new(opportunity_role_params)\n\n\n @opportunity_role.save\n\n render json: @opportunity_role\n end",
"def edit_roles\n if (@user = find_user(params[:id]))\n begin\n User.transaction(@user) do\n \n roles = params[:user][:roles].collect { |role_id| Role.find(role_id) }\n # add any new roles & remove any missing roles\n roles.each { |role| @user.roles << role if [email protected]?(role) }\n @user.roles.each { |role| @user.roles.delete(role) if !roles.include?(role) }\n\n @user.save\n flash[:notice] = \"Roles updated for user '#{@user.login}'.\"\n end\n rescue\n flash[:warning] = 'Roles could not be edited at this time. Please retry.'\n ensure\n redirect_to :back\n end\n else\n redirect_back_or_default :action => 'list'\n end\n end",
"def create\n @roles_privilege = RolesPrivilege.new(roles_privilege_params)\n\n respond_to do |format|\n if @roles_privilege.save\n format.html { redirect_to @roles_privilege, notice: 'Roles privilege was successfully created.' }\n format.json { render :show, status: :created, location: @roles_privilege }\n else\n format.html { render :new }\n format.json { render json: @roles_privilege.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @title = \"New User\"\n\n @user = User.new\n @user.user_roles.build\n respond_to do |format|\n format.html #new.html.erb\n format.js\n format.json { render json: @user }\n end\n end",
"def roles_path\n @roles_path ||= '/api/v2/roles'\n end",
"def render_create_success\n render json: UserSerializer.new(@resource, include: [:roles]).serialized_json\n end",
"def create\n @role = Role.new role_params\n flash[:notice] = 'Role was successfully created.' if @role.save\n respond_with @role\n end",
"def create\n @employees = params[:employee_ids]\n if @employees.nil?\n flash[:notice] = 'Select Employees.'\n render :new\n else\n @employees.each do |e|\n id = EmployeeShift.create(employee_id: e).id\n EmployeeShiftsShiftRotation.create(shift_rotation_id: params[:employee_shift][:id], employee_shift_id: id)\n end\n flash[:notice] = 'Employee assign successfully.'\n redirect_to new_employee_shift_path\n end\n end",
"def create\n return unless check_permission\n\n @role = Role.new(role_params)\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n else\n @users = User.all\n format.html { render :new }\n end\n end\n end",
"def create\n @user = User.new(params[:user])\n @roles = [Role.find_by_name(params[:user]['role'])]\n @user.person.attributes = (params[:person])\n @user.roles = @roles\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to admin_users_url }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @team = @organization.teams.build(team_params)\n\n respond_to do |format|\n if @team.save\n current_user.add_role :admin, @team\n format.html { redirect_to @team, notice: 'Team was successfully created.' }\n format.json { render :show, status: :created, location: @team }\n else\n format.html { render :new }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def employees_rol_params\n params.require(:employees_rol).permit(:employee_id, :rol_id)\n end",
"def create\n @user_role = UserRole.new(params[:user_role])\n\n respond_to do |format|\n if @user_role.save\n flash[:notice] = 'UserRole was successfully created.'\n format.html { redirect_to([:admin, @user_role]) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def create\n @role = System::Role.new(system_role_params)\n respond_to do |format|\n if @role.save\n format.html { redirect_to system_roles_url, notice: '添加角色成功.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_user\n params[:roles] ||= []\n\n @team = Team.find(params[:id])\n authorize @team, :update?\n\n @user = User.find_or_invite(params[:email])\n\n roles = []\n roles << :admin if params[:roles].include? 'admin'\n roles << :member if params[:roles].include? 'member'\n roles.each do |role|\n @user.add_role role, @team\n end\n\n respond_to do |format|\n if @user.nil?\n format.html { redirect_to @team, notice: 'Could not find user' }\n format.json { render status: :unprocessable_entity }\n elsif roles.empty?\n format.html { redirect_to @team, notice: 'Please select at least one role' }\n format.json { render status: :unprocessable_entity }\n else\n format.html { redirect_to @team, notice: 'User was successfully added.' }\n format.json { head :no_content }\n end\n end\n end",
"def list_employee_roles_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V1EmployeesApi.list_employee_roles ...\"\n end\n if opts[:'order'] && !['ASC', 'DESC'].include?(opts[:'order'])\n fail ArgumentError, 'invalid value for \"order\", must be one of ASC, DESC'\n end\n if !opts[:'limit'].nil? && opts[:'limit'] > 200\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling V1EmployeesApi.list_employee_roles, must be smaller than or equal to 200.'\n end\n\n # resource path\n local_var_path = \"/v1/me/roles\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'batch_token'] = opts[:'batch_token'] if !opts[:'batch_token'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n \n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<V1EmployeeRole>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: V1EmployeesApi#list_employee_roles\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @role = Role.new role_params\n authorize @role\n flash.now[:notice] = 'Role was successfully created.' if @role.save\n respond_with @role\n end",
"def create\n @app_role = AppRole.new(params[:app_role])\n\n respond_to do |format|\n if @app_role.save\n format.html { redirect_to @app_role, notice: 'App role was successfully created.' }\n format.json { render json: @app_role, status: :created, location: @app_role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @app_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @team_user_role = TeamUserRole.new(team_user_role_params)\n\n respond_to do |format|\n if @team_user_role.save\n format.html { redirect_to @team_user_role, notice: 'Team user role was successfully created.' }\n format.json { render :show, status: :created, location: @team_user_role }\n else\n format.html { render :new }\n format.json { render json: @team_user_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @roles_assignment = RolesAssignment.new(roles_assignment_params)\n\n respond_to do |format|\n if @roles_assignment.save\n format.html { redirect_to @roles_assignment, notice: 'Roles assignment was successfully created.' }\n format.json { render :show, status: :created, location: @roles_assignment }\n else\n format.html { render :new }\n format.json { render json: @roles_assignment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = get_role\n flash[:notice] = t('create.success', :scope => get_i18n_scope) if @role.save and not request.xhr?\n respond_with @event, @role, :location => {:action => 'index'}\n end",
"def create\n @movie_role = MovieRole.new(movie_role_params)\n\n respond_to do |format|\n if @movie_role.save\n format.html { redirect_to @movie_role, notice: 'Movie role was successfully created.' }\n format.json { render :show, status: :created, location: @movie_role }\n else\n format.html { render :new }\n format.json { render json: @movie_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_role(name, perms=nil)\n perms ||= []\n role = {\n :name => name,\n :permissions => perms,\n }\n post(\"/roles\", role)\n end",
"def create\n @token = params[:invite_token]\n if @token.nil?\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Employee cannot be created.' }\n format.json { render :show, status: :unprocessable_entity, location: @employee }\n end\n else\n @employee = User.new(user_params)\n @employee.role = Employee.new(employee_params)\n @employee.role.shipping_address = Address.new(shipping_address_params)\n @employee.role.billing_address = Address.new(billing_address_params)\n\n @invitation = Invite.find_by token: @token\n @employee.role.business = @invitation.business\n\n Employee.transaction do\n User.transaction do\n Address.transaction do\n @employee.role.shipping_address.save!\n @employee.role.billing_address.save!\n @employee.role.save!\n @employee.save!\n end\n end\n end\n\n respond_to do |format|\n if @employee.persisted?\n format.html { redirect_to root_path, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def index\n @roles = Role.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @roles }\n end\n end",
"def create_role(role_name, data = {})\n raise Auth0::MissingParameter, 'Must supply a valid role_name' if role_name.to_s.empty?\n\n data[:name] = role_name\n post roles_path.to_s, data\n end",
"def user_roles=(value)\n roles[:user_roles]=value\n end",
"def create\n @account = Account.new(alumnis_params)\n\n respond_to do |format|\n if @account.save\n @account.add_role 'alumni'\n format.html { redirect_to admin_accounts_alumnis_path, notice: 'Alumni was successfully created.' }\n format.json { render :show, status: :created, location: @account }\n else\n format.html { render :new }\n format.json { render json: @account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(params[:role])\n\n @perms = params[:permissions[\"permissions\"]]\n if @perms != nil\n @permissions = @perms[\"permissions\"]\n end\n #logger.debug \"PERMISSIONS: #{@permissions.inspect}\"\n if @permissions == nil\n @role.read = 0\n @role.write = 0\n @role.execute = 0\n end\n if @permissions != nil\n if @permissions.include?(\"read\")\n @role.read = 1\n else\n @role.read = 0\n end\n if @permissions.include?(\"write\")\n @role.write = 1\n else\n @role.write = 0\n end\n if @permissions.include?(\"execute\")\n @role.execute = 1\n else\n @role.execute = 0\n end\n end\n \n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: t(:role_created) }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @role = Role.create(params[:role])\n\n if @role.errors.empty?\n flash['notice'] = \"Role #{@role.display_name} added\"\n redirect_to :action => 'list'\n else\n flash['notice'] = @role.errors.full_messages.pop\n redirect_to :action => 'add'\n end\n \n end",
"def update\n @user.roles=params[\"user\"][\"roles\"]\n respond_to do |format|\n if @user.update(event_params)\n format.html { redirect_to users_path, notice: 'User roles change successfully' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @consultant_role = ConsultantRole.new(params[:consultant_role])\n\n respond_to do |format|\n if @consultant_role.save\n format.html { redirect_to consultant_roles_path(:search_id => params[:consultant_role][:search_id]), notice: \"#{@consultant_role.employee.full_name} was successfully added to this search.\" }\n format.json { render json: @consultant_role, status: :created, location: @consultant_role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @consultant_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @required_role = RequiredRole.new(required_role_params)\n\n respond_to do |format|\n if @required_role.save\n format.html { redirect_to @required_role, notice: 'Required role was successfully created.' }\n format.json { render :show, status: :created, location: @required_role }\n else\n format.html { render :new }\n format.json { render json: @required_role.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7080383",
"0.68218297",
"0.6687899",
"0.6650206",
"0.6552826",
"0.6469759",
"0.6410619",
"0.6390163",
"0.63549286",
"0.63196176",
"0.6303331",
"0.63011956",
"0.62763643",
"0.6245801",
"0.6241004",
"0.62396085",
"0.62288684",
"0.62150186",
"0.61875415",
"0.61672366",
"0.6143499",
"0.61298454",
"0.61074317",
"0.608096",
"0.6078557",
"0.60702324",
"0.6053368",
"0.6043691",
"0.6035371",
"0.6033386",
"0.6033386",
"0.6033386",
"0.60221165",
"0.6005963",
"0.60053664",
"0.5999681",
"0.59890425",
"0.5984973",
"0.59783155",
"0.59752834",
"0.5961685",
"0.5914563",
"0.59098417",
"0.5905569",
"0.59039545",
"0.58713984",
"0.5863694",
"0.5862447",
"0.58517236",
"0.58505493",
"0.5842128",
"0.58346105",
"0.5832247",
"0.5831476",
"0.5827779",
"0.58259517",
"0.5825934",
"0.58148193",
"0.5811945",
"0.58111626",
"0.57972926",
"0.5794012",
"0.57916296",
"0.5787597",
"0.5777283",
"0.575786",
"0.5755019",
"0.5753675",
"0.5753068",
"0.57529455",
"0.5747187",
"0.57414705",
"0.57349753",
"0.5727864",
"0.57088315",
"0.569993",
"0.5693711",
"0.56923753",
"0.5692212",
"0.56903833",
"0.5686061",
"0.56821394",
"0.5678935",
"0.56775516",
"0.56655836",
"0.5661484",
"0.5653355",
"0.5645181",
"0.5644874",
"0.5641101",
"0.5626152",
"0.5619134",
"0.5616266",
"0.56112677",
"0.5605993",
"0.5590666",
"0.558671",
"0.5583942",
"0.5579583",
"0.55763364"
] | 0.7312509 | 0 |
DELETE /employees_roles/1 DELETE /employees_roles/1.json | def destroy
@employees_role.disable!
redirect_to employees_roles_path, :alert => "Employees_Roles disabled."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @company = Company.find(params[:company_id])\n @role = Role.find(params[:id])\n @role.destroy\n \n respond_to do |format|\n format.html { redirect_to company_roles_path(@company) }\n format.json { head :no_content }\n end\n end",
"def destroy\n chef_server_rest.delete(\"roles/#{@name}\")\n end",
"def destroy\n @admin_role = Role.find(params[:id])\n @admin_role.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lab_role = LabRole.find(params[:id])\n @lab_role.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to company_roles_url(@company), notice: 'Role was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n \n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = @client.roles.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n flash[:notice] = 'Role was successfully removed.' \n format.html { redirect_to(client_roles_url(@client)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n role.destroy\n respond_to do |format|\n format.html { redirect_to admin_roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def DeleteRole id\n \n APICall(path: \"custom_roles/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\n @rol.destroy\n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if !grant_access(\"alter_roles\", current_user)\n head(403)\n end\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @app_role = AppRole.find(params[:id])\n @app_role.destroy\n\n respond_to do |format|\n format.html { redirect_to app_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employees_rol.destroy\n respond_to do |format|\n format.html { redirect_to employees_rols_url, notice: 'Employees rol was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n Tools.write2log(current_user.id, 'Удаление', 'Сотрудники', 0, '# ' + @employee.id.to_s)\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee = current_owner.employees.find(params[:id])\n @employee.destroy\n\n respond_to do |format|\n format.html { redirect_to employees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entity_role.destroy\n respond_to do |format|\n format.html { redirect_to entity_roles_url, notice: 'Entity role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @core_user_role.destroy\n respond_to do |format|\n format.html { redirect_to core_user_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to system_roles_url, notice: '删除角色成功.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @roles_and_permission = @roles.roles_and_permission.find(params[:id])\n @roles_and_permission.destroy\n\n respond_to do |format|\n format.html { redirect_to roles_and_permissions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to management_roles_url, notice: 'Perfil was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consultant_role = ConsultantRole.find(params[:id])\n emp_name = @consultant_role.employee.full_name\n @consultant_role.destroy\n\n respond_to do |format|\n format.html { redirect_to consultant_roles_url, :notice => \"#{emp_name} has been removed from the search.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee = Employee.find(params[:id])\n @employee.destroy\n\n respond_to do |format|\n format.html { redirect_to employees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee = Employee.find(params[:id])\n @employee.destroy\n\n respond_to do |format|\n format.html { redirect_to employees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee = Employee.find(params[:id])\n @employee.destroy\n\n respond_to do |format|\n format.html { redirect_to employees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee = Employee.find(params[:id])\n @employee.destroy\n\n respond_to do |format|\n format.html { redirect_to employees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n format.html { redirect_to roles_url , :notice => t('hurricane.notice.delete_record_success', :type => t_type)}\n format.json { head :no_content }\n end\n end",
"def destroy\n @team_role.destroy\n respond_to do |format|\n format.html { redirect_to lab_team_roles_path(@lab) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @users_role.destroy\n respond_to do |format|\n format.html { redirect_to users_roles_url, notice: 'Users role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lab_permissions_role = LabPermissionsRole.find(params[:id])\n @lab_permissions_role.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_permissions_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ministerial_role.destroy\n respond_to do |format|\n format.html { redirect_to ministerial_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_employee.destroy\n respond_to do |format|\n format.html { redirect_to [:admin, @admin_employee], notice: 'Employee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @master_role.destroy\n respond_to do |format|\n format.html { redirect_to master_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_with @role, location: roles_path\n end",
"def destroy\n @role.destroy\n respond_with @role, location: roles_path\n end",
"def destroy\n @required_role.destroy\n respond_to do |format|\n format.html { redirect_to required_roles_url, notice: 'Required role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find params[:user_id]\n @role = Role.find params[:id]\n\n @user.roles.delete @role\n flash[:notice] = 'Assigment was successfully destroyed.'\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user = User.find(params[:user_id])\n @role = Role.find(params[:id])\n if @user.has_role?(@role.name)\n @user.roles.delete(@role)\n end\n respond_to do |format|\n format.html {redirect_to :action => 'index' }\n format.xml { head :ok }\n end\n \n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to user_roles_path }\n format.js\n format.json { head :no_content }\n end\n end",
"def destroy\n @venue_role.destroy\n respond_to do |format|\n format.html { redirect_to venue_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n format.html { redirect_to(roles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n format.html { redirect_to(roles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @org_role.destroy\n respond_to do |format|\n format.html { redirect_to org_roles_url, notice: 'Org role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deleteEntityEmployee( 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/employee\",params)\n end",
"def destroy\r\n @role.destroy\r\n respond_to do |format|\r\n format.html { redirect_to \"index\", notice: 'Role was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @sulabh_user_role.destroy\n respond_to do |format|\n format.html { redirect_to sulabh_user_roles_url, notice: 'Sulabh user role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employe = Employe.find(params[:id])\n @employe.destroy\n\n respond_to do |format|\n format.html { redirect_to employes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mg_role.destroy\n respond_to do |format|\n format.html { redirect_to mg_roles_url, notice: 'Mg role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n \n @users = User.find_by_role_id(@role.id)\n respond_to do |format|\n if @users == nil\n @role.destroy\n format.html { redirect_to roles_url, :notice => t(:role_deleted) }\n format.json { head :no_content }\n else\n format.html { redirect_to roles_url, :alert => t(:role_inuse) }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @hisd_employee = HisdEmployee.find(params[:id])\n @hisd_employee.destroy\n\n respond_to do |format|\n format.html { redirect_to hisd_employees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @roles_privilege.destroy\n respond_to do |format|\n format.html { redirect_to roles_privileges_url, notice: 'Roles privilege was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n respond_with(@role)\n end",
"def destroy\n @admin_role_ref.destroy\n respond_to do |format|\n format.html { redirect_to admin_role_refs_url, notice: 'Admin role ref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employ = Employ.find(params[:id])\n @employ.destroy\n\n respond_to do |format|\n format.html { redirect_to employs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @individual_role_record = IndividualRoleRecord.find(params[:id])\n @individual_role_record.destroy\n\n respond_to do |format|\n format.html { redirect_to individual_role_records_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_role = UserRole.find(params[:id])\n @user_role.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_roles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @operations_role = OperationsRole.find(params[:id])\n @operations_role.destroy\n\n respond_to do |format|\n format.html { redirect_to(operations_roles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @userrole = Userrole.find(params[:id])\n @userrole.destroy\n\n respond_to do |format|\n format.html { redirect_to(userroles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cms_role.destroy\n respond_to do |format|\n format.html { redirect_to cms_roles_url, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n @role = get_role\n respond_with @event, @role\n end",
"def destroy\n @company = Company.find(params[:company_id]) \n @employee = @company.employees.find(params[:id])\n \n @employee.destroy\n respond_to do |format|\n format.html { redirect_to company_employees_url, notice: 'Employee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scheduled_employee = ScheduledEmployee.find(params[:id])\n @scheduled_employee.destroy\n\n respond_to do |format|\n format.html { redirect_to employees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @movie_role.destroy\n respond_to do |format|\n format.html { redirect_to movie_roles_url, notice: 'Movie role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @team_user_role.destroy\n respond_to do |format|\n format.html { redirect_to team_user_roles_url, notice: 'Team user role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role_user = RoleUser.find(params[:id])\n @role_user.destroy\n\n respond_to do |format|\n format.html { redirect_to(role_users_url) }\n format.xml { head :ok }\n format.json { render :text => '{status: \"success\"}'}\n end\n end",
"def destroy\n @role_auth_ref.destroy\n respond_to do |format|\n format.html { redirect_to role_auth_refs_url, notice: 'Role auth ref was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @opportunity_role = OpportunityRole.find(params[:id])\n @opportunity_role.destroy\n\n head :no_content\n end",
"def destroy\n @user_role = UserRole.find(params[:id])\n @user_role.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_user_roles_url) }\n end\n end",
"def destroy\n @role_user = RolesUser.find(params[:id])\n @role_user.destroy\n\n respond_to do |format|\n format.html { redirect_to(roles_users_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_path, notice: 'Employee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee_master.destroy\n respond_to do |format|\n format.html { redirect_to employee_masters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employe.destroy\n respond_to do |format|\n format.html { redirect_to employes_path(api_id: @employe.organisme_id), notice: 'Employe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url, notice: 'Employee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url, notice: 'Employee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url, notice: 'Employee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url, notice: 'Employee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url, notice: 'Employee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url, notice: 'Employee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url, notice: 'Employee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url, notice: 'Employee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url, notice: 'Employee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url, notice: 'Employee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url, notice: 'Employee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url, notice: 'Employee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @employee.destroy\n respond_to do |format|\n format.html { redirect_to employees_url, notice: 'Employee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.71176326",
"0.70981854",
"0.7010913",
"0.7004338",
"0.69940305",
"0.6977842",
"0.69690055",
"0.69353807",
"0.6933423",
"0.6915135",
"0.69101447",
"0.6894705",
"0.68750685",
"0.68716884",
"0.6841944",
"0.6835002",
"0.68312514",
"0.6824029",
"0.68176633",
"0.6806977",
"0.679789",
"0.6794484",
"0.67939526",
"0.67926514",
"0.6786173",
"0.6786173",
"0.6786173",
"0.6786173",
"0.6786173",
"0.6786173",
"0.6786173",
"0.6783066",
"0.6783066",
"0.6783066",
"0.6783066",
"0.6779703",
"0.676848",
"0.67524946",
"0.67524946",
"0.67524946",
"0.67524946",
"0.67524946",
"0.67524946",
"0.6741837",
"0.67384785",
"0.67351556",
"0.67175967",
"0.6710549",
"0.66979706",
"0.66979706",
"0.6697046",
"0.6682289",
"0.66782653",
"0.6668986",
"0.6668374",
"0.66606694",
"0.66606694",
"0.66513294",
"0.66252375",
"0.6623257",
"0.6623186",
"0.66069984",
"0.66038454",
"0.66025686",
"0.6592339",
"0.65791774",
"0.65719205",
"0.65686136",
"0.6567062",
"0.6559016",
"0.65523905",
"0.65478194",
"0.65447265",
"0.653515",
"0.6534987",
"0.65342355",
"0.6531461",
"0.6530273",
"0.65244305",
"0.65166986",
"0.65135676",
"0.6513082",
"0.65120864",
"0.65092933",
"0.6502243",
"0.6501896",
"0.65017927",
"0.6501564",
"0.6496384",
"0.6495673",
"0.64950174",
"0.64950174",
"0.64950174",
"0.64950174",
"0.64950174",
"0.64950174",
"0.64950174",
"0.64950174",
"0.64950174",
"0.64950174",
"0.64950174"
] | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def employees_role_params
params.require(:employees_role).permit!
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 |
clean up the filters so only valid ones exist | def clean_filters
cleaned_filters = {}
self.filters.each do |name, value|
if (self.filter_options[name.to_sym][:fields].detect{|f| f[:value] == value } rescue false)
cleaned_filters[name.to_sym] = value
end
end
self.filters = cleaned_filters
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_filters\n params = instance_values.symbolize_keys\n filters = clean_params(params)\n validate_filters(filters)\n end",
"def remove_filters!\n @filters = []\n end",
"def filters; end",
"def filters; end",
"def set_filters\n @filters = ''\n @filters.concat(\"status:'Available'\")\n unless @manufacturer_or_publisher.blank?\n @filters.concat(\" AND (manufacturer:'#{@manufacturer_or_publisher}'\")\n @filters.concat(\" OR publisher:'#{@manufacturer_or_publisher}')\")\n end\n @filters.concat(\" AND category:'#{@category}'\") unless @category.blank?\n @filters.concat(\" AND seller_name:'#{@seller_name}'\") unless @seller_name.blank?\n end",
"def validate_filters(filter_params)\n validate\n filter_params.delete_if { |key| errors.include?(key) }\n end",
"def validate_filter\n ensure_filter_only_attributes\n ensure_no_unsupported_filters\n end",
"def filters\n end",
"def reset_filters\n @_filters = []\n end",
"def reset\n all_filters.each(&:reset)\n validate\n end",
"def validate_filter!(filters)\n filters.each_key do |key|\n # FIXME: real exception\n raise \"Bad key #{key} in Chef::NodeMap filter expression\" unless VALID_OPTS.include?(key)\n end\n end",
"def filters\n @filters ||= {}\n end",
"def filter; end",
"def filter; end",
"def filter; end",
"def strict_filters; end",
"def filters=(_arg0); end",
"def filters=(_arg0); end",
"def filter\n end",
"def filter!; end",
"def populate_filters(_inputs)\n super.tap do\n self.class.filters.each do |name, filter|\n next if given?(name)\n\n model_field = self.class.model_field_cache_inverse[name]\n next if model_field.nil?\n\n value = public_send(model_field)&.public_send(name)\n public_send(\"#{name}=\", filter.clean(value, self))\n end\n end\n end",
"def allowed_filters\n []\n end",
"def preprocess_data\n # Remove things if needed\n if @filter_keys\n @input = @input.delete_if{|k, v| !@filter_keys.include?(k)}\n end\n end",
"def prune_filters(facets) \n [[userdatacats, \"Categorical\"], [userdataconts, \"Continuous\"], [userdatabins, \"Binary\"]].each do |filters, filter_type|\n to_remove = []\n filters.each do |filter|\n matching_facet = facets.find do |facet| \n facet.feature_type == filter_type and facet.name == filter.name and facet.active \n end\n if matching_facet.nil? \n to_remove << filter\n end\n end\n to_remove.each { |filter| filters.delete(filter) }\n end\n end",
"def apply_filter\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def strict_filters=(_arg0); end",
"def filters\n @filters ||= {}\n end",
"def filters\n @filters ||= {}\n end",
"def clear_filters\n\t\t@filters = []\n\t\treturn self\n\tend",
"def add_filters(filters); end",
"def parse_filters(params)\n if params['filters'].blank?\n Utilities::Geo::REGEXP_COORD.keys\n else\n params.permit(filters: [])[:filters].map(&:to_sym)\n end\n end",
"def filter_fields\n\t \n\t \tremove_attribute(:version)\n\t \tremove_attribute(:op_success)\n\t \tattributes\n\n\t \t\n\t end",
"def filter_fields\n\t \n\t \tremove_attribute(:version)\n\t \tremove_attribute(:op_success)\n\t \tattributes\n\n\t \t\n\t end",
"def ResetFilters\n @filters = []\n @anchor = []\n end",
"def set_filters\n @filters = []\n section_ids = Section.pluck(:id)\n\n [:ministers, :departments].each do |filter_type|\n if params[filter_type].present?\n id_list = params[filter_type].map(&:to_i)\n\n id_list.reject! do |item|\n !section_ids.include? item\n end\n\n @filters += Section.where(id: id_list)\n end\n end\n end",
"def validate_query_filters\n super\n\n or_filters.each_key do |field|\n if values_for(field)\n case type_for(field)\n when :integer\n add_filter_error(field, :invalid, true) if or_values_for(field).detect {|v| v.present? && !v.match(/\\A[+-]?\\d+(,[+-]?\\d+)*\\z/) }\n when :float\n add_filter_error(field, :invalid, true) if or_values_for(field).detect {|v| v.present? && !v.match(/\\A[+-]?\\d+(\\.\\d*)?\\z/) }\n when :date, :date_past\n case or_operator_for(field)\n when \"=\", \">=\", \"<=\", \"><\"\n add_filter_error(field, :invalid, true) if or_values_for(field).detect {|v|\n v.present? && (!v.match(/\\A\\d{4}-\\d{2}-\\d{2}(T\\d{2}((:)?\\d{2}){0,2}(Z|\\d{2}:?\\d{2})?)?\\z/) || parse_date(v).nil?)\n }\n when \">t-\", \"<t-\", \"t-\", \">t+\", \"<t+\", \"t+\", \"><t+\", \"><t-\"\n add_filter_error(field, :invalid, true) if or_values_for(field).detect {|v| v.present? && !v.match(/^\\d+$/) }\n end\n end\n end\n\n add_filter_error(field, :blank, true) unless\n # filter requires one or more values\n (or_values_for(field) and !or_values_for(field).first.blank?) or\n # filter doesn't require any value\n [\"o\", \"c\", \"!*\", \"*\", \"t\", \"ld\", \"w\", \"lw\", \"l2w\", \"m\", \"lm\", \"y\", \"*o\", \"!o\"].include? or_operator_for(field)\n end if or_filters && or_filters.respond_to?(:each_key)\n end",
"def validate_filter()\n filter_module = (RUBY_VERSION < '1.9') ? params[:filter] : params[:filter].to_sym\n if (params.key?(:filter) && @source::Filters::constants.include?(filter_module))\n @filter = \"#{@source.name}::Filters::#{params[:filter]}\".constantize\n else\n redirect_to root_path\n end\n end",
"def filter_collection!\n return if filtering_params.blank?\n\n filtering_params.each do |key, value|\n filter_key = \"filter_#{key}\"\n next if value.blank? || !collection.respond_to?(filter_key)\n\n self.collection = collection.public_send(filter_key, value)\n end\n end",
"def reset_filter_params\n params[:search] = nil\n params[:status] = nil\n params[:unassigned] = nil\n params[:assigned_to_me] = nil\n params[:needs_attention] = nil\n params[:year] = nil\n end",
"def clear_filter\n @filter_string = ''\n @found_count = -1\n model.refilter\n filter\n end",
"def filters\n\t\t@filters_array = Array(@profile[:filters]) unless(@filters_array)\n\t\t@filters_array.each do |filter|\n\n\t\t\tif respond_to?( \"filter_#{filter}\" )\n\t\t\t\[email protected] do |field|\n\t\t\t\t\t# If a key has multiple elements, apply filter to each element\n\t\t\t\t\t@field_array = Array( @form[field] )\n\n\t\t\t\t\tif @field_array.length > 1\n\t\t\t\t\t\t@field_array.each_index do |i|\n\t\t\t\t\t\t\telem = @field_array[i]\n\t\t\t\t\t\t\t@field_array[i] = self.send(\"filter_#{filter}\", elem)\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tif not @form[field].to_s.empty?\n\t\t\t\t\t\t\t@form[field] = self.send(\"filter_#{filter}\", @form[field].to_s)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@form\n\tend",
"def ensure_filters\n # private_methods returns the list of private methods accessible to obj. If the all parameter is set to\n # false, only those methods in the receiver will be listed.\n private_methods(false).grep(/\\Afilter_by_/)&.each { |filter| send(filter) }\n end",
"def filter!(filter)\n # {:scope => :transaction, :merchant => { :matcher => 'ATM WITHDRAWAL' }}\n # {:scope => :collection, :name => :credit_card_payments }\n @transactions.reject! do |t|\n t.send(filter[:field]).downcase == filter[:matcher].downcase\n end\n end",
"def filter_params\n @filter_params_cache ||= clean_hash(params[:filter]).with_indifferent_access\n end",
"def normalize_params(params)\n # filters\n conditions = params[:filter] && convert_filters(params[:filter])\n \n normalized_conditions = {}\n conditions && conditions.each_pair do |k, v|\n normalized_conditions.merge!(k.gsub(\"__\", \"_\") => v)\n end\n \n {:conditions => normalized_conditions}\n end",
"def enforce_filter_order(filters)\n if self.class.const_defined?(:FILTER_ORDER)\n self.class.const_get(:FILTER_ORDER).map do |field|\n filters.detect { |f| f.field.to_s == field }\n end.compact\n else\n filters\n end\n end",
"def validate\n active_filters.each {|f| f.validate}\n @errors = active_filters.reject(&:valid?).collect {|f| \"#{f.label}: #{f.error}\"}\n @conditions = Sanitizer.send(:merge_conditions, *(active_filters.collect(&:condition)))\n valid?\n end",
"def html_clean_filters( src_key, tree_key = nil )\n\n tree_key = \"#{src_key}_tree\".to_sym unless tree_key\n src_key, tree_key = src_key.to_k, tree_key.to_k\n\n filters = []\n filters << html_parse_filter( src_key, tree_key )\n\n #FIXME: PAGE: filters << TitleExtractor.new, or after?\n\n # FIXME: if src is text, last filter\n # filters << TextCtrlWSFilter.new( ContentKeys::TITLE )\n\n tfc = TreeFilterChain.new( html_tree_filters )\n\n filters << HTMLTreeFilter.new( tree_key, tfc,\n HTMLTreeFilter::Order::DEPTH_FIRST )\n\n #FIXME: First block extractor back to text key?\n\n filters\n end",
"def prepare_filters(input, setup = @valid_filters)\n input = input.keys_to_symbols\n (setup.keys & input.keys).inject({}) do |prepared, filter|\n # TODO if we ever do more complex filters (eg multiple ids, where logically they're stored as a list but go\n # back to a csv string for display), this is where we do it\n prepared.merge(filter => input[filter])\n end\n end",
"def clear_instance_filters\n instance_filters.clear\n end",
"def initialize\n @all_filters = []\n @errors = []\n @conditions = nil\n filters\n reset\n end",
"def filtered_parameters; end",
"def validate_filters_clause(errors)\n errors\n end",
"def clean_filter(value)\n value = @filters[value] if value.is_a? Symbol\n ActiveRecord::Type::Boolean.new.cast(value)\n end",
"def filters_must_be_formatted\n return unless filters\n\n begin\n formatted = JSON.parse(filters)\n formatted.each do |f|\n if !f.is_a?(Hash)\n errors.add(:filters, 'Incorrect format')\n elsif f['name'].blank?\n errors.add(:filters, 'No field defined')\n elsif f['values'].blank? && (f['to'].blank? || f['from'].blank?)\n errors.add(:filters, \"Column #{f['name']} has incorrect values\")\n end\n end\n rescue\n errors.add(:filters, 'Error parsing the filters')\n end\n end",
"def filters_must_be_formatted\n if filters\n begin\n formatted = JSON.parse(filters)\n formatted.each do |f|\n unless f.is_a?(Hash)\n errors.add(:filters, 'Incorrect format')\n else\n if f['name'].blank?\n errors.add(:filters, 'No field defined')\n else\n if f['values'].blank? && (f['to'].blank? || f['from'].blank?)\n errors.add(:filters, \"Column #{f['name']} has incorrect values\")\n end\n end\n end\n end\n rescue\n errors.add(:filters, 'Error parsing the filters')\n end\n end\n end",
"def process_filters(search_opts = {})\n filter_str = ''\n if search_opts['filter']\n search_opts['filter'].each do |f|\n filter_str = \"#{filter_str} AND #{f}\"\n end\n search_opts.delete('filter')\n end\n filter_str\n end",
"def set_filters(value)\n valid = []\n value.each do |filter|\n if (!filter['name'].blank? && !filter['to'].blank? && !filter['from'].blank?)\n valid << filter\n elsif (filter['name'] && filter['values'])\n # Hack to accept both an array of values or a JSON\n filter['values'] = if filter['values'].is_a? String\n JSON.parse(filter['values'])\n else\n filter['values']\n end\n valid << filter\n end\n end\n self.write_attribute :filters, valid.to_json\n end",
"def get_feed_filters\n filters = self.filters.to_h.reject{ |k, _v| PROHIBITED_FILTERS.include?(k.to_s) }\n filters.merge!({ 'report_status' => ['published'] }) if self.published\n filters\n end",
"def set_filters\n @filters ||= begin\n filters = []\n filters << { attribute: Gemgento::ProductAttribute.find_by!(code: 'color'), value: params[:color] } unless params[:color].blank?\n filters\n end\n end",
"def filter_items\n @filter_items ||= []\n end",
"def filters_halted\n end",
"def filter_proc(filters = {})\n lambda do |p|\n (filters[:name].nil? || p.name =~ filters[:name]) &&\n (filters[:appid_name].nil? || p.app_id_name =~ filters[:appid_name]) &&\n (filters[:appid].nil? || p.entitlements.app_id =~ filters[:appid]) &&\n (filters[:uuid].nil? || p.uuid =~ filters[:uuid]) &&\n (filters[:team].nil? || p.team_name =~ filters[:team] || p.team_ids.any? { |id| id =~ filters[:team] }) &&\n (filters[:exp].nil? || (p.expiration_date < DateTime.now) == filters[:exp]) &&\n (filters[:has_devices].nil? || !(p.provisioned_devices || []).empty? == filters[:has_devices]) &&\n (filters[:all_devices].nil? || p.provisions_all_devices == filters[:all_devices]) &&\n (filters[:aps_env].nil? || match_aps_env(p.entitlements.aps_environment, filters[:aps_env])) &&\n true\n end\n end",
"def set_filter(opts)\n opts = check_params(opts,[:filters])\n super(opts)\n end",
"def validate_filter(filter)\r\n # Each field in the filter array must be a valid fieldname in the\r\n # table.\r\n filter.each { |f|\r\n raise 'Invalid field name: %s in filter!' % f unless \\\r\n @field_names.include?(f)\r\n }\r\n end",
"def set_filters\n filter_param_keys = [\n 'brand', 'color',\n 'size', 'department', 'keywords'\n ]\n @filters = []\n filter_param_keys.each do |key|\n if !params[key].blank?\n params[key].split(',').each do |val|\n @filters << {:key => key, :val => val}\n end\n end\n end\n \n \n if params[:price]\n params[:price].split(',').each_slice(2).to_a.each do |range|\n @filters << {:key => 'price', :val => range.join(',')}\n end\n end\n\n if @products\n @brands = @products.facet('brand_facet').rows.sort_by{ |brand| brand.value.capitalize}\n @departments = @products.facet('department_facet').rows\n end\n \n @colors = ['green', 'blue', 'purple', 'red', 'pink', 'beige', 'brown', 'yellow', 'orange', 'black', 'white', 'gray', 'teal', 'glowing', 'gold', 'silver']\n \n if [email protected]? && @taxon.has_size?\n sizes = (Spree::Product.sizes.sort_by{|size| size.position}.map(&:presentation) & @products.facet(\"size_facet\").rows.map(&:value))\n end\n end",
"def validate_filterrific_available_filters\n if filterrific_available_filters.blank?\n raise(ArgumentError, \":available_filters can't be empty\")\n end\n end",
"def filter *filters\n spawn :@filters, @filters + parse_filter_input(filters)\n end",
"def strip_unwanted!(filter)\n substitute!(filter, '')\n end",
"def global_filter; end",
"def apply_filters(entries, filters)\n filters.each{\n |filter|\n parts = filter.split(\"=\")\n \n # Determine if the filter is joined with a '=' or '!='\n last_char=parts[0][-1,1]\n if last_char == \"!\"\n test_equals = false\n key = parts[0][0, parts[0].length()-1]\n match = parts[1]\n else\n test_equals = true\n key = parts[0]\n match = parts[1]\n end\n \n entries.each{\n |e, entry|\n # Find the key value in entry, or nil if it doesn't exist\n value = find_entry_setting(entry, key)\n \n # Calculate if the returned value matches the filter value\n if value.is_a?(Array)\n is_equal = false\n value.each{\n |v|\n if is_value_match?(v, match)\n is_equal = true\n end\n }\n else\n is_equal = is_value_match?(value, match)\n end\n \n # Delete the entry if the result of the match check isn't what\n # the filter is looking for\n if is_equal != test_equals\n entries.delete(e)\n end\n }\n }\n \n return entries\n end",
"def filter\n super\n end",
"def initialize_available_filters\n @@available_filters ||= {}\n end",
"def filter\n\tfilter_disabled\n\tfilter_repeated\n\tfilter_silenced\n\tfilter_dependencies\n end",
"def liquid_filters\n [\n StylesheetFilter,\n JavascriptFilter,\n AssignToFilter,\n LinkToFilter,\n GoogleAnalyticsFilter,\n GoogleWebmasterToolsFilter,\n GoogleJavascriptFilter,\n TextileFilter,\n DesignResourceFilter,\n AttributeFilter,\n ResourceFilter,\n NodeFilter,\n FormFilter\n ]\n end",
"def except *filter_list\n filter.except filter_list\n self\n end",
"def clear_filters\n Native.sd_journal_flush_matches(@ptr)\n end",
"def ensure_facet_filters_are_unique\n duplicate_ids = find_duplicates(self.get_facet_identifiers)\n duplicate_filters = find_duplicates(self.get_filter_values)\n if duplicate_ids.any? || duplicate_filters.any?\n errors.add(:facet_filters, \"contains duplicated identifiers/filters: #{[duplicate_ids, duplicate_filters].flatten.compact.join(', ')}\")\n end\n end",
"def filters\n unless @filters\n @filters = {}\n return @filters unless @params[:f_inclusive] && @params[:f_inclusive].respond_to?(:each_pair)\n @params[:f_inclusive].each_pair do |field, value_array|\n @filters[field] ||= value_array.dup\n end\n end\n @filters\n end",
"def acceptable_filter_scopes\n []\n end",
"def filters=( args )\n @filters.clear\n add_filters(*args)\n end",
"def filter_shows(links)\n\t\t\[email protected] do |f| # Apply each filter\n\t\t\t\tnew_links = links.reject { |name, _link| f.(name) }\n\t\t\t\t# Stop if the filter removes every release\n\t\t\t\tbreak if new_links.size == 0\n\n\t\t\t\tlinks = new_links\n\t\t\tend\n\n\t\t\tlinks\n\t\tend",
"def validate_and_sanitize\n r = validate\n return r unless r.success?\n\n r = fetch_and_validate_client\n return r unless r.success?\n\n r = fetch_and_validate_admin\n return r unless r.success?\n\n error_codes = []\n\n if @sortings.present?\n @sortings.each do |sort_key, sort_value|\n next if sort_value.blank? || GlobalConstant::User.sorting[sort_key].blank?\n allowed_sort_values = GlobalConstant::User.sorting[sort_key].keys\n if allowed_sort_values.include?(sort_value)\n @allowed_sortings[sort_key] = sort_value\n else\n error_codes << 'invalid_sortings'\n break\n end\n end\n end\n\n @sortings = @allowed_sortings.present? ? @allowed_sortings : GlobalConstant::User.default_sorting\n\n @filters = {} if @filters.blank?\n\n if Util::CommonValidateAndSanitize.is_hash?(@filters)\n\n @filters.each do |filter_key, filter_val|\n next if filter_val.blank?\n\n if GlobalConstant::User.allowed_filter.include?(filter_key)\n allowed_filter_val = []\n\n if filter_key == GlobalConstant::User.email_filter\n allowed_filter_val = [filter_val]\n else\n allowed_filter_val = GlobalConstant::User.filters[filter_key].keys\n end\n\n if allowed_filter_val.include?(filter_val)\n @allowed_filters[filter_key] = filter_val.to_s\n else\n error_codes << 'invalid_filters'\n end\n\n end\n end\n\n else\n error_codes << 'invalid_filters'\n end\n\n error_codes.uniq!\n\n return error_with_identifier('invalid_api_params',\n 'um_u_l_vasp_1',\n error_codes\n ) if error_codes.present?\n\n\n success\n\n end",
"def filter_parameters=(_arg0); end",
"def filter_parameters=(_arg0); end",
"def filter_illegal_changes\n return unless params[:description].is_a?(ActionController::Parameters)\n\n root = in_admin_mode?\n admin = @description.is_admin?(@user)\n author = @description.author?(@user)\n\n params[:description].delete(:source_type) unless root\n unless root ||\n ((admin || author) &&\n # originally was\n # (desc.source_type != \"project\" &&\n # desc.source_type != \"project\"))\n # see https://www.pivotaltracker.com/story/show/174566300\n @description.source_type != \"project\")\n params[:description].delete(:source_name)\n end\n params[:description].delete(:license_id) unless root || admin || author\n end",
"def parameters_to_filter\n @parameters_to_filter ||= []\n end",
"def available_filters\n unless @available_filters\n initialize_available_filters\n @available_filters.each do |field, options|\n options[:name] ||= l(options[:label] || \"field_#{field}\".gsub(/_id$/, ''))\n end\n end\n @available_filters\n end",
"def apply_global_filters(query, filter_params)\n value = filter_params[:filter][999.to_s] rescue nil\n\n return query if value.blank?\n\n queries = []\n values = []\n\n # iterate over all filter inputs\n ajax_filters.each do |filter|\n next if filter.blank?\n next if filter.having.present?\n\n query, q, v = apply_filter(query, filter, value)\n\n next if q.blank?\n\n queries += Array(q)\n values += Array(v) unless v.nil?\n end\n\n query.where(queries.join(' OR '), *values)\n end",
"def filtered_entries; end",
"def filter(new_filters)\n new_filters = JSON.parse(new_filters) if new_filters.is_a?(String)\n if filters = query['_filter']\n filters = JSON.parse(filters)\n filters = [filters] unless filters.is_a?(Array)\n filters.push(new_filters)\n else\n filters = new_filters\n end\n query('_filter' => filters.to_json)\n end",
"def initialize\n @filters = []\n end",
"def Filter=(arg0)",
"def default_filters\n params[:filter].keys.map(&:to_sym) - @request.resource_klass._custom_filters\n end",
"def filters=(*filters)\n @filters = filters.flatten\n end",
"def resetFilter\n @current = @groups\n @pattern = nil\n end",
"def filter_params\n params[:f] || {}\n end",
"def filter(filters = {})\n all.select do |rule|\n [:country, :type].each do |condition|\n break false if filters[condition] && filters[condition] != rule[condition]\n true\n end\n end\n end"
] | [
"0.794043",
"0.7490198",
"0.7308222",
"0.7308222",
"0.71641165",
"0.71485585",
"0.7070446",
"0.7038898",
"0.7034479",
"0.6862236",
"0.68190986",
"0.67827415",
"0.67598474",
"0.67598474",
"0.67598474",
"0.67114085",
"0.67074555",
"0.67074555",
"0.6700287",
"0.66866624",
"0.6678169",
"0.66721535",
"0.6646747",
"0.6636188",
"0.66282207",
"0.6621223",
"0.6621223",
"0.66180485",
"0.66168183",
"0.66168183",
"0.66128623",
"0.66127896",
"0.6571444",
"0.6557095",
"0.6557095",
"0.65497875",
"0.6521514",
"0.6498515",
"0.64955884",
"0.6482989",
"0.6467637",
"0.6456127",
"0.64542925",
"0.6438052",
"0.6401708",
"0.6388347",
"0.6377541",
"0.63701624",
"0.6350518",
"0.63443977",
"0.63428515",
"0.63310045",
"0.6326686",
"0.6315384",
"0.6313685",
"0.63114583",
"0.63052267",
"0.629633",
"0.6293274",
"0.626453",
"0.6263709",
"0.623935",
"0.62241125",
"0.6218916",
"0.6207439",
"0.62023246",
"0.6201144",
"0.620079",
"0.61745614",
"0.617365",
"0.61644244",
"0.61610824",
"0.61541384",
"0.61523086",
"0.6137593",
"0.6106764",
"0.6102777",
"0.608085",
"0.60769135",
"0.60753995",
"0.60594064",
"0.6055226",
"0.60507005",
"0.6044609",
"0.60297066",
"0.60292345",
"0.60292345",
"0.60223335",
"0.6017063",
"0.60146457",
"0.5998633",
"0.5996858",
"0.5996825",
"0.5996471",
"0.59956014",
"0.598491",
"0.5983378",
"0.5976735",
"0.59619725",
"0.59572953"
] | 0.8127907 | 0 |
Now capture maximum stack depth reached | def max_depth &blk
xmax = 0
loop do
begin
xmax = [xmax, yield].max
rescue HaltState
raise StopIteration
end
end
xmax
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_level_depth\n MAXIMUM_LEVEL_DEPTH\n end",
"def my_depth\n 1\n end",
"def depth=(_arg0); end",
"def stack; end",
"def stack; end",
"def stack_depth\n @stack.size\n end",
"def depth; end",
"def max_nesting=(depth)\n #This is a stub, used for indexing\n end",
"def depth_max; depths.max end",
"def max_nesting()\n #This is a stub, used for indexing\n end",
"def current_depth\n 0\n end",
"def check_overflow\r\n if @depth >= 100\r\n msgbox(Vocab::EventOverflow)\r\n exit\r\n end\r\n end",
"def to_iseq_stack_max\n 10\n end",
"def i_am_not_too_deep?(depth)\n depth <= @depth_to_explore\n end",
"def stack_trace; end",
"def trace_down(stack = [])\n stack << self\n return next_in_chain.trace_down(stack) if next_in_chain.present?\n stack\n end",
"def stack_size()\n #This is a stub, used for indexing\n end",
"def push_local_depth\n <<-CODE\n next_int;\n k = (native_int)_int;\n next_int;\n t1 = c->active_context;\n for(j = 0; j < k; j++) {\n t2 = blokctx_env(state, t1);\n t1 = blokenv_get_home_block(t2);\n }\n stack_push(tuple_at(state, blokctx_locals(state, t1), _int));\n CODE\n end",
"def depth\n @cur_level - @base_level + 1\n end",
"def depth_min; depths.min end",
"def depth\n @options[:depth] += 1\n ret = yield\n @options[:depth] -= 1\n ret\n end",
"def get_depth\n raise \"Not implemented\"\n end",
"def naked_top_level; end",
"def make_depth(depth)\n if depth then\n @depth = depth\n else\n # There is no default depth, use the heuristic that the\n # depth is more or less equal to the bit width of the\n # largest argument type.\n @depth = @funcE.each_argT.map {|t| t.width }.max\n end\n # Resize the stackes according to the depth.\n @stack_sigs.each do |sig|\n sig.type.instance_variable_set(:@range,0..@depth-1)\n end\n @stack_ptr.type.instance_variable_set(:@range,(@depth+1).width-1..0)\n end",
"def stacktrace; end",
"def depth\n self.ancestors.size\n end",
"def to_stack; end",
"def depth\n @depth ||= to && to.depth + 1 || 0\n end",
"def naked_top_level?; end",
"def depth\n return 0 if nil?\n\n @accumulator_depth = 1\n depth_aux(self, @accumulator_depth)\n @accumulator_depth\n end",
"def lambda_stack; end",
"def lambda_stack; end",
"def lambda_stack; end",
"def on_size_exceeded\n tracer.trace('operation.parent') do\n # Fill the trace over the capacity of the context\n max_size.times do |i|\n tracer.trace('operation.sibling') do |span|\n yield(span) if i + 1 == max_size\n end\n end\n end\n end",
"def depth\n @locals.size\n end",
"def pop_exception_handling_frames\n m = @thread.__method_at(i = 1)\n until ExceptionFrames.include?(m.__name) or i >= @thread.__stack_depth\n i += 1\n m = @thread.__method_at(i)\n end\n if i < @thread.__stack_depth\n until m.__env_id == RubyEnv or i >= @thread.__stack_depth\n i += 1\n m = @thread.__method_at(i)\n end\n end\n @thread.__trim_stack_to_level(i) unless i >= @thread.__stack_depth\n end",
"def recursive => nil",
"def get_method_stack(fqns, name, scope: T.unsafe(nil)); end",
"def peek(depth = T.unsafe(nil)); end",
"def off_test_stack32_014\n rsp = exec(\": test 2 4 6 depth ;\")\n stk = stack(rsp)\n assert_equal([2, 4, 6, 3], stk)\n end",
"def cond_stack; end",
"def cond_stack; end",
"def cond_stack; end",
"def __stack\n @stack ||= []\n end",
"def print_stack_trace(frame, opts={})\n opts = DEFAULT_STACK_TRACE_SETTINGS.merge(opts)\n halfstack = (opts[:maxstack]+1) / 2\n n = frame.stack_size\n n = [n, opts[:count]].min if opts[:count]\n if n > (halfstack * 2)\n print_stack_trace_from_to(0, halfstack-1, frame, opts)\n msg \"... %d levels ...\" % (n - halfstack*2)\n last_frame = print_stack_trace_from_to(n - halfstack, n-1, frame, opts)\n else\n last_frame = print_stack_trace_from_to(0, n-1, frame, opts)\n end\n msg \"(More stack frames follow...)\" if last_frame.type != 'TOP'\n end",
"def __stack\n @stack\n end",
"def backtrace; end",
"def depth\n @env.length\n end",
"def full_backtrace; end",
"def is_circular?\n max_level = 0\n each_ancestor { |_, level| max_level = [max_level, level].max }\n each_descendant { |_, level| max_level = [max_level, level].max }\n max_level == RECURSION_DEPTH_LIMIT\n end",
"def peek_max()\n return nil if @max_stack.empty?\n\n @max_stack.last\n end",
"def deepest_cause; end",
"def backtrace_ignores; end",
"def capture_stack?\n @capture_stack\n end",
"def backtrace_level; end",
"def test_simple_block_will_tail_call\n src =<<-EOC\n defn t() {\n defn g() { 2;9}\n {3;%g}\n }\n %t\nEOC\n vi = mkvi src; ti = mkti src\n vmax = max_depth { vi.step; vi.frames.length }\n tmax = max_depth { ti.step; ti.frames.length }\n\n assert tmax < vmax, \"Expected #{tmax} to be less than #{vmax}\"\n end",
"def callstack\n @callstack.dup\n end",
"def StopStack\n \n end",
"def log_depth(depth)\n @max_depth = max(@max_depth,depth)\n end",
"def depth()\n #This is a stub, used for indexing\n end",
"def max_depth\n if @head.nil?\n return nil\n else\n max_depth = find_max_depth(head)\n end\n return max_depth\n end",
"def too_deep?( depth )\n depth.to_i > 0 && (depth + 1) <= path.to_s.count( '/' )\n end",
"def recursion_test\n begin\n fibonacci = Fibonacci.new\n fibonacci.get_via_recursion(TEST_VALUE)\n rescue SystemStackError => e\n STDERR.puts 'recursion depth death'\n -1\n end\n end",
"def max?()\n\t\treturn @stack.length >= MAX_HYPOTHESES\n\tend",
"def stack(new_scope = T.unsafe(nil)); end",
"def StartStack\n\n end",
"def maximum_depth(node, depth = 0)\n @h = depth\n node.descendants.map{|d| @h = d.depth if d.depth >= @h }\n @h \nend",
"def swimInDepth _obj, _args\n \"_obj swimInDepth _args;\" \n end",
"def recurse_call(*args)\n # # create a state for the call.\n # call_state = SequencerT.current.step\n\n # Get the variables for handling the stack overflow.\n stack_ptr = @stack_ptr\n depth = @depth \n argsIdx = @argsIdx\n this = self\n\n # Adds the argument to the stack if no overflow.\n HDLRuby::High.top_user.hif(stack_ptr < depth) do\n # hprint(\"stack_ptr=\",stack_ptr,\" depth=\",depth,\"\\n\")\n # Adds the arguments and the return state to the current stack frame.\n # Since not pushed the stack yet for not loosing the previous\n # arguments, add +1 to the offset when poking the new arguments.\n # args.each_with_index { |arg,i| self.poke(@argsIdx + i,arg,1) }\n args.each_with_index { |arg,i| this.poke(argsIdx + i,arg,1) }\n end\n\n # Push a new frame.\n self.push_all\n\n # create a state for the call.\n call_state = SequencerT.current.step\n\n # Prepare the handling of overflow\n call_state_value = call_state.value\n overflow = @funcE.overflow\n if overflow then\n HDLRuby::High.top_user.hif(stack_ptr > depth) do\n HDLRuby::High.top_user.instance_exec(&overflow)\n end\n end\n\n # Get the state value of the function: it is the state\n # following the first function call.\n func_state_value = @state.value + 1\n # Do the call.\n call_state.gotos << proc do\n HDLRuby::High.top_user.instance_exec do\n hif(stack_ptr <= depth) do\n next_state_sig <= func_state_value\n end\n helse do\n # Overflow! Skip the call.\n next_state_sig <= call_state_value + 1\n # if overflow then\n # # There is some overflow code to execute.\n # HDLRuby::High.top_user.instance_exec(&overflow)\n # end\n end\n end\n end\n\n return call_state\n end",
"def look_deeper contexts, deep, max_item_depth = 9, max_aspect_depth = 9, item_depth = 0\n unless item_depth == 0\n deep = look_wider contexts, deep, max_aspect_depth, 0\n deep[:row] += 1\n end\n deep[:indents] ||= []\n # deep[:numberings] ||= []\n deep[:indents ][deep[:row]] = item_depth || 0\n # deep[:numberings][deep[:row]] = self.class.numbering_list || []\n self.class.numbering_push\n unless (item_depth += 1) >= max_item_depth\n items.each do |item|\n self.class.numbering_increment\n deep = (item.recursive_ref || item).look_deeper contexts, deep, max_item_depth, max_aspect_depth, item_depth\n end\n end\n self.class.numbering_pop\n item_depth -= 1\n deep\n end",
"def stack_current_size()\n if(@stack == nil)\n return 0\n end\n return @stack.length\n end",
"def clean_up_closed_if_depth_bound_reached\n if @n.depth == DEPTH_BOUND\n clean_up_closed(@n)\n true\n end\n false\n end",
"def frame_count\n Rubinius::VM.backtrace(1).count\n end",
"def reCalculateMax\n # first reset saved maximum number\n @maxNumber = 0;\n # then begin reCalculate process But if stack has numbers\n if @stackList.length > 0\n @stackList.each do |num|\n if @maxNumber < num\n @maxNumber = num\n end\n end\n end\n end",
"def depth\n return codeArray.length\n end",
"def getStateStackDepth()\n\t\t\treturn @_state_stack.size\n\t\tend",
"def backtrace_threshold_ms; end",
"def show_stack(stack = nil)\n\tstack = 99999 if stack == nil || stack <= 0\n\tbegin\n\t raise Exception.new\n\trescue Exception=>e\n\t if e.backtrace.size >=2 \n\t stack += 1\n\t stack = e.backtrace.size-1 if stack >= e.backtrace.size\n\t return e.backtrace[1..stack].join(\"\\n\") \n\t end\n\tend\n\treturn \"\"\nend",
"def stack_trace=(_arg0); end",
"def test_fact_aps_should_result_smaller_max_depth_for_tail_call\n vi = mkvi src_fact_aps; ti = mkti src_fact_aps\n vmax = max_depth { vi.step; vi.frames.length }\n tmax = max_depth { ti.step; ti.frames.length }\n assert tmax < vmax, \"Expected #{tmax} to be less than #{vmax}\"\n end",
"def dump_call_stack\n puts \"[Debug] callStack start---\"\n puts caller\n puts \"[Debug] callStack end---\"\nend",
"def current_depth\n current = Fiber.current\n managed_fiber?(current) ? current.depth : 0\n end",
"def backtrace\n end",
"def initialize(depth = 0)\r\n @depth = depth\r\n check_overflow\r\n clear\r\n end",
"def depth\n ancestors.count\n end",
"def depth\n ancestors.count\n end",
"def stackFrameWalk()\n toKernel32Code = toKernel32()\n data = <<EOS\n push esi\n push ecx\n\n mov eax, ebp\n\n stack_walking:\n mov esi, eax\n lodsd\n mov ecx,[eax]\n test ecx, ecx\n jnz stack_walking\n\n ; esi now points to last stack frame (and since lodsd increments esi by 4 it points to function in ntdll.dll)\n mov eax,[esi]\n\n find_begin:\n dec eax\n xor ax,ax ; work through image until we find base address\n cmp word [eax],0x5A4D ; MZ start of PE header\n jnz find_begin\n\n pop ecx\n pop esi\n\n mov edx, eax\n ; edx now points to ntdll.dll or kernel32.dll base address (depending on windows version)\n\n #{toKernel32Code}\nEOS\n data\n end",
"def nesting() end",
"def stack(*args); end",
"def get_max()\n return @maxs_stack.peek()\n end",
"def backtrace_cleaner; end",
"def __caller_caller__(depth)\n return unless PutsDebuggerer.caller?\n start_depth = depth.to_i + 1\n caller_depth = PutsDebuggerer.caller == -1 ? -1 : (start_depth + PutsDebuggerer.caller)\n caller[start_depth..caller_depth].to_a\n end",
"def trace_up(stack = [])\n stack << self\n return previous_in_chain.trace_up(stack) if previous_in_chain.present?\n stack.reverse # Reversing because the top most one will be at the end.\n end",
"def set_local_depth\n <<-CODE\n next_int;\n k = (native_int)_int;\n next_int;\n t3 = stack_pop();\n t1 = c->active_context;\n\n for(j = 0; j < k; j++) {\n t2 = blokctx_env(state, t1);\n t1 = blokenv_get_home_block(t2);\n }\n\n t2 = blokctx_locals(state, t1);\n if(t2->gc_zone == 0) {\n sassert(_int < NUM_FIELDS(t2) && \"locals tuple sized wrong\");\n fast_unsafe_set(t2, _int, t3);\n } else {\n tuple_put(state, t2, _int, t3);\n }\n stack_push(t3);\n\n CODE\n end",
"def min_depth\n return 0 if @poss.empty?\n @poss[0].length\n end",
"def back_amb\n @__back_amb ||= [Proc.new { fail ExhaustedError, \"amb tree exhausted\" }]\n end",
"def back_amb\n @__back_amb ||= [Proc.new { fail ExhaustedError, \"amb tree exhausted\" }]\n end",
"def stack\n @stack\n end",
"def scan_patterns\n @max_level = 0\n @root.bfs do |r|\n reached = false\n curr_instances = yield(r.parent_id)\n curr_instances.each do |c_instance|\n q = @query.new.extend(Pbuilder::Query)\n q = q.search_next_instances(c_instance.uri, r.node.edge, r.node.value)\n q.execute do |i|\n @action.call(i, r.id, r.level, r.node.edge, c_instance.id)\n reached = true\n end\n end if ! curr_instances.nil?\n @max_level = r.level if r.level > @max_level\n reached\n end if @pass\n @max_level\n end",
"def close_stack indent_level\r\n while @token_stack.size > 0 and @token_stack[-1].indent_level >= indent_level\r\n if @token_stack.size > 1 # if this is not the last token, add to parents\r\n @token_stack[-2].add_block_code self.convert(@token_stack[-1])\r\n else # this is the last token in the stack\r\n dump self.convert(@token_stack[-1])\r\n end\r\n @token_stack.pop\r\n end\r\n end"
] | [
"0.67450094",
"0.668409",
"0.66827315",
"0.6663168",
"0.6663168",
"0.6590127",
"0.65386474",
"0.6512906",
"0.64937514",
"0.6424617",
"0.6372019",
"0.6370233",
"0.626721",
"0.62181246",
"0.6193175",
"0.61604714",
"0.6135609",
"0.61037326",
"0.6102831",
"0.6093379",
"0.6084884",
"0.59988016",
"0.59475154",
"0.59418225",
"0.58748615",
"0.58601683",
"0.5854527",
"0.5853876",
"0.58387315",
"0.581129",
"0.5796448",
"0.5796448",
"0.5796448",
"0.5775324",
"0.57670593",
"0.5765878",
"0.57574654",
"0.5754766",
"0.57516044",
"0.57503533",
"0.57502246",
"0.57502246",
"0.57502246",
"0.5749551",
"0.57431126",
"0.5724054",
"0.57230556",
"0.5713144",
"0.57128394",
"0.5706842",
"0.5705517",
"0.56971806",
"0.5696016",
"0.5687661",
"0.5678747",
"0.5667121",
"0.56642246",
"0.56579065",
"0.564995",
"0.56494355",
"0.56481904",
"0.56357735",
"0.5633614",
"0.5626657",
"0.562381",
"0.55959165",
"0.5580407",
"0.5579479",
"0.5573486",
"0.55722994",
"0.5570781",
"0.55286574",
"0.55212146",
"0.55205566",
"0.5520421",
"0.55156624",
"0.55078506",
"0.55055785",
"0.54971886",
"0.54930073",
"0.5480254",
"0.54615384",
"0.54530984",
"0.5434661",
"0.54318",
"0.54318",
"0.5423693",
"0.5418639",
"0.54166436",
"0.5414725",
"0.5401018",
"0.540057",
"0.5390513",
"0.53804255",
"0.5371572",
"0.5339297",
"0.5339297",
"0.5325381",
"0.5325127",
"0.53184205"
] | 0.5959136 | 22 |
Should not be same stack depth, must be smaller | def test_fact_aps_should_result_smaller_max_depth_for_tail_call
vi = mkvi src_fact_aps; ti = mkti src_fact_aps
vmax = max_depth { vi.step; vi.frames.length }
tmax = max_depth { ti.step; ti.frames.length }
assert tmax < vmax, "Expected #{tmax} to be less than #{vmax}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stack; end",
"def stack; end",
"def depth; end",
"def depth=(_arg0); end",
"def my_depth\n 1\n end",
"def recursive => nil",
"def nesting() end",
"def to_stack; end",
"def depth_min; depths.min end",
"def deepest_cause; end",
"def test_inorder_stack_no_change\n a = [1, 2, 3, 4]\n assert_equal a, a.my_flatten_inorder_stack\n end",
"def stack_size()\n #This is a stub, used for indexing\n end",
"def test_orderOfElements\n @stack.push( 42 )\n assert_equal(@stack.top, 42)\n @stack.push( 84 )\n assert_equal(@stack.top, 84)\n @stack.pop\n assert_equal(@stack.top, 42)\n @stack.pop\n assert_nil(@stack.top)\n end",
"def current_depth\n 0\n end",
"def max_nesting()\n #This is a stub, used for indexing\n end",
"def too_nested\n \"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{\"#{nil}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"}\"\nend",
"def naked_top_level?; end",
"def i_am_not_too_deep?(depth)\n depth <= @depth_to_explore\n end",
"def solution(t)\n # write your code in Ruby 2.2\n depth = 0\n childs = []\n\n childs << t.l if t.l\n childs << t.r if t.r\n\n while not childs.empty? do\n depth += 1\n\n cc = []\n childs.each do |t|\n cc << t.l if t.l\n cc << t.r if t.r\n end\n\n childs = cc\n end\n\n depth\nend",
"def trace_down(stack = [])\n stack << self\n return next_in_chain.trace_down(stack) if next_in_chain.present?\n stack\n end",
"def depth\n self.ancestors.size\n end",
"def cond_stack; end",
"def cond_stack; end",
"def cond_stack; end",
"def test_topOnEmptyStack\n assert_nil(@stack.top)\n end",
"def deepest(cause); end",
"def naked_top_level; end",
"def peek(depth = T.unsafe(nil)); end",
"def empty?; @stack.empty?; end",
"def leaf?; false end",
"def no_circular_reference\n\n end",
"def __stack\n @stack ||= []\n end",
"def stack_top\n self # okay maybe I'll implement this\n end",
"def depth()\n #This is a stub, used for indexing\n end",
"def depthfirst?\n false\n end",
"def stack(*args); end",
"def lambda_stack; end",
"def lambda_stack; end",
"def lambda_stack; end",
"def one_singleton_ancestors_cache; end",
"def stack_trace; end",
"def recursive_solution\n\n end",
"def too_deep?( depth )\n depth.to_i > 0 && (depth + 1) <= path.to_s.count( '/' )\n end",
"def test_depth_value_not_exist\n @tree.insert(\"c\")\n refute_equal 0, @tree.depth_of?(\"a\")\n end",
"def explode!(n)\n n.traverse(:preorder_left) do |p|\n if p.depth == 4\n # puts \"Explode #{p.inspect}\"\n p.explode!\n return true\n end\n end\n\n false\nend",
"def test_false_empty\n @eval.load_stacks([5, 5, '+'])\n assert_equal false, @eval.empty_stack\n end",
"def test_recursive_methods\n assert_equal 0, find_node(1).ancestors_r.size\n assert_equal 8, find_node(1).descendants_r.size\n assert_equal 4, find_node('1_1_2_1_1').ancestors_r.size\n end",
"def off_test_stack32_014\n rsp = exec(\": test 2 4 6 depth ;\")\n stk = stack(rsp)\n assert_equal([2, 4, 6, 3], stk)\n end",
"def max_level_depth\n MAXIMUM_LEVEL_DEPTH\n end",
"def stack_depth\n @stack.size\n end",
"def include_root?\n min_depth == 0\n end",
"def test_should_block_recursion_in_tree\n group = Group.find @greeks_group.id\n\n assert_raises(RecursionInTree) { group.parent = Group.find @cretes_group.id }\n end",
"def swimInDepth _obj, _args\n \"_obj swimInDepth _args;\" \n end",
"def get_depth\n raise \"Not implemented\"\n end",
"def outer; end",
"def max_nesting=(depth)\n #This is a stub, used for indexing\n end",
"def find_beeper()\n while not next_to_a_beeper?()\n move_toward_beeper()\n end\n end",
"def test_depth_two_levels\n @tree.insert(\"a\")\n @tree.insert(\"b\")\n assert_equal 1, @tree.depth_of?(\"b\")\n end",
"def StartStack\n\n end",
"def is_well_formed?\n\t\t\treturn self.node_stack.length == 1\n\t\tend",
"def initialize\n @stack = []\n end",
"def initialize\n @stack = []\n end",
"def __stack\n @stack\n end",
"def safe_level(*) end",
"def stack(new_scope = T.unsafe(nil)); end",
"def check_integrity(list)\n complete = list.to_a\n 1.upto(list.level) do |l|\n #if anything in the higher layer wasn't in layer 0\n difference = list.to_a(nil,nil,nil,l) - complete\n puts \"stray node found in level: #{l} which is #{list.to_a(nil,nil,nil,l)}\" if !difference.empty? \n expect(difference).to match_array([])\n end\nend",
"def deep_thaw!\n replace deep_thaw\n end",
"def depth_of(score)\n if include?(score) #This is calling the method on line 44\n 1 + @root_node.depth_of(score) \n else \n nil\n end \nend",
"def min_depth\n return 0 if @poss.empty?\n @poss[0].length\n end",
"def leaf?; @leaf; end",
"def trace_up(stack = [])\n stack << self\n return previous_in_chain.trace_up(stack) if previous_in_chain.present?\n stack.reverse # Reversing because the top most one will be at the end.\n end",
"def flatten( level = 1 )\n\n load_parent_state\n \n return super\n\n end",
"def test_multiple_validity\n @eval.load_stacks([5, 6, 7])\n assert_equal nil, @eval.check_final_validity\n end",
"def stack\n return (@stack&.stack || [])\n end",
"def depth\n @depth ||= to && to.depth + 1 || 0\n end",
"def push_local_depth\n <<-CODE\n next_int;\n k = (native_int)_int;\n next_int;\n t1 = c->active_context;\n for(j = 0; j < k; j++) {\n t2 = blokctx_env(state, t1);\n t1 = blokenv_get_home_block(t2);\n }\n stack_push(tuple_at(state, blokctx_locals(state, t1), _int));\n CODE\n end",
"def test_globalize\n fs = FrameStack.new\n fs.first[:foo] = 9\n fs.push\n fs[:foo] = 8\n fs.push\n fs[:foo] = 7\n fs.push\n fs[:foo] = 10\n fs.globalize\n fs.pop; fs.pop; fs.pop\n assert_eq 10, fs[:foo]\n assert_eq 10, fs.first[:foo]\n end",
"def depth_first(value)\n\tend",
"def depth_max; depths.max end",
"def stack\n @stack\n end",
"def branch; end",
"def test_draw_included_in_stack\n assert_equal (draw - stack), []\n end",
"def stacktrace; end",
"def recursiveTreeTraversal(element)\n begin\n requirementsTree = findRequirementsTree(element)\n unless requirementsTree == nil\n checkForDuplicateRoots(requirementsTree)\n end\n for child in element.getOwnedElement()\n recursiveTreeTraversal(child)\n end\n rescue SystemStackError\n $logger.log(\"Recursive Issue1: \" + element.getName())\n end\nend",
"def state_depth_must_be(level)\n states[0..level].each do |a|\n raise 'factory state error' if a.nil?\n end\n end",
"def nested_stacks_google(recurse = true)\n my_template = sparkleish_template\n if my_template[:resources][name]\n my_template = my_template.get(:resources, name, :properties, :stack)\n end\n n_stacks = my_template[:resources].map do |s_name, content|\n if content[:type] == \"sparkleformation.stack\"\n n_stack = self.class.new(api)\n n_stack.extend PretendStack\n n_layout = custom.fetch(:layout, {}).fetch(:resources, []).detect { |r| r[:name] == name }\n n_layout = (n_layout || custom.fetch(:layout, {})).fetch(:resources, []).detect { |r| r[:name] == s_name } || Smash.new\n n_stack.load_data(\n :name => s_name,\n :id => s_name,\n :template => content.get(:properties, :stack),\n :outputs => n_layout.fetch(\"outputs\", []).map { |o_val| Smash.new(:key => o_val[:name], :value => o_val[\"finalValue\"]) },\n :custom => {\n :resources => resources.all.map(&:attributes),\n :layout => n_layout,\n },\n ).valid_state\n n_stack.data[:logical_id] = s_name\n n_stack.data[:parent_stack] = self\n n_stack\n end\n end.compact\n if recurse\n (n_stacks + n_stacks.map(&:nested_stacks)).flatten.compact\n else\n n_stacks\n end\n end",
"def not_reset_scope?(node); end",
"def question_one\n stack = Stack.new\n stack.push(3)\n stack.push(5)\n stack.push(2)\n stack.push(4)\n stack.push(1)\n stack.pop\n stack.pop\n stack.pop\n stack.min\nend",
"def current_stack_match?\n parent_stack = @stack[0..-2]\n\n return false unless dom_stubs[@stack].at_xpath(@xpath)\n\n parent_stack.empty? || !dom_stubs[parent_stack].at_xpath(@xpath)\n end",
"def sort_stack(stack)\n return stack\nend",
"def test(list)\n complete = list.to_a\n 1.upto(list.level) do |l|\n #if anything in the higher layer wasn't in layer 0\n difference = list.to_a(nil,nil,nil,l) - complete\n puts \"test failed level #{l} ,inconsistent node(s) #{difference}\" if (difference.count != 0)\n end\n puts \"test complete\"\nend",
"def test_true_empty\n @eval.load_stacks([5, '+'])\n assert_equal true, @eval.empty_stack\n end",
"def look_deeper contexts, deep, max_item_depth = 9, max_aspect_depth = 9, item_depth = 0\n unless item_depth == 0\n deep = look_wider contexts, deep, max_aspect_depth, 0\n deep[:row] += 1\n end\n deep[:indents] ||= []\n # deep[:numberings] ||= []\n deep[:indents ][deep[:row]] = item_depth || 0\n # deep[:numberings][deep[:row]] = self.class.numbering_list || []\n self.class.numbering_push\n unless (item_depth += 1) >= max_item_depth\n items.each do |item|\n self.class.numbering_increment\n deep = (item.recursive_ref || item).look_deeper contexts, deep, max_item_depth, max_aspect_depth, item_depth\n end\n end\n self.class.numbering_pop\n item_depth -= 1\n deep\n end",
"def test_full_stack_ignore\n puts \"test_full_stack_ignore\"\n expects = []\n 100.times do\n expects << random_string\n pr = push(expects[-1])\n assert_equal(0, pr, \"expected 0, got #{pr}\")\n end\n\n (rand(5) + 2).times do\n r = push(\"too full\", :timeout => 3)\n assert_equal(nil, r, \"expected nil, got #{r}\")\n end\n\n 100.times do |i|\n r = pop\n s = expects.pop\n assert_equal(s, r, \"expected #{s}, got #{r}\")\n end\n end",
"def is_circular?\n max_level = 0\n each_ancestor { |_, level| max_level = [max_level, level].max }\n each_descendant { |_, level| max_level = [max_level, level].max }\n max_level == RECURSION_DEPTH_LIMIT\n end",
"def stronger\n ancestors\n end",
"def whole_reg?\n size == parent.size\n end",
"def cmdarg_stack; end",
"def cmdarg_stack; end",
"def cmdarg_stack; end",
"def test_depth_three_levels\n @tree.insert(\"c\")\n @tree.insert(\"b\")\n @tree.insert(\"a\")\n assert_equal 2, @tree.depth_of?(\"a\")\n end"
] | [
"0.69032776",
"0.69032776",
"0.67008334",
"0.6506748",
"0.64947563",
"0.6449063",
"0.6427461",
"0.6276969",
"0.60935307",
"0.60789",
"0.6013681",
"0.59305847",
"0.58943874",
"0.5877971",
"0.58657676",
"0.58018625",
"0.5788122",
"0.5749958",
"0.5745213",
"0.5733999",
"0.5731058",
"0.5727031",
"0.5727031",
"0.5727031",
"0.57226145",
"0.57191306",
"0.5710989",
"0.5697083",
"0.5680105",
"0.5646587",
"0.5638826",
"0.5637243",
"0.5606086",
"0.5567999",
"0.55582464",
"0.5549717",
"0.54995847",
"0.54995847",
"0.54995847",
"0.54903185",
"0.5487269",
"0.54820764",
"0.54814315",
"0.5479885",
"0.54743123",
"0.5472429",
"0.5466536",
"0.54626757",
"0.54572225",
"0.54478914",
"0.54426444",
"0.5428749",
"0.5428093",
"0.54235864",
"0.5422432",
"0.54192156",
"0.5414371",
"0.54094046",
"0.5408136",
"0.5407461",
"0.5405524",
"0.5405524",
"0.540459",
"0.5402079",
"0.5400776",
"0.5397918",
"0.5397254",
"0.53930575",
"0.53927636",
"0.538759",
"0.536736",
"0.5357802",
"0.5356161",
"0.53556246",
"0.5354533",
"0.53499204",
"0.53432804",
"0.53409743",
"0.53343886",
"0.5327637",
"0.53262705",
"0.53212345",
"0.5311542",
"0.5308223",
"0.5307726",
"0.53049356",
"0.53034985",
"0.53021747",
"0.530177",
"0.5289181",
"0.5287668",
"0.5287604",
"0.52809525",
"0.5271757",
"0.52703536",
"0.5268191",
"0.526537",
"0.5264292",
"0.5264292",
"0.5264292",
"0.52517587"
] | 0.0 | -1 |
simple block: TODO: Must handle toplevel block | def test_simple_block_will_tail_call
src =<<-EOC
defn t() {
defn g() { 2;9}
{3;%g}
}
%t
EOC
vi = mkvi src; ti = mkti src
vmax = max_depth { vi.step; vi.frames.length }
tmax = max_depth { ti.step; ti.frames.length }
assert tmax < vmax, "Expected #{tmax} to be less than #{vmax}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block_node; end",
"def block_node; end",
"def pre_block\n end",
"def pre_block\n end",
"def blocks; end",
"def blocks; end",
"def blocks; end",
"def blocks() end",
"def list_block()\n\nend",
"def process_simple_block_opener(tk); end",
"def simple\n puts 'Here comes the code block!'\n yield\n puts 'There was the code block!'\nend",
"def main_content\n yield if block_given?\n end",
"def process_simple_block_opener(tk)\n return unless [TkLBRACE, TkDO, TkBEGIN, TkELSE].include?(tk.class) &&\n # Make sure hashes are parsed as hashes, not as blocks\n (@last_ns_tk.nil? || @last_ns_tk.lex_state != EXPR_BEG)\n\n @level += 1\n @state = :block\n @block_num += 1\n if @block.nil?\n @block = TokenList.new\n tokens = [tk, TkStatementEnd.new(tk.line_no, tk.char_no)]\n tokens = tokens.reverse if TkBEGIN === tk.class\n @statement.concat(tokens)\n else\n @statement << tk\n end\n\n true\n end",
"def block?; end",
"def require_block; end",
"def yield; end",
"def block_node=(_); end",
"def post_block\n end",
"def post_block\n end",
"def block\n true\n end",
"def MyBlockMethod()\n puts \"At the top of the method\"\n\tyield\n\tputs \"At the bottom of the method\"\nend",
"def process_complex_block_opener(tk); end",
"def run(&block); end",
"def content\n call_block\n end",
"def run(&block)\n end",
"def parse_block(*_arg0); end",
"def call_block\n puts \"start\"\n yield \"foobar\" if block_given?\n puts \"end\"\nend",
"def anonymous_blocklists; end",
"def call_block\n\tputs \"Start of method\"\n\tyield\n\tyield\n\tputs \"End of method\"\nend",
"def before_block_boundary?; end",
"def process_block_token(tk); end",
"def blocklists; end",
"def block_name \n :CodeBlock \n end",
"def block_name \n :CodeBlock \n end",
"def sup_bro\n puts \"This is before a block!\"\n name = \"Katy\"\n yield(name)\n puts \"This is after a block!\"\nend",
"def block=(_arg0); end",
"def block=(_arg0); end",
"def parse_block_html; end",
"def parse_codeblock; end",
"def after_block_boundary?; end",
"def block_sample\n p \"AAA\"\n yield\n p \"BBB\"\nend",
"def context(&block); end",
"def context(&block); end",
"def toplevel; end",
"def inner\n puts \"TODO\"\n end",
"def run_block\n yield\nend",
"def call_block\r\n puts \"Start of method\"\r\n yield\r\n yield\r\n puts \"End of method\"\r\nend",
"def render_parent_block(name, context, blocks = {})\n # ob_start();\n display_parent_block(name, context, blocks)\n # return ob_get_clean();\n end",
"def block_eg1(cutblock)\n puts \"this is the first message from 1 \"\n cutblock.call\n puts \"this is the middle message\"\n cutblock.call\n puts \"this is the last\\n\\n\"\nend",
"def rblock\n if block_given?\n # yield execute the block\n yield\n else\n puts \"No block\"\n end\n end",
"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 begin; end",
"def bb_unconditional_branch\n @file.puts \" @current_block.left = arg1.basic_block\"\n @file.puts \" @current_block.close\"\n @file.puts \" @current_block = new_basic_block\"\n end",
"def record_block\n @block = true\n end",
"def inside_t1\n yield\n end",
"def greeting(&block)\n puts 'good morning'\n text = block.call('hello')\n puts text\n puts 'good evening'\nend",
"def greeting(&block)\n puts 'good morning'\n text = block.call('hello')\n puts text\n puts 'good evening'\nend",
"def process_complex_block_opener(tk)\n return unless OPEN_BLOCK_TOKENS.include?(tk.class)\n\n @current_block = tk.class\n @state = :block_statement\n\n true\n end",
"def test_block\n\tputs \"You are in the method\"\n\tyield\n\tputs \"You are again back to the method\"\n\tyield\nend",
"def begin() end",
"def body_content\n call_block\n end",
"def initialize_starting_block\n nil\n end",
"def call_block\n puts 'Start'\n yield\n yield\n puts 'End'\nend",
"def callBlock\n yield\n yield\nend",
"def m12a(p1,p2,p3, &blk)\n\tyield(p1,p2) # два параметра передаем в блок\n\tputs \"The third parameter is #{p3}\" # один параметр испоьзуем прямо тут\nend",
"def pets\n yield\n puts \"Luna\"\n puts \"B\"\nend",
"def nesting() end",
"def if_block_given\n p \"hoge\"\n yield if block_given?\n p \"end\"\nend",
"def return(&block); end",
"def call_block\n @_block.call(self) if @_block\n end",
"def main_end ; end",
"def begin_block(name, opts)\n @block_name_stack << name\n @block_opts_stack << opts\n @block_break_type_stack << \"entry-break\"\n end",
"def give(&my_block)\n my_block.call(\"2 turtle doves\", \"1 partridge\")\nend",
"def will_run_block\n # when you use yield, you'll call the block\n yield\n puts 'End'\nend",
"def method &block \r\n\t1\r\nend",
"def i_take_a_block\n yield\nend",
"def run_block_proc\n yield\nend",
"def section(title)\n puts \"===== #{title} =====\" if @display_headers\n yield\n puts if @display_headers\nend",
"def block_given?() end",
"def give(&my_block)\n my_block.call(\"2 turtle doves\", \"1 partridge\")\nend"
] | [
"0.74986035",
"0.74986035",
"0.74986035",
"0.74986035",
"0.74986035",
"0.74986035",
"0.74986035",
"0.74986035",
"0.74986035",
"0.74986035",
"0.74986035",
"0.74986035",
"0.74986035",
"0.74986035",
"0.74986035",
"0.74986035",
"0.74986035",
"0.74986035",
"0.74986035",
"0.74986035",
"0.73755735",
"0.73755735",
"0.73499864",
"0.73499864",
"0.717328",
"0.717328",
"0.717328",
"0.71443903",
"0.6861234",
"0.68569875",
"0.68440104",
"0.68168",
"0.6801346",
"0.6775347",
"0.6679201",
"0.6650963",
"0.661651",
"0.66147065",
"0.66147065",
"0.65964735",
"0.65947455",
"0.65688956",
"0.6521262",
"0.64942926",
"0.647022",
"0.6459301",
"0.6450469",
"0.64500993",
"0.64334553",
"0.642607",
"0.64098674",
"0.63977647",
"0.6393879",
"0.6393879",
"0.6357565",
"0.63504946",
"0.63504946",
"0.63206017",
"0.6305024",
"0.62739766",
"0.62659174",
"0.6261607",
"0.6261607",
"0.6245639",
"0.6241825",
"0.62310845",
"0.62150925",
"0.62071425",
"0.6194514",
"0.6190901",
"0.61739206",
"0.61739206",
"0.61713976",
"0.6153614",
"0.6143044",
"0.61176234",
"0.6115146",
"0.6115146",
"0.6110198",
"0.61040604",
"0.60980356",
"0.6097567",
"0.6086312",
"0.6078336",
"0.6069349",
"0.60663646",
"0.60637224",
"0.6051098",
"0.60314715",
"0.6031235",
"0.6029861",
"0.60198224",
"0.6019351",
"0.60117",
"0.60060924",
"0.6002907",
"0.5999712",
"0.5996614",
"0.59946835",
"0.5990256",
"0.59846723"
] | 0.0 | -1 |
test return via tail call | def test_will_return_via_tail_call
src =<<-EOC
defn g() {9}
defn f(x) {
zero?(:x) && return %g
%g + 9
}
EOC
vi = mkvi src+"\nf(0)\n";ti = mkti src+"\nf(0)\n"
assert (vi.run == 9) && (ti.run == 9), "Expected both optimized and non_optiized to return9, but one of them did not"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_ending(_result)\n end",
"def demonstrate_early_return\n return\n puts \"You will never see this, because we never get here.\"\nend",
"def call\n [false, yield]\n rescue halt => e\n [true, e.payload[0]]\n end",
"def success?() end",
"def exit(res=0) end",
"def success?(*) end",
"def crappy_api_call\n $count += 1\n\n # First two calls fail\n raise \"OH SNAP\" if $count < 3\n\n # Next few calls say pending\n return :pending if $count < 5\n\n # Then finally done\n return :happy\nend",
"def go_wrapper(count, meth)\n return false unless meth.call\n (count-1).times {break unless meth.call}\n return true\n end",
"def exit!(res=0) end",
"def generic_return(code)\n code.call\n return \"generic_return method finished\"\nend",
"def failure\n @back.pop.call\n end",
"def check_return(proc4)\n proc4.call\n puts \"Puts string after return was called\"\nend",
"def test_after_exit\n flag = false\n @acc = 0\n def bar\n __label__ 20\n @acc = @acc + 1\n end\n bar\n unless flag\n flag = true\n __goto__ 20\n end\n assert_equal 2, @acc\n end",
"def test_tail\r\n assert_respond_to(@log, :tail)\r\n assert_raises(EventLogError){ @log.tail } # requires block\r\n end",
"def test_non_tail_position_blocks_cannot_have_tailcalls\n tails_found = 0\n tcompile 'defn foo() {{9; %g}; 99}'\n visit_tree @tc.ast, tailcall:->(x) {tails_found += 1 }\n assert tails_found.zero?, \"Expected to not find any tail calls, but found #{tails_found} instead\" \n end",
"def failed?; failed_to_start? || (@success == false) end",
"def keep_retval?\n @keep_retval\n end",
"def next?()\n !end?\n end",
"def capture_eof\n yield\n false\nrescue SystemExit\n true\nend",
"def call_return_instruction\n assert(\"call_return_instruction: not a call\") { calls? }\n r_pre_index = index + self.delay_slots\n block.instructions[r_pre_index].next\n end",
"def tail; end",
"def tor_exit_node?; end",
"def tor_exit_node?; end",
"def ok?\n skip? || @result\n end",
"def test_call\n log \"tast_call() called\"\n return \"test_call() return value\"\n end",
"def do_failure; end",
"def call\n expect :result\n\n self.last\n end",
"def endless_loop?; end",
"def failure?; terminal_flag == :failure end",
"def failure?; terminal_flag == :failure end",
"def proc_in_return\n proc_func = proc {\n return\n }\n proc_func.call\n\n \"mew\"\n end",
"def say_hello\n return\n puts \"Hello!\" #this code will never be reached\nend",
"def test_early_exit_needed_in_contexts_with_method_return_value_set\n method_context = @manager.enter_method_scope(@test_self)\n method_context.return_type = Constants[\"Boolean\"]\n flow_context = @manager.enter_flow_control_block_scope()\n flow_context.set_return(Constants[\"true\"])\n assert_true flow_context.need_early_exit\n @manager.leave_scope(flow_context)\n assert_true method_context.need_early_exit\n @manager.leave_scope(method_context)\n end",
"def ret!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 1)\n\n type = RET\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 7:7: 'returns'\n match(\"returns\")\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__, 1)\n\n end",
"def call_error?(rc) (rc.respond_to?(:ok?) and rc.ok?) ? false : true end",
"def cdr(e)\n e.tail\nend",
"def failure\n @__num_of_tries ||= 0\n @__num_of_tries += 1\n back_amb.pop.call\n end",
"def process_return(exp)\n return \"return #{process exp.shift}\"\n end",
"def return!(&block); end",
"def goto_if_false\n <<-CODE\n next_int;\n t1 = stack_pop();\n if(!RTEST(t1)) {\n c->ip = _int;\n cpu_cache_ip(c);\n }\n CODE\n end",
"def success?; terminal_flag == :success end",
"def success?; terminal_flag == :success end",
"def sret\n <<-CODE\n t1 = stack_pop();\n cpu_simple_return(state, c, t1);\n CODE\n end",
"def failures; end",
"def failures; end",
"def failures; end",
"def return_after \n begin\n @stop_after = true\n yield\n ensure\n @stop_after = false\n end\n end",
"def a_method_interrupted(a,b)\n puts \"I got #{a}\"\n puts \"I got #{b}\"\n return a+b\n puts \"I got #{a+b}\"\nend",
"def next?\n not_finished?\n end",
"def finish_step?\n return !goto_true && !goto_false\n end",
"def passed?; end",
"def passed?; end",
"def passed?; end",
"def returnsomething\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 18 )\n\n begin\n # at line 613:5: expression\n @state.following.push( TOKENS_FOLLOWING_expression_IN_returnsomething_848 )\n expression\n @state.following.pop\n # --> action\n\n \trt = @stack_operands.pop\n rt_t = @stack_types.pop\n if(rt_t != @current_method.return_type)\n raise \"Invalid return type #{rt_t} in the #{@current_method.return_type} type method #{@current_class.name}::#{@current_method.name}\"\n end\n generate('ret', nil, nil ,rt )\n @is_returning = true\n free_avail(rt)\n free_avail_const(rt)\n \n \n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 18 )\n\n end\n \n return \n end",
"def check_return(lambda4)\n lambda4.call\n puts \"Puts string after return was called\"\nend",
"def result_of_checking; end",
"def exited?(*) end",
"def proceed!; end",
"def proceed!; end",
"def execute_last &decision\n return execute_line @test_lines[-1], &decision\n end",
"def last_exit_successful?\n $!.nil? || $!.is_a?(SystemExit) && $!.success?\nend",
"def identify_return_sites\n blocks.each { |b|\n b.instructions.each { |i|\n i.set_return_site(false)\n }\n }\n blocks.each { |b|\n b.instructions.each { |i|\n if i.calls?\n return_index = i.index + i.delay_slots + 1\n overflow = return_index - b.instructions.length\n if overflow < 0\n b.instructions[return_index].set_return_site(true)\n else\n b.next.instructions[overflow].set_return_site(true)\n end\n end\n }\n }\n end",
"def failed?\n !success?\n end",
"def tail(obj); end",
"def done?\n !!@exitstatus\n end",
"def done?; true end",
"def failure\n if $DEBUG\n @__num_of_tries ||= 1\n @__num_of_tries += 1\n end\n back_amb.pop.call\n end",
"def break_v_return_2(r_v_b)\n\tcounter = 0\n\tuntil counter == 10\n\t\tputs counter +=1\n\t\treturn if counter == 5 && r_v_b == \"return\"\n\t\tbreak if counter == 5 && r_v_b == \"break\"\n\tend\n\n\tputs \"If you see me, a break(or nothing) must have been used\"\nend",
"def continue?; end",
"def end() end",
"def ret(val=nil)\n return if @finished\n if @function.return_type == Types::VOID\n @builder.ret_void\n else\n pret val\n @builder.br(@function.return_block)\n end\n self.finish\n end",
"def test_return_in_job()\n assert_nothing_thrown() do\n s = generate_spawner(1, false, 0, @jobs_log_file, @spawner_log_file)\n generate_tasks_addition(s, 1, true, 2) {return 42}\n end\n end",
"def success(*args); end",
"def stop?(*) end",
"def test_top_level_conditionals_should_not_have_tail_calls\n tcompile 'zero?(0) && %g'\n tail_found = false\n lambdacall_found = false\n visit_tree @tc.ast, lambdacall: ->(x) { lambdacall_found = true }, tailcall: ->(x) { tail_found = true }\n assert !tail_found, \"Expected to not find any :tailcalls, but did\"\n assert lambdacall_found, \"Expected to find a :lambdacall node\" \n end",
"def exec_api_call(rest_type, req, data = nil, exit_on_fail = false)\n max_retry = RETRIES\n get_hash = nil\n attempts = 0\n is_good = false\n while !is_good && attempts < max_retry\n attempts += 1\n get_hash = call_api(req, rest_type, data)\n is_good = get_hash[:status]\n unless is_good\n exit_script() if exit_on_fail\n puts \"Got Error making API call - #{req} \"\n if attempts < max_retry\n puts \"Retrying #{attempts}\"\n sleep(4 * attempts)\n end\n end\n end\n get_hash\n end",
"def tail=(_); end",
"def prefail?\n @status.exitstatus & (1 << 4) != 0\n end",
"def success?; end",
"def success?; end",
"def success?; end",
"def success?; end",
"def success?; end",
"def success?; end",
"def my_method(i = 0)\n _t('method') do\n return if i > 20\n sleep 0.1\n my_method(i + 1)\n end\nend",
"def long_planeteer_calls(calls)# code an argument here\n # Your code here\n calls.any? do |call|\n call.length > 4\n end\nend",
"def get_response(url)\n\t\t\t\t\t\tres_flag = false\n\t\t\t\t\t\t\t\tresponse = RestClient.get(url){|response, request, result| response \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif response.code != 200\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tputs response.code\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tres_flag = true\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tputs \"Skipped due to #{response.code}\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\treturn res_flag\nend",
"def exit!() end",
"def soft_return\n <<-CODE\n t1 = stack_pop();\n cpu_simple_return(state, c, t1);\n CODE\n end",
"def test_lambda\n lambda { p \"Exit from lambda.\" and return }.call()\n p \"Exit from lambda method\" and return\nend",
"def method_return_from_loop\n (1..10).each do |n|\n if n == 5\n return 5 * 5\n end\n end\n nil\n end",
"def success?\n finished? and !exception\n end",
"def success; end",
"def success; end",
"def has_next?; end",
"def last_command_successful?\n $?.exitstatus == 0\n end",
"def test_simple_block_will_tail_call\n src =<<-EOC\n defn t() {\n defn g() { 2;9}\n {3;%g}\n }\n %t\nEOC\n vi = mkvi src; ti = mkti src\n vmax = max_depth { vi.step; vi.frames.length }\n tmax = max_depth { ti.step; ti.frames.length }\n\n assert tmax < vmax, \"Expected #{tmax} to be less than #{vmax}\"\n end",
"def capture_return\n @returns = @code.split(/\\(/).first !~ /void/ \n end",
"def self_log?\n @status.exitstatus & (1 << 7) != 0\n end",
"def cret(cond, val=nil, blk=nil)\n return if @finished\n pret val\n cont = blk ? blk : @function.add_block(\"block\")\n @builder.cond(Convert(cond, Types::BOOL), @function.return_block, cont.to_ptr)\n if blk\n self.finish\n else\n @builder.position_at_end(cont)\n @basic_block = cont\n end\n end"
] | [
"0.6785964",
"0.6284976",
"0.624223",
"0.62293106",
"0.6119412",
"0.6087102",
"0.60093004",
"0.59873486",
"0.5900966",
"0.58965045",
"0.5880964",
"0.5872966",
"0.58577317",
"0.58067894",
"0.57845235",
"0.57704794",
"0.57646817",
"0.5745195",
"0.5735738",
"0.57289803",
"0.5717828",
"0.57025033",
"0.57025033",
"0.5699749",
"0.5676672",
"0.5673953",
"0.564325",
"0.5639013",
"0.5631204",
"0.5631204",
"0.56236815",
"0.559186",
"0.55792207",
"0.5561088",
"0.5550392",
"0.55465704",
"0.55400145",
"0.55376256",
"0.5531561",
"0.5527948",
"0.5505768",
"0.5505768",
"0.54900604",
"0.5486938",
"0.5486938",
"0.5486938",
"0.5485674",
"0.54855835",
"0.5484292",
"0.5479623",
"0.54752237",
"0.54752237",
"0.54752237",
"0.54697907",
"0.54648083",
"0.545664",
"0.54550064",
"0.54544824",
"0.54544824",
"0.5443769",
"0.54390603",
"0.54363",
"0.5432933",
"0.5415143",
"0.54127944",
"0.5407508",
"0.5402137",
"0.5400131",
"0.5397267",
"0.5395603",
"0.53946584",
"0.53870475",
"0.53840303",
"0.5383841",
"0.5381069",
"0.53749895",
"0.53748435",
"0.53636235",
"0.5356279",
"0.5356279",
"0.5356279",
"0.5356279",
"0.5356279",
"0.5356279",
"0.53476137",
"0.5329401",
"0.5324231",
"0.5323557",
"0.532279",
"0.53213",
"0.53186536",
"0.53175074",
"0.5315193",
"0.5315193",
"0.53151536",
"0.53110784",
"0.530844",
"0.5303446",
"0.5288595",
"0.5288226"
] | 0.6735239 | 1 |
Should tail call within nonlambda bodies E.g. toplevel blocks, conditionals | def test_does_not_convert_lambdacalls_to_tailcalls_for_top_level_constructs
tcompile 'defn g() {9}; {1; %g}'
tail_found = false
lambdacall_found = false
visit_tree @tc.ast, lambdacall: ->(x) { lambdacall_found = true }, tailcall: ->(x) { tail_found = true }
assert !tail_found, "Expected to not find any :tailcalls, but did"
assert lambdacall_found, "Expected to find a :lambdacall node"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_top_level_conditionals_should_not_have_tail_calls\n tcompile 'zero?(0) && %g'\n tail_found = false\n lambdacall_found = false\n visit_tree @tc.ast, lambdacall: ->(x) { lambdacall_found = true }, tailcall: ->(x) { tail_found = true }\n assert !tail_found, \"Expected to not find any :tailcalls, but did\"\n assert lambdacall_found, \"Expected to find a :lambdacall node\" \n end",
"def test_non_tail_position_blocks_cannot_have_tailcalls\n tails_found = 0\n tcompile 'defn foo() {{9; %g}; 99}'\n visit_tree @tc.ast, tailcall:->(x) {tails_found += 1 }\n assert tails_found.zero?, \"Expected to not find any tail calls, but found #{tails_found} instead\" \n end",
"def test_simple_block_will_tail_call\n src =<<-EOC\n defn t() {\n defn g() { 2;9}\n {3;%g}\n }\n %t\nEOC\n vi = mkvi src; ti = mkti src\n vmax = max_depth { vi.step; vi.frames.length }\n tmax = max_depth { ti.step; ti.frames.length }\n\n assert tmax < vmax, \"Expected #{tmax} to be less than #{vmax}\"\n end",
"def test_will_return_via_tail_call\n src =<<-EOC\ndefn g() {9}\ndefn f(x) {\n zero?(:x) && return %g\n %g + 9\n}\nEOC\n vi = mkvi src+\"\\nf(0)\\n\";ti = mkti src+\"\\nf(0)\\n\"\n assert (vi.run == 9) && (ti.run == 9), \"Expected both optimized and non_optiized to return9, but one of them did not\"\n end",
"def unconditional_branch\n @before_stream = lambda { @file.puts \" location = @ip + 1\" }\n @after_stream = lambda { @file.puts \" arg1.used_at location\" }\n @after_stack = lambda { bb_unconditional_branch }\n method_definition\n end",
"def skip_or_pending_inside_block?(param0 = T.unsafe(nil)); end",
"def taily(sexp)\n if lambdacall?(sexp)\n lambdacall_to_tailcall(sexp)\n elsif conditional?(sexp)\n left = cadr(sexp); right = caddr(sexp)\n left = expression_or_block(left)\n if lambdacall?(right)\n right = lambdacall_to_tailcall(right)\n else\n right = expression_or_block(right)\n end\n list(car(sexp), left, right)\n elsif block?(sexp)\n handle_block(sexp)\n else\n sexp\n end\n end",
"def test3\n\tputs \"Entering test method\"\n\tl = ->{ puts \"Entering lambda\"; break; puts \"Exiting lambda\" }\n\tl.call\n\tputs \"Exiting test method\"\nend",
"def on_tlambda *xs\n unless @found\n @level += 1\n end\n super\n end",
"def captured_by_block?; end",
"def test_lambda\n lambda { p \"Exit from lambda.\" and return }.call()\n p \"Exit from lambda method\" and return\nend",
"def on_lambda *xs\n unless @found\n @level -= 1\n if @level == 0\n @found = true\n @lineno = lineno\n @column = column\n end\n end\n super\n end",
"def next_block_will_be_binary\n @block_arity = 2\n end",
"def after_block_boundary?; end",
"def lambda_stack; end",
"def lambda_stack; end",
"def lambda_stack; end",
"def lambda; end",
"def block?; end",
"def check_return_with_lambda\n my_lambda = lambda { return }\n my_lambda.call\n puts \"This will be output to screen.\"\n puts \" \"\n puts \"remaining line.\"\nend",
"def another_lambda\n\tl = lambda {return}\n\tl.call\n\tputs \"After Lambda\"\nend",
"def my_lambda\n\n\tputs \"first lambda\"\n\n\tproc1 = lambda {\n\n\t\tputs \"second lambda\"\n\t\t#breaak or return\n\n\t}\n\n\tproc1.call\n\tputs \"last lambda\"\nend",
"def bb_unconditional_branch\n @file.puts \" @current_block.left = arg1.basic_block\"\n @file.puts \" @current_block.close\"\n @file.puts \" @current_block = new_basic_block\"\n end",
"def fun3(&block)\n block.yield unless block.nil?\nend",
"def before_block_boundary?; end",
"def test2\n\tputs \"Entering method\"\n\tl = ->{ puts \"Entering lambda\"; return }\n\tl.call\n\tputs \"Exiting lambda\" # this gets executed\nend",
"def cond_stack; end",
"def cond_stack; end",
"def cond_stack; end",
"def my_method\n \n puts \"before proc\"\n\n my_proc = lambda{\n puts \"Inside proc\"\n #return\n #break\n }\n\n my_proc.call\n puts \"after proc\"\n\nend",
"def tail=(_); end",
"def lambda_inside\n return_lambda = lambda { return }\n return_lambda.call\n puts \"In Method! (Lambda)\"\nend",
"def my_method\n \n puts \"before proc\"\n \n my_proc = lambda{\n \n puts \"Inside proc\"\n break\n }\n \n my_proc.call\n puts \"after proc\"\n \nend",
"def captured_by_block; end",
"def endless_loop?; end",
"def keep_if(&block); end",
"def outer; end",
"def not &blk\n @negative = !@negative\n if blk\n @block = blk\n execute_block\n end\n end",
"def block_method\nputs \"called outside block in block_method\"\n#add method, to check if there is a block on this method\nyield if block_given? #predicate method, it have question mark on end\nputs \"now we are returning again to block\"\nend",
"def inner\n puts \"TODO\"\n end",
"def next_block_will_be_binary_with_swapped_arguments\n @block_arity = -2\n end",
"def warn_no_continuations; end",
"def false a\n # catch cuts\n catch :rubylog_cut do\n a.prove { return }\n end\n yield\n end",
"def my_method\n puts \"reached the top\"\n yield\n puts \"reached the bottom\"\nend",
"def bar\n\tf = lambda { return \"return from lambda\"}\n\tf.call # control does not leave bar here\n\treturn \"return from bar\"\nend",
"def accept_nonblock(*) end",
"def accept_nonblock(*) end",
"def accept_nonblock(*) end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def lambda?\n true\n end",
"def abc(x, y, &b)\n puts x \n y.call \n binding.pry # break point here\n b.call if block_given?\nend",
"def test_4_mix_of_lambdas_and_blocks_can_call_each_other\n result = interpret <<EOC\nl1=->() {1}\nb1=:{%l1()}\nl2=->() {%b1}\nm2=:{%l2}\n%m2\nEOC\n assert_eq result, 1\n end",
"def quux\n block = proc do\n break 'quux: proc break'\n end\n block.call\n return 'quux: post proc'\nend",
"def cond; end",
"def cond; end",
"def cond; end",
"def check_return_with_lambda\n my_lambda = lambda { return }\n # lambda return does not cause return of method..\n my_lambda.call\n puts \"This will be output to screen.\"\nend",
"def return!(&block); end",
"def block_and_forth_forever(&block)\nend",
"def block_and_forth_forever(&block)\nend",
"def block_and_forth_forever(&block)\nend",
"def block(node, in_sentence=false)\n body = node.array\n body.each_with_index do |node, index|\n if body.length == index + 1 # last element\n if @in_method\n emit \"Finally we return \"\n end\n visit node, true\n emit \".\"\n else\n visit node, in_sentence\n emit '. '\n end\n end\n end",
"def my_method\n puts \"before proc\"\n my_proc = lambda do\n puts \"inside proc\"\n return\n end\n my_proc.call\n puts \"after proc\"\nend",
"def inside_t1\n yield\n end",
"def run_proc_or_lambda_2(blockblock)\n puts \"station 1 of 3\"\n blockblock.call\n puts \"station 3 of 3\"\nend",
"def run_proc_or_lambda_2(blockblock)\n puts \"station 1 of 3\"\n blockblock.call\n puts \"station 3 of 3\"\nend",
"def another_lambda\n l = lambda {return 1}\n l.call\n puts \"After Lambda\"\nend",
"def lambda_method\n my_lambda = lambda {return \"I'm a lambda\"}\n my_lambda.call\n return \"I'm the last line of the method!\"\nend",
"def block_node; end",
"def block_node; end",
"def tail; end",
"def halted_callback_hook(filter, _); end",
"def blocks() end",
"def check_return_with_lambda\n my_lambda = lambda { return }\n my_lambda.call\n puts \"This will be output to screen.\"\nend",
"def accept_nonblock\r\n end",
"def trampoline\n f = self\n f = f.call while f.kind_of?(Call)\n f\n end",
"def my_method\n puts \"Reached the top\"\n yield\n puts \"Reached the bottom\"\nend",
"def pre_block\n end",
"def pre_block\n end",
"def run_cond; end",
"def check_return_with_lambda\n my_lambda = lambda { return } # merely returns to the execution point where lambda was called\n my_lambda.call\n puts \"This will be output to screen.\"\nend"
] | [
"0.7241717",
"0.690801",
"0.64395726",
"0.63621336",
"0.6343288",
"0.62677443",
"0.6192723",
"0.61860776",
"0.6120529",
"0.6111363",
"0.6101398",
"0.609224",
"0.60827696",
"0.6073877",
"0.60052836",
"0.60052836",
"0.60052836",
"0.5989503",
"0.5989185",
"0.59751594",
"0.5968359",
"0.59548944",
"0.595164",
"0.5879788",
"0.5875392",
"0.5834509",
"0.5833549",
"0.5833549",
"0.5833549",
"0.58245826",
"0.57787436",
"0.5763749",
"0.57513106",
"0.57342976",
"0.5715773",
"0.5674239",
"0.56664073",
"0.566289",
"0.5656577",
"0.5656324",
"0.5643303",
"0.56224513",
"0.56076014",
"0.55984885",
"0.55982536",
"0.5581225",
"0.5581225",
"0.5581225",
"0.5574344",
"0.5574344",
"0.5574344",
"0.5574344",
"0.5574344",
"0.5574344",
"0.5574344",
"0.5574344",
"0.5574344",
"0.5574344",
"0.5574344",
"0.5574344",
"0.5574344",
"0.5574344",
"0.5574344",
"0.5574344",
"0.5574344",
"0.5574344",
"0.5574344",
"0.5574344",
"0.55731165",
"0.55647635",
"0.554984",
"0.5539556",
"0.55222094",
"0.55222094",
"0.55222094",
"0.5519802",
"0.5509739",
"0.5498198",
"0.5498198",
"0.5498198",
"0.549132",
"0.54878736",
"0.5487805",
"0.5463388",
"0.5463388",
"0.54619676",
"0.54540074",
"0.5441504",
"0.5441504",
"0.544006",
"0.54353046",
"0.54352987",
"0.5430425",
"0.5417969",
"0.54154384",
"0.5412697",
"0.54104793",
"0.54104793",
"0.5406225",
"0.53978515"
] | 0.68060917 | 2 |
Should not have any tail calls for toplevel conditionals, either. | def test_top_level_conditionals_should_not_have_tail_calls
tcompile 'zero?(0) && %g'
tail_found = false
lambdacall_found = false
visit_tree @tc.ast, lambdacall: ->(x) { lambdacall_found = true }, tailcall: ->(x) { tail_found = true }
assert !tail_found, "Expected to not find any :tailcalls, but did"
assert lambdacall_found, "Expected to find a :lambdacall node"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def naked_top_level?; end",
"def naked_top_level; end",
"def test_non_tail_position_blocks_cannot_have_tailcalls\n tails_found = 0\n tcompile 'defn foo() {{9; %g}; 99}'\n visit_tree @tc.ast, tailcall:->(x) {tails_found += 1 }\n assert tails_found.zero?, \"Expected to not find any tail calls, but found #{tails_found} instead\" \n end",
"def cond; end",
"def cond; end",
"def cond; end",
"def test_will_return_via_tail_call\n src =<<-EOC\ndefn g() {9}\ndefn f(x) {\n zero?(:x) && return %g\n %g + 9\n}\nEOC\n vi = mkvi src+\"\\nf(0)\\n\";ti = mkti src+\"\\nf(0)\\n\"\n assert (vi.run == 9) && (ti.run == 9), \"Expected both optimized and non_optiized to return9, but one of them did not\"\n end",
"def cond_stack; end",
"def cond_stack; end",
"def cond_stack; end",
"def child_condition; end",
"def conditionally(*) end",
"def conditionally(*) end",
"def test_does_not_convert_lambdacalls_to_tailcalls_for_top_level_constructs\n tcompile 'defn g() {9}; {1; %g}'\n tail_found = false\n lambdacall_found = false\n visit_tree @tc.ast, lambdacall: ->(x) { lambdacall_found = true }, tailcall: ->(x) { tail_found = true }\n assert !tail_found, \"Expected to not find any :tailcalls, but did\"\n assert lambdacall_found, \"Expected to find a :lambdacall node\"\n end",
"def endless_loop?; end",
"def skip_or_pending_inside_block?(param0 = T.unsafe(nil)); end",
"def condition; end",
"def toplevel_method\n true\nend",
"def test_simple_block_will_tail_call\n src =<<-EOC\n defn t() {\n defn g() { 2;9}\n {3;%g}\n }\n %t\nEOC\n vi = mkvi src; ti = mkti src\n vmax = max_depth { vi.step; vi.frames.length }\n tmax = max_depth { ti.step; ti.frames.length }\n\n assert tmax < vmax, \"Expected #{tmax} to be less than #{vmax}\"\n end",
"def unless_condition; end",
"def continue?; end",
"def semact?; false; end",
"def run_cond; end",
"def infinite_loop?; end",
"def demonstrate_early_return\n return\n puts \"You will never see this, because we never get here.\"\nend",
"def capture_eof\n yield\n false\nrescue SystemExit\n true\nend",
"def false a\n # catch cuts\n catch :rubylog_cut do\n a.prove { return }\n end\n yield\n end",
"def warn_no_continuations; end",
"def bb_unconditional_branch\n @file.puts \" @current_block.left = arg1.basic_block\"\n @file.puts \" @current_block.close\"\n @file.puts \" @current_block = new_basic_block\"\n end",
"def exclude_end?() end",
"def main\n if 0\n p 0\n end\n\n if \"\" then\n p 1\n end\n\n if false\n p 2\n end\n\n if nil\n p 3\n end\n\n scope\nend",
"def actual_flow_control\n super\n end",
"def toplevel; end",
"def cond=(_arg0); end",
"def cond=(_arg0); end",
"def cond=(_arg0); end",
"def guard; end",
"def skipped?; end",
"def skipped?; end",
"def skipped?; end",
"def skipped?; end",
"def backtrace_ignores; end",
"def never?; end",
"def unconditional_branch\n @before_stream = lambda { @file.puts \" location = @ip + 1\" }\n @after_stream = lambda { @file.puts \" arg1.used_at location\" }\n @after_stack = lambda { bb_unconditional_branch }\n method_definition\n end",
"def forced_exit?; @quit > 1 end",
"def sticky?() end",
"def has_tail?\n [email protected]?\n end",
"def not_close_scope?(node); end",
"def skip_backtrace=(_arg0); end",
"def tail; end",
"def do_not_thread; true; end",
"def do_not_thread; true; end",
"def do_not_thread; true; end",
"def non_blocking?()\n #This is a stub, used for indexing\n end",
"def leading?\n !(@tailing)\n end",
"def warn_no_continuations\n end",
"def skipping_setup\n @fast_skipped = false\n bt = nil\n begin\n if self[:fast_pending]\n bt, message = self[:fast_pending]\n pend(message)\n elsif self[:fast_omit]\n bt, message, cond_block = self[:fast_omit]\n omit_if(cond_block.call(self), message)\n end\n rescue PendedError, OmittedError => e\n @fast_skipped = true\n # We reset the backtrace to point to the line where the pend/omit call was\n # originally made.\n e.set_backtrace(bt) if bt\n raise e\n end\n end",
"def say_hello\n return\n puts \"Hello!\" #this code will never be reached\nend",
"def proceed?(global_options,command,options,arguments) #:nodoc:\n if command && command.skips_pre\n true\n elsif @@pre_block\n @@pre_block.call(global_options,command,options,arguments)\n else\n true\n end\n end",
"def tail=(_); end",
"def skipped!; end",
"def ignores; end",
"def failure?; terminal_flag == :failure end",
"def failure?; terminal_flag == :failure end",
"def main_end ; end",
"def skip_backtrace; end",
"def taily(sexp)\n if lambdacall?(sexp)\n lambdacall_to_tailcall(sexp)\n elsif conditional?(sexp)\n left = cadr(sexp); right = caddr(sexp)\n left = expression_or_block(left)\n if lambdacall?(right)\n right = lambdacall_to_tailcall(right)\n else\n right = expression_or_block(right)\n end\n list(car(sexp), left, right)\n elsif block?(sexp)\n handle_block(sexp)\n else\n sexp\n end\n end",
"def test_jmpf_branches_if_top_of_stack_is_false\n @ctx.constants = [false, 'ok']\n @bc.codes = [:cls, :pushc, 0, :jmpf, 7, :pushl, 15, :pushc, 1, :halt]\n assert_eq @ci.run, 'ok'\n end",
"def before_block_boundary?; end",
"def requested_flow_control\n super\n end",
"def is_top_level?\n respond_to?(:includes_origen_top_level?)\n end",
"def skipped; end",
"def pre_loop; end",
"def backtrace_ignores=(_arg0); end",
"def infinite?() end",
"def local?; end",
"def optional\n puts 'A code block isn\\'t required, but it\\'s nice.'\n yield if block_given? #Kernel#block_given?\n puts 'I\\'m happy either way, really.'\nend",
"def infinite?; end",
"def pass_control_on_condition\n puts \"Inside the method\"\n yield if block_given? #only if the block present the yield will be executed\n # or yield\n # end\n puts \"Back inside the method\"\nend",
"def outside_control?\n\t t = thread\n\t !t || t != Thread.current\n\tend",
"def fatal?; @level <= FATAL; end",
"def fatal?; @level <= FATAL; end",
"def postcontrol?\n return nil unless body # greez from falsyness\n\n local_variable_scope.first_assignment_in_body_and_used_in_condition?(body, condition)\n end",
"def assert\n raise \"The mode is not printed!\"unless yield\nend",
"def sub_branch?\n !root?\n end",
"def method4(a)\n if a\n puts \"bam\"\n end\n unless(a)\n puts \"baz\"\n end\n end",
"def continue; end",
"def continue; end",
"def check_for_infinite_loop(processed_source, offenses_by_iteration); end",
"def top_level?\n !self.reply_comment?\n end",
"def leaf?; false end",
"def stackless?\n lazy? or not @continuations\n end",
"def non_complex_expression?(condition); end",
"def skip_optional_do_after_expression\n skip_tkspace_without_nl\n tk = get_tk\n\n b_nest = 0\n nest = 0\n\n loop do\n break unless tk\n case tk[:kind]\n when :on_semicolon, :on_nl, :on_ignored_nl then\n break if b_nest.zero?\n when :on_lparen then\n nest += 1\n when :on_rparen then\n nest -= 1\n when :on_kw then\n case tk[:text]\n when 'begin'\n b_nest += 1\n when 'end'\n b_nest -= 1\n when 'do'\n break if nest.zero?\n end\n when :on_comment, :on_embdoc then\n if b_nest.zero? and \"\\n\" == tk[:text][-1] then\n break\n end\n end\n tk = get_tk\n end\n\n skip_tkspace_without_nl\n\n get_tk if peek_tk && :on_kw == peek_tk[:kind] && 'do' == peek_tk[:text]\n end",
"def complex_condition?(condition); end",
"def scope_condition() {} end",
"def missed?; end",
"def pass_control_on_condition\n puts \"Inside the method\"\n\n if block_given?\n yield\n end\n\n puts \"Back inside the method\"\nend",
"def ignore_parent_exclusion=(_arg0); end",
"def pipe?() end"
] | [
"0.7108519",
"0.6499122",
"0.6320789",
"0.61334276",
"0.61334276",
"0.61334276",
"0.60807234",
"0.6032399",
"0.6032399",
"0.6032399",
"0.5990137",
"0.5982177",
"0.5982177",
"0.5909732",
"0.59077466",
"0.58573425",
"0.580224",
"0.5733866",
"0.5727014",
"0.566493",
"0.56537306",
"0.5639219",
"0.5609509",
"0.5603617",
"0.55653125",
"0.5560837",
"0.5558828",
"0.55470526",
"0.55202156",
"0.55095863",
"0.5491719",
"0.5486531",
"0.54589003",
"0.545725",
"0.545725",
"0.545725",
"0.54488146",
"0.54399127",
"0.54399127",
"0.54399127",
"0.54399127",
"0.542416",
"0.54236066",
"0.541715",
"0.5414213",
"0.5408735",
"0.54075843",
"0.5392015",
"0.5380701",
"0.5378402",
"0.53747106",
"0.53747106",
"0.53747106",
"0.53713757",
"0.5369502",
"0.5357437",
"0.53496224",
"0.534782",
"0.5331263",
"0.5330891",
"0.53239125",
"0.5310712",
"0.53064084",
"0.53064084",
"0.53049713",
"0.5278402",
"0.5272697",
"0.5271847",
"0.52625394",
"0.52560383",
"0.52534425",
"0.52235264",
"0.52191806",
"0.5215675",
"0.5208051",
"0.5207651",
"0.5206322",
"0.5204632",
"0.5203979",
"0.51980865",
"0.51915085",
"0.51915085",
"0.5175217",
"0.5173087",
"0.5167634",
"0.5165255",
"0.5162652",
"0.5162652",
"0.51557785",
"0.51469535",
"0.51459914",
"0.51450574",
"0.51361746",
"0.51340723",
"0.51307523",
"0.51289254",
"0.5126235",
"0.5124941",
"0.5118446",
"0.511303"
] | 0.71061885 | 1 |
Cannot have tail calls in blocks that are not the tail position inside lambdas. Must refrain from promoting anything in block or conditional into tailcall. | def test_non_tail_position_blocks_cannot_have_tailcalls
tails_found = 0
tcompile 'defn foo() {{9; %g}; 99}'
visit_tree @tc.ast, tailcall:->(x) {tails_found += 1 }
assert tails_found.zero?, "Expected to not find any tail calls, but found #{tails_found} instead"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_does_not_convert_lambdacalls_to_tailcalls_for_top_level_constructs\n tcompile 'defn g() {9}; {1; %g}'\n tail_found = false\n lambdacall_found = false\n visit_tree @tc.ast, lambdacall: ->(x) { lambdacall_found = true }, tailcall: ->(x) { tail_found = true }\n assert !tail_found, \"Expected to not find any :tailcalls, but did\"\n assert lambdacall_found, \"Expected to find a :lambdacall node\"\n end",
"def test_top_level_conditionals_should_not_have_tail_calls\n tcompile 'zero?(0) && %g'\n tail_found = false\n lambdacall_found = false\n visit_tree @tc.ast, lambdacall: ->(x) { lambdacall_found = true }, tailcall: ->(x) { tail_found = true }\n assert !tail_found, \"Expected to not find any :tailcalls, but did\"\n assert lambdacall_found, \"Expected to find a :lambdacall node\" \n end",
"def taily(sexp)\n if lambdacall?(sexp)\n lambdacall_to_tailcall(sexp)\n elsif conditional?(sexp)\n left = cadr(sexp); right = caddr(sexp)\n left = expression_or_block(left)\n if lambdacall?(right)\n right = lambdacall_to_tailcall(right)\n else\n right = expression_or_block(right)\n end\n list(car(sexp), left, right)\n elsif block?(sexp)\n handle_block(sexp)\n else\n sexp\n end\n end",
"def next_block_will_be_binary\n @block_arity = 2\n end",
"def next_block_will_be_binary_with_swapped_arguments\n @block_arity = -2\n end",
"def fun3(&block)\n block.yield unless block.nil?\nend",
"def lam(&block)\n\tblock.call(1)\nend",
"def next\n head = If.new(left, HeadCallable.new(left), ReturnNull.new)\n .result\n .call\n @left = If.new(left, TailCallable.new(left), ReturnNull.new)\n .result\n .call\n head\n end",
"def block?; end",
"def skip_or_pending_inside_block?(param0 = T.unsafe(nil)); end",
"def on_lambda *xs\n unless @found\n @level -= 1\n if @level == 0\n @found = true\n @lineno = lineno\n @column = column\n end\n end\n super\n end",
"def captured_by_block?; end",
"def trampoline\n f = self\n f = f.call while f.kind_of?(Call)\n f\n end",
"def test_4_mix_of_lambdas_and_blocks_can_call_each_other\n result = interpret <<EOC\nl1=->() {1}\nb1=:{%l1()}\nl2=->() {%b1}\nm2=:{%l2}\n%m2\nEOC\n assert_eq result, 1\n end",
"def process_block exp\n exp = exp.dup\n exp.shift\n\n exp.map! do |e|\n process e\n end\n\n exp.unshift :rlist\n end",
"def test_simple_block_will_tail_call\n src =<<-EOC\n defn t() {\n defn g() { 2;9}\n {3;%g}\n }\n %t\nEOC\n vi = mkvi src; ti = mkti src\n vmax = max_depth { vi.step; vi.frames.length }\n tmax = max_depth { ti.step; ti.frames.length }\n\n assert tmax < vmax, \"Expected #{tmax} to be less than #{vmax}\"\n end",
"def another_lambda\n\tl = lambda {return}\n\tl.call\n\tputs \"After Lambda\"\nend",
"def lambda; end",
"def run_proc_or_lambda_2(blockblock)\n puts \"station 1 of 3\"\n blockblock.call\n puts \"station 3 of 3\"\nend",
"def run_proc_or_lambda_2(blockblock)\n puts \"station 1 of 3\"\n blockblock.call\n puts \"station 3 of 3\"\nend",
"def lambda_stack; end",
"def lambda_stack; end",
"def lambda_stack; end",
"def cbo2 (&inBlock)\n returnLambda = nil\n begin\n puts \"Received inBlock of class #{inBlock.class}\"\n puts \"Inspecting inBlock: #{inBlock.inspect}\"\n puts \"Converting inBlock to lambda\"\n returnLambda = lambda inBlock\n rescue Exception\n puts \"Got an Exception. Guess you can't do that. Returning nil.\"\n end\n returnLambda\nend",
"def my_lambda\n\n\tputs \"first lambda\"\n\n\tproc1 = lambda {\n\n\t\tputs \"second lambda\"\n\t\t#breaak or return\n\n\t}\n\n\tproc1.call\n\tputs \"last lambda\"\nend",
"def on_tlambda *xs\n unless @found\n @level += 1\n end\n super\n end",
"def tail=(_); end",
"def process_block exp\n exp = exp.dup\n exp.shift\n if @inside_concat\n @inside_concat = false\n exp[0..-2].each do |e|\n process e\n end\n @inside_concat = true\n process exp.last\n else\n exp.map! do |e|\n res = process e\n if res.empty? or res == ignore\n nil\n elsif node_type?(res, :lvar) and res.value == :_erbout\n nil\n\n else\n res\n end\n end\n block = Sexp.new(:rlist).concat(exp).compact\n block.line(exp.line)\n block\n end\n end",
"def block_and_forth_forever(&block)\nend",
"def block_and_forth_forever(&block)\nend",
"def block_and_forth_forever(&block)\nend",
"def run_proc_or_lambda(blockblock)\n puts \"station 1 of 3\"\n blockblock.call\n puts \"station 3 of 3\"\nend",
"def tail_rewrite(ast)\n fn = ->(v) { if tail_candidate?(v)\n list(car(v), cadr(v), map_inner_tree(caddr(v), &fn))\n else\n v\n end\n }\n\n map_inner_tree(ast, &fn)\nend",
"def test_will_return_via_tail_call\n src =<<-EOC\ndefn g() {9}\ndefn f(x) {\n zero?(:x) && return %g\n %g + 9\n}\nEOC\n vi = mkvi src+\"\\nf(0)\\n\";ti = mkti src+\"\\nf(0)\\n\"\n assert (vi.run == 9) && (ti.run == 9), \"Expected both optimized and non_optiized to return9, but one of them did not\"\n end",
"def test3\n\tputs \"Entering test method\"\n\tl = ->{ puts \"Entering lambda\"; break; puts \"Exiting lambda\" }\n\tl.call\n\tputs \"Exiting test method\"\nend",
"def full_lift_proc(&block)\n lambda do |*args|\n args.inject(curry_lift_proc(&block)) do |a,e|\n a.apply(e)\n end\n end\n end",
"def return!(&block); end",
"def call_block(block,stdout,stderr,exitstatus)\n # blocks that take no arguments have arity -1. Or 0. Ugh.\n if block.arity > 0\n case block.arity\n when 1 \n block.call(stdout)\n when 2\n block.call(stdout,stderr)\n else\n # Let it fail for lambdas\n block.call(stdout,stderr,exitstatus)\n end\n else\n block.call\n end\n end",
"def traverse(&block); end",
"def traverse(&block); end",
"def maybe_append_block! args, blk\n return false unless @has_proc_contract && !blk &&\n (@args_contract_index || args.size < args_contracts.size)\n\n args << nil\n true\n end",
"def foo3(&block)\n block.call(1) \nend",
"def lambda?\n block_literal? && method?(:lambda)\n end",
"def iterating_block?(node); end",
"def captured_by_block; end",
"def check_return_with_lambda\n my_lambda = lambda { return }\n my_lambda.call\n puts \"This will be output to screen.\"\n puts \" \"\n puts \"remaining line.\"\nend",
"def another_lambda\n l = lambda {return 1}\n l.call\n puts \"After Lambda\"\nend",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def leaf_lambda(node, this, nxt)\n set_lambda(this, nxt, 1)\n end",
"def next\n if @lambdas.size > 0\n @lambdas.shift.call(lambda { self.next })\n else\n @running = false\n end\n end",
"def keep_if(&block); end",
"def callBlock\n yield\n yield\nend",
"def block_vs_proc_lamda\n #puts $catch_block\n print \"In method: before yield\\n\"\n yield\n print \"In method: after yield\\n\"\n \n p = Proc.new { |my_var| print \"in method in proc and parameter is: #{my_var}\\n\"} \n p.call 10\n l = lambda { |lamda_var| print \"in method in lambda and parameter is: #{lamda_var}\\n\"}\n l.call 11 \n #puts $catch_block\n 10\nend",
"def run_block_3\n p = Proc.new # if new proc is not passed a code block, it looks to see if the current scope has been passed a code block and use that\n p.call # if current scope has not been passed a code block, there will be an error\nend",
"def lamda_method\n l = lambda { return \"\\nreturning from lamda\\n\"}\n l.call\n print \"\\nStatement after lamda\\n\"\nend",
"def callBlock\n yield ,\n end",
"def after_block_boundary?; end",
"def block_checker(param) \n [ param , block_given? ]\nend",
"def take_block(&block)\n block.call\nend",
"def take_block(&block)\n block.call\nend",
"def take_block(&block)\n block.call\nend",
"def take_block(&block)\n block.call\nend",
"def take_block(&block)\n block.call\nend",
"def take_block(&block)\n block.call\nend",
"def lambda?\n true\n end",
"def block_node; end",
"def block_node; end",
"def hello(&block)\n puts block\n block.call\nend",
"def call_block(&block)\n block.call\nend",
"def foldl(list, &block); end",
"def hello_world(&block)\n puts block.call\nend",
"def nullary_method_with_block( str )\n # puts \"in nullary_m_with_block, str = #{str}\" # DEBUG\n if @take_block == true then\n nullary_method( str )\n else # code a block\n @w = :block # change writing method\n belay # a must before block opening\n # push a new pipe, head and tail to the writing stack:\n @rr.empty? ? ( @rr = [@r] ) : ( @rr.push @r ) # store the register\n @r = :delta # a block runs in its own unswitchable register delta\n @pipe << String.new # push pipe\n # puts \"@pipe is << #@pipe >>\" # DEBUG\n @head << case @block_arity # push head\n when 0 then [ \"#{str} { \" ]\n when 1 then set \"delta\"; [ \"#{str} { |epsilon|\" ]\n when 2 then @argsrc.zeta; @argsrc.ref!\n set \"delta\"; [ \"#{str} { |epsilon, zeta|\" ]\n when -2 then @argsrc.epsilon; @argsrc.ref!\n set \"delta\"; [ \"#{str} { |epsilon, zeta|\" ]\n else raise \"Unknown @block_arity: #@block_arity\"\n end\n write \"\\n\"\n opener = case @block_arity; when 0 then \"\";\n when 1, 2 then \"delta = epsilon\"\n when -2 then \"delta = zeta\" end\n @opener << opener # push opener\n @block_arity = 1 # after use, set block arity flag back to default\n # puts \"@pipe is << #@pipe >>\" # DEBUG\n write opener; write \"\\n\"; write @pipe.last\n finisher = String.new\n @finisher << finisher # push finisher\n @tail << [ \"\\n\" ] # push tail\n @tail.last << finisher << \"\\n\" << \"}\" # done\n end\n end",
"def bb_unconditional_branch\n @file.puts \" @current_block.left = arg1.basic_block\"\n @file.puts \" @current_block.close\"\n @file.puts \" @current_block = new_basic_block\"\n end",
"def unconditional_branch\n @before_stream = lambda { @file.puts \" location = @ip + 1\" }\n @after_stream = lambda { @file.puts \" arg1.used_at location\" }\n @after_stack = lambda { bb_unconditional_branch }\n method_definition\n end",
"def take_block(a) \n if block_given?\n yield(a) \n else \n a\n end\nend",
"def block_node=(_); end",
"def compute\n return yield if block_given?\n\n 'Does not compute.'\nend",
"def i_take_an_explicit_block &block\n puts block.inspect\nend",
"def block_checker(array, &block)\n [array.to_a, !!block]\nend",
"def hello(&block)\n puts \"Hello #{block.call}\" if block_given?\nend",
"def hello(&block)\n puts \"Hello #{block.call}\" if block_given?\nend"
] | [
"0.6700456",
"0.6526589",
"0.6526163",
"0.6451164",
"0.6203788",
"0.6100986",
"0.6070055",
"0.6023657",
"0.59866434",
"0.5948143",
"0.59413046",
"0.59318626",
"0.58681124",
"0.58627313",
"0.58618885",
"0.5852341",
"0.5849713",
"0.584776",
"0.58378494",
"0.58378494",
"0.5827967",
"0.5827967",
"0.5827967",
"0.58213645",
"0.5762638",
"0.57576156",
"0.5736532",
"0.57210016",
"0.57180715",
"0.57180715",
"0.57180715",
"0.57172316",
"0.5703878",
"0.5688182",
"0.56635803",
"0.56599367",
"0.5640679",
"0.5637352",
"0.5636966",
"0.5636966",
"0.5624043",
"0.5620233",
"0.5585966",
"0.5576045",
"0.5572146",
"0.55483264",
"0.5546967",
"0.55371183",
"0.55371183",
"0.55371183",
"0.55371183",
"0.55371183",
"0.55371183",
"0.55371183",
"0.55371183",
"0.55371183",
"0.55371183",
"0.55371183",
"0.55371183",
"0.55371183",
"0.55371183",
"0.55371183",
"0.55371183",
"0.55371183",
"0.55371183",
"0.55371183",
"0.55371183",
"0.5512514",
"0.55122405",
"0.5512143",
"0.54701364",
"0.5468924",
"0.54677325",
"0.5459208",
"0.5450184",
"0.5445223",
"0.54435605",
"0.5428117",
"0.5428117",
"0.5428117",
"0.5428117",
"0.5428117",
"0.5428117",
"0.5425472",
"0.5424397",
"0.5424397",
"0.54225624",
"0.54175717",
"0.5416806",
"0.54111016",
"0.53911555",
"0.53719574",
"0.53652203",
"0.53647316",
"0.5363998",
"0.5357791",
"0.5349982",
"0.53462815",
"0.533864",
"0.533864"
] | 0.6599951 | 1 |
GET /tutorials GET /tutorials.json | def index
@search = Tutorial.search(params[:q])
@tutorials = @search.result.where(suggestion: false).page(params[:page]).per(5).order('created_at DESC')
@suggestions = @search.result.where(suggestion: true).page(params[:page]).per(5).order('created_at DESC')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tutorials }\n end\n end",
"def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html\n format.json do\n render json: @tutorials\n end\n end\nend",
"def show\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial }\n end\n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial.to_hash(false) }\n end\n end",
"def new\n @tutorial = Tutorial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial }\n end\n end",
"def new\n @tutorial = Tutorial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial }\n end\n end",
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def index\n @tutorials = @course.tutorials.all\n end",
"def show\n @tutorials = Tutorials.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tutorials }\n end\n end",
"def show\n @lesson_learned = LessonLearned.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lesson_learned }\n end\n end",
"def index\n\t\t@tutorials = Tutorial.order(sort_column + \" \" + sort_direction).page(params[:page]).per(10)\n\n\t\trespond_to do |format|\n\t\t format.js\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render :json => @tutorials }\n\t\tend\n\tend",
"def index\n @tutorials = current_user.tutorials\n end",
"def new\n\t\t@tutorial = Tutorial.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render :json => @tutorial }\n\t\tend\n\tend",
"def index\n @tutorials = Tutorials.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tutorials }\n end\n end",
"def create\n @tutorials = Tutorial.all\n @tutorial = Tutorial.new(tutorial_params)\n\n if @tutorial.save\n render json: @tutorial\n else\n render json: @tutorial.errors.full_messages, status:400\n end\n end",
"def index\n @lessons = Lesson.all\n\n render 'index.json'\n end",
"def index\n @lesson_learneds = LessonLearned.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lesson_learneds }\n end\n end",
"def show\n @lesson = Lesson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lesson }\n end\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @examples }\n end\n end",
"def show\n\t\t@tutorial = Tutorial.find(params[:id])\n\t\t@tutorial_reviews = TutorialReview.find_all_by_tutorial_id(@tutorial.id).reverse\n\n\t\t#@tweets = Tweet.find_all_by_tutorial_id(@tutorial.id)\n\n\t\t@tweets = Tweet.where(\"tweets.updated_at <= (SELECT MIN(t.updated_at) FROM tweets AS t WHERE t.from_user=tweets.from_user)\").order(\"tweets.tweet_id desc\").find_all_by_tutorial_id(@tutorial.id).first(108)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render :json => @tutorial }\n\t\tend\n\tend",
"def show\n @backend_tutorial_stat = Backend::TutorialStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @backend_tutorial_stat }\n end\n end",
"def index\n @tutorials = Tutorial.all\n @title = \"A collection of Ruby on Rails tutorials\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tutorials }\n end\n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n end",
"def show\n @lesson = Lesson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @lesson }\n end\n end",
"def index\n #@lessons = Lesson.all\n @lessons = @course.lessons.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @lessons }\n end\n end",
"def tutorial\n end",
"def index\n @tutorial_sections = TutorialSection.all\n end",
"def show\n @learn = Learn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @learn }\n end\n end",
"def new\n @tutorial_quest = Tutorial::Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial_quest }\n end\n end",
"def create\n @tutorial = current_user.tutorials.create(tutorial_params)\n\n respond_to do |format|\n if @tutorial.save\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully created.' }\n format.json { render :show, status: :created, location: @tutorial }\n else\n format.html { render :new }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n if params[:topic_id]\n lessons = Lesson.where( topic_id: params[:topic_id] )\n else\n lessons = Lesson.all\n end\n\n respond_to do |format| \n format.html { }\n format.js { }\n format.json { render json: lessons }\n end\n end",
"def show\n \t@tutorial = Tutorial.find_by_permalink(params[:id])\n @steps = @tutorial.steps\n @next = @steps[0]\n @title = \"#{@tutorial.name} - A Ruby on Rails tutorial\"\n @content = \"Building a forum application from scratch using Ruby on Rails 3\"\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tutorial }\n end\n end",
"def index\n @guides = Guide.page(1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: {:guides => @guides.as_json} }\n end\n end",
"def show\n @lab_teach_resource = LabTeachResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_teach_resource }\n end\n end",
"def show\n #@lesson = Lesson.find(params[:id])\n @lesson = @course.lessons.find(params[:id])\n @lessons = @course.lessons.all\n @courses = Course.all\n @pages = @lesson.pages.all\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @lesson }\n end\n end",
"def index\n @teaches = Teach.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teaches }\n end\n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n\t @videos = @tutorial.videos.all\n \n end",
"def index\n @tutorials = Tutorial.page(params[:page]).per(5)\n @page_title = \"My Portfolio Tutorials\"\n end",
"def show\n @title = t 'view.teaches.show_title'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teach }\n end\n end",
"def tutorial_params\n params.require(:tutorials).permit()\n end",
"def new\n @tutorials = Tutorials.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tutorials }\n end\n end",
"def new\n @lesson_learned = LessonLearned.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lesson_learned }\n end\n end",
"def show\n @teach = Teach.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teach }\n end\n end",
"def show\n @teach = Teach.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teach }\n end\n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n @first_tutorial = Tutorial.first\n # if @tutorial.id == Tutorial.maximum(\"id\")\n # @next_tutorial = Tutorial.find(1)\n # else \n # @next_tutorial = Tutorial.find(@tutorial.id + 1)\n # end\n\n @user = current_user\n if [email protected]?\n @quiz = Quiz.where(:user_id => @user.id, :tutorial_id => @tutorial.id)\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial }\n end\n end",
"def show\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @practice }\n end\n end",
"def show\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @practice }\n end\n end",
"def get_tutorials\n Story.published.commoners_voice.select do |s|\n %w(tutorial howto).all? {|t| s.tags.pluck(:name).include?(t)}\n end.first(3)\n end",
"def show\n #@course = Course.find(params[:course_id])\n @course_lesson = CourseLesson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course_lesson }\n end\n end",
"def new\n @lesson = Lesson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lesson }\n end\n end",
"def index\n @creator = current_user\n @user_tutorials = UserTutorial.includes(:user)\n @langs = [\"CSS\", \"HTML\"]\n end",
"def test\n get(\"/help/test\")\n end",
"def set_tutorial\n @tutorial = @course.tutorials.friendly.find(params[:id])\n end",
"def tutorial_params\n params.require(:tutorial).permit(:title, :body)\n end",
"def index\n @ideas = Idea.all\n\n render json: @ideas\n end",
"def new\n @tutorial = Tutorial.new\n\t@title = \"New tutorial\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tutorial }\n end\n end",
"def index\n @ideas = Idea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end",
"def index\n @lectures = Lecture.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @lectures }\n end\n end",
"def index\n @ideas = Idea.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end",
"def show\n begin\n @example = Example.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n # last URL parameter is not example ID, but the example's number\n @example = @language.examples.where(number: params[:id].to_i).first\n end\n @examples = [@example]\n respond_to do |format|\n format.html { render 'examples/index' } # also show index.html.erb\n format.json { render json: @example }\n end\n end",
"def show\n @study = Study.find(params[:id])\n render json: @study\n end",
"def show\n @study = find_or_redirect_to_study || return #redirecting\n @lessons = @study.lessons\n\n # Users last watched or... for now\n @lesson = @lessons.first\n\n respond_to do |format|\n format.html { redirect_to study_lesson_url(@study, @lesson) }\n format.json { render json: @study }\n end\n end",
"def tutorial_params\n params.require(:tutorial).permit(:title, :functionality, :learning_language_ids, :body, :suggestion)\n end",
"def destroy\n @tutorial = Tutorial.find(params[:id])\n @tutorial.destroy\n render json: @tutorial\n end",
"def show\n @lecture_note = LectureNote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lecture_note }\n end\n end",
"def index\n @my_exams = MyExam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_exams }\n end\n end",
"def new\n #@lesson = Lesson.new\n @lesson = @course.lessons.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lesson }\n end\n end",
"def show\n @teacher = Teacher.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teacher }\n end\n end",
"def show\n @need_help = NeedHelp.find(params[:id])\n\n respond_to do |format|\n format.json {render json: @need_help}\n end\n end",
"def show\n @help = Help.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @help }\n end\n end",
"def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"def index\n @lessons = Lesson.all\n end",
"def index\n @lessons = Lesson.all\n end",
"def index\n @lessons = Lesson.all\n end",
"def index\n @lessons = Lesson.all\n end",
"def get_students\n @course = Course.find(params[:course_id])\n\n render json: @course.students\n end",
"def show\n @guide = Guide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guide.as_json(:root => true) }\n end\n end",
"def show\n @teacher = Teacher.find(params[:id])\n\n respond_to do |format|\n #format.html # show.html.erb\n format.json { render json: @teacher }\n end\n end",
"def show\n @training = Training.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @training }\n end\n end",
"def show\n @love = Love.find(params[:id])\n render json: @love\n end",
"def show\n @study = Study.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @study }\n end\n end",
"def show\n render status: 200, json: UserTrainingStory.find(params[:id])\n end",
"def show\n @teacher = Teacher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @teacher }\n end\n end",
"def index\n @title = \"Studies\"\n\n respond_to do |format|\n format.html do\n @my_studies = Study.with_user(current_user.netid)\n end\n format.json do\n render :json => Study.with_user(current_user.netid).to_json\n end\n end\n end",
"def set_tutorial\n @tutorial = Tutorial.find(params[:id])\n end",
"def set_tutorial\n @tutorial = Tutorial.find(params[:id])\n end",
"def set_tutorial\n @tutorial = Tutorial.find(params[:id])\n end",
"def set_tutorial\n @tutorial = Tutorial.find(params[:id])\n end",
"def create\n \n if is_admin?\n @tutorial = Tutorial.new({user_id: @cur_user.id, title: \"#{@cur_user.name}'s Tutorial\"})\n respond_to do |format|\n if @tutorial.save\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully created.' }\n format.json { render json: @tutorial.to_hash(false), status: :created, location: @tutorial }\n else\n format.html { render :status => 404 }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { render text: \"Not allowed\", status: 404 }\n format.json { render json: @tutorial.errors, status: :forbidden }\n end\n end\n end",
"def index\n @ideas = Idea.current_ideas_for(current_user).entries\n respond_with(@ideas) do |format|\n format.json { render json: @ideas }\n end\n end",
"def test_get_skills_route\n render :json => get_profile_skills_for_profile(\"https://www.linkedin.com/in/marissamayer\").to_json\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @exercises }\n end\n end",
"def index\n session[:currTags] = [];\n @tutorials = Tutorial.find(:all, :order => \"rating DESC, updated_at\")\n @tutorialViewBoxes = tutorialViewBox_factory(@tutorials)\n @tags = Tag.find(:all, :select => \"name\").map(&:name)\n @categories = Category.all\n respond_to do |format|\n format.html{render :layout => 'application_no_footer'} \n format.json { render json: @tutorialViewBoxes }\n end\n end",
"def create\n @tutorial = Tutorial.new(params[:tutorial])\n\n respond_to do |format|\n if @tutorial.save\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully created.' }\n format.json { render json: @tutorial, status: :created, location: @tutorial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tutorial = Tutorial.new(params[:tutorial])\n\n respond_to do |format|\n if @tutorial.save\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully created.' }\n format.json { render json: @tutorial, status: :created, location: @tutorial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @topics = Topic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @topics }\n end\n end",
"def index\n @topics = Topic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @topics }\n end\n end",
"def index\n @topics = Topic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @topics }\n end\n end"
] | [
"0.76766384",
"0.7651599",
"0.73566383",
"0.72547084",
"0.67954177",
"0.67954177",
"0.67930365",
"0.67930365",
"0.67266923",
"0.6671137",
"0.6664682",
"0.6612035",
"0.6605375",
"0.65844387",
"0.6584147",
"0.65572023",
"0.6529032",
"0.65067923",
"0.64678335",
"0.6459095",
"0.64441407",
"0.6414745",
"0.6410353",
"0.639915",
"0.63963115",
"0.63602185",
"0.6266924",
"0.62500226",
"0.6229867",
"0.6170651",
"0.61618805",
"0.6141078",
"0.6131107",
"0.6124707",
"0.61146176",
"0.6096237",
"0.6084975",
"0.60642016",
"0.6059753",
"0.60439456",
"0.6018319",
"0.6009907",
"0.59937197",
"0.5988883",
"0.5988883",
"0.5946074",
"0.5935024",
"0.5935024",
"0.59292835",
"0.59245443",
"0.5921525",
"0.59187704",
"0.58985883",
"0.5889605",
"0.5876243",
"0.5875558",
"0.5855841",
"0.585538",
"0.5834199",
"0.5833738",
"0.5831567",
"0.5825101",
"0.5806772",
"0.5799925",
"0.57987314",
"0.5775681",
"0.5773054",
"0.57667863",
"0.57640916",
"0.5757779",
"0.57530177",
"0.57513666",
"0.5748428",
"0.5748428",
"0.57474",
"0.57474",
"0.57474",
"0.57474",
"0.5741963",
"0.5736815",
"0.5730642",
"0.5725903",
"0.5723309",
"0.5718621",
"0.57185316",
"0.57183075",
"0.57111126",
"0.57106674",
"0.57106674",
"0.57106674",
"0.57106674",
"0.57068455",
"0.5700299",
"0.56913996",
"0.5690213",
"0.5689685",
"0.56894904",
"0.56894904",
"0.5688595",
"0.5688595",
"0.5688595"
] | 0.0 | -1 |
GET /tutorials/1 GET /tutorials/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tutorials }\n end\n end",
"def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html\n format.json do\n render json: @tutorials\n end\n end\nend",
"def show\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial }\n end\n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial.to_hash(false) }\n end\n end",
"def new\n @tutorial = Tutorial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial }\n end\n end",
"def new\n @tutorial = Tutorial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial }\n end\n end",
"def show\n @lesson_learned = LessonLearned.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lesson_learned }\n end\n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n end",
"def show\n @lesson = Lesson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lesson }\n end\n end",
"def new\n\t\t@tutorial = Tutorial.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render :json => @tutorial }\n\t\tend\n\tend",
"def show\n @tutorials = Tutorials.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tutorials }\n end\n end",
"def create\n @tutorials = Tutorial.all\n @tutorial = Tutorial.new(tutorial_params)\n\n if @tutorial.save\n render json: @tutorial\n else\n render json: @tutorial.errors.full_messages, status:400\n end\n end",
"def index\n @tutorials = @course.tutorials.all\n end",
"def show\n @lesson = Lesson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @lesson }\n end\n end",
"def index\n @lessons = Lesson.all\n\n render 'index.json'\n end",
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def show\n @backend_tutorial_stat = Backend::TutorialStat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @backend_tutorial_stat }\n end\n end",
"def show\n\t\t@tutorial = Tutorial.find(params[:id])\n\t\t@tutorial_reviews = TutorialReview.find_all_by_tutorial_id(@tutorial.id).reverse\n\n\t\t#@tweets = Tweet.find_all_by_tutorial_id(@tutorial.id)\n\n\t\t@tweets = Tweet.where(\"tweets.updated_at <= (SELECT MIN(t.updated_at) FROM tweets AS t WHERE t.from_user=tweets.from_user)\").order(\"tweets.tweet_id desc\").find_all_by_tutorial_id(@tutorial.id).first(108)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render :json => @tutorial }\n\t\tend\n\tend",
"def index\n @tutorials = Tutorials.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tutorials }\n end\n end",
"def index\n @tutorials = current_user.tutorials\n end",
"def index\n @lesson_learneds = LessonLearned.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lesson_learneds }\n end\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @examples }\n end\n end",
"def index\n\t\t@tutorials = Tutorial.order(sort_column + \" \" + sort_direction).page(params[:page]).per(10)\n\n\t\trespond_to do |format|\n\t\t format.js\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render :json => @tutorials }\n\t\tend\n\tend",
"def show\n @learn = Learn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @learn }\n end\n end",
"def index\n @tutorials = Tutorial.all\n @title = \"A collection of Ruby on Rails tutorials\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tutorials }\n end\n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n @first_tutorial = Tutorial.first\n # if @tutorial.id == Tutorial.maximum(\"id\")\n # @next_tutorial = Tutorial.find(1)\n # else \n # @next_tutorial = Tutorial.find(@tutorial.id + 1)\n # end\n\n @user = current_user\n if [email protected]?\n @quiz = Quiz.where(:user_id => @user.id, :tutorial_id => @tutorial.id)\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial }\n end\n end",
"def index\n #@lessons = Lesson.all\n @lessons = @course.lessons.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @lessons }\n end\n end",
"def show\n \t@tutorial = Tutorial.find_by_permalink(params[:id])\n @steps = @tutorial.steps\n @next = @steps[0]\n @title = \"#{@tutorial.name} - A Ruby on Rails tutorial\"\n @content = \"Building a forum application from scratch using Ruby on Rails 3\"\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tutorial }\n end\n end",
"def new\n @tutorial_quest = Tutorial::Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial_quest }\n end\n end",
"def show\n begin\n @example = Example.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n # last URL parameter is not example ID, but the example's number\n @example = @language.examples.where(number: params[:id].to_i).first\n end\n @examples = [@example]\n respond_to do |format|\n format.html { render 'examples/index' } # also show index.html.erb\n format.json { render json: @example }\n end\n end",
"def tutorial\n end",
"def create\n @tutorial = current_user.tutorials.create(tutorial_params)\n\n respond_to do |format|\n if @tutorial.save\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully created.' }\n format.json { render :show, status: :created, location: @tutorial }\n else\n format.html { render :new }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @tutorial_sections = TutorialSection.all\n end",
"def index\n @guides = Guide.page(1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: {:guides => @guides.as_json} }\n end\n end",
"def index\n if params[:topic_id]\n lessons = Lesson.where( topic_id: params[:topic_id] )\n else\n lessons = Lesson.all\n end\n\n respond_to do |format| \n format.html { }\n format.js { }\n format.json { render json: lessons }\n end\n end",
"def show\n #@lesson = Lesson.find(params[:id])\n @lesson = @course.lessons.find(params[:id])\n @lessons = @course.lessons.all\n @courses = Course.all\n @pages = @lesson.pages.all\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @lesson }\n end\n end",
"def new\n @lesson = Lesson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lesson }\n end\n end",
"def new\n @lesson_learned = LessonLearned.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lesson_learned }\n end\n end",
"def show\n @title = t 'view.teaches.show_title'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teach }\n end\n end",
"def set_tutorial\n @tutorial = @course.tutorials.friendly.find(params[:id])\n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n\t @videos = @tutorial.videos.all\n \n end",
"def index\n @tutorials = Tutorial.page(params[:page]).per(5)\n @page_title = \"My Portfolio Tutorials\"\n end",
"def show\n @lab_teach_resource = LabTeachResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_teach_resource }\n end\n end",
"def show\n @study = Study.find(params[:id])\n render json: @study\n end",
"def new\n @tutorials = Tutorials.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tutorials }\n end\n end",
"def new\n @tutorial = Tutorial.new\n\t@title = \"New tutorial\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tutorial }\n end\n end",
"def show\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @practice }\n end\n end",
"def show\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @practice }\n end\n end",
"def show\n #@course = Course.find(params[:course_id])\n @course_lesson = CourseLesson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course_lesson }\n end\n end",
"def destroy\n @tutorial = Tutorial.find(params[:id])\n @tutorial.destroy\n render json: @tutorial\n end",
"def index\n @teaches = Teach.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @teaches }\n end\n end",
"def set_tutorial\n @tutorial = Tutorial.find(params[:id])\n end",
"def show\n render status: 200, json: UserTrainingStory.find(params[:id])\n end",
"def new\n #@lesson = Lesson.new\n @lesson = @course.lessons.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lesson }\n end\n end",
"def set_tutorial\n @tutorial = Tutorial.find(params[:id])\n end",
"def set_tutorial\n @tutorial = Tutorial.find(params[:id])\n end",
"def set_tutorial\n @tutorial = Tutorial.find(params[:id])\n end",
"def set_tutorial\n @tutorial = Tutorial.find(params[:id])\n end",
"def show\n @study = find_or_redirect_to_study || return #redirecting\n @lessons = @study.lessons\n\n # Users last watched or... for now\n @lesson = @lessons.first\n\n respond_to do |format|\n format.html { redirect_to study_lesson_url(@study, @lesson) }\n format.json { render json: @study }\n end\n end",
"def show\n @teach = Teach.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teach }\n end\n end",
"def show\n @teach = Teach.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teach }\n end\n end",
"def show\n render status: 200, json: Training.find(params[:id])\n end",
"def show\n @study = Study.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @study }\n end\n end",
"def show\n @training = Training.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @training }\n end\n end",
"def show\n @lecture_note = LectureNote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lecture_note }\n end\n end",
"def set_tutorial\n @tutorial = Tutorial.friendly.find(params[:id])\n end",
"def show\n @story = Story.find(params[:id])\n\t\t@title = \"Newsy | \" + @story.title\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story }\n end\n end",
"def new\n @title = t 'view.teaches.new_title'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @teach }\n end\n end",
"def create\n @tutorial = Tutorial.new(params[:tutorial])\n\n respond_to do |format|\n if @tutorial.save\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully created.' }\n format.json { render json: @tutorial, status: :created, location: @tutorial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tutorial = Tutorial.new(params[:tutorial])\n\n respond_to do |format|\n if @tutorial.save\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully created.' }\n format.json { render json: @tutorial, status: :created, location: @tutorial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tutorial_params\n params.require(:tutorials).permit()\n end",
"def show\n @guide = Guide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guide.as_json(:root => true) }\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"def show\n @yourstory = Yourstory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @yourstory }\n end\n end",
"def show\n story = Story.find(params[:id])\n render json: story\n end",
"def create\n @tutorial = Tutorial.new(tutorial_params)\n\n respond_to do |format|\n if @tutorial.save\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tutorial }\n else\n format.html { render action: 'new' }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @help = Help.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @help }\n end\n end",
"def destroy\n @tutorial = Tutorial.find(params[:id])\n @tutorial.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorials_url }\n format.json { head :no_content }\n end\n end",
"def index\n @ideas = Idea.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end",
"def index\n @ideas = Idea.all\n\n render json: @ideas\n end",
"def show\n if params[:category_id]\n @category = Category.find(params[:category_id])\n #category = Category.find(params[:category_id])\n @tutorials = Tutorial.where(:category_id => @category)\n else\n @tutorials = Tutorial.all\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end",
"def tutorial_params\n params.require(:tutorial).permit(:title, :body)\n end",
"def show\n render :json => Topic.find(params[:id]) \n end",
"def show\n @laboratory = Laboratory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @laboratory }\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @exercises }\n end\n end",
"def show\n @familiar = Familiar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @familiar }\n end\n end",
"def show\n @love = Love.find(params[:id])\n render json: @love\n end",
"def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end",
"def show\n @exercise = Exercise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end",
"def index\n @api_v1_todos = Todo.all\n render json: @api_v1_todos\n end",
"def index\n @ideas = Idea.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end",
"def show\n @need_help = NeedHelp.find(params[:id])\n\n respond_to do |format|\n format.json {render json: @need_help}\n end\n end",
"def index\n @creator = current_user\n @user_tutorials = UserTutorial.includes(:user)\n @langs = [\"CSS\", \"HTML\"]\n end",
"def show\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam }\n end\n end",
"def show\n @knowledge = Knowledge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @knowledge }\n end\n end",
"def new\n @learn = Learn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @learn }\n end\n end",
"def index\n @lessons = Lesson.all\n end",
"def index\n @lessons = Lesson.all\n end",
"def index\n @lessons = Lesson.all\n end"
] | [
"0.7621065",
"0.758367",
"0.7509276",
"0.7332348",
"0.69647455",
"0.69647455",
"0.67902",
"0.67004806",
"0.66976464",
"0.6686013",
"0.66804034",
"0.66611755",
"0.6650495",
"0.66296536",
"0.66223055",
"0.66203606",
"0.66203606",
"0.6610281",
"0.65733653",
"0.6518051",
"0.65089566",
"0.6463732",
"0.6443637",
"0.6441546",
"0.6410208",
"0.63928294",
"0.6353566",
"0.634893",
"0.63468915",
"0.6329407",
"0.6323342",
"0.6287764",
"0.62721366",
"0.62174207",
"0.6205816",
"0.6187683",
"0.6186058",
"0.6180725",
"0.6150323",
"0.61453456",
"0.6137895",
"0.61321294",
"0.61280066",
"0.61269945",
"0.6109036",
"0.6079252",
"0.60632044",
"0.6059592",
"0.6059592",
"0.60567456",
"0.6056011",
"0.60548115",
"0.6021643",
"0.60145086",
"0.60086334",
"0.60084313",
"0.60084313",
"0.60084313",
"0.60084313",
"0.60032314",
"0.5995579",
"0.5995579",
"0.5977288",
"0.5973076",
"0.59660333",
"0.596439",
"0.5943449",
"0.5941382",
"0.593269",
"0.5922915",
"0.5922915",
"0.59109235",
"0.59107727",
"0.5901488",
"0.5901488",
"0.5895536",
"0.5873122",
"0.58700246",
"0.5866165",
"0.5862606",
"0.58618075",
"0.58606344",
"0.58543587",
"0.5853895",
"0.58531284",
"0.58471256",
"0.5844964",
"0.5844508",
"0.58355385",
"0.58341795",
"0.58341795",
"0.5832514",
"0.5829842",
"0.5829569",
"0.5827445",
"0.5818938",
"0.58082664",
"0.580724",
"0.5807089",
"0.5807089",
"0.5807089"
] | 0.0 | -1 |
POST /tutorials POST /tutorials.json | def create
@tutorial = Tutorial.new(tutorial_params)
respond_to do |format|
if @tutorial.save
format.html { redirect_to @tutorial, notice: 'Tutorial was successfully created.' }
format.json { render action: 'show', status: :created, location: @tutorial }
else
format.html { render action: 'new' }
format.json { render json: @tutorial.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @tutorials = Tutorial.all\n @tutorial = Tutorial.new(tutorial_params)\n\n if @tutorial.save\n render json: @tutorial\n else\n render json: @tutorial.errors.full_messages, status:400\n end\n end",
"def create\n @tutorial = current_user.tutorials.create(tutorial_params)\n\n respond_to do |format|\n if @tutorial.save\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully created.' }\n format.json { render :show, status: :created, location: @tutorial }\n else\n format.html { render :new }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tutorial = Tutorial.new(params[:tutorial])\n\n respond_to do |format|\n if @tutorial.save\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully created.' }\n format.json { render json: @tutorial, status: :created, location: @tutorial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tutorial = Tutorial.new(params[:tutorial])\n\n respond_to do |format|\n if @tutorial.save\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully created.' }\n format.json { render json: @tutorial, status: :created, location: @tutorial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tutorials = Tutorials.new(params[:tutorials])\n\n respond_to do |format|\n if @tutorials.save\n flash[:notice] = 'Tutorials was successfully created.'\n format.html { redirect_to(@tutorials) }\n format.xml { render :xml => @tutorials, :status => :created, :location => @tutorials }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tutorials.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tutorial = Tutorial.new(tutorial_params)\n\n respond_to do |format|\n if @tutorial.save\n format.html { redirect_to @tutorial, notice: 'Your Tutorial post was successfully created and is now live...' }\n format.json { render :show, status: :created, location: @tutorial }\n else\n format.html { render :new }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tutorial_params\n params.require(:tutorials).permit()\n end",
"def tutorial_params\n params.require(:tutorial).permit(:title, :body)\n end",
"def new\n @tutorial = Tutorial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial }\n end\n end",
"def new\n @tutorial = Tutorial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial }\n end\n end",
"def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html\n format.json do\n render json: @tutorials\n end\n end\nend",
"def create\n process_tag_params\n @tutorial = @course.tutorials.new(tutorial_params)\n\n respond_to do |format|\n if @tutorial.save\n add_new_tags\n format.html { redirect_to [:admin, @course, @tutorial], notice: 'Tutorial was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tutorial }\n else\n format.html { render action: 'new' }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @tutorials = Tutorial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tutorials }\n end\n end",
"def tutorial_params\n params.require(:tutorial).permit(:title, :functionality, :learning_language_ids, :body, :suggestion)\n end",
"def create\n\t\t@tutorial = Tutorial.new(params[:tutorial])\n\n\t\[email protected] = current_user\n\n\t\trespond_to do |format|\n\t\t\tif @tutorial.save\n\t\t\t\tformat.html { redirect_to @tutorial, :notice => 'Tutorial was successfully created.' }\n\t\t\t\tformat.json { render :json => @tutorial, :status => :created, :location => @tutorial }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.json { render :json => @tutorial.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n \n if is_admin?\n @tutorial = Tutorial.new({user_id: @cur_user.id, title: \"#{@cur_user.name}'s Tutorial\"})\n respond_to do |format|\n if @tutorial.save\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully created.' }\n format.json { render json: @tutorial.to_hash(false), status: :created, location: @tutorial }\n else\n format.html { render :status => 404 }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { render text: \"Not allowed\", status: 404 }\n format.json { render json: @tutorial.errors, status: :forbidden }\n end\n end\n end",
"def tutorial_params\n params.require(:tutorial).permit!\n end",
"def tutorial_params\n params.require(:tutorial).permit(:title, :image_url, :description, :course_id, tag_ids: [])\n end",
"def new\n\t\t@tutorial = Tutorial.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render :json => @tutorial }\n\t\tend\n\tend",
"def tutorial_params\n params.require(:tutorial).permit(:title, :author, :description, :user_id, :steps_attributes => [:id, :title, :problem, :solution, :_destroy])\n end",
"def create\n @creator = current_user.id\n @user_tutorial = UserTutorial.new(user_tutorial_params)\n @user_tutorial.user_id = @creator\n\n respond_to do |format|\n if @user_tutorial.save\n format.html { redirect_to @user_tutorial, notice: 'User tutorial was successfully created.' }\n format.json { render :show, status: :created, location: @user_tutorial }\n else\n format.html { render :new }\n format.json { render json: @user_tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tutorial_committee = TutorialCommittee.new(tutorial_committee_params)\n\n respond_to do |format|\n if @tutorial_committee.save\n format.html { redirect_to @tutorial_committee, notice: 'Tutorial committee was successfully created.' }\n format.json { render :show, status: :created, location: @tutorial_committee }\n else\n format.html { render :new }\n format.json { render json: @tutorial_committee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tutorial_section = TutorialSection.new(tutorial_section_params)\n\n respond_to do |format|\n if @tutorial_section.save\n format.html { redirect_to @tutorial_section, notice: 'Tutorial section was successfully created.' }\n format.json { render :show, status: :created, location: @tutorial_section }\n else\n format.html { render :new }\n format.json { render json: @tutorial_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tutorial = Tutorial.new(params[:tutorial])\n authorize! :create, @tutorial\n respond_to do |format|\n if @tutorial.save\n format.html { redirect_to(@tutorial, :notice => 'Tutorial was successfully created.') }\n format.xml { render :xml => @tutorial, :status => :created, :location => @tutorial }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tutorial.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tutorial_quest = Tutorial::Quest.new(params[:tutorial_quest])\n\n respond_to do |format|\n if @tutorial_quest.save\n format.html { redirect_to @tutorial_quest, notice: 'Quest was successfully created.' }\n format.json { render json: @tutorial_quest, status: :created, location: @tutorial_quest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutorial_quest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @typetutorial = Typetutorial.new(typetutorial_params)\n\n respond_to do |format|\n if @typetutorial.save\n format.html { redirect_to @typetutorial, notice: 'Typetutorial was successfully created.' }\n format.json { render :show, status: :created, location: @typetutorial }\n else\n format.html { render :new }\n format.json { render json: @typetutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @lesson_learned = LessonLearned.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lesson_learned }\n end\n end",
"def create \n @tutorial = Tutorial.new(tutorial_param)\n if @tutorial.save\n redirect_to :action => 'index' \n else\n redirect_to :action => 'new', :msg => 'some feilds have not been filled out fully'\n end\n end",
"def new\n @tutorials = Tutorials.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tutorials }\n end\n end",
"def new\n @lesson = Lesson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lesson }\n end\n end",
"def tutorial\n end",
"def new\n @tutorial_quest = Tutorial::Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial_quest }\n end\n end",
"def create\n @lesson = Lesson.new(lesson_params)\n\n if @lesson.save\n render :show, status: :created, location: @lesson\n else\n render json: @lesson.errors, status: :unprocessable_entity\n end\n end",
"def create\n @lesson = Lesson.new(params[:lesson])\n\n respond_to do |format|\n if @lesson.save\n format.html { redirect_to @lesson, notice: 'Lesson was successfully created.' }\n format.json { render json: @lesson, status: :created, location: @lesson }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lesson = Lesson.new(lesson_params)\n\n respond_to do |format|\n if @lesson.save\n format.html { redirect_to @lesson, notice: 'Lesson was successfully created.' }\n format.json { render :show, status: :created, location: @lesson }\n else\n format.html { render :new }\n format.json { render json: @lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lesson = Lesson.new(lesson_params)\n\n respond_to do |format|\n if @lesson.save\n format.html { redirect_to @lesson, notice: 'Lesson was successfully created.' }\n format.json { render :show, status: :created, location: @lesson }\n else\n format.html { render :new }\n format.json { render json: @lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lesson = Lesson.new(lesson_params)\n\n respond_to do |format|\n if @lesson.save\n format.html { redirect_to @lesson, notice: 'Lesson was successfully created.' }\n format.json { render :show, status: :created, location: @lesson }\n else\n format.html { render :new }\n format.json { render json: @lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial }\n end\n end",
"def destroy\n @tutorial.destroy\n respond_to do |format|\n format.html { redirect_to tutorials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutorial = Tutorial.find(params[:id])\n @tutorial.destroy\n render json: @tutorial\n end",
"def new\n #@lesson = Lesson.new\n @lesson = @course.lessons.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lesson }\n end\n end",
"def create\n @learn = Learn.new(params[:learn])\n\n respond_to do |format|\n if @learn.save\n format.html { redirect_to @learn, notice: 'Learn was successfully created.' }\n format.json { render json: @learn, status: :created, location: @learn }\n else\n format.html { render action: \"new\" }\n format.json { render json: @learn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial.to_hash(false) }\n end\n end",
"def test_should_create_post_via_API_JSON\r\n get \"/logout\"\r\n post \"/forum_posts.json\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n topic = JSON.parse(response.body)\r\n assert topic['title'] == 'API Test Post', 'Incorrect topic title'\r\n assert topic['user_id'] == 1, 'Incorrect user id'\r\n assert topic['body'] == 'Test Post desc', 'Incorrect topic description' \r\n end",
"def create\n @intro = Intro.new(intro_params)\n\n respond_to do |format|\n if @intro.save\n format.html { redirect_to @intro, notice: 'Intro was successfully created.' }\n format.json { render :show, status: :created, location: @intro }\n else\n format.html { render :new }\n format.json { render json: @intro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def create\n @lesson = Lesson.new(lesson_params)\n\n respond_to do |format|\n if @lesson.save\n format.html { redirect_to @lesson, notice: 'Lesson was successfully created.' }\n format.json { render :show, status: :created, location: @lesson }\n else\n format.html { render :new }\n format.json { render json: @lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @learning = Learning.new(learning_params)\n\n respond_to do |format|\n if @learning.save\n format.html { redirect_to @learning, notice: 'Learning was successfully created.' }\n format.json { render :show, status: :created, location: @learning }\n else\n format.html { render :new }\n format.json { render json: @learning.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@lesson = Lesson.new(params[:lesson])\n @lesson = @course.lessons.new(params[:lesson])\n\n respond_to do |format|\n if @lesson.save\n format.html { redirect_to [@course,@lesson], :notice => 'Lesson was successfully created.' }\n format.json { render :json => @lesson, :status => :created, :location => @lesson }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @lesson.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def user_tutorial_params\n params.require(:user_tutorial).permit(:name, :language, :goal, :content, :code, :files, :image)\n end",
"def create\n @lesson = Lesson.new(lesson_params)\n\n respond_to do |format|\n if @lesson.save\n format.html { redirect_to course_section_lessons_path(@course, @section), notice: 'Lesson was successfully created.' }\n format.json { render action: 'show', status: :created, location: @lesson }\n else\n format.html { render action: 'new' }\n format.json { render json: @lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @tutorial = Tutorial.find(params[:id])\n @tutorial.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutorial.destroy\n respond_to do |format|\n format.html { redirect_to admin_course_tutorials_path(@course) }\n format.json { head :no_content }\n end\n end",
"def create\n @title = t 'view.teaches.new_title'\n\n respond_to do |format|\n if @teach.save\n format.html { redirect_to @teach, notice: t('view.teaches.correctly_created') }\n format.json { render json: @teach, status: :created, location: @teach }\n else\n format.html { render action: 'new' }\n format.json { render json: @teach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @tutorial.destroy\n respond_to do |format|\n format.html { redirect_to tutorials_url, notice: 'Tutorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_tutorial.destroy\n respond_to do |format|\n format.html { redirect_to user_tutorials_url, notice: 'User tutorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def new\n @learn = Learn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @learn }\n end\n end",
"def new\n @tutorial = Tutorial.new\n\t@title = \"New tutorial\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tutorial }\n end\n end",
"def new\n @title = t 'view.teaches.new_title'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @teach }\n end\n end",
"def create\n @lecture = Lecture.new(lecture_params)\n\n respond_to do |format|\n if @lecture.save\n format.html { redirect_to @lecture, notice: 'Lecture was successfully created.' }\n format.json { render :show, status: :created, location: @lecture }\n else\n format.html { render :new }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n\t\t@tutorial = Tutorial.find(params[:id])\n\t\[email protected]\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to tutorials_url }\n\t\t\tformat.json { head :ok }\n\t\tend\n\tend",
"def destroy\n @tutorials = Tutorials.find(params[:id])\n @tutorials.destroy\n\n respond_to do |format|\n format.html { redirect_to(tutorials_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @how_to = HowTo.new(how_to_params)\n\n respond_to do |format|\n if @how_to.save\n format.html { redirect_to @how_to, notice: 'How to was successfully created.' }\n format.json { render :show, status: :created, location: @how_to }\n else\n format.html { render :new }\n format.json { render json: @how_to.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n\t\t@tutorials = Tutorial.order(sort_column + \" \" + sort_direction).page(params[:page]).per(10)\n\n\t\trespond_to do |format|\n\t\t format.js\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render :json => @tutorials }\n\t\tend\n\tend",
"def index\n @lesson_learneds = LessonLearned.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lesson_learneds }\n end\n end",
"def typetutorial_params\n params.require(:typetutorial).permit(:type_id, :tutorial_id)\n end",
"def destroy\n #@tutorial = Tutorial.find(params[:id])\n #@tutorial.destroy\n #\n #respond_to do |format|\n # format.html { redirect_to tutorials_url }\n # format.json { head :no_content }\n #end\n end",
"def create\n @introexam = Introexam.new(introexam_params)\n\n respond_to do |format|\n if @introexam.save\n format.html { redirect_to @introexam, notice: 'Introexam was successfully created.' }\n format.json { render :show, status: :created, location: @introexam }\n else\n format.html { render :new }\n format.json { render json: @introexam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @examples }\n end\n end",
"def create\n @need_help = NeedHelp.new(params[:need_help])\n\n respond_to do |format|\n if @need_help.save\n format.json {render json: @need_help, status: :created, location: @need_help}\n else\n format.json {render json: @need_help.errors, status: :unprocessable_entity}\n end\n end\n end",
"def test_should_create_link_via_API_JSON\r\n get \"/logout\"\r\n post \"/links.json\", :api_key => 'testapikey',\r\n :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response :created\r\n link = JSON.parse(response.body)\r\n check_new_link(link) \r\n end",
"def set_tutorial\n @tutorial = Tutorial.find(params[:id])\n end",
"def set_tutorial\n @tutorial = Tutorial.find(params[:id])\n end",
"def set_tutorial\n @tutorial = Tutorial.find(params[:id])\n end",
"def set_tutorial\n @tutorial = Tutorial.find(params[:id])\n end",
"def create\n @teach = Teach.new(params[:teach])\n\n respond_to do |format|\n if @teach.save\n format.html { redirect_to @teach, notice: 'Teach was successfully created.' }\n format.json { render json: @teach, status: :created, location: @teach }\n else\n format.html { render action: \"new\" }\n format.json { render json: @teach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tutorial_params\n params.require(:tutorial).permit(\n :subject, :dates, :timestart ,:timeend, \n :typetutorials_attributes=> [:id,:type_id, :tutorial_id], \n :annotations_attributes=>[:id,:comment,:times,:user_id]\n )\n end",
"def new\n @tutorial_state = Tutorial::State.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial_state }\n end\n end",
"def create\n \t@step = @tutorial.steps.build(params[:step])\n authorize! :create, @step\n respond_to do |format|\n if @step.save\n format.html { redirect_to(@tutorial, :notice => 'Step was successfully created.') }\n format.xml { render :xml => @tutorial, :status => :created, :location => @tutorial }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @step.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tutorial_state = Tutorial::State.new(params[:tutorial_state])\n\n respond_to do |format|\n if @tutorial_state.save\n format.html { redirect_to @tutorial_state, notice: 'State was successfully created.' }\n format.json { render json: @tutorial_state, status: :created, location: @tutorial_state }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutorial_state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @teach = Teach.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @teach }\n end\n end",
"def new\n @teacher = Teacher.find(params[:teacher_id])\n @learningwalk = @teacher.learningwalks.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @learningwalk }\n end\n end",
"def create\n @teach = Teach.new(teach_params)\n\n respond_to do |format|\n if @teach.save\n format.html { redirect_to @teach, notice: 'Teach was successfully created.' }\n format.json { render :show, status: :created, location: @teach }\n else\n format.html { render :new }\n format.json { render json: @teach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n training.attributes = training_params\n\n respond_to do |format|\n if training.save\n format.html { redirect_to student_url(training.student_id), notice: \"Training was successfully created.\" }\n format.json { render :show, status: :created, location: training }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: training.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @question_learned = QuestionLearned.new(question_learned_params)\n\n respond_to do |format|\n if @question_learned.save\n format.html { redirect_to @question_learned, notice: 'Question learned was successfully created.' }\n format.json { render action: 'show', status: :created, location: @question_learned }\n else\n format.html { render action: 'new' }\n format.json { render json: @question_learned.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @tutorials = @course.tutorials.all\n end",
"def new\n @training = Training.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @training }\n end\n end",
"def set_tutorial\n @tutorial = Tutorial.find(params[:id])\n end",
"def create\n @teacher = Teacher.new(params[:teacher])\n\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to @teacher, notice: 'Teacher was successfully created.' }\n format.json { render json: @teacher, status: :created, location: @teacher }\n else\n format.html { render action: \"new\" }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @teacher = Teacher.new(params[:teacher])\n\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to @teacher, notice: 'Teacher was successfully created.' }\n format.json { render json: @teacher, status: :created, location: @teacher }\n else\n format.html { render action: \"new\" }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @what_test = WhatTest.new(what_test_params)\n\n respond_to do |format|\n if @what_test.save\n format.html { redirect_to @what_test, notice: 'What test was successfully created.' }\n format.json { render :show, status: :created, location: @what_test }\n else\n format.html { render :new }\n format.json { render json: @what_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_lesson = UserLesson.new(user_lesson_params)\n\n respond_to do |format|\n if @user_lesson.save\n format.html { redirect_to @user_lesson, notice: 'User lesson was successfully created.' }\n format.json { render :show, status: :created, location: @user_lesson }\n else\n format.html { render :new }\n format.json { render json: @user_lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lecture = Lecture.new(lecture_params)\n #if @lecture.password == \"\"\n @lecture.password = nil\n #end\n \n respond_to do |format|\n if @lecture.save\n top = Topic.new\n top.name = @lecture.name\n top.lecture = @lecture\n top.save\n \n exp = Explanation.new\n exp.author = true\n exp.user = current_user\n exp.topic = top\n exp.save\n \n format.html { redirect_to @lecture }\n format.json { render action: 'show', status: :created, location: @lecture }\n else\n format.html { render action: 'new' }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @lab_teach_resource = LabTeachResource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab_teach_resource }\n end\n end",
"def create\n @timetable = Timetable.new(timetable_params)\n @timetable.save\n respond_with [@timetable.lesson,@timetable]\n end",
"def index\n @tutorials = Tutorials.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tutorials }\n end\n end",
"def index\n @tutorials = Tutorial.all\n @title = \"A collection of Ruby on Rails tutorials\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tutorials }\n end\n end",
"def create\n @learn_article = LearnArticle.new(learn_article_params)\n\n respond_to do |format|\n if @learn_article.save\n format.html { redirect_to @learn_article, notice: 'Learn article was successfully created.' }\n format.json { render :show, status: :created, location: @learn_article }\n else\n format.html { render :new }\n format.json { render json: @learn_article.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tutorials = Tutorials.find(params[:id])\n\n respond_to do |format|\n if @tutorials.update_attributes(params[:tutorials])\n flash[:notice] = 'Tutorials was successfully updated.'\n format.html { redirect_to(@tutorials) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tutorials.errors, :status => :unprocessable_entity }\n end\n end\n end"
] | [
"0.76698226",
"0.7308089",
"0.6955424",
"0.6955424",
"0.68650454",
"0.68634087",
"0.67928624",
"0.6764526",
"0.66929144",
"0.66929144",
"0.66369426",
"0.6636901",
"0.66156876",
"0.65631616",
"0.6539225",
"0.6455816",
"0.6441011",
"0.6339235",
"0.6326344",
"0.62354505",
"0.62270075",
"0.6226772",
"0.6093517",
"0.6082153",
"0.60626435",
"0.6041818",
"0.6020163",
"0.5970692",
"0.59699446",
"0.59656507",
"0.59631866",
"0.5956453",
"0.59385276",
"0.5930914",
"0.5867453",
"0.5867453",
"0.5867453",
"0.5864483",
"0.5855227",
"0.58353287",
"0.5781246",
"0.57535815",
"0.5752451",
"0.5712613",
"0.57123023",
"0.57118577",
"0.57118577",
"0.5699827",
"0.56934834",
"0.5670632",
"0.5669812",
"0.565605",
"0.56559247",
"0.56532323",
"0.56464237",
"0.5633545",
"0.56303656",
"0.56280255",
"0.5626994",
"0.56167704",
"0.56145054",
"0.56135416",
"0.55901605",
"0.55852634",
"0.5557775",
"0.5554118",
"0.55508375",
"0.55458915",
"0.55320364",
"0.5525015",
"0.54955906",
"0.5493522",
"0.5491966",
"0.5491966",
"0.5491966",
"0.5491966",
"0.54891527",
"0.54874235",
"0.54783475",
"0.5474897",
"0.54723305",
"0.5471876",
"0.5464804",
"0.5439788",
"0.5430732",
"0.54297656",
"0.54177624",
"0.54088825",
"0.5406493",
"0.53874403",
"0.53874403",
"0.5375481",
"0.5374816",
"0.5366466",
"0.5362866",
"0.5362155",
"0.5362152",
"0.5360368",
"0.5357876",
"0.53553873"
] | 0.68600416 | 6 |
PATCH/PUT /tutorials/1 PATCH/PUT /tutorials/1.json | def update
respond_to do |format|
if @tutorial.update(tutorial_params)
format.html { redirect_to @tutorial, notice: 'Tutorial was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @tutorial.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n if @tutorial.update_attributes(params[:tutorial])\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n if @tutorial.update_attributes(params[:tutorial])\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tutorials = Tutorials.find(params[:id])\n\n respond_to do |format|\n if @tutorials.update_attributes(params[:tutorials])\n flash[:notice] = 'Tutorials was successfully updated.'\n format.html { redirect_to(@tutorials) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tutorials.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tutorial.update(tutorial_params)\n format.html { redirect_to @tutorial, notice: \"Tutorial was successfully updated.\"}\n format.json {render :show, status: ok, location: @tutorial}\n else\n format.html { render :edit }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n respond_to do |format|\n if @tutorial.update(tutorial_params)\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully updated.' }\n format.json { render :show, status: :ok, location: @tutorial }\n else\n format.html { render :edit }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tutorial.update(tutorial_params)\n format.html { redirect_to @tutorial, notice: 'Your Tutorial post was successfully updated and is now live...' }\n format.json { render :show, status: :ok, location: @tutorial }\n else\n format.html { render :edit }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_tutorial.update(user_tutorial_params)\n format.html { redirect_to @user_tutorial, notice: 'User tutorial was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_tutorial }\n else\n format.html { render :edit }\n format.json { render json: @user_tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n\t\t@tutorial = Tutorial.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @tutorial.update_attributes(params[:tutorial])\n\t\t\t\tformat.html { redirect_to @tutorial, :notice => 'Tutorial was successfully updated.' }\n\t\t\t\tformat.json { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.json { render :json => @tutorial.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @tutorial = Tutorial.find(params[:id])\n editUpdate = params[:tutorial]\n hideUpdate = editUpdate.extract_keys!([:hidden])\n adminUpdate = editUpdate.extract_keys!([:featured])\n success = false\n \n #EDIT REQUEST\n if can_edit?(@tutorial) \n success = @tutorial.update_attributes(editUpdate)\n end\n \n #HIDE REQUEST\n if can_hide?(@tutorial) \n success = @tutorial.update_attributes(hideUpdate)\n end\n \n #ADMIN REQUEST\n if can_admin?(@tutorial)\n if adminUpdate.has_key?(:featured)\n if adminUpdate['featured'] == true\n adminUpdate['featured_at'] = Time.now()\n else\n adminUpdate['featured_at'] = nil\n end\n end\n \n success = @tutorial.update_attributes(adminUpdate)\n end\n\n respond_to do |format|\n if success\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully updated.' }\n format.json { render json: {}, status: :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tutorial.errors.full_messages(), status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tutorial_section.update(tutorial_section_params)\n format.html { redirect_to @tutorial_section, notice: 'Tutorial section was successfully updated.' }\n format.json { render :show, status: :ok, location: @tutorial_section }\n else\n format.html { render :edit }\n format.json { render json: @tutorial_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n process_tag_params\n respond_to do |format|\n if @tutorial.update(tutorial_params)\n add_new_tags\n format.html { redirect_to [:admin, @course, @tutorial], notice: 'Tutorial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n respond_to do |format|\n if @tutorial_committee.update(tutorial_committee_params)\n format.html { redirect_to @tutorial_committee, notice: 'Tutorial committee was successfully updated.' }\n format.json { render :show, status: :ok, location: @tutorial_committee }\n else\n format.html { render :edit }\n format.json { render json: @tutorial_committee.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 respond_to do |format|\n if @tutorial.update(tutorial_params)\n format.html { redirect_to profile_path(locale: I18n.locale,username: @tutorial.user.username), notice: 'tutorial was successfully updated.' }\n format.json { render :show, status: :ok, location: @tutorial }\n else\n format.html { render :edit }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n respond_to do |format|\n if @typetutorial.update(typetutorial_params)\n format.html { redirect_to @typetutorial, notice: 'Typetutorial was successfully updated.' }\n format.json { render :show, status: :ok, location: @typetutorial }\n else\n format.html { render :edit }\n format.json { render json: @typetutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tutorial = Tutorial.find_by_permalink(params[:id])\n authorize! :update, @tutorial\n respond_to do |format|\n if @tutorial.update_attributes(params[:tutorial])\n format.html { redirect_to(@tutorial, :notice => 'Tutorial was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tutorial.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tutorial = Tutorial.find(params[:id])\n if @tutorial.update_attributes(tutorial_param)\n redirect_to :action => 'show', :id => @tutorial\n else\n render :action => 'edit'\n end\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n\n respond_to do |format|\n if @lecture.update(lecture_params)\n format.html { redirect_to lectures_url }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\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 options={}\n client.put(\"/#{id}\", options)\n end",
"def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\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 update\n @need_help = NeedHelp.find(params[:id])\n\n respond_to do |format|\n if @need_help.update_attributes(params[:need_help])\n format.json {head :no_content}\n else\n format.json {render json: @need_help.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n @backend_tutorial_stat = Backend::TutorialStat.find(params[:id])\n\n respond_to do |format|\n if @backend_tutorial_stat.update_attributes(params[:backend_tutorial_stat])\n format.html { redirect_to @backend_tutorial_stat, notice: 'Tutorial stat was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @backend_tutorial_stat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @step = Step.find(params[:id])\n @tutorial = @step.tutorial\n authorize! :update, @step\n respond_to do |format|\n if @step.update_attributes(params[:step])\n format.html { redirect_to(@tutorial, :notice => 'Step was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @step.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_hello.update(api_hello_params)\n format.html { redirect_to @api_hello, notice: 'Hello was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_hello }\n else\n format.html { render :edit }\n format.json { render json: @api_hello.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def patch\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 patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n respond_to do |format|\n if @intro.update(intro_params)\n format.html { redirect_to @intro, notice: 'Intro was successfully updated.' }\n format.json { render :show, status: :ok, location: @intro }\n else\n format.html { render :edit }\n format.json { render json: @intro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lecture.update(lecture_params)\n format.html { redirect_to @lecture, notice: 'Lecture was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @learn = Learn.find(params[:id])\n\n respond_to do |format|\n if @learn.update_attributes(params[:learn])\n format.html { redirect_to @learn, notice: 'Learn was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @learn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n question = Question.find_by!(id: params[:id])\n if question\n question.name = params[:name]\n question.description = params[:description]\n question.user_id = params[:user_id]\n question.category_id = params[:category_id]\n question.zavrseno = params[:zavrseno]\n question.uposlenik_id = params[:uposlenik_id]\n question.save\n render json: question, status: 200 \n else\n render json: { errors: \"This link is invalid.\"}, status: 404\n end\n end",
"def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end",
"def update!(**args)\n @examples = args[:examples] if args.key?(:examples)\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 tutorial_params\n params.require(:tutorial).permit(:title, :body)\n end",
"def update\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n if @specie.update_attributes(params[:specie])\n format.html { redirect_to @specie, notice: 'Specie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specie.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 http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\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 set_api_v1_todo\n @api_v1_todo = Todo.find(params[:id])\n end",
"def UpdateArticle id,params = {}\n \n APICall(path: \"help_center/articles/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @todo = Todo.find(params[:id])\n if @todo.update(todo_params)\n render json: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end",
"def update\n @kitty = Kitty.find(params[:id])\n\n respond_to do |format|\n if @kitty.update_attributes(params[:kitty])\n format.html { redirect_to @kitty, notice: 'Kitty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kitty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend",
"def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end",
"def update\n # @recipe = Recipe.find(params[:id])\n #\n update! do |success, failure|\n # success.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n # success.json { head :ok }\n # failure.html { render action: \"edit\" }\n # failure.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end",
"def update\n @lab = lab.find(params[:id])\n\n respond_to do |format|\n if @lab.update_attributes(params[:lab])\n format.html { redirect_to @lab, notice: 'lab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @todo.update(todo_params)\n head :no_content\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end",
"def tutorial_params\n params.require(:tutorials).permit()\n end",
"def update\n @lecture_note = LectureNote.find(params[:id])\n\n respond_to do |format|\n if @lecture_note.update_attributes(params[:lecture_note])\n format.html { redirect_to @lecture_note, notice: 'Lecture note was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lecture_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lab = Lab.find(params[:id])\n\n respond_to do |format|\n if @lab.update_attributes(params[:lab])\n format.html { redirect_to @lab, notice: 'Lab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @introexam.update(introexam_params)\n format.html { redirect_to @introexam, notice: 'Introexam was successfully updated.' }\n format.json { render :show, status: :ok, location: @introexam }\n else\n format.html { render :edit }\n format.json { render json: @introexam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @familiar = Familiar.find(params[:id])\n\n respond_to do |format|\n if @familiar.update_attributes(params[:familiar])\n format.html { redirect_to @familiar, notice: 'Familiar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @familiar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n req.patch?\n end",
"def put(*args)\n request :put, *args\n end",
"def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @metodo = Metodo.find(params[:id])\n\n respond_to do |format|\n if @metodo.update_attributes(params[:metodo])\n format.html { redirect_to metodos_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @metodo.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 @tutorial_state = Tutorial::State.find(params[:id])\n\n respond_to do |format|\n if @tutorial_state.update_attributes(params[:tutorial_state])\n format.html { redirect_to @tutorial_state, notice: 'State was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tutorial_state.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @laboratory = Laboratory.find(params[:id])\n\n if @laboratory.update!(laboratory_params)\n render json: @laboratory\n else \n render json: @laboratory.errors, status: :unprocessable_entity\n end\n end",
"def update\n # @topic = current_user.topics.find(params[:lesson][:topic_id])\n # @course = @topic.courses.first\n\n # @lesson.title = 'New Lesson (rename)' if params[:title] = ''\n respond_to do |format|\n if @lesson.update(lesson_update)\n format.html { redirect_to course_topic_lesson_path(@lesson.topic.course, @lesson.topic, @lesson), notice: 'Lesson was updated created.' }\n format.json { render :show, status: :ok, location: @lesson }\n else\n format.html { render :edit }\n format.json { render json: @lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lecture.update(lecture_params)\n format.html { redirect_to @lecture, notice: 'Lecture was successfully updated.' }\n format.json { render :show, status: :ok, location: @lecture }\n else\n format.html { render :edit }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lecture.update(lecture_params)\n format.html { redirect_to @lecture, notice: 'Lecture was successfully updated.' }\n format.json { render :show, status: :ok, location: @lecture }\n else\n format.html { render :edit }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lecture.update(lecture_params)\n format.html { redirect_to @lecture, notice: 'Lecture was successfully updated.' }\n format.json { render :show, status: :ok, location: @lecture }\n else\n format.html { render :edit }\n format.json { render json: @lecture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment.tutorial, notice: 'Comment was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @howto = Howto.find(params[:id])\n\n respond_to do |format|\n if @howto.update_attributes(params[:howto])\n flash[:notice] = 'Howto was successfully updated.'\n format.html { redirect_to(@howto) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @howto.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lab = Lab.find(params[:id])\n\n respond_to do |format|\n if @lab.update_attributes(lab_params)\n format.html { redirect_to @lab, notice: 'Lab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n format.html { redirect_to exams_path, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @concept = Concept.find(params[:id])\n\n respond_to do |format|\n if @concept.update_attributes(params[:concept])\n format.html { redirect_to @concept, notice: 'Concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @concept.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @concept = Concept.find(params[:id])\n\n respond_to do |format|\n if @concept.update_attributes(params[:concept])\n format.html { redirect_to @concept, notice: 'Concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @concept.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @example.update(example_params)\n format.html { redirect_to @example, notice: 'Operação realizada com sucesso.' }\n format.json { render :show, status: :ok, location: @example }\n else\n format.html { render :edit }\n format.json { render json: @example.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tutorial_params\n params.require(:tutorial).permit!\n end",
"def update\n #@lesson = Lesson.find(params[:id])\n @lesson = @course.lessons.find(params[:id])\n\n respond_to do |format|\n if @lesson.update_attributes(params[:lesson])\n format.html { redirect_to [@course,@lesson], :notice => 'Lesson was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @lesson.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def update\n @lab_method = LabMethod.find(params[:id])\n\n respond_to do |format|\n if @lab_method.update_attributes(params[:lab_method])\n format.html { redirect_to @lab_method, notice: 'Lab method was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\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",
"def update\n team_name = params[:name]\n team_description = params[:description]\n team_id = params[:id]\n\n respond_to do |format|\n if OkrTeam.where(id: team_id).update_all(name: team_name, description: team_description)\n format.json { render json: 'Team is updated successfully!', status: :ok }\n else\n format.json { render json: 'Error!', status: :unprocessable_entity }\n end\n end\n end",
"def update\n @practice = Practice.find(params[:id])\n\n respond_to do |format|\n if @practice.update_attributes(params[:practice])\n format.html { redirect_to @practice, notice: 'Practice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @practice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lesson = Lesson.find(params[:id])\n\n respond_to do |format|\n if @lesson.update_attributes(params[:lesson])\n format.html { redirect_to @lesson, notice: 'Lesson was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lesson.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @testis = Teste.find(params[:id])\n\n respond_to do |format|\n if @testis.update_attributes(params[:testis])\n format.html { redirect_to @testis, notice: 'Teste was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @testis.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.66692483",
"0.66692483",
"0.66230613",
"0.66168857",
"0.66019565",
"0.64313674",
"0.64128816",
"0.62854636",
"0.62485856",
"0.617944",
"0.6116152",
"0.6110436",
"0.6091951",
"0.60826355",
"0.60359186",
"0.6025176",
"0.60157734",
"0.59678245",
"0.5939726",
"0.5926772",
"0.59208155",
"0.59208155",
"0.589688",
"0.5891402",
"0.58603585",
"0.5857945",
"0.5857945",
"0.58499014",
"0.58481723",
"0.5832466",
"0.58246225",
"0.57952094",
"0.5785296",
"0.57624495",
"0.5758431",
"0.573036",
"0.5705649",
"0.5694612",
"0.56856006",
"0.567267",
"0.5669785",
"0.5659502",
"0.56435543",
"0.56196225",
"0.5613318",
"0.56128526",
"0.5603413",
"0.5591751",
"0.55896556",
"0.55713636",
"0.556922",
"0.556922",
"0.5568854",
"0.5566304",
"0.55581176",
"0.5545862",
"0.55384743",
"0.55292124",
"0.55279154",
"0.55210716",
"0.5519208",
"0.5511748",
"0.5503916",
"0.54957634",
"0.54926056",
"0.54842776",
"0.5484102",
"0.54830116",
"0.54825985",
"0.54781747",
"0.5475325",
"0.54740405",
"0.5471721",
"0.54715014",
"0.54705364",
"0.54650205",
"0.54650205",
"0.54650205",
"0.5458427",
"0.5457133",
"0.5455492",
"0.5454731",
"0.5448736",
"0.54447454",
"0.54402065",
"0.54402065",
"0.54358417",
"0.5433222",
"0.5430798",
"0.5429141",
"0.5427425",
"0.5426467",
"0.5424417",
"0.5423356",
"0.5423356",
"0.5423356",
"0.5423203",
"0.5422354",
"0.5415452",
"0.5415346"
] | 0.6698879 | 0 |
DELETE /tutorials/1 DELETE /tutorials/1.json | def destroy
@tutorial.destroy
respond_to do |format|
format.html { redirect_to tutorials_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @tutorial = Tutorial.find(params[:id])\n @tutorial.destroy\n render json: @tutorial\n end",
"def destroy\n @tutorial = Tutorial.find(params[:id])\n @tutorial.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutorial.destroy\n respond_to do |format|\n format.html { redirect_to admin_course_tutorials_path(@course) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutorials = Tutorials.find(params[:id])\n @tutorials.destroy\n\n respond_to do |format|\n format.html { redirect_to(tutorials_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n #@tutorial = Tutorial.find(params[:id])\n #@tutorial.destroy\n #\n #respond_to do |format|\n # format.html { redirect_to tutorials_url }\n # format.json { head :no_content }\n #end\n end",
"def destroy\n @tutorial.destroy\n respond_to do |format|\n format.html { redirect_to tutorials_url, notice: 'Tutorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_tutorial.destroy\n respond_to do |format|\n format.html { redirect_to user_tutorials_url, notice: 'User tutorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutorial.destroy\n respond_to do |format|\n format.html { redirect_to tutorials_url, notice: 'Your Tutorial post was successfully deleted and is now permanently offline...' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t@tutorial = Tutorial.find(params[:id])\n\t\[email protected]\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to tutorials_url }\n\t\t\tformat.json { head :ok }\n\t\tend\n\tend",
"def destroy\n @typetutorial.destroy\n respond_to do |format|\n format.html { redirect_to typetutorials_url, notice: 'Typetutorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutorial_section.destroy\n respond_to do |format|\n format.html { redirect_to tutorial_sections_url, notice: 'Tutorial section was successfully destroyed.' }\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 @tutorial = Tutorial.find_by_permalink(params[:id])\n @tutorial.destroy\n authorize! :destroy, @tutorial\n\n respond_to do |format|\n format.html { redirect_to(tutorials_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @backend_tutorial_stat = Backend::TutorialStat.find(params[:id])\n @backend_tutorial_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to backend_tutorial_stats_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @example.destroy\n respond_to do |format|\n format.html { redirect_to examples_url, notice: 'Operação realizada com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutorial_committee.destroy\n respond_to do |format|\n format.html { redirect_to tutorial_committees_url, notice: 'Tutorial committee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @example.update_attributes(:deleted => 1)\n respond_to do |format|\n format.html { redirect_to examples_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @how_to = HowTo.find(params[:id])\n @how_to.destroy\n\n respond_to do |format|\n @status = admin_course_tutorials_url(@course)\n format.html { redirect_to(admin_course_tutorials_url(@course)) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @step.destroy\r\n respond_to do |format|\r\n format.html { redirect_to @tutorial, notice: 'Step was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @tutorial = Tutorial.find(params[:id])\n \n if can_delete?(@tutorial)\n \n @tutorial.media_objects.each do |m|\n m.destroy\n end\n \n @tutorial.user_id = -1\n @tutorial.hidden = true\n @tutorial.save\n \n respond_to do |format|\n format.html { redirect_to tutorials_url }\n format.json { render json: {}, status: :ok }\n end\n else\n respond_to do |format|\n format.html { redirect_to '/public/401.html' }\n format.json { render json: {}, status: :forbidden }\n end\n end\n end",
"def destroy\n @lesson = Lesson.find(params[:id])\n @lesson.destroy\n\n respond_to do |format|\n format.html { redirect_to lessons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lesson = Lesson.find(params[:id])\n @lesson.destroy\n\n respond_to do |format|\n format.html { redirect_to lessons_url }\n format.json { head :no_content }\n end\n end",
"def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end",
"def destroy\n @learn = Learn.find(params[:id])\n @learn.destroy\n\n respond_to do |format|\n format.html { redirect_to learns_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 delete\n Tutorial.find(params[:id]).destroy\n redirect_to :action => 'index' \n end",
"def destroy\n @lesson.destroy\n respond_to do |format|\n format.html { redirect_to lessons_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 @normal_example = NormalExample.find(params[:id])\n @normal_example.destroy\n\n respond_to do |format|\n format.html { redirect_to(normal_examples_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tutorial.destroy\n respond_to do |format|\n format.html { redirect_to profile_path(locale: I18n.locale,username: @tutorial.user.username), notice: 'tutorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @intro.destroy\n respond_to do |format|\n format.html { redirect_to intros_url, notice: 'Intro 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 @cocoon_example.destroy\n respond_to do |format|\n format.html { redirect_to cocoon_examples_url, notice: 'Cocoon example was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lecture.destroy\n respond_to do |format|\n format.html { redirect_to lectures_url }\n format.json { head :no_content }\n end\n end",
"def delete\n @guide = Guide.find(params[:id])\n @guide.destroy\n respond_to do |format|\n format.html { redirect_to guides_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @introexam.destroy\n respond_to do |format|\n format.html { redirect_to introexams_url, notice: 'Introexam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @step = Step.find(params[:id])\n @step.destroy\n authorize! :destroy, @step\n respond_to do |format|\n format.html { redirect_to(@tutorial) }\n format.xml { head :ok }\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 @learning.destroy\n respond_to do |format|\n format.html { redirect_to learnings_url, notice: 'Learning was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lesson.destroy\n respond_to do |format|\n format.html { redirect_to lessons_url, notice: 'Lesson was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lesson.destroy\n respond_to do |format|\n format.html { redirect_to lessons_url, notice: 'Lesson was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lesson.destroy\n respond_to do |format|\n format.html { redirect_to lessons_url, notice: 'Lesson was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def test_del\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 id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @lecture = Lecture.find(params[:id])\n @lecture.destroy\n\n respond_to do |format|\n format.html { redirect_to lectures_url, notice: \"Lecture was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@lesson = Lesson.find(params[:id])\n @lesson = @course.lessons.find(params[:id])\n @lesson.destroy\n\n respond_to do |format|\n format.html { redirect_to course_lessons_path(@course) }\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 @step = @guide.steps.find(params[:id])\n @step.destroy\n\n respond_to do |format|\n format.html { redirect_to guide_steps_path(@guide) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample.destroy\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @learn = Learn.find(params[:id])\n @learn.destroy\n\n respond_to do |format|\n format.html { redirect_to(learns_url) }\n format.xml { head :ok }\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 @tutorial_state = Tutorial::State.find(params[:id])\n @tutorial_state.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorial_states_url }\n format.json { head :ok }\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 @api_hello.destroy\n respond_to do |format|\n format.html { redirect_to api_hellos_url, notice: 'Hello was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @example_two.destroy\n respond_to do |format|\n format.html { redirect_to example_twos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lecture.destroy\n respond_to do |format|\n format.html { redirect_to lectures_url, notice: 'Lecture was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lecture.destroy\n respond_to do |format|\n format.html { redirect_to lectures_url, notice: 'Lecture was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lecture.destroy\n respond_to do |format|\n format.html { redirect_to lectures_url, notice: 'Lecture was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lesson.destroy\n respond_to do |format|\n format.html { redirect_to admin_path, notice: 'Lesson was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @teach = Teach.find(params[:id])\n @teach.destroy\n\n respond_to do |format|\n format.html { redirect_to teaches_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 @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 Topic.find(params[:id]).destroy\n render :json => {:ok => true}, :head => :no_content\n end",
"def destroy\n @my_exam = MyExam.find(params[:id])\n @my_exam.destroy\n\n respond_to do |format|\n format.html { redirect_to my_exams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @howto = Howto.find(params[:id])\n @howto.destroy\n\n respond_to do |format|\n format.html { redirect_to(howtos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lesson.destroy\n respond_to do |format|\n format.html { redirect_to lessons_url, notice: 'Lesson was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tourguide.destroy\n respond_to do |format|\n format.html { redirect_to tourguides_url, notice: 'Tourguide was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test1.destroy\n respond_to do |format|\n format.html { redirect_to test1s_url, notice: \"Test1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lesson = Lesson.find(params[:id])\n @lesson.destroy\n\n respond_to do |format|\n format.html { redirect_to(lessons_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @teach = Teach.find(params[:id])\n @teach.destroy\n\n respond_to do |format|\n format.html { redirect_to teaches_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @question_learned.destroy\n respond_to do |format|\n format.html { redirect_to question_question_learneds_path(@question) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n render json: nil, status: :ok\n end",
"def destroy\n @study = Study.find(params[:id])\n @study.destroy\n\n respond_to do |format|\n format.html { redirect_to studies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @guide = Guide.find(params[:id])\n @guide.destroy\n\n respond_to do |format|\n format.html { redirect_to guides_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @guide = Guide.find(params[:id])\n @guide.destroy\n\n respond_to do |format|\n format.html { redirect_to guides_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo3.destroy\n respond_to do |format|\n format.html { redirect_to todo3s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @learn_article.destroy\n respond_to do |format|\n format.html { redirect_to learn_articles_url, notice: 'Learn article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @sample = Sample.find(params[:id])\n # @sample.destroy\n\n# respond_to do |format|\n# format.html { redirect_to samples_url }\n# format.json { head :no_content }\n# end\n end",
"def destroy\n @file_example.destroy\n respond_to do |format|\n format.html { redirect_to file_examples_url, notice: 'File example was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @first_exam.destroy\n respond_to do |format|\n format.html { redirect_to first_exams_url, notice: 'First exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @random_exam.destroy\n respond_to do |format|\n format.html { redirect_to random_exams_url, notice: 'Random exam was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to todos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to todos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @practice.destroy\n respond_to do |format|\n format.html { redirect_to practices_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @course_lesson = CourseLesson.find(params[:id])\n @course_lesson.destroy\n\n respond_to do |format|\n format.html { redirect_to course_lessons_url }\n format.json { head :ok }\n end\n end"
] | [
"0.77756006",
"0.77635777",
"0.76979846",
"0.7655823",
"0.7637724",
"0.7615782",
"0.7406003",
"0.7403622",
"0.7369901",
"0.7306867",
"0.7271038",
"0.72081655",
"0.72025627",
"0.71776426",
"0.7145344",
"0.71135455",
"0.7080351",
"0.70493287",
"0.7030867",
"0.70085275",
"0.69969517",
"0.6985545",
"0.6985545",
"0.6978834",
"0.69746363",
"0.6972669",
"0.6958024",
"0.69308466",
"0.69283926",
"0.6916731",
"0.6913592",
"0.6904708",
"0.6847028",
"0.6847028",
"0.68448687",
"0.6832917",
"0.6826436",
"0.68105936",
"0.6790582",
"0.6789116",
"0.6789116",
"0.6785626",
"0.67786217",
"0.67759454",
"0.67462736",
"0.67461973",
"0.67461973",
"0.6745492",
"0.6745341",
"0.6739841",
"0.6738599",
"0.6733715",
"0.6733715",
"0.6733715",
"0.6733715",
"0.6732889",
"0.67314655",
"0.6728301",
"0.6727003",
"0.6720083",
"0.6709572",
"0.66931045",
"0.6686751",
"0.66813534",
"0.66775846",
"0.66775846",
"0.66775846",
"0.6674238",
"0.6672327",
"0.66570777",
"0.6642397",
"0.66398495",
"0.66398495",
"0.66398495",
"0.66398495",
"0.66396755",
"0.66341984",
"0.6634168",
"0.66340244",
"0.6633556",
"0.6623382",
"0.6623045",
"0.66159946",
"0.6614189",
"0.66131765",
"0.66121435",
"0.66105855",
"0.6609336",
"0.6609336",
"0.6605005",
"0.65998554",
"0.65996295",
"0.6593161",
"0.65899557",
"0.65899014",
"0.65836203",
"0.65836203",
"0.6582255",
"0.6581949",
"0.65818423"
] | 0.78816277 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_tutorial
@tutorial = Tutorial.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 tutorial_params
params.require(:tutorial).permit(:title, :functionality, :learning_language_ids, :body, :suggestion)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def valid_params_request?; end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def list_params\n params.permit(:name)\n end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def url_whitelist; end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] | [
"0.69802505",
"0.6781974",
"0.67470175",
"0.67430073",
"0.67350477",
"0.6593221",
"0.6504263",
"0.64988977",
"0.6481794",
"0.64800006",
"0.64568025",
"0.64411247",
"0.6379476",
"0.63765615",
"0.6368045",
"0.6320141",
"0.6300363",
"0.6300057",
"0.62952244",
"0.6294712",
"0.6293856",
"0.6290323",
"0.62816143",
"0.6241851",
"0.6241208",
"0.622036",
"0.62128764",
"0.62110275",
"0.61966056",
"0.61776453",
"0.617547",
"0.6174961",
"0.61654735",
"0.6153256",
"0.61516005",
"0.6149498",
"0.6123234",
"0.6118653",
"0.61077267",
"0.61061186",
"0.6093616",
"0.608318",
"0.6074428",
"0.60650206",
"0.60244286",
"0.6020295",
"0.60155797",
"0.6012826",
"0.6010141",
"0.6010141",
"0.60037106",
"0.600298",
"0.59979576",
"0.5994806",
"0.5994283",
"0.5993927",
"0.5980616",
"0.59667075",
"0.59614897",
"0.59610957",
"0.596071",
"0.5959614",
"0.59554",
"0.59542966",
"0.5946781",
"0.5940262",
"0.5940262",
"0.59401053",
"0.5937168",
"0.5932135",
"0.59293395",
"0.592659",
"0.59202623",
"0.59112674",
"0.59088206",
"0.590716",
"0.59056735",
"0.589997",
"0.5899655",
"0.5898926",
"0.5896042",
"0.589589",
"0.5895867",
"0.58894163",
"0.5884936",
"0.5879227",
"0.58740723",
"0.5871364",
"0.5870148",
"0.5869228",
"0.5868196",
"0.5867967",
"0.5865532",
"0.58653617",
"0.58644646",
"0.58631665",
"0.5862611",
"0.5857609",
"0.58558804",
"0.5853729",
"0.5853025"
] | 0.0 | -1 |
Right now we have /v2/exercises and /v2/exercises/:track_id. Let's tweak the /v2/exercises to take an optional parameter ?tracks=a,b,c and if that parameter is passed, only return the data for those tracks. | def test_that_you_may_filter_to_single_track
getting '/v2/exercises?tracks=fruit'
returns_tracks %w( fruit )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:track_id]\n @track = Track.find(params[:track_id])\n @events = Event.where(track_id: params[:track_id]).where(event_type: 'track')\n else\n @events = Event.all\n end\n end",
"def search_track(opts = {}, &block)\n if opts.is_a? String\n query = opts\n else\n query = opts[:query]\n artist = opts[:artist]\n track = opts[:track]\n end\n if not query.nil?\n query = query.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)\n get(\"#{@base_url}/tracks/search/json?q=#{query}\", track_mapping, block)\n elsif not artist.nil? and not track.nil?\n artist = artist.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)\n track = track.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)\n get(\"#{@base_url}/tracks/search/exact/json?artist=#{artist}&track=#{track}\", track_mapping, block)\n end\n end",
"def resource\n unless @track.present?\n @track = Album.artist_id(params[:artist_id]).find(params[:album_id]).original_tracks.find(params[:id])\n @track.album_context = @track.albums.find(params[:album_id])\n end\n \n @track\n end",
"def tracks_get_info params = { :track_id => nil }\n json = send_request 'tracks_get_info', params\n if json['success'] == true\n json['data']\n else\n puts \"Error: \" + json['message']\n exit\n end\n end",
"def index\n @api_v1_exercises = Api::V1::Exercise.all\n end",
"def tracks(args={})\n query = \"/?client_id=#{@client_id}&format=#{format.to_s}&#{format_parameters(args)}\"\n path = __method__.to_s\n http_get(path, query)\n end",
"def index\n @album = Album.find_by(id: params[:album_id])\n @tracks = Track.where(album_id: params[:album_id])\n end",
"def index\n @trackers = Tracker.all\n @trackers = @trackers.where(id: params[:ids].split(',')) if params[:ids].present?\n end",
"def tracks_search params = { :query => 'love', :page => 1 }\n json = send_request 'tracks_search', params\n if json['success'] == true\n json['tracks']\n else\n puts \"Error: \" + json['message']\n exit\n end\n end",
"def find_track(track_name, next_url: nil, all: false)\n uri = next_url.nil? ? 'https://api.deezer.com/search/track' : next_url\n headers = {params: {access_token: @access_token, q: track_name, strict: 'on'}}\n if all\n iterator_wrapper(__method__, track_name, next_url: uri)\n else\n response = RestWrapper.perform_request(uri, :get, headers)\n next_url.nil? ? response['data'] : response\n end\n end",
"def search(track, options={})\n get(:standard, {:method => \"track.search\", :track => track}.merge(options))\n end",
"def get_tracks search\n sa = search.split(' ')\n\n if sa.size > 1\n case sa.first\n when 'u' \n sa.shift\n @sc_client.User.find(sa.join('-')).tracks\n when 't'\n sa.shift\n @sc_client.Track.find(:all,:params => { :q => sa.join('-') } )\n else\n @sc_client.Track.find(:all,:params => { :q => sa.join('-')} )\n end\n else\n @sc_client.Track.find(:all,:params => { :q => search } )\n end\n end",
"def get_tracks\n\t\ttracks = @client.get('/tracks', :limit => 6)\n\t\ttracks.each do |track|\n\t\t\tuser = @client.get('/users/' + track.user_id.to_s)\n\t\t\t\tif user.city.present? && user.country.present?\n\t\t\t\t\tgeocoding = Geocoder.search(\"#{user.city}, #{user.country}\").first\n\t\t\t\t\t# track.delete_if {geocoding.nil?}\n\t\t\t\t\tif geocoding\n\t\t\t\t\t\tlat = geocoding.data[\"geometry\"][\"location\"][\"lat\"] ? geocoding.data[\"geometry\"][\"location\"][\"lat\"] : ['51']\n\t\t\t\t\t\tlng = geocoding.data[\"geometry\"][\"location\"][\"lng\"] ? geocoding.data[\"geometry\"][\"location\"][\"lng\"] : ['0.1']\n\t\t\t\t\tend\n\t\t\t\t\t@filtered_tracks << { track: track, user: user, coordinates: [lat, lng] }\n\t\t\t\tend\n\t\tend\n\t\t@filtered_tracks\n\tend",
"def get_hyped_tracks( params )\n LastFM.get( \"chart.getHypedTracks\", params )\n end",
"def weather_search\n cookies[:dance] = false\n cookies[:party] = false\n cookies[:feeling] = \"\"\n cookies[:genre] = \"\"\n cookies[:weather] = params[:want_to]\n cookies[:search] = params[:weather]\n\n @tracks = TracksHelper::Track.lyrics_keywords(params[:weather], 30).select{ |t| t.match_weather(params[:want_to])}\n\n respond_to do |format|\n if @tracks.length > 0\n format.html {render :show, layout: false}\n format.json {render json: @tracks.map{|track| track.as_json.slice(\"title\", \"artist_name\", \"track_youtube_id\")}}\n else\n flash[:danger] = 'There was a problem'\n format.html { render :_no_results, layout: false }\n format.json { }\n end\n end\n end",
"def show\n client_playlist = Soundcloud.new(:client_id => Rails.application.secrets.soundcloud_client_id,\n :client_secret => Rails.application.secrets.soundcloud_secret,\n :username => Rails.application.secrets.soundcloud_username,\n :password => Rails.application.secrets.soundcloud_password)\n client_track = SoundCloud.new(:client_id => Rails.application.secrets.soundcloud_client_id)\n # create an array of track ids\n track_url = Post.find(params[:id]).try(:track_url)\n # puts track_url.inspect\n embed_info = client_track.get('/oembed', :url => track_url)\n @song = embed_info['html']\n @track_id = client_track.get('/resolve', :url => track_url).id\n @playlists = client_playlist.get(\"/me/playlists\")\n end",
"def track_params\n params[:track]\n end",
"def api_v1_exercise_params\n params.fetch(:api_v1_exercise, {}).permit *Api::V1::Exercise::STRONG_PARAMETERS #I had to put tests extra\n end",
"def set_api_v1_exercise\n @api_v1_exercise = Api::V1::Exercise.find(params[:id])\n end",
"def set_api_v1_exercise\n @api_v1_exercise = Api::V1::Exercise.find(params[:id])\n end",
"def exercises\n ids = self.exercise_records.pluck(:exercise_id)\n Exercise.where(id: ids)\n end",
"def index\n if params[:hour] != nil && params[:hour].to_i > 0\n @tracked_data = TrackedDatum.where(updated_at: params[:hour].to_i.hours.ago..Time.now).all.order(:pageURL)\n else\n @tracked_data = TrackedDatum.all.order(:pageURL)\n end\n end",
"def index\n\tif (params.has_key?(:workout_id))\n\t\tset_workout\n\t\t@exercises = @workout.exercises.paginate(page: params[:page])\n\t\t\t\n\t\t#@exercises = current_user.exercises.find(params[:workout_exercises][:workout_id])\n\telse\n\t\t@exercises = current_user.exercises.paginate(page: params[:page])\n\tend\t\n\t\n end",
"def show\n @track = @disc.tracks.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @track }\n end\n end",
"def track_params\n params.require(:track).permit(:title, :artist, :album, :date, :notes, :favourite, :user_id, :useers)\n end",
"def show\n @exercises = Exercise.where(\"chapter_id = ?\", params[:id]).order(:number)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chapter }\n end\n end",
"def show\n @tracks = Track.where(\"competition_id = ?\", params[:id]).all\n\n unless current_user.nil?\n # A track can participate in one competition at a time\n @my_tracks_to_submit = Track.where(\"username = ?\", current_user.username).where(\"competition_id IS NULL\").all\n end\n end",
"def track_params\n params.require(:track).permit(:title, :ord, :lyrics, :album_id, :band_id)\n end",
"def show\n @track = Track.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @track }\n end\n end",
"def show\n @track = Track.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @track }\n end\n end",
"def show\n @track = Track.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @track }\n end\n end",
"def index\n @user = User.find(params[:user_id])\n @exercises = @user.exercises.all\n end",
"def track_ids\n tracks || []\n end",
"def index\n @tracks = Track.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tracks }\n end\n end",
"def index\n if params[:course]\n # @searched = params[:course]\n # @tracks = Track.where(\"title ILIKE ?\", \"%#{params[:course]}%\")\n @q = Track.ransack(params[:course])\n @tracks = @q.result(distinct: true)\n else \n @q = Track.ransack(params[:q])\n @tracks = @q.result(distinct: true)\n end\n end",
"def search\n cookies[:dance] = false\n cookies[:party] = false\n cookies[:weather] = \"\"\n cookies[:feeling] = \"\"\n cookies[:genre] = \"\"\n cookies[:search] = params[:word]\n\n @tracks = TracksHelper::Track.lyrics_keywords(params[:word])\n\n\n respond_to do |format|\n if @tracks.length > 0\n format.html {render :show, layout: false}\n format.json {render json: @tracks.map{|track| track.as_json.slice(\"title\", \"artist_name\", \"track_youtube_id\")}}\n else\n flash[:danger] = 'There was a problem'\n format.html { render :_no_results, layout: false }\n end\n end\n end",
"def track_params\r\n params.require(:track).permit(:track_url)\r\n end",
"def track_params\n params.require(:track).permit(:title, :url)\n end",
"def stories(project, api_key, filter='')\n\treq = Net::HTTP::Get.new(\n \"/services/v3/projects/#{project}/stories?filter=#{filter}\",\n {'X-TrackerToken'=>api_key}\n )\n res = Net::HTTP.start(@pt_uri.host, @pt_uri.port) {|http|\n http.request(req)\n }\n\n return res.body\nend",
"def tracking_details\n buyer = @current_user\n type_of_tracking = (params[:type_of_tracking] || \"property_tracking\").to_sym\n if type_of_tracking == :property_tracking\n udprns = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:property_tracking]).pluck(:udprn)\n api = PropertySearchApi.new(filtered_params: {})\n body = api.fetch_details_from_udprns(udprns)\n render json: {property_details: body}, status: 200\n else\n if params[\"hash_str\"].present?\n body = Oj.load(Net::HTTP.get(URI.parse(URI.encode(\"http://52.66.124.42/api/v0/properties/search?hash_str=#{params['hash_str']}\"))))\n render json: {property_details: body}, status: 200\n else\n body = []\n search_hashes = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[type_of_tracking]).pluck(:hash_str).compact\n search_hashes.each do |search_hash|\n ### TODO: Fix this. Use internal methods rather than calling the api\n body = Oj.load(Net::HTTP.get(URI.parse(URI.encode(\"http://api.prophety.co.uk/api/v0/properties/search?hash_str=#{search_hash}\")))) + body\n end\n render json: {search_hashes: search_hashes, property_details: body}\n end\n end\n end",
"def index\n\t\t@exercises = Exercise.liked_by(current_user.id).search_by_name(params[:search_name]).search_by_type(params[:search_type]).search_by_owner(params[:search_owner]).published\n\t\t\t.concat(Exercise.owned_by(current_user.id).search_by_name(params[:search_name]).search_by_type(params[:search_type]).search_by_owner(params[:search_owner]).published)\n\t\t\t.concat(Exercise.owned_by(current_user.id).search_by_name(params[:search_name]).search_by_type(params[:search_type]).search_by_owner(params[:search_owner]).unpublished)\n\t\t\t.paginate(:page => params[:page], :per_page => 10)\n\t\t\t#Exercise.liked_by(current_user.id).published.paginate(:page => params[:page], :per_page => 30)\n\t\tlogger.debug \"wisport #{@exercises}\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n\t\t\tformat.js\n end\n end",
"def index\n @exercises = Exercise.search(params)\n # @exercises = Kaminari.paginate_array(@exercises).page(params[:exercise_page]).per(PER_PAGE_RECORDS)\n end",
"def index\n @tracks = Track.all\n end",
"def index\n @tracks = Track.all\n end",
"def index\n @tracks = Track.all\n end",
"def topsongs\n tracks = Array.new\n session[:related].each do |artistName|\n artist = RSpotify::Artist.search(artistName).first\n top_tracks = artist.top_tracks(@userCountry).first\n tracks.push(top_tracks.uri)\n end\n\n uri = URI.parse(\"#{@playlistUrl}/tracks/\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true #this helps with the https\n request = Net::HTTP::Post.new(uri)\n request[\"Authorization\"] = \"Bearer #{@data[\"access_token\"]}\"\n request[\"Content-Type\"] = \"application/json\"\n request.body = \"{\\\"uris\\\": #{tracks}}\"\n response = http.request(request)\n finished = JSON.parse(response.read_body)\n if finished.key?(\"snapshot_id\")\n @playlistCheck = true\n else\n @playlistCheck = false\n end\nend",
"def show\n @track = Track.find(params[:id])\n render :template => \"tracks/show\"\n end",
"def index\n facility_id = params[:facility_id]\n org_id = params[:org_id]\n opts = {\n user_facility_ids: facility_id && BSON::ObjectId(facility_id),\n user_org_ids: org_id && BSON::ObjectId(org_id),\n access_ids: params[:access_id] && BSON::ObjectId(params[:access_id]),\n status: params[:status],\n :pass_time.gte => params[:start_at],\n :pass_time.lte => params[:end_at]\n }.delete_if { |key, value| value.blank? }\n query = []\n unless params[:key].blank?\n query << { user_name: /.*#{params[:key]}.*/ }\n query << { user_sno: /.*#{params[:key]}.*/ }\n query << { user_nationality: /.*#{params[:key]}.*/ }\n end\n query << {} if query.blank?\n @trackers = paginate(Tracker.where(opts).and('$or': query))\n end",
"def track_params\n params.require(:track).permit(:title, :description, :short, :language, :level, :price)\n end",
"def index\n @tracks = @disc.tracks.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tracks }\n end\n end",
"def show\n response = Track.get_track_musicians_by_track_id(params[:id])\n @title = response['Results'][0]['Title']\n if response['Results'][0]\n @track = response['Results'][0]['Participations']\n else\n @track = nil\n end\n end",
"def track_params\n params.require(:track).permit(:name, :user_id, :url, :source)\n end",
"def get_tracks(*ids)\n song_list = []\n ids.each do |id|\n song_list << @tracks.find {|s| s.track_id == id}\n end\n return song_list.compact\n end",
"def track_params\n params.require(:track).permit(:title, :latitude_from, :longtitude_from, :latitude_to, :longtitude_to) #:user_id, :json_response, :json_processed\n end",
"def search_tracks(q, page=1)\n \t response_body = get_body(http_get(\"http://ws.spotify.com/search/1/track.json?q=#{CGI.escape(q)}&page=#{page}\"))\n \t json = ActiveSupport::JSON.decode(response_body)\n to_tracks(json[\"tracks\"])\n \tend",
"def index\n @exercises = Exercise.paginate(:page => params[:page], :per_page => 10).order('created_at DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @exercises }\n end\n end",
"def index\n @tracks = Track.where(:user_id => current_user.id)\n end",
"def search_with_age\n cookies[:dance] = false\n cookies[:party] = false\n cookies[:weather] = \"\"\n cookies[:genre] = \"\"\n cookies[:feeling] = params[:feeling]\n cookies[:search] = params[:age]\n\n @form_feeling = params[:feeling]\n @tracks = TracksHelper::Track.lyrics_keywords(params[:age], 20).select{ |t| t.match_sentiment(@form_feeling)}\n respond_to do |format|\n if @tracks.length > 0\n format.html {render :show, layout: false}\n format.json {render json: @tracks.map{|track| track.as_json.slice(\"title\", \"artist_name\", \"track_youtube_id\")}}\n else\n flash[:danger] = 'There was a problem'\n format.html { render :_no_results, layout: false }\n format.json { }\n end\n end\nend",
"def track_params\n params.require(:track).permit!\n end",
"def track_params\n params.require(:track).permit(:name, :file, :cover, :artist)\n end",
"def exerciseoverview_params\n params[:exerciseoverview]\n end",
"def tracks\n args = [country]\n args << {:location => city} if city\n link :top_tracks, :Track, *args\n end",
"def show\n @album = Album.find(params[:id])\n @tracks = @album.tracks\nend",
"def index\n p params[:tour_id]\n if params[:tour_id].nil?\n @points = Point.all\n render json: @points, include: :tour, status: :ok\n else\n @points = Point.where(tour_id: params[:tour_id])\n render json: @points, status: :ok\n end\n end",
"def index\n @tracks = Track.all\n render json: {tracks: @tracks}\n end",
"def index\n @tracks = Track.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tracks }\n end\n end",
"def track_params\n params.require(:track).permit(:title)\n end",
"def index\n @tracks = current_user.tracks\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tracks }\n end\n end",
"def get_answers_for\n user = current_user\n render_401 and return unless user\n prospect = User.find_by_id(params[:for_user_id])\n render_404 and return unless prospect\n\n answers = ShortQuestion.get_latest_n_answers_for(prospect.id, params[:num], params[:start])\n render :json => {\n :success => true,\n :answers => answers\n }\n end",
"def album_tracks(album, options = {})\n get \"albums/#{album}/tracks\", options\n end",
"def albums_tracks(args={})\n query = \"/?client_id=#{@client_id}&format=#{format.to_s}&#{format_parameters(args)}\"\n path = __method__.to_s.gsub(/[_]/,'/')\n http_get(path, query)\n end",
"def tracks(user, options={})\n get(:standard, {:method => \"library.getTracks\", :user => user}.merge(options))\n end",
"def find_tracks_for_trackable(trackable_str, trackable_id)\n find(:all,\n :conditions => [\"trackable_type = ? and trackable_id = ?\", trackable_str, trackable_id],\n :order => \"created_at DESC\"\n )\n end",
"def api_v1_exercise_params\n params.require(:api_v1_exercise).permit(:title, :description, :deadline, :visible_date, :do_plagiarism_check, :exercise_test, :exercise_hidden_test, :exercise_stub)\n end",
"def tracks(options={})\n call_pageable('library.gettracks', :tracks, Track, {:user => @user.name}.merge(options))\n end",
"def chart_data\n @track=current_user.tracks.find(params[:id])\n respond_to do |format|\n format.json {render :json => @track.as_chart_data}\n end\n end",
"def top_tracks(country, options={})\n get(:standard, {:method => \"geo.getTopTracks\", :country => country}.merge(options))\n end",
"def show_tracker\n find_user\n if [email protected]?\n assign_project\n @req = Requirement.find_by_id(params[:req])\n if [email protected]?\n @all_user=Tracker.find_all_user(@user)\n @tracker_reqs=Tracker.find_tracker_by_req(@req)\n #@tracker_reqs=req.trackers.find(:all,:order => \"updated_at desc\")\n session[:req_id][email protected]\n respond_to do |format|\n format.html { render \"trackers/index\" }\n end\n else\n redirect_to sign_in_url\n end\n\n end\n end",
"def get_track(spotify_id)\n content = HTTParty.get('http://ws.spotify.com/lookup/1/.json?uri=' + URI.escape(\"spotify:track:#{spotify_id}\"))\n if !content.body.empty?\n Oj.load(content.body)\n else\n flash[:notice] = 'Error with Spotify! Try again in 10 seconds!'\n end\n end",
"def show\n begin\n @example = Example.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n # last URL parameter is not example ID, but the example's number\n @example = @language.examples.where(number: params[:id].to_i).first\n end\n @examples = [@example]\n respond_to do |format|\n format.html { render 'examples/index' } # also show index.html.erb\n format.json { render json: @example }\n end\n end",
"def show\n @remote_ip = request.env[\"HTTP_X_FORWARDED_FOR\"]\n # @track = Track.find(params[:id])\n # #@similar_tracks = SimilarTrack.find(:all, :conditions =>[\"altnet_id = ?\", params[:id]])\n # sql = \"select tracks.id, tracks.name as track_name, artists.name as artist_name, score from similar_tracks, tracks,albums,artists where altnet_id = \" + params[:id] + \" and similar_track_id = tracks.id and tracks.album_id = albums.id and albums.artist_id = artists.id order by score desc\"\n # @similar_tracks = Track.find_by_sql(sql) \n # \n # respond_to do |format|\n # format.html # show.html.erb\n # format.xml { render :xml => @similar_tracks }\n # end\n end",
"def show\n artist = params[:artist]\n track = params[:track]\n @url = \"http://soundcloud.com/#{artist}/#{track}\"\n @soundcloud_track = Soundcloud.client.get('/resolve', :url => @url)\n end",
"def exercise_params\n params.require(:exercise).permit(:workout_id, :title, :sets, :reps)\n end",
"def show\n exercise_illustration = case @exercise.blank?\n when true\n ExerciseIllustration.where(token: params[:exercise_id], id: params[:id])\n when false\n @exercise.exercise_illustrations.find(params[:id])\n end\n\n render json: exercise_illustration\n end",
"def playlists_track_params\n params.require(:playlists_track).permit(:playlist_id, :track_id)\n end",
"def time_track\n @time_track ||= begin\n record = teacher.time_tracks.\n for_date(time_track_params[:clock_out].to_date).\n no_clock_out.first\n\n raise ActiveRecord::RecordNotFound if record.nil?\n\n record\n end\n rescue ActiveRecord::RecordNotFound\n message = 'Time Track not found!'\n\n render json: [message], status: :unprocessable_entity\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @exercises }\n end\n end",
"def artist_top_tracks(artist, options = {})\n get \"artists/#{artist}/top-tracks\", options\n end",
"def track_params\n params.require(:track).permit(:name, :artist, :release, :file)\n end",
"def show\n @exercise = Exercise.find_by_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise }\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"def index\n @exercises = Exercise.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @exercises }\n end\n end",
"def show\n render json: {track: @track}\n end",
"def index\n @oncourse_exercises = OncourseExercise.all\n\n\n\n end",
"def index\n if params[:hour] != nil && params[:hour].to_i > 0\n @tracked_pages = TrackedPage.where(updated_at: params[:hour].to_i.hours.ago..Time.now).all.order(:pageURL)\n else\n @tracked_pages = TrackedPage.all.order(:pageURL)\n end\n end",
"def show\n @track = Track.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @track }\n end\n end",
"def show\n @track = Track.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @track }\n end\n end",
"def track_params\n params.require(:track).permit(:name, :fecha)\n end",
"def get_track(id)\n return @tracks.find {|s| s.track_id == id}\n end",
"def index\n if params[:issue_id].present?\n @responses = Response.where( issue_id: params[:issue_id])\n elsif params[:install_id].present?\n @responses = Response.where( install_id: params[:install_id])\n else\n @responses = Response.all\n end\n end"
] | [
"0.606591",
"0.57334566",
"0.5726674",
"0.56712407",
"0.558732",
"0.55744505",
"0.5491342",
"0.54742",
"0.5463494",
"0.5418604",
"0.5404517",
"0.54043984",
"0.53959787",
"0.5373809",
"0.5305484",
"0.52836776",
"0.5282571",
"0.5272556",
"0.52332693",
"0.52332693",
"0.52280957",
"0.52114016",
"0.5178499",
"0.5154691",
"0.51513606",
"0.51402307",
"0.51203454",
"0.50993365",
"0.509589",
"0.509589",
"0.509589",
"0.5095324",
"0.5086573",
"0.50857943",
"0.5075677",
"0.50736564",
"0.50724816",
"0.50718987",
"0.5070856",
"0.50658387",
"0.5053983",
"0.5040914",
"0.5038785",
"0.5038785",
"0.5038785",
"0.50361633",
"0.5025712",
"0.50246096",
"0.5008788",
"0.5002342",
"0.49767494",
"0.49666283",
"0.49649122",
"0.49629137",
"0.49611908",
"0.49542025",
"0.49439648",
"0.4940527",
"0.49221826",
"0.49188563",
"0.48996797",
"0.4884859",
"0.4882653",
"0.48779476",
"0.48644406",
"0.4856116",
"0.48520908",
"0.4849284",
"0.4849048",
"0.48408818",
"0.48397368",
"0.48363954",
"0.4835549",
"0.48309058",
"0.4816318",
"0.4813154",
"0.4812416",
"0.4811204",
"0.48085377",
"0.48071122",
"0.4803778",
"0.48029172",
"0.48022217",
"0.48006004",
"0.479887",
"0.47964966",
"0.4793268",
"0.47930768",
"0.47861198",
"0.4785393",
"0.47841907",
"0.47841907",
"0.47762245",
"0.4772092",
"0.47711837",
"0.47680995",
"0.47680995",
"0.4765928",
"0.47628555",
"0.47625878"
] | 0.7185951 | 0 |
def initialize( credit_card_processor ) | def renew_business_subscription( user, package, business, credit_card)
charge_and_subscribe user, package, business, nil, credit_card
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(card_number_or_token, card_expiry_month = nil, card_expiry_year = nil, card_cvc = nil)\n if card_expiry_month == nil\n @card_token = card_number_or_token\n else\n @card_number = card_number_or_token\n @card_expiry_month = card_expiry_month\n @card_expiry_year = card_expiry_year\n @card_cvc = card_cvc\n end\n end",
"def initialize (card_name, bank_name)\n\t\tself.bank_name = bank_name\n\t\tself.card_name = card_name\n\t\tself.accounts = {}\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#creates accounts hash to store credit card balance in\n\t\tself.credit_lim = 1000\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#creates a credit limit of 1000\n\t\tself.record_to_statem = {}\n\t\tself.trans_count = 0\n\t\tself.post = \"\"\n\tend",
"def initialize(credit_number) # define initialize method that accepts one argument (number)\n\t\t@number = credit_number.to_s.split(\"\").map(&:to_i) # define instance variable of number equal to argument \n\t\t# number which we \n\t\t# turn to string and split each char to array then map each array element back to integer\n\t\traise ArgumentError.new(\"Credit card number must be 16 digits long\") if @number.length != 16\n\t # raise argument error if length of array is not equal to 16 characters\n\tend",
"def prepare_credit_card\n @card = ActiveMerchant::Billing::CreditCard.new({\n :number => card_number,\n :month => card_month,\n :year => card_year,\n :first_name => card_first_name,\n :last_name => card_last_name,\n :verification_value => card_verification,\n :type => card_type\n })\n \n if @card.valid?\n @result[:card] = true\n else\n @result[:card] = false\n end\n @result[:card]\n end",
"def process_card(card_data) # card_dat --> hash con toda la informacion de l tarjeta de credito\n\t\toptions = payment_options #options es todo el hash \n\t\toptions[:payer][:payment_method] = \"credit_card\"\n\t\toptions[:payer][:funding_instruments] = [{\n\t\t\tcredit_card: {\n\t\t\t\ttype: CreditCardValidator::Validator.card_type(card_data[:number]), #visa, mastercard\n\t\t\t\tnumber: card_data[:number], #numero de la cuenta\n\t\t\t\texpire_month: card_data[:expire_month],\n\t\t\t\texpire_year: card_data[:expire_year],\n\t\t\t\tcvv2: card_data[:cvv2]\n\t\t\t}\n\t\t}]\n\t\tself.payment = Payment.new(options)\n\t\tself.payment\n\tend",
"def initialize\n @credit_card = false\n @debit_card = false\n @cash = false\n end",
"def new\n @credit_card = ActiveMerchant::Billing::CreditCard.new\n end",
"def initialize()\n # Cards table, containing cards hashes\n setAllCards()\n end",
"def initialize(response, card)\n @response = response\n @card = card\n end",
"def initialize(user_id, card_id)\n @card_id = card_id\n @user_id = user_id\n end",
"def initialize(properties)\n @card = properties\n end",
"def parse_card(params)\n ActiveMerchant::Billing::CreditCard.new(:number => params[:card_number],\n :verification_value => params[:card_code],\n :month => params[:card_month], \n :year => params[:card_year], \n :first_name => params[:first_name],\n :last_name => params[:last_name]) \n end",
"def credit_card_number; end",
"def initialize(cards) #argument\n @cards = cards\n end",
"def initialize(format = UprightCard.new)\n @format = format\n @card_data = pick_card\n end",
"def initialize(client_code, name, balance, password, credit_card_number)\n @client_code = client_code\n @name = name\n @balance = balance\n @password = password\n @credit_card_number = credit_card_number\n end",
"def initialize(params = {})\n @card_number = nil\n @errors = []\n @expiration_date = nil\n self.attributes = params\n end",
"def from_hcard()\n end",
"def initialize(cards)\n @cards = cards\n end",
"def initialize(cards)\n @cards = cards\n end",
"def initialize(cards)\n @cards = cards\n end",
"def init_cc\n raise NotImplementedError\n end",
"def new_credit_card\n # populate new card with some saved values\n ActiveMerchant::Billing::CreditCard.new(\n :first_name => user.first_name,\n :last_name => user.last_name,\n # :address etc too if we have it\n :brand => cc_type\n )\n end",
"def card_detection\n end",
"def credit_card\n\t\t@credit_card ||= ActiveMerchant::Billing::CreditCard.new(\n\t\t\t:type => card_type,\n\t\t\t:number => card_number,\n\t\t\t:verification_value => card_cvv,\n\t\t\t:month => card_exp_month,\n\t\t\t:year => card_exp_year,\n\t\t\t:first_name => self.billing_address.name.split(' ').first,\n\t\t\t:last_name => self.billing_address.name.split(' ').last\n\t\t\t)\n\tend",
"def credit_card_type; end",
"def initialize(cards)\n @cards = cards\n end",
"def initialize(payment)\n @payment = payment\n end",
"def initialize(cards = Deck.all_cards)\n end",
"def initialize(barcode)\n self.barcode = barcode\n end",
"def initialize(barcode)\n self.barcode = barcode\n end",
"def initialize(attributes)\n super()\n self.identity = attributes[:identity]\n self.identity_type = attributes[:identity_type]\n self.public_key = attributes[:raw_public_key]\n self.scope = attributes[:scope] || Card::APPLICATION\n self.data = attributes[:data]\n self.info = attributes[:info]\n end",
"def initialize card,log\n\t\tlog.info \"Card_for_db.initialize(#{card.name}) start.\"\n\t\tsuper(name:card.name,\n\t\t\tprice: card.price,\n\t\t\tdate: card.date,\n\t\t\tstore_url: card.store_url,\n\t\t\tgenerating_mana_type: card.generating_mana_type,\n\t\t\tmanacost: card.manacost,\n\t\t\tcolor: card.color,\n\t\t\tmanacost_point: card.manacost_point,\n\t\t\tcardtype: card.cardtype,\n\t\t\toracle: card.oracle,\n\t\t\tpowertoughness: card.powertoughness,\n\t\t\tillustrator: card.illustrator,\n\t\t\trarity: card.rarity,\n\t\t\tcardset: card.cardset)\n\tend",
"def credit_card\n @credit_card ||= ActiveMerchant::Billing::CreditCard.new(\n :number => card_number,\n :verification_value => card_verification,\n :month => card_expires_on.month,\n :year => card_expires_on.year,\n :first_name => first_name,\n :last_name => last_name\n )\n end",
"def initialize(card)\n @card = card #TODO: change this to @rank\n end",
"def initialize(card_number, limit)\n @card_number = card_number\n @limit = limit\n end",
"def initialize(string, card)\n # attributes\n @guess = string\n @card = card\n end",
"def initialize(card, board_name, actions)\n @card_id = card.id\n @card_name = card.name\n @board_id = card.board_id\n @board_name = board_name\n @actions = actions\n @labels = card.card_labels\n end",
"def initialize(cards = Deck.all_cards)\n @cards = cards\n end",
"def initialize(amount, currency_code)\n @amount = amount\n @currency_code = currency_code\n end",
"def initialize\n @first_name = Forgery::Name.first_name\n @last_name = Forgery(:basic).password(:at_least => 6, :at_most => 8)\n @full_name = \"#@first_name #@last_name\"\n @type = 'Visa'\n @number = Forgery::CreditCard.number(:type => 'Visa', :length => 16, :prefixes => %w\"470758 473099 475034 474480 477462\").to_s\n @cvv = Random.new.rand(100..999).to_s\n @cvv2 = ''\n @expire_month = Forgery::Date.month(:numerical => true).to_s\n @expire_year = Forgery::Date.year(:future => true, :past => false, :min_delta => 1, :max_delta => 5).to_s\n @last_four_digits = @number[12..-1]\n end",
"def initialize(card_array) # creates an array of cards\n @cards = card_array\n end",
"def get_credit_card\n end",
"def init()\n\t$numCharges = 0\n\t$numGiftCards = 0\n\t$giftCardAmount = 0\n\t$discountPercentage = 0\n\t$total = 0\n\t$labor = 0\nend",
"def initialize\n @cards = Card::RANKS.product(Card::SUITS).collect { |rank, suit| Card.new(suit, rank) }\n end",
"def creditcard=(creditcard)\n @creditcard = creditcard\n self.cc_type = ActiveMerchant::Billing::CreditCard.type?(creditcard.number)\n self.number = creditcard.number if Spree::Config[:store_cc]\n self.display_number = creditcard.display_number \n self.month = creditcard.month\n self.year = creditcard.year\n self.first_name = creditcard.first_name\n self.last_name = creditcard.last_name\n end",
"def initialize(card_id, source_date, opts = {})\n @card_id = card_id\n @source_date = source_date\n\n\n\n end",
"def initialize(phone)\n @phone = phone\n end",
"def initialize()\n @cards = []\n end",
"def test_secure_setup\n customer = customers(:bob)\n \n credit_card_params = {\n :number => \"4111111111111111\",\n :last_four => \"1111\",\n :month => \"1\",\n :year => (Date.today.year + 2).to_s,\n }\n\n cc = CreditCard.secure_setup(credit_card_params, customer)\n assert cc.original_valid?\n end",
"def initialize\n # Call function to generate the account number\n account_number_gen\n # Initialize instance variables\n @checking_account_balance = 0\n @saving_account_balance = 0\n @@total_accounts += 1\n @interest_rate = 0.01\n end",
"def initialize(card_value, card_suit)\n fail \"Invalid suit: #{card_suit}\" unless validate_suit(card_suit)\n fail \"Invalid value: #{card_value}\" unless validate_value(card_value)\n @value = card_value\n @suit = card_suit\n @hash = nil\n end",
"def initialize\n\t@view_all_claims = false\n\t@rx_number = 0\n\t@fill_number = 0\n\t@customer = \"\"\n\t@plan = 0\n\t@from_date = Date.today\n\t@status = \"\"\n end",
"def initialize() end",
"def initialize(params = {})\n run_callbacks :create do\n super\n @cards ||= []\n end\n end",
"def initialize\n\t\t@cards = []\n\t\t@value = 0\n\t\t@currentBet = 0\n\t\t@hasAce = false\n\t\t@blackjack = false\n\tend",
"def initialize(customer)\n @customer = customer #When Blackjack.new , this will run\n deck = Deck.new #creates a new instance of Deck from deck.rb\n @deck = deck.cards.shuffle #Creates variable @deck which is a new shuffled deck\n @player = [] #creates Dlayer array (hand)\n @dealer = [] #creates Dealer array (hand)\n start_game #runs the start_game method which runs the Blackjack Menu\n end",
"def build_creditcard_from_params(params)\n ActiveMerchant::Billing::CreditCard.new(\n :number => params[:number],\n :month => params[:month],\n :year => params[:year],\n :first_name => params[:first_name],\n :last_name => params[:last_name],\n :verification_value => params[:verification])\n end",
"def initialize(amount, currency_code)\n @amount = amount.to_f\n @currency_code = currency_code\n end",
"def create_source_from_ccid\n creditcard = Creditcard.find_by_id( @creditcard_id )\n if creditcard\n self.source = creditcard\n end\n end",
"def initialize(source = RkFxRates::Provider::Ecb)\n \t\t@source = source\n @fx_hash = retrieve\n \tend",
"def initialize_instance\n super\n userHandle.value = get_parameter(:handle)\n request.pduHead.frag_length = self.num_bytes\n request.opnum.value = 47 \t\t#SamrQueryInformationUser2\n end",
"def initialize\n super CardNine::Cards::PlayingCard.deck, [:community], STAGES\n end",
"def initialize(input_holder_name, input_amount, input_type)\n @holder_name = input_holder_name\n @amount = input_amount\n @type = input_type\nend",
"def init\n # BME280 register setting\n set_register\n\n # read trimming parameter \n read_trim_params\n self\n end",
"def initialize(card1, card2)\n @card1 = card1\n @card2 = card2\n run_callbacks(:initialize)\n Rails.logger.info \"#{self.class.name} will be used for #{card1} versus #{card2}\".colorize(:light_magenta)\n end",
"def initialize(&block)\n class <<self\n self\n end.class_eval do\n attr_accessor(:commodity, *PostData::PostParam) \n end\n \n # return-back to merchant-web\n self.customer_specification_flag = Config::CUSTOMER_SPECIFICATION_FLAG \n self.settlement_type = Config::SETTLEMENT_TYPE_CARD\n\n # if block_given?\n # yield(self) #self.instance_eval(&block)\n # return self.get_keys\n # end\n end",
"def initialize\n\t\t@cards = (1..52).to_a\n\tend",
"def initialize\n\n\n\n end",
"def initialize(name, age)\n @name = name\n @age = age\n @report_card = Report_Card.new\n end",
"def initialize\n # Could add options so that game can be created with different amounts of cards depending upon the game being created\n\n deck = Array.new\n\n Card::VALID_SUITS.each do |vs|\n Card::VALID_NUMBERS.each do |vn|\n deck.push Blackjack::Card.new(vs, vn)\n end\n end\n @deck = deck.shuffle\n end",
"def set_credit_card\n @credit_card = CreditCard.find(params[:id])\n end",
"def set_credit_card\n @credit_card = CreditCard.find(params[:id])\n end",
"def initialize(card1 = nil, card2 = nil, card3 = nil)\n @card1 = card1\n @card2 = card2\n @card3 = card3\n @good_set\n end",
"def initialize(params = {})\n # set up our initial wallet state\n @messages ||= {}\n # @warning = false\n @cards ||= []\n @errors ||= []\n self.attributes = params\n end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize\n\n\nend",
"def initialize(amount, currency)\n set_amount(amount)\n set_currency(currency)\n end",
"def initialize(params)\n @area_code = params[:area_code]\n @country_code = params[:country_code]\n @local_number_format = params[:local_number_format]\n @mobile_format = params[:mobile_format]\n @number_format = params[:number_format]\n end",
"def build_payment_mechanism(xml, credit_card)\n xml.PaymentMech{\n xml.CreditCard{\n type = credit_card.type\n xml.Type(CARDS[type.to_sym] || 1, :DataType=>\"S32\")\n xml.Number(credit_card.number)\n #TODO: only takes 2 digit year and month\n #xml.Expires(\"#{credit_card.year}/#{credit_card.month}\", :DataType=>\"ExpirationDate\", :Locale=>\"826\") \n xml.Expires(\"10/10\", :DataType=>\"ExpirationDate\", :Locale=>\"826\") \n \n if not credit_card.start_year.nil? or not credit_card.start_month.nil?\n xml.StartDate(\"#{credit_card.start_year}/#{credit_card.start_month}\", :DataType=>\"StartDate\", :Local=>\"826\") \n end\n if not credit_card.issue_number.nil?\n xml.IssueNum(credit_card.issue_number)\n end\n if not credit_card.verification_value.nil?\n xml.Cvv2Indicator(\"1\")\n xml.Cvv2Indicator(credit_card.verification_value)\n end\n }\n }\n end",
"def initialize(process); end",
"def initialize\n @cards = []\n end",
"def assign_default_credit_card\n true\n end",
"def create_stripe_payment_method(card_number)\n payment_method.gateway.request do\n Stripe::PaymentMethod.create({\n type: 'card',\n card: {\n number: card_number,\n exp_month: 12,\n exp_year: (Time.zone.now.year + 1),\n cvc: '123',\n },\n })\n end\n end",
"def initialize (amount, code = \"USD\")\n #need default for object to accept 1 argument\n @code = code #currency code\n @amount = amount #amount\n @@count +=1\n #add 1 to count everytime a new object is made for the class\n end",
"def initialize \r\n @cards = []\r\n\r\n\r\n\r\n # Idiomatic ruby loop\r\n SUITS.each do |suit|\r\n RANKS.each do |rank|\r\n @cards.push(Card.new(rank,suit))\r\n end\r\n end\r\n end",
"def credit_card(*types); end",
"def initialize\n puts \"Enter your secret numerical code\"\n @code = self.get_input\n end",
"def initialize\r\n\r\n end",
"def initialize(value, shape)\n # Every card must have a shape and value\n @shape=shape\n @value=value\n end",
"def initialize company_id, *args\n @company_id = company_id\n @company_card = Card.fetch company_id\n super *args\n end",
"def add_creditcard(request, creditcard)\r\n\r\n cardNo = creditcard.number\r\n cardNo.strip!\r\n if ((cardNo.length == 44) || (cardNo =~ /[A-Z]/i) || (cardNo =~ /\\+/) || (cardNo =~ /\\=/))\r\n request.Set(RocketGate::GatewayRequest::CARD_HASH, creditcard.number)\r\n else\r\n request.Set(RocketGate::GatewayRequest::CARDNO, creditcard.number)\r\n request.Set(RocketGate::GatewayRequest::CVV2, creditcard.verification_value)\r\n request.Set(RocketGate::GatewayRequest::EXPIRE_MONTH, creditcard.month)\r\n request.Set(RocketGate::GatewayRequest::EXPIRE_YEAR, creditcard.year)\r\n request.Set(RocketGate::GatewayRequest::CUSTOMER_FIRSTNAME, creditcard.first_name)\r\n request.Set(RocketGate::GatewayRequest::CUSTOMER_LASTNAME, creditcard.last_name)\r\n end\r\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def initialize\n setup_token\n end"
] | [
"0.70009565",
"0.694839",
"0.68983704",
"0.6884361",
"0.68617547",
"0.6840973",
"0.6826779",
"0.6819645",
"0.6773246",
"0.67632383",
"0.6742972",
"0.673884",
"0.6732884",
"0.6672971",
"0.6658415",
"0.66534555",
"0.6631368",
"0.6629951",
"0.6596177",
"0.6596177",
"0.6596177",
"0.6566715",
"0.65654856",
"0.6548369",
"0.6540035",
"0.64943177",
"0.6490916",
"0.6478738",
"0.6443721",
"0.64398074",
"0.64398074",
"0.6432691",
"0.6419356",
"0.64173716",
"0.6412646",
"0.63913786",
"0.63796806",
"0.63789207",
"0.6367003",
"0.63496643",
"0.6335929",
"0.63323677",
"0.629838",
"0.6292345",
"0.6281117",
"0.627849",
"0.6259449",
"0.6254912",
"0.623535",
"0.6233037",
"0.6232661",
"0.62256616",
"0.6224278",
"0.6200311",
"0.61964685",
"0.6186103",
"0.6176004",
"0.6173276",
"0.6151587",
"0.6150695",
"0.6149337",
"0.61469156",
"0.6145468",
"0.61396253",
"0.6122313",
"0.6118759",
"0.6106443",
"0.61041766",
"0.6103069",
"0.6102372",
"0.6097869",
"0.60964674",
"0.60964674",
"0.6091999",
"0.60878795",
"0.6087733",
"0.6087733",
"0.6087733",
"0.6087733",
"0.6087733",
"0.6086163",
"0.6080723",
"0.6078943",
"0.60789096",
"0.60761195",
"0.6074491",
"0.6072137",
"0.60693884",
"0.60675377",
"0.60597175",
"0.6057473",
"0.60540456",
"0.60536295",
"0.6047145",
"0.60408854",
"0.6040578",
"0.60379004",
"0.60379004",
"0.60379004",
"0.60379004",
"0.6036199"
] | 0.0 | -1 |
Debit the label's account, and each parent up the tree. | def debit_sign_up user, transaction_event, label
return if label.nil?
# It's ok if the balance goes negative, we want the sign up either way. This is an atomic update
Label.update_all("available_balance = available_balance - package_signup_rate", {id: label.id})
label.reload
ce = CreditEvent.create(label_id: label.id,
user_id: user.id,
charge_amount: (-1) * label.package_signup_rate,
post_available_balance: label.available_balance,
note: "Business sign up",
action: "sign up",
transaction_event_id: transaction_event.id)
debit_sign_up(user, transaction_event, label.parent)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def debit\n @debit ||= begin\n @debit = if parent\n expenses.debit.sum(:transaction_amount)\n else\n children.inject(0) { |total, child| total += child.debit }\n end\n end\n end",
"def unbranch\n @child\n end",
"def down\n @level += 1\n add_newline\n end",
"def debit(amount)\n self.balance -= amount\n end",
"def debit(amount, current_period)\n if balance.zero?\n @balance += amount\n save_txn(current_period, 'debit', amount, @balance)\n else\n calculate_interest(current_period, @txns.keys.last)\n @balance += amount\n save_txn(current_period, 'debit', amount, @balance)\n @ints << @interest\n get_balance\n end\n end",
"def debit(amount, options = {})\n transaction do\n begin\n Transaction.debit(self, amount, options)\n self.balance -= amount\n rescue ActiveRecord::StatementInvalid\n self.balance += amount\n end\n end\n self.save!\n self.balance\n end",
"def rebalance\n order = self.level_order\n return build_tree(order)\n end",
"def debit(description, amount)\n\t\tadd_transaction(description, -amount)\n\tend",
"def delete_branch\n #we'll get all descendants by level descending order. That way we'll make sure deletion will come from children to parents\n children_to_be_deleted = self.class.find(:all, :conditions => \"id_path like '#{self.id_path},%'\", :order => \"level desc\")\n children_to_be_deleted.each {|d| d.destroy}\n #now delete my self :)\n self.destroy\n end",
"def removing_plan_relation(transaction, parent, child, relations); end",
"def remove_from_tree(item, node) \n return rebalance(super(item, node))\n end",
"def debit amount, appears_on_statement_as=nil, meta={}, description=nil\n self.account.debit(amount, appears_on_statement_as, meta, description, self.uri)\n end",
"def deduct\n @balance -= @journey_log.fare\n end",
"def deduct(amount)\n @balance -= amount\n end",
"def debit_account\n @debit_account ||= Account.find_by_full_name 'Expenses:Unknown'\n end",
"def reverse transaktion\n decrement!(:balance, transaktion.amount) if transaktion.deposit?\n increment!(:balance, transaktion.amount) if transaktion.withdrawal?\n end",
"def removeSubTree(bname)\n # Remove the brick from it's parent\n # Recursively remove this brick and its children \n self.traverse_postorder(bname) do |brick|\n # Remove the brick from the hash\n self.removeBrick(brick['brick'])\n\n # Now remove the parent node's link to the brick\n self.removeChildLink(brick['parent'], brick['brick'])\n end\n end",
"def add_to_bank\n @user.balance -= 10\n @croupier.balance -= 10\n @bank = 20\n end",
"def delete_aux(next_node, value)\n return nil if next_node.right_child.nil? && next_node.left_child.nil?\n\n return next_node.left_child if next_node.right_child.nil?\n\n return next_node.right_child if next_node.left_child.nil?\n\n build_tree(in_order_traversal(next_node) - [value])\n end",
"def decrement(node)\n change_by node, -1\n end",
"def debit amount=nil, appears_on_statement_as=nil, holds_uri=nil, meta={}, description=nil\n self.account.debit(amount, appears_on_statement_as, holds_uri, meta, description, self.uri)\n end",
"def debit amount=nil, appears_on_statement_as=nil, holds_uri=nil, meta={}, description=nil\n self.account.debit(amount, appears_on_statement_as, holds_uri, meta, description, self.uri)\n end",
"def fDebitCoinsFrom (email, amount)\n @users.debitCoinsFrom(email, amount)\n end",
"def test_debit\n @account=accounts(:joe)\n [email protected]\n @account.debit! 5000\n assert_equal orig_balance-5000 , @account.balance\n end",
"def debit_customer_account\n end",
"def direct_debit()\n @amount -= 50 if @type == \"personal\"\n @amount -= 100 if @type == \"business\"\n end",
"def rebalance\n @root = build_tree(self.level_order_traversal) if !self.balanced?\n end",
"def remove_node\n cspsearchpath.delete(@label)\n end",
"def delete_node(node)\n ## just copy the information of the next node and then cut it out\n node.id = node.next.id\n node.next = node.next.next\nend",
"def subtract_amount(amount)\n @balance -= amount\n end",
"def node_delete_after!(x, prev, level)\n netx = node_next(x, level) # 'next' is a reserved word in ruby\n \n # forward links\n prev[0][level] = netx\n \n # backward links\n netx[3][level] = prev\n end",
"def rebalance_for_left_delete\n\t\t\trebalance = false\n\t\t\t[if black?\n\t\t\t\tif @right.black?\n\t\t\t\t\tif @right.children_color?(:black)\n\t\t\t\t\t\t# make whole sub-tree 1 level lower and ask rebalance\n\t\t\t\t\t\trebalance = true\n\t\t\t\t\t\twith_right(@right.with_color(:red))\n\t\t\t\t\telse\n\t\t\t\t\t\t# move 1 black from the right to the left by single/double rotation\n\t\t\t\t\t\tbalanced_rotate_left\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t# flip this sub-tree into another type of 3-children node\n\t\t\t\t\tret = rotate_left\n\t\t\t\t\t# try to rebalance in sub-tree\n\t\t\t\t\tleft, rebalance = ret.left.rebalance_for_left_delete\n\t\t\t\t\traise 'should not happen' if rebalance\n\t\t\t\t\tret.with_left(left)\n\t\t\t\tend\n\t\t\telse # red\n\t\t\t\tif @right.children_color?(:black)\n\t\t\t\t\t# make right sub-tree 1 level lower\n\t\t\t\t\twith_right(@right.with_color(color)).with_color(@right.color)\n\t\t\t\telse\n\t\t\t\t\t# move 1 black from the right to the left by single/double rotation\n\t\t\t\t\tbalanced_rotate_left\n\t\t\t\tend\n\t\t\tend, rebalance]\n\t\tend",
"def up\n @level -= 1\n add_newline\n end",
"def deduct_wallet\n user = User::find(self.user_id)\n user.budget -= self.pending_money\n user.save\n\n self.pending_money = 0\n self.save\n end",
"def refund_backers!\n self.class.transaction do\n Transaction.build do |tr|\n tr.description = \"Refund Fundraiser(#{id}) #{pledges_count} Pledges - Total Pledges: $#{total_pledged} Account Balance: $#{account_balance}\"\n\n # remove all money from the fundraiser account\n tr.splits.create(amount: -account_balance, item: self)\n\n # for each pledge, add a split adding money to person accounts\n pledges.find_each do |pledge|\n # get the amount to refund (pledge split where account is this fundraiser)\n if (split = pledge.splits.find_by_account_id(account.id))\n tr.splits.create(amount: split.amount, item: pledge.person)\n end\n end\n end\n end\n end",
"def two_child_delete(node)\n return node if node.left.nil?\n \n until node.nil? do\n return node if node.left.nil?\n node = node.left\n end\n\n end",
"def delete\n @prev_node.next_node = @next_node\n @next_node.prev_node = @prev_node\n @prev_node = @next_node = nil\n @value\n end",
"def debit *args\n warn_on_positional args\n\n options = args.last.is_a?(Hash) ? args.pop : {}\n amount = args[0] || options.fetch(:amount) { nil }\n appears_on_statement_as = args[1] || options.fetch(:appears_on_statement_as) { nil }\n meta = args[2] || options.fetch(:meta) { nil }\n description = args[3] || options.fetch(:description) { nil }\n\n self.account.debit(\n :amount => amount,\n :appears_on_statement_as => appears_on_statement_as,\n :meta => meta,\n :description => description,\n :source_uri => self.uri\n )\n end",
"def cut(x, y)\n x.left.right = x.right\n x.right.left = x.left\n y.degree -= 1\n if (y.degree == 0)\n y.child = nil\n elsif (y.child == x)\n y.child = x.right\n end\n x.right = @next\n x.left = @next.left\n @next.left = x\n x.left.right = x\n x.parent = nil\n x.marked = false\n end",
"def finish_transaction!\n threadlocal_graph_info[:tx_depth] -= 1 rescue nil\n end",
"def cut(x, y)\n x.left.right = x.right\n x.right.left = x.left\n y.degree -= 1\n if (y.degree == 0)\n y.child = nil\n elsif (y.child == x)\n y.child = x.right\n end\n x.right = @next\n x.left = @next.left\n @next.left = x\n x.left.right = x\n x.parent = nil\n x.marked = false\n end",
"def level_down\r\r\n return if @level.zero?\r\r\n @level -= 1\r\r\n level_update\r\r\n end",
"def remove_from_balance\n self.user.balance -= self.price\n self.user.save\n end",
"def deduct(num)\n @balance -= num\n end",
"def close_account\n stocks_qty = self.stocks.group(:stock_symbol).sum(:stock_qty)\n total_amount = 0 # sets variable total_amount to 0\n # iterates through each stock owned by the user, pulls the current price from the stock table\n ## and muplies it by the quantity of stocks owned by user\n stocks_qty.each do |key, value| \n total_amount += (find_stock(key).current_price * value)\n end\n self.update(balance: self.balance += total_amount) # adds the total amount to the users balance\n self.trades.destroy_all # removes all associated trades for that user from the trades table\n puts \"Your account has been closed and funds have been transferred to your account, your current balance is $#{self.balance.round(2)}\" # displays users net worth\n end",
"def rebalance!\n # Short-circut if already balanced.\n return @root if balanced?\n\n @root = build_tree(inorder)\n end",
"def deposit(t)\n\n @balance += t.amount\n t.currBalance = @balance\n @ledger << t\n\n end",
"def postorder(node)\n return if !node\n postorder(node.left_child)\n postorder(node.right_child)\n print node.value, \" \"\n end",
"def -( other_object )\n\t\tother_dn = other_object.dn\n\t\treturn self.reject {|branch| branch.dn.downcase == other_dn.downcase }\n\tend",
"def decrement(labels = {}, by = 1)\n label_set = label_set_for(labels)\n synchronize do\n @values[label_set] ||= 0\n @values[label_set] -= by\n end\n end",
"def traverse_down(&block)\n block.call(self)\n if(!children.nil?)\n children.each{ |child| child.traverse_down(&block) }\n end\n end",
"def cf_down_payment\n cash_flow_builder(amt: -self.down_payment, pos_arr: [0])\n end",
"def set_nest(bank_account)\n \t\tbank_account.customer ||= self\n \tend",
"def add_accounts(accounts)\n self.children = accounts.map do |account|\n node = TreeNode.new(account)\n node.add_accounts(account.child_ledger_accounts)\n node\n end\n end",
"def remove_label!( n )\n save if remove_label( n )\n end",
"def clean_tree(branch)\n\n branch.children = branch.children.inject(Children.new(branch)) do |r, c|\n cc = if c.name == 'sequence' and c.children.size == 1\n c.children.first\n else\n c\n end\n r << clean_tree(cc)\n end\n\n branch\n end",
"def get_parent_id()\n self.account_id\n end",
"def destroy\n @bank_account.destroy\n end",
"def pay(amount)\n @bankroll -= amount\n @@bankroll -= amount\n end",
"def delete_node(current_node)\n\nend",
"def delete(root, data)\n\t\ttarget = find(root, data) unless data.nil?\n\t\tunless target.nil?\n\t\t\tbrmn = find_bottom_right_most_node(root)\n\n\t\t\tif brmn != target\n\t\t\t\ttarget.title = brmn.title\n\t\t\t\ttarget.rating = brmn.rating\n\t\t\t\t\n\t\t\t\t# remove link to brmn from former parent\n\t\t\t\tunless brmn.parent.nil?\n\t\t\t\t\tif brmn.parent.right.title == brmn.title\n\t\t\t\t\t\tbrmn.parent.right = nil\n\t\t\t\t\telse\n\t\t\t\t\t\tbrmn.parent.left = nil\n\t\t\t\t\tend\n\n\t\t\t\t\tbrmn.parent = nil\n\t\t\t\tend\n\n\t\t\t\tunless target.parent.nil?\n\t\t\t\t\tparent_compare(target, target.parent)\n\t\t\t\tend\n\n\t\t\t\tchild_compare(target)\n\t\t\telse\n\t\t\t\tself.root = nil\n\t\t\tend\n\t\tend\n\tend",
"def withdraw(amount)\n @balance -= amount\n end",
"def unfinish(paths)\n if paths.empty?\n raise Plan::Advice.new('please drill down to a level to unfinish')\n end\n # go to the right depth and unfinish\n item = path_tree.descend(paths)\n item.unfinish!\n save_path_tree\n # print what happened here\n print_depth item\n end",
"def withdraw(amount)\n @balance -= amount\n end",
"def debits(shareholder)\n shareholder_effects(shareholder, :debit)\n end",
"def remove_at(index)\n removed_node = at_no_data(index)\n prev_node = at_no_data(index - 1)\n next_node = at_no_data(index + 1)\n prev_node.next_node = next_node\n puts \"#{removed_node.data} has left the group\"\n removed_node\n end",
"def bubble_up(index, node)\n while (index!=0 && @ary[(index-1)/2].key > node.key) #while parent is bigger,\n @ary[index], @ary[(index-1)/2] = @ary[(index-1)/2], @ary[index] #swap\n index = (index-1)/2\n end\n end",
"def capture amount=nil, appears_on_statement_as=nil, meta={}, description=nil\n amount ||= self.amount\n self.account.debit(amount, appears_on_statement_as, self.uri, meta, description)\n end",
"def sibling_accounts\n Sfaccount.find(:all, :conditions => [\"parent_id = ?\",id])\n end",
"def move_down\n # Ensure each parent node to this node (the goal here is to hit a question node) is valid\n !survey.node_maps.select do |i|\n i.node == self\n end.collect do |node_map|\n # Must have children to move lower!\n # And the children are also answers!\n next unless !node_map.children.empty? && !node_map.children.select { |j| j.node.class.ancestors.include?(::ActiveRecordSurvey::Node::Answer) }.empty?\n\n # I know this looks overly complicated, but we need to always work with the survey.node_maps - never children/parent of the relation\n parent_node = survey.node_maps.select do |j|\n node_map.parent == j\n end.first\n\n children = survey.node_maps.select do |j|\n node_map.children.include?(j)\n end\n\n children_children = survey.node_maps.select do |j|\n children.collect(&:children).flatten.include?(j)\n end\n\n children.each do |c|\n parent_node.children << c\n end\n\n children.each do |c|\n c.children << node_map\n end\n\n children_children.each do |i|\n node_map.children << i\n end\n end\n end",
"def payment(amount)\n @balance -= amount\n end",
"def detach_from_parent\n return nil if parent.nil? # root\n oci = own_child_index\n parent.children.delete_at(oci) if oci\n self.parent = nil\n oci\n end",
"def unlink_group\n if self.parentID != nil\n Group.find(self.parentID).remove_members([self.id.to_s])\n end\n end",
"def down_child\n # Returns down_child unless it's nil\n return @down_child unless @down_child.nil?\n\n # If passed the guard, down_child was not calculated yet, so generates it,\n # stores a ref and return the node\n @down_child = calculate_down_child\n @down_child\n end",
"def balance\n entries = @@ledgers.find(\"owner\" => @sender).first['entries']\n\n sum = 0\n entries.each do |entry|\n value = entry['value'].gsub(\"$\",\"\")\n\n if entry['value'][0] == '('\n value = value[1..-2]\n sum = sum - value.to_i\n else\n sum = sum + value.to_i\n end\n end\n\n @t.say(\"The balance is $#{sum}\")\nend",
"def debit!(amount)\n self.balance -= parse_monetary_value(amount)\n self.store\n end",
"def orphan\n parent.disown self if parent\n @parent = nil\n end",
"def delete(root, data)\n\t\ttarget = find(root, data) unless data.nil?\n\n\t\tunless target.nil?\n\t\t\tbrmn = find_bottom_right_most_node(root)\n\n\t\t\tif brmn != target\n\t\t\t\ttarget.value = brmn.value\n\t\t\t\t\n\t\t\t\t# remove link to brmn from former parent\n\t\t\t\tunless brmn.parent.nil?\n\t\t\t\t\tif brmn.parent.right.value == brmn.value\n\t\t\t\t\t\tbrmn.parent.right = nil\n\t\t\t\t\telse\n\t\t\t\t\t\tbrmn.parent.left = nil\n\t\t\t\t\tend\n\n\t\t\t\t\tbrmn.parent = nil\n\t\t\t\tend\n\n\t\t\t\tunless target.parent.nil?\n\t\t\t\t\tparent_compare(target, target.parent)\n\t\t\t\tend\n\n\t\t\t\tchild_compare(target)\n\t\t\telse\n\t\t\t\tself.root = nil\n\t\t\tend\n\t\tend\n\tend",
"def debit!(amount:, kind: :main, reference: nil,\n member_id: nil, currency: nil)\n return if amount.zero?\n\n currency ||= reference.currency\n account_code = Operations::Chart.code_for(\n type: operation_type,\n kind: kind,\n currency_type: currency.type\n )\n create!(\n debit: amount,\n reference: reference,\n currency_id: currency.id,\n code: account_code,\n member_id: member_id || reference.member_id\n ).tap(&:save!)\n end",
"def debit!(reference:, amount:, kind:, member_id: nil, currency: nil)\n return if amount.zero?\n\n currency ||= reference.currency\n account_code = Operations::Chart.code_for(\n type: operation_type,\n kind: kind,\n currency_type: currency.type.to_sym\n )\n create!(\n debit: amount,\n reference: reference,\n currency_id: currency.id,\n code: account_code,\n member_id: member_id || reference.member_id\n )\n end",
"def balance\n node = self\n i = (node.count(:right) - node.count(:left))/2\n while (i!=0)\n if (i>0)\n mvnode = node.right\n node.right = nil\n mvnode.add_horizontal node\n i -= 1\n else\n mvnode = node.left\n node.left = nil\n mvnode.add_horizontal node\n i += 1\n end\n node = mvnode\n end\n if (node.left != nil)\n node.left = node.left.balance\n end\n if (node.right != nil)\n node.right = node.right.balance\n end\n if (node.down != nil)\n node.down = node.down.balance\n end\n node\n end",
"def delete!\n PoolNode.rmdir(@id)\n super\n Address.delete(@id)\n Subnet.delete(@subnet)\n end",
"def deleteNode node\n node.val = node.next.val\n node.next = node.next.next\nend",
"def remove_label( n )\n raise InvalidNodeError.new('given node is not a node') unless n.class.respond_to?(:acts_as_node)\n return false unless can_share?\n label_arr = get_label_arr\n label_arr.delete(n_field(n))\n self.label_node_ids = label_arr.join(',')\n remove_acls( n )\n true\n end",
"def node_leave_parent(node, parent)\n node.parents.delete(parent)\n end",
"def postOrder(root)\n return nil if root == nil\n\n postOrder(root.left)\n postOrder(root.right)\n print \" #{root.value}\"\nend",
"def unwrap(node)\n node.children.each do |child|\n node.parent << child\n end\n node.remove\n end",
"def withdraw(amount)\n @balance = @balance - amount\n end",
"def credit\n @credit ||= begin\n @credit = if parent\n expenses.credit.sum(:transaction_amount)\n else\n children.inject(0) { |total, child| total += child.credit }\n end\n end\n end",
"def DFT_post_order_recursive(root)\n if root == nil\n return\n end\n \n DFT_post_order_recursive(root.left)\n DFT_post_order_recursive(root.right)\n print \"#{root.value}\\n\"\n \n end",
"def remove_or_decrement_ref(*nodes); end",
"def withdraw (amount, account)\n if account == \"checking\"\n @checking_account_balance -= amount\n elsif account == \"saving\"\n @saving_account_balance -= amount\n else\n puts \"No account was selected\"\n end\n end",
"def delete_node_group_descendents(node_group_model)\n id = node_group_model['id']\n tree = get_node_group_trees_of_direct_descendents\n tree[id].each do |childid|\n delete_tree_recursion(tree, childid)\n end\n end",
"def del_access_node(node)\n puts \"Deleting Node with value: #{node.value} from the list\"\n if node.next != nil\n node.value = node.next.value\n node.next = node.next.next\n else\n node.value = nil\n end\n print\n end",
"def untransform(target_account)\n entries.each do |entry|\n entry.fields['ownerId'] = target_account\n entry.untransform user, target_account\n end\n\n @state = :untransformed\n @account_id = target_account\n true\n end",
"def remove\n each { |x| x.parent.children.delete(x) }\n end",
"def debitCoins(amount)\r\n @betESSCoins -= amount\r\n end",
"def disown container\n children.delete container\n end",
"def bubble_down()\n\t\t# remove max and swap with last node\n\t\t@elements[0] = @elements.pop\n\t\ti = 0\n\t\twhile(i < @elements.length)\n\t\t\tmax_idx = i\n\t\t\t# find greater of left and right child\n\t\t\tif((2*i + 1) < @elements.length && @elements[2*i + 1][@orderBy] >= @elements[max_idx][@orderBy])\n\t\t\t\tmax_idx = 2*i + 1\n\t\t\tend\n\t\t\tif((2*i + 2) < @elements.length && @elements[2*i + 2][@orderBy] >= @elements[max_idx][@orderBy])\n\t\t\t\tmax_idx = 2*i + 2\n\t\t\tend\n\t\t\t# if left or right child is greater, swap and update i\n\t\t\tif(max_idx != i)\n\t\t\t\tswap(i, max_idx)\n\t\t\t\ti = max_idx\n\t\t\t# if not, we are done\n\t\t\telse\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend",
"def drop_one!(label)\n i = self.labels.index(label)\n return nil unless i\n self.items.each do |item|\n item.delete_at(i)\n end\n self.labels.delete_at(i)\n self\n end"
] | [
"0.6143413",
"0.5633018",
"0.55283314",
"0.54975086",
"0.52922297",
"0.5230875",
"0.5215906",
"0.5189633",
"0.51758176",
"0.5163152",
"0.5151609",
"0.51502055",
"0.5149883",
"0.51460785",
"0.5141521",
"0.51234025",
"0.51225007",
"0.5096106",
"0.509563",
"0.5074093",
"0.5025018",
"0.5025018",
"0.50246525",
"0.501782",
"0.5005713",
"0.49644077",
"0.4920233",
"0.4908057",
"0.48856917",
"0.4873589",
"0.48670617",
"0.4861846",
"0.48613286",
"0.48611993",
"0.48591685",
"0.48536575",
"0.48476443",
"0.4834747",
"0.48273855",
"0.4826113",
"0.48243788",
"0.48234248",
"0.48193702",
"0.48179758",
"0.48147714",
"0.4806556",
"0.47977623",
"0.47929218",
"0.478998",
"0.47754332",
"0.47754267",
"0.4768236",
"0.4768193",
"0.47674698",
"0.4767022",
"0.4764204",
"0.4750638",
"0.47504842",
"0.4740786",
"0.47294652",
"0.47153804",
"0.47094214",
"0.4699012",
"0.46867797",
"0.4682673",
"0.46756202",
"0.46678337",
"0.46676856",
"0.4666054",
"0.46611553",
"0.4658559",
"0.46569207",
"0.4655896",
"0.46548992",
"0.46534908",
"0.46509242",
"0.46474516",
"0.4639078",
"0.46341428",
"0.4630744",
"0.46300355",
"0.46283656",
"0.462822",
"0.46274614",
"0.46219143",
"0.46188402",
"0.46111026",
"0.4609306",
"0.46071637",
"0.460668",
"0.46058008",
"0.46057484",
"0.46034804",
"0.4602285",
"0.45975515",
"0.45953977",
"0.45897365",
"0.45873988",
"0.4587157",
"0.4587128"
] | 0.62035877 | 0 |
Each month, debit the label for each active subscription. Care has been taken so that this job, which usually runs from a cron > rake task, can safely be rerun in case an error occurs. | def debit_monthly_subscriptions
ccp = CreditCardProcessor.new(@label)
# subscriptions dont start for atleast a month after being created.
# filter out any recently billed subscriptions. This allows a job to rerun safely if an error occurs.
@label.subscriptions.where('created_at < ? and label_last_billed_at <= ?', 1.month.ago, 1.month.ago).where(status: :success).each do |subscription|
if ccp.valid_recurring( subscription )
debit_monthly_subscription @label, subscription
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def month_label\n \"#{label}\"\n end",
"def perform\n @previousMonth = (Date.today - 1.months).strftime(\"%Y-%m\")\n\n \t# Only exec with subscription status is active\n # Subscription subscription_type == 1 is free trial\n # If user upgrade subscription, and then subscription_type update to 2 is invidual account\n # Update subscription_type == 2 on production, because in test we manual modify account\n\t\tSubscription.where(status: 1).each do |subscription|\n\n\t\t\t# Find user\n\t\t\t@user = User.find(subscription.user_id)\n\n # Get bandwidth & storage usage on previous month\n if @user.bandwidths.present? && @user.bandwidths.find_by(monthly: @previousMonth).present?\n bwdUsage = @user.bandwidths.find_by(monthly: @previousMonth).bandwidth_usage * 1000.00\n else\n bwdUsage = 0\n end\n\n if @user.storages.present? && @user.storages.find_by(monthly: @previousMonth).present?\n stgUsage = @user.storages.find_by(monthly: @previousMonth).storage_usage * 1000.00\n else\n stgUsage = 0\n end\n\n # Calculator usage pricing\n @totalPrice = (@user.subscription.stg_price * (stgUsage / 1000000000.00)) + (@user.subscription.bwd_price * (bwdUsage / 1000000000.00))\n\n @description = \"Delivery Appliance running in global: #{ApplicationController::FormatNumber.new(bwdUsage).formatHumanSize()}, and File Appliance in global: #{ApplicationController::FormatNumber.new(stgUsage).formatHumanSize()} (Source:#{Package.find(@user.subscription.package).name} [#{@user.subscription.name}])\"\n\t\t\t\n if @totalPrice != 0\n # Effect only with subscription type automatic payment by credit card\n if @user.subscription.payment_type == 2 && @user.credit.card_token.present?\n charge = Stripe::Charge.create(\n :amount => @totalPrice.to_i,\n :currency => \"vnd\",\n :customer => @user.credit.stripe_token,\n :source => @user.credit.card_token,\n :description => @description\n )\n\n # Defind charge succeeded response from Stripe\n if charge[\"status\"] == \"succeeded\"\n\n # Create transaction succeeded\n @user.credit.transactions.create(\n description: @description,\n transaction_type: 'Automatic Payment',\n stripe_id: charge[\"id\"],\n amount: @totalPrice.to_i,\n card_id: @user.credit.card_token,\n card_name: @user.credit.card_name,\n card_number: @user.credit.last4,\n card_brand: @user.credit.card_brand,\n status: 'succeeded',\n monthly: @previousMonth\n )\n end\n end\n\n # Effect only with subscription type automatic payment by deposit\n if @user.subscription.payment_type == 2 && @user.credit.card_token.nil?\n\n # Check credit\n if @user.credit.credit_value != 0 && @user.credit.credit_value > @totalPrice\n\n # Update credit balance\n @user.credit.decrement! :credit_value, @totalPrice\n\n # Create transaction of this month\n @user.credit.transactions.create(\n description: @description,\n transaction_type: 'Automatic Payment',\n amount: @totalPrice,\n status: 'succeeded',\n monthly: @previousMonth\n )\n else\n # Create transaction of this month\n @user.credit.transactions.create(\n description: @description,\n transaction_error: 'Deposit balance not enough for this payment. Please check your credit again',\n transaction_type: 'Automatic Payment',\n amount: @totalPrice,\n status: 'failed',\n monthly: @previousMonth\n )\n\n # Suspend subscription if payment failed\n @user.subscription.update(status: 2)\n end\n end\n\n # Effect only with subscription type manual payment\n if @user.subscription.payment_type == 3\n # Create invoice in previous month, default status is unpaid\n @user.credit.invoices.create(\n description: @description,\n invoice_type: 'Check Out',\n amount: @totalPrice,\n status: 'unpaid',\n monthly: @previousMonth\n )\n end\n end\n\t\tend\n\n # Rescue error and create transaction failed with message\n rescue Stripe::CardError => e\n\n # Create transaction failed\n @user.credit.transactions.create(\n description: @description,\n transaction_error: e.message,\n transaction_type: 'Automatic Payment',\n amount: @totalPrice.to_i,\n card_id: @user.credit.card_token,\n card_name: @user.credit.card_name,\n card_number: @user.credit.last4,\n card_brand: @user.credit.card_brand,\n status: 'failed',\n monthly: @previousMonth\n )\n\n # Suspend subscription if payment failed\n @user.subscription.update(status: 2)\n end",
"def month_labels\n dates.collect { |date| date.to_date.day == 1 ? date.to_date.strftime('%B') : '' }\n end",
"def translated_month_names; end",
"def company_payment_reminders\n check_company_usage_cycle\n company_monthly_payment_reminders\n end",
"def monthly\n NewsletterMailer.monthly\n end",
"def monthly\n end",
"def monthly(options = {})\n branch options.merge(every: :month)\n end",
"def monthly(options = {})\n branch options.merge(every: :month)\n end",
"def date_labels\n if @count < 90\n dates.collect { |date| date.to_date.strftime('%d') == Time.now.strftime('%a') ? date.to_date.strftime('%b %e') : '' }\n else\n dates.collect { |date| date.to_date.strftime('%d') == '01' ? date.to_date.strftime('%b %e') : '' }\n end\n end",
"def subscriber_notice_subscription_renewal\n BrandMailer.subscriber_notice(\n brand: Brand.find_by(company_name: 'Brand Nine'),\n stage: 'subscription_renewal'\n )\n end",
"def subscriber_notice_subscription_paid\n BrandMailer.subscriber_notice(\n brand: Brand.find_by(company_name: 'Brand Nine'),\n stage: 'subscription_paid'\n )\n end",
"def month_names; end",
"def subscription_term; end",
"def apply_label(scans_array)\n # only process labeled scans that are not released\n scans= scans_array.find_all{|s| s['scan_id'].to_i != 0 && s['publish_ready_timestamp'].nil?}\n # only pass the scan_id to createall\n scans.map!{|s| s['scan_id']}\n unless scans.nil?\n SwareBase.transaction do\n OocScan.create_all!(scans,current_user.userid)\n end\n end\n end",
"def setup_free_trial\n self.free_trial_end_at = (Time.now + 1.month).utc\n end",
"def multi_day_labels(num_days)\n labels = []\n num_days.times do |i|\n labels << (Date.today-i).to_time.strftime(\"%A\")\n end \n labels.reverse!\n labels << (Date.today+1).to_time.strftime(\"%A\")\n return labels\n end",
"def each_august( n=1); each_monthnum(self.Aug,n); end",
"def monthly\n @greeting = \"Hello\"\n mail subject: args[:subject], to: args[:emails]\n mail to: \"[email protected]\"\n end",
"def set_auto_renew_off_for_inactive_plans inactive_billables\n change_plan_status(inactive_billables, renew: true)\n end",
"def period_in_words\n case recurring_month\n when 12\n 'yearly'\n when 1\n 'monthly'\n when 0\n \"once\"\n else\n \"every #{recurring_month} months\"\n end\n end",
"def monthly_language_activity\n memoized_language_breakdowns = all_languages_monthly_activity\n\n MONTHS.map do |month|\n res = [Date::MONTHNAMES[month]]\n memoized_language_breakdowns.each do |lang, breakdown|\n value = breakdown.detect { |b| b.fetch(\"month\") == month }\n prs = value ? value.fetch(\"prs\") : 0\n res << prs\n end\n res\n end\n end",
"def set_active_subscriptions_paid!\r\n self.subscriptions.all { |sub| sub.pay! }\r\n end",
"def training_sessions_remaining_this_month\n end",
"def monthly_language_activity\n @data.fetch(\"activity\")\n end",
"def subscription_start_date\n # if (_subscribed_at = subscription_started_at)\n # # * if the subscription already started, no point calulating again\n # _subscribed_at\n # else\n # * if no subscription started yet, consider this month\n _date = Date.today\n if _date.day == 1\n _date.to_date # if today is 1st, why wait? start the subscription from today\n else\n (_date + 1.month).beginning_of_month.to_date # .to_date # today is not 1st, let this month be pro-rated\n end\n end",
"def welcome_call_rescheduled\n UserMailer.welcome_call_rescheduled(WelcomeCall.where(available: false).take)\n end",
"def subscription_mailer\n users_id = Subscription.where('category_id in (?)', self.categories.ids).distinct.pluck(:user_id)\n users_id.delete(self.user.id)\n if users_id.any?\n number_elements = ((users_id.size/25.to_f).round == 0 ? 1 : (users_id.size/25.to_f).round)\n users_id.each_slice(number_elements) {|array| UserMailer.delay.subscription(array, self.id) }\n end\n end",
"def not_completed_all_by_month\n #calls the not_completed function to hopefully set a not_completed_with_date list containing a sorted list of tasks that HAVE dates\n not_completed\n return_list = []\n #check if each item in the list is in the current month\n @not_completed_with_date.each do |a|\n b = Date.strptime(\"#{a.date}\")\n if b.mon == Date.today.mon\n return_list << a\n end\n end\n return_list\n end",
"def monthly_ledgers\n @monthly_ledgers ||= period.monthly_ledgers\n end",
"def reset_all\n @subscription = Subscription.find(params[:id])\n if request.post? && params[\"yes\"]\n @subscription.periods.each { |copy| copy.reset! }\n flash[:notice] = \"Tæller for abonnement blev nulstillet.\"\n @subscription.save\n end\n redirect_to subscription_path(@subscription)\n \n rescue ActiveRecord::RecordNotFound\n flash[:error] = 'Dette abonnement kunne ikke findes.'\n redirect_to subscription_path(@subscription)\n end",
"def reset_all\n @subscription = Subscription.find(params[:id])\n if request.post? && params[\"yes\"]\n @subscription.periods.each { |copy| copy.reset! }\n flash[:notice] = \"Tæller for abonnement blev nulstillet.\"\n @subscription.save\n end\n redirect_to subscription_path(@subscription)\n \n rescue ActiveRecord::RecordNotFound\n flash[:error] = 'Dette abonnement kunne ikke findes.'\n redirect_to subscription_path(@subscription)\n end",
"def billing_monthly?\n numbering_period == 'monthly'\n end",
"def monthly_mass_mailing\n setup_monthly_mailing_render_default\n end",
"def monthly\n keys = redis.keys(\"#{prefix_monthly}:*\")\n keys.zip(redis.mget(keys)).inject({}) { |t,p| t.merge(p.first.sub(\"#{prefix_monthly}:\", '') => p.last.to_i) }\n end",
"def monthly_ledgers\n list_months.map {|my| Compta::MonthlyLedger.new(self, my)}\n end",
"def update_recurrent_subscriptions\n notification_type_subscriptions.recurrent.each do |recurrent_subscription| \n recurrent_subscription.recurrence.update_attributes(:starts_at => ActiveSupport::TimeZone[timezone].parse(\"#{Date.today.to_s} #{recurrent_subscription.notification_type.constantize.time}\"))\n end\n end",
"def unsubscribe_from_label(project, name)\n post(\"/projects/#{url_encode project}/labels/#{url_encode name}/unsubscribe\")\n end",
"def list_all_not_completed_this_month\n @due_this_month = not_complete_by_date.select {|x| x.due_date.month == Date.today.month}\n @anniversary_this_month = @anniversary_list.select {|x| x.month == Date.today.month}\n @anniversary_this_month = @anniversary_this_month.sort_by {|x| x.day}\n return @due_this_month + @anniversary_this_month + show_not_completed_items\n end",
"def month_to_name\n month = Date.new(Time.now.year, purchased_at_month.to_i)\n month.strftime(\"%B\")\n end",
"def schedule_loan_tasks(order)\n comment = \"system note - Made payment on #{order.created_at}\"\n msg = \"Call #{customer.full_name} about there payment.\"\n new_date = self.due_date.next_month\n tasks.each do |t|\n t.mark_completed_and_msg(order.user_id, comment)\n end\n self.update_attribute(:due_date, new_date)\n Task.create!(:user_id => user_id, :assigned_to => user_id, :name => msg, :asset_id => self.id, :asset_type => self.class, :company_id => company_id, :category => \"call\", :due_at => new_date - 2.days)\n end",
"def labels\n return \"Title: #{@title}; Description: #{@desc}; #{@complete}, Due Date: #{@dueDate}\"\n end",
"def exportMonthlyFiles()\r\n months = @messages.getMonths()\r\n months.each { |month|\r\n exportMonthlyFile(month)\r\n }\r\n end",
"def update_monthly_happiness_distributions! \n HappinessEntry.beginning_of_month_days.each do |beginning_of_month_day|\n uid = uid_for_month(beginning_of_month_day)\n end_of_month_day = beginning_of_month_day.end_of_month\n entries_for_month = HappinessEntry.in_month(beginning_of_month_day, end_of_month_day)\n update_happiness_distribution! uid, :month, entries_for_month \n end\n end",
"def each_july( n=1); each_monthnum(self.Jul,n); end",
"def each_january( n=1); each_monthnum(self.Jan,n); end",
"def month() end",
"def subscribe_to_label(project, name)\n post(\"/projects/#{url_encode project}/labels/#{url_encode name}/subscribe\")\n end",
"def reset_checks\n @free_checks_available = FREE_CHECKS_PER_MONTH\n end",
"def monthly_timesheet\n \n end",
"def set_subscription_name\r\n \r\n self.subscription_name = self.membership.name\r\n \r\n if !member.subscriptions.nil?\r\n subscription_membership_name_array = []\r\n name_counter = 1\r\n \r\n #Create an array of membership names of all subscriptions\r\n self.member.subscriptions.each do |subscription|\r\n subscription_membership_name_array.push(subscription.membership.name)\r\n end\r\n \r\n #Compare the current subscription name against the array of membership names\r\n subscription_membership_name_array.each do |subscription_membership_name| \r\n if self.subscription_name == subscription_membership_name\r\n name_counter += 1\r\n end\r\n end\r\n \r\n if name_counter > 1\r\n self.subscription_name = self.membership.name + \" - \" + name_counter.to_s\r\n end\r\n end\r\n end",
"def test_monthly_duration_products_are_present_in_summary\n activity = account_activities(:one)\n price = billing_prices(:create_one_month)\n activity.update(activity_type: 'create', price: price)\n\n response = <<-XML\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <results>\n <Result Type=\"0\" Desc=\"OK\" docid=\"309902\" doctype=\"ARVE\" submit=\"Invoices\"/>\n </results>\n XML\n\n stub_request(:post, ENV['directo_invoice_url']).with do |request|\n body = CGI.unescape(request.body)\n body.include? 'month(s)'\n end.to_return(status: 200, body: response)\n\n assert_difference 'Setting.directo_monthly_number_last' do\n DirectoInvoiceForwardLegacyJob.perform_now(monthly: true, dry: false)\n end\n end",
"def dmail_inactive_approvers!\n days_until_next_month = (Date.current.next_month.beginning_of_month - Date.current).to_i\n return unless days_until_next_month <= 21\n\n inactive_approvers.each do |user|\n Dmail.create_automated(to: user, title: \"You will lose approval privileges soon\", body: <<~BODY)\n You've approved fewer than #{MINIMUM_APPROVALS} posts in the past\n #{APPROVAL_PERIOD.inspect}. You will lose your approval privileges in\n #{days_until_next_month} #{\"day\".pluralize(days_until_next_month)}\n unless you have approved at least #{MINIMUM_APPROVALS} posts by the end\n of the month.\n BODY\n end\n end",
"def perform (from=nil)\n if from.nil?\n subscribers = Octo::Subscriber.where(created_at: 24.hours.ago..Time.now.floor)\n else\n subscribers = Octo::Subscriber.where(created_at: from..Time.now.floor)\n end\n # MAIL CODE\n Octo.get_config(:email_to).each { |x|\n opts1 = {\n text: \"Today number of new susbcribes are \" + subscribers.length,\n name: x.fetch('name')\n }\n Octo::Email.send(x.fetch('email'), subject, opts1)\n }\n end",
"def sendgrid_subscriptiontrack_text texts\n @sg_subscriptiontrack_text = texts\n end",
"def expiration_month\n @months = [\"01\",\"02\",\"03\",\"04\",\"05\",\"06\",\"07\",\"08\",\"09\",\"10\",\"11\",\"12\"]\n end",
"def generate_invoices\n companies = Company.all\n\n companies.each do |company|\n\n last = company.last_bill\n last ||= company.created_at.prev_month.to_date\n\n actual = last.next_month.end_of_month\n\n while actual < Date.today\n\n counter = 0\n company.users.each do |user|\n\n if user.role != ROOT\n last_period = user.periods.where(\"created_at <= :end_of_last_month\",{:end_of_last_month => actual}).order(\"created_at DESC\").first\n \n if !last_period.nil?\n unless last_period.state <= STATE[:inactive] && last_period.created_at <= actual.prev_month\n counter+=1\n end\n end\n end\n\n end\n\n if counter > 0\n bill = company.bills.build\n bill.value = counter\n bill.state = -1\n bill.month = actual\n bill.save\n end\n\n company.last_bill = actual\n company.save\n\n actual = actual.next_month.end_of_month\n end\n end\n \n redirect_to backoffice_bills_path\n end",
"def current_cron_jobs\n client.get_cron_jobs(label_selector)\n end",
"def perform\n tick(I18n.t('jobs.expire_analysis_tasks.progress_expiring'))\n Datasets::AnalysisTask.destroy_all ['created_at < ?', 2.weeks.ago]\n\n completed\n end",
"def monthly\n @greeting = \"Here are your monthly deals!\"\n\n mail to: \"[email protected]\"\n end",
"def customer_label(label_name, options = {})\n if plural_match = label_name.to_s.match(/(\\w+)s\\Z/)\n pluralize = true\n label_name = plural_match[1]\n end\n method_name = \"#{label_name.to_s}_label\"\n return_label = self.try(method_name) if self.respond_to?(method_name)\n return_label = DEFAULT_LABEL[label_name.to_sym] if return_label.blank?\n format_customer_label(return_label, :titleize => options[:titleize], :pluralize => pluralize)\n end",
"def label_target\n \"delivery_time\"\n end",
"def update_billing_cycle\n if recurring_payment = self.purchase_order.payments.recurring.first\n recurring_payment = recurring_payment.decrement(:duration_occurrences)\n # udpate the billing period of the order only \n if recurring_payment.duration_occurrences > 0\n nbp = self.next_service_billing_period\n if nbp && (!self.purchase_order.billing_due_on || nbp.include?(self.purchase_order.billing_due_on))\n self.purchase_order.billing_due_on = nbp.last + 1.day\n self.purchase_order.save(false)\n end\n else\n self.purchase_order.cancel!\n end\n end\n end",
"def yearly\n NewsletterMailer.yearly\n end",
"def mmm_test_subj_call\n ->(candidate) { I18n.t('email.test_monthly_mail_subject_initial_input', candidate_account_name: candidate.account_name) }\n end",
"def perform\n @start_date = Time.zone.today.prev_month.at_beginning_of_month\n @end_date = Time.zone.today.prev_month.at_end_of_month.end_of_day\n\n appeals_this_month = count_appeals_this_month\n async_stats = ClaimReviewAsyncStatsReporter.new(start_date: start_date, end_date: end_date)\n certification_metric = Metrics::CertificationUsage.new(Metrics::DateRange.new(start_date, end_date))\n\n send_report(appeals: appeals_this_month, async_stats: async_stats, certification_metric: certification_metric)\n end",
"def daily_morning\n logger.info \" daily_morning\"\n run('Newsletter', :send!)\n end",
"def each_february( n=1); each_monthnum(self.Feb,n); end",
"def months\n Thread.current[:datet_mode] = :months\n return self\n end",
"def pay_active_subscriptions!\n\t\t# puts \"PAY_ACITVE_SUBSCRIPTIONS 1, center: #{@center.inspect} subs: #{@center.subscriptions.size} #{@center.subscriptions.inspect}\"\n result = @center.subscriptions.map { |sub|\n\t\t\t# puts \"SUB_SERVICE: pay #{sub.inspect}\"\n\t \t\tsub.pay! }\n\t\t# puts \"PAY_ACTIVE_SUBSCRIPTIONS result: #{result.inspect}\"\n end",
"def subscription_status()\n status = { \"active\" => \"label-success\",\n \"in_trial\" => \"label-default\",\n \"non_renewing\" => \"label-warning\",\n \"cancelled\" => \"label-danger\",\n \"future\" => \"label-primary\"\n }\n return status\n end",
"def calculate_this_month\n site_id = params[:id]\n date_end = DateTime.now\n nrday = date_end.day.to_i\n nrday -= 1\n date_start = DateTime.now-nrday.days\n Delayed::Job.enqueue CalculateSite.new(site_id,date_start,date_end)\n #calculate_month(site_id,date_start,date_end)\n render :nothing => true\n end",
"def argument_daily_digest\n subscriptions = Subscription.find(:all , :conditions => ['status = 1 && daily_digest = 1 && argument_id is not null'])\n subscriptions.each do |sub|\n Mailers::Debate.deliver_send_subscription_email(\"\",sub.argument,sub,HOST_DOMAIN)\n end\n end",
"def set_expired_plans_to_inactive_if_autorenew_is_off billables\n change_plan_status(billables, renew: false)\n end",
"def each_april( n=1); each_monthnum(self.Apr,n); end",
"def monthly_active(options = {})\n request_model = @request_model_factory.monthly_active_request_model(options)\n response = @network_client.perform_request(request_model)\n parse_point_response(response)\n end",
"def months_list\n\t (Date.today-1.year..Date.today).map{|d| [d.strftime(\"%b-%Y\"), d.strftime(\"%m-%Y\")]}.uniq.reverse\n\tend",
"def display_monthly(months:, nondiscuss:)\n months.sort.reverse.each do |month|\n data = get_mails_month(yearmonth: month, nondiscuss: nondiscuss)\n next if data.empty?\n _h1 \"board@ statistics for #{month} (total mails: #{data[MAILS].length + data[TOOLS].length})\", id: \"#{month}\"\n _div.row do\n _div.col_sm_6 do\n _ul.list_group do\n _li.list_group_item.active.list_group_item_info \"Top Ten Email Senders (from non-tool mails: #{data[MAILS].length})\"\n ctr = 0\n data[MAILCOUNT].each do |id, num|\n if num > (data[MAILS].length / 10)\n _li.list_group_item.list_group_item_warning \"#{id} wrote: #{num}\"\n else\n _li.list_group_item \"#{id} wrote: #{num}\"\n end\n ctr += 1\n break if ctr >= 10\n end\n end \n end\n _div.col_sm_6 do\n _ul.list_group do\n _li.list_group_item.list_group_item_info \"Tool Generated Emails (by type, total tool mails: #{data[TOOLS].length})\"\n data[TOOLCOUNT].each do |id, num|\n _li.list_group_item \"#{num} emails from #{id} tool\"\n end\n end\n end\n end\n end\nend",
"def calculate_invoice\n @event.category == \"bill\" ? \"Bill-#{Time.now.strftime(\"%Y\")}/1\" : \"Quotation-#{Time.now.strftime(\"%Y\")}/1\"\n end",
"def list_not_completed_this_month_date_only\n @due_this_month = not_complete_by_date.select {|x| x.due_date.month == Date.today.month}\n @anniversary_this_month = @anniversary_list.select {|x| x.month == Date.today.month}\n @anniversary_this_month = @anniversary_this_month.sort_by {|x| x.day}\n return @due_this_month + @anniversary_this_month\n end",
"def current_month_kwh_usage_by_day\n current_date = Time.now.utc.to_date\n num_days_until_yesterday = current_date.day - 1\n usage_data = []\n current_date.downto(num_days_until_yesterday.days.ago.utc.to_date).each do |date|\n usage_data << total_day_kwh_usage_on(date).round(2)\n end\n usage_data\n end",
"def checking_in_number\n self.days_completed += 1\n self.check_in_current = true\n next_day = self.current_day + 1\n if next_day > self.days_to_complete # For real time feedback\n self.active = false \n self.inactive_cleanup\n end\n self.save\n\n # Since you already checked in, delete reminder to check in again\n sms_reminder_jobs = Delayed::Job.where(:owner_type => \"Micropost\", \n :owner_id => self.id, \n :owner_job_type => \"4 Hour Reminder\"\n )\n sms_reminder_jobs.each do |job|\n job.delete\n end\n end",
"def get_labels_releases(label_id, pagination={})\n query_and_build \"labels/#{label_id}/releases\", pagination\n end",
"def label(name)\n @labels << Label.new( [now, name, nil, {}] )\n end",
"def subscribed?\n preminum? ? true : false\n# if active_trial? \n# return false\n# else\n# total_month = subscriptions.where('transaction_id > 0').sum(:month)\n# first_subscription = subscriptions.where('transaction_id > 0').order(:created_at).first\n# if total_month == 0 || first_subscription.nil? || (first_subscription.created_at.to_date <= total_month.to_i.months.ago.to_date) \n# return false\n# else\n# return true\n# end\n# end\n end",
"def subscriber_notice_awaiting_payment\n BrandMailer.subscriber_notice(\n brand: Brand.find_by(company_name: 'Brand Nine'),\n stage: 'awaiting_payment'\n )\n end",
"def setup_months(start_month, end_month)\n @months = []\n while start_month <= end_month\n @months << start_month\n start_month += 1\n end\n end",
"def schedule_recurring_jobs\n EmbargoAutoExpiryJob.perform_later(account)\n LeaseAutoExpiryJob.perform_later(account)\n end",
"def export_subscriptions\n OpmlExporter.enqueue_export_job self\n end",
"def recurring; end",
"def each_october( n=1); each_monthnum(self.Oct,n); end",
"def current_month\n Time.now.strftime(\"%^b\")\n end",
"def month; end",
"def month; end",
"def month_name(number); end",
"def class_lifeline_ticker es, class_name, upto_date = Time.now.month_start\n active_months = class_months(es, class_name)\n range = month_range(active_months.first, upto_date)\n range.map {|mo| active_months.include?(mo) ? \"*\" : \".\" }.join\nend",
"def each_may( n=1); each_monthnum(self.May,n); end",
"def period\n case self.recurring_month\n when 12\n 1.year # 1.year != 12.months\n else\n self.recurring_month.months\n end\n end",
"def month=(_arg0); end",
"def usage_reset_day\n self.upload_limit_resets_at.strftime(\"%A, %B %e, %Y\")\n end"
] | [
"0.5627847",
"0.554653",
"0.55419827",
"0.5530015",
"0.5518673",
"0.5309939",
"0.52983016",
"0.5261452",
"0.5261452",
"0.52268386",
"0.5170234",
"0.5152929",
"0.50666344",
"0.50568134",
"0.50348157",
"0.50147647",
"0.5014254",
"0.49698037",
"0.49676493",
"0.49538717",
"0.49532664",
"0.49504158",
"0.4940553",
"0.4920814",
"0.49192357",
"0.49189752",
"0.4916393",
"0.4890276",
"0.48897886",
"0.4878118",
"0.48687384",
"0.48687384",
"0.48669404",
"0.48641896",
"0.48575616",
"0.4851402",
"0.4844563",
"0.48366934",
"0.4829657",
"0.4806357",
"0.47785193",
"0.47734916",
"0.47709638",
"0.47700113",
"0.47624555",
"0.47541317",
"0.47500655",
"0.47378916",
"0.4737251",
"0.47287565",
"0.47264907",
"0.4725509",
"0.4716862",
"0.4716169",
"0.47093213",
"0.47088256",
"0.469485",
"0.4690505",
"0.4679911",
"0.46797046",
"0.4676728",
"0.46759048",
"0.46738982",
"0.46727502",
"0.46708563",
"0.46707013",
"0.4667266",
"0.4664836",
"0.46592078",
"0.46538064",
"0.46515048",
"0.46482196",
"0.46438769",
"0.4639423",
"0.46383613",
"0.46322253",
"0.462207",
"0.4610399",
"0.4608258",
"0.46070522",
"0.4606999",
"0.4606705",
"0.45969662",
"0.45958626",
"0.4595065",
"0.45907912",
"0.45887655",
"0.4586961",
"0.4586003",
"0.45788434",
"0.4574793",
"0.4574259",
"0.45715693",
"0.45715693",
"0.45654234",
"0.4565142",
"0.45649457",
"0.45575613",
"0.45511448",
"0.4550679"
] | 0.72310346 | 0 |
Obtiene el numero de repeticiones del conjunto de datos por caracter Y carga los datos al objeto Information del array | def get_Table(value, elements)
#arr_data = values.clone #recivimos el arreglo de elementos y copiamos
countArray = Array.new()
array = value.split("")
for i in 0..(elements.length - 1)
elements[i].setTimes(array.count(elements[i].getCode()))##Cargamos los datos al objeto Inormation
end
return elements
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asignador\n alum = []\n line = read_alumnos\n line.each do |alumno|\n contador = 0\n arr = alumno.split(' ')\n arr.each do |x|\n contador += 1 if x == 'A'\n end\n alum << Alumnos.new(arr[0], arr[1], arr[2], arr[3], contador)\n end\n alum\nend",
"def nombres_comunes\n datos = eval(naturalista_info.decodifica64)\n datos = datos.first if datos.is_a?(Array)\n return [] unless datos['taxon_names'].present?\n nombres_comunes_faltan = []\n\n # Nombres comunes de la base de catalogos\n nom_comunes = especie.nombres_comunes\n nom_comunes = nom_comunes.map(&:nombre_comun).map{ |nom| I18n.transliterate(nom).downcase }.sort if nom_comunes\n\n datos['taxon_names'].each do |datos_nombres|\n next unless datos_nombres['is_valid']\n next if datos_nombres['lexicon'] == 'Scientific Names'\n\n # Nombre comun de NaturaLista\n nombre = I18n.transliterate(datos_nombres['name']).downcase\n lengua = datos_nombres['lexicon']\n\n if nom_comunes.present?\n next if nom_comunes.include?(nombre)\n end\n nombres_comunes_faltan << \"#{especie.catalogo_id},\\\"#{datos_nombres['name']}\\\",#{lengua},#{especie.nombre_cientifico},#{especie.categoria_taxonomica.nombre_categoria_taxonomica},http://naturalista.conabio.gob.mx/taxa/#{naturalista_id}\"\n end\n\n nombres_comunes_faltan\n end",
"def nacti_data(data, pomer)\n poc_nactenych_klauzuli = 0 \n pole_radku = data.split(\"\\n\")\n \n pole_radku.each do |radek|\n if(radek[0]!=\"c\")then #preskakuji komentar\n pole_hodnot = radek.split(' ') # ulozim si hodnoty do pole\n \n case radek[0]\n \n when \"p\"\n #nacteni zakladniho nastaveni instance\n @pocet_promennych = pole_hodnot[2].to_i\n @pocet_klauzuli = pole_hodnot[3].to_i\n # pokud je nastaven pomer (tj. obtiznost instance)\n if((pomer!=-1)&&(@pocet_klauzuli>=@pocet_promennych.to_f*pomer))then\n @pocet_klauzuli = @pocet_promennych.to_f*pomer\n end\n \n when \"w\"\n #nacitani vahoveho vektoru\n citac = 1\n while(citac < pole_hodnot.length)do\n @pole_vah[citac-1] = pole_hodnot[citac].to_i\n citac +=1\n end\n\n # when \"%\" # pouze pro kontrolu\n #ukoncovaci znak\n # puts \"%\" \n \n else\n #nacitani klauzuli\n if(poc_nactenych_klauzuli<@pocet_klauzuli)then\n citac = 0\n while(citac < pole_hodnot.length-1)do\n if(@klauzule[poc_nactenych_klauzuli]==nil)then\n nove_pole = []\n @klauzule[poc_nactenych_klauzuli]= nove_pole\n end\n @klauzule[poc_nactenych_klauzuli][@klauzule[poc_nactenych_klauzuli].length] = pole_hodnot[citac].to_i\n citac +=1\n end\n poc_nactenych_klauzuli+=1\n end \n end\n end\n end \n end",
"def titulares_serial\n Representante.find(self.titular_ids_serial).map(&:nombre)\n end",
"def character_info(index)\n\n $line_data.map do |x| \n [\n {wizzes_mugs_etc[:mentions] => x[index]},\n {wizzes_mugs_etc[:name] => x[index]},\n {wizzes_mugs_etc[:house] => x[index]} \n ]\n\n # trt = $line_data[index].split(\",\")\n # x[index] = \"#{trt}\"\n \n end \n \n \n\n end",
"def filas(tablero)\r\n\t#Fila0\r\n\t\te = 0\r\n\t\t@fila0 = Array.new\r\n\t\twhile e < 7\r\n\t\t\t@fila0 << tablero[0,e]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Fila1\r\n\t\te = 0\r\n\t\t@fila1 = Array.new\r\n\t\twhile e < 7\r\n\t\t\t@fila1 << tablero[1,e]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Fila2\r\n\t\te = 0\r\n\t\t@fila2 = Array.new\r\n\t\twhile e < 7\r\n\t\t\t@fila2 << tablero[2,e]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Fila3\r\n\t\te = 0\r\n\t\t@fila3 = Array.new\r\n\t\twhile e < 7\r\n\t\t\t@fila3 << tablero[3,e]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Fila4\r\n\t\te = 0\r\n\t\t@fila4 = Array.new\r\n\t\twhile e < 7\r\n\t\t\t@fila4 << tablero[4,e]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\r\n\t#Fila5\r\n\t\te = 0\r\n\t\t@fila5 = Array.new\r\n\t\twhile e < 7\r\n\t\t\t@fila5 << tablero[5,e]\r\n\t\t\te += 1\r\n\t\tend\r\nend",
"def initialize( valor_entrada) \n @filas = valor_entrada.length\n\t@columnas = valor_entrada[0].length\n \t@matriz = Array.new(filas){Array.new(columnas)}\n\n \[email protected]{ |i|\n \t\[email protected]{ |j|\n \t\t@matriz[i][j] = valor_entrada[i][j]\n \t\t}\n \t}\nend",
"def cambioPuntajes(n)\n puntaje1=@mapaactual[@mapaactual.keys[0]]\n puntaje2=@mapaactual[@mapaactual.keys[1]]\n if n==\"[1,0]\"\n puntaje1=1+puntaje1\n @mapaactual[@mapaactual.keys[0]]=puntaje1\n @mapaactual\n elsif n==\"[0,1]\"\n puntaje2=1+puntaje2\n @mapaactual[@mapaactual.keys[1]]=puntaje2\n @mapaactual\n end\n end",
"def aumentar(array, aumento, desde, hasta)\n arr_filtro = array[desde..hasta] #rango de los datos filtrados\n arr_filtro.map!{|venta_mensual| venta_mensual * aumento}.sum #valor total por el porcentaje de aumento\nend",
"def generisi\n @mreza = [0] * 81\n \n 0.upto 8 do |red|\n 0.upto 8 do |kolona|\n @mreza[red*9 + kolona] = moguci(red, kolona).sample\n end\n end\n end",
"def getData(monArray)\n\t\tmyIndex = 0\n\t\tindex = 0\n\n\t\t@product = @html.xpath(X_PATH_DATA)\n\t\twhile(index<@product.length)\n\t\t\tmyIndex = index/4\n\t\t\t\n\t\t\t(monArray.at(myIndex)).check_rate = ((@product.at(index)).text).gsub(/[^\\d]/, '')\t\n\t\t\tindex +=1\n\t\t\t\n\t\t\t(monArray.at(myIndex)).history = ((@product.at(index)).text).gsub(/[^\\d]/, '')\t\n\t\t\tindex +=1\n\n\t\t\t(monArray.at(myIndex)).multiple_notifications = (@product.at(index)).text\n\t\t\tindex +=1\n\n\t\t\t(monArray.at(myIndex)).push_notifications = (@product.at(index)).text\n\t\t\tindex +=1\n\t\t\n\t\tend\n\t\n\tend",
"def no_registrado()\n lines = read()\n lines.each do |x|\n arr = x.split(\" \")\n arr.each_with_index do |item, index|\n if item == \"NR\"\n if index == 1\n puts \"el #{arr[0]} en la bodega 1\"\n elsif index == 2\n puts \"el #{arr[0]} en la bodega 2\"\n elsif index == 3\n puts \"el #{arr[0]} en la bodega 3\"\n end\n end\n end\n end\nend",
"def capturarDatosParaPintar(array , pos ,cantiNumero)\nentrar=true;\nstringDevolver='';\nipos=1;\n\nwhile entrar\n if ipos >= cantiNumero\n entrar =false; \n end\n data = \"#{array[pos]} \"\n stringDevolver+=data;\n data=\"\";\n pos+=1;\n ipos+=1;\n end\nreturn stringDevolver;\nend",
"def ahorrodinero(año)\n\n i = 0\n final = Array.new \n final1 = Array.new \n final2 = Array.new \n \n\n datos = Valore.where(:año => año)\n \n datos.each do |datos|\n \n \n final[i] = datos.read_attribute(\"es\")\n final1[i] = datos.read_attribute(\"tarifa\")\n final2[i] = final1[i]*final[i]\n \n i = i +1\n \n \n end\n \n return final2\n\n\n\n end",
"def initialize(arraycontent, nombre)\n super\n @gei = get_gei\n @usoterreno = get_usoterreno\n @eficiencia = get_eficiencia_energetica\n end",
"def cambioRondas(n)\n rond=@mapaactual[@mapaactual.keys[2]]\n @mapaactual[@mapaactual.keys[2]]=rond+n\n @mapaactual\n end",
"def get_array_values(init,type)\n if type == \"fecha\"\n final = Time.new.year\n unidad = \"\"\n elsif type == \"rango\"\n final = 5000\n unidad = \"m2\"\n elsif type == \"aforo\"\n final = 500\n unidad = \"\"\n end\n array_ = []\n\n #((final.to_i).downto(Integer(init))).each do |n|\n (Integer(init)..(final.to_i)).each do |n|\n array_ << \"#{n}#{unidad}\"\n end\n return array_\n end",
"def damepromedio(arr)\n\thprom = {}\n\tarr.each do |linea|\n\t\tdata = linea.split(', ') # separo los datos\n\t\tcantnotas = data.count - 1\n\t\tpromedio = data.inject(0) {|sum, x| sum + x.to_f} / cantnotas\n\t\thprom[data[0]] = promedio # retorno hash con nombre y promedio\n\tend\n\thprom\nend",
"def jugadas_posibles\n Array.new.tap do |jugadas_posibles|\n (1..8).each do |columna|\n (1..8).each do |fila|\n jugadas_posibles << [columna, fila] if puede_moverse?(columna, fila)\n end\n end\n end\n end",
"def asigna_datos\n return unless taxon.present?\n\n cols = if columnas_array.present?\n columnas_array\n else\n columnas.split(',') if columnas.present?\n end\n\n cols.each do |col|\n\n case col\n when 'x_snib_id'\n if proveedor = taxon.proveedor\n self.taxon.x_snib_id = proveedor.snib_id\n end\n when 'x_snib_reino'\n if proveedor = taxon.proveedor\n self.taxon.x_snib_reino = proveedor.snib_reino\n end\n when 'x_naturalista_id'\n if proveedor = taxon.proveedor\n self.taxon.x_naturalista_id = proveedor.naturalista_id\n end\n when 'x_foto_principal'\n if adicional = taxon.adicional\n self.taxon.x_foto_principal = adicional.foto_principal\n end\n when 'x_nombre_comun_principal'\n if adicional = taxon.adicional\n self.taxon.x_nombre_comun_principal = adicional.nombre_comun_principal\n end\n when 'x_categoria_taxonomica'\n self.taxon.x_categoria_taxonomica = taxon.try(:nombre_categoria_taxonomica) || taxon.categoria_taxonomica.nombre_categoria_taxonomica\n when 'x_estatus'\n self.taxon.x_estatus = Especie::ESTATUS_SIGNIFICADO[taxon.estatus]\n when 'x_nombres_comunes'\n nombres_comunes = taxon.nombres_comunes.map{ |nom| nom.nombre_comun.capitalize }.uniq.sort\n next unless nombres_comunes.any?\n self.taxon.x_nombres_comunes = nombres_comunes.join(', ')\n when 'x_tipo_distribucion'\n tipos_distribuciones = taxon.tipos_distribuciones.map(&:descripcion).uniq\n next unless tipos_distribuciones.any?\n self.taxon.x_tipo_distribucion = tipos_distribuciones.join(',')\n when 'x_nom' # TODO: homologar las demas descargas\n nom = taxon.catalogos.nom.distinct\n next unless nom.any?\n self.taxon.x_nom = nom.map(&:descripcion).join(', ')\n \n # Para las observaciones\n obs = []\n taxon.especies_catalogos.each do |cat|\n obs << cat.observaciones if [14,15,16,17].include?(cat.catalogo_id)\n end\n \n self.taxon.x_nom_obs = obs.join(', ')\n when 'x_iucn' # TODO: homologar las demas descargas\n iucn = taxon.catalogos.iucn.distinct\n next unless iucn.any?\n self.taxon.x_iucn = iucn.map(&:descripcion).join(', ')\n \n # Para las observaciones\n obs = []\n taxon.especies_catalogos.each do |cat|\n obs << cat.observaciones if [25,26,27,28,29,30,31,32,1022,1023].include?(cat.catalogo_id)\n end\n \n self.taxon.x_iucn_obs = obs.join(', ')\n when 'x_cites' # TODO: homologar las demas descargas\n cites = taxon.catalogos.cites.distinct\n next unless cites.any?\n self.taxon.x_cites = cites.map(&:descripcion).join(', ') \n\n # Para las observaciones\n obs = []\n taxon.especies_catalogos.each do |cat|\n obs << cat.observaciones if [22,23,24].include?(cat.catalogo_id)\n end\n \n self.taxon.x_cites_obs = obs.join(', ') \n when 'x_ambiente' # TODO: homologar las demas descargas\n if hash_especies.present? # Quiere decir que viene de las descargas pr region\n ambiente = []\n taxon.catalogos.each do |catalogo|\n if catalogo.nivel1 == 2\n ambiente << catalogo\n end\n end\n else\n ambiente = taxon.catalogos.ambientes\n end\n\n next unless ambiente.any?\n self.taxon.x_ambiente = ambiente.map(&:descripcion).join(', ') \n when 'x_naturalista_fotos'\n next unless adicional = taxon.adicional\n if proveedor = taxon.proveedor\n self.taxon.x_naturalista_fotos = \"#{CONFIG.site_url}especies/#{taxon.id}/fotos-naturalista\" if proveedor.naturalista_id.present? && adicional.foto_principal.present?\n end\n when 'x_bdi_fotos'\n next unless adicional = taxon.adicional\n self.taxon.x_bdi_fotos = \"#{CONFIG.site_url}especies/#{taxon.id}/bdi-photos\" if adicional.foto_principal.present?\n when 'x_bibliografia'\n biblio = taxon.bibliografias\n self.taxon.x_bibliografia = biblio.map(&:cita_completa).join(\"\\n\")\n when 'x_url_ev'\n self.taxon.x_url_ev = \"#{CONFIG.site_url}especies/#{taxon.id}-#{taxon.nombre_cientifico.estandariza}\"\n when 'x_num_reg'\n self.taxon.x_num_reg = hash_especies[taxon.scat.catalogo_id]\n else\n next\n end # End switch\n end # End each cols\n\n # Para agregar todas las categorias taxonomicas que pidio, primero se intersectan\n cats = COLUMNAS_CATEGORIAS & cols\n\n if cats.any?\n return if taxon.is_root? # No hay categorias que completar\n ids = taxon.path_ids\n\n Especie.select(:nombre, \"#{CategoriaTaxonomica.attribute_alias(:nombre_categoria_taxonomica)} AS nombre_categoria_taxonomica\").left_joins(:categoria_taxonomica).where(id: ids).each do |ancestro|\n categoria = 'x_' << ancestro.nombre_categoria_taxonomica.estandariza\n next unless COLUMNAS_CATEGORIAS.include?(categoria)\n eval(\"self.taxon.#{categoria} = ancestro.nombre\") # Asigna el nombre del ancestro si es que coincidio con la categoria\n end\n end\n end",
"def datos(opc={})\n return [] unless cadena_especies.present?\n\n # Por default muestra todos\n Especie.caso_rango_valores('especies.id',cadena_especies).order('nombre_cientifico ASC').limit(opc[:limit] ||= 300000).each do |taxon|\n self.taxon = taxon\n asigna_datos\n self.taxones << taxon\n end\n end",
"def busca_n_gramas(indice_)\n encontrados = Array.new\n tamano_texto = @texto.length\n n_gramas = @texto.clone\n if indice_ > 7 || indice_ < 2\n puts \"Solo puedo darte de 2 a 7 -gramas\"\n return\n end\n arreglo = frecuencias(false)\n 10.times do |i|\n frecuen = arreglo[i]\n letra = frecuen[0]\n caracter = letra.dup\n j = 0\n sig = nil\n ant = nil\n while true\n en_texto = \"\" << n_gramas[j]\n if caracter.eql?(en_texto)\n sig = n_gramas[j...j+indice_]\n ant = n_gramas[j+1-indice_..j]\n rep_s = n_gramas.scan(sig).size\n rep_a = n_gramas.scan(ant).size\n if rep_s > 2\n salida = sig + \" -- \" + rep_s.to_s\n salida2 = ant + \" -- \" + rep_a.to_s\n puts salida\n puts salida2\n end\n break\n end#if\n j = j.succ \n end#e while\n end\n return encontrados\n end",
"def initialize(info_nutricional, cantidad = 1.0)\n @nombre = info_nutricional[:nombre]\n @proteinas = info_nutricional[:proteinas] * cantidad\n @carbohidratos = info_nutricional[:carbohidratos] * cantidad\n @lipidos = info_nutricional[:lipidos] * cantidad\n @gei = info_nutricional[:gei] * cantidad\n @terreno = info_nutricional[:terreno] * cantidad\n @cantidad = cantidad\n end",
"def bilan\n raise \"Il faut lancer l'étude avec Etude::start avant de construire le bilan\" if @data.nil?\n @bilan ||= begin\n c = []\n # Largeur : 26 (sans les \"|\")\n titre = \"Exercices #{from_exercice} à #{to_exercice}\"\n gauche = ((26 - titre.length).to_f / 2).floor - 1\n droite = \" \" * (26 - (gauche + titre.length))\n gauche = \" \" * gauche\n entete = <<-TXT\n----------------------------\n|#{gauche}#{titre}#{droite}|\n----------------------------\n| Doigté | Nombre de fois |\n TXT\n c << entete.strip\n titre_section = <<-TXT\n----------------------------\n| Par quantité |\n----------------------------\n TXT\n c << titre_section.strip\n nombre_max = nil\n nombre_min = nil\n nb_courant = nil\n @data.sort_by{|c, e| e[:nombre]}.reverse.each do |combi, data_combi|\n nb_courant = data_combi[:nombre]\n nombre_max = nb_courant if nombre_max.nil?\n nb = (\" \" * 5) << nb_courant.to_s # 16\n nb << \" \" * (16 - nb.length) \n c << \"| #{combi} | #{nb}|\"\n end\n nombre_min = nb_courant\n \n titre_section = <<-TXT\n----------------------------\n| Par premier doigt |\n----------------------------\n TXT\n c << titre_section.strip\n @data.sort_by{|combi, e| combi[0..0]}.each do |combi, data_combi|\n nb = data_combi[:nombre]\n nb = \"#{nb} (max)\" if nb == nombre_max\n nb = \"#{nb} (min)\" if nb == nombre_min\n nb = (\" \" * 5) << nb.to_s\n nb << \" \" * (16 - nb.length) \n c << \"| #{combi} | #{nb}|\"\n end\n \n titre_section = <<-TXT\n----------------------------\n| Par second doigt |\n----------------------------\n TXT\n c << titre_section.strip\n @data.sort_by{|combi, e| combi[2..2]}.each do |combi, data_combi|\n nb = data_combi[:nombre]\n nb = \"#{nb} (max)\" if nb == nombre_max\n nb = \"#{nb} (min)\" if nb == nombre_min\n nb = (\" \" * 5) << nb.to_s # 16\n nb << \" \" * (16 - nb.length) \n c << \"| #{combi} | #{nb}|\"\n end\n c << \"-\" * 28\n c << \"\\n\"\n c.join(\"\\n\")\n end\n end",
"def contar_lineas\n line = read_alumnos\n contador = line.count\n contador\nend",
"def datos_descarga(taxa)\n return unless taxa.any?\n self.taxones = []\n\n taxa.each do |taxon|\n self.taxon = taxon\n asigna_datos\n self.taxones << taxon\n end\n end",
"def set_valores_num\n valor = 1\n i = 0\n while(i < @col)\n j = 0\n while(j < @fil)\n @matrix[i][j] = valor\n valor += 1\n j += 1\n end\n i += 1\n end\n end",
"def modif(file, array)\n #leer el csv\n # CSV.foreach(file) do |person_in_line|\n # p \"#{person_in_line[0]}, #{person_in_line[1]}, #{person_in_line[2]}, #{person_in_line[3]}, #{person_in_line[4]}\"\n # end\n\n counter = 1\n\n array.each do |person_atributS|\n p \"#{counter} #{person_atributS.first_name} #{person_atributS.last_name} #{person_atributS.phone} #{person_atributS.created_at}\"\n counter +=1\n end\n p \" selecciona su numero de persona\"\n number_to_look = gets.to_i\n\n p \"que atributos quieres cambiar\"\n p \"nombre presiona 1\"\n p \"apellido presiona 2\"\n p \"telefono presiona 3\"\n p \"fecha de creacion presiona 4\"\n counter = 0\n atribut_to_look = gets.to_i\n #encontrar personas en el arreglo\n array.each do |person_atributS|\n counter +=1\n #escoger atributo\n if counter == number_to_look\n p \"ingresa el nuevo atributo\"\n new_atribut = gets.chomp\n old_atribut = \"\"\n #modificar atributo\n case atribut_to_look\n when 1 then old_atribut = person_atributS.first_name\n when 2 then old_atribut = person_atributS.last_name\n when 3 then old_atribut = person_atributS.phone\n when 4 then old_atribut = person_atributS.created_at\n end\n case atribut_to_look\n when 1 then person_atributS.first_name = new_atribut\n when 2 then person_atributS.last_name = new_atribut\n when 3 then person_atributS.phone = new_atribut\n when 4 then person_atributS.created_at = new_atribut = DateTime.parse(new_atribut)\n end\n p \"#{old_atribut} ha sido modificado por #{new_atribut}\"\n end\n\n end# fin de la iteracion del array.each do |person_atributS|\n\n #empujar arreglo a CSV\n CSV.open(\"people.csv\", \"wb\") do |line_on_csv|\n array.each do |person|\n line_on_csv << [person.first_name, person.last_name, person.email, person.phone, person.created_at]\n end\n end\n end",
"def filtrarObstaculos(cad)\n aux=[]\n cad.each do |elemento|\n if (elemento[0] == \"O\")\n aux.push(stringObstaculos(elemento))\n end\n end\n return aux #[[\"O\",3,2],......]\nend",
"def position_array_personne_epenser(journaliste)\n \tputs \"Reponse :\"\n \tputs \"@epenser est sur la ligne #{journaliste.index(\"@epenser\")}\"\n \tputs\nend",
"def medir_indicador_res_tipo_1(idacs, mind, fini, ffin)\n { resind: idacs.count, datosint: [] }\n end",
"def populate(lines)\n\t\ti = 1\n\t\[email protected]_index do |x|\n\t\t\t# split each line into an array of integers and map to a 2 dimensional array\n\t\t\t@matrix[x] = lines[i].split(' ').map(&:to_i)\n\t\t\ti+=1\t\n\t\tend\t\n\tend",
"def setup\n size 200, 200\n # The text from the file is loaded into an array. \n stuff = File.readlines(\"#{sketch_path}/data/data-1.txt\")\n\n # This array has one element because the file only has one line. \n # Convert String into an array of integers using ',' as a delimiter\n @data = stuff.first.split(',')\n @data.map! { |num| num.to_i }\nend",
"def chargeGrille()\n data = []\n File.foreach(@nomniv).with_index do |line, line_no|\n data << line.chomp\n end\n # Slice permet de récupérer la taille de la matrice \n # tel que 7:7\n num = data.slice!(0)\n self.colonnes = @x\n self.lignes = @y\n\n # Parcours des données récupérés afin de charger\n # les boutons\n for i in 0..(data.length() - 1) \n data[i].split(':').each_with_index do | ch, index| \n # # Création d'une case \n if ch != '0'\n btn = Ile.new(self, ch,index,i)\n @sommets << btn\n else \n btn = Pont.new(self, index, i)\n end\n\n # On attache la référence de la grille\n self.attach(btn, index,i, 1,1)\n end\n end\n\n return self\n end",
"def cartas_por_pinta\n @pintas = []\n @pintas = @mi_mano.group_by{|k, v| v[:pinta]}.map{|k, v| [k, v.count]}\n end",
"def datos(row, i)\n data = row[7].nil? ? SIN_DATOS : row[i]\n status = row[i + 31]\n [data, status]\n end",
"def data\n final = [[\"25%\", 0], [\"50%\", 0], [\"75%\", 0], [\"100%\", 0]]\n self.usages.each do |usage|\n if usage.percent > 75 && usage.percent <= 100\n final[0][1] += 1\n final[1][1] += 1\n final[2][1] += 1\n final[3][1] += 1\n elsif usage.percent > 50 && usage.percent <= 75\n final[0][1] += 1\n final[1][1] += 1\n final[2][1] += 1\n elsif usage.percent > 25 && usage.percent <= 50\n final[0][1] += 1\n final[1][1] += 1\n elsif usage.percent > 0 && usage.percent <= 25\n final[0][1] += 1\n end\n end\n return final\n end",
"def cargarProductos()\n i=0\n File.open('productos.txt', 'r') do |f1| #primer parametro lo q va a leer, r es para leer (f1 es el primeer archivo etc etc)\n while linea = f1.gets\n $productos[i]=linea.split (\",\") #este es un metodo para que cuando ingresen los datos al arreglo los separe por columnas cada que tenga una coma\n #pueden borrarla si no les sirve\n i+1\n end\n end\nend",
"def carbohidratos\n\t\treturn @carbohidratos*@cantidad\n\tend",
"def kcallipidos\n\t\t\t@lipidos * 9\n\t\tend",
"def columnas(tablero)\r\n\t#Columnas0\r\n\t\te = 0\r\n\t\t@columna0 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna0 << tablero[e,0]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Columnas1\r\n\t\te = 0\r\n\t\t@columna1 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna1 << tablero[e,1]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Columnas2\r\n\t\te = 0\r\n\t\t@columna2 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna2 << tablero[e,2]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Columnas3\r\n\t\te = 0\r\n\t\t@columna3 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna3 << tablero[e,3]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Columnas4\r\n\t\te = 0\r\n\t\t@columna4 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna4 << tablero[e,4]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\r\n\t#Columnas5\r\n\t\te = 0\r\n\t\t@columna5 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna5 << tablero[e,5]\r\n\t\t\te += 1\r\n\t\tend\r\n\r\n\t#Columnas6\r\n\t\te = 0\r\n\t\t@columna6 = Array.new\r\n\t\twhile e < 6\r\n\t\t\t@columna6 << tablero[e,6]\r\n\t\t\te += 1\r\n\t\tend\r\nend",
"def initialize(names, data)\n @names = names\n @N = names.length\n\n @data = data\n\n @mintape = data[0][0][:stats][0][:tape_abs].length\n @maxtape = data[0][0][:stats][-1][:tape_abs].length\n @T = data[0][0][:points].length / 2\n @T2 = 2 * @T\n\n @idata = Array.new(@N - 1) { |i| Array.new(i) }\n end",
"def initialize(nr)\n @nr = nr\n @positionen = []\n end",
"def initialize(nr)\n @nr = nr\n @positionen = []\n end",
"def cargar_datos(formulario, registro, indice)\n formulario.each do |llave, valor|\n next if llave == indice\n\n registro.send(\"#{llave}=\", valor)\n end\nend",
"def hidratos_carbono\r\n hc = 0\r\n @lista_alimentos.each do |i|\r\n hc += i.carbohidratos\r\n end\r\n return hc\r\n end",
"def transform_numbers_field fields,row_size\n count = 0\n @numbers.each do |n,arr|\n i = fields.delete(n) # delete the old field\n ## replace by the new fields instead\n arr.each { |v| fields[v] = row_size + count; count += 1 }\n end\n return fields\n end",
"def estatistica_legendas(ano)\n @estatisticas[\"legendas\"] = \"numero_partidos\"\n @legendas_anos[ano].each do | partido, legenda |\n partidos_str = legenda.composicao_coligacao\n legenda.numero_partidos = partidos_str.split(\"/\").size\n end\n end",
"def notaminima(nota = 5)\n\t\t\tdata = \"\"\n\t\t\tarray = []\n\t\t\tcontadornota = 0\n\t\t\tfile = File.open(\"promediosAlumnos.csv\", \"r\")\n\t\t\tcontenido = file.readlines()\n\n\t\t\t#File.open(\"promedios.csv\", \"r\"){|file|\n\t\t\t#\tdata = file.readlines\n\t\t\t#}\n\n\t\t\tcontenido.each do |i|\n\t\t\t\tarreglo = i.split(\",\")\n\t\t\t\t#contadornota = contadornota + arreglo.to_i\n\t\t\t\t#if ret[1].to_i > 5\n\t\t\t\tarray.push(arreglo[0]) if arreglo[1].to_i >= nota\n\t\t\t#end\n\t\tend\n\t\treturn array\n\t\tend",
"def lipidos\n\t\treturn @lipidos*@cantidad\n\tend",
"def cartas_por_valor\n @valores = []\n @valores = @mi_mano.group_by{|k, v| v[:valor]}.map{|k, v| [k, v.count]}\n end",
"def proteinas\n\t\treturn @proteinas*@cantidad\n\tend",
"def take_a_number(katz_deli, person)\n katz_deli.push(person)\n new_person_in_line = \" \"\n katz_deli.each_with_index do |item,index|\n new_person_in_line = \"Welcome, #{item}. You are number #{index + 1} in line.\"\n end\n puts new_person_in_line\n end",
"def cargar_comandos_jugadas_repetir_otro_sorteo(ticket, sorteo_origen , sorteo_destino)\n #Buscar todos los comandos de todas las jugadaslots de ese ticket con ese sorteo de origen.\n @array_jugadas_de_ese_sorteo_en_ese_ticket = Jugadalot.where(:ticket_id => ticket, :sorteot => Sorteot.where(:sigla => sorteo_origen.to_s).first.id)\n \n @comando_jugadas =[] # Defino el array que trenda todos los comando de las jugadas de este sorteo de ese ticket\n\n @array_jugadas_de_ese_sorteo_en_ese_ticket.each do |jugadalot|\n @comando_jugadas << jugadalot.comandojugada\n end\n \n #Hacer un solo string con todos los comando_jugadas.join(\"*\") unidos por caracter especial \"*\" ok. ted.\n @comando_jugadas = @comando_jugadas.join(\"*\")\n\n #Hacer un string.replace pattern .01 a .02 (sorteo_origen, sorteo_destino)\n sorteo_origen = \".\" + sorteo_origen\n sorteo_destino = \".\" + sorteo_destino\n\n @comando_jugadas.gsub(sorteo_origen, sorteo_destino)\n #dejar que siga evaluando hacia abajo... ok ted. Bloque de codigo guardar jugadas.\n \n end",
"def terrenos\r\n terreno = 0\r\n @lista_alimentos.each do |i|\r\n terreno += i.terreno\r\n end\r\n return terreno\r\n end",
"def segmentation\n # Total\n @mic[\"total\"] = status_count(@total_mic)\n\n # PACPOA: contagem separada por matriz e programa = PACPOA\n matriz_pacpoa = ['CARNE', 'LEITE', 'OVO', 'PESCADO']\n matriz_pacpoa.each do |matriz|\n segment = @total_mic.programa('PACPOA').matriz(matriz)\n @mic[\"PACPOA_#{matriz}\"] = status_count(segment)\n end\n\n # PNCP: contagem separada por programa\n pncp = ['Listeria', 'Aves', 'STEC', 'Suínos']\n pncp.each do |name|\n segment = @total_mic.programa(name)\n @mic[\"PNCP_#{name}\"] = status_count(segment)\n end\n\n # Bebidas nao alcoolicas: amostras de origem vegetal\n bebidas = @total_mic.matriz('VEGETAL')\n @mic['bebidas'] = status_count(bebidas)\n\n # Outros\n @mic['outros'] = others(@mic)\n end",
"def initialize(select, datas, matricula, unico = false)\n\n @select = select\n @unico = unico\n @hash_final = []\n @matricula = matricula\n datas.each do |data|\n @justificativa = Frequencia::Justificada.where(\"data = '#{data}' and matricula = '#{@matricula}'\")\n i = 0\n f = 0\n a = {}\n hora = []\n total = 0\n\n unless @select.blank?\n select.each do |dados|\n if (dados.data.strftime(\"%Y-%m-%d\").to_date == data)\n i += 1\n a[(\"hora#{i}\").to_sym] = dados.data.strftime(\"%H:%M:%S\")\n hora << ChronicDuration.parse(a[(\"hora#{i}\").to_sym])\n if (hora.count % 2) == 0\n f += 1\n calculo_hora = (hora[i-1] - hora[i-2])\n total += calculo_hora\n end\n end\n end\n else\n a = {:hora1 => '-', :hora2 => '-', :total_geral => 'Inconsistente'}\n end\n\n a = regra_horas(a)\n\n a[:data] = data\n a[:total_geral] = ChronicDuration.output(total, :format => :chrono) if a[:total_geral].blank?\n a[:justificativa] = @justificativa[0].justificativa.descricao if !@justificativa[0].blank?\n @hash_final << a\n\n end\n return @hash_final\n end",
"def array_of_driver\r\n\t\tnumber = @array_translate.length-1\r\n\t\tarray_driver = []\r\n\t\t(2..number).each do |index|\r\n\t\t\tdriver_obj = Driver.new(convert_coordinate(index))\r\n\t\t\tdriver_obj.name = @array_translate[index][0]\r\n\t\t\tarray_driver << driver_obj\r\n\t\tend\r\n\t\tarray_driver\r\n\tend",
"def ndata; end",
"def medir_indicador_otro_tipo_23(mind, fini, ffin)\n datosint = []\n eap = ::ApplicationHelper::ESTADOS_APROBADO.map { |l| \"'#{l}'\" }\n eap = eap.join(', ')\n base = Cor1440Gen::Proyectofinanciero.\n where('fechaformulacion >= ?', fini).\n where('fechaformulacion <= ?', ffin).\n where('respgp_id IS NOT NULL')\n cd1 = base.clone.where('estado IN (?)', \n ::ApplicationHelper::ESTADOS_APROBADO) \n d1 = cd1.count\n evd1 = cd1.pluck('id')\n rutaev1 = d1 == 0 ? '#' :\n cor1440_gen.proyectosfinancieros_url + '?filtro[busid]=' + \n evd1.join(',')\n datosint << {valor: d1, rutaevidencia: rutaev1 }\n cd2 = base.clone\n d2 = cd2.count\n evd2 = cd2.pluck('id')\n datosint << {valor: d2, rutaevidencia: d2 == 0 ? '#' :\n cor1440_gen.proyectosfinancieros_url + '?filtro[busid]=' + \n evd2.join(',')}\n resind = d2.to_f > 0 ? 100*d1.to_f/d2.to_f : nil;\n\n return {resind: resind, datosint: datosint, rutaevidencia: rutaev1}\n end",
"def Traductor nume\n\nnumero = {}\nnumero[0] = \"Cero\"\nnumero[1] = \"Uno\"\nnumero[2] = \"Dos\"\nnumero[3] = \"Tres\"\nnumero[4] = \"Cuatro\"\nnumero[5] = \"Cinco\"\nnumero[6] = \"Seis\"\nnumero[7] = \"Siete\"\nnumero[8] = \"Ocho\"\nnumero[9] = \"Nueve\"\nnumero[10] = \"Diez\"\n\n\n\nreturn numero[nume.to_i]\n\n\nend",
"def listaVariables\n listaAux=[]\n cont=0\n listaAux[0]=match(\"Identificador\")\n cont+=1\n while (nodoExiste && @arrayTokens[@punteroToken].returnTipo == \"Coma\") do\n match(\"Coma\")\n listaAux[cont]=match(\"Identificador\")\n cont+=1\n end\n return listaAux\n end",
"def get_energia_lipidos\n\t\t\t\t@lipidos * 9\n\t\t\tend",
"def line(katz_deli)\n if katz_deli.length >= 1\n array = []\n counter = 1 \n katz_deli.each do |name|\n array.push(\"#{counter}. #{name}\")\n counter += 1 \n end\n puts \"The line is currently: #{array.join(\" \")}\"\n else\n puts \"The line is currently empty.\"\n end \nend",
"def initialize(nombre,alimentos,cantidad)\n super(nombre,alimentos,cantidad) # Llamada al contructor de la clase padre\n @emisiones_diarias = 0 # Variable para almacenar valor de efceto invernadero\n @metros_terreno = 0 # variable para almacenar valor del terreno\n end",
"def get_jogos\n @dt = Array.new; @dados = \"\"; vetor = Array.new; contador=0;\n @doc[\"entry\"].each do |pontos| \n #p \"Contador: #{contador}\"\n linha = pontos[\"cell\"][0][\"row\"]\n coluna = pontos[\"cell\"][0][\"col\"] \n valor = pontos[\"cell\"][0][\"inputValue\"]\n #pega as datas dos jogos\n if linha.to_i > 2 && contador > 3\n p \"Jogo: #{valor} #{pontos[\"cell\"][0][\"col\"][2]} #{pontos[\"cell\"][0][\"col\"][3] } X #{pontos[\"cell\"][0][\"col\"][5] } #{pontos[\"cell\"][0][\"col\"][6] } \"\n end#fim da linha\n \n contador += contador\n# if coluna == \"2\"\n# if linha.to_i > 2\n# pp \"Jogador A: #{valor} #{contador}\"\n# jogador_a = valor\n# @dados += valor + \" \"\n# end \n# end\n# \n# if coluna == \"3\"\n# if linha.to_i > 2\n# pp \"Pontos A: #{valor} #{contador}\"\n# pontos_a = valor\n# @dados += valor + \" \"\n# end\n# end\n# \n# if coluna == \"4\"\n# if linha.to_i > 2\n# pp \"Versus: #{valor} #{contador}\"\n# versus = valor\n# @dados += valor + \" \"\n# end\n# end\n# \n# if coluna == \"5\"\n# if linha.to_i > 2\n# pp \"Pontos B: #{valor} #{contador}\"\n# pontos_b = valor\n# @dados += valor + \" \"\n# end\n# end\n# \n# if coluna == \"6\"\n# if linha.to_i > 2\n# pp \"Jogador: #{valor} #{contador}\"\n# jogador_b = valor\n# @dados += valor\n# end\n# end\n \n end#fim teste principal\n end",
"def contador_letras(nombres)\n nombres.map{ |x| x.length} # [7, 6, 8, 7, 5, 3, 3]\nend",
"def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # digito agencia 1\n # conta corrente 8\n # digito da conta 1\n # numero convenio 6\n cc = conta_corrente.to_s.rjust(8, '0')\n \"#{agencia}#{agencia_dv}#{cc}#{conta_corrente_dv}#{''.rjust(6, '0')}\"\n end",
"def medir_indicador_otro_tipo_33(mind, fini, ffin)\n datosint = []\n base = ::Productopf.\n where( 'proyectofinanciero_id IN (SELECT id ' +\n 'FROM cor1440_gen_proyectofinanciero ' +\n 'WHERE respgp_id IS NOT NULL ' +\n 'AND estado IN (?))', \n ::ApplicationHelper::ESTADOS_APROBADO).\n where('fechaplaneada>=?', fini).\n where('fechaplaneada<=?', ffin).\n where('fechareal<=(fechaplaneada + 7)')\n d1 = base.count\n idp1 = base.pluck(:proyectofinanciero_id)\n rutaev1 = d1 == 0 ? '#' :\n cor1440_gen.proyectosfinancieros_url + '?filtro[busid]=' + \n idp1.uniq.join(',')\n datosint << { valor: d1, rutaevidencia: rutaev1 }\n\n base3 = ::Productopf.\n where( 'proyectofinanciero_id IN (SELECT id ' +\n 'FROM cor1440_gen_proyectofinanciero ' +\n 'WHERE respgp_id IS NOT NULL '+\n 'AND estado IN (?))', \n ::ApplicationHelper::ESTADOS_APROBADO).\n where('fechaplaneada>=?', fini).\n where('fechaplaneada<=?', ffin)\n d2 = base3.count\n idp2 = base3.pluck(:proyectofinanciero_id)\n rutaev2 = d2 == 0 ? '#' :\n cor1440_gen.proyectosfinancieros_url + '?filtro[busid]=' + \n idp2.uniq.join(',')\n datosint << { valor: d2, rutaevidencia: rutaev2 }\n\n resind = d2.to_f > 0 ? 100*d1.to_f/d2.to_f : nil\n return {resind: resind, datosint: datosint, rutaevidencia: rutaev1}\n end",
"def ubicacion2(cadena)\n cad=cadena.split(/\\s|,/)\n cad[0]=cad[0].to_i\n cad[1]=cad[1].to_i\n return cad #[2,2,\"S\"]\nend",
"def discover_points # step 1\r\n x = 0\r\n y = 0\r\n @image_arr.each do |row|\r\n x = 0\r\n row.each do |cell|\r\n if cell == 1 # discovered the cell is 1\r\n @ordinal_arr.push([y,x]) # this is where i push the ordinals.\r\n puts \"#{y},#{x}\"\r\n end\r\n x = x + 1\r\n end\r\n y = y + 1\r\n puts \"\" \r\n end\r\n end",
"def numbers\n @board.map!.with_index do |e, i|\n e == AIR ? i.to_s : e\n end\n draw_board\nend",
"def telefones\n self.contato_telefones.map{|a| \"(#{a.ddd}) #{a.numero}\"}\n end",
"def eercicio\n\ta = Array.new(20)\n\tfor i in 0..20\n\t\ta[i] = rand(1..100)\n\tend\n\tputs \"#{a}\"\n\tb= a.select{|k| k%2 == 0}\n\tputs \"Pares #{b} \"\n\tc= a.select{|k| k%2 == 1}\n\tputs \"Impares #{c}\"\n\td = a.select{|k| k%2 == 0 && a.find_index(k)%2 == 0 && a.find_index(k)>0}\n\tputs \"Numeros PAR que corresponde con el indice #{d}\"\n\top\t =\"s\" \n\twhile op == \"s\" do\n\t\tputs \"Array #{a}\"\n\t\tputs \"Introduzca numero a buscar\"\n\t\tnum = gets.chomp.to_i\n\t\tvar = a.select{|k| k==num}\n\t\tputs \"#{var}\"\n\t\t#\tputs \"El numero existe\"\n\t\t#else\n\t\t#\tputs \"El numero no existe\"\n\t\t#end\n\tend\nend",
"def index\n @array = [45, 6, 32, 0]\n end",
"def make_info_mano_onlogs\r\n @log.debug \"make_info_mano_onlogs\"\r\n @mano_coll = []\r\n curr_ix = 0\r\n curr_mano_info = {:ix => curr_ix, :data => []}\r\n @data_logs.each do |line|\r\n #p line\r\n if line =~ /new_mano/\r\n @mano_coll << curr_mano_info if curr_mano_info.size > 0\r\n curr_ix += 1\r\n curr_mano_info = {:ix => curr_ix, :data => []}\r\n else\r\n curr_mano_info[:data] << line \r\n end\r\n end\r\n end",
"def convert_song_original_array(song)\n song.map! do |lyric|\n word = lyric[0]\n number = lyric[1]\n (word * number).scan(word) # returns an array of instanaces of word\n end\n song.flatten!\n return song\nend",
"def disc_factory(number)\n disc_array = []\n number.times do\n disc_array << Disc.new\n end\n disc_array\n end",
"def create_game_field_array\r\n\t\r\n\t\ti=0\r\n\t\twhile i < 8 do\r\n\t\t\tj=0\r\n\t\t\t\r\n\t\t\twhile j < 8 do\r\n\t\t\t #Copy the \".\" object in the actual Position of the 2 dimensional Array \r\n\t \t @nha[i][j] =\".\"\t\t\r\n\t\t\t\tj+=1\t\t\r\n\t\t\tend\r\n\t\t\ti+=1\r\n\t\tend\r\n\t\treturn true\r\n\tend",
"def info_conta\n # CAMPO TAMANHO\n # agencia 3\n # conta corrente 7\n \"#{agencia}#{conta_corrente}\"\n end",
"def repartir jugadores, jugador_inicial\n\t\t# Repite esta secuencia el tamaño maximo de la baraja menos 2. Una vez menos por el indice del array que es empieza a cero. Otra vez menos por la salida controlada.\n\t\tjugador_que_toca = jugador_inicial\n\t\tfor i in (0.. Constantes::TAMANO_MAX_BARAJA - 2)\n\t\t\t# rand (x) produce un numero entero entre 0 y x-1\n\t\t\tindice = rand (Constantes::TAMANO_MAX_BARAJA - i)\n\t\t\t# la carta elegida al azar es @baraja[indice]\n\t\t\t# asigna la carta al jugador que le toca en el reparto (circular)\n\t\t\tj1 = jugadores[jugador_que_toca]\n\t\t\t# Si la mano de un jugador (array de cartas) no esta creado\n\t\t\tif j1.mano_jugador == nil\n\t\t\t\tthen\n\t\t\t\t# lo crea con la carta seleccionada como unico elemento\n\t\t\t\tj1.mano_jugador = [@baraja [indice]]\n\t\t\telse\n\t\t\t\t# si ya esta creado (array vacio o con elementos) inserta al final del array la carta seleccionada\n\t\t\t\tj1.mano_jugador << @baraja[indice]\n\t\t\tend \n\t\t\t# pasa al siguiente jugador\n\t\t\tjugador_que_toca = Util.siguiente_jugador jugador_que_toca\n\t\t\t#saca la carta de la baraja\n\t\t\t@baraja = @baraja - [@baraja[indice]]\n\n\t\tend\n\t\t# queda un elemento en el array de baraja\n\t\t# sera para el ultimo jugador y estara en @baraja[0]\n\t\tj1 = jugadores[jugador_que_toca]\n\t\tj1.mano_jugador << @baraja[0]\n\t\t# pasa al siguiente jugador para que es al que le tocara jugar\n\t\tjugador_que_toca = Util.siguiente_jugador jugador_que_toca\n\tend",
"def ig_ind\n\t\taibc(@datos[0]).each_with_index.map{ |ind, i| (ind/aibc(@datos[1])[i])*100 }\n\tend",
"def extract(n)\n arr = []\n self.each do |x|\n arr << x[n]\n end\n return arr\n end",
"def reset \n\t\t@resultado[\"rondas\"] = 0\n\t\t@resultado[\"1\"] = 0\n\t\t@resultado[\"2\"] = 0\n\t\t@s1 = \"\"\n\t\t@s2 = \"\"\n\t\t@j1 = \"\"\n\t\t@j2 = \"\"\n\t\t@puntos = \"\"\n\t\t@rondas = \"\"\n\tend",
"def clasificar_por_imc (lista)\n \n imc_bajo = Lista.new()\n imc_normal = Lista.new()\n imc_excesivo = Lista.new()\n\n nodo = lista.extract\n \n while !(nodo.nil?)\n\n if nodo.value.datos_ant.indice_masa_corporal >= 30\n imc_excesivo.insert(nodo.value.datos_ant.indice_masa_corporal)\n elsif nodo.value.datos_ant.indice_masa_corporal >=18.5\n imc_normal.insert(nodo.value.datos_ant.indice_masa_corporal)\n else\n imc_bajo.insert(nodo.value.datos_ant.indice_masa_corporal)\n end\n nodo = lista.extract\n end\n\n \"Los IMC por debajo de lo normal son #{imc_bajo.to_s}, los IMC dentro de lo normal son #{imc_normal.to_s} y los que tienen un IMC excesivo son #{imc_excesivo.to_s}\"\n\nend",
"def header_init(width)\r\n display_arr = Array.new(width)\r\n count = width -1\r\n display_arr.each_with_index do\r\n |x, y|\r\n display_arr[y] = count\r\n count = count - 1\r\n end\r\n return display_arr\r\nend",
"def get_hidratos\n @_100=((@hidratos*100)/@peso)\n @ir_100=(@_100/260)*100\n @porcion=((@hidratos*@gramos_porciones)/@peso)\n @ir_porcion=(@porcion/260)*100\n [ @hidratos , @_100 , @ir_100.round(1) , @porcion , @ir_porcion.round(1) ]\n end",
"def index\n @funcs = Func.all\n #↖︎データを受け渡している\n\n idx = 0\n @data = []\n 5.times do |i|\n idx += 1\n place = { \"name\" => \"名前\"}\n distance = 100\n @data[i] = \"#{idx+1}: #{place['name']}: #{distance}m \"\n end\n end",
"def ndp_lla=(i); typecast i; end",
"def terreno\n\t\treturn @terreno*@cantidad\n\tend",
"def select_taguchi_array\n closest = 0\n [8, 16, 32, 64, 128, 256, 512, 1024].each do |n|\n if @num_genes <= n - 1\n closest = n\n break\n end\n end\n file_name = \"L#{closest}\"\n load_array_from_file file_name\n end",
"def initialize(nombre,ingredientes)\n @nombre = nombre\n @ingredientes = ingredientes\n food = @ingredientes.head\n @total_nutricional = 0.0\n while food != nil do\n @total_nutricional += food[:value].proteinas * (food[:value].gramos / 1000.0)\n @total_nutricional += food[:value].carbohidratos * (food[:value].gramos / 1000.0)\n @total_nutricional += food[:value].lipidos * (food[:value].gramos / 1000.0)\n food = food[:next]\n end\n end",
"def initialize(alto, ancho, alt, anc, array, n_elem)\n\t\t@alt = alto-1\n\t\t@anc = ancho-1\n\t\t@n_elem = n_elem\n\t\t@alto = Array.new(@n_elem)\n\t\t@ancho = Array.new(@n_elem)\n\t\t@elem = Array.new(@n_elem)\n\t\tfor i in(0..@n_elem-1)\n\t\t @alto[i] = alt[i]\n\t\t @ancho[i] = anc[i]\n\t\t @elem[i] = array[i]\n\t\tend\n\tend",
"def filtrarPuentes(cad)\n aux=[]\n cad.each do |elemento|\n if (elemento[0] == \"P\")\n aux.push(convertPuente(elemento))\n end\n end\n return aux # [P,[3,1],[3,5]]\nend",
"def inicializar\n categoria = gets.to_i\n case categoria\n when 1\n load 'nombres_script.rb'\n when 2\n load 'apellidos_script.rb'\n else\n load 'verbos_script.rb'\n end\n\n @respuesta = []\n @intentos = 0\n #Inicializar @limite según longitud de la palabra\n case @palabra.length\n when 0..4\n @limite = 7\n when 5..8\n @limite = 12\n when 9..15\n @limite = 20\n else\n @limite = 30\n end\n #Inicializar respuesta con guines bajos\n @palabra.length.times do |x|\n @respuesta[x] = \"_\"\n end\n return @respuesta\nend",
"def each\n\t\t@nombre\n\tend",
"def load_data(filename)\n File.open(filename, 'r').each_line do |line|\n line = line.split '\t'\n\n @moviedata[line[1].to_sym][0] += 1\n @moviedata[line[1].to_sym][1] += line[2].to_i\n\n @userdata[line[0].to_sym].push([line[1], line[2].to_i])\n \n end\n #puts numlines\n end",
"def indices\n { persona: persona_index,\n numerus: [0, 3],\n genus: [0],\n modus: [0, 6],\n tempus: [nil, nil, nil, 0, 12, 24],\n }\n end",
"def victoire\n \n [[@a1, @a2, @a3],\n [@a1, @b2, @c3],\n [@a1, @b1, @c1],\n [@b1, @b2, @b3],\n [@c1, @c2, @c3],\n [@c1, @b2, @a3],\n [@a2, @b2, @c2],\n [@a3, @b3, @c3]]\n end",
"def info_conta\n # CAMPO TAMANHO\n # agencia 4\n # complemento 1\n # conta corrente 8\n # digito da conta 1\n # complemento 6\n \"#{agencia} #{conta_corrente}#{digito_conta}#{''.rjust(6, ' ')}\"\n end"
] | [
"0.5802085",
"0.5763871",
"0.56955564",
"0.5683279",
"0.55540043",
"0.5542687",
"0.55140877",
"0.545684",
"0.545295",
"0.54402584",
"0.53586465",
"0.53525424",
"0.53054714",
"0.5277477",
"0.52665687",
"0.5254182",
"0.5229877",
"0.5223083",
"0.52073264",
"0.52040786",
"0.5201754",
"0.5195149",
"0.5186636",
"0.5177375",
"0.5167937",
"0.51669055",
"0.5159632",
"0.5155597",
"0.51541936",
"0.5146642",
"0.5136308",
"0.51279074",
"0.51224875",
"0.5107499",
"0.50874597",
"0.5076238",
"0.50597674",
"0.5057579",
"0.50522417",
"0.50504196",
"0.5045875",
"0.50406474",
"0.50330967",
"0.50330967",
"0.50206333",
"0.50162125",
"0.5009686",
"0.5009284",
"0.5008625",
"0.5006466",
"0.49990848",
"0.49975723",
"0.4986935",
"0.49869266",
"0.49827757",
"0.49824426",
"0.4981369",
"0.49781674",
"0.49772668",
"0.4964877",
"0.49644342",
"0.49594885",
"0.49509144",
"0.4950801",
"0.49472222",
"0.49402776",
"0.49266052",
"0.49173668",
"0.4917027",
"0.48960367",
"0.4877534",
"0.48765412",
"0.48709685",
"0.48704273",
"0.48605925",
"0.48561952",
"0.4842916",
"0.48415318",
"0.4838669",
"0.4830726",
"0.483006",
"0.48250547",
"0.4819797",
"0.48152012",
"0.4804526",
"0.47996566",
"0.479965",
"0.47979277",
"0.4788556",
"0.47811493",
"0.4776706",
"0.47744814",
"0.47717553",
"0.47708064",
"0.47683677",
"0.4764528",
"0.47641966",
"0.47631174",
"0.4759516",
"0.47560856"
] | 0.5728942 | 2 |
GET /armas/1 GET /armas/1.json | def show
@arma = Arma.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aroma }\n end\n end",
"def show\n @ramal = Ramal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ramal }\n end\n end",
"def show\n @arrest = Arrest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arrest }\n end\n end",
"def show\n @rua = Rua.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rua }\n end\n end",
"def show\n @reltramovano = Reltramovano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reltramovano }\n end\n end",
"def show\n @ram = Ram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ram }\n end\n end",
"def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end",
"def show\n @rayon = Rayon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rayon }\n end\n end",
"def show\n @remito = Remito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @remito }\n end\n end",
"def show\n @ami = Ami.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ami }\n end\n end",
"def show\n @arcone = Arcone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arcone }\n end\n end",
"def index\n @aromas = Aroma.order(\"lower(name) ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @aromas }\n end\n end",
"def index\n @ramais = Ramal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ramais }\n end\n end",
"def show\n @anuncio = Anuncio.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @anuncio }\n end\n end",
"def index\n @normas = Norma.all\n render json: @normas\n end",
"def show\n @razmer_go = RazmerGo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @razmer_go }\n end\n end",
"def show\n @matricula = Matricula.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @matricula }\n end\n end",
"def show\n @turma = Turma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @turma }\n end\n end",
"def show\n @imp2_raman = Imp2Raman.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imp2_raman }\n end\n end",
"def show\n @rum = Rum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rum }\n end\n end",
"def index\n @ruas = Rua.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ruas }\n end\n end",
"def show\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.json { render json: @imobiliaria }\r\n end\r\n end",
"def show\n @repa = Repa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repa }\n end\n end",
"def show\n @ar = Ar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ar }\n end\n end",
"def show\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\n @articulo = Articulo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\n @ano = Ano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ano }\n end\n end",
"def show\n @asaaddrobj = Asaaddrobj.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asaaddrobj }\n end\n end",
"def show\n @lugar = Lugar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lugar }\n end\n end",
"def show\n @torso = Torso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torso }\n end\n end",
"def show\n @realiza = Realiza.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @realiza }\n end\n end",
"def show\n @repa = Repa.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repa }\n end\n end",
"def show\n @remedio = Remedio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @remedio }\n end\n end",
"def show\n @atr = Atr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @atr }\n end\n end",
"def show\n @mapeamento = Mapeamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mapeamento }\n end\n end",
"def show\n render json: Alien.find(params[\"id\"])\n end",
"def show \n @route = Route.find(params[:id])\n \n respond_to do |format|\n format.html \n format.json { render json: @route }\n end\n end",
"def show\n @motivobaja = MotivoBaja.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @motivobaja }\n end\n end",
"def show\n @am_result = AmResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @am_result }\n end\n end",
"def show\n @aactio = Aactio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aactio }\n end\n end",
"def show\n @missionmaker = Missionmaker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @missionmaker }\n end\n end",
"def show\n @materia = Materia.find(params[:id])\n\n render json: @materia\n end",
"def show\n @litra = Litra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @litra }\n end\n end",
"def show\n @imp_raman = ImpRaman.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imp_raman }\n end\n end",
"def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end",
"def show\n @reparacion = Reparacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reparacion }\n end\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @respuesta }\n end\n end",
"def show\n @moresmallarmorinfo = Moresmallarmorinfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmallarmorinfo }\n end\n end",
"def show\r\n @asistencia = Asistencia.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @asistencia }\r\n end\r\n end",
"def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end",
"def show\n @relogio = Relogio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relogio }\n end\n end",
"def show\n @material_apoyo = MaterialApoyo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @material_apoyo }\n end\n end",
"def show\n @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @atracao }\n end\n end",
"def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end",
"def show\n @vachana = Vachana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vachana }\n end\n end",
"def new\n @aroma = Aroma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aroma }\n end\n end",
"def show\n @retroaspecto = Retroaspecto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retroaspecto }\n end\n end",
"def get_modelos\n marca = Marca.find(params[:marca_id])\n @modelos = Modelo.of_marca(marca.id)\n\n render json: @modelos\n\n end",
"def show\n @mrj = Mrj.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mrj }\n end\n end",
"def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end",
"def show\n @tarefa = Tarefa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tarefa }\n end\n end",
"def show\n @asesor = Asesor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asesor }\n end\n end",
"def index\n @repas = Repa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repas }\n end\n end",
"def show\n @vrabat = Vrabat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vrabat }\n end\n end",
"def show\n @moresmalltrial = Moresmalltrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmalltrial }\n end\n end",
"def magasin\r\n \tvil = params[:id]\r\n \tmagasin = Market.where(vil_id: vil, type_id: 5)\r\n \trender json: magasin\r\n end",
"def show\n @runway_ap = RunwayAp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @runway_ap }\n end\n end",
"def index\n @artefact = Artefact.find(params[:artefact_id])\n\n @assets = @artefact.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assets }\n end\n end",
"def display\n @json = Rma.search(params[:rmaName])\n # render :text => @json.inspect\n end",
"def show\n @mattress = Mattress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mattress }\n end\n end",
"def show\n @laundromat = Laundromat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @laundromat }\n end\n end",
"def show\n render json: @lugar\n end",
"def show\n @amplicon = Amplicon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @amplicon }\n end\n end",
"def show\n @apuesta_detail = ApuestaDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apuesta_detail }\n end\n end",
"def show\n seleccionarMenu(:rondas)\n @ronda = Ronda.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ronda }\n end\n end",
"def show\n @aliquotum = Aliquotum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aliquotum }\n end\n end",
"def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end",
"def index\n @relaciones_articulos_medida = RelacionArticuloMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @relaciones_articulos_medida }\n end\n end",
"def show\n @reprogramacion = Reprogramacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reprogramacion }\n end\n end",
"def show\n @articuloind = Articuloind.find(params[:id])\n\n \n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @articuloind }\n end\n end",
"def show\n unless possui_acesso?()\n return\n end\n @matricula = Matricula.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @matricula }\n end\n end",
"def new\n @arma = Arma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arma }\n end\n end",
"def show\n @microfilm_reel = MicrofilmReel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microfilm_reel }\n end\n end",
"def show\n @route = Route.find(params[:id])\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @route }\n end\n end",
"def show\n @reconocimiento = Reconocimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reconocimiento }\n end\n end",
"def show\n @route = Route.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @route }\n end\n end",
"def show\n @vano = Vano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vano }\n end\n end",
"def show\n puts params[:id]\n render json: Todo.find(params[:id])\n end",
"def index\n @turmas = Turma.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @turmas }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render json: @maudio}\n end\n end",
"def show\n @safra_verdoso = SafraVerdoso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @safra_verdoso }\n end\n end",
"def show\n @materia = Materia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @materia }\n end\n end",
"def show\n @galactic_arm = Galacticarm.find(params[:id])\n end",
"def show\n @safra = Safra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @safra }\n end\n end",
"def show\n @areco = Areco.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @areco }\n end\n end",
"def show\n @aquarium = Aquarium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aquarium }\n end\n end",
"def show\n @agendamento = Agendamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agendamento }\n end\n end",
"def show\n @sabor = Sabor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sabor }\n end\n end"
] | [
"0.71906567",
"0.6847012",
"0.6815357",
"0.66430825",
"0.66130096",
"0.65958613",
"0.6588227",
"0.6536431",
"0.6484815",
"0.6477601",
"0.6453134",
"0.6451618",
"0.64361244",
"0.6421455",
"0.6420411",
"0.6410161",
"0.6408766",
"0.64047074",
"0.6392062",
"0.63905627",
"0.63802326",
"0.6361435",
"0.63611466",
"0.63563275",
"0.63522464",
"0.63518846",
"0.63518846",
"0.63518846",
"0.635125",
"0.63411057",
"0.633691",
"0.63340324",
"0.6325095",
"0.63243246",
"0.63242877",
"0.6324083",
"0.63002706",
"0.62987983",
"0.6296664",
"0.6295686",
"0.6287612",
"0.6287489",
"0.6285601",
"0.6254875",
"0.6251215",
"0.6250619",
"0.62396735",
"0.6230797",
"0.6221626",
"0.62191975",
"0.6217273",
"0.620889",
"0.6207814",
"0.620592",
"0.6198024",
"0.6197358",
"0.6197358",
"0.6196604",
"0.61950225",
"0.618342",
"0.6177753",
"0.6169432",
"0.61672705",
"0.6165735",
"0.61621934",
"0.6161938",
"0.61605364",
"0.6155127",
"0.6154922",
"0.61543345",
"0.6153017",
"0.6150817",
"0.6148934",
"0.614781",
"0.6146046",
"0.6142431",
"0.6139623",
"0.61286193",
"0.61229265",
"0.6122601",
"0.61199695",
"0.6112996",
"0.61129326",
"0.61095864",
"0.60880166",
"0.6086818",
"0.6079694",
"0.60758674",
"0.60755575",
"0.6074171",
"0.6072245",
"0.6070021",
"0.60688066",
"0.6067523",
"0.6066105",
"0.6065113",
"0.6062835",
"0.6059844",
"0.6055129",
"0.6052722"
] | 0.6253763 | 44 |
GET /armas/new GET /armas/new.json | def new
@arma = Arma.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @arma }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @aroma = Aroma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aroma }\n end\n end",
"def new\n @manga = Manga.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manga }\n end\n end",
"def new\n @reltramovano = Reltramovano.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reltramovano }\n end\n end",
"def new\n @repa = Repa.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repa }\n end\n end",
"def new\n @ram = Ram.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ram }\n end\n end",
"def new\n @lugar = Lugar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lugar }\n end\n end",
"def new\n @routing = Routing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @routing }\n end\n end",
"def new\n @atr = Atr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @atr }\n end\n end",
"def new\n @ano = Ano.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ano }\n end\n end",
"def new\n @atracao = Atracao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @atracao }\n end\n end",
"def new\n @torso = Torso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @torso }\n end\n end",
"def new\n @rua = Rua.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rua }\n end\n end",
"def new\n @route = Route.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end",
"def new\n @arbitro = Arbitro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arbitro }\n end\n end",
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end",
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end",
"def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @route }\n end\n end",
"def new\n @tarefa = Tarefa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tarefa }\n end\n end",
"def new\n @marina = Marina.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @marina }\n end\n end",
"def new\n @turma = Turma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @turma }\n end\n end",
"def new\n @ramal = Ramal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ramal }\n end\n end",
"def new\n @asaaddrobj = Asaaddrobj.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asaaddrobj }\n end\n end",
"def new\n @requerimiento = Requerimiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @requerimiento }\n end\n end",
"def new\n @ar = Ar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @ar }\n end\n end",
"def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recurso }\n end\n end",
"def new\n @laundromat = Laundromat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @laundromat }\n end\n end",
"def new\n @torneo = Torneo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @torneo }\n end\n end",
"def new\n @agronomiaquimica = Agronomiaquimica.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end",
"def new\n @slam = Slam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slam }\n end\n end",
"def new\n @aactio = Aactio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aactio }\n end\n end",
"def new\n @arcone = Arcone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arcone }\n end\n end",
"def new\n @articulo = Articulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @articulo }\n end\n end",
"def new\n @articulo = Articulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @articulo }\n end\n end",
"def new\n @articulo = Articulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @articulo }\n end\n end",
"def new\n @articulo = Articulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @articulo }\n end\n end",
"def new\n @retroalimentacion = Retroalimentacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @retroalimentacion }\n end\n end",
"def new\n @sala = Sala.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sala }\n end\n end",
"def new\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aviso }\n end\n end",
"def new\n @trnodo = Trnodo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trnodo }\n end\n end",
"def new\n @caixa = Caixa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caixa }\n end\n end",
"def new\n @asesor = Asesor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asesor }\n end\n end",
"def new\n @remito = Remito.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @remito }\n end\n end",
"def new\n @missionmaker = Missionmaker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @missionmaker }\n end\n end",
"def new\n @respuesta = Respuesta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @respuesta }\n end\n end",
"def new\n @artigo = Artigo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @artigo }\n end\n end",
"def new\n @carrera = Carrera.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @carrera }\n end\n end",
"def new\n @lbaa = Lbaa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lbaa }\n end\n end",
"def new\n DebugLog(params.inspect)\n @lancamentorapido = Lancamentorapido.new\n \n @categorias = Category.all\n @centrosdecusto = Centrodecusto.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lancamentorapido }\n end\n end",
"def new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end",
"def new\n @distro = Distro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distro }\n end\n end",
"def new\n @sistema = Sistema.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sistema }\n end\n end",
"def new\r\n @antenne = Antenne.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @antenne }\r\n end\r\n end",
"def new\n @asociado = Asociado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asociado }\n end\n end",
"def new\n @actore = Actore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @actore }\n end\n end",
"def new\n @safra_verdoso = SafraVerdoso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @safra_verdoso }\n end\n end",
"def new\n @razmer_go = RazmerGo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @razmer_go }\n end\n end",
"def new\n @reparacion = Reparacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reparacion }\n end\n end",
"def new\n @recinto = Recinto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recinto }\n end\n end",
"def new\n @presenza = Presenza.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @presenza }\n end\n end",
"def new\n @zoneamento = Zoneamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @zoneamento }\n end\n end",
"def new\n @orgao = Orgao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @orgao }\n end\n end",
"def new\n @tare = Tare.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tare }\n end\n end",
"def new\n @rayon = Rayon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rayon }\n end\n end",
"def new\n @archivo = Archivo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @archivo }\n end\n end",
"def new\n @selecao = Selecao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @selecao }\n end\n end",
"def new\n @motivobaja = MotivoBaja.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @motivobaja }\n end\n end",
"def new\n @areco = Areco.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @areco }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @alley }\n end\n end",
"def new\n @livro = Livro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @livro }\n end\n end",
"def new\n @amplicon = Amplicon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @amplicon }\n end\n end",
"def new\n @control_asistencia = ControlAsistencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @control_asistencia }\n end\n end",
"def new\n @safra_averiado = SafraAveriado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @safra_averiado }\n end\n end",
"def new\n @reconocimiento = Reconocimiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @reconocimiento }\n end\n end",
"def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @premio }\n end\n end",
"def new\n @asignatura = Asignatura.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @asignatura }\n end\n end",
"def new\n @vocacionada = Vocacionada.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vocacionada }\n end\n end",
"def new\n @pto = Pto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pto }\n end\n end",
"def new\n @apuesta_detail = ApuestaDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @apuesta_detail }\n end\n end",
"def new\n @vano = Vano.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vano }\n end\n end",
"def new\n @prioridade = Prioridade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prioridade }\n end\n end",
"def new\n respond_to do |format|\n format.json { render json: { :army_id => nil} }\n end\n end",
"def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @premio }\n end\n end",
"def new\n @tea = Tea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tea }\n end\n end",
"def new\n @tea = Tea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tea }\n end\n end",
"def new\n unless possui_acesso?()\n return\n end\n @matricula = Matricula.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @matricula }\n end\n end",
"def new\n @empresa = Empresa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @empresa }\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 new\n @assembly = Assembly.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assembly }\n end\n end",
"def new\n @lore = Lore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lore }\n end\n end",
"def new\n @safra = Safra.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @safra }\n end\n end",
"def new\n @arrival = Arrival.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arrival }\n end\n end",
"def new\n @arrival = Arrival.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arrival }\n end\n end",
"def new\n @rum = Rum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rum }\n end\n end",
"def new\r\n @salle = Salle.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @salle }\r\n end\r\n end",
"def new\n @caracteristica_imovel = CaracteristicaImovel.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caracteristica_imovel }\n end\n end",
"def new\n @termin = Termin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @termin }\n end\n end",
"def new\n @modelo = Modelo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @modelo }\n end\n end",
"def new\n @retro = Retro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @retro }\n end\n end",
"def new\n @situacao_avaliacao = SituacaoAvaliacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @situacao_avaliacao }\n end\n end",
"def new\n @origami = Origami.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @origami }\n end\n end"
] | [
"0.7549714",
"0.7383404",
"0.7377255",
"0.7367986",
"0.730991",
"0.72938913",
"0.72883743",
"0.72838646",
"0.72799796",
"0.7267717",
"0.72607434",
"0.72563845",
"0.72356594",
"0.7224617",
"0.7216198",
"0.7216198",
"0.7216198",
"0.7209998",
"0.7201315",
"0.71820986",
"0.7179988",
"0.7161758",
"0.7154003",
"0.71503645",
"0.7132991",
"0.7119345",
"0.7111329",
"0.70878637",
"0.70813274",
"0.7077122",
"0.70759803",
"0.707448",
"0.707448",
"0.707448",
"0.707448",
"0.70722514",
"0.7052298",
"0.705158",
"0.7050355",
"0.7050326",
"0.7047509",
"0.7033974",
"0.7027928",
"0.70257086",
"0.7015086",
"0.7008783",
"0.6994188",
"0.6986917",
"0.698394",
"0.698394",
"0.6982537",
"0.69768924",
"0.6975793",
"0.6972491",
"0.6971029",
"0.6966743",
"0.696455",
"0.6963186",
"0.69561225",
"0.6952937",
"0.6950522",
"0.6944735",
"0.69429505",
"0.69399554",
"0.69381344",
"0.69375235",
"0.69358635",
"0.6935085",
"0.69245976",
"0.69230485",
"0.6922331",
"0.69185144",
"0.6916476",
"0.6913582",
"0.690798",
"0.69037616",
"0.6897057",
"0.68893397",
"0.6888817",
"0.68864346",
"0.6882016",
"0.68806887",
"0.6880189",
"0.6880189",
"0.68782496",
"0.6877823",
"0.6874104",
"0.68738145",
"0.6873543",
"0.6872083",
"0.68718845",
"0.68718845",
"0.6871221",
"0.6863371",
"0.68632627",
"0.68592006",
"0.68588823",
"0.68508905",
"0.68485326",
"0.6845893"
] | 0.74300873 | 1 |
POST /armas POST /armas.json | def create
@arma = Arma.new(params[:arma])
respond_to do |format|
if @arma.save
format.html { redirect_to @arma, notice: 'Arma was successfully created.' }
format.json { render json: @arma, status: :created, location: @arma }
else
format.html { render action: "new" }
format.json { render json: @arma.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @armazena = Armazena.new(armazena_params)\n\n respond_to do |format|\n if @armazena.save\n format.html { redirect_to @armazena, notice: 'Armazena was successfully created.' }\n format.json { render :show, status: :created, location: @armazena }\n else\n format.html { render :new }\n format.json { render json: @armazena.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @aroma = Aroma.new(params[:aroma])\n\n respond_to do |format|\n if @aroma.save\n format.html { redirect_to @aroma, notice: 'Aroma was successfully created.' }\n format.json { render json: @aroma, status: :created, location: @aroma }\n else\n format.html { render action: \"new\" }\n format.json { render json: @aroma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @marca = Marca.new(marca_params)\n if @marca.save\n render json: @marca\n else\n render json: @marca.errors, status: :unprocessable_entity \n end\n end",
"def create\n @ramal = Ramal.new(params[:ramal])\n\n respond_to do |format|\n if @ramal.save\n format.html { redirect_to @ramal, notice: 'Ramal criado com sucesso!' }\n format.json { render json: @ramal, status: :created, location: @ramal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ramal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asana = Asana.new(asana_params)\n\n respond_to do |format|\n if @asana.save\n format.html { redirect_to @asana, notice: 'Asana criado com sucesso.' }\n format.json { render :show, status: :created, location: @asana }\n else\n format.html { render :new }\n format.json { render json: @asana.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asama_tanim = AsamaTanim.new(asama_tanim_params)\n\n respond_to do |format|\n if @asama_tanim.save\n format.html { redirect_to @asama_tanim, notice: 'Asama tanim was successfully created.' }\n format.json { render :show, status: :created, location: @asama_tanim }\n else\n format.html { render :new }\n format.json { render json: @asama_tanim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ar = Ar.new(params[:ar])\n\n respond_to do |format|\n if @ar.save\n format.html { redirect_to @ar, :notice => 'Ar was successfully created.' }\n format.json { render :json => @ar, :status => :created, :location => @ar }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @ar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end",
"def create\n @artesano = Artesano.new(artesano_params)\n\n respond_to do |format|\n if @artesano.save\n format.html { redirect_to @artesano, notice: 'Artesano was successfully created.' }\n format.json { render :show, status: :created, location: @artesano }\n else\n format.html { render :new }\n format.json { render json: @artesano.errors, status: :unprocessable_entity }\n end\n end\n end",
"def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end",
"def create\n @manga = Manga.new(manga_params)\n\n respond_to do |format|\n if @manga.save\n format.html { redirect_to @manga, notice: 'Manga was successfully created.' }\n format.json { render :show, status: :created, location: @manga }\n else\n format.html { render :new }\n format.json { render json: @manga.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lugar = Lugar.new(lugar_params)\n\n if @lugar.save\n render json: @lugar, status: :created, location: @lugar\n else\n render json: @lugar.errors, status: :unprocessable_entity\n end\n end",
"def create\n @galactic_arm = Galacticarm.new(galactic_arm_params)\n\n respond_to do |format|\n if @galactic_arm.save\n format.html { redirect_to @galactic_arm, notice: 'Galactic arm was successfully created.' }\n format.json { render :show, status: :created, location: @galactic_arm }\n else\n format.html { render :new }\n format.json { render json: @galactic_arm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @arbitro = Arbitro.new(params[:arbitro])\n\n respond_to do |format|\n if @arbitro.save\n format.html { redirect_to @arbitro, notice: 'El Arbitro se ha creado con exito.' }\n format.json { render json: @arbitro, status: :created, location: @arbitro }\n else\n format.html { render action: \"new\" }\n format.json { render json: @arbitro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ra = Ra.new(ra_params)\n\n respond_to do |format|\n if @ra.save\n format.html { redirect_to @ra, notice: 'Ra was successfully created.' }\n format.json { render :show, status: :created, location: @ra }\n else\n format.html { render :new }\n format.json { render json: @ra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @torneo_apartura = TorneoApartura.new(torneo_apartura_params)\n\n respond_to do |format|\n if @torneo_apartura.save\n format.html { redirect_to @torneo_apartura, notice: 'Torneo apartura was successfully created.' }\n format.json { render :show, status: :created, location: @torneo_apartura }\n else\n format.html { render :new }\n format.json { render json: @torneo_apartura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @magasin = Magasin.new(magasin_params)\n\n respond_to do |format|\n if @magasin.save\n format.html { redirect_to @magasin, notice: 'Magasin was successfully created.' }\n format.json { render :show, status: :created, location: @magasin }\n else\n format.html { render :new }\n format.json { render json: @magasin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @rua = Rua.new(params[:rua])\n\n respond_to do |format|\n if @rua.save\n format.html { redirect_to @rua, notice: 'Rua was successfully created.' }\n format.json { render json: @rua, status: :created, location: @rua }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rua.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @anuncio = Anuncio.new(anuncio_params)\n\n if @anuncio.save\n render :show, status: :created, location: @anuncio\n else\n render json: @anuncio.errors, status: :unprocessable_entity\n end\n end",
"def create\n @ram = Ram.new(params[:ram])\n\n respond_to do |format|\n if @ram.save\n format.html { redirect_to @ram, notice: 'Ram was successfully created.' }\n format.json { render json: @ram, status: :created, location: @ram }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ram.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @long_arm = LongArm.new(long_arm_params)\n\n respond_to do |format|\n if @long_arm.save\n format.html { redirect_to @long_arm, notice: 'Long arm was successfully created.' }\n format.json { render :show, status: :created, location: @long_arm }\n else\n format.html { render :new }\n format.json { render json: @long_arm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_route(payload)\n with_rescue do\n payload = payload.to_json if payload.is_a?(Hash)\n connection.post do |request|\n request.url routes_path\n request.body = payload\n request.headers['Content-Type'] = 'application/json'\n end\n end\n end",
"def create\n @ram_post = RamPost.new(ram_post_params)\n\n respond_to do |format|\n if @ram_post.save\n format.html { redirect_to @ram_post, notice: 'Ram post was successfully created.' }\n format.json { render :show, status: :created, location: @ram_post }\n else\n format.html { render :new }\n format.json { render json: @ram_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @drama = current_user.dramas.build(drama_params)\n\n respond_to do |format|\n if @drama.save\n format.html { redirect_to @drama, notice: 'Drama was successfully created.' }\n format.json { render :show, status: :created, location: @drama }\n else\n format.html { render :new }\n format.json { render json: @drama.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @alejandro = Alejandro.new(alejandro_params)\n\n respond_to do |format|\n if @alejandro.save\n format.html { redirect_to @alejandro, notice: 'Alejandro was successfully created.' }\n format.json { render :show, status: :created, location: @alejandro }\n else\n format.html { render :new }\n format.json { render json: @alejandro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asaaddrobj = Asaaddrobj.new(params[:asaaddrobj])\n\n respond_to do |format|\n if @asaaddrobj.save\n format.html { redirect_to @asaaddrobj, notice: 'Asaaddrobj was successfully created.' }\n format.json { render json: @asaaddrobj, status: :created, location: @asaaddrobj }\n else\n format.html { render action: \"new\" }\n format.json { render json: @asaaddrobj.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rozmiar = Rozmiar.new(rozmiar_params)\n\n respond_to do |format|\n if @rozmiar.save\n format.html { redirect_to @rozmiar, notice: 'Rozmiar was successfully created.' }\n format.json { render :show, status: :created, location: @rozmiar }\n else\n format.html { render :new }\n format.json { render json: @rozmiar.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rayon = Rayon.new(params[:rayon])\n\n respond_to do |format|\n if @rayon.save\n format.html { redirect_to @rayon, notice: 'Rayon was successfully created.' }\n format.json { render json: @rayon, status: :created, location: @rayon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rayon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @alram_test = AlramTest.new(alram_test_params)\n\n respond_to do |format|\n if @alram_test.save\n format.html { redirect_to @alram_test, notice: 'Alram test was successfully created.' }\n format.json { render :show, status: :created, location: @alram_test }\n else\n format.html { render :new }\n format.json { render json: @alram_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reltramovano = Reltramovano.new(params[:reltramovano])\n\n respond_to do |format|\n if @reltramovano.save\n format.html { redirect_to @reltramovano, notice: 'Reltramovano was successfully created.' }\n format.json { render json: @reltramovano, status: :created, location: @reltramovano }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reltramovano.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @manga = Manga.new(manga_params)\n @manga.tags = @params_tags\n @manga.author = @author\n\n respond_to do |format|\n if @manga.save\n format.html { redirect_to @manga, notice: 'Manga was successfully created.' }\n format.json { render :show, status: :created, location: @manga }\n else\n format.html { render :new }\n format.json { render json: @manga.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @turma = Turma.new(params[:turma])\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to @turma, notice: 'Turma criada com sucesso.' }\n format.json { render json: @turma, status: :created, location: @turma }\n else\n format.html { render action: \"new\" }\n format.json { render json: @turma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @arcone = Arcone.new(params[:arcone])\n\n respond_to do |format|\n if @arcone.save\n format.html { redirect_to @arcone, notice: 'Arcone was successfully created.' }\n format.json { render json: @arcone, status: :created, location: @arcone }\n else\n format.html { render action: \"new\" }\n format.json { render json: @arcone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @marca = Marca.new(marca_params)\n\n respond_to do |format|\n if @marca.save\n format.html { redirect_to @marca, notice: \"Marca was successfully created.\" }\n format.json { render :show, status: :created, location: @marca }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @marca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @norma = Norma.new(norma_params)\n\n if @norma.save\n render :show, status: :created, location: @norma\n else\n render json: @norma.errors, status: :unprocessable_entity\n end\n end",
"def create\n @amu = Amu.new(amu_params)\n\n respond_to do |format|\n if @amu.save\n format.html { redirect_to @amu, notice: 'Amu was successfully created.' }\n format.json { render action: 'show', status: :created, location: @amu }\n else\n format.html { render action: 'new' }\n format.json { render json: @amu.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @arma = Arma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @arma }\n end\n end",
"def create\n @atracao = Atracao.new(params[:atracao])\n\n respond_to do |format|\n if @atracao.save\n format.html { redirect_to @atracao, :notice => 'Atracao was successfully created.' }\n format.json { render :json => @atracao, :status => :created, :location => @atracao }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @atracao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @the_rasp = TheRasp.new(the_rasp_params)\n\n respond_to do |format|\n if @the_rasp.save\n format.html { redirect_to @the_rasp, notice: 'The rasp was successfully created.' }\n format.json { render :show, status: :created, location: @the_rasp }\n else\n format.html { render :new }\n format.json { render json: @the_rasp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @safra_averiado = SafraAveriado.new(params[:safra_averiado])\n\n respond_to do |format|\n if @safra_averiado.save\n format.html { redirect_to @safra_averiado, notice: 'Safra averiado was successfully created.' }\n format.json { render json: @safra_averiado, status: :created, location: @safra_averiado }\n else\n format.html { render action: \"new\" }\n format.json { render json: @safra_averiado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def create\n @tipoapreensao = Tipoapreensao.new(tipoapreensao_params)\n\n respond_to do |format|\n if @tipoapreensao.save\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tipoapreensao }\n else\n format.html { render action: 'new' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @motorista = Motorista.new(motorista_params)\n\n respond_to do |format|\n if @motorista.save\n format.html { redirect_to @motorista, notice: 'Motorista was successfully created.' }\n format.json { render :show, status: :created, location: @motorista }\n else\n format.html { render :new }\n format.json { render json: @motorista.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n cartoon_ad = CartoonAd.create(cartoon_ad_params)\n render json: cartoon_ad\n end",
"def androidreserva\n\n @reservas = Reservation.all\n \n \n\n render :json => {\n :reservas => @reservas\n \n\n }\n\n \n end",
"def create\n @tarefa = Tarefa.new(params[:tarefa])\n\n respond_to do |format|\n if @tarefa.save\n format.html { redirect_to @tarefa, notice: 'Tarefa was successfully created.' }\n format.json { render json: @tarefa, status: :created, location: @tarefa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @turma = Turma.new(turma_params)\n @turma.usuario = current_usuario\n @turma.turma_ativa = true\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to turmas_path, notice: 'Turma salva com sucesso.' }\n format.json { render :show, status: :created, location: @turma }\n else\n format.html { render :new }\n format.json { render json: @turma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @agronomiaquimica = Agronomiaquimica.new(params[:agronomiaquimica])\n\n respond_to do |format|\n if @agronomiaquimica.save\n format.html { redirect_to @agronomiaquimica, notice: 'Agronomiaquimica was successfully created.' }\n format.json { render json: @agronomiaquimica, status: :created, location: @agronomiaquimica }\n else\n format.html { render action: \"new\" }\n format.json { render json: @agronomiaquimica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @jra = Jra.new(jra_params)\n\n respond_to do |format|\n if @jra.save\n format.html { redirect_to @jra, notice: 'Jra was successfully created.' }\n format.json { render :show, status: :created, location: @jra }\n else\n format.html { render :new }\n format.json { render json: @jra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @azul = Azul.new(azul_params)\n\n respond_to do |format|\n if @azul.save\n format.html { redirect_to @azul, notice: 'Azul was successfully created.' }\n format.json { render :show, status: :created, location: @azul }\n else\n format.html { render :new }\n format.json { render json: @azul.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @responsavel = Responsavel.new(responsavel_params)\n\n if @responsavel.save\n render json: @responsavel, status: :created, location: @responsavel\n else\n render json: @responsavel.errors, status: :unprocessable_entity\n end\n end",
"def create\n @astronomium = Astronomium.new(astronomium_params)\n\n respond_to do |format|\n if @astronomium.save\n format.html { redirect_to @astronomium, notice: 'Astronomium was successfully created.' }\n format.json { render :show, status: :created, location: @astronomium }\n else\n format.html { render :new }\n format.json { render json: @astronomium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @masut_assay = MasutAssay.new(params[:masut_assay])\n\n respond_to do |format|\n if @masut_assay.save\n format.html { redirect_to masut_assays_url, notice: 'Данные нового анализа мазута успешно записаны.' }\n format.json { render json: @masut_assay, status: :created, location: @masut_assay }\n else\n format.html { render action: \"new\" }\n format.json { render json: @masut_assay.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @safra = Safra.new(params[:safra])\n\n respond_to do |format|\n if @safra.save\n format.html { redirect_to @safra }\n else\n format.html { render action: \"new\" }\n format.json { render json: @safra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @marina = Marina.new(params[:marina])\n\n respond_to do |format|\n if @marina.save\n format.html { redirect_to @marina, notice: 'Marina was successfully created.' }\n format.json { render json: @marina, status: :created, location: @marina }\n else\n format.html { render action: \"new\" }\n format.json { render json: @marina.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vacuna = Vacuna.new(vacuna_params)\n @vacuna.mascota_id = @mascota.id\n respond_to do |format|\n if @vacuna.save\n format.html { redirect_to @vacuna, notice: 'Vacuna Agregada exitosamente' }\n format.json { render :show, status: :created, location: @vacuna }\n else\n format.html { render :new }\n format.json { render json: @vacuna.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asesor = Asesor.new(params[:asesor])\n\n respond_to do |format|\n if @asesor.save\n format.html { redirect_to @asesor, notice: 'Asesor was successfully created.' }\n format.json { render json: @asesor, status: :created, location: @asesor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @asesor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @atr = Atr.new(params[:atr])\n\n respond_to do |format|\n if @atr.save\n format.html { redirect_to @atr, notice: 'Atr was successfully created.' }\n format.json { render json: @atr, status: :created, location: @atr }\n else\n format.html { render action: \"new\" }\n format.json { render json: @atr.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @postavka = Postavka.new(postavka_params)\n\n respond_to do |format|\n if @postavka.save\n format.html { redirect_to @postavka, notice: 'Postavka was successfully created.' }\n format.json { render action: 'show', status: :created, location: @postavka }\n else\n format.html { render action: 'new' }\n format.json { render json: @postavka.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @aroma = Aroma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aroma }\n end\n end",
"def create\n @roupa = Roupa.new(roupa_params)\n\n respond_to do |format|\n if @roupa.save\n format.html { redirect_to @roupa, notice: \"Roupa was successfully created.\" }\n format.json { render :show, status: :created, location: @roupa }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @roupa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@alejandro = Alejandro.new(alejandro_params)\n\n\t\trespond_to do |format|\n\t\t\tif @alejandro.save\n\t\t\t\tformat.html { redirect_to alejandros_path, notice: 'Alejandro was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @alejandro }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @alejandro.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @aactio = Aactio.new(params[:aactio])\n\n respond_to do |format|\n if @aactio.save\n format.html { redirect_to @aactio, notice: 'Aactio was successfully created.' }\n format.json { render json: @aactio, status: :created, location: @aactio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @aactio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_appdefn(to_hash)\n end",
"def create\n apartment = Apartment.create(apartment_params)\n render json: apartment\n end",
"def create\n @repa = Repa.new(params[:repa])\n\n respond_to do |format|\n if @repa.save\n format.html { redirect_to repas_url, notice: 'Repa was successfully created.' }\n format.json { render json: @repa, status: :created, location: @repa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @repa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @archdiocese = Archdiocese.new(archdiocese_params)\n\n if @archdiocese.save\n render json: @archdiocese, status: :created, location: @archdiocese\n else\n render json: @archdiocese.errors, status: :unprocessable_entity\n end\n end",
"def create\n @restora = Restora.new(restora_params)\n\n respond_to do |format|\n if @restora.save\n format.html { redirect_to @restora, notice: 'Restora was successfully created.' }\n format.json { render :show, status: :created, location: @restora }\n else\n format.html { render :new }\n format.json { render json: @restora.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @administracao_rota = Administracao::Rota.new(administracao_rota_params)\n\n respond_to do |format|\n if @administracao_rota.save\n format.html { redirect_to @administracao_rota, notice: 'Rota foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @administracao_rota }\n else\n format.html { render :new }\n format.json { render json: @administracao_rota.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @arl = Arl.new(arl_params)\n\n respond_to do |format|\n if @arl.save\n format.html { redirect_to @arl, notice: 'Arl was successfully created.' }\n format.json { render :show, status: :created, location: @arl }\n else\n format.html { render :new }\n format.json { render json: @arl.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @torso = Torso.new(params[:torso])\n\n respond_to do |format|\n if @torso.save\n format.html { redirect_to @torso, notice: 'Torso was successfully created.' }\n format.json { render json: @torso, status: :created, location: @torso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @torso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @metar_raport = MetarRaport.new(metar_raport_params)\n\n respond_to do |format|\n if @metar_raport.save\n format.html { redirect_to @metar_raport, notice: 'Metar raport was successfully created.' }\n format.json { render :show, status: :created, location: @metar_raport }\n else\n format.html { render :new }\n format.json { render json: @metar_raport.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @horario_alarma = HorarioAlarma.new(horario_alarma_params)\n\n respond_to do |format|\n if @horario_alarma.save\n format.html { redirect_to @horario_alarma, notice: 'Horario alarma was successfully created.' }\n format.json { render :show, status: :created, location: @horario_alarma }\n else\n format.html { render :new }\n format.json { render json: @horario_alarma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @arrendatario = Arrendatario.new(arrendatario_params)\n\n respond_to do |format|\n if @arrendatario.save\n format.html { redirect_to @arrendatario, notice: 'Arrendatario was successfully created.' }\n format.json { render :show, status: :created, location: @arrendatario }\n else\n format.html { render :new }\n format.json { render json: @arrendatario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @materia = Materia.new(params[:materia])\n\n if @materia.save\n render json: @materia, status: :created, location: @materia\n else\n render json: @materia.errors, status: :unprocessable_entity\n end\n end",
"def create\n @pharm = Pharm.new(pharm_params)\n @pharm.user_id = current_user.id\n\n respond_to do |format|\n if @pharm.save\n format.html { redirect_to @pharm, notice: 'Pharm was successfully created.' }\n format.json { render :show, status: :created, location: @pharm }\n else\n format.html { render :new }\n format.json { render json: @pharm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mapeamento = Mapeamento.new(params[:mapeamento])\n\n respond_to do |format|\n if @mapeamento.save\n format.html { redirect_to @mapeamento, notice: 'Mapeamento was successfully created.' }\n format.json { render json: @mapeamento, status: :created, location: @mapeamento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mapeamento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @razdel = Razdel.new(razdel_params)\n\n respond_to do |format|\n if @razdel.save\n format.html { redirect_to @razdel, notice: 'Razdel was successfully created.' }\n format.json { render :show, status: :created, location: @razdel }\n else\n format.html { render :new }\n format.json { render json: @razdel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @regra = Regra.new(regra_params)\n\n respond_to do |format|\n if @regra.save\n format.html { redirect_to @regra, notice: 'Regra was successfully created.' }\n format.json { render :show, status: :created, location: @regra }\n else\n format.html { render :new }\n format.json { render json: @regra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ulasan = Ulasan.new(ulasan_params)\n\n if @ulasan.save\n render :show, status: :created, location: @ulasan\n else\n render json: @ulasan.errors, status: :unprocessable_entity\n end\n end",
"def create\n @imp2_raman = Imp2Raman.new(params[:imp2_raman])\n\n respond_to do |format|\n if @imp2_raman.save\n format.html { redirect_to @imp2_raman, notice: 'Imp2 raman was successfully created.' }\n format.json { render json: @imp2_raman, status: :created, location: @imp2_raman }\n else\n format.html { render action: \"new\" }\n format.json { render json: @imp2_raman.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @matricula = Matricula.new(matricula_params)\n\n respond_to do |format|\n if @matricula.save\n format.html { redirect_to @matricula, notice: 'Matricula was successfully created.' }\n format.json { render json: @matricula, status: :created, location: @matricula }\n else\n format.html { render action: \"new\" }\n format.json { render json: @matricula.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @Empresa = Empresa.find(params[:empresa_id])\n p simulacion_params[:id]\n if simulacion_params[:id]!=nil\n respond_to do |format| \n format.html { render json: 1 and return}\n end\n end\n [email protected](simulacion_params)\n respond_to do |format|\n if simulacion.save\n format.html { render json: {simulacion:simulacion}}\n else\n format.html { render action: simulacion.errors }\n end\n end\n end",
"def create\n @verma = Verma.new(verma_params)\n\n respond_to do |format|\n if @verma.save\n format.html { redirect_to @verma, notice: 'Verma was successfully created.' }\n format.json { render :show, status: :created, location: @verma }\n else\n format.html { render :new }\n format.json { render json: @verma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @odeme_akademist = Odeme::Akademist.new(params[:odeme_akademist])\n\n respond_to do |format|\n if @odeme_akademist.save\n format.html { redirect_to @odeme_akademist, notice: 'Akademist was successfully created.' }\n format.json { render json: @odeme_akademist, status: :created, location: @odeme_akademist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @odeme_akademist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pharma = Pharma.new(pharma_params)\n\n respond_to do |format|\n if @pharma.save\n format.html { redirect_to @pharma, notice: 'Pharma was successfully created.' }\n format.json { render :show, status: :created, location: @pharma }\n else\n format.html { render :new }\n format.json { render json: @pharma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @turma = @disciplina.turmas.new(turma_params)\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to @turma, notice: 'A Turma foi criada com sucesso.' }\n format.json { render action: 'show', status: :created, location: @turma }\n else\n format.html { render action: 'new' }\n format.json { render json: @turma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rastreamento = Rastreamento.new(rastreamento_params)\n\n respond_to do |format|\n if @rastreamento.save\n format.html { redirect_to @rastreamento, notice: 'Rastreamento was successfully created.' }\n format.json { render :show, status: :created, location: @rastreamento }\n else\n format.html { render :new }\n format.json { render json: @rastreamento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rotina = Rotina.new(rotina_params)\n @rotina.user = current_user\n respond_to do |format|\n if @rotina.save\n format.html { redirect_to rotinas_path, notice: 'Rotina criada com sucesso.' }\n format.json { render action: 'show', status: :created, location: @rotina }\n else\n format.html { render action: 'new' }\n format.json { render json: @rotina.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @testmonial = Testmonial.new(testmonial_params)\n\n if @testmonial.save\n render json: @testmonial, status: :created\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end",
"def create\n @oferta_academica = OfertaAcademica.new(params[:oferta_academica])\n\n if @oferta_academica.save\n render json: @oferta_academica, status: :created, location: @oferta_academica\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end",
"def create\n @klasa = Klasa.new(klasa_params)\n\n respond_to do |format|\n if @klasa.save\n format.html { redirect_to @klasa, notice: 'Klasa was successfully created.' }\n format.json { render :show, status: :created, location: @klasa }\n else\n format.html { render :new }\n format.json { render json: @klasa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @raindrop = Raindrop.new(raindrop_params)\n\n respond_to do |format|\n if @raindrop.save\n format.html { redirect_to @raindrop, notice: 'Raindrop was successfully created.' }\n format.json { render :show, status: :created, location: @raindrop }\n else\n format.html { render :new }\n format.json { render json: @raindrop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @runway_ap = RunwayAp.new(params[:runway_ap])\n\n respond_to do |format|\n if @runway_ap.save\n format.html { redirect_to @runway_ap, notice: 'Runway ap was successfully created.' }\n format.json { render json: @runway_ap, status: :created, location: @runway_ap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @runway_ap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ami = Ami.new(params[:ami])\n\n respond_to do |format|\n if @ami.save\n format.html { redirect_to @ami, notice: 'Ami was successfully created.' }\n format.json { render json: @ami, status: :created, location: @ami }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ami.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @imp_raman = ImpRaman.new(params[:imp_raman])\n\n respond_to do |format|\n if @imp_raman.save\n format.html { redirect_to @imp_raman, notice: 'Imp raman was successfully created.' }\n format.json { render json: @imp_raman, status: :created, location: @imp_raman }\n else\n format.html { render action: \"new\" }\n format.json { render json: @imp_raman.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asignatura = Asignatura.new(asignatura_params)\n\n respond_to do |format|\n if @asignatura.save\n format.json { render json: \"Asignatura Creada\", status: :created, location: @asignatura }\n else\n format.json { render json: @asignatura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @azienda = Azienda.new(azienda_params)\n\n respond_to do |format|\n if @azienda.save\n format.html { redirect_to @azienda, notice: 'Azienda was successfully created.' }\n format.json { render :show, status: :created, location: @azienda }\n else\n format.html { render :new }\n format.json { render json: @azienda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @retroalimentacion = Retroalimentacion.new(params[:retro])\n\n respond_to do |format|\n if @retroalimentacion.save\n format.html { redirect_to @retroalimentacion, notice: 'Retroalimentacion was successfully created.' }\n format.json { render json: @retroalimentacion, status: :created, location: @retroalimentacion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @retroalimentacion.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.6315217",
"0.63119906",
"0.6170182",
"0.6012161",
"0.59608924",
"0.592838",
"0.5910538",
"0.5907308",
"0.5897372",
"0.58575916",
"0.5857578",
"0.5840712",
"0.58275205",
"0.5826234",
"0.5800352",
"0.57831806",
"0.57798153",
"0.576889",
"0.57540303",
"0.57385564",
"0.5730596",
"0.572675",
"0.5724054",
"0.57167417",
"0.57157415",
"0.5713591",
"0.57002664",
"0.5685685",
"0.5682922",
"0.56825566",
"0.56788",
"0.5678793",
"0.56616205",
"0.5658964",
"0.5654248",
"0.56522",
"0.56397665",
"0.56393856",
"0.5631258",
"0.56290877",
"0.562232",
"0.56026536",
"0.5587886",
"0.5586865",
"0.5575994",
"0.55730134",
"0.5570313",
"0.5566228",
"0.5564663",
"0.555955",
"0.55578315",
"0.55437785",
"0.5531642",
"0.5531029",
"0.55304956",
"0.5521684",
"0.5515093",
"0.5514614",
"0.55117327",
"0.55039144",
"0.55037594",
"0.5502443",
"0.54966724",
"0.54962295",
"0.54932576",
"0.54838747",
"0.5477099",
"0.54673433",
"0.5461272",
"0.5454819",
"0.5451558",
"0.5450877",
"0.5428605",
"0.5422614",
"0.5421643",
"0.54156",
"0.5413251",
"0.5412903",
"0.5411649",
"0.54050326",
"0.5404695",
"0.5404617",
"0.5402917",
"0.53992933",
"0.53984475",
"0.5396692",
"0.5390107",
"0.5389117",
"0.537566",
"0.5374682",
"0.5370166",
"0.5367925",
"0.53664154",
"0.5366079",
"0.53660107",
"0.5360351",
"0.5358615",
"0.5356041",
"0.53536534",
"0.53523225"
] | 0.6746256 | 0 |
PUT /armas/1 PUT /armas/1.json | def update
@arma = Arma.find(params[:id])
respond_to do |format|
if @arma.update_attributes(params[:arma])
format.html { redirect_to @arma, notice: 'Arma was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @arma.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n if @aroma.update_attributes(params[:aroma])\n format.html { redirect_to @aroma, notice: 'Aroma was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aroma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def put url, payload\n RestClient::Request.execute(:method => :put, :url => url, :payload => payload, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def update\n respond_to do |format|\n if @galactic_arm.update(galactic_arm_params)\n format.html { redirect_to @galactic_arm, notice: 'Galactic arm was successfully updated.' }\n format.json { render :show, status: :ok, location: @galactic_arm }\n else\n format.html { render :edit }\n format.json { render json: @galactic_arm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end",
"def set_api_v1_armor\n @armor = Armor.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @long_arm.update(long_arm_params)\n format.html { redirect_to @long_arm, notice: 'Long arm was successfully updated.' }\n format.json { render :show, status: :ok, location: @long_arm }\n else\n format.html { render :edit }\n format.json { render json: @long_arm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n @asaaddrobj = Asaaddrobj.find(params[:id])\n\n respond_to do |format|\n if @asaaddrobj.update_attributes(params[:asaaddrobj])\n format.html { redirect_to @asaaddrobj, notice: 'Asaaddrobj was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @asaaddrobj.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_radios_for_array(args = {}) \n put(\"/radios.json/#{args[:arrayId]}\", args)\nend",
"def put(href, additional_parameters = {})\n rest_connect do |base_uri, headers|\n href = \"#{base_uri}/#{href}\" unless begins_with_slash(href)\n new_path = URI.escape(href)\n req = Net::HTTP::Put.new(new_path, headers) \n req.set_content_type('application/json')\n req.body = additional_parameters.to_json\n req\n end\n end",
"def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end",
"def put(path, to: nil, as: nil, **constraints, &blk)\n add_route(::Rack::PUT, path, to, as, constraints, &blk)\n end",
"def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end",
"def update\n respond_to do |format|\n if @asformulary.update(asformulary_params)\n format.html { redirect_to @asformulary, notice: 'Asformulary was successfully updated.' }\n format.json { render :show, status: :ok, location: @asformulary }\n else\n format.html { render :edit }\n format.json { render json: @asformulary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @atr = Atr.find(params[:id])\n @[email protected]_atr\n @man_rsc=@mcr_atr.man_rsc\n http = Net::HTTP.new(\"192.168.119.163\",9999)\n post_params = {'value' => @atr.value}\n request = Net::HTTP::Put.new(\"/mbs/#{@man_rsc.domain}/#{@man_rsc.name}/#{@mcr_atr.name}/#{@atr.name}\")\n request.set_form_data(post_params)\n begin\n response = http.request(request)\n rescue Errno::ECONNREFUSED\n end\n\n respond_to do |format|\n if @atr.update_attributes(params[:atr])\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @atr.errors, status: :unprocessable_entity }\n end\n end\n end",
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end",
"def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @asama_tanim.update(asama_tanim_params)\n format.html { redirect_to @asama_tanim, notice: 'Asama tanim was successfully updated.' }\n format.json { render :show, status: :ok, location: @asama_tanim }\n else\n format.html { render :edit }\n format.json { render json: @asama_tanim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, &block)\n route 'PUT', path, &block\n end",
"def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end",
"def add_aos_version(args = {}) \n post(\"/aosversions.json/\", args)\nend",
"def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end",
"def put(path, options={})\n request :put, path, options\n end",
"def update\n @ar = Ar.find(params[:id])\n\n respond_to do |format|\n if @ar.update_attributes(params[:ar])\n format.html { redirect_to @ar, :notice => 'Ar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @amenity = Amenity.find(params[:id])\n if @amenity.update_attributes(:name=>params[:body][:amenity])\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@amenity.errors)\n end \n end",
"def put(*args)\n request(:put, *args)\n end",
"def update\n @rayon = Rayon.find(params[:id])\n\n respond_to do |format|\n if @rayon.update_attributes(params[:rayon])\n format.html { redirect_to @rayon, notice: 'Rayon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rayon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put options\n rest_request({ method: :put }.merge(options))\n end",
"def put options\n rest_request({ method: :put }.merge(options))\n end",
"def perform_put(path, options = {})\n perform_request(:put, path, options)\n end",
"def update\n @ramal = Ramal.find(params[:id])\n\n respond_to do |format|\n if @ramal.update_attributes(params[:ramal])\n format.html { redirect_to @ramal, notice: 'Ramal alterado com sucesso!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ramal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @manga = Manga.find(params[:id])\n\n respond_to do |format|\n if @manga.update_attributes(params[:manga])\n format.html { redirect_to @manga, notice: 'Manga was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @manga.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def update\n @safra = Safra.find(params[:id])\n\n respond_to do |format|\n if @safra.update_attributes(params[:safra])\n format.html { redirect_to @safra}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @safra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, params={})\n RestClient.put request_base+path, params\n end",
"def api_put(path, data = {})\n api_request(:put, path, :data => data)\n end",
"def put\n RestClient.put(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def update\n @arbitro = Arbitro.find(params[:id])\n\n respond_to do |format|\n if @arbitro.update_attributes(params[:arbitro])\n format.html { redirect_to @arbitro, notice: 'El Arbitro se ha modificado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @arbitro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @asana.update(asana_params)\n format.html { redirect_to @asana, notice: 'Asana atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @asana }\n else\n format.html { render :edit }\n format.json { render json: @asana.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end",
"def put(path, params={}, options={})\n request(:put, api_path(path), params, options)\n end",
"def update\n @ami = Ami.find(params[:id])\n\n respond_to do |format|\n if @ami.update_attributes(params[:ami])\n format.html { redirect_to @ami, notice: 'Ami was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ami.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, opts = {})\n request(:put, path, opts).body\n end",
"def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_put(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def put(path, params = {})\n request(:put, path, params)\n end",
"def update\n megam_rest.update_assembly(to_hash)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def update\n @lugar = Lugar.find(params[:id])\n\n if @lugar.update(lugar_params)\n head :no_content\n else\n render json: @lugar.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @asteroid.update(asteroid_params)\n format.html { redirect_to @asteroid, notice: 'Asteroid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @asteroid.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end",
"def put(path, parameters = {})\n request(:put, path, parameters)\n end",
"def put(path, options = {})\n request(:put, path, options)\n end",
"def put(path, options = {})\n request(:put, path, options)\n end",
"def update\n resource.update_attributes params[params_key], as: current_role\n respond_with resource\n end",
"def update\n respond_to do |format|\n if @magasin.update(magasin_params)\n format.html { redirect_to @magasin, notice: 'Magasin was successfully updated.' }\n format.json { render :show, status: :ok, location: @magasin }\n else\n format.html { render :edit }\n format.json { render json: @magasin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, params={})\n request(:put, path, params)\n end",
"def update\n @ram = Ram.find(params[:id])\n\n respond_to do |format|\n if @ram.update_attributes(params[:ram])\n format.html { redirect_to @ram, notice: 'Ram was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ram.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @aactio = Aactio.find(params[:id])\n\n respond_to do |format|\n if @aactio.update_attributes(params[:aactio])\n format.html { redirect_to @aactio, notice: 'Aactio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aactio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @arcone = Arcone.find(params[:id])\n\n respond_to do |format|\n if @arcone.update_attributes(params[:arcone])\n format.html { redirect_to @arcone, notice: 'Arcone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @arcone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(path, params)\n parse_response @client[path].put(params)\n end",
"def put(path, options = {})\n request(:put, path, options)\n end",
"def put(path, options = {})\n request(:put, path, options)\n end",
"def put(path, data = {})\n self.class.put path, :body => data.merge(:u => access_token)\n end",
"def put(path, options={}, format=format)\n request(:put, path, options, format)\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\n @sphere = Sphere.find(params[:id])\n\n respond_to do |format|\n if @sphere.update_attributes(params[:sphere])\n format.html { redirect_to @sphere, notice: 'Sphere a été édité avec succès.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sphere.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @asistencia = Asistencia.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @asistencia.update_attributes(params[:asistencia])\r\n format.html { redirect_to @asistencia, notice: 'Asistencia 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: @asistencia.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n params.require(%i[id units])\n retrieve_and_validate_put.update!(units: params[:units])\n head :no_content\n end",
"def update\n if @norma.update(norma_params)\n render :show, status: :ok, location: @norma\n else\n render json: @norma.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @asteroid.update(asteroid_params)\n format.html { redirect_to @asteroid, notice: 'Asteroid was successfully updated.' }\n format.json { render :show, status: :ok, location: @asteroid }\n else\n format.html { render :edit }\n format.json { render json: @asteroid.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def update\n @anuncio = Anuncio.find params[:id]\n if @anuncio.update(anuncio_params)\n render :show, status: :ok, location: @anuncio\n else\n render json: @anuncio.errors, status: :unprocessable_entity\n end\n end",
"def put(name,&block)\n build_resource(name, :put, &block)\n end",
"def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend",
"def update\n @bus_route = BusRoute.find(params[:id])\n \n respond_to do |format|\n if @bus_route.update_attributes(params[:bus_route])\n format.html { redirect_to @bus_route, notice: 'Bus route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bus_route.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n apartment = Apartment.find(params[:id])\n apartment.update_attributes(apartment_params)\n render json: apartment\n end",
"def update \t\n record = AssetType.find(params[:id])\n record.update_attributes(params[:record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end",
"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 put(path, options={})\n send_request 'put', path, options\n end"
] | [
"0.62828606",
"0.62345004",
"0.6135801",
"0.60945356",
"0.600059",
"0.59718084",
"0.59200907",
"0.5910291",
"0.58377844",
"0.58332145",
"0.5823986",
"0.5819997",
"0.5819997",
"0.58075976",
"0.57939506",
"0.57937175",
"0.5772021",
"0.57697093",
"0.5755873",
"0.57325506",
"0.5708138",
"0.56961876",
"0.5688767",
"0.5688343",
"0.5683171",
"0.5676195",
"0.5674507",
"0.5662714",
"0.5655985",
"0.56463",
"0.5644819",
"0.5640398",
"0.56312287",
"0.56303513",
"0.56156",
"0.5610214",
"0.5609475",
"0.5606837",
"0.55962384",
"0.55962384",
"0.55853814",
"0.55819196",
"0.5559738",
"0.55571514",
"0.55571514",
"0.55571514",
"0.5554048",
"0.55456716",
"0.554538",
"0.55433434",
"0.5541983",
"0.5540339",
"0.55383176",
"0.55314344",
"0.5523689",
"0.5514439",
"0.5507138",
"0.55051464",
"0.55051464",
"0.54989654",
"0.5495671",
"0.5495671",
"0.5495671",
"0.5495671",
"0.5495671",
"0.5495671",
"0.5495671",
"0.5495671",
"0.5493671",
"0.54933923",
"0.5490124",
"0.54802936",
"0.5478451",
"0.5478451",
"0.5469893",
"0.54691535",
"0.5464601",
"0.54626644",
"0.54477626",
"0.5443135",
"0.5442326",
"0.5441838",
"0.5441838",
"0.5438522",
"0.54346913",
"0.54345816",
"0.543332",
"0.5428993",
"0.54285496",
"0.54223657",
"0.541603",
"0.5415215",
"0.54141057",
"0.5413675",
"0.5410615",
"0.54076606",
"0.5407432",
"0.54030794",
"0.5400322",
"0.5393112"
] | 0.62137115 | 2 |
DELETE /armas/1 DELETE /armas/1.json | def destroy
@arma = Arma.find(params[:id])
@arma.destroy
respond_to do |format|
format.html { redirect_to armas_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @aroma = Aroma.find(params[:id])\n @aroma.destroy\n\n respond_to do |format|\n format.html { redirect_to aromas_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @ramal = Ramal.find(params[:id])\n @ramal.destroy\n\n respond_to do |format|\n format.html { redirect_to ramais_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @atr = Atr.find(params[:id])\n @atr.destroy\n\n respond_to do |format|\n format.html { redirect_to atrs_url }\n format.json { head :no_content }\n end\n end",
"def delete(*rest) end",
"def destroy\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def destroy\n @record = Asset.find(params[:id])\n @record.trash\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @asaaddrobj = Asaaddrobj.find(params[:id])\n @asaaddrobj.destroy\n\n respond_to do |format|\n format.html { redirect_to asaaddrobjs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manga = Manga.find(params[:id])\n @manga.destroy\n\n respond_to do |format|\n format.html { redirect_to mangas_url }\n format.json { head :no_content }\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n @arcone = Arcone.find(params[:id])\n @arcone.destroy\n\n respond_to do |format|\n format.html { redirect_to arcones_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request(:delete, path)\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @aactio = Aactio.find(params[:id])\n @aactio.destroy\n\n respond_to do |format|\n format.html { redirect_to aactios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resa.destroy\n respond_to do |format|\n format.html { redirect_to resas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aquarium = Aquarium.find(params[:id])\n @aquarium.destroy\n\n respond_to do |format|\n format.html { redirect_to aquaria_url }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @aucrecord.destroy\n respond_to do |format|\n format.html { redirect_to aucrecords_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 @retroalimentacion = Retroalimentacion.find(params[:id])\n @retroalimentacion.destroy\n\n respond_to do |format|\n format.html { redirect_to retroalimentacions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @remito = Remito.find(params[:id])\n @remito.destroy\n\n respond_to do |format|\n format.html { redirect_to remitos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rayon = Rayon.find(params[:id])\n @rayon.destroy\n\n respond_to do |format|\n format.html { redirect_to rayons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asteroid.destroy\n respond_to do |format|\n format.html { redirect_to asteroids_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @amu.destroy\n respond_to do |format|\n format.html { redirect_to amus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ano = Ano.find(params[:id])\n @ano.destroy\n\n respond_to do |format|\n format.html { redirect_to anos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @a = A.find(params[:id])\n @a.destroy\n\n respond_to do |format|\n format.html { redirect_to as_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def delete!\n request! :delete\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def delete\n api(\"Delete\")\n end",
"def destroy\n @repa = Repa.find(params[:id])\n @repa.destroy\n\n respond_to do |format|\n format.html { redirect_to repas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repa = Repa.find(params[:id])\n @repa.destroy\n\n respond_to do |format|\n format.html { redirect_to repas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @ami = Ami.find(params[:id])\n @ami.destroy\n\n respond_to do |format|\n format.html { redirect_to amis_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n record = Asset.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resto.destroy\n respond_to do |format|\n format.html { redirect_to restos_url, notice: 'Entry was deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @astronomium.destroy\n respond_to do |format|\n format.html { redirect_to astronomia_url, notice: 'Astronomium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n @lancamentorapido = Lancamentorapido.find(params[:id])\n @lancamentorapido.destroy \n\n respond_to do |format|\n format.html { redirect_to lancamentorapidos_path }\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 resource.destroy\n render json: {success: true}, status: :ok\n end",
"def destroy\n resource.destroy\n render json: {success: true}, status: :ok\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 @razmer_go = RazmerGo.find(params[:id])\n @razmer_go.destroy\n\n respond_to do |format|\n format.html { redirect_to razmer_gos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n\t\trequest(path, :delete)\n\tend",
"def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end",
"def destroy\n @ram = Ram.find(params[:id])\n @ram.destroy\n\n respond_to do |format|\n format.html { redirect_to rams_url }\n format.json { head :no_content }\n end\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @galactic_arm.destroy\n respond_to do |format|\n format.html { redirect_to galactic_arms_url, notice: 'Galactic arm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @atracao = Atracao.find(params[:id])\n @atracao.destroy\n\n respond_to do |format|\n format.html { redirect_to atracaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ar = Ar.find(params[:id])\n @ar.destroy\n\n respond_to do |format|\n format.html { redirect_to ars_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aadt = Aadt.find(params[:id])\n @aadt.destroy\n\n respond_to do |format|\n format.html { redirect_to aadts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tarefa = Tarefa.find(params[:id])\n @tarefa.destroy\n\n respond_to do |format|\n format.html { redirect_to tarefas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @realiza = Realiza.find(params[:id])\n @realiza.destroy\n\n respond_to do |format|\n format.html { redirect_to realizas_url }\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 destroy\n @midia.destroy\n\n respond_to do |format|\n format.html { redirect_to midias_url }\n format.json { head :no_content }\n end\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def destroy\n @obra.destroy\n respond_to do |format|\n format.html { redirect_to obras_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @verb.destroy\n\n head :no_content\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 @tantosha.destroy\n # @tantosha.delete\n respond_to do |format|\n format.html { redirect_to tantoshas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @antropo.destroy\n respond_to do |format|\n format.html { redirect_to antropos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @farmacium.destroy\n respond_to do |format|\n msg = { :status => \"ok\", :message => \"Eliminado!\" }\n format.json { render :json => msg }\n end\n end",
"def destroy\n @restora.destroy\n respond_to do |format|\n format.html { redirect_to restoras_url, notice: 'Restora was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rotina.destroy\n respond_to do |format|\n format.html { redirect_to rotinas_url }\n format.json { head :no_content }\n end\n end",
"def delete\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n\n respond_to do |format|\n format.html { redirect_to avisos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @apuesta_detail = ApuestaDetail.find(params[:id])\n @apuesta_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to apuesta_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @arbitro = Arbitro.find(params[:id])\n @arbitro.destroy\n\n respond_to do |format|\n format.html { redirect_to arbitros_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aream.destroy\n respond_to do |format|\n format.html { redirect_to areams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asama_tanim.destroy\n respond_to do |format|\n format.html { redirect_to asama_tanims_url, notice: 'Asama tanim was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aliquotum = Aliquotum.find(params[:id])\n @aliquotum.destroy\n\n respond_to do |format|\n format.html { redirect_to aliquota_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vachana = Vachana.find(params[:id])\n @vachana.destroy\n\n respond_to do |format|\n format.html { redirect_to vachanas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vachana = Vachana.find(params[:id])\n @vachana.destroy\n\n respond_to do |format|\n format.html { redirect_to vachanas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asana.destroy\n respond_to do |format|\n format.html { redirect_to asanas_url, notice: 'Asana excluído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @capa = Capa.find(params[:id])\n @capa.destroy\n\n respond_to do |format|\n format.html { redirect_to capas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ra.destroy\n respond_to do |format|\n format.html { redirect_to ras_url, notice: 'Ra was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request(:delete, path)\n end",
"def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end",
"def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end"
] | [
"0.7387626",
"0.7325976",
"0.70670795",
"0.7022399",
"0.69331324",
"0.6904006",
"0.6823416",
"0.68159956",
"0.6815535",
"0.6791774",
"0.675919",
"0.675789",
"0.6756564",
"0.6753797",
"0.67472506",
"0.6733369",
"0.671898",
"0.6717733",
"0.6716567",
"0.6712523",
"0.67095405",
"0.67060304",
"0.6690899",
"0.6690656",
"0.6690398",
"0.6688704",
"0.66851777",
"0.66851777",
"0.66851777",
"0.66851777",
"0.66772944",
"0.6676359",
"0.66727823",
"0.66683877",
"0.6667205",
"0.66659945",
"0.66632247",
"0.66629654",
"0.6657025",
"0.6647365",
"0.6646536",
"0.6644899",
"0.6640925",
"0.6638974",
"0.6633621",
"0.66300297",
"0.6626263",
"0.6626263",
"0.6624241",
"0.6624092",
"0.66238767",
"0.6623444",
"0.6621307",
"0.66196126",
"0.66160476",
"0.66157556",
"0.6615162",
"0.6615162",
"0.66098535",
"0.66098535",
"0.6605856",
"0.6604396",
"0.6601541",
"0.6599496",
"0.6594641",
"0.65930986",
"0.65905654",
"0.6588713",
"0.65773237",
"0.6577079",
"0.65725476",
"0.65715814",
"0.65699404",
"0.6567757",
"0.65676296",
"0.65673566",
"0.6564836",
"0.65641135",
"0.6557376",
"0.65557796",
"0.65554094",
"0.65554094",
"0.65534985",
"0.65511787",
"0.65504944",
"0.6550318",
"0.6550072",
"0.6549998",
"0.65479386",
"0.6546215",
"0.65442",
"0.6544169",
"0.6543375",
"0.6543375",
"0.6539047",
"0.6538837",
"0.65379405",
"0.65369856",
"0.6535639",
"0.6533862"
] | 0.6899469 | 6 |
Initialize a new instance. | def initialize
@hash = lens_keys.map { |k| [k, nil] }.to_h.with_indifferent_access
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize\n init\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 \n end",
"def initialize() end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\r\n\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 raise \"#{self.class.to_s} should not be instantiated directly.\"\n 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 initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize(*) end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n super()\n end",
"def initialize\n end",
"def initialize()\n\t\tend",
"def initialize(options = {})\n init(options)\n end",
"def init\n end",
"def init\n end",
"def init\n end",
"def initialize\n \n end",
"def initialize\n \n end",
"def initialize\n set_defaults\n end",
"def initialize\n set_defaults\n end",
"def initialize\n\t\t\n\tend",
"def initialize\n\n\tend",
"def initialize\n\n\tend",
"def init\n raise NotImplementedError\n end",
"def constructor; end",
"def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end",
"def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end",
"def initialize # rubocop:disable Lint/UselessMethodDefinition\n super()\n end",
"def initialize()\r\n\r\n end",
"def initialize()\n # override parent\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def initialize(*_)\n super\n end",
"def initialize\n self.context = Context.new\n end",
"def initialize(instance)\n @instance = instance\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def new()\n #This is a stub, used for indexing\n end",
"def initialize(*args)\n super\n end",
"def initialize(instance)\n @instance = instance\n end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def initialize(instance)\n @instance = instance\n logger.debug \"Successfully initialized #{description}\"\n end",
"def initialize()\n end",
"def initialize()\n end"
] | [
"0.8421217",
"0.8421217",
"0.8369548",
"0.8332979",
"0.83191633",
"0.83191633",
"0.83191633",
"0.83191633",
"0.83191633",
"0.83191633",
"0.8306204",
"0.8198475",
"0.8196622",
"0.8015988",
"0.8015988",
"0.8015988",
"0.8015988",
"0.8015988",
"0.8015988",
"0.8015988",
"0.8015988",
"0.8015988",
"0.79094356",
"0.7854806",
"0.7854806",
"0.7854806",
"0.7854806",
"0.7854806",
"0.7854806",
"0.7854806",
"0.7854806",
"0.7833152",
"0.7815885",
"0.7815885",
"0.7815885",
"0.7815885",
"0.7815885",
"0.7815885",
"0.7815885",
"0.7815885",
"0.7815885",
"0.7815885",
"0.7815885",
"0.78137505",
"0.78137505",
"0.78137505",
"0.78137505",
"0.78137505",
"0.7802029",
"0.7802029",
"0.7802029",
"0.7802029",
"0.7802029",
"0.7802029",
"0.7802029",
"0.77490026",
"0.7702958",
"0.7702854",
"0.77004653",
"0.77004653",
"0.77004653",
"0.76983327",
"0.76983327",
"0.7694804",
"0.7694804",
"0.7689014",
"0.7682197",
"0.7682197",
"0.76440835",
"0.75765777",
"0.7558955",
"0.7558955",
"0.7558955",
"0.75574386",
"0.75372046",
"0.7536425",
"0.7536425",
"0.7536425",
"0.7527264",
"0.7505022",
"0.75023043",
"0.74920404",
"0.74920404",
"0.74920404",
"0.74920404",
"0.74920404",
"0.74920404",
"0.74920404",
"0.74920404",
"0.74920404",
"0.74920404",
"0.7476386",
"0.74702334",
"0.7431116",
"0.7419451",
"0.7419451",
"0.7419451",
"0.7419451",
"0.74161214",
"0.7400038",
"0.7400038"
] | 0.0 | -1 |
Retrieve lens by key. | def [](key)
key = key_for(key, false)
@hash[key] if key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(key)\n get_all(key).first\n end",
"def [](key)\n key = convert_key(key)\n regular_reader(key)\n end",
"def get(key)\n @manager.retrieve(key)\n end",
"def [](*key)\n get(*key)\n end",
"def [](key)\n fetch(key)\n end",
"def read(key)\n perform_read(:read, key)\n end",
"def get(type, key)\n require_layers!\n\n fetch_count = 0\n result = layers.inject(nil) do |res, layer|\n res || lambda do\n fetch_count += 1\n layer.get(type, key)\n end.call\n end || raise(Dis::Errors::NotFoundError)\n\n store_immediately!(type, result) if fetch_count > 1\n result\n end",
"def [](key)\n key = key.to_s unless key.is_a? String\n puts \"SEARCHING for key '#{key}' in doc '#{@id}'\"\n cursor = @collection.find_one( { plgid: @id } )\n if cursor\n return cursor[key]\n end\n nil\n end",
"def get(key); end",
"def get(key); end",
"def get(key); end",
"def get(key); end",
"def get(key)\n end",
"def get(key)\n @ivar.each_with_index do |ele, i|\n if ele[0] == key \n return ele[1]\n end\n end\n end",
"def [](key)\n field_get key\n end",
"def find_by_key(key)\n find_by_id(key) # backlog method looks exactly the same except for the parameter type\n end",
"def get(key)\n end",
"def get(key)\n db.get(key)\n end",
"def [](key)\n self.get(key)\n end",
"def [](key = nil)\n return @collection unless key\n\n result = @collection.find { |f| f.name == key }\n return result.value if result\n\n nil\n end",
"def find(key)\n raise UnknownEntity unless key?(key)\n\n collection[ukey(key)]\n end",
"def [](key)\n\t\t\t\treturn(lookup(key))\n\t\t\tend",
"def [](key)\n\t\t\t\treturn(lookup(key))\n\t\t\tend",
"def get key; call key; end",
"def get(kind, key)\n end",
"def get(key)\n response = db.get_item(@table_name, {'HashKeyElement' => {'S' => key}})\n get_item_from_body(response.body)\n end",
"def search_field_def_for_key(key, lens = nil)\n blacklight_config(lens).search_fields[key.to_s]\n end",
"def [](key)\n\n lookup(key.to_s)\n end",
"def [](key)\n get(key)\n end",
"def [](key)\n get(key)\n end",
"def [](key)\n get(key)\n end",
"def [](key)\n get(key)\n end",
"def find_by_key(key)\n by_key[key]\n end",
"def find_by_key(key)\n by_key[key]\n end",
"def find_by_key(key)\n find_by('key', key)\n end",
"def getDoc(key); @docs[key] end",
"def get(key)\n @first.get(key)\n end",
"def [](key)\n key = namespaced_key(key)\n get(key)\n end",
"def []( key )\n hash = load_hash\n hash[key]\n end",
"def get(key)\n node = node_for_key(key)\n node.read(&@block)\n end",
"def fetch(*key); end",
"def [](key)\n\t\tget key\n\tend",
"def get(key)\n \n end",
"def get_item(key)\n self[key]\n end",
"def [](key)\n content = list_map_db[key]\n content&.first\n end",
"def read(key)\n @cache[key]\n end",
"def [](key)\n @keychain[key]\n end",
"def [](key)\n @metadata[key]\n end",
"def [](key)\n find_value(key)\n end",
"def get(key)\n Lib.get @path, @no_follow, key.to_s\n end",
"def _get(key)\r\n\t\treturn _get_with_connection(@connection, @store_name, key, true)\r\n end",
"def [](key)\n __getobj__[key]\n end",
"def fetch(key); end",
"def [](key)\n if RUBY_ENGINE == 'opal'\n @hash[key]\n else\n @mutex.synchronize { @hash[key] }\n end\n end",
"def lookup(key)\n\t\t\t\treturn(@keys[key])\n\t\t\tend",
"def lookup(key)\n\t\t\t\treturn(@keys[key])\n\t\t\tend",
"def [](key)\n load(key)\n end",
"def [](key)\n load(key)\n end",
"def get(key)\n return do_get(key, false)\n end",
"def [](key)\n resolve(key)\n end",
"def grab(*key)\n synchronize do\n @data.get(*key)\n end\n end",
"def get(key)\n @@list[key]\n end",
"def [](key)\n return @discovery_document[key]\n end",
"def lens_key\n Blacklight::Lens.key_for(controller_name, false)\n end",
"def [](key)\n all(key).first\n end",
"def get(*key)\n key = model.typecast_key(key)\n return if key.any? { |v| v.blank? }\n\n if resource = @cache[key]\n # find cached resource\n resource\n elsif !loaded? && (query.limit || query.offset > 0)\n # current query is exclusive, find resource within the set\n\n # TODO: use a subquery to retrieve the Collection and then match\n # it up against the key. This will require some changes to\n # how subqueries are generated, since the key may be a\n # composite key. In the case of DO adapters, it means subselects\n # like the form \"(a, b) IN(SELECT a,b FROM ...)\", which will\n # require making it so the Query condition key can be a\n # Property or an Array of Property objects\n\n # use the brute force approach until subquery lookups work\n lazy_load\n @cache[key]\n else\n # current query is all inclusive, lookup using normal approach\n first(model.key(repository.name).zip(key).to_hash)\n end\n end",
"def get(key)\n @hash.get(key)\n end",
"def get_by_key(key)\n @store_[key] || YakvdConstants.key_not_found\n end",
"def get(key)\n position = find(key)\n if position != nil\n @values[position]\n else\n nil\n end\n end",
"def [](key)\n @data ||= restore\n @data[key]\n end",
"def [](key)\n @data ||= @dbman.restore\n @data[key]\n end",
"def [](key)\n if RUBY_ENGINE == 'opal'\n @hash[key]\n else\n @mutex.synchronize { @hash[key] }\n end\n end",
"def get(key)\n send_command([:get, key])\n end",
"def [](key)\n index = @keydir[key] or return nil\n @keydir.data_files[index.file_id][index.value_pos, index.value_sz].value\n end",
"def read(key, default=nil)\n document = @dao.collection.find_one(selector(key))\n if !document.nil?\n document['v']\n else\n default\n end\n end",
"def [](key)\n _data.fetch(key) { search_in_kept_data(key) }\n end",
"def []( key )\n context.fetch(key.to_s, nil)\n end",
"def get(type, key)\n dir = directory(type, key)\n return unless dir\n\n dir.files.get(key_component(type, key))\n end",
"def get(key)\n @collection.deserialize(\n [@dataset.get(key)].compact\n ).first\n end",
"def get(key)\n _get_from_params(key) || _get_from_values(key)\n end",
"def get(key)\n index = key_index(key)\n if( index )\n self.values.get(index)\n else\n nil\n end\n end",
"def [](key)\n @monitor.synchronize do\n _, value = get(key)\n value\n end\n end",
"def [](key)\n entry = find_entry(key)\n return(entry.nil? ? nil : entry[1])\n end",
"def fetch(key)\n result.fetch(key)\n end",
"def get(key)\n key && (@documents[key.to_sym] ||= load(key.to_sym)) || nil\n end",
"def get(key)\n get_recursive(@root, key)\n end",
"def [](key)\n @doc[key]\n end",
"def [](key)\n @doc[key]\n end",
"def [](key)\n if @metadata.key?(key.to_s)\n @metadata[key.to_s]\n else\n @shape[key.to_s]\n end\n end",
"def find _key\n _object = store.transaction(:read_only) { |s| s[prepare_key(_key)] }\n _object.send(:after_load) if _object\n _object\n end",
"def get(key)\n position = search(key)\n return nil if (key <=> @keys[position]) != 0\n @values[position]\n end",
"def obtain!(key)\n raise \"Missing key #{key}\" unless @hash.key?(key)\n @hash[key]\n end",
"def get( key )\n key = UniMap.str_to_key( key ) unless key.is_a?( Key )\n key && get_k( key )\n end",
"def underbang_reader(key)\n if key?(key)\n self[key]\n else\n self.class.new\n end\n end",
"def [](key)\n return nil if @collection.nil?\n return_item_value key\n end",
"def get(key)\n @cache[key]\n end",
"def [](key)\n self.internal_object[key.to_s]\n end",
"def [](key); end",
"def [](key); end",
"def [](key); end",
"def [](key); end"
] | [
"0.66972464",
"0.66490626",
"0.65541035",
"0.65483165",
"0.65420663",
"0.64959085",
"0.64853114",
"0.64756656",
"0.6335023",
"0.6335023",
"0.6335023",
"0.6335023",
"0.63267547",
"0.62444645",
"0.62404275",
"0.6240061",
"0.62381667",
"0.621151",
"0.6187879",
"0.61837876",
"0.6175903",
"0.616429",
"0.616429",
"0.61616045",
"0.6158261",
"0.61558944",
"0.61488634",
"0.61434263",
"0.6136538",
"0.6136538",
"0.6136538",
"0.6136538",
"0.61331904",
"0.61331904",
"0.61274",
"0.6111583",
"0.6110238",
"0.6109485",
"0.6102417",
"0.6101251",
"0.6089287",
"0.60813916",
"0.607646",
"0.60651827",
"0.60609144",
"0.6047689",
"0.60280293",
"0.6026914",
"0.6022684",
"0.60221744",
"0.6018951",
"0.6007472",
"0.6006772",
"0.5999339",
"0.59974974",
"0.59974974",
"0.59963226",
"0.59963226",
"0.5986578",
"0.597248",
"0.5964746",
"0.5963903",
"0.59592265",
"0.5959151",
"0.5954564",
"0.5950787",
"0.5942303",
"0.5942029",
"0.5937255",
"0.59364814",
"0.59354156",
"0.59242475",
"0.5922782",
"0.59223855",
"0.592087",
"0.5914473",
"0.59107196",
"0.5909563",
"0.5908179",
"0.59076154",
"0.5901387",
"0.5899387",
"0.5898543",
"0.58960444",
"0.58960426",
"0.58797425",
"0.5874615",
"0.5874615",
"0.5872481",
"0.5862401",
"0.5848537",
"0.5835604",
"0.58310795",
"0.5829104",
"0.58277684",
"0.58264613",
"0.5826072",
"0.5823904",
"0.5823904",
"0.5823904",
"0.5823904"
] | 0.0 | -1 |
Set lens by key. | def []=(key, entry)
key = key_for(key) unless valid_key?(key)
@hash[key] = entry if key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lset(key, index, value); end",
"def lset(key, index, value); end",
"def lset(key, index, value)\n send_command([:lset, key, Integer(index), value])\n end",
"def key=(key); end",
"def set(key, val = nil)\n @statistics[:set] += 1\n with_branch_for(key) do |branch|\n branch.set key, val\n end\n end",
"def field_set!(key, value)\n send \"_#{key}_set\", value\n end",
"def set(key, value); end",
"def set(key, value); end",
"def lset(key, index, value)\n node_for(key).lset(key, index, value)\n end",
"def []=(key, value)\n field_set key, value\n end",
"def set(key, value)\n end",
"def set(key, value)\n arr_pos = to_hash(key)\n list = @array[array_pos]\n node = list.find_by_key(key)\n if node\n node.data = value\n else\n self.put(key, value)\n end\n end",
"def set_key(key, &block)\n @callbacks[key.ord] = block\n end",
"def setnx(key, value); end",
"def setnx(key, value); end",
"def set(key, value)\n change(:set, key, value)\n end",
"def updateKey; @key = getKey; self end",
"def []=(key,arg)\n @hash[key] = arg\n end",
"def set(k,v)\n each do |e|\n e.set k,v\n end\n self\n end",
"def update_key(key, val)\n @ivar.each_with_index do |ele, i|\n if ele[0] == key\n @ivar[i][1] = val \n end\n end\n end",
"def set(key, value)\n @namehash[key.to_sym][0] = value\n end",
"def key=(new_key)\n @key = new_key\n end",
"def []=(key, value)\n if argument_key?(key)\n super\n else\n @metadata[key] = value\n end\n end",
"def set_key\n @key = Key.find(params[:id])\n end",
"def []=( key, value )\n ensure_aggregate!\n @context[ key ] = value\n end",
"def []=(key, data)\n\t\tset key, data\n\tend",
"def []=(key, item)\n item.set_collection_key(key)\n add(item)\n end",
"def set key, data\n\t\t@data_base[ key ] = data\n\t\tupdate_database\n\tend",
"def set_field(key, value)\n\n Ruote.set(h.fields, key, value)\n end",
"def set k,v\n key = k.to_s.to_sym\n v = (v.is_a?(ASObj) ? v.finish : v) unless v == nil\n @_[key] = v unless v == nil\n @_.delete key if v == nil\n end",
"def def_set_accessor(key)\n key = key.to_sym\n raise ArgumentError.new('Invalid entry type: %s' % key) if respond_to?(key)\n metaclass.class_eval do\n define_method(key) {|*val| val.size > 0 ? (self[key] ||= Set.new).merge(val) : self[key] }\n define_method(\"#{key}!\") {|*val| val.size > 0 ? (cache[key] ||= Set.new).merge(val) : cache[key] }\n end\n end",
"def []=(key, value)\n ks = key.to_sym\n if @hash.has_key? ks\n ns = @hash[ks]\n ns[:value] = value\n ns[:trigger].call(value) if ns[:trigger].respond_to?(:call)\n elsif existing = get(key)\n option(existing[:doc].to_s.dup, key, value)\n else\n raise(ArgumentError, \"No key for %p exists\" % [key])\n end\n end",
"def []=(key, val); end",
"def set(key , value)\n index = key_index(key)\n if( index )\n @i_values.set(index , value)\n else\n @i_keys.push(key)\n @i_values.push(value)\n end\n value\n end",
"def liner_set(key, value)\n key = key.to_sym\n with_valid_attribute(key) do\n instance_variable_set \"@#{key}\", value\n end\n end",
"def []=(key , value)\n set(key, value)\n end",
"def set(key, value, **options); end",
"def set(key, value=self)\n if value.kind_of?(Proc)\n metadef(key, &value)\n metadef(\"#{key}?\") { !!__send__(key) }\n metadef(\"#{key}=\") { |val| set(key, Proc.new{val}) }\n @keys << key \n elsif value == self && key.is_a?(Hash)\n key.to_hash.each { |k,v| set(k, v) }\n elsif respond_to?(\"#{key}=\")\n __send__ \"#{key}=\", value\n @keys << key \n else\n set key, Proc.new{value}\n end\n self\n end",
"def set_state(key, val)\n @state[key] = val\n self\n end",
"def set( key, value )\n unless key.is_a?( Key )\n k = UniMap.str_to_key( key )\n unless k\n raise IndexError, \"No Key named #{key.inspect} in UniMap.KEY_SPACE\"\n end\n key = k\n end\n set_k( key, value )\n end",
"def set(key, value)\n @store[key] = value\n end",
"def set(key , value)\n index = key_index(key)\n if( index )\n self.keys.set(index , value)\n else\n self.keys.push(key)\n self.values.push(value)\n end\n value\n end",
"def []=(key, value)\n offset = append(key, value)\n index(key, offset)\n end",
"def set_attribute(key_, value_)\n attribute(key_, value_, :set)\n end",
"def []=(k, v) \n @data[k] = v\n end",
"def []=(k, v) \n @data[k] = v\n end",
"def set_keyval\n @keyval = Keyval.find(params[:id])\n end",
"def set( key, value )\n fail NotImplementedError\n end",
"def []=( key, value )\n context.store(key.to_s, value)\n end",
"def getset(key); end",
"def lut_set_proc(lut_key, block)\n lut_proc[lut_key.to_sym] = block\n end",
"def []=(key, value)\n if Dottie.dottie_key?(key)\n Dottie.set(wrapped_object_or_self, key, value)\n else\n super\n end\n end",
"def set key, value\n @reverse_cache[value.object_id] = key\n @cache[key] = value.object_id\n ObjectSpace.define_finalizer(value, @finalize)\n end",
"def []=(key, value)\n set(key, value)\n end",
"def []=(key, value)\n set(key, value)\n end",
"def []=(key, val)\n @data[key] = val\n end",
"def set(key, value)\n Lib.set @path, @no_follow, key.to_s, value.to_s\n end",
"def []=( key, value )\n\t\t@data[ key ] = value\n\t\t@modified = true\n\tend",
"def set_members(key)\n perform_read(:set_members, key)\n end",
"def set(key, value)\n response = db.put_item(@table_name, {'id' => {'S' => key}, 'value' => {'S' => value}})\n true\n end",
"def []=(key, service)\n set(key, service)\n end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key, value); end",
"def []=(key,val) ; @data[key] = val ; end",
"def set(key, value)\n peek[key.to_sym] = value\n end",
"def set_key(key, text)\n return if key == self.key and text == self.text\n @key = key\n @text = text\n refresh\n end",
"def []=(key, value)\n #if the key is an alias, lookup the real key\n key = aliasing_hash_aliases[key] if aliasing_hash_aliases.include?(key)\n \n super\n end",
"def set_k( key, value )\n HTMapHelper.set_map( self, key, value )\n end",
"def make_setter( key )\n\t\treturn Proc.new {|new_value| self.namespaced_hash[ key.to_sym ] = new_value }\n\tend",
"def set(key, value)\n raise NotImplementedError\n end",
"def []=(key, value)\n set(key, value)\n end",
"def []=(k, v)\n self.send(k.to_s + \"=\", v)\n end",
"def []= (*key, value)\n return nil if [:object, :query].include?(key[0])\n rhSet(@hParams, value, key)\n end",
"def set(key, val)\n if key_in_map?(@ivar,key)\n update_key(key,val)\n else\n @ivar << [key, val]\n end\n end",
"def set(key, value)\n self.data ||= {}\n self.data[key.to_s] = value\n self.save!\n end",
"def set(key, value)\n\t\t\t\t# TODO This could be a bit more efficient:\n\t\t\t\tself.delete(key)\n\t\t\t\tself.add(key, value)\n\t\t\tend",
"def []=(key, value)\n put(key, value)\n end",
"def set(key, val)\n return unless val\n db[key] = val\n end",
"def []= key, value\n @data[key] = value\n end",
"def []= key, value\n @data[key] = value\n end",
"def []=(key, val)\n @write_lock ||= true\n @data ||= restore\n @data[key] = val\n end",
"def []=(k, v)\n internal[k] = v\n persist!\n v\n end",
"def set k,v\n key = k.to_s.to_sym\n v = (v.is_a?(JrdObj) ? v.finish : v) unless v == nil\n @_[key] = v unless v == nil\n @_.delete key if v == nil\n end",
"def set(key, value)\n @metadata[key] = value\n end",
"def []=(key, val)\n self.setObject(val, forKey: key.to_s)\n self.synchronize\n end",
"def set_state(key, value)\n proxy.setState(key, value)\n end",
"def []=(key, val)\n @write_lock ||= true\n @data ||= @dbman.restore\n @data[key] = val\n end"
] | [
"0.67129654",
"0.67129654",
"0.6519039",
"0.63984656",
"0.62730616",
"0.62324435",
"0.62141365",
"0.62141365",
"0.6107315",
"0.6085474",
"0.6068545",
"0.6061341",
"0.60493135",
"0.6044077",
"0.6044077",
"0.6040151",
"0.5997749",
"0.5981817",
"0.59637684",
"0.5940847",
"0.5928316",
"0.5927177",
"0.59235036",
"0.5894121",
"0.588001",
"0.5879729",
"0.58669114",
"0.5851372",
"0.58376735",
"0.5835371",
"0.5828835",
"0.58247757",
"0.58008915",
"0.5799332",
"0.57900465",
"0.5787817",
"0.5785893",
"0.57835525",
"0.57772803",
"0.5771937",
"0.5768349",
"0.5762371",
"0.57533026",
"0.5740628",
"0.5714614",
"0.5714614",
"0.5711207",
"0.5709735",
"0.5701876",
"0.57015604",
"0.5696702",
"0.56862915",
"0.56756246",
"0.5671772",
"0.5671772",
"0.5666061",
"0.566424",
"0.5658684",
"0.5657994",
"0.565629",
"0.5653716",
"0.5652618",
"0.5652618",
"0.5652618",
"0.5652618",
"0.5652618",
"0.5652618",
"0.5652618",
"0.5652618",
"0.5652618",
"0.5652618",
"0.5652618",
"0.5652618",
"0.5652618",
"0.5652618",
"0.5652618",
"0.5652618",
"0.56501555",
"0.5636001",
"0.5631336",
"0.5617052",
"0.561224",
"0.5611353",
"0.56073916",
"0.5605299",
"0.56037235",
"0.5599475",
"0.5598321",
"0.55980617",
"0.55979407",
"0.55974764",
"0.55961853",
"0.55884945",
"0.55884945",
"0.55812967",
"0.558094",
"0.5578705",
"0.5577862",
"0.5566321",
"0.55551237",
"0.5553092"
] | 0.0 | -1 |
depends_on "cmake" => :build | def install
# ENV.deparallelize # if your formula fails when building in parallel
# Remove unrecognized options if warned by configure
# system "./configure", "--disable-debug",
# "--disable-dependency-tracking",
# "--disable-silent-rules",
# "--prefix=#{prefix}"
# system "cmake", ".", *std_cmake_args
# system "make", "install" # if this fails, try separate make/make install steps
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def package_depends_on\n depends_on\n end",
"def install\n# Dependency tracking only, uncomment this section only if you know what you\n# are doing!\n#\n# mkdir 'build'\n# cd 'build' do\n# system \"cmake .. #{std_cmake_parameters}\"\n# system \"make package\"\n# end\nend",
"def cmake_package(options, &block)\n package_common(:cmake, options) do |pkg|\n pkg.depends_on 'cmake'\n common_make_based_package_setup(pkg)\n yield(pkg) if block_given?\n end\nend",
"def depends_on(pkg)\n autobuild.depends_on(pkg.autobuild)\n end",
"def build_gem; end",
"def build_dependency\n npm_install\nend",
"def common_build\n copy_gems # in make/gems.rb\n end",
"def common_build\n copy_gems\n end",
"def common_build\n copy_gems\n end",
"def depends_on(mod)\n @log.info \"Loading module '#{mod}' as a dependency\"\n loaded = require \"#{File.dirname(__FILE__)}/modules/#{mod.to_s}.rb\"\n @log.info \"Module '#{mod}' already loaded, not re-loading\" if !loaded\nend",
"def dependencies; end",
"def dependencies; end",
"def dependencies; end",
"def depends_on( other_dependency )\n namespace name do\n task :build => \"#{other_dependency}:done\"\n end\n end",
"def build_gems; end",
"def depends_on\n return @depends_on\n end",
"def build_release\n build_dependency\n puts '### release build ###'\n `gulp release`\n puts '### release build done ###'\n post_build\nend",
"def direct_dependencies; end",
"def fetch_development_dependencies # :nodoc:\n end",
"def dependency_target\n self.name == \"hoe\" ? extra_deps : extra_dev_deps\n end",
"def build\n cd_and_sh( pkg_dir, build_commands )\n end",
"def dependencies\n self.config.depends || []\n end",
"def rebuild\n build addl_cmake_bld_args: '--clean-first'\n end",
"def run_in_build(*args)\n in_build do |source_dir|\n run_command(\"cmake\", \"-G\", select_generator, source_dir) unless File.exist?(\"CMakeCache.txt\")\n args.push(\"cmake\", \"--build\", \".\") if args.empty?\n args.push(\"--target\", $target) if $target\n args.push(\"--config\", $config) if $config\n run_command(*args)\n end\nend",
"def prebuild(build, listener)\n end",
"def prebuild(build, listener)\n end",
"def prebuild(build, listener)\n end",
"def depends_on(package, *version)\n dependencies << [ package, *version ]\n end",
"def install_ruby_dependencies(rubie)\n pkgs = []\n case rubie\n when /^ruby-/, /^ree-/, /^rbx-/, /^kiji/\n case node['platform']\n when \"debian\",\"ubuntu\"\n pkgs = %w{ build-essential openssl libreadline6 libreadline6-dev\n zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev\n sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev\n ncurses-dev automake libtool bison ssl-cert }\n pkgs += %w{ subversion } if rubie =~ /^ruby-head$/\n when \"suse\"\n pkgs = %w{ gcc-c++ patch zlib zlib-devel libffi-devel\n sqlite3-devel libxml2-devel libxslt-devel }\n if node['platform_version'].to_f >= 11.0\n pkgs += %w{ libreadline5 readline-devel libopenssl-devel }\n else\n pkgs += %w{ readline readline-devel openssl-devel }\n end\n pkgs += %w{ git subversion autoconf } if rubie =~ /^ruby-head$/\n when \"centos\",\"redhat\",\"fedora\",\"scientific\",\"amazon\"\n pkgs = %w{ gcc-c++ patch readline readline-devel zlib zlib-devel\n libyaml-devel libffi-devel openssl-devel }\n pkgs += %w{ git subversion autoconf } if rubie =~ /^ruby-head$/\n end\n when /^jruby-/\n # TODO: need to figure out how to pull in java recipe only when needed. For\n # now, users of jruby will have to add the \"java\" recipe to their run_list.\n #include_recipe \"java\"\n case node['platform']\n when \"debian\",\"ubuntu\"\n pkgs += %w{ g++ ant }\n end\n end\n\n pkgs.each do |pkg|\n package pkg do\n action :nothing\n end.run_action(:install)\n end\nend",
"def test_bad_chicken_deps\n check_deps_fail \"notapackage\" => :chicken if which('csc')\n end",
"def test_bad_chicken_deps\n check_deps_fail \"notapackage\" => :chicken if which('csc')\n end",
"def build_snapshot\n build_dependency\n puts '### dev build ###'\n puts `gulp 2>&1`\n puts '### dev build done ###'\n post_build\nend",
"def depends_on=(value)\n @depends_on = value\n end",
"def build\n if phase.has_key?('build')\n execute(\"build\", phase['build'])\n end\n end",
"def build_files_command\n \"middleman build\"\n end",
"def setup_maven_build_targets(cmp, build_vars)\n cmp_src_path = component_src_path cmp\n cmp_build_bin = component_build_bin cmp\n\n if cmp_build_bin != 'mvn'\n STDERR.puts \"[#{cmp}]: the builder is configured (in the YAML file) as '#{cmp_build_bin}', however it seems to be 'mvn'. Look in the source directory ('#{cmp_src_path}') for more details\"\n end\n\n mvn_versions = lookup_maven_pom(cmp_src_path)\n mvn_versions.each do |mvn_version|\n mvn_filename = 'pom.xml'\n if mvn_version != ''\n mvn_filename = 'pom.hadoop' + mvn_version + '.xml'\n end\n mvn_file = File.join cmp_src_path, mvn_filename\n\n # Store the Maven POM file\n build_vars['BUILDER_FILES'] << mvn_file\n\n # Extract the elements of version from the Maven POM XML file\n (mvn_version, has_hadoop, has_spark) = lookup_version_from_mvn_pom(mvn_filename)\n\n # Store the elements of version\n build_vars['PACKAGE_VERSIONS'][mvn_version] = true\n build_vars['HAS_HADOOP'] = has_hadoop\n build_vars['HAS_SPARK'] = has_spark\n\n # Set up the Maven build command line\n cmp_builder_cmds = \"#{cmp_build_bin} -f #{mvn_file} #{CONF_MVN_ARGS}\"\n build_vars['BUILDER_CMDS'] << \"#{cmp_builder_cmds}\"\n \n # Maven tasks/targets for building, packaing and installing (in the local\n # Maven repository, eg, ~/.m2/repository)\n cmp_builder_tasks = \"compile package install\"\n build_vars['BUILDER_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_builder_tasks}\"\n\n # Set up the Maven test command line\n cmp_test_tasks = \"test\"\n build_vars['TEST_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_test_tasks}\"\n end\nend",
"def setup\n default_repository.update_submodules(:recursive => true)\n true\n end",
"def build\n safesystem \"autoreconf -vfi\"\n configure :prefix => prefix\n make\n end",
"def test_no_build_deps\n c = Control.new(__method__)\n c.parse!\n assert_equal(nil, c.source.fetch('build-depends', nil),\n \"Found a build dep #{c.source.fetch('build-depends', nil)}\")\n end",
"def cmake_has_parallel_flag?\n (CMAKE_VERSION <=> [3, 12]) >= 0\nend",
"def common_build\n puts \"common_build dir=#{pwd} #{SHOES_TGT_ARCH}\"\n #mkdir_p \"#{TGT_DIR}/ruby\"\n #cp_r \"#{EXT_RUBY}/lib/ruby/#{RUBY_V}\", \"#{TGT_DIR}/ruby/lib\"\n %w[req/ftsearch/lib/* req/rake/lib/*].each do |rdir|\n FileList[rdir].each { |rlib| cp_r rlib, \"#{TGT_DIR}/lib/ruby/#{TGT_RUBY_V}\" }\n end\n %w[req/ftsearch/ext/ftsearchrt req/chipmunk/ext/chipmunk].\n #%w[req/binject/ext/binject_c req/ftsearch/ext/ftsearchrt req/bloopsaphone/ext/bloops req/chipmunk/ext/chipmunk].\n each { |xdir| copy_ext xdir, \"#{TGT_DIR}/lib/ruby/#{TGT_RUBY_V}/#{SHOES_TGT_ARCH}\" }\n\n gdir = \"#{TGT_DIR}/lib/ruby/gems/#{RUBY_V}\"\n {'hpricot' => 'lib', 'sqlite3' => 'lib'}.each do |gemn, xdir|\n #{'hpricot' => 'lib', 'json' => 'lib/json/ext', 'sqlite3' => 'lib'}.each do |gemn, xdir|\n spec = eval(File.read(\"req/#{gemn}/gemspec\"))\n mkdir_p \"#{gdir}/specifications\"\n mkdir_p \"#{gdir}/gems/#{spec.full_name}/lib\"\n FileList[\"req/#{gemn}/lib/*\"].each { |rlib| cp_r rlib, \"#{gdir}/gems/#{spec.full_name}/lib\" }\n mkdir_p \"#{gdir}/gems/#{spec.full_name}/#{xdir}\"\n FileList[\"req/#{gemn}/ext/*\"].each { |elib| copy_ext elib, \"#{gdir}/gems/#{spec.full_name}/#{xdir}\" }\n cp \"req/#{gemn}/gemspec\", \"#{gdir}/specifications/#{spec.full_name}.gemspec\"\n end\n end",
"def autotools_package(options, &block)\n package_common(:autotools, options) do |pkg|\n pkg.depends_on 'autotools'\n common_make_based_package_setup(pkg)\n yield(pkg) if block_given?\n end\nend",
"def prebuild(build, listener)\n # do any setup that needs to be done before this build runs.\n end",
"def make_deps t\n sh \"gcc -MM -MF #{t.name} #{$C_FLAGS.join ' '} -c #{t.source}\"\nend",
"def dependencies=(_arg0); end",
"def enable_dependency_loading; end",
"def enable_dependency_loading; end",
"def install_dependencies\n raise 'Not implemented'\n end",
"def pre_install; end",
"def copy_project_dependencies_for_awestruct_image\n\n puts \"- Copying project dependencies into '_docker/awestruct' for build...\"\n\n parent_gemfile = File.open '../Gemfile'\n parent_gemlock = File.open '../Gemfile.lock'\n\n target_gemfile = FileHelpers.open_or_new('awestruct/Gemfile')\n target_gemlock = FileHelpers.open_or_new('awestruct/Gemfile.lock')\n #Only copy if the file has changed. Otherwise docker won't cache optimally\n FileHelpers.copy_if_changed(parent_gemfile, target_gemfile)\n FileHelpers.copy_if_changed(parent_gemlock, target_gemlock)\n\n puts \"- Successfully copied project dependencies into '_docker/awestruct' for build.\"\n\nend",
"def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n # remove leftovers from previous rake.\n rm_rf \"#{TGT_DIR}/lib\"\n rm_rf \"#{TGT_DIR}/etc\"\n rm_rf \"#{TGT_DIR}/share\"\n rm_rf \"#{TGT_DIR}/conf.d\"\n mkdir_p \"#{TGT_DIR}/lib\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy include files\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n # do some windows things\n mkdir_p \"#{TGT_DIR}/share/glib-2.0/schemas\"\n if APP['GTK'] == \"gtk+-2.0\" \n cp_r\"#{TGT_SYS_DIR}/share/glib-2.0/schemas/gschema.dtd\",\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n elsif APP['GTK'] == \"gtk+-3.0\"\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n else\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n end\n sh \"#{WINDRES} -I. shoes/appwin32.rc shoes/appwin32.o\"\n cp_r \"#{ShoesDeps}/etc\", TGT_DIR\n mkdir_p \"#{ShoesDeps}/lib\"\n if APP['GTK'] == \"gtk+-3.0\"\n cp_r \"#{ShoesDeps}/lib/gtk-3.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n else\n cp_r \"#{ShoesDeps}/lib/gtk-2.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n end\n bindir = \"#{ShoesDeps}/bin\"\n #cp_r \"#{bindir}/fc-cache.exe\", TGT_DIR\n cp_r \"#{bindir}/gtk-update-icon-cache.exe\", TGT_DIR\n # below for debugging purposes\n if ENV['GDB'] \n cp \"#{bindir}/fc-cat.exe\", TGT_DIR\n cp \"#{bindir}/fc-list.exe\", TGT_DIR\n cp \"#{bindir}/fc-match.exe\", TGT_DIR\n cp \"#{bindir}/fc-pattern.exe\", TGT_DIR\n cp \"#{bindir}/fc-query.exe\", TGT_DIR\n cp \"#{bindir}/fc-scan.exe\", TGT_DIR\n cp \"#{bindir}/fc-validate.exe\", TGT_DIR\n end\n # disable MS Theme\n if !ENABLE_MS_THEME \n Dir.chdir(\"#{TGT_DIR}/share/themes/MS-Windows/gtk-2.0/\") do\n mv 'gtkrc', 'disabled-gtkrc'\n end\n else\n # add our overrides to the MS-Windows theme\n cp \"platform/msw/gtkrc\", \"#{TGT_DIR}/etc/gtk-2.0/\"\n end\n end",
"def install_dependencies\n recipe_eval do\n run_context.include_recipe 'chef-sugar::default'\n run_context.include_recipe 'build-essential::default'\n\n case node.platform_family\n when 'debian'\n package 'curl'\n package 'git-core'\n package 'libxml2-dev'\n package 'libxslt-dev'\n package 'zlib1g-dev'\n package 'ncurses-dev'\n package 'libssl-dev'\n when 'freebsd'\n package 'textproc/libxml2'\n package 'textproc/libxslt'\n package 'devel/ncurses'\n when 'mac_os_x'\n run_context.include_recipe 'homebrew::default'\n package 'libxml2'\n package 'libxslt'\n package 'openssl'\n when 'rhel'\n package 'curl'\n package 'bzip2'\n package 'file'\n package 'git'\n package 'libxml2-devel'\n package 'libxslt-devel'\n package 'ncurses-devel'\n package 'zlib-devel'\n package 'openssl-devel'\n end\n end\n end",
"def define_packaging_tasks\n\n\t\t### Task: prerelease\n\t\tunless Rake::Task.task_defined?( :pre )\n\t\t\tdesc \"Append the package build number to package versions\"\n\t\t\ttask :pre do\n\t\t\t\trev = get_numeric_rev()\n\t\t\t\ttrace \"Current rev is: %p\" % [ rev ]\n\t\t\t\t$hoespec.spec.version.version << \"pre#{rev}\"\n\t\t\t\tRake::Task[:gem].clear\n\n\t\t\t\tGem::PackageTask.new( $hoespec.spec ) do |pkg|\n\t\t\t\t\tpkg.need_zip = true\n\t\t\t\t\tpkg.need_tar = true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tnamespace :deps do\n\n\t\t\tif RVM_GEMSET.exist?\n\t\t\t\tdesc \"Update the project's RVM gemset\"\n\t\t\t\ttask :gemset do\n\t\t\t\t\tdeps = make_gemset_recommendations( $hoespec.spec )\n\t\t\t\t\tupdates = deps.values.compact\n\n\t\t\t\t\tif !updates.empty?\n\t\t\t\t\t\t$stderr.puts \"%d gems in the current gemset have newer matching versions:\" %\n\t\t\t\t\t\t\t [ updates.length ]\n\t\t\t\t\t\tdeps.each do |old, newer|\n\t\t\t\t\t\t\tnext unless newer\n\t\t\t\t\t\t\t$stderr.puts \" #{old} -> #{newer}\"\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tif ask( \"Update? \" )\n\t\t\t\t\t\t\tupdate_rvm_gemset( deps )\n\t\t\t\t\t\t\trun 'rvm', 'gemset', 'import', RVM_GEMSET.to_s\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\tend\n\n\t\t### Make the ChangeLog update if the repo has changed since it was last built\n\t\tfile '.hg/branch'\n\t\tfile 'ChangeLog' => '.hg/branch' do |task|\n\t\t\t$stderr.puts \"Updating the changelog...\"\n\t\t\tcontent = make_changelog()\n\t\t\tFile.open( task.name, 'w', 0644 ) do |fh|\n\t\t\t\tfh.print( content )\n\t\t\tend\n\t\tend\n\n\tend",
"def build\n\t@built_gem_path ||= @helper.build_gem\nend",
"def test_harness_dependencies(*)\n return unless platform[/n(5|6)k/]\n skip_if_nv_overlay_rejected(agent)\n\n # Vxlan has a hard requirement to disable feature fabricpath on n5/6k\n cmd = 'no feature-set fabricpath'\n command_config(agent, cmd, cmd)\nend",
"def install_build_dependencies(build_dependencies) # rubocop:disable Metrics/AbcSize\n http = []\n pkgutil = []\n noasks = [\"instance=overwrite\", \"partial=nocheck\", \"runlevel=nocheck\", \"idepend=nocheck\", \"rdepend=nocheck\", \"space=nocheck\", \"setuid=nocheck\", \"conflict=nocheck\", \"action=nocheck\", \"basedir=default\"]\n noask_command = noasks.map { |noask| \"echo '#{noask}' >> /var/tmp/noask\" }.join('; ')\n\n build_dependencies.each do |build_dependency|\n if build_dependency =~ /^http.*\\.gz/\n # Fetch, unpack, install...this assumes curl is present.\n package = build_dependency.sub(/^http.*\\//, '')\n http << \"tmpdir=$(#{mktemp}); (cd ${tmpdir} && curl --silent --show-error --fail -O #{build_dependency} && gunzip -c #{package} | pkgadd -d /dev/stdin -a /var/tmp/noask all)\"\n else\n # Opencsw dependencies. At this point we assume that pkgutil is installed.\n pkgutil << build_dependency\n end\n end\n\n command = ''\n unless pkgutil.empty?\n command << \"/opt/csw/bin/pkgutil -y -i #{pkgutil.join(\"\\s\")}; \"\n end\n\n unless http.empty?\n command << \"echo -n > /var/tmp/noask; #{noask_command}; \"\n command << http.join('; ')\n end\n\n command\n end",
"def cask(name); dep name, :template => \"icelab:cask\"; end",
"def activate_compiler_deps\n dependency \"rake-compiler\", \"~> 1.0\", :development\n\n gem \"rake-compiler\", \"~> 1.0\"\n rescue LoadError\n warn \"Couldn't load rake-compiler. Skipping. Run `rake newb` to fix.\"\n end",
"def build; end",
"def build_me\n # Download all softwares in parallel\n download\n build\n end",
"def my_post_build_step\n puts 'post-build step!'\nend",
"def setup_build_deps!\n ENV['PATH'] = \"#{File.expand_path('../../../vendor/depot_tools', __FILE__)}:#{ENV['PATH']}\"\n Dir.chdir(File.expand_path('../../../vendor', __FILE__)) do\n system \"fetch v8\" or fail \"unable to fetch v8 source\"\n Dir.chdir('v8') do\n unless system \"git checkout #{source_version}\"\n fail \"unable to checkout source for v8 #{source_version}\"\n end\n system \"gclient sync\" or fail \"could not sync v8 build dependencies\"\n end\n end\n end",
"def depend_on( name, version = nil )\n spec = Gem.source_index.find_name(name).last\n version = spec.version.to_s if version.nil? and !spec.nil?\n\n PROJ.gem.dependencies << case version\n when nil; [name]\n when %r/^\\d/; [name, \">= #{version}\"]\n else [name, version] end\nend",
"def test_dependencies\n []\n end",
"def test_dependencies\n []\n end",
"def dependent; end",
"def dependent; end",
"def install\n # ENV.deparallelize # if your formula fails when building in parallel\n args = std_cmake_args\n if build.with? \"static\"\n args << \"-DBUILD_SHARED_LIBS:BOOL=OFF\"\n end\n inreplace \"cmake/External_zlib.cmake\", \"1.2.8\", \"1.2.11\"\n inreplace \"cmake/External_zlib.cmake\", \"44d667c142d7cda120332623eab69f40\", \"1c9f62f0778697a09d36121ead88e08e\"\n\n system \"cmake\", \".\", *args\n system \"make\"\n system \"make\", \"install\"\n end",
"def build\n sh './configure -u couchdb -c'\n make :release\n end",
"def build_depfile(name, perform_installation=false)\n repo_hash = {}\n # set environment variable to determine what version of modules to install\n # this assumes that the environment variable repos_to_use has been coded in\n # your Depfile to allow installation of different versions of modules\n ENV['repos_to_use'] = name\n # parse Depfile and install modules in our tmp directory.\n eval(File.read(File.expand_path(options[:depfile])))\n # install modules if desired\n install! if perform_installation\n\n # iterate through all git modules\n each_module_of_type(:git) do |git_repo|\n abort(\"Module git_repo[:name] was defined multiple times in same Depfile\") if repo_hash[git_repo[:name]]\n repo_hash[git_repo[:name]] = git_repo\n end\n # clear out the modules once finished\n clear_modules\n repo_hash\n end",
"def build_gem\n Juwelier::Commands::BuildGem.build_for(self).run\n end",
"def depend_on( name, version = nil )\n spec = Gem::Specification.find_by_name(name)\n version = spec.version.to_s if version.nil? and !spec.nil?\n\n PROJ.gem.dependencies << case version\n when nil; [name]\n when %r/^\\d/; [name, \">= #{version}\"]\n else [name, version] end\nend",
"def require_gems; end",
"def activate_publish_deps\n dependency \"rdoc\", [\">= 4.0\", \"< 7\"], :developer if need_rdoc\n end",
"def build_environment_resources(environment, system_exec)\n puts \"Building all required resources for environment '#{environment.environment_name}'\"\n\n if environment.is_drupal_environment?\n build_css_and_js_for_drupal\n environment.create_template_resources\n end\n\n copy_project_dependencies_for_awestruct_image\n build_base_docker_images(environment, system_exec)\n build_environment_docker_images(environment, system_exec)\n\nend",
"def activate_inline_deps\n dependency \"RubyInline\", \"~> 3.9\"\n end",
"def setup_sbt_build_targets(cmp, build_vars)\n cmp_src_path = component_src_path cmp\n cmp_build_bin = component_build_bin cmp\n cmp_hadoop_versions = component_hadoop_versions cmp\n cmp_spark_versions = component_spark_versions cmp\n\n # SBT build (for Scala code)\n sbt_file = lookup_sbt_file(cmp_src_path)\n if sbt_file != ''\n if cmp_build_bin != 'sbt'\n STDERR.puts \"[#{cmp}]: the builder is configured (in the YAML file) as '#{cmp_build_bin}', however it seems to be 'sbt'. Look in the source directory ('#{cmp_src_path}') for more details\"\n end\n\n # Store the SBT build file\n build_vars['BUILDER_FILES'] << sbt_file\n\n # Extract the elements of version from the SBT build file\n (sbt_version, has_hadoop, has_spark) = lookup_version_from_sbt_build(sbt_file)\n\n # Store the elements of version\n build_vars['PACKAGE_VERSIONS'][sbt_version] = true\n build_vars['HAS_HADOOP'] = has_hadoop\n build_vars['HAS_SPARK'] = has_spark\n\n # Set up the SBT build command line\n sbt_args_hadoop_list = Array.new\n sbt_args_list = Array.new\n sbt_args_base = \"\\'; #{CONF_SBT_ARGS} ; set version := \\\"#{sbt_version}\"\n if has_hadoop\n # There should be a target for every version of Hadoop\n cmp_hadoop_versions.each do |hadoop_version|\n sbt_args = \"#{sbt_args_base}-hadoop#{hadoop_version}\"\n sbt_args_hadoop_list << sbt_args\n end\n end\n\n if has_spark\n # When building for Spark, Hadoop is necessarily part of the target\n cmp_spark_versions.each do |spark_version|\n sbt_args_hadoop_list.each do |sbt_args|\n sbt_args += \"-spark#{spark_version}\"\n sbt_args_list << sbt_args\n end\n end\n\n else\n # Target for Hadoop, but not Spark\n sbt_args_hadoop_list.each do |sbt_args|\n sbt_args_list << sbt_args\n end\n end\n\n if sbt_args_list.empty?\n # Target with Hadoop, and potentially Spark\n sbt_args = sbt_args_base + \"\\\"\\'\"\n\n cmp_builder_cmds = \"#{cmp_build_bin} #{sbt_args}\"\n build_vars['BUILDER_CMDS'] = \"#{cmp_builder_cmds}\"\n\n cmp_builder_tasks = \"+compile +package +publishM2 +publishLocal\"\n build_vars['BUILDER_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_builder_tasks}\"\n # Set up the SBT test command line\n cmp_test_tasks = \"+test\"\n build_vars['TEST_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_test_tasks}\"\n\n else\n # Target with neither Hadoop nor Spark\n sbt_args_list.each do |sbt_args|\n sbt_args += \"\\\"\\'\"\n\n cmp_builder_cmds = \"#{cmp_build_bin} #{sbt_args}\"\n build_vars['BUILDER_CMDS'] = \"#{cmp_builder_cmds}\"\n \n cmp_builder_tasks = \"+compile +package +publishM2 +publishLocal\"\n build_vars['BUILDER_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_builder_tasks}\"\n \n # Set up the SBT test command line\n cmp_test_tasks = \"+test\"\n build_vars['TEST_FULL_CMDS'] << \"#{cmp_builder_cmds} #{cmp_test_tasks}\"\n end\n end\n\n else\n STDERR.puts \"[#{cmp}]: cannot determine the builder in '#{cmp_src_path}'\"\n end\nend",
"def build_remote_dependencies\n modules_json_path = \"#{@mod.cache_dir}/.terraform/modules/modules.json\"\n return unless File.exist?(modules_json_path)\n\n initialized_modules = JSON.load(IO.read(modules_json_path))\n # For example of structure see spec/fixtures/initialized/modules.json\n initialized_modules[\"Modules\"].each do |meta|\n build_remote_mod(meta)\n end\n end",
"def build_package\n # Force timestamp to be initialized before anything else. This gives us a\n # stable timestamp for the process.\n timestamp\n # Prepare the work area: copy files from root_path to work_path based on\n # the resolved Manifest.txt.\n prepare_work_area\n # Anything that has been modified locally needs to be reset.\n restore_modified_files\n # Save both the final release metadata and the in-package release metadata.\n save_release_metadata\n # Vendor the dependencies for the package.\n vendor_dependencies\n # Request that supporting plug-ins build the package.\n request_build_package\n end",
"def install\n system \"cmake\", \".\", *std_cmake_args\n system \"make\", \"install\"\n end",
"def dependency_met?\n true\n end",
"def update_dependencies()\n\t\"berks vendor cookbooks #{(@debug ? '-d' : '-q')}\"\n end",
"def gemspec_building_block; end",
"def build_pkg(dist, arch, deps)\n start_dir = Dir.pwd\n build_dir = \"/tmp/rhobuild\"\n version = Rhoconnect::VERSION\n description = '\"Rhoconnect production environment\"'\n prefix = \"/opt/rhoconnect/installer\"\n gem_name = \"rhoconnect-#{version}.gem\"\n\n before_install_script = \"#{build_dir}/unix-like/pre_install.sh\"\n after_install_script = \"#{build_dir}/unix-like/post_install.sh\"\n before_remove_script = \"#{build_dir}/unix-like/pre_uninstall.sh\"\n after_remove_script = \"#{build_dir}/unix-like/post_uninstall.sh\"\n\n `rm -rf #{build_dir}` if File.exist?(\"#{build_dir}\")\n Dir.mkdir(\"#{build_dir}\")\n Dir.mkdir(\"#{build_dir}/unix-like\")\n\n # Copy all necessary Files into the build_dir\n system(\"cp install.sh Gemfile Gemfile.lock #{build_dir}\")\n system(\"cp -r installer/unix-like/*.sh #{build_dir}/unix-like\")\n system(\"cp -r installer/unix-like/*.rb #{build_dir}/unix-like\")\n system(\"cp pkg/#{gem_name} #{build_dir}\")\n\n # cd into the pkg dir so that fpm will create the package into the pkg dir.\n Dir.chdir(\"./pkg\") # it created by build task and should already exist\n\n # Construct fpm command\n fpm_cmd = \"fpm -s dir -t #{dist} -n rhoconnect -v #{version} -a #{arch} -C #{build_dir} --epoch 1 \" +\n \"--before-install #{before_install_script} --after-install #{after_install_script} \" +\n \"--before-remove #{before_remove_script} --after-remove #{after_remove_script} \" +\n \"--prefix #{prefix} --description #{description}\"\n # Add the list of dependencies to the fpm call\n deps.each { |dep| fpm_cmd << \" -d '#{dep}'\" }\n fpm_cmd << \" './'\"\n # Create the package\n system(fpm_cmd)\n # Leave no trace...\n system(\"rm -rf #{build_dir}\")\n Dir.chdir(start_dir)\nend",
"def enable_dependency_loading=(_arg0); end",
"def enable_dependency_loading=(_arg0); end",
"def build_cardio()\n CommandProcessor.command(\"VERSION=#{@current_release.version} ./releasinator.sh\", live_output=true)\nend",
"def testing_gems\n gem 'rake'\n gem 'rspec', '~> 3.0.0'\n gem 'rspec-wait'\n gem 'cucumber'\n gem 'simplecov'\n gem 'bundler', '~> 1.6'\n gem 'bunny', '~> 1.4'\n gem 'database_cleaner'\n gem 'racatt'\n gem 'codacy-coverage', :require => false\nend",
"def install_modules_dependencies(spec, new_arch_enabled: ENV['RCT_NEW_ARCH_ENABLED'] == \"1\")\n NewArchitectureHelper.install_modules_dependencies(spec, new_arch_enabled, $FOLLY_VERSION)\nend",
"def development?\n @dependency.type == :development\n end",
"def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n mkdir_p \"#{TGT_DIR}/lib\"\n # clean out leftovers from last build\n rm_f \"#{TGT_DIR}/libruby.so\" if File.exist? \"#{TGT_DIR}/libruby.so\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvm}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvm}\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvt}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvt}\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy and link libruby.so - pick the right one to \n # cp \"#{EXT_RUBY}/lib/libruby.so.#{RUBY_V}\", \"#{TGT_DIR}\"\n cp \"#{EXT_RUBY}/lib/libruby.so.#{rbvm}\", \"#{TGT_DIR}\"\n # copy include files - it might help build gems\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n # can't figure out ln -s? push pwd, cd, ln, pop\n #cdir = pwd\n #cd TGT_DIR\n chdir TGT_DIR do\n ln_s \"libruby.so.#{rbvm}\", \"libruby.so\"\n #ln_s \"libruby.so.#{RUBY_V}\", \"libruby.so.#{::RUBY_V[/^\\d+\\.\\d+/]}\"\n end\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n end",
"def fetch_dependencies()\n\t\"berks vendor cookbooks #{(@debug ? '-v' : '-q')}\"\n end",
"def setup_project_python_environment\n if not has_valid_virtualenv?\n return false\n end\n if should_do_requirements_install\n action \"Installing user defined python dependencies\" do\n unless install_user_python_dependencies()\n return false\n end\n note_install(\"pythonenv\")\n end\n end\n if should_install_python_dependencies?\n unless install_python_dependencies()\n return false\n end\n end\n return true\n end",
"def dependencies\n\t\t0\n\tend",
"def gemspec( * )\n\t\traise \"Circular dependency: can't depend on the gemspec to build itself\"\n\tend",
"def testBuild2LevelsDependency\n setRepository('DeliverablesProcessDependency') do |iRepoDir|\n runFSCMS(['Build', '--', '--target', 'TestType/TestID3/0.1/TestDeliverable'])\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal($FSCMSTest_RepositoryToolsDir, iFile.read)\n end\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID2/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal([\n $FSCMSTest_RepositoryToolsDir,\n \"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable\"\n ], iFile.read.split(\"\\n\"))\n end\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID3/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal([\n $FSCMSTest_RepositoryToolsDir,\n \"#{iRepoDir}/TestType/TestID2/0.1/Deliverables/TestDeliverable\"\n ], iFile.read.split(\"\\n\"))\n end\n end\n end",
"def install\n system \"cmake\", \"-S\", \".\", \"-B\", \"build\", *std_cmake_args\n system \"cmake\", \"--build\", \"build\"\n system \"cmake\", \"--install\", \"build\"\n end",
"def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n mkdir_p \"#{TGT_DIR}/lib\"\n # clean out leftovers from last build\n rm_f \"#{TGT_DIR}/libruby.so\" if File.exist? \"#{TGT_DIR}/libruby.so\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvm}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvm}\"\n rm_f \"#{TGT_DIR}/libruby.so.#{rbvt}\" if File.exist? \"#{TGT_DIR}/libruby.so.#{rbvt}\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy and link libruby.so - pick the right one to \n cp \"#{EXT_RUBY}/lib/libruby.so.#{rbvm}\", \"#{TGT_DIR}\"\n # copy include files - it might help build gems\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n chdir TGT_DIR do\n ln_s \"libruby.so.#{rbvm}\", \"libruby.so\"\n end\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n end",
"def gem_build_task(gem,namespace_name=:gems)\n namespace(namespace_name) do\n gem_dir = CapyBrowser::Rake::RelativePath.new('tmp/gems').path\n directory gem_dir\n\n desc gem.build_description\n task :build => [:directories,gem.name.to_sym ] do |t|\n t.reenable\n end\n\n desc \"Build all gems\"\n task :rebuild do |t|\n rm_rf(gem_dir)\n Rake::Task[\"gems:build\"].reenable\n Rake::Task[\"gems:build\"].invoke\n end\n\n desc gem.build_gemfile_description\n task gem.name.to_sym => [gem.gemfile] do |t|\n t.reenable\n end\n\n file \"tmp/vendor/cache/#{gem.gemfile}\" => [gem.gemfile_path.relative_path]\n file gem.gemfile_path.relative_path => gem.gemfile\n file gem.gemfile => gem_dir do |t|\n puts gem.invoke!\n rm_rf(gem_dir)\n end\n end\nend",
"def build(chroot,dirs,task,add_to_autoreq=true,snapshot_release=false)\n validate_in_mock_group?\n _verbose = ENV.fetch('SIMP_PKG_verbose','no') == 'yes'\n\n # Default package metadata for reference\n default_metadata = YAML.load(File.read(\"#{@src_dir}/build/package_metadata_defaults.yaml\"))\n\n metadata = Parallel.map(\n # Allow for shell globs\n Array(dirs),\n :in_processes => get_cpu_limit,\n :progress => task.name\n ) do |dir|\n result = []\n\n fail(\"Could not find directory #{dir}\") unless Dir.exist?(dir)\n\n Dir.chdir(dir) do\n built_rpm = false\n unique_build = (get_cpu_limit != 1).to_s\n\n if _verbose\n $stderr.puts(\"Running 'rake pkg:rpm' on #{File.basename(dir)}\")\n end\n\n # We're building a module, override anything down there\n if File.exist?('metadata.json')\n unique_namespace = (0...24).map{ (65 + rand(26)).chr }.join.downcase\n\n Simp::Rake::Pkg.new(Dir.pwd, nil, unique_namespace, @simp_version)\n\n Rake::Task[\"#{unique_namespace}:pkg:rpm\"].invoke(chroot, unique_build, snapshot_release)\n\n built_rpm = true\n\n # We're building one of the extra assets and should honor its Rakefile\n elsif File.exist?('Rakefile')\n\n rake_flags = Rake.application.options.trace ? '--trace' : ''\n\n cmd = %{SIMP_BUILD_version=#{@simp_version} rake pkg:rpm[#{chroot},#{unique_build},#{snapshot_release}] #{rake_flags} 2>&1}\n\n build_success = true\n begin\n ::Bundler.with_clean_env do\n %x{#{cmd}}\n build_success = $?.success?\n end\n\n built_rpm = true\n rescue\n build_success = false\n end\n\n unless build_success\n if _verbose\n $stderr.puts(\"First 'rake pkg:rpm' attempt failed, running bundle and trying again.\")\n end\n\n ::Bundler.with_clean_env do\n %x{bundle install --with development}\n %x{#{cmd}}\n end\n end\n else\n puts \"Warning: '#{dir}' could not be built via Rake\"\n end\n\n if built_rpm\n tarballs = Dir.glob('dist/*.tar.gz')\n srpms = Dir.glob('dist/*.src.rpm')\n rpms = (Dir.glob('dist/*.rpm') - srpms)\n\n # Not all items generate tarballs\n tarballs.each do |pkg|\n if (File.stat(pkg).size == 0)\n raise(\"Empty Tarball '#{pkg}' generated for #{dir}\")\n end\n end\n raise(\"No SRPMs generated for #{dir}\") if srpms.empty?\n raise(\"No RPMs generated for #{dir}\") if rpms.empty?\n\n last_build = {\n 'git_hash' => %x{git show-ref --head HEAD}.chomp,\n 'rpms' => {}\n }\n\n # Glob all generated rpms, and add their metadata to a result array.\n rpms.each do |rpm|\n # get_info from each generated rpm, not the spec file, so macros in the\n # metadata have already been resolved in the mock chroot.\n metadata = Simp::RPM.get_info(rpm)\n\n if File.exist?('build/package_metadata.yaml')\n metadata.merge!(YAML.load_file('build/package_metadata.yaml'))\n end\n\n rpm_stat = File.stat(rpm)\n\n last_build['rpms'][rpm] = {\n 'metadata' => metadata,\n 'size' => rpm_stat.size\n }\n\n result << metadata\n end\n\n File.open('dist/.last_build_metadata', 'w') do |fh|\n fh.puts(last_build.to_yaml)\n end\n end\n\n if _verbose\n $stderr.puts(\"Finshed 'rake pkg:rpm' on #{File.basename(dir)}\")\n end\n end\n\n result\n end\n\n metadata.each do |mod|\n # Each module could generate multiple rpms, each with its own metadata.\n # Iterate over them to add all built rpms to autorequires.\n mod.each do |module_pkginfo|\n next unless (module_pkginfo && module_pkginfo.is_a?(Hash))\n\n # Set up the autorequires\n if add_to_autoreq\n # Register the package with the autorequires\n mode = 'r+'\n mode = 'w+' unless File.exist?(\"#{@src_dir}/build/autorequires\")\n autoreq_fh = File.open(\"#{@src_dir}/build/autorequires\",mode)\n\n begin\n # Reads the autorequires file, then empties it\n autorequires = []\n autorequires += autoreq_fh.read.split(\"\\n\")\n autoreq_fh.rewind\n autoreq_fh.truncate(0)\n\n # The SIMP Rakefile expects the autorequires to be in this format.\n autorequires << \"#{module_pkginfo[:name]} #{module_pkginfo[:version]} #{module_pkginfo[:release]}\"\n autoreq_fh.puts(autorequires.sort.uniq.join(\"\\n\"))\n ensure\n autoreq_fh.flush\n autoreq_fh.close\n end\n end\n end\n end\n end",
"def cabal(arg)\n arg.with_defaults(:dev => 'dev')\n if arg[:dev] == 'prod'\n 'cabal'\n else\n 'cabal-dev'\n end\n end"
] | [
"0.6862918",
"0.67779785",
"0.6605081",
"0.6427604",
"0.6401638",
"0.6370821",
"0.62428576",
"0.6164104",
"0.6164104",
"0.6134335",
"0.6026515",
"0.6026515",
"0.6026515",
"0.594891",
"0.59437174",
"0.5839825",
"0.5780695",
"0.5748207",
"0.57473993",
"0.57118607",
"0.56998265",
"0.5680032",
"0.5666816",
"0.55673045",
"0.5553601",
"0.5553601",
"0.5553601",
"0.55466515",
"0.5538157",
"0.55217826",
"0.55217826",
"0.5519493",
"0.5484798",
"0.54724073",
"0.54464006",
"0.5435829",
"0.54142326",
"0.5411415",
"0.5400483",
"0.5386782",
"0.53857106",
"0.5370171",
"0.5365297",
"0.5351393",
"0.53431296",
"0.533195",
"0.533195",
"0.53318095",
"0.53314954",
"0.5329625",
"0.53204703",
"0.5318234",
"0.53120536",
"0.5303001",
"0.52892995",
"0.52800345",
"0.52775717",
"0.527258",
"0.5269118",
"0.5267966",
"0.52616966",
"0.52555907",
"0.52525264",
"0.52387947",
"0.52387947",
"0.52341557",
"0.52341557",
"0.522743",
"0.5222687",
"0.5220484",
"0.521786",
"0.5217262",
"0.521222",
"0.5204341",
"0.5199813",
"0.5187717",
"0.51750255",
"0.51721495",
"0.51601803",
"0.5147383",
"0.51221305",
"0.51193964",
"0.5115175",
"0.51141286",
"0.51048714",
"0.51048714",
"0.50978106",
"0.5097517",
"0.50964344",
"0.5092484",
"0.50806177",
"0.50751054",
"0.50584775",
"0.50555366",
"0.50493675",
"0.50458884",
"0.5045265",
"0.50407934",
"0.5036601",
"0.5034939",
"0.5031975"
] | 0.0 | -1 |
Save auto scale group | def group_save(group)
raise NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform_save\n api.group_save(self)\n end",
"def auto_scaling_group_name\n data.auto_scaling_group_name\n end",
"def save_groups\n self.groups.each { |c| if c.destroy_association? then c.destroy else c.save end }\n self.added_groups.each { |c| c.save unless c.nil? } unless self.added_groups.nil?\n end",
"def save\n requires :id\n requires :adjustment_type\n requires :auto_scaling_group_name\n requires :scaling_adjustment\n\n options = Hash[self.class.aliases.map { |key, value| [key, send(value)] }]\n options.delete_if { |key, value| value.nil? }\n\n service.put_scaling_policy(adjustment_type, auto_scaling_group_name, id, scaling_adjustment, options)\n reload\n end",
"def autosave; end",
"def scale=(val)\n self['scale'] = val\n end",
"def save(nsc)\n # load includes admin users, but save will fail if they are included.\n admins = nsc.users.select { |u| u.is_admin }.map { |u| u.id }\n @users.reject! { |id| admins.member? id }\n params = @id ? { 'entityid' => @id, 'mode' => 'edit' } : { 'entityid' => false, 'mode' => false }\n uri = AJAX.parameterize_uri('/data/assetGroup/saveAssetGroup', params)\n data = JSON.parse(AJAX.post(nsc, uri, _to_entity_details, AJAX::CONTENT_TYPE::JSON))\n data['response'] == 'success.'\n end",
"def bgsave; end",
"def bgsave; end",
"def scale(max_size, desired_capacity)\n client.update_auto_scaling_group(auto_scaling_group_name: asg_name, max_size: max_size, desired_capacity: desired_capacity)\n end",
"def refresh_ce_group!\n self.save! if refresh_ce_group\n end",
"def store_group(uuid)\n Uploadcare::Group.store(uuid)\n end",
"def save\n deleted! if @deleted\n # If there is an ID, update that entry\n if @id\n Cli.edit_group( @id, name: @name )\n else # If no ID, that means this is a new entry\n Cli.add_group( @name )\n set_id_after_save\n end\n self\n end",
"def scale(name)\n \n end",
"def store_zoom #:nodoc:\n # If scale is 100 we don't need to write a record\n return if @zoom == 100\n\n record = 0x00A0 # Record identifier\n length = 0x0004 # Bytes to follow\n\n header = [record, header].pack(\"vv\")\n data = [@zoom, 100].pack(\"vv\")\n\n append(header, data)\n end",
"def save\n \n transaction do |transaction|\n check_usergroups! if self.usergroups and (not self.usergroups.empty?)\n super\n update_aspects\n transaction.commit\n end\n\n end",
"def add_group!( group )\n save if add_group( group )\n end",
"def scale(sx,sy)\n set RGhost::Scale.new(sx,sy)\n \n end",
"def save_group_visibilities(group_ids)\n groups.clear\n if group_ids\n selected_groups = Group.find(group_ids)\n selected_groups.each do |group|\n groups << group\n end\n end\n end",
"def scale\n @photo = Photo.find(params[:id])\n img = Magick::Image.read('public' + @photo.attachment_url).first\n img = img.scale(1.5)\n img.write('public' + @photo.attachment_url)\n end",
"def save_rmagick(path, margin=4)\n scale = 8\n w = (width+margin+margin)*scale\n h = (width+margin+margin)*scale\n canvas = Magick::Image.new(w,h);\n gc = Magick::Draw.new\n gc.fill('black')\n gc.stroke('black')\n points.each do |p|\n gc.rectangle( (p[0]+margin)*scale,(p[1]+margin)*scale,\n (p[0]+margin)*scale+scale-1,(p[1]+margin)*scale+scale-1 )\n end\n gc.draw(canvas)\n canvas.write(path) { self.depth = 8; }\n end",
"def save\n con = Group.open_connection\n\n if (self.groupid)\n # update\n sql = \"UPDATE groups SET groupname='#{self.groupname}', grouptype='#{self.grouptype}' WHERE groupid = #{self.groupid}\"\n else\n # add\n sql = \"INSERT INTO groups (groupname, grouptype) VALUES ('#{self.groupname}', '#{self.grouptype}')\"\n end\n #\n #\n con.exec(sql)\n #\n end",
"def save\n response = @server.post(\"#{@parent_path}/layergroups\", JSON.generate({ \"layerGroup\" => @parameters }))\n raise ArgumentError, \"Error creating layer group.\\n #{response.body}\" if response.code != \"201\"\n @path = response.header[\"Location\"]\n parse(@server.get(@path).body)\n self\n end",
"def set_scale\n @scale = Scale.find(params[:id])\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 save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def persist!\n @snapshot.save!\n @processes.each(&:save!)\n persist_labels\n persist_metrics\n end",
"def update_auto_scaling_group(auto_scaling_group_name, options = {})\n if availability_zones = options.delete('AvailabilityZones')\n options.merge!(AWS.indexed_param('AvailabilityZones.member.%d', [*availability_zones]))\n end\n request({\n 'Action' => 'UpdateAutoScalingGroup',\n 'AutoScalingGroupName' => auto_scaling_group_name,\n :parser => Fog::Parsers::AWS::AutoScaling::Basic.new\n }.merge!(options))\n end",
"def update_group(increment)\n end",
"def scale=(scaling)\n @scale.set(scaling)\n @transform_dirty = true\n scaling\n end",
"def scales\n \n end",
"def save_everything\r\n\t\tself.pictures = ImageAsset.where(attachable_id: self.id, attachable_type: \"Product\")\r\n\t\tself.pictures.each do |asset|\r\n\t\t\tasset.product_id = self.id\r\n\t\t\tasset.user_id = self.user.id\r\n\t\t\tasset.save!\r\n\t\tend\r\n\t\tif !self.pictures.empty?\r\n\t\t\tself.product_pic = self.pictures.last\r\n\t\tend\r\n\t\tself.feature_groups.each do |f|\r\n\t\t\tf.product = self\r\n\t\t\tf.product_id = self.id\r\n\t\t\tf.save!\r\n\t\tend\r\n\t\t\r\n\tend",
"def bgsave\n on_each_node :bgsave\n end",
"def setscale(*)\n super\n end",
"def save\n on_each_node :save\n end",
"def auto_scaling_group(group_name)\n AutoScalingGroup.new(group_name)\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 set_group_belonging\n #group_number = self.id % 4\n #self.update_attributes(group: group_number)\n self.update_attributes(group: 1)\n end",
"def save\n super save\n end",
"def keep(persist_attribs)\n persist_attribs[:id] = persist_attribs[:group_id]\n super\n end",
"def handle_irc_set_scale(response)\n key = response.user.name + '-scale'\n persisted_scale = redis.hget(REDIS_KEY, key)\n\n if ['c','f','k'].include? response.matches[0][0].downcase\n scale_to_set = response.matches[0][0].downcase\n else\n # Toggle mode\n scale_to_set = get_other_scale(persisted_scale)\n end\n\n if persisted_scale == scale_to_set\n reply = \"Scale is already set to #{scale_to_set}!\"\n else\n redis.hset(REDIS_KEY, key, scale_to_set)\n reply = \"Scale set to #{scale_to_set}\"\n end\n response.reply reply\n end",
"def scale(value)\n @tileset.scale = value\n end",
"def setup_group\n self.status = 'pending'\n make_slug\n self.valid? && self.save! ? true : false\n end",
"def create\n @size_group = SizeGroup.new(params[:size_group])\n result = @size_group.save\n if result\n for size in params[:size]\n new_size = Size.new(size)\n new_size.save\n @size_group.sizes << new_size\n end\n end\n respond_to do |format|\n if result\n flash[:notice] = 'SizeGroup was successfully created.'\n format.html { redirect_to([:admin, @size_group]) }\n format.xml { render :xml => @size_group, :status => :created, :location => @size_group }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @size_group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def init_groups\n @@client.describe_auto_scaling_groups.auto_scaling_groups\n end",
"def persist_metrics\n self.metrics.each(&:save)\n end",
"def replace_namespaced_stateful_set_scale(name, namespace, body, opts = {})\n data, _status_code, _headers = replace_namespaced_stateful_set_scale_with_http_info(name, namespace, body, opts)\n return data\n end",
"def save(*args)\n\t grouping_too = self.new_record?\n\t res = super\n\t self.groupings.create(competition: self, name: self.fullname(),\n\t\t\t\t\tbracket_grouping: self.playoffbracket) if grouping_too\n\t res # return result of call to super\n\tend",
"def save\n synchronize(:encinch_storage_save) do\n @storage.save\n end\n end",
"def save!(*args)\n\t grouping_too = self.new_record?\n\t res = super\n\t self.groupings.create!(competition: self, name: self.fullname(),\n\t\t\t\t\tbracket_grouping: self.playoffbracket) if grouping_too\n\t res # return result of call to super\n\tend",
"def remove_auto_scaling_group_properties\n properties = []\n properties << :AvailabilityZones\n properties << :HealthCheckGracePeriod\n properties << :HealthCheckType\n add_patch Patches::RemoveProperty.new 'AWS::AutoScaling::AutoScalingGroup', properties\n end",
"def update\n @grade_scale = GradeScale.find(params[:id])\n respond_to do |format|\n if(params[:grade_scale][:scale_type] != \"manual\")\n @grade_scale.manual_grades.clear\n end\n if @grade_scale.update_attributes(params[:grade_scale])\n format.js\n end\n end\n end",
"def save\n end",
"def recreate_object_key\n $feed.unrecord(\"group:#{id}\")\n data = { id: self.permalink, name: self.display_name }\n data[:photo] = self.profile_photo_url(:thumb) if self.profile_photo\n $feed.record(\"group:#{id}\", data)\n end",
"def assign\n @picture = Picture.find_by(id: params[:picture_id])\n @content.essence.picture = @picture\n @content.touch # We need to touch manually because its not saved yet.\n @element = @content.element\n @dragable = @options[:grouped]\n @options = @options.merge(dragable: @dragable)\n end",
"def set_small_group\n @small_group = SmallGroup.find(params[:id])\n end",
"def before_save\n prepare_attributes\n find_song_groups!\n end",
"def update_marking_group(name, active_category)\n marking_group_name.set name\n active_marking_group_value.select active_category\n click_link('Update')\n sleep 2\n end",
"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 after_store\n if group_owner?\n self.stored_group_notification_count = group_notification_count\n self.stored_group_member_notifier_count = group_member_notifier_count\n self.stored_group_members = group_members.as_json\n self.stored_group_members.each do |group_member|\n # Cast Time and DateTime field to String to handle Dynamoid unsupported type error\n group_member.each do |k, v|\n group_member[k] = v.to_s if v.is_a?(Time) || v.is_a?(DateTime)\n end\n end\n save\n else\n group_owner.after_store\n end\n end",
"def save_task_groups(task, params)\n @task.task_groups = params[:task_groups].map {|gp| TaskGroup.find(gp)} if params[:task_groups]\n @task.save\n end",
"def scale\n @data['scale']\n end",
"def scale\n self['scale']\n end",
"def save\n SAVE\n end",
"def save\n end",
"def save\n end",
"def before_destroy\n default = Group.find(:first, \n :conditions => [\"template_id = ? and name = '_default'\", \n self.template_id])\n if (default.is_default?)\n self.fields.each do |f|\n f.group_id = default.id\n f.save\n end\n #trigger a save to (hopefully) refresh the data for AS\n default.save\n end\n end",
"def save_group(user)\n ActiveRecord::Base.transaction do\n save\n @user_group = UserGroup.new\n @user_group.user_id = user.id\n @user_group.group_id = id\n @user_group.save\n @member = GroupMember.new\n @member.e_mail = user.email\n @member.group_id = id\n @member.save\n end\n end",
"def save_object\n end",
"def assign_group(group_size, students)\n\nend",
"def save\n end",
"def save\n end",
"def save\n end",
"def set_group\n data[:group]\n end",
"def save!\n end",
"def generate_save\n YAML.dump(self)\n end",
"def save\n das = []\n @map.each_key do |key|\n if key == DATAMATRIX_KEY\n das.concat save_data_matrix_alt(@object, @map[key])\n elsif @map[key].is_a? UploadAssoc\n # TODO: update this to lazy associate once aq is updated to hav lazy upload assoc (on master, just not on server yet)\n @object.associate(key, @map[key].tag, @map[key].upload)\n else\n das << @object.lazy_associate(key, @map[key])\n end\n end\n DataAssociation.import(das, on_duplicate_key_update: [:object]) unless das.empty?\n @object.save\n nil\n end",
"def scale(xscale, yscale = xscale)\n current_transformation.scale(xscale, yscale)\n self[\"transform\"] = current_transformation.to_s\n end",
"def save(name)\n Highgui.save_image name, @iplimage_struct\n end",
"def set_scale_type\n @scale_type = ScaleType.find(params[:id])\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 update\n @group = SuperSimpleCms::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 super_simple_group_path(@group) } \n format.js { redirect_to formatted_super_simple_group_path(@group, :js) }\n format.xml { render :xml => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"new\" }\n format.js { render :action => \"new\", :layout=>false}\n format.xml { render :xml => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def auto_orient\n # debugger\n manipulate! do |img, index, options|\n # options[:write] = {\n # :quality => 100,\n # :depth => 8\n # }\n img = img.auto_orient\n end\n end",
"def save\n filename = Time.now.strftime(\"measures-%Y-%m-%d-%H%M%S.json\")\n dirname = \"goals/measures\"\n hash = { \"objective\" => @name}\n @outcomes.each {|o|\n hash.store(\"outcome\", o.name)\n hash.store(\"scale\", \"#{o.scale.class.name}.rb\")\n hash.store(\"baseline\", o.baseline)\n hash.store(\"baseline date\", o.baseline_date)\n hash.store(\"target\", o.target)\n hash.store(\"target date\", o.target_date)\n hash.store(\"measure\", o.last_measure.value)\n hash.store(\"measure date\", Time.now.strftime(\"%b %-d, %Y\"))\n }\n\n if !File.exists? dirname\n FileUtils.mkdir_p dirname\n end\n\n File.open(\"#{dirname}/#{filename}\",\"a\") do |f|\n f.write(JSON.pretty_generate(hash))\n f.write(\"\\n\")\n end\n end",
"def max_snapshot_groups=(_arg0); end",
"def save_image!(rmagick_image, model_image_attr, tmp_filename='custom')\n t_custom = Tempfile.new([tmp_filename, '.jpg'])\n rmagick_image.write(t_custom.path)\n model_image_attr.store!(File.open(t_custom.path))\n send(\"write_#{model_image_attr.mounted_as}_identifier\")\n save # pretty sure we need to save the model\n t_custom\n end",
"def save_grip; end",
"def after_create entity_group\n ueg=entity_group.user_entity_groups.build\n ueg.user=entity_group.creator\n ueg.save\n end",
"def regenerate_styles!\n logger.debug(\"******** in regenerate\")\n self.label_image.reprocess! \n self.processing = false \n self.save(:validate=> false)\n end",
"def save\n perform_save\n end",
"def group= group\n unless group.class == Modeles::Group\n groupname = group.to_s\n group = Modeles::Group.find_by_name groupname\n unless group\n @errors << \"Group #{group} doesn't exists\"\n return false\n end\n end\n @fileInTable.group = group\n @fileInTable.path = @user + '/'\n @fileInTable.path += group.name + '/' + @path\n @group = group.name\n @path = @user + '/' + @group + '/' + @path\n save\n end",
"def zoom_to_scale(new_scale)\n @map_state.merge!('Scale' => new_scale)\n update_session do |xml|\n set_map_state xml\n end\n \n TileCache.clear(@session_id)\n end",
"def max_snapshot_groups; end"
] | [
"0.63678324",
"0.57937557",
"0.57171226",
"0.5675286",
"0.5606568",
"0.55539775",
"0.55265784",
"0.55089664",
"0.55089664",
"0.5476972",
"0.5460333",
"0.5449027",
"0.54341185",
"0.540207",
"0.53455514",
"0.5318177",
"0.5265907",
"0.5244669",
"0.52410775",
"0.5230672",
"0.51987803",
"0.5183292",
"0.51731086",
"0.51466143",
"0.51419437",
"0.5108679",
"0.5108679",
"0.5108679",
"0.5108679",
"0.5108679",
"0.5108679",
"0.5108679",
"0.5108679",
"0.51070654",
"0.5106114",
"0.5096018",
"0.50894046",
"0.5088551",
"0.5070759",
"0.5063332",
"0.5063255",
"0.50591815",
"0.5032595",
"0.50237477",
"0.5011597",
"0.49993175",
"0.497638",
"0.4970937",
"0.49689406",
"0.49687755",
"0.49381986",
"0.49322003",
"0.49259454",
"0.49258614",
"0.49253377",
"0.49230722",
"0.49117848",
"0.490967",
"0.49065167",
"0.49018195",
"0.4899716",
"0.48979473",
"0.48960954",
"0.4892548",
"0.48795018",
"0.48733345",
"0.48665813",
"0.4860384",
"0.4857763",
"0.48503834",
"0.48424497",
"0.48384055",
"0.48384055",
"0.48369887",
"0.48313507",
"0.48267046",
"0.4825757",
"0.48240927",
"0.48240927",
"0.48185703",
"0.4806084",
"0.48060495",
"0.4802352",
"0.47937384",
"0.4789193",
"0.47874492",
"0.4782115",
"0.47771126",
"0.47771016",
"0.47755164",
"0.47718078",
"0.47706535",
"0.47700626",
"0.47679725",
"0.47672683",
"0.47632712",
"0.4760932",
"0.47593278",
"0.47585386",
"0.47541308"
] | 0.6210058 | 1 |
Reload the group data from the API | def group_reload(group)
if(group.persisted?)
result = request(
:method => :get,
:path => "/groups/#{group.id}",
:expects => 200
)
grp = result.get(:body, :group)
group.load_data(
:name => grp.get('groupConfiguration', :name),
:minimum_size => grp.get('groupConfiguration', 'minEntities'),
:maximum_size => grp.get('groupConfiguration', 'maxEntities'),
:desired_size => grp.get(:state, 'desiredCapacity'),
:current_size => grp.get(:state, 'activeCapacity'),
:servers => grp.get(:state, :active).map{|s| AutoScale::Group::Server.new(self, :id => s[:id])}
).valid_state
else
group
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def perform_reload\n api.group_reload(self)\n end",
"def fetch_group_data\n response = fetch_data(@@SETTINGS.group_tab)\n unless response.nil?\n adjust_groups response\n end\n end",
"def refresh_ce_group!\n self.save! if refresh_ce_group\n end",
"def refresh\n fetch_api_data\n self\n end",
"def reload_data\n reset_collection_data\n reload_collection_data\n end",
"def reload!\n fetch_data!\n end",
"def group_reload\n\t\tRails.application.load_seed \n\t\t@items = Item.all\n\t\trender 'index'\n\tend",
"def update_groups\n unless group_ids.nil?\n self.groups_members.each do |m|\n m.destroy unless group_ids.include?(m.group_id.to_s)\n group_ids.delete(m.group_id.to_s)\n end\n group_ids.each do |g|\n self.groups_members.create(:group_id => g) unless g.blank?\n end\n reload\n self.group_ids = nil\n end\n end",
"def reload\n reset\n fetch\n end",
"def reload\n reset\n fetch\n end",
"def load_groups\n @groups = Group.order(:name)\n end",
"def populateGroup(group_id)\n database = SQLite3::Database.new( @database )\n group = $gm.get(\"/groups/#{group_id}\", @token)['response']\n\n if group['image_url'].nil?\n group['image_url'] = 'img/groupme.png'\n elsif group['image_url'].empty?\n group['image_url'] = 'img/groupme.png'\n else\n group['image_url'] = \"#{group['image_url']}.avatar\"\n end\n\n group_info = Hash.new\n user_info = Hash.new\n user_group_info = Hash.new\n \n #Adds new group if they don't exist, and updates the group if they do \n if database.execute( \"SELECT * FROM groups WHERE group_id='#{group['group_id']}'\").empty? \n group_info[group['group_id']] = [group['created_at'], group['name'], group['image_url'], group['creator_user_id'], false ]\n $logger.info \"Adding new group #{group['name']} to the database\"\n else\n group_info[group['group_id']] = [group['created_at'], group['name'], group['image_url'], group['creator_user_id'], true ]\n end\n \n #Adds any new members to the group, and updates any members who have made changes \n group['members'].each do | member |\n\n if member['image_url'].nil?\n member['image_url'] = 'img/groupme.png'\n elsif member['image_url'].empty?\n member['image_url'] = 'img/groupme.png'\n else\n member['image_url'] = \"#{member['image_url']}.avatar\"\n end\n\n if database.execute( \"SELECT * FROM users WHERE user_id='#{member['user_id']}'\").empty?\n user_info[member['user_id'] ] = [member['image_url'], false ]\n else\n user_info[member['user_id'] ] = [member['image_url'], true ]\n end\n if database.execute( \"SELECT * FROM user_groups WHERE user_id='#{member['user_id']}' AND group_id='#{group['group_id']}'\").empty?\n user_group_info[member['user_id']] = [group['group_id'], member['nickname'], false]\n else\n user_group_info[member['user_id']] = [group['group_id'], member['nickname'], true]\n end\n end\n\n database.transaction\n group_info.each do | key, value |\n if value[4]\n database.execute( \"UPDATE groups SET name=?, image=?, creator=?, created_at=datetime('#{value[0]}','unixepoch') WHERE group_id='#{key}'\",\n value[1],\n value[2],\n value[3] ) \n else \n database.execute( \"INSERT INTO groups(group_id, name, image, creator, created_at) VALUES (?, ?, ?, ?, datetime('#{value[0]}','unixepoch'))\",\n\t\t key,\n value[1],\n value[2],\n value[3] )\n end\n end\n \n user_info.each do | key, value |\n if value[1]\n database.execute( \"UPDATE users SET avatar_url=? WHERE user_id='#{key}'\",\n value[0] )\n else\n database.execute( \"INSERT INTO users(user_id, avatar_url) VALUES (?, ?)\",\n key,\n value[0] )\n end \n end\n\n user_group_info.each do | key, value |\n if value[2]\n database.execute( \"UPDATE user_groups SET name=? WHERE user_id='#{key}' AND group_id='#{value[0]}'\",\n value[1] )\n else\n database.execute( \"INSERT INTO user_groups(user_id, group_id, name) VALUES (?, ?, ?)\",\n key,\n value[0],\n value[1] )\n end\n end\n database.commit\n end",
"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 refresh!\n response = Wucluster.ec2.describe_security_groups(:group_name => id)\n update! response.securityGroupInfo.item.first\n end",
"def set_api_v1_group_update\n @api_v1_group_update = Api::V1::GroupUpdate.find(params[:id])\n end",
"def refresh_node_group_model(node_group_model)\n get_node_group(node_group_model['id'])\n end",
"def reload\n resp = api_client.get(url)\n refresh(JSON.load(resp.body))\n end",
"def fetch_group\n @group = Group.find(params[:group_id])\n end",
"def set_group\n data[:group]\n end",
"def update_grouped group, forced = false\n\n # get sorted list of clients in group and calculate hash\n \n group_array = group.client_infos( uuid )\n sorted_group = group_array.sort { |m,n| m[:id] <=> n[:id] }\n\n md5 = Digest::MD5.hexdigest( sorted_group.to_json )\n\n # if group has changed or the method is called with the forced parameter\n\n puts \"forced group update for client #{uuid} after 60s\" if forced\n\n if (@current_group_hash != md5 && group.size > 0) || forced\n\n # set response for peek request\n\n response = {\n :group_id => md5,\n :group => sorted_group\n }\n\n @grouped.call( response ) if @grouped\n\n # if client was peeking, stop\n # (if this method was called by another client's environment update or signing off)\n\n @peek_timer.cancel if @peek_timer\n end\n end",
"def reload\n self.data = self.class.load_data\n self\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 update\n @group.update(group_params)\n respond_with(@group)\n end",
"def update(options)\n response = super(options)\n\n if options[:redownload]\n attributes = options.merge(response[:data][:adgroups][identifier]).with_indifferent_access\n set_attrs(attributes)\n end\n\n response\n end",
"def index\n @api_v1_group_updates = Api::V1::GroupUpdate.all\n end",
"def reload\n if (mtime = File::mtime(@path)) > @mtime\n @group.clear\n File.open(@path){|io|\n while line = io.gets\n line.chomp!\n group, members = line.split(/:\\s*/)\n @group[group] = members.split(/\\s+/)\n end\n }\n @mtime = mtime\n end\n end",
"def update\n group = Group.find(params[:id])\n if group.update(group_params)\n render json: group\n else\n render json: group.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @group.update(group_params)\n format.json { head :no_content }\n else\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateGroup params = {}\n \n APICall(path: 'groups.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n update_params = params_for_update\n\n errors = update_article_groups(@group, update_params)\n if errors\n render_errors(errors)\n return\n end\n\n respond_with @project do |format|\n format.json { render json: decorate_group(@group) }\n end\n end",
"def reload\n clear_memoizations!\n remove = data.keys.find_all do |k|\n ![:id, :name].include?(k.to_sym)\n end\n remove.each do |k|\n data.delete(k)\n end\n super\n end",
"def load_group\n @group = Group.find_by_name(params[:id].titleize) or raise ActiveRecord::RecordNotFound\n end",
"def set_group\n #@group = Group.find(params[:id])\n end",
"def reload_data\n self.class.new reinit_endpoint.do_get\n end",
"def update\n counter = 0\n groupCounter = 1\n if !params[:group].nil?\n $inspectparams = params[:group]\n params[:group].each do |group|\n if groupCounter > $groupUpdateNumber || group[:id] == \"\"\n puts \"WORKKKK\"\n break if group[:group_name] == \"\" || group[:end_time] == \"\"\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 end\n break if group[:group_name] == \"\" || group[:end_time] == \"\"\n @groupUpdate = Group.find_by(id: group[:id])\n @groupUpdate.update(group_name: group[:group_name].downcase, end_time: group[:end_time], time_zone: current_user.time_zone) if [email protected]?\n puts \"this is @group: \" + @group.inspect.to_s\n groupCounter += 1\n counter += 1\n end\n end\n redirect_to root_path, notice: \"successfully updated your classes\"\n end",
"def groups\r\n save_default_group(params)\r\n delete_group(params)\r\n end",
"def load_group group_id, info_level = \"Full\", include_children = \"true\"\n\t\t\t@response = api_request 'LoadGroup', [group_id, info_level, include_children]\n\t\t\traise ZenfolioAPI::ZenfolioAPISessionError, @response['error']['message'] if @response['result'].nil? && @response['error'].length > 0\n\n\t\t\telements = []\n\t\t\t@response['result']['Elements'].each do |element|\n\t\t\t\tif element['$type'] == \"PhotoSet\"\n\t\t\t\t\telements << ZenfolioAPI::Model::Gallery.new(:id => element['Id'], :type => element['$type'], :caption => element['Caption'], \n\t\t\t\t\t\t:created_on => element['CreatedOn']['Value'], :modified_on => element['ModifiedOn']['Value'], :photo_count => element['PhotoCount'],\n\t\t\t\t\t\t:image_count => element['ImageCount'], :video_count => element['VideoCount'], :photo_bytes => element['PhotoBytes'], :views => element['Views'],\n\t\t\t\t\t\t:featured_index => element['FeaturedIndex'], :is_random_title_photo => element['IsRandomTitlePhoto'], :upload_url => element['UploadUrl'],\n\t\t\t\t\t\t:video_upload_url => element['VideoUploadUrl'], :page_url => element['PageUrl'], :mailbox_id => element['MailboxId'], :text_cn => element['TextCn'], \n\t\t\t\t\t\t:photo_list_cn => element['PhotoListCn'], :group_index => element['GroupIndex'], :title => element['Title'], :owner => element['Owner'])\n\t\t\t\telse\n\t\t\t\t\t#group_elements = load_group element['Id']\n\t\t\t\t\telements << ZenfolioAPI::Model::Group.new(:id => element['Id'], :created_on => element['CreatedOn']['Value'], :modified_on => element['ModifiedOn']['Value'], \n\t\t\t\t\t\t:page_url => element['PageUrl'], :mailbox_id => element['MailboxId'], :immediate_children_count => element['ImmediateChildrenCount'], :text_cn => element['TextCn'], \n\t\t\t\t\t\t:caption => element['Caption'], :collection_count => element['CollectionCount'], :sub_group_count => element['SubGroupCount'], :gallery_count => element['GalleryCount'],\n\t\t\t\t\t\t:featured_index => element['FeaturedIndex'], :is_random_title_photo => element['IsRandomTitlePhoto'], :upload_url => element['UploadUrl'],\n\t\t\t\t\t\t:photo_count => element['PhotoCount'], :parent_groups => element['ParentGroups'], :title => element['Title'])\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t@group = ZenfolioAPI::Model::Group.new(:id => @response['result']['Id'], :created_on => @response['result']['CreatedOn']['Value'], :modified_on => @response['result']['ModifiedOn']['Value'], \n\t\t\t\t:page_url => @response['result']['PageUrl'], :mailbox_id => @response['result']['MailboxId'], :immediate_children_count => @response['result']['ImmediateChildrenCount'], \n\t\t\t\t:text_cn => @response['result']['TextCn'], :caption => @response['result']['Caption'], :collection_count => @response['result']['CollectionCount'], \n\t\t\t\t:sub_group_count => @response['result']['SubGroupCount'], :gallery_count => @response['result']['GalleryCount'], :featured_index => @response['result']['FeaturedIndex'], \n\t\t\t\t:is_random_title_photo => @response['result']['IsRandomTitlePhoto'], :upload_url => @response['result']['UploadUrl'], :photo_count => @response['result']['PhotoCount'], \n\t\t\t\t:parent_groups => @response['result']['ParentGroups'], :title => @response['result']['Title'], :elements => elements)\n\n\t\t\t@group\n\t\tend",
"def set_group\n @group = Group.find(params[:id])\n end",
"def refresh!\n self.data = client.get(path).data\n end",
"def reload\n self.raw_data = self.class.find(app_id: app_id, build_id: id).raw_data\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 set_group\n # byebug\n @group = Group.find(params[:id])\n end",
"def refresh\n update_attributes_from_id(@id)\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\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 set_group\r\n @group = Group.find(params[:id])\r\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 if @group.update(group_params)\n render_json_message({success: t('.success')}, 200)\n else\n render_json_message({errors: @group.errors.messages}, 422)\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 reload_data\n puts \"Refreshing data now...\".cyan\n sleep(2)\n CovidTracking::Summary.reset\n CovidTracking::CountrySummary.reset\n self.data_loader.reset\n program_run\n end",
"def reload\n @items = nil\n\n attributes = self.class.client.get_list(id: id)\n initialize(attributes)\n\n self\n end",
"def set_group\n @group = Group.find_by_id(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n\n end",
"def refresh\n load if changed?\n end",
"def set_api_v1_group_field\n @api_v1_group_field = Api::V1::GroupField.find(params[:id])\n end",
"def update\n @group.name = params['name']\n @group.save\n respond_to do |format|\n format.json { render :show, status: :ok, location: @group }\n end\n end",
"def members(group)\n reload\n @group[group] || []\n end",
"def set_api_v1_groups_poll\n @api_v1_groups_poll = Api::V1::GroupsPoll.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end",
"def set_group\n @group = Group.find(params[:id])\n end"
] | [
"0.81318593",
"0.703726",
"0.6859572",
"0.6815805",
"0.6695819",
"0.6631904",
"0.6581476",
"0.656722",
"0.6537091",
"0.6537091",
"0.64264214",
"0.64112556",
"0.64005286",
"0.6383394",
"0.63491476",
"0.63233507",
"0.6278371",
"0.62172574",
"0.61674315",
"0.6104667",
"0.6093864",
"0.60839605",
"0.6083743",
"0.60797256",
"0.60766345",
"0.60706013",
"0.60451657",
"0.603817",
"0.59991574",
"0.59882927",
"0.5986189",
"0.5932251",
"0.5931699",
"0.59316987",
"0.59265316",
"0.5920193",
"0.591798",
"0.5916365",
"0.58993495",
"0.5889911",
"0.5886295",
"0.588166",
"0.58808255",
"0.58712536",
"0.58712536",
"0.58712536",
"0.58712536",
"0.58712536",
"0.58712536",
"0.58712536",
"0.58712536",
"0.5866338",
"0.5865422",
"0.5864352",
"0.5860541",
"0.58539534",
"0.58523566",
"0.5841082",
"0.58337075",
"0.5822058",
"0.5819311",
"0.5818193",
"0.58094096",
"0.5808796",
"0.58069783",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646",
"0.579646"
] | 0.7543723 | 1 |
Delete auto scale group | def group_destroy(group)
if(group.persisted?)
request(
:path => "/groups/#{group.id}",
:method => :delete,
:expects => 204
)
true
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_asg name\n auto_scaling = new_auto_scaling\n groups = auto_scaling.groups\n raise \"unable to delete asg, #{name}. asg not found!\" if groups[name].nil? \n\n asg = groups[name]\n\n puts \"deleting asg, #{asg.name}\"\n asg.delete({:force => true})\n delete_launch_configs\nend",
"def delete options = {}\n client_opts = {}\n client_opts[:force_delete] = options[:force] == true\n client_opts[:auto_scaling_group_name] = name\n client.delete_auto_scaling_group(client_opts)\n nil\n end",
"def destroy(options = { :force => false })\n requires :id\n\n opts = {}\n opts.merge!({'ForceDelete' => true}) if options[:force]\n\n service.delete_auto_scaling_group(id, opts)\n end",
"def delete_group(group)\n\t\t\tend",
"def delete_group(group)\n\t\t\tend",
"def remove_auto_scaling_group_properties\n properties = []\n properties << :AvailabilityZones\n properties << :HealthCheckGracePeriod\n properties << :HealthCheckType\n add_patch Patches::RemoveProperty.new 'AWS::AutoScaling::AutoScalingGroup', properties\n end",
"def delete_related_groups\n \n end",
"def delete_group(uuid)\n Uploadcare::Group.delete(uuid)\n end",
"def remove_group(group)\n self.groups.destroy group \n end",
"def destroy\n Group.delete_groups_and_acls([id])\n end",
"def destroy\n @size_group.destroy\n\n render :nothing => true\n end",
"def deleteGroup _args\n \"deleteGroup _args;\" \n end",
"def remove_group\n create_group.tap do |r|\n r.action(:remove)\n end\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\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_by_param(params[:id])\n @group.tuners.clear\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(key)\n key = to_key key\n @group.delete key if @group.key? key\n end",
"def perform_destroy\n api.group_destroy(self)\n end",
"def test_delete\n g = [22058]\n Group.delete(g)\n end",
"def dissolve_groups\n groups.destroy_all\n end",
"def destroy\n @group.destroy\n\n head :no_content\n end",
"def delete_old_asg config, launch_config_name\n auto_scaling = new_auto_scaling\n auto_scaling.groups.each do |group|\n server = tag_value(group.tags, \"server\")\n if server != config[\"server\"]\n next \n end\n\n env = tag_value(group.tags, \"env\")\n if env != config[\"env\"]\n next \n end\n\n if group.name != launch_config_name.name\n puts \"deleting instance group, #{group.name} => #{launch_config_name.name}\"\n delete_asg group.name\n end\n end\nend",
"def remove_group!( group )\n save if remove_group( group )\n end",
"def removeGroupIcon _obj, _args\n \"_obj removeGroupIcon _args;\" \n end",
"def destroy_group_with_extension\n # INFO: currently only a superuser can destroy a group. See CartoDB/cartodb-postgresql#114\n organization.owner.in_database(as: :superuser) do |conn|\n Carto::Group.destroy_group_extension_query(conn, name)\n end\n end",
"def destroy\n @size_group = SizeGroup.find(params[:id])\n @size_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_size_groups_url) }\n format.xml { head :ok }\n end\n end",
"def delete_resource_group(group_name)\n cmdline = Schott::AzureCLI::Commandlines.delete_resource_group(group_name)\n sh(cmdline)\n end",
"def delete_launch_configs\n auto_scaling = new_auto_scaling\n groups = auto_scaling.groups\n auto_scaling.launch_configurations.each do |config|\n if groups[config.name].nil?\n puts \"deleting asg launch configuration, #{config.name}\"\n config.delete()\n end\n end\nend",
"def destroy\n #@s_group.destroy\n @s_group = SGroup.find(params[:id].to_i)\n @s_group.delete_flg = 1\n @s_group.save!\n\n respond_to do |format|\n format.html { redirect_to s_groups_url, notice: 'S group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group_question_alternative.destroy\n head :no_content\n end",
"def hcRemoveGroup _obj, _args\n \"_obj hcRemoveGroup _args;\" \n end",
"def destroy\n @ratio_group = RatioGroup.find(params[:id])\n\n respond_to do |format|\n if @ratio_group.destroy\n format.html { redirect_to ratio_groups_url,\n notice: (crud_notice('destroyed', @ratio_group) + \"#{undo_link(@ratio_group)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to ratio_groups_url, alert: \"#{@ratio_group.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @ratio_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n onesecgroup('delete', resource[:name])\n @property_hash.clear\n end",
"def remove_group(value)\n @children['group'][:value].delete(value)\n end",
"def destroy_group(name)\n response = Curl.delete(azure_face_uri << name) do |http|\n http.headers[\"Ocp-Apim-Subscription-Key\"] = key\n end\n response.body_str\n end",
"def empty_group(group, opts)\n # unlink all resources from this group\n group.empty_group\n end",
"def purge (group)\n ensure_group(group).purge\n end",
"def db_delete\n assert_privileges(\"db_delete\")\n db = MiqWidgetSet.find(params[:id]) # temp var to determine the parent node of deleted items\n process_elements(db, MiqWidgetSet, \"destroy\")\n g = MiqGroup.find(@sb[:nodes][2].split('_').first)\n # delete dashboard id from group settings and save\n db_order = g.settings && g.settings[:dashboard_order] ? g.settings[:dashboard_order] : nil\n db_order&.delete(db.id)\n g.save\n nodes = x_node.split('-')\n self.x_node = \"#{nodes[0]}-#{nodes[1]}-#{nodes[2].split('_').first}\"\n replace_right_cell(:replace_trees => [:db])\n end",
"def destroy\n @prefix_group.destroy\n\n respond_to do |format|\n format.html { redirect_to prefix_groups_url }\n format.json { head :no_content }\n format.js { render :text => \"$('##{dom_id(@prefix_group)}').remove();\" }\n end\n end",
"def clear_group!\n Vedeu.bind(:_clear_group_) do |name|\n Vedeu::Clear::NamedGroup.render(name)\n end\n end",
"def destroy\n @exam_group = ExamGroup.shod(params[:id])\n authorize! :delete, @exam_group\n batch = @exam_group.batch\n @exam_group.destroy\n flash[:notice] = 'Exam Group deleted successfully!'\n redirect_to exam_group_path(batch)\n end",
"def destroy\n @meta_data_group = MetaDataGroup.find(params[:id])\n @meta_data_group.destroy\n\n respond_to do |format|\n format.html { redirect_to meta_data_groups_url }\n format.json { head :no_content }\n end\n end",
"def delete_vlan_group\n super\n end",
"def destroy\n @group.destroy\n msg = [\"Destroyed group.\", rebuild_configs].join(\" \")\n redirect_to groups_url, notice: msg\n end",
"def delete_group\n @group = Group.find(params[:id])\n @created_g_u= Array.new\n @defalut_group = @login_user.default_group[0]\n @group.group_users.each do |g_u|\n g_u.destroy\n group = @login_user.belongs_to_group(g_u.user_id)\n if group.blank?\n group_user = GroupUser.new(:user_id=>g_u.user_id,:group_id=>@defalut_group.id) if group.blank?\n @created_g_u << group_user if group_user.save\n end \n end\n @group.destroy\n #redirect_to :back\n respond_to do |format|\n format.js\n end\n end",
"def destroy\n\n bp_pic_group = BpPicGroup.find(params[:id])\n bp_pic_group.deleted = 9\n bp_pic_group.deleted_at = Time.now\n set_user_column(bp_pic_group)\n bp_pic_group.save!\n\n respond_to do |format|\n format.html { redirect_to bp_pic_groups_path }\n end\n end",
"def destroy\n\n bp_pic_group = BpPicGroup.find(params[:id])\n bp_pic_group.deleted = 9\n bp_pic_group.deleted_at = Time.now\n set_user_column(bp_pic_group)\n bp_pic_group.save!\n\n respond_to do |format|\n format.html { redirect_to bp_pic_groups_path }\n end\n end",
"def clearGroupIcons _args\n \"clearGroupIcons _args;\" \n end",
"def destroy\n @client.resource_groups.delete(@resource_group)\n end",
"def degroup!\n self.explicit_boundaries = []\n self\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 -(scale)\n if @scales.include? scale\n @scales.remove(scale)\n end\n end",
"def destroy\n super\n\n @children.each do |_child_name, child_group|\n child_group.each(&:destroy)\n end\n\n @children = {}\n end",
"def instructor_delete_grp_set(course, group)\n load_course_grps course\n logger.info \"Deleting teacher group set '#{group.group_set}'\"\n wait_for_load_and_click link_element(xpath: \"//a[@title='#{group.group_set}']\")\n wait_for_update_and_click link_element(xpath: '//button[@title=\"Add Group\"]/following-sibling::span/a')\n confirm(true) { wait_for_update_and_click link_element(class: 'delete-category') }\n list_item_element(xpath: '//li[contains(.,\"Group set successfully removed\")]').when_present Utils.short_wait\n end",
"def delete_group_label(group, name)\n delete(\"/groups/#{url_encode group}/labels/#{name}\")\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 destroy\n @image_group = ImageGroup.find(params[:id])\n @image_group.destroy\n\n respond_to do |format|\n format.html { redirect_to image_groups_url }\n format.json { head :no_content }\n format.js {}\n end\n end",
"def destroy\n @grupoassunto.destroy\n\n head :no_content\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 destroy\n @assign_group_place.destroy\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 destroy\n @small_group.destroy\n respond_to do |format|\n format.html { redirect_to small_groups_url, notice: 'Small 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 head :no_content\n end",
"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 service_group_delete(a10, name)\n a10.send(:axapi, 'slb.service_group.delete', 'post', {name: name, format: 'json'})\nend",
"def destroy\n @group_mag = GroupMag.find(params[:id])\n @group_mag.destroy\n\n respond_to do |format|\n format.html { redirect_to group_mags_url }\n format.json { head :ok }\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 # @group = @hub.groups.get(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to hub_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group_key.destroy\n respond_to do |format|\n format.html { redirect_to group_keys_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visual_group = VisualGroup.find(params[:id])\n model = @visual_group.visual_model\n @visual_group.destroy\n\n redirect_to(visual_model_visual_groups_url(model),\n notice: :destroy_visual_group_success.t)\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_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 delete_all_vlan_groups\n super\n end",
"def destroy\n @image_gallery_group = ImageGalleryGroup.find(params[:id])\n @image_gallery_group.destroy\n\n respond_to do |format|\n format.html { redirect_to( admin_image_gallery_groups_url ) }\n format.xml { head :ok }\n end\n end",
"def mark_children_for_removal\n work_graphics.each do |work_graphic|\n work_graphic.destroy\n end\n end",
"def remove(graphic)\n @child_graphics.delete(graphic)\n end",
"def destroy\n @attribute_group = AttributeGroup.find(params[:id])\n @attribute_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(attribute_groups_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @measure_group = MeasureGroup.find(params[:id])\n @measure_group.destroy\n\n respond_to do |format|\n format.html { redirect_to measure_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @instruments_group.destroy\n respond_to do |format|\n format.html { redirect_to instruments_groups_url, notice: 'La catégorie d\\'instruments a été supprimée.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group.destroy unless @group.default\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\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.find_by_slug_or_id(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 @collection_group.destroy\n respond_to do |format|\n format.html { redirect_to collection_groups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @subgroup.destroy\r\n respond_to do |format|\r\n format.html { redirect_to groups_path, notice: 'Apakšgrupa veiksmīgi dzēsta' }\r\n end\r\n end",
"def destroy\n\t\t@dname = @dist_group.dist_name\n\t\tdelete_secret_key\n @dist_group = DistGroup.find(params[:id])\n @dist_group.destroy\n\n respond_to do |format|\n format.html { redirect_to dist_groups_url, notice: 'Distribution Group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy_google_group\n result = Gandalf::GoogleApiClient.delete_google_group(self.apps_id)\n result.data\n end",
"def destroy\n @tag_type_group.destroy\n \n TagType.where(:tag_type_group => @tag_type_group).update_all(:tag_type_group_id => nil)\n \n @tag_types= TagType.by_group\n \n respond_to do |format|\n format.html { redirect_to tag_type_groups_url, notice: 'Tag type group was successfully destroyed.' }\n format.json { head :no_content }\n format.js { render :layout => false }\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 remove_dependency_group!\n @dependency_groups.pop\n end",
"def destroy\n @scale.destroy\n respond_to do |format|\n format.html { redirect_to scales_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @microsites_group.destroy\n respond_to do |format|\n format.html { redirect_to microsites_groups_url, notice: 'Microsites 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.json { head :no_content }\n end\n end",
"def destroy\n @scale.destroy\n respond_to do |format|\n format.html { redirect_to scales_url }\n format.json { head :no_content }\n end\n end",
"def groups\r\n save_default_group(params)\r\n delete_group(params)\r\n end",
"def clean_up\n #Delete every thing but the most recent config[:screenshot_max_keep] screenshots\n max_screenshots = self.config[:screenshot_max_keep] || 5\n #Delete the last created one while they count is more then the max\n while self.admo_screenshots.count > max_screenshots\n self.admo_screenshots.order_by('created_at asc').first.destroy\n end\n end",
"def delete_pipeline(id)\n delete(\"dealGroups/#{id}\")\n end",
"def destroy\n @group.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Le groupe a été supprimé.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if !self.insurance_sessions.blank?\n #check insurance session. If there is an insurance billng, then there must be a session.\n errors.add :base, \"The Group is associated to a session and/or claim. Group cannot be deleted\"\n else\n run_callbacks :destroy do\n self.update_column(:deleted, true)\n end\n end\n end",
"def destroy\n @graphic.destroy\n end",
"def terminate_instance_in_auto_scaling_group(instance_id, should_decrement_desired_capacity)\n request({\n 'Action' => 'TerminateInstanceInAutoScalingGroup',\n 'InstanceId' => instance_id,\n 'ShouldDecrementDesiredCapacity' => should_decrement_desired_capacity.to_s,\n :parser => Fog::Parsers::AWS::AutoScaling::TerminateInstanceInAutoScalingGroup.new\n })\n end"
] | [
"0.6906662",
"0.68263584",
"0.6776696",
"0.6706074",
"0.6706074",
"0.65363663",
"0.64924675",
"0.63809776",
"0.6305741",
"0.6263097",
"0.6256154",
"0.62538105",
"0.6232756",
"0.61864233",
"0.6177051",
"0.6145282",
"0.61311674",
"0.6118659",
"0.6112829",
"0.6092973",
"0.6056133",
"0.6048712",
"0.6035013",
"0.60102564",
"0.60096765",
"0.5988129",
"0.5982648",
"0.5980798",
"0.5922191",
"0.58983105",
"0.5897437",
"0.5876791",
"0.58719444",
"0.58689433",
"0.5858442",
"0.5853425",
"0.5853301",
"0.5845557",
"0.584198",
"0.5832963",
"0.58237386",
"0.58233404",
"0.58197784",
"0.58064824",
"0.58005977",
"0.579483",
"0.579483",
"0.5791923",
"0.578245",
"0.5780792",
"0.576948",
"0.5755249",
"0.57385",
"0.57370204",
"0.5717447",
"0.57116354",
"0.57116354",
"0.5708997",
"0.57037795",
"0.5703289",
"0.5702168",
"0.5700508",
"0.5695639",
"0.56909",
"0.5689167",
"0.56823874",
"0.5673357",
"0.56724626",
"0.56545943",
"0.56506884",
"0.5647985",
"0.56452626",
"0.564266",
"0.56403923",
"0.5638674",
"0.56274885",
"0.56253254",
"0.5624756",
"0.56079006",
"0.55989873",
"0.55918366",
"0.5591409",
"0.5590706",
"0.55898654",
"0.55811554",
"0.5575465",
"0.5574489",
"0.55737644",
"0.5565974",
"0.55652195",
"0.55630517",
"0.5562201",
"0.55583453",
"0.55560106",
"0.55486566",
"0.55465025",
"0.5545047",
"0.55421543",
"0.5539498",
"0.55357975",
"0.5533252"
] | 0.0 | -1 |
Return all auto scale groups | def group_all(options={})
result = request(
:method => :get,
:path => '/groups',
:expects => 200
)
result.fetch(:body, 'groups', []).map do |lb|
Group.new(
self,
:id => lb[:id],
:name => lb.get(:state, :name),
:current_size => lb.get(:state, 'activeCapacity'),
:desired_size => lb.get(:state, 'desiredCapacity')
).valid_state
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_groups\n @@client.describe_auto_scaling_groups.auto_scaling_groups\n end",
"def autoscaling_instances\n autoscaling_group.auto_scaling_instances\n end",
"def autoscaling_instances\n autoscaling_group.auto_scaling_instances\n end",
"def getAsgs()\n options = Hash.new\n asgs = []\n next_token = 0\n while next_token != nil\n options[:next_token] = next_token unless next_token == 0\n resp = @asg.describe_auto_scaling_groups(options)\n asgs.concat(resp.data[:auto_scaling_groups])\n next_token = resp.data[:next_token]\n end\n asgs\n end",
"def get_instances\n all_instances = Array.new()\n @groups.values.each do |instances|\n instances.each do |instance|\n all_instances << instance\n end\n end\n all_instances\n end",
"def all_example_groups\n strategy.example_groups\n end",
"def i_groups; end",
"def get_all_groups\n grps = []\n grps += self.groups\n grps.each { |g| grps += g.get_all_groups }\n return grps.compact.uniq\n end",
"def groups\n hyrax_groups.map(&:name)\n end",
"def describe_auto_scaling_groups(options = {})\n if auto_scaling_group_names = options.delete('AutoScalingGroupNames')\n options.merge!(AWS.indexed_param('AutoScalingGroupNames.member.%d', [*auto_scaling_group_names]))\n end\n request({\n 'Action' => 'DescribeAutoScalingGroups',\n :parser => Fog::Parsers::AWS::AutoScaling::DescribeAutoScalingGroups.new\n }.merge!(options))\n end",
"def groups\n @groups = init_groups\n end",
"def auto_scaling_group_name\n data.auto_scaling_group_name\n end",
"def accord_all_groups\n gr3+gr4+gr5+gr6+gr7+gr8+gr9\n end",
"def groups\n return [] if new_record?\n cached_groups do\n fetch_groups!\n end\n end",
"def to_groups \n @monitor_groups.map{|x| MonitorGroup.new(x)}\n end",
"def groups; end",
"def groups; end",
"def groups; end",
"def all_groups\r\n result = []\r\n self.groups.each { |group| result << group.descendants_and_self }\r\n result.flatten!\r\n result.uniq!\r\n return result\r\n end",
"def ii_groups; end",
"def groups()\n\t\t\tend",
"def initialize_groups\n @groups = []\n @edges.each do |e|\n @groups.push([e[0]]) # single-element group\n @groups.push([e[1]]) # single-element group\n end\n @groups.uniq!\n end",
"def get_groups()\n return self.groups\n end",
"def groups\n return [] if self.group_list.nil?\n self.group_list\n end",
"def groups\r\n @groups ||= fetch_groups\r\n end",
"def auto_scaling_group(group_name)\n AutoScalingGroup.new(group_name)\n end",
"def groups\n @@groups = Group.groups if @@groups.nil? or @@groups.empty?\n @@groups\n end",
"def groups(reload = false)\n self.actor_containers.reload if reload\n self.actor_containers.map { |gm| gm.group }\n end",
"def iii_groups; end",
"def groups\n find_groups if @groups.nil?\n @groups\n end",
"def groups\n @bundles.keys\n end",
"def groups\n normalize_boundaries\n groups = []\n (0..boundaries.size - 1).each do |k|\n groups << group_rows(k)\n end\n groups\n end",
"def groups_to_show\n begin\n group_names = plugin_setting('groups_shown').to_s\n group_names.split(',').map {|group_name|\n Group.named(group_name)\n }.flatten \n rescue\n []\n end\n end",
"def get_app_scaling_limits\n web_cart = get_framework_cartridge\n component_instance = self.component_instances.find_by(cartridge_name: web_cart.name)\n group_instance = group_instances_with_scale.select{ |go| go.all_component_instances.include? component_instance }[0]\n [group_instance.min, group_instance.max]\n end",
"def groups\n @groups ||= questions.map{|question|question.meta_attribute_entity_group}.uniq\n end",
"def groups\n @groups ||= {}\n end",
"def groups\n return @groups\n end",
"def groups\n groups = []\n relations = self.group_relations\n relations.each do |r|\n groups.push r.group\n end\n groups\n end",
"def groups\n @groups ||= Groups.call(self)\n end",
"def all_groups\n result = Array.new\n \n for group in self.groups\n result << group.ancestors_and_self\n end\n \n result.flatten!\n result.uniq!\n \n return result\n end",
"def get_groups\n `id -nG #{name}`.split(' ')\n end",
"def groups\n\t\t\[email protected]\n\t\tend",
"def hyrax_group_names\n groups\n end",
"def groups\n return @groups if @groups\n @groups = AaaGroups.new node\n @groups\n end",
"def all_assessment_groups\n extract_assessment_groups(assessment_groups.all(:include => :assessment_group_batches))\n end",
"def groups\n find(:group).map { |g| g.content }\n end",
"def groups\n result = []\n each_element('group') { |group|\n result.push(group.text)\n }\n result\n end",
"def groups\n result = []\n each_element('group') { |group|\n result.push(group.text)\n }\n result\n end",
"def all_groups\n result = Array.new\n\n for group in self.groups\n result << group.ancestors_and_self\n end\n\n result.flatten!\n result.uniq!\n\n return result\n end",
"def named_groups\n @named_groups ||= Hash[groups.map { |group| [group.auto_scaling_group_name, group] }]\n end",
"def getGroups()\n\n groups = YAML.load_file(@GROUPSFILE)\n groupsS = []\n for i in 0..groups.size\n groupsS <= groups[i]\n end\n return groupsS\n\n end",
"def populated_groups\n @counts.keys\n end",
"def groups()\n grlist = []\n Etc.group { |g|\n grlist.push(g.name)\n }\n return grlist.uniq.sort\n end",
"def taggable_document_collection_groups_container\n Rails.cache.fetch(taggable_document_collection_groups_cache_digest, expires_in: 1.day) do\n DocumentCollection.latest_edition.alphabetical.includes(:groups).flat_map do |collection|\n collection.groups.map { |group| [\"#{collection.title} (#{group.heading})\", group.id] }\n end\n end\n end",
"def load_groups\n @groups = Group.order(:name)\n end",
"def description\n client.describe_auto_scaling_groups(auto_scaling_group_names: [asg_name])&.auto_scaling_groups.first\n end",
"def ebs_groups\n @ebs_groups ||= ebs_volumes.map(&:group).reject(&:nil?).uniq\n end",
"def group\n @gp40s = Gp40.find_measure_group(params[:gp40_id], params[:machine_id])\n\n sort_ad()\n set_graph()\n end",
"def remove_auto_scaling_group_properties\n properties = []\n properties << :AvailabilityZones\n properties << :HealthCheckGracePeriod\n properties << :HealthCheckType\n add_patch Patches::RemoveProperty.new 'AWS::AutoScaling::AutoScalingGroup', properties\n end",
"def qihu_get_all(campaign_se_id)\n adgroups = Array.new\n group_service = Qihu::DianJing::Client.new(get_auth).group\n response = group_service.getIdListByCampaignId(campaignId: campaign_se_id)\n id_list = JSON.parse(response.body)[\"groupIdList\"]\n id_list.each do |id|\n adgroup = AgaApiFactory::Model::Adgroup.new\n adgroup.se_id = id.to_i\n adgroup.adgroup_name = id \n adgroup.price = 0\n adgroup.negative_words = \"\"\n adgroup.exact_negative_words = \"\"\n adgroup.status = 0\n adgroup.se_status = adgroup.status\n adgroups << adgroup\n end\n adgroups\n end",
"def index\n @collection_groups = CollectionGroup.all\n end",
"def groups\n @domains.map { |domain|\n groups_for_domain(domain)\n }.flatten\n end",
"def groups\n @students.each_slice((@students.count / 2.0).round).to_a\n end",
"def hcAllGroups _args\n \"hcAllGroups _args;\" \n end",
"def scales\n \n end",
"def groups\n @parent.groups(@filter)\n end",
"def index\n @small_groups = SmallGroup.all\n end",
"def tag_groups\n build_tag_groups_array RubyRedtail::Query.run(\"settings/taggroups\", @api_hash, \"GET\")\n end",
"def get_grouping_options\n RedmineCharts::GroupingUtils.types\n end",
"def collect_groups\n @groups.inject(name => self) do |acc, g|\n acc.merge(g.collect_groups)\n end\n end",
"def groups\n quads\n end",
"def groups(recursive = false)\n Set.new() << self\n end",
"def age_groups\n get_endpoint(Bestsellers::AgeGroup.path).map{|g|\n Bestsellers::AgeGroup.new(g)\n }\n end",
"def groups(*args)\n end",
"def effective_groups\n ret = [ self ]\n memberships.each do |m|\n unless ret.include?(m) # prevent infinite recursion\n tmp = m.effective_groups\n tmp.each do |g|\n ret << g unless ret.include?(g)\n end\n end\n end\n ret\n end",
"def grouped_by_access_feature!\n groups = {'audio_described_performance' => [], 'captioned_performance' => [], 'signed_performance' => [], 'touch_tour' => [], 'relaxed_performance' => [], 'talk_back' => []}\n\n @instances.each do |instance|\n instance_types = instance.meta_attributes.select{|attr_key, attr_value| groups.keys.include?(attr_key) && attr_value==\"true\"}.keys\n\n if instance_types.any?\n instance_types.each do |type|\n groups[type].push(instance)\n end\n end\n end\n\n groups.each do |type, instances|\n groups[type] = slice_instances_by_date(instances.reverse)\n end\n\n groups\n end",
"def list\n @groups = Group.find(:all, :order => 'name')\n end",
"def effective_groups\n ret = [ self ]\n memberships.each do |m|\n unless ret.include?(m) # prevent infinite recursion\n tmp = m.effective_groups\n tmp.each do |g|\n ret << g unless ret.include?(g)\n end\n end\n end\n ret.sort{|a,b| a.name <=> b.name}\n end",
"def groups\n @groups_hosts.keys.sort\n end",
"def instance_ids\n @instance_ids ||= groups.map { |gr| gr.instances.map { |i| i.instance_id } }.flatten\n end",
"def groups\n unless @groups\n @groups = convert_to_objects(cn_groups)\n end\n @groups\n end",
"def each\n group.each\n end",
"def to_a\n @groups.to_a\n end",
"def groups\n groups = []\n @config['groups'].each do |k, v|\n groups << OpenStruct.new(\n name: k,\n size: Size.new(v['size']),\n rss: v['rss'],\n requests: v['requests'],\n path: v['path'])\n end\n groups.freeze\n end",
"def groups_of(num)\n collection.each_slice(num).to_a\n end",
"def groups\n group_ids.split(',').inject(Array.new) do |arr,gid|\n arr << Ecore::Group.where(:id => gid).first\n end\n end",
"def hc_group_list_all(id)\n org=Org.find(id)\n org.hc_groups.all(:order=>'group_name')\n end",
"def getGroups\n groups = $gm.get(\"/groups\", @token, \"per_page=100\")\n group_ids = Array.new\n\n groups['response'].each do |group|\n group_ids.push({\n 'name' => group['name'],\n 'group_id' => group['id'],\n 'image' => group['image_url']})\n end\n\n return group_ids\n end",
"def categorized_groups\n tag.published_groups\n end",
"def girl_groups; end",
"def groups(*groups); end",
"def groups(*groups); end",
"def set_possible_guidance_groups\n # find all the themes in this plan\n # and get the guidance groups they belong to\n ggroups = []\n self.template.phases.each do |phase|\n phase.sections.each do |section|\n section.questions.each do |question|\n question.themes.each do |theme|\n theme.guidances.each do |guidance|\n ggroups << guidance.guidance_group if guidance.guidance_group.published\n # only show published guidance groups\n end\n end\n end\n end\n end\n\n self.guidance_groups = ggroups.uniq\n end",
"def effective_groups(refresh = false)\n @effective_groups = nil if refresh\n @effective_groups ||= if system_admin?\n AccessGroup.all.map{ |g| g.to_s.upcase }\n else\n groups\n .collect{ |g| g.effective_groups }\n .flatten\n end\n .map{ |g| g.to_s.upcase }\n .uniq\n .sort\n end",
"def group\n klass.collection.group(\n :key => field_list,\n :cond => selector,\n :initial => { :group => [] },\n :reduce => Javascript.group\n ).collect do |docs|\n docs[\"group\"] = docs[\"group\"].collect do |attrs|\n Mongoid::Factory.from_db(klass, attrs)\n end\n docs\n end\n end",
"def get_guidance_group_options\n # find all the themes in this plan\n # and get the guidance groups they belong to\n ggroups = []\n Template.includes(phases: [sections: [questions: [themes: [guidances: [guidance_group: :org]]]]]).find(self.template_id).phases.each do |phase|\n phase.sections.each do |section|\n section.questions.each do |question|\n question.themes.each do |theme|\n theme.guidances.each do |guidance|\n ggroups << guidance.guidance_group if guidance.guidance_group.published && !guidance.guidance_group.org.is_other?\n # only show published guidance groups\n end\n end\n end\n end\n end\n return ggroups.uniq\n end",
"def get_all_groups(empty_size = 2)\n @groups = []\n iter = 1\n empty_buffer = 0\n\n loop do\n group = @zbx.query( method: \"hostgroup.get\", params: {\"output\" => \"extend\", \"groupids\" => [iter] } )\n iter += 1\n\n if group != []\n @groups.push(group)\n else\n empty_buffer += 1\n end\n\n if empty_buffer > empty_size\n break\n end\n end\n return true if @groups.size > 0\n end",
"def group(i)\n case i\n when 0..2 then (0..2).to_a\n when 3..5 then (3..5).to_a\n when 6..8 then (6..8).to_a\n end\n end",
"def get_all_groups\n grps = self.get_groups_recursively\n grps << self.home_group\n logged_in_group = Group.new(:name => \"logged in user\")\n logged_in_group.id = 0\n grps << logged_in_group\n anonymous_group = Group.new(:name => \"anonymous user\")\n anonymous_group.id = -1\n grps << anonymous_group\n return grps.compact.uniq\n end",
"def resource_groups\n return @resource_groups unless @resource_groups.nil?\n\n refs = references(:resource_groups) || []\n @resource_groups = refs.map { |ems_ref| resource_group(ems_ref) }.compact\n end"
] | [
"0.70269644",
"0.6789279",
"0.6789279",
"0.66555667",
"0.64899504",
"0.6219308",
"0.6133411",
"0.6043947",
"0.60395217",
"0.59962046",
"0.5972055",
"0.5927886",
"0.5867459",
"0.5840454",
"0.58295584",
"0.5819522",
"0.5819522",
"0.5819522",
"0.57992727",
"0.5747224",
"0.57445455",
"0.57260036",
"0.5705411",
"0.56916237",
"0.5691082",
"0.56716704",
"0.565609",
"0.5640467",
"0.5600442",
"0.5584795",
"0.5563368",
"0.5560118",
"0.5555175",
"0.55538416",
"0.555007",
"0.55498546",
"0.55421716",
"0.5530017",
"0.5527728",
"0.5523055",
"0.55216277",
"0.55160445",
"0.5475303",
"0.5416372",
"0.5410895",
"0.53941804",
"0.539098",
"0.539098",
"0.53787667",
"0.5377133",
"0.53562653",
"0.5353498",
"0.5353453",
"0.53516364",
"0.53506416",
"0.53396875",
"0.53262806",
"0.532445",
"0.53243583",
"0.5321381",
"0.53152204",
"0.53014874",
"0.530122",
"0.52920395",
"0.5290773",
"0.5270924",
"0.5263577",
"0.5259403",
"0.52591634",
"0.5253453",
"0.5224221",
"0.5222288",
"0.5219273",
"0.52181286",
"0.5202487",
"0.5201399",
"0.520058",
"0.5196532",
"0.51849514",
"0.5172315",
"0.5166902",
"0.51667225",
"0.5159413",
"0.5158741",
"0.5153382",
"0.51527333",
"0.51397187",
"0.51233166",
"0.5123044",
"0.5120905",
"0.5102113",
"0.5102113",
"0.5098114",
"0.5095414",
"0.5089372",
"0.50868475",
"0.5086032",
"0.50814724",
"0.5078267",
"0.5077284"
] | 0.539694 | 45 |
Actions to not authorized users | def user_not_authorized
#flash[:alert] = "You are not cool enough to do this - go back from whence you came."
redirect_to root_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unauthorized\n end",
"def unauthorized_user!\n if @user != current_user\n redirect_to root_path, status: :unauthorized, alert: 'You can only perform this action on your own user!'\n end\n end",
"def authorize_unauthenticated_user\n target_action = params[:controller] + '#' + params[:action]\n unless User::DEFAULT_PERMISSIONS.include?(target_action)\n head :unauthorized and return\n end\n end",
"def unauthorised\n flash[:notice] = 'Unauthorised operation. Please try another option '\n redirect_to robots_path\n end",
"def skip_authorization; end",
"def not_authorized\n redirect_to volunteer_positions_url, alert: \"You are not authorized to perform the requested action!\"\n end",
"def user_not_authorized\n flash[:warning] = \"You are not authorized to perform this action.\"\n redirect_to(request.referrer || root_path)\n end",
"def user_not_authorized\n \tflash[:alert] = \"You are not authorized to perform this action.\"\n \tredirect_to(request.referrer || root_path)\n end",
"def not_authorised\n flash[:notice] = 'You are not authorized to perform this action!'\n redirect_back(fallback_location: root_path)\n end",
"def restrict_access\n head :unauthorized and return false unless current_user\n end",
"def assert_user_cant_access(user, actions, params = {})\r\n assert_user_access_check(false, user, actions, params)\r\n end",
"def skip_authorization_check(*args)\n before_action(*args) do |controller|\n controller.instance_variable_set(:@_authorized, true)\n end\n end",
"def not_authorized\n redirect_to home_path\n flash[:error] = \"You are not authorized to do that.\"\n end",
"def access_denied\n\n end",
"def unauthorized\n head :unauthorized\n end",
"def access_denied\n end",
"def unauthorized\n render :text => \"You are not authorized to perform this action\", :status => 401\n end",
"def users_only\n deny_access(\"Necesitas crear una cuenta para entrar a esta sección\") unless signed_in?\n end",
"def user_not_authorized\n flash[:alert] = \"You are not authorized to perform that action.\"\n redirect_to(request.referrer || root_path)\n end",
"def user_not_authorized\n flash[:alert] = t('messages.non_authorized_action')\n redirect_to(request.referrer || root_path)\n end",
"def unauthenticated\n end",
"def denied\n end",
"def skip_authorization\n @_authorization_performed = true\n end",
"def user_not_authorized\n respond_to do |format|\n format.json do\n render json: ErrorReport.generate( { id: [t(\"errors.messages.not_authorized\")] }, 403 ), status: :forbidden\n end\n end\n end",
"def not_allowed! redirect = root_url\n raise Exceptional::Unauthorized.new(\"Sorry, I was could not perform the action you requested!\")\n end",
"def user_not_authorized\n flash[:alert] = \"You are not authorized to perform this action.\"\n redirect_to(request.referrer || root_path)\n end",
"def unauthorized\n render_json error: 'Access Not Authorized', status: :forbidden\n end",
"def index\n prevent_non_admin\n end",
"def user_not_authorized\n flash[:alert] = \"Vous n'êtes pas autorisé à exécuter cette action.\"\n redirect_to(root_path)\n end",
"def unauthorized\n\n render_error( :unauthorized )\n\n end",
"def user_not_authorized\n flash[:danger] = \"Access denied.\"\n redirect_to (request.referrer || root_path)\n end",
"def needs_authenticate_user?\n except_actions = %w[index show]\n !except_actions.include?(action_name)\n end",
"def show\n skip_authorization\n end",
"def restrict_access\t\n\t\tif current_user.owner == false\n\t\t\tredirect_to user_path(current_user), notice: \"You can't view this page, contact your box owner\"\n\t\tend\t\n\tend",
"def redirect_non_users(id = params[:user_id])\n not_authorized(\"User not found.\") if id && !User.exists?(id)\n end",
"def user_access_control_all\n @user = User.find(params[:user_id])\n\n unless [email protected]? && current_user.admin? || current_user?(@user)\n response_access_denied\n end\n\n rescue\n response_access_denied\n end",
"def authorize!(user)\n redirect '/not_authorized' unless authorized?(user)\nend",
"def needs_authenticate_user?\n except_actions = %w[index show print]\n !except_actions.include?(action_name)\n end",
"def user_not_authorized\n redirect_to((request.referrer || root_path) ,notice: \"Authorization error.\")\n end",
"def filter_self\n if @user && !current_user.can_edit?(@user)\n respond_to do |format|\n format.html {\n render :nothing => true, :status => 403\n }\n format.json {\n render :json => {:status => 'failure'}, :status => 403\n }\n end\n end\n end",
"def rescue_unauthorized\n render nothing: true, status: 403\n end",
"def rescue_unauthorized\n render nothing: true, status: 403\n end",
"def unauthorized_request user:current_user,filter:nil\n\t\t\tputs \"\\n\\nNo filter matches the given http method, controller, or controller method, rerouting...\" if filter.blank?\n\t\t\tputs \"\\n\\nUser #{user.email} is not authorized to #{filter.http_method.upcase}::>#{filter.controller || 'all'}.#{filter.action_name || 'all'}, rerouting...\\n\\n\" unless filter.blank?\n\t\t\trender json: \"Unauthorized Request\"\n\t\tend",
"def user_not_authorized\n flash[:alert] = \"You are not authorized to perform this action.\"\n redirect_to(root_path)\n end",
"def user_not_authorized\n flash[:alert] = \"You are not authorized to perform this action.\"\n redirect_to root_path\n end",
"def not_authorized\n flash[:error] = I18n.t :forbidden\n response.headers['Status-Code'] = '403'\n redirect_to root_path\n end",
"def access_denied\n redirect_to controller: :users, action: :login\n end",
"def controller_actions_should_fail_if_not_logged_in(cont, opts={})\n except= opts[:except] || []\n actions_to_test= get_all_actions(cont).reject{ |a| except.include?(a) }\n actions_to_test += opts[:include] if opts[:include]\n actions_to_test.each do |a|\n get a\n response.should_not be_success\n response.should redirect_to('http://test.host/')\n end\n end",
"def forbidden\n head :forbidden\n end",
"def permit_unprotected_actions\n # Allow clients to download packages\n can [:download, :icon], Package\n # Allow client computer requests\n can :checkin, Computer\n can [:show_plist, :show_resource], Computer\n # Allow any request to retrieve catalogs\n can :read, Catalog\n # Allow everyone to edit their user record\n can [:read, :update], User, :id => @user.id\n # Allow anyone to login and logout\n can [:create, :destroy], :session\n # Allow anyone to view their dashboard\n can :manage, :dashboard\n end",
"def unauthorized?(action, subject)\n !authorized? action, subject\n end",
"def user_not_authorized(exception)\n case exception.query\n when 'approve?',\n 'can_add_attachment?',\n /^add_response_to_flagged_case/,\n 'upload_responses?',\n 'update_closure?'\n super(exception, case_path(@case))\n else\n super\n end\n end",
"def authorize_user\n # simple authorization: kick out anonymous users from backend actions\n=begin\n if !current_user\n redirect_back_or_default(home_page) and return if action_name =~ /index|edit|update|destroy/\n \n # skip checking permission if user is an admin\n elsif !current_user.has_role?('Admin')\n unless current_user.has_permission?(controller_name, action_name, params)\n flash[:warning] = 'Access Denied'\n redirect_back_or_default(home_page) and return\n end\n end\n=end\n end",
"def user_actions(user)\n can_act_as_logged_in_user(user) unless Revs::Application.config.restricted_beta # also have logged in privileges if we are not in beta\n end",
"def user_not_authorized\n flash[:alert] = \"Access denied.\"\n redirect_to (request.referrer || root_path)\n end",
"def redirect_unauthorized!\n redirect_to not_authorized_path\n end",
"def unauthorized\n render :json => \"You are not authorized for access.\", :status => :unauthorized\n end",
"def skip_actions; end",
"def unauthorized\n flash[:alert] = \"You are not authorized to view that page.\"\n redirect_to '/'\n end",
"def deny_access_action( txn, *args )\n\t\t\tself.log.error \"Unauthorized request for %s\" % [ txn.uri ]\n\t\t\ttxn.status = Apache::FORBIDDEN\n\t\t\treturn \"access denied\"\n\t\tend",
"def authorize_access\n # byebug\n redirect_to root_path, alert: \"Access Denied\" unless can? :modify, Post\n end",
"def index\n # authorize! :index, @user, :message => 'Not authorized as an administrator.'\n @users = User.all\n end",
"def unauthorized_access\n flash[:notice] = \"Unauthorized access\"\n redirect_to \"/\"\n return false\n end",
"def authorized!\n redirect_to root_url, alert: \"You need to be set up for receiving whispers first\" and return unless current_user\n end",
"def authorise_action\n if !logged_in? or (@annotation.source != current_user)\n # TODO: return either a 401 or 403 depending on authentication\n respond_to do |format|\n flash[:error] = 'You are not allowed to perform this action.'\n format.html { redirect_to :back }\n format.xml { head :forbidden }\n end\n return false\n end\n return true\n end",
"def authorise_action\n if !logged_in? or (@annotation.source != current_user)\n # TODO: return either a 401 or 403 depending on authentication\n respond_to do |format|\n flash[:error] = 'You are not allowed to perform this action.'\n format.html { redirect_to :back }\n format.xml { head :forbidden }\n end\n return false\n end\n return true\n end",
"def access_denied\n if logged_in?\n flash[:notice] = I18n.t('application.not_authorized')\n respond_to do |f|\n f.html do\n unless request.xhr?\n redirect_to current_user.has_any_role? ? admin_nodes_path : root_path\n else\n render text: flash[:notice], status: :forbidden # Render HTML\n end\n end\n f.js do\n render :update do |page|\n page.redirect_to '/admin' # Redirect through JS\n end\n end\n f.json do\n render json: { error: flash[:notice] }.to_json, status: :forbidden\n end\n end\n else\n super\n end\n end",
"def index\n @user = User.find(params[:user_id])\n @conditions = @user.conditions\n\n if current_user.id == @user.id\n\t\t\trender action: :index\n\t\telse\n\t\t\trender file: 'public/denied'\n\t\tend\n end",
"def deny_access\n store_location\n redirect_to signin_path, :notice =>'Merci de vous identifier pour accéder à cette page.'\n end",
"def deny_access\n if not current_user\n authenticate_user!\n elsif current_user.member?\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end",
"def authorize_user\n redirect_to restrooms_path, flash: {message: \"You don't have permission to make changes to another user's profile.\"} unless current_user.admin? || @user == current_user\n end",
"def authorized?\n render nothing: true, status: :forbidden if !current_account\n end",
"def user_not_authorized\n flash[:alert] = I18n.t('pundit.default')\n redirect_to(request.referrer || authenticated_root_path || unauthenticated_root_path)\n end",
"def correct_initiative_only\n unless current_user.admin?\n if current_user.service_user? || current_user.initiatives.exclude?(Initiative.find(params[:initiative_id]))\n flash[:danger] = 'You are not allowed to access that page.'\n redirect_to current_user\n end\n end\n end",
"def unauthenticated_action?(controller, action)\n controller == \"users\" && action == \"create\"\n end",
"def permission_required \n render_403 unless admin? || @user == current_user\n end",
"def check_permission\n redirect_to dashboard_path, notice: 'You are not authorised to perform this action.' unless current_user&.admin?\n end",
"def not_protected (controller_name, action_name)\n if (!['users'].include? controller_name)\n return false\n end \n\n if (!['create', 'new', 'index'].include? action_name)\n return false\n end\n\n return true\n end",
"def filter_object\n # redirect_to(root_url, :notice => \"Do not have permission\") and return\n end",
"def no_access\n flash[:message] = \"You do not have access to that page.\"\n redirect '/'\n end",
"def access_denied\n redirect_to main_app.root_url, alert: \"Not authorized\"\n end",
"def authorize_for_none\n # Clear all authorizations and create an allow-all entry\n ContentAuthorization.transaction do\n update_privacy_level(ContentAuthorization::AuthInvisible)\n clear_accessors\n end\n end",
"def correct_initiative_only\n unless current_user.admin?\n if current_user.service_user? || current_user.initiatives.exclude?(Initiative.find(params[:id]))\n flash[:danger] = 'You are not allowed to access that page.'\n redirect_to current_user\n end\n end\n end",
"def check_access_control_all\n @user = User.find(params[:user_id])\n\n response_access_denied unless current_user.has_role?(:admin) || current_user.id == @user.id\n rescue\n response_access_denied\n end",
"def help\r\n\r\n @user_actions = Access.where(:table_sid => \"users\", :action_sid => [\"index\", \"list\", \"new\", \"create\", \"show\", \"edit\", \"update\", \"destroy\", \"search\", \"download\", \"feed\", \"help\", \"login\", \"logout\", \"home\", \"access_graph\", \"field_access_graph\", \"change_password\"]).includes([:user_accesses, :profile_accesses]).reject{|a| @current_user.can_run?(a) }\r\n render(:layout => !request.xhr?)\r\n end",
"def users_only\n deny_access(\"You must be signed in to access this page.\") unless signed_in?\n end",
"def require_authorization!\n unless current_user == @event.user\n render json: {}, status: :forbidden\n end\n end",
"def give_no_access_to(login)\n give_access_to(:noaccess, login)\n end",
"def block_unauthenticated_user!\n unless current_user\n return render_unauthorized\n end\n end",
"def forbidden\n respond_with 403\n end",
"def forbidden!\n render_api_error!('403 Forbidden', 403)\n end",
"def deny_access\n redirect_to signin_path, notice: \"Please sign in to access that page.\"\n end",
"def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end",
"def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end",
"def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end",
"def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end",
"def redirect_403\n return hit_error(403) unless current_user\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end"
] | [
"0.7613339",
"0.7581469",
"0.756388",
"0.7373604",
"0.72696954",
"0.71314347",
"0.71256775",
"0.70912206",
"0.70816797",
"0.7051413",
"0.70486206",
"0.6971704",
"0.69712406",
"0.6966304",
"0.69630015",
"0.69587594",
"0.6951655",
"0.6947262",
"0.69447285",
"0.6943064",
"0.694228",
"0.693811",
"0.6937305",
"0.6934298",
"0.69146556",
"0.6881758",
"0.688167",
"0.68757796",
"0.68670404",
"0.68597054",
"0.685202",
"0.6849589",
"0.68493193",
"0.6834201",
"0.68226343",
"0.6801956",
"0.6799572",
"0.6799245",
"0.67966896",
"0.67947394",
"0.6793357",
"0.6793357",
"0.6792793",
"0.6770307",
"0.6735552",
"0.67129105",
"0.6706373",
"0.66730225",
"0.6662313",
"0.6661271",
"0.6659249",
"0.6652523",
"0.66428435",
"0.66352516",
"0.6629474",
"0.66200036",
"0.660468",
"0.65967774",
"0.65833646",
"0.658254",
"0.656225",
"0.65567404",
"0.6543608",
"0.6533611",
"0.65268123",
"0.65268123",
"0.6521305",
"0.65205294",
"0.65191656",
"0.6497398",
"0.6489381",
"0.6487498",
"0.64871025",
"0.64850265",
"0.6478593",
"0.6466156",
"0.6460794",
"0.6457591",
"0.6450811",
"0.6448041",
"0.6448021",
"0.6437766",
"0.64345133",
"0.64341277",
"0.64295304",
"0.64271903",
"0.6425222",
"0.641909",
"0.64184785",
"0.6416631",
"0.64117587",
"0.6410868",
"0.64102435",
"0.64102435",
"0.64102435",
"0.64102435",
"0.6409068",
"0.640785",
"0.640785",
"0.640785"
] | 0.65635943 | 60 |
Sets the default options for the scope specified by `name` | def list_default_options(name, options = {})
write_inheritable_attribute(:list_options, {}) if list_options.nil?
list_options[name] = Facade.options[:default_options].merge(options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_default_options\n end",
"def default_options=(opts); end",
"def merge_default_options(name, type, options = {})\n list_options[name][type].merge(options)\n\t\tend",
"def reset!\n @options = Name.defaults.dup\n end",
"def set_default(name, options = {})\n value = options[:default]\n defaults[name] = value unless value.nil?\n end",
"def option(options)\n default_options.merge! options\n end",
"def option(name, value = nil)\n default_options[name] = value\n end",
"def default_options=( opts )\n sync{ @opts = opts.nil? ? nil : opts.dup }\n end",
"def scope_options; end",
"def scope_options; end",
"def default_scope=(_arg0); end",
"def initialize(name)\n @name = name\n @options = Hash.new\n end",
"def default_for name, value\n @default_options[name] = value\n end",
"def []=(name, options); end",
"def default_options\n sync{ @opts || {} }\n end",
"def default_options; {} end",
"def set_defaults( name, *args, &block )\n clear_defaults( name )\n @aliases[ name ] = args.shift if args.first.is_a? Symbol\n @defaults[ name ] = args.pop if args.last.is_a? Hash\n @callbacks[ name ] = block\n fail( ArgumentError, \"invalid defaults for #{name}\" ) unless args.empty?\n self\n end",
"def default_options\n { \"token_credential_uri\" => self.class::TOKEN_CREDENTIAL_URI,\n \"audience\" => self.class::AUDIENCE,\n \"scope\" => self.class::SCOPE }\n end",
"def default_options\n options = {}\n options[:query_options] ||= {}\n options[:resource_name] = name.split(\"::\").last.downcase\n options[:collection_name] = name.split(\"::\").last.downcase + \"ListItem\"\n options\n end",
"def default_options\n options = {}\n options[:query_options] ||= {}\n options[:resource_name] = name.split(\"::\").last.downcase\n options[:collection_name] = name.split(\"::\").last.downcase + \"ListItem\"\n options\n end",
"def prov_set_default_options\n {\n :reason_text => nil,\n :applied_states => PROV_STATES.keys,\n :type_choice => 'all',\n :user_choice => approver? ? 'all' : current_user.id,\n :time_period => 7,\n }\n end",
"def default_options\n { }\n end",
"def default_options; end",
"def default_options; end",
"def default_options; end",
"def define_options(opt)\n # override this; no additional options by default\n end",
"def set_default(name, *args, &block)\n set(name, *args, &block) unless exists?(name)\nend",
"def set_default(name, *args, &block)\n set(name, *args, &block) unless exists?(name)\nend",
"def collection_scope name, options = {}\n default = options[:default] || nil\n collection_method name do |value=default|\n value = value == false ? \"0\" : value.to_s\n current_value = (@parameters ||= {})[name]\n clear if value != current_value\n (@parameters ||= {})[name] = value\n self\n end\n end",
"def set_default_options!\n @options ||= OpenStruct.new\n @options.skip_uncovered = false\n @options.mute = false\n @options.reports = []\n end",
"def default_options\n {}\n end",
"def default_options\n {}\n end",
"def default_options\n {}\n end",
"def reset\n @options = VALID_OPTIONS_KEYS.inject({}) do |opts, k|\n default_option = OnTheSnow::Config.const_get(\"DEFAULT_#{k.upcase}\")\n self.send(\"#{k}=\", default_option)\n opts[k.to_s] = default_option #unless default_option.nil?\n opts\n end\n self\n end",
"def default_options\n {}\n end",
"def default_options\n {}\n end",
"def default_options\n {}\n end",
"def add_scope(name, config={})\n scopes[name] = config\n end",
"def default_options\n # {}\n end",
"def default_opts\n { :default => default }.merge( opts )\n end",
"def init_config()\n options_apply_filter(\"DEFAULT\")\n end",
"def default_options\n {}\n end",
"def attr_options name, options = {}\n @attr_options ||= {}\n @attr_options[name] = options\n end",
"def set_default_options(options = T.unsafe(nil)); end",
"def global_option(name, *options, &block)\n if name.is_a? Hash\n name.each do |alias_name, option_name|\n option = @global_parameters[option_name]\n if option.nil?\n @global_parameters[alias_name] = option_name\n else\n option.aliases << alias_name\n @global_parameters[alias_name] = option\n end\n end\n else\n option = Option.new(self, name, *options, &block)\n @global_parameters.each do |option_alias, option_name|\n if option_name == option.name\n @global_parameters[option_alias] = option\n option.aliases << option_alias\n end\n end\n @global_parameters[option.name] = option\n end\n end",
"def reset_options!\n @options = self::DEFAULT_OPTIONS.clone # 'self::' is necessary with ruby 1.8\n end",
"def default_fields_with_name(name=self.class.name.underscore, options={})\n self.default_fields.each do |k, v|\n options[\"#{name}_#{k}\"] = v\n end\n options\n end",
"def option(name, options = {})\n settings[name] = options[:default]\n\n class_eval <<-RUBY\n def #{name}\n settings[#{name.inspect}]\n end\n\n def #{name}=(value)\n settings[#{name.inspect}] = value\n end\n\n def #{name}?\n #{name}\n end\n RUBY\n end",
"def initialize(name, overrides, defaults)\n @name,@overrides,@defaults = name,overrides,defaults\n end",
"def set_default_options()\n @options = OpenStruct.new(\n :output_base => nil,\n :verbose => false,\n :config_file => nil,\n :samples => nil,\n :delay => 30,\n :scheduler_opts => ''\n )\nend",
"def initialize(name, definition = {})\n @name = CommandLine::Option.rewrite(name)\n @alias = definition[:alias].to_sym if definition[:alias]\n @required = definition.has_key?(:required) && definition[:required] == true\n @parameter_count = definition[:parameters] || 1\n @multiple = definition[:multiple] || false\n @default_value = definition[:default] || false\n end",
"def defaults_for( name, &block )\n ::Loquacious::Configuration.defaults_for(name, &block)\n end",
"def set name, value\n unless @defaults.is_a? Hash\n @defaults = {}\n append('<defaults>', @defaults)\n end\n\n @defaults[name.to_sym] = value\n end",
"def default_scope; end",
"def give_options\n clean_user_options\n @user_options.merge(default_options)\n end",
"def reset_options\n VALID_OPTIONS_KEYS.each do |key|\n send(\"#{key}=\", default_options[key])\n end\n end",
"def initialize name, *options\n @name = name\n @options = options\n end",
"def []=( name, value )\n @options[ name ] = value\n end",
"def default(name)\n tk_call(@path, 'default', tagid(name))\n self\n end",
"def set_default_options(options = nil)\n #give some sensical options instead of blank elements\n @options = Hash.new\n @options[:default_title] = \"My Awesome Title\"\n @options[:default_link] = \"http://default.wordpress.com\"\n @options[:default_description] = \"My Awesome Description\"\n @options[:pub_date] = \"Tue, 10 Mar 2009 00:12:59 +0000\"\n @options[:base_blog_url] = \"http://default.wordpress.com\"\n @options[:creator] = \"Hiro\"\n end",
"def default_options\n @default_options ||= {}\n end",
"def property(name, options = {})\n set_default_options(name, options)\n super(name, options)\n end",
"def set_options_defaults(options)\n options[:limit] = 999999 unless options.has_key? :limit\n options[:include_menu_parent] = false unless options.has_key? :include_menu_parent\n options[:hierarchical] = true unless options.has_key? :hierarchical\n options[:with_nav] = true unless options.has_key? :with_nav\n options[:nav_class] = \"nav_menu\" unless options.has_key? :nav_class\n options[:active_class] = \"active\" unless options.has_key? :active_class\n options[:content_type] = \"\" unless options.has_key? :content_type\n options[:all_content_types] = false unless options.has_key? :all_content_types\n options[:with_locale] = false unless options.has_key? :with_locale\n options[:active_ids] = [] unless options.has_key? :active_ids\n options[:nav_html] = '' unless options.has_key? :nav_html\n options[:children_content] = false unless options.has_key? :children_content\n end",
"def default_options\n DEFAULT_OPTIONS\n end",
"def initialize(name, options = {})\n @name = name\n @default = options[:default]\n @type = options[:type] || String\n end",
"def set_default_name \n self.name ||= \"Itinerary\" \n end",
"def defaults(defaults = {})\n @scope = @scope.new(defaults: merge_defaults_scope(@scope[:defaults], defaults))\n yield\n ensure\n @scope = @scope.parent\n end",
"def default_scopes(*scopes)\n @config.instance_variable_set(:@default_scopes, OAuth::Scopes.from_array(scopes))\n end",
"def set_default_options(iParameters)\n @DefaultOptions.merge!(iParameters)\n end",
"def initialize name, options = {}\n super\n end",
"def initialize **opts\n @options = DEFAULT_OPTIONS.merge opts\n end",
"def default_option(option, value)\n default_options[option.to_sym] = value\n end",
"def set_study_default_options\n case study_file.file_type\n when 'Metadata'\n set_default_annotation\n when 'Cluster'\n set_default_cluster\n set_default_annotation\n when 'AnnData'\n set_default_cluster\n set_default_annotation\n end\n Rails.logger.info \"Setting default options in #{study.name}: #{study.default_options}\"\n study.save\n # warm all default caches for this study\n ClusterCacheService.delay(queue: :cache).cache_study_defaults(study)\n end",
"def merge_defaults(options = {})\n defaults = {}\n # defaults[:character_name] = @charater_name if @charater_name\n defaults[:region] = @region if @region\n defaults[:caching] = @caching if @caching\n defaults[:cache_timeout] = @cache_timeout if @cache_timeout\n defaults[:debug] = @debug if @debug\n\n # overwrite defaults with any given options\n defaults.merge!(options)\n end",
"def add_default_command_options(options)\n defaults = self[:default_run_options]\n options = defaults.merge(options)\n\n env = self[:default_environment]\n env = env.merge(options[:env]) if options[:env]\n options[:env] = env unless env.empty?\n\n shell = options[:shell] || self[:default_shell]\n options[:shell] = shell unless shell.nil?\n\n options\n end",
"def reset!\n @options = defaults\n end",
"def reset!\n @options = defaults\n end",
"def defaults_and_options options\n options\n end",
"def default=( val )\r\n @opts[:default] = val\r\n end",
"def option(name, behaviors = {}, &block)\n Ablerc.options << Ablerc::Option.new(name, behaviors, &block)\n end",
"def add_option(name, opt={})\n @options = (@options || {}).merge(name.to_s=>opt)\n end",
"def default_scope\n Configuration::Scope.new(Configuration.new)\n end",
"def set_default\n end",
"def default_adapter_options=(_arg0); end",
"def default_adapter_options=(_arg0); end",
"def initialize(name, opts={})\n @name = name\n @exclude_in = Set.new(Array(opts[:exclude_in]))\n @optional_in = Set.new(Array(opts[:optional_in]))\n @default = opts[:default]\n @has_default = opts.key?(:default)\n @redact_in = Set.new(Array(opts[:redact_in]))\n end",
"def default(name,value)\n @network.spec_factory.defaults[name]=value\n end",
"def option(sym, default = nil, &block)\n _defmetasyntax(\"option\", _intern(sym), block) {|target|\n seq() { default } | seq(sym)\n }\n end",
"def set_default\n cmd = \"{\\\"id\\\":8,\\\"method\\\":\\\"set_default\\\",\\\"params\\\":[]}\\r\\n\"\n request(cmd)\n end",
"def apply_start_block_option_overrides(options)\n @requested_args.each { |option_name, option_value| options.update(option_name, option_value, add_missing: false) }\n end",
"def set_options(opts)\n common_options(opts)\n end",
"def set(name)\n @name = name\n self\n end",
"def options\n @scope.options\n end",
"def set_defaults(options = T.unsafe(nil)); end",
"def initialize(*args)\n DEFAULT_OPTIONS.each do |option|\n self.send(:\"#{option}=\", self.class.send(:class_variable_get, :\"@@default_#{option}\") )\n end\n end",
"def reset!\n Gocdkit::Configurable.keys.each do |key|\n instance_variable_set(:\"@#{key}\", Gocdkit::Default.options[key])\n end\n self\n end",
"def nested_set_scope(options = {})\n add_scope_conditions_to_options(options)\n\n self.class.base_class.default_scoped.nested_set_scope options\n end",
"def options\n defaults.merge!(@options)\n end",
"def options\n defaults.merge!(@options)\n end",
"def on_set_specific_options(scopetta_opt)\r\n @game_opt[:vale_napola] = scopetta_opt[:vale_napola][:val] if scopetta_opt[:vale_napola]\r\n @log.debug(\"Core scopetta options #{@game_opt.inspect}\")\r\n end"
] | [
"0.676358",
"0.6623187",
"0.6401575",
"0.63101536",
"0.6235039",
"0.61169153",
"0.60953236",
"0.60657513",
"0.6007901",
"0.6007901",
"0.5992962",
"0.5937585",
"0.59060174",
"0.58734804",
"0.58436984",
"0.58228767",
"0.5811458",
"0.57931924",
"0.57927626",
"0.57927626",
"0.578483",
"0.57778573",
"0.57713497",
"0.57713497",
"0.57713497",
"0.57543653",
"0.575008",
"0.575008",
"0.5748572",
"0.57068485",
"0.56956834",
"0.56956834",
"0.56956834",
"0.5695069",
"0.56889236",
"0.56889236",
"0.5688677",
"0.5670995",
"0.5667104",
"0.56593925",
"0.56504834",
"0.56282634",
"0.56163955",
"0.55723983",
"0.5568488",
"0.55683535",
"0.5566964",
"0.556081",
"0.5542787",
"0.5536805",
"0.5532988",
"0.5526569",
"0.5514239",
"0.55059284",
"0.5493449",
"0.5493389",
"0.548609",
"0.5484946",
"0.5480894",
"0.54771113",
"0.54657346",
"0.545277",
"0.5446998",
"0.54458606",
"0.5444292",
"0.5441648",
"0.5431067",
"0.5422979",
"0.54228014",
"0.54157674",
"0.539807",
"0.5396154",
"0.5395017",
"0.539485",
"0.53759974",
"0.5363904",
"0.5363904",
"0.536238",
"0.53584504",
"0.53570414",
"0.5355234",
"0.5347118",
"0.533186",
"0.53257585",
"0.53257585",
"0.5325257",
"0.5320068",
"0.53143793",
"0.5312917",
"0.53121644",
"0.530823",
"0.5302283",
"0.5298734",
"0.5289335",
"0.5285821",
"0.52842176",
"0.52755994",
"0.52641255",
"0.52641255",
"0.52624923"
] | 0.63188994 | 3 |
Used to build up find conditions | def list_conditions
@list_conditions ||= FilterFoo.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_find_conditions\n segments = conditions.collect{|c| c.to_find_conditions }.compact\n return nil if segments.length == 0\n cond = \"(\" + segments.collect{|s| s.first }.join(\" #{logical_join} \") + \")\"\n cond = \"NOT #{cond}\" if negative?\n \n values = segments.inject([]){|all, now| all + now[1..-1] }\n [ cond, *values ]\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 gen_conditions\n\t conditions = {}\n\t\tsearch_fields = [:title, :genre, :year, :directors, :actors]\n\t\tsearch_fields.each do |sf|\n\t\t conditions[sf] = self.send(sf).stringValue unless self.send(sf).nil? || self.send(sf).stringValue == \"\"\n\t\tend\n\t\t(conditions.empty?) ? nil : conditions\n\tend",
"def gen_conditions\n\t conditions = {}\n\t\tsearch_fields = [:title, :genre, :year, :directors, :actors]\n\t\tsearch_fields.each do |sf|\n\t\t conditions[sf] = self.send(sf).stringValue unless self.send(sf).nil? || self.send(sf).stringValue == \"\"\n\t\tend\n\t\t(conditions.empty?) ? nil : conditions\n\tend",
"def build_conditions_for_datatable\n criteria = search_for.inject([]) do |crit, atom|\n search = AjaxDatatablesRails::Datatable::SimpleSearch.new(value: atom, regex: datatable.search.regexp?)\n disjunction = searchable_columns.map do |simple_column|\n simple_column.search = search\n simple_column.search_query\n end.reduce(:or)\n bag_of_text_class = get_bag_of_text_class\n if bag_of_text_class\n bag_of_text_query = bag_of_text_class.arel_table[:bag_of_text].matches(\"%#{atom}%\")\n if disjunction\n disjunction = disjunction.or(bag_of_text_query)\n else\n disjunction = bag_of_text_query\n end\n end\n crit << disjunction\n end.compact.reduce(:and)\n criteria\n end",
"def gen_conditions\n\t conditions = {}\n\t\tsearch_fields = [:title, :genre, :year, :id]\n\t\tsearch_fields.each do |sf|\n\t\t conditions[sf] = self.send(sf).stringValue unless self.send(sf).nil? || self.send(sf).stringValue == \"\"\n\t\tend\n\t\t(conditions.empty?) ? nil : conditions\n\tend",
"def build_conditions!(options = {}, &block)\n conditions = @reflection.klass.build_conditions!(options, &block)\n conditions.scope = scope(:find)[:conditions]\n conditions\n end",
"def build_conditions(options = {}, &block)\n conditions = @reflection.klass.build_conditions(options, &block)\n conditions.scope = scope(:find)[:conditions]\n conditions\n end",
"def makeConditions #:doc:\n @condition_string = \"\"\n @condition_values = Hash.new\n i = 0\n \n # if search is from spesific devices\n if @device_ids.size > 0\n @device_ids.uniq!\n firstdevid = true\n @device_ids.each do |id|\n if firstdevid\n @condition_string += \"(devices.id in (\"\n firstdevid = false\n else\n @condition_string += \", \"\n end\n @condition_string += \":cond#{i}\"\n @condition_values.merge!({\"cond#{i}\".intern => id})\n i += 1\n end\n @condition_string += \"))\"\n if not @conditions.empty? or @locationdata.size == 3\n @condition_string += \" AND \"\n end\n end\n \n # take each condition and combine them\n firstcond = true\n @conditions.each do |keyword, values|\n condition = \"(\"\n statement = @condition_rules[keyword]\n \n # combine values\n firstvalue = true\n values.each do |value|\n condition_part = statement.gsub(\"?\") do |s|\n new = \":cond#{i}\"\n # bind the value\n @condition_values.merge!({\"cond#{i}\".intern => value})\n \n # do some special processing if the keyword is type and there's 2 \"?\"'s in the statement\n if keyword == \"type\" and statement.count(\"?\") == 2\n value = value[0..-2].insert(1, \".\")\n end\n i += 1\n new\n end\n \n if not firstvalue\n condition += \" OR \"\n end\n condition += condition_part\n \n firstvalue = false\n end\n \n condition += \")\"\n \n # append condition_string with the condition\n if not firstcond\n @condition_string += \" AND \"\n end\n @condition_string += condition\n firstcond = false\n end\n \n # add distance-search to conditions\n if @locationdata.size == 3\n statement = \"(\" + @condition_rules[\"distance\"] + \")\"\n j = 0\n statement.gsub!(\"?\") do |s|\n j += 1\n new = \":cond#{i}\"\n # bind the value\n if j == 1\n @condition_values.merge!({\"cond#{i}\".intern => @locationdata[\"lat\"]})\n elsif j == 3\n @condition_values.merge!({\"cond#{i}\".intern => @locationdata[\"lon\"]})\n elsif j == 5\n @condition_values.merge!({\"cond#{i}\".intern => (@locationdata[\"distance\"].to_f / @@kms_per_degree) **2})\n else\n i += 1\n end\n new\n end\n \n if not @conditions.empty?\n @condition_string += \" AND \"\n end\n @condition_string += statement\n end\n end",
"def build_conditions(params)\n Array.new.tap do |conditions|\n query_params = params.dup\n\n query_params.reject! do |k, v|\n !model_fields.keys.include?(k.to_sym) &&\n !model_relationships.keys.include?(k.to_sym) &&\n !(k.to_sym == :search)\n end\n\n query_params.compact.each do |key, value|\n filter_type = model_fields[key.to_sym] || model_relationships[key.to_sym] || key\n conditions << send(\"build_#{filter_type}_conditions\", key, value)\n end\n end\n end",
"def build_conditions(params)\n Array.new.tap do |conditions|\n query_params = params.dup\n\n query_params.reject! do |k, v|\n !model_fields.keys.include?(k.to_sym) &&\n !model_relationships.keys.include?(k.to_sym) &&\n !(k.to_sym == :search)\n end\n\n query_params.compact.each do |key, value|\n filter_type = model_fields[key.to_sym] || model_relationships[key.to_sym] || key\n conditions << send(\"build_#{filter_type}_conditions\", key, value)\n end\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 build_find_params(options)\n keyconditions = []\n keyparameters = []\n parameters = []\n includes = []\n joins = []\n\n # Build SQL WHERE clause using the AST\n sql = @ast.to_sql(self, definition) do |notification, value|\n\n # Handle the notifications encountered during the SQL generation:\n # Store the parameters, includes, etc so that they can be added to\n # the find-hash later on.\n case notification\n when :keycondition then keyconditions << value\n when :keyparameter then keyparameters << value\n when :parameter then parameters << value\n when :include then includes << value\n when :joins then joins << value\n else raise ScopedSearch::QueryNotSupported, \"Cannot handle #{notification.inspect}: #{value.inspect}\"\n end\n end\n # Build SQL ORDER BY clause\n order = order_by(options[:order]) do |notification, value|\n case notification\n when :parameter then parameters << value\n when :include then includes << value\n when :joins then joins << value\n else raise ScopedSearch::QueryNotSupported, \"Cannot handle #{notification.inspect}: #{value.inspect}\"\n end\n end\n sql = (keyconditions + (sql.blank? ? [] : [sql]) ).map {|c| \"(#{c})\"}.join(\" AND \")\n # Build hash for ActiveRecord::Base#find for the named scope\n find_attributes = {}\n find_attributes[:conditions] = [sql] + keyparameters + parameters unless sql.blank?\n find_attributes[:include] = includes.uniq unless includes.empty?\n find_attributes[:joins] = joins.uniq unless joins.empty?\n find_attributes[:order] = order unless order.nil?\n\n # p find_attributes # Uncomment for debugging\n return find_attributes\n end",
"def to_find_conditions\n @conditions.to_find_conditions\n end",
"def generate_search (options)\n conditions_stmt = ''\n\n if options[:id].to_s.strip != '' then\n options[:id] = CGI::unescape(options[:id])\n conditions_stmt += ' AND ' unless conditions_stmt == ''\n conditions_stmt += 'code = \"' + options[:id].to_s.strip + '\"'\n end\n\n if options[:visited].to_s.strip != '' then\n options[:visited] = CGI::unescape(options[:visited])\n conditions_stmt += ' AND ' unless conditions_stmt == ''\n conditions_stmt += 'visited = \"' + (options[:visited] == 'true' ? 't' : 'f') + '\"'\n end\n \n if options[:name].to_s.strip != '' then\n options[:name] = CGI::unescape(options[:name])\n conditions_stmt += ' AND ' unless conditions_stmt == ''\n if options[:name] =~ /\\*|\\%/\n options[:name] = options[:name].gsub('*', '%')\n conditions_stmt += 'name LIKE \"' + options[:name].to_s.strip + '\"'\n else\n if options[:name] =~ /!/\n conditions_stmt += 'name != \"' + options[:name].gsub('!', '').to_s.strip + '\"'\n else\n conditions_stmt += 'name = \"' + options[:name].to_s.strip + '\"'\n end\n end\n end\n \n Rails.logger.debug {\"Search conditions: #{conditions_stmt}\"}\n conditions_stmt\n end",
"def build_conditions(conditions)\n conditions = [\"1=1\"] if conditions.blank?\n unless self.claim_id.blank?\n conditions[0] += \" and id = ?\"\n conditions << self.claim_id\n end\n unless self.organisation_id.blank?\n conditions[0] += \" and organisation_id = ?\"\n conditions << self.organisation_id\n end\n unless self.date_service_start.blank?\n conditions[0] += \" and date_service >= ?\"\n conditions << self.date_service_start\n end\n unless self.date_service_end.blank?\n conditions[0] += \" and date_service <= ?\"\n conditions << self.date_service_end\n end\n unless self.invoice_date_start.blank?\n conditions[0] += \" and invoice_date >= ?\"\n conditions << self.invoice_date_start\n end\n unless self.invoice_date_end.blank?\n conditions[0] += \" and invoice_date <= ?\"\n conditions << self.invoice_date_end\n end\n unless self.programme_id.blank?\n conditions[0] += \" and programme_id = ?\"\n conditions << self.programme_id\n end\n unless self.fee_schedule_id.blank?\n conditions[0] += \" and fee_schedule_id = ?\"\n conditions << self.fee_schedule_id\n end\n unless self.claim_status_id.blank?\n conditions[0] += \" and claim_status_id = ?\"\n conditions << self.claim_status_id\n end\n unless self.invoice_no.blank?\n conditions[0] += \" and invoice_no = ?\"\n conditions << self.invoice_no\n end\n if self.zero_value == 1 \n conditions[0] += \" and amount = 0\"\n end\n conditions\n end",
"def conditions\n\t\t[conditions_clauses.join(' AND '), *conditions_options]\n\tend",
"def conditions\n\t\t[conditions_clauses.join(' AND '), *conditions_options]\n\tend",
"def build_where_ns(query,ns)\n where = \"\"\n query.each_pair do |k, v| \n if (k!='include' and k!='exclude')\n where += \"(`#{ns}`.`#{escape_str_field(k)}` #{build_equal_condition(v)}) AND \"\n end\n end\n where.chomp(' AND ')\n end",
"def build_search(options = {}, &block)\n conditions = @reflection.klass.build_search(options, &block)\n conditions.scope = scope(:find)[:conditions]\n conditions\n end",
"def conditions\n [conditions_clauses.join(' AND '), *conditions_options]\nend",
"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 scaffold_search_add_condition(conditions, record, field) # :doc:\n return unless column = record.column_for_attribute(field)\n if column.klass == String\n if record.send(field).length > 0\n conditions[0] << \"#{record.class.table_name}.#{field} #{record.class.scaffold_auto_complete_search_operator} ?\"\n conditions << \"%#{record.send(field)}%\"\n end\n elsif column.klass == Object\n conditions[0] << \"#{record.class.table_name}.#{field} IS #{record.send(field) ? 'TRUE' : 'FALSE'}\"\n else\n conditions[0] << \"#{record.class.table_name}.#{field} = ?\"\n conditions << record.send(field)\n end\n end",
"def build_scoped_search_conditions(search_string) \n if search_string.nil? || search_string.strip.blank?\n return {:conditions => nil}\n else \n query_fields = {}\n self.scoped_search_fields.each do |field| \n field_name = connection.quote_table_name(table_name) + \".\" + connection.quote_column_name(field)\n query_fields[field_name] = self.columns_hash[field.to_s].type\n end\n \n assoc_models_to_include = []\n self.scoped_search_assoc_groupings.each do |group|\n assoc_models_to_include << group[0]\n group[1].each do |group_field|\n field_name = connection.quote_table_name(group[0].to_s.pluralize) + \".\" + connection.quote_column_name(group_field)\n query_fields[field_name] = self.reflections[group[0]].klass.columns_hash[group_field.to_s].type\n end\n end\n \n search_conditions = QueryLanguageParser.parse(search_string) \n conditions = QueryConditionsBuilder.build_query(search_conditions, query_fields) \n \n retVal = {:conditions => conditions}\n retVal[:include] = assoc_models_to_include unless assoc_models_to_include.empty?\n\n return retVal\n end\n end",
"def build_search!(options = {}, &block)\n conditions = @reflection.klass.build_search!(options, &block)\n conditions.scope = scope(:find)[:conditions]\n conditions\n end",
"def to_find_conditions(join_association = {})\n return nil if operator.nil?\n \n op, arg_format, values = operator, \"?\", [operand]\n op, arg_format, values = case operator\n when :<=> then [ \"BETWEEN\", \"? AND ?\", [ operand.first, operand.last ] ]\n when :=~ then\n case operand\n when String then [ \"LIKE\", arg_format, values ]\n when Regexp then [ \"REGEXP\", arg_format, values.map(&:source) ]\n end\n when :==, :=== then\n case operand\n when Array then [ \"IN\", \"(?)\", values ]\n when Range then [ \"IN\", \"(?)\", values ]\n when Condition then [ \"=\", operand.full_name, [] ]\n when nil then [ \"IS\", \"NULL\", [] ]\n else [ \"=\", arg_format, values ]\n end\n when :contains then [ \"LIKE\", arg_format, values.map{|v| \"%#{v}%\" } ]\n else\n case operand\n when Condition then [ op, oprand.full_name, [] ]\n else [ op, arg_format, values ]\n end\n end\n sql = \"#{full_name} #{op} #{arg_format}\"\n sql = \"NOT (#{sql})\" if @negative\n [ sql, *values ]\n end",
"def conditions(extra_conditions = nil)\n time_qualifiers = qualifiers.select { |q| q.qualifiable_type == \"TimeRange\" }\n status_qualifiers = qualifiers.select { |q| q.qualifiable_type == \"Status\" }\n property_qualifiers = qualifiers.select { |q| q.qualifiable_type == \"PropertyValue\" }\n customer_qualifiers = qualifiers.select { |q| q.qualifiable_type == \"Customer\" }\n standard_qualifiers = (qualifiers - property_qualifiers - status_qualifiers -\n customer_qualifiers - time_qualifiers)\n\n res = conditions_for_standard_qualifiers(standard_qualifiers)\n res += conditions_for_property_qualifiers(property_qualifiers)\n res << conditions_for_status_qualifiers(status_qualifiers)\n res << conditions_for_customer_qualifiers(customer_qualifiers)\n res << conditions_for_time_qualifiers(time_qualifiers)\n res << conditions_for_keywords\n res << extra_conditions if extra_conditions\n res << user.user_tasks_sql\n res << unread_conditions(user) if unread_only?\n\n res = res.select { |c| !c.blank? }\n res = res.join(\" AND \")\n\n return res\n end",
"def build_where(query)\n where = \"\"\n query.each_pair do |k, v| \n if (k!='include' and k!='exclude')\n where += \"(`#{escape_str_field(k)}` #{build_equal_condition(v)}) AND \"\n end\n end\n where.chomp(' AND ')\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 build_predicates(structure)\n construct_condition(structure, true)\n end",
"def define_conditions(params, ptype, version_id)\n condition_array = []\n condition_array[0] = 'blank'\n select_conditions = []\n \n case ptype\n when 'id' #list of ids entered\n id_list = create_array_from_text_area(params[:oligo_ids], 'integer')\n select_conditions.push('id IN (?)')\n condition_array.push(id_list)\n \n when 'gl' #gene list entered (as array from drop-down)\n gene_list = params[:oligo_design][:gene_code]\n select_conditions.push('gene_code IN (?)')\n condition_array.push(gene_list)\n \n when 'gt' #gene list entered (as text)\n gene_list = create_array_from_text_area(params[:genes])\n select_conditions.push('gene_code IN (?)')\n condition_array.push(gene_list)\n \n when 'p' #project entered, without entering specific genes, so get all genes for project\n gene_list = ProjectGene.genelist(params[:project], nil)\n select_conditions.push('gene_code IN (?)')\n condition_array.push(gene_list)\n end\n \n if params[:enzyme] && !param_blank?(params[:enzyme][:enzyme_code])\n select_conditions.push('enzyme_code IN (?)')\n condition_array.push(enzyme_add_gapfill(params[:enzyme][:enzyme_code]))\n end\n \n select_conditions.push('version_id = ?')\n condition_array.push(version_id)\n condition_array[0] = select_conditions.join(' AND ')\n return condition_array \n end",
"def generate_conditions owner, name\n result = \"\"\n parent = nil\n has_resource = false\n resources.each do |resource| \n if resource == name\n has_resource = true\n break\n end\n \n parent = resource if resource != name\n end\n \n result = \", :conditions => [\\\"#{parent}_id = ?\\\", @#{owner}.#{name}.#{parent}.id]\" if has_resource && parent\n result\n end",
"def conditions\n return ['1=0'] if !valid?\n\n conds = []\n values = []\n for col in klass.columns do\n col_str = col_name(col)\n val = @attrs[encode_name(col)]\n if !val.blank?\n case col.type\n when :string, :text\n if val =~ /\\*$/\n conds << col_str + ' like ?'\n values << val.gsub(/\\*$/, '%')\n else\n conds << col_str + '=?'\n values << val\n end\n when :datetime\n case is_dbms?\n when Dbms::MYSQL\n# conds << col_str + @_operator.exp(encode_name(col))\n conds << sprintf(\"date(%s)\",\n col_str) +\n @_operator.exp(encode_name(col))\n else\n conds << sprintf(\"date(timezone('%s',%s))\",\n DEFAULT_TIMEZONE_FOR_TIMESTAMP_DATE_COMPARISON,\n col_str) +\n @_operator.exp(encode_name(col))\n end\n values << val.to_s\n when :boolean\n case is_dbms?\n when Dbms::MYSQL\n conds << col_str + @_operator.exp(encode_name(col))\n values << (val=='true')\n else\n conds << col_str + @_operator.exp(encode_name(col))\n values << val\n end\n else\n conds << col_str + @_operator.exp(encode_name(col))\n values << val\n end\n end\n end\n return [conds.join(' and ')] + values\n end",
"def get_criteria\n parameters = params[:analysis] ? params[:analysis] : params\n criteria = { name: parameters[:name] }\n criteria[:collection] = parameters[:collection] if parameters[:collection].present?\n if parameters[:date_from].present?\n criteria[:attribute] = :date\n criteria[:value] = date_from..date_to\n return criteria\n end\n [:size, :color, :fabric].each do |attr|\n if parameters[attr].present?\n criteria[:attribute] = \"pieces.#{attr}\"\n criteria[:value] = parameters[attr]\n return criteria\n end\n end\n criteria\n end",
"def make_conditions(params, model)\n search_string = params[SEARCH_KEY]\n filter_string = params[FILTER_KEY]\n if search_string && filter_string\n error 400, convert(body_for(:invalid_params, [FILTER_KEY]))\n elsif search_string\n words = search_string.downcase.split(\" \")\n { :_keywords => { '$all' => words } }\n elsif filter_string\n begin\n unsafe = QS_FILTER.parse(filter_string)\n sanitize(unsafe, model)\n rescue QueryStringFilter::ParseError\n error 400, convert(body_for(:invalid_filter, filter_string))\n end\n else\n {}\n end\n end",
"def subtree_conditions\n column = \"#{self.base_class.table_name}.#{self.base_class.structure_column}\"\n lookup = if has_parent? then\n \"%/#{id}\"\n else\n \"#{id}\"\n end\n [\"#{column} like ?\n or #{column} like ?\n or #{column} like ?\n or #{column} like ?\n or #{column} = ?\n or #{self.base_class.table_name}.#{self.base_class.primary_key} = ?\", \"#{lookup}\", \"#{lookup}/%\", \"#{lookup},%\", \",#{id}\", \"#{id}\", \"#{id}\"]\n end",
"def build_condition_string\n @criteria.each do |k, criteria_fields|\n next if criteria_fields['value'].blank? # If there is no value to compare against don't add to the where clause\n\n # \"(display_field_values.display_field_id = ? AND display_field_values.value #{condition})\"\n condition_sql = \"\"\n condition_params = []\n\n if %w(survey_response_id survey_responses.page_url survey_responses.created_at survey_responses.device).include?(criteria_fields['display_field_id'])\n\n # The display_field_id is actually the full column name we want to use in the where clause\n operator = sql_condition(criteria_fields['include_exclude'], criteria_fields['condition'])\n\n condition_sql = \"#{criteria_fields['display_field_id']} #{operator} ?\"\n\n if criteria_fields['display_field_id'] == 'survey_responses.created_at'\n # When the display_field_id == 'survey_responses.created_at' then we need to convert the value to a datetime object\n begin\n # chomp the value\n criteria_fields['value'].chomp!\n\n # Set the time format string based on the datetime input by the user\n if /\\d{1,2}\\/\\d{1,2}\\/\\d{4}\\s\\d{2}:\\d{2}:\\d{2}/.match(criteria_fields['value'])\n time_string = \"%m/%d/%Y %H:%M:%S\"\n elsif /\\d{1,2}\\/\\d{1,2}\\/\\d{4}\\s\\d{2}:\\d{2}/.match(criteria_fields['value'])\n time_string = \"%m/%d/%Y %H:%M\"\n elsif /\\d{1,2}\\/\\d{1,2}\\/\\d{4}/.match(criteria_fields['value'])\n time_string = '%m/%d/%Y'\n else\n next # The time submitted date does not fit any of the formats so skip the condition\n end\n\n search_time = Time.strptime(criteria_fields['value'] + \" #{Time.zone.now.formatted_offset}\", time_string.chomp + \" %:z\")\n search_time += 1.day if time_string == \"%m/%d/%Y\" && operator == \">\"\n search_time = search_time + 1.day - 1.second if time_string == \"%m/%d/%Y\" && operator == \"<=\"\n\n condition_params << search_time\n\n rescue\n next # An error was raised when processing Time.strptime() meaning we have an invalid date\n end\n else\n # When the display_field_id == 'survey_resposnes.page_url' just add the condition directly on\n condition_params << value_bind(criteria_fields['value'], criteria_fields['condition'])\n end\n\n else\n # Add the field to search\n field_to_search = \"display_field_values.display_field_id = ?\"\n condition_params << criteria_fields['display_field_id']\n\n # add the condition check\n condition = \"display_field_values.value #{sql_condition(criteria_fields['include_exclude'], criteria_fields['condition'])} ?\"\n\n # add the condition parameter\n condition_params << value_bind(criteria_fields['value'], criteria_fields['condition'])\n\n condition_sql = \"(#{field_to_search} AND #{condition})\"\n end\n\n @conditions << condition_sql\n @parameters.concat(condition_params)\n\n @clause_joins << (criteria_fields['clause_join'] || 'AND') unless @conditions.size == 1\n end\n end",
"def define_conditions(params, version_id=Version::DESIGN_VERSION_ID)\n @where_select = ['version_id = ?']\n @where_values = [version_id]\n\n if params[:gene_string]\n gene_array = create_array_from_text_area(params[:gene_string])\n elsif params[:pilot_oligo_design] && !param_blank?(params[:pilot_oligo_design][:gene_code])\n gene_array = params[:pilot_oligo_design][:gene_code] \n end\n \n if gene_array\n @where_select.push(\"gene_code IN (?)\")\n @where_values.push(gene_array)\n end\n \n sql_where_clause = [@where_select.join(' AND ')].concat(@where_values)\n return sql_where_clause\n end",
"def conditions\n [@clause, current_id, *@clause_args]\n end",
"def conditions; end",
"def conditions; end",
"def appctrl_build_search_conditions( model )\n\n # All search-related keys start with \"s_\". The next character is a number\n # or letter which causes \"sort\" to organise keys in the order specified in\n # the view. An associated key \"sr_\" carries \"and\" or \"or\" for the radio\n # button selection for that entry, or neither of these if there is no radio\n # button (the first search term).\n\n conditions = []\n query = ''\n first = true\n columns = model::SEARCH_COLUMNS\n translate = model.respond_to?( :columns_for_translation )\n\n columns.each do | column |\n\n # Fields with a \"#\" inside have a method name to call to generate the\n # form data.\n\n array = column.split( '#' )\n\n if ( array.size > 1 )\n column = array.first\n generator_method = array.last\n else\n generator_method = nil\n end\n\n column = model.translated_column( column ) if ( translate )\n value = params[ \"s_#{ column }\".to_sym ]\n next if ( value.blank? )\n\n radio = params[ \"sr_#{ column }\".to_sym ]\n\n # If this is the first search term with a non-empty value then the radio\n # button and/or state is irrelevant and must be suppressed to avoid\n # invalid SQL generation later.\n\n if ( first )\n radio = ''\n first = false\n end\n\n # Make sure the value is an appropriate type.\n\n klass = model.columns_hash[ column ].klass # Ruby type representing column\n\n if ( klass == Fixnum )\n value = value.to_i\n elsif ( klass == Float )\n value = value.to_f\n else\n value = \"%#{ value }%\"\n end\n\n # If a block is given then call it, passing the column name. It should\n # evaluate to \"nil\" or a string.\n\n caller_sql = yield( column ) if ( block_given? )\n\n if ( caller_sql.nil? )\n klass = model.columns_hash[ column ].klass # Ruby type representing column\n\n if ( klass == Fixnum || klass == Float )\n sql_fragment = \"#{ column } = ?\"\n else\n sql_fragment = \"LOWER(#{ column }) LIKE LOWER(?)\"\n end\n\n conditions.push( value )\n else\n sql_fragment = caller_sql\n conditions = conditions + ( [ value ] * caller_sql.count( '?' ) )\n end\n\n # Map radios manually, rather than with \"radio.uppercase\" or whatever -\n # the values come from the form submission so cannot be trusted. Someone\n # might try inserting bits of SQL in there to hack the site.\n\n case radio\n when \"and\": sql_fragment = \" AND (#{ sql_fragment })\"\n when \"or\": sql_fragment = \" OR (#{ sql_fragment })\"\n else sql_fragment = \"(#{ sql_fragment })\"\n end\n\n query << sql_fragment\n end\n\n # Push the conditions string onto the front of the array as this is what\n # the \":conditions\" parameter in \"find()\" et al will expect.\n\n return conditions.unshift( query )\n end",
"def descendant_conditions\n column = \"#{self.base_class.table_name}.#{self.base_class.ancestry_column}\"\n lookup = if has_parent? then\n \"%/#{id}\"\n else\n \"#{id}\"\n end\n [\"#{column} like ?\n or #{column} like ?\n or #{column} like ?\n or #{column} like ?\n or #{column} = ?\", \"#{lookup}\", \"#{lookup}/%\", \"#{lookup},%\", \",#{id}\", \"#{id}\"]\n end",
"def conditions\n sqlwhere = \"1 = 1 \"\n sqlwhere = sqlwhere + \"and orders.namel like ? \" if is_string_here?(namel)\n sqlwhere = sqlwhere + \"and orders.email like ? \" if is_string_here?(email)\n sqlwhere = sqlwhere + \"and addresses.street_address1 like ? \" if is_string_here?(street_address1)\n sqlwhere = sqlwhere + \"and addresses.street_address2 like ? \" if is_string_here?(street_address2)\n sqlwhere = sqlwhere + \"and orders.user_id = ? \" if is_object_here?(user_id)\n sqlwhere = sqlwhere + \"and orders.order_state_id = ? \" if is_object_here?(order_state_id)\n sqlwhere = sqlwhere + \"and orders.checkout_state_id = ? \" if is_object_here?(checkout_state_id)\n sqlwhere = sqlwhere + \"and orders.created_at > ? \" if is_object_here?(created_at_since)\n sqlwhere = sqlwhere + \"and orders.created_at < ? \" if is_object_here?(created_at_till)\n\n result = [sqlwhere]\n result << UnicodeUtils.downcase(namel) if is_string_here?(namel)\n result << UnicodeUtils.downcase(email) if is_string_here?(email)\n result << UnicodeUtils.downcase(street_address1) if is_string_here?(street_address1)\n result << UnicodeUtils.downcase(street_address2) if is_string_here?(street_address2)\n result << user_id if is_object_here?(user_id)\n result << order_state_id if is_object_here?(order_state_id)\n result << checkout_state_id if is_object_here?(checkout_state_id)\n result << created_at_since if is_object_here?(created_at_since)\n result << created_at_till if is_object_here?(created_at_till)\n result\n end",
"def google_conditions(search, field)\n goods = search.goods\n bads = search.bads\n ands = []\n ands += goods.map do |good|\n or_clause(*good.map { |str| \"#{field} LIKE '%#{clean_pattern(str)}%'\" })\n end\n ands += bads.map { |bad| \"#{field} NOT LIKE '%#{clean_pattern(bad)}%'\" }\n [ands.join(\" AND \")]\n end",
"def build_conditions_for_my_or_all(emp_user_id,company_id,record_type=\"My\",assigned_id=\"assigned_to_employee_user_id\")\n\t\tif record_type == \"My\"\n\t\t\t\" #{assigned_id} = #{emp_user_id} and company_id = #{company_id} \"\n\t\telse\n\t\t\t\"company_id = #{company_id}\"\n\t\tend\n\tend",
"def pattern_find_with_conditions_and_params_or_limit\n <<-EOT\n SendWithArguments<\n arguments = ActualArguments<\n array = [\n any+,\n HashLiteral<\n array = [\n any{even},\n SymbolLiteral<value = :limit | :conditions>,\n SendWithArguments<\n name = :[],\n receiver = Send<name = :params | :session>\n >,\n any{even}\n ]\n >\n ]\n >,\n name = :find>\n EOT\n end",
"def find_options options={}\r\n con = conditions\r\n par = parameters\r\n inc = includes\r\n cond_ary = nil\r\n if conditions\r\n cond_ary=[con]\r\n cond_ary += par if par\r\n end\r\n options[:conditions] = cond_ary if cond_ary\r\n options[:include] = includes if includes\r\n options \r\n end",
"def makeSearch #:doc:\n # beginning of sql query string\n sql = @select_part1 + \" \" + @select_part2\n\n begin\n @hash_in_where = \"\"\n \n if @context_hash != nil\n \n # If 'user' parameter given, only files owned by 'user' can be in search results.\n only_these_users_in_where = \"\"\n if @only_these_users != nil\n only_these_users_in_where = \" users.username IN (\"\n users = @only_these_users.split(' ')\n users.each_with_index do |x, i|\n if i == 0\n only_these_users_in_where += \"'\" + x + \"'\"\n else\n only_these_users_in_where += ', ' + \"'\" + x + \"'\"\n end\n end\n \n only_these_users_in_where += \") AND \"\n end\n \n \n # Find devfiles that have queried context_hash\n devfiles = Devfile.find_by_sql(\"SELECT devfiles.id as devfile_id, devfiles.device_id, metadatas.devfile_id, metadatas.metadata_type_id,\n metadatas.value, metadata_types.id, metadata_types.name,\n devices.id, devices.user_id, users.id, users.username \n FROM devfiles, metadatas, metadata_types, devices, users\n WHERE metadatas.value = '\"+@context_hash+\"' AND\n metadata_types.name = 'context_hash' AND\n devfiles.id = metadatas.devfile_id AND\n devices.id = devfiles.device_id AND\n devices.user_id = users.id AND #{only_these_users_in_where}\n metadatas.metadata_type_id = metadata_types.id\")\n \n if devfiles != nil && devfiles.size > 0\n # Add id:s of devfiles that will be included into results, because these devfiles belong to queried context\n @hash_in_where = \" OR devfiles.id IN ( \"\n \n @devfiles_in_context = Array.new\n \n devfiles.each_with_index do |x, i|\n @devfiles_in_context.push(x.devfile_id)\n if i == 0\n @hash_in_where += x.devfile_id.to_s\n else\n @hash_in_where += \", \" + x.devfile_id.to_s\n end \n end\n @hash_in_where += \" )\"\n end\n end\n puts @hash_in_where\n available_files_only_in_where = \"\"\n \n if @availableFilesOnly == true\n available_files_only_in_where = \" AND ( blobs.uploaded = 1 OR devices.last_seen >= '#{device_online_timeout.to_s(:db)}' ) \"\n end\n \n show_deleted_files_in_where = \"\"\n \n if @showDeletedFiles == false && @queryparams[:what_to_get] =~ /files/i\n show_deleted_files_in_where = \" AND devfiles.deleted = 0 \"\n end\n \n # make the where-part of the sql query\n if not @versionlist_conditions\n makeConditions\n if @condition_string != \"\" || @hash_in_where != \"\"\n sql += \" ( \" + @condition_string + @hash_in_where + \" ) \"\n else\n sql += \" false \"\n end\n sql += show_deleted_files_in_where + available_files_only_in_where + @default_id_conditions\n else\n sql += \" \" + @versionlist_conditions + \" \" + @default_id_conditions\n end\n rescue => exp\n putsE(exp)\n raise exp\n end\n\n @sql = sql\n \n # sorting order\n @sql_sorting = \"\"\n if not @versionlist_sorting\n @sql_sorting = getSortingOrder\n else\n @sql_sorting = @versionlist_sorting\n end\n \n sql += \" ORDER BY \" + @sql_sorting\n puts \"Initial SQL: #{sql}\"\n \n @results_per_page = 100 # default\n @show_page = 1 # default\n if @queryparams[:format] == \"atom\"\n @results_per_page = 100 #default maxresults for atom-feed\n if @queryparams[:maxresults] and @queryparams[:maxresults] =~ /^\\d{1,}$/\n @results_per_page = @queryparams[:maxresults]\n end\n else\n if @queryparams[:perpage]\n @results_per_page = @queryparams[:perpage].to_i\n end\n if @queryparams[:page] and @queryparams[:page] =~ /^\\d{1,}$/\n @show_page = @queryparams[:page]\n end\n end\n\n # will_paginate uses sql-subqueries to get COUNT of rows. Subqueries are NOT\n # supported by Mysql versions < 4.1. So we have to do the counting by ourselves...\n count = sql.gsub(@select_part1, \"SELECT COUNT(*) AS entries\").gsub(/\\sORDER BY.*$/, \"\").gsub!(/\\:\\w+/) do |s|\n \"'\" + @condition_values[s.gsub(\":\", \"\").intern].to_s + \"'\"\n end\n \n \n \n if @queryparams[:what_to_get] =~ /files/i\n # entries = Devfile.count_by_sql(count)\n\n # Pagination will be made later, with new sql query\n @results = Devfile.find_by_sql [sql, @condition_values]#,\n# :page => @show_page,\n# :per_page => @results_per_page,\n# :total_entries => entries\n # Remove files from results that user is not allowed to access\n checkFileRightstoResults \n elsif @queryparams[:what_to_get] =~ /devices/i\n entries = Device.count_by_sql(count)\n @results = Device.paginate_by_sql [sql, @condition_values],\n :page => @show_page,\n :per_page => @results_per_page,\n :total_entries => entries\n # SHOULD EVERYONE BE ALLOWED TO SEE ALL DEVICES?\n \n elsif @versionlist_conditions\n entries = Blob.count_by_sql(count)\n @results = Blob.paginate_by_sql [sql, @condition_values],\n :page => @show_page,\n :per_page => @results_per_page,\n :total_entries => entries\n end\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_field_conditions_as_hash\n [\n { :value => I18n.t(\"and\"), :key => \"and\"},\n { :value => I18n.t(\"or\"), :key => \"or\"},\n { :value => I18n.t(\"exclude\"), :key => \"exclude\"}\n ]\n end",
"def search_conditions(query, fields=nil)\n return nil if query.blank?\n fields ||= @search_columns\n\n # split the query by commas as well as spaces, just in case\n words = query.split(\",\").map(&:split).flatten\n\n binds = {} # bind symbols\n or_frags = [] # OR fragments\n count = 1 # to keep count on the symbols and OR fragments\n\n words.each do |word|\n like_frags = [fields].flatten.map { |f| \"LOWER(#{f}) LIKE :word#{count}\" }\n or_frags << \"(#{like_frags.join(\" OR \")})\"\n binds[\"word#{count}\".to_sym] = \"%#{word.to_s.downcase}%\"\n count += 1\n end\n [or_frags.join(\" AND \"), binds]\n end",
"def conditions\n @conditions ||= []\n end",
"def conditions\n @conditions\n end",
"def conditions\n @conditions\n end",
"def build_filter filters, fields\n filters = [filters] unless filters.is_a? Array\n where = [Array.new(filters.count, associations_to_tables(fields).map { |f| \"#{f} LIKE ?\" }.join(\" || \")).join(\" || \")]\n filters.each do |filter|\n fields.count.times { |n| where << \"%#{filter}%\" }\n end\n where\n end",
"def build_where rule_selectors: []\n return [] if rule_selectors.size == 1\n\n 0.upto(rule_selectors.size-2).collect do |index|\n \"ID(ro0) = ID(ro#{index+1})\"\n end\n end",
"def conditions\n @generated_conditions.collect { |_, cond| cond }\n end",
"def get_conditions_for(base_scope, query)\n unless query.blank?\n base_scope = base_scope.like_any([:name, :description], query.split)\n end\n base_scope\n end",
"def search(*rules); end",
"def search(*rules); end",
"def find_with_searchlogic(*args)\n options = args.extract_options!\n options = filter_options_with_searchlogic(options)\n args << options\n find_without_searchlogic(*args)\n end",
"def build_filter filter, fields\n where = [fields.map { |f| \"#{f} like ?\" }.join(\" || \")]\n fields.count.times { |n| where << \"%#{filter}%\" }\n where\n end",
"def build_criteria(more=[], less=[], local={})\n # TODO: This build_criteria treats \"more\" differently than the\n # ObjectBase one. Sort it out! (This way is better)\n names = [:region, :zone, :environment, :role].compact\n names -= [*less].flatten.uniq.compact\n values = names.collect do |n|\n local[n.to_sym] || @@global.send(n.to_sym)\n end\n names.zip(values) + more\n end",
"def subtree_conditions\n column = \"#{self.base_class.table_name}.#{self.base_class.ancestry_column}\"\n lookup = if has_parent? then\n \"%/#{id}\"\n else\n \"#{id}\"\n end\n [\"#{column} like ?\n or #{column} like ?\n or #{column} like ?\n or #{column} like ?\n or #{column} = ?\n or #{self.base_class.table_name}.#{self.base_class.primary_key} = ?\", \"#{lookup}\", \"#{lookup}/%\", \"#{lookup},%\", \",#{id}\", \"#{id}\", \"#{id}\"]\n end",
"def conditions_for_keywords\n sql = []\n params = []\n\n keywords.each do |kw|\n str = \"lower(tasks.name) like ?\"\n str += \" or lower(tasks.description) like ?\"\n sql << str\n 2.times { params << \"%#{ kw.word.downcase }%\" }\n end\n\n sql = sql.join(\" or \")\n res = TaskFilter.send(:sanitize_sql_array, [ sql ] + params)\n return \"(#{ res })\" if !res.blank?\n end",
"def build_scoped_search_conditions(search_string)\n if search_string.nil? || search_string.strip.blank?\n return {:conditions => nil}\n else\n query_fields = {}\n self.scoped_search_fields.each do |field|\n field_name = model.connection.quote_table_name(model.table_name) + \".\" + model.connection.quote_column_name(field)\n query_fields[field_name] = model.columns_hash[field.to_s].type\n end\n\n assoc_model_indx = 0\n assoc_fields_indx = 1\n assoc_models_to_include = []\n self.scoped_search_assoc_groupings.each do |group|\n assoc_models_to_include << group[assoc_model_indx]\n group[assoc_fields_indx].each do |group_field|\n field_name = model.connection.quote_table_name(group[assoc_model_indx].to_s.pluralize) + \".\" + model.connection.quote_column_name(group_field)\n query_fields[field_name] = model.reflections[group[assoc_model_indx]].klass.columns_hash[group_field.to_s].type\n end\n end\n\n search_conditions = ScopedSearch::QueryLanguageParser.parse(search_string)\n conditions = ScopedSearch::QueryConditionsBuilder.build_query(search_conditions, query_fields)\n\n retval = {:conditions => conditions}\n retval[:include] = assoc_models_to_include unless assoc_models_to_include.empty?\n\n return retval\n end\n end",
"def conditions\n @@conditions ||= []\n end",
"def find_expressions (options={})\n\n #conditions = determine_conditions(options)\n # note : this call modifies the options hash...\n\n conditions = {}\n\n #\n # maximize usage of SQL querying\n\n exps = DataMapper.repository(@dm_repository) {\n DmExpression.all(conditions)\n }\n\n #\n # do the rest of the filtering\n\n exps.inject([]) { |a, de|\n fe = de.as_owfe_expression(application_context)\n a << fe if does_match?(options, fe)\n a\n }\n end",
"def test_like_two_search_condition\n search_conditions = [[\"Wes\", :like],[\"Hays\", :like]]\n query_fields = {'some_table.first_name' => :string,'some_table.last_name' => :string} \n conditions = build_query(search_conditions, query_fields) \n \n fields = ['first_name','last_name']\n regExs = [build_regex_for_like(fields,'keyword_0'), \n build_regex_for_like(fields,'keyword_1')].join('[ ]AND[ ]')\n \n assert_match /^#{regExs}$/, conditions.first\n assert_equal '%Wes%', conditions.last[:keyword_0]\n assert_equal '%Hays%', conditions.last[:keyword_1]\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 search(criteria = {})\r\n \r\n end",
"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 conditions\n @conditions + @condition_blocks\n end",
"def conditions\n [[]]\n end",
"def prepare_conditions\n @conditions = [\"null is not null\"]\n if @user.has_one_of_roles?(['admin', 'vicerector'])\n @conditions = ['null is null']\n elsif @user.has_one_of_roles?(['dean', 'faculty_secretary'])\n @conditions = [\"department_id IN (\" + @user.person.faculty.departments.map {|dep|\n dep.id}.join(', ') + \")\"]\n elsif @user.has_one_of_roles?(['leader', 'department_secretary'])\n department_id = @user.person.department.id\n @conditions = ['department_id = ?', department_id]\n elsif @user.has_role?('tutor')\n @conditions = ['tutor_id = ?', @user.person.id]\n end\n end",
"def add_where(arr:)\n @where_conditions << \" AND (#{arr.first}) \" # put in parenthesis for good measure\n @where_params << arr[1..]\n @where_params.flatten!\n end",
"def get_conditions(groups, options = {})\n options = options.clone # Often params are directly passed here... and this function can mess 'em up\n options[:id] = nil unless options[:id] =~ /^\\d+$/\n id_select = options[:id].blank? ? \"IS NULL\" : \"= :id\" \n conditions = [%Q{\n group_id IN (:groups) AND (\n (controller = 'all' AND action = 'all') OR\n (controller = :controller AND action = 'all' AND item_id #{id_select}) OR\n (controller = :controller AND action = :action) OR\n (controller = :controller AND action = :action AND item_id #{id_select} ) )},\n { :groups => groups, :controller => options[:controller], :action => options[:action], :id => options[:id] }] \n return conditions\n end",
"def build_condition_clauses(conditions, aggregations)\n {}.tap do |clauses|\n aggregations.each do |agg|\n clauses.merge!(agg.to_query) if agg.selections?\n end\n conditions.each_pair do |name, condition|\n next if condition.name == :keywords\n merge_clause(clauses, condition.to_query) unless condition.blank?\n end\n end\n end",
"def build_list_options\n conditions = []\n conditions_str = []\n @search_titles = []\n @search_filters ||= {}\n # convert, from k-params to k-fields\n params_keys = {}\n params.delete_if { |kp,v|\n unless (kf = ParamToField[kp.to_sym]).nil? then\n @search_filters[ kf ] = v\n params_keys[ kf ] = kp\n true\n end\n }\n\n if @search_filters[:addressbook_group_id] then \n if filter_instance = AddressbookGroup.find_by_id(@search_filters[:addressbook_group_id]) \n conditions_str << \"addressbook_group_phones.addressbook_group_id = ?\"\n conditions << @search_filters[:addressbook_group_id]\n @search_titles << ['addressbook group', filter_instance]\n else\n @search_filters.delete(:addressbook_group_id)\n end\n end\n\n=begin\n if @search_filters[:department_id] then \n filter_instance = Department.find_by_id(@search_filters[:department_id])\n if filter_instance then\n conditions_str << \"addressbook_contacts.department_id = ?\"\n conditions << @search_filters[:department_id]\n @search_titles << ['department', filter_instance]\n else\n @search_filters.delete(:department_id)\n end\n end\n if @search_filters[:user_id] then \n filter_instance = User.find_by_id(@search_filters[:user_id])\n if filter_instance then\n conditions_str << \"addressbook_contacts.user_id = ?\"\n conditions << @search_filters[:user_id]\n @search_titles << ['user', filter_instance]\n else\n @search_filters.delete(:user_id)\n end\n end\n=end\n \n #conditions_str << \"addressbook_contacts.public = ?\"\n #conditions << params[:public]\n \n #if !params[:public] then\n # conditions_str << \"addressbook_contacts.user_id = ? \"\n # conditions << self.current_user.id\n #end\n \n if @search_filters[:search_text] then\n search_fields = %w(name email description address city country birthday)\n unless search_fields.empty? then\n conditions_str << '(' + search_fields.map{ |c| \"`addressbook_contacts`.`#{c}` LIKE ?\" }.join(' OR ') + ')'\n search_fields.size.times { conditions << \"%#{@search_filters[:search_text]}%\" }\n end \n @search_titles << ['text', @search_filters[:search_text]] \n end\n \n \n # store again to params (for next link)\n @search_filters.each_pair { |kf,v| params[ params_keys[kf] ] = v }\n \n # return conditions array\n conditions.unshift( conditions_str.join(' AND ') ) unless conditions_str.empty?\n conditions unless conditions.empty?\n end",
"def find_by_flags(*args)\n conditions = self.flags_conditions(args)\n where([ conditions ])\n end",
"def construct_owner_conditions(table = aliased_table, reflection = @reflection)\n construct_owner_attributes(reflection).map do |attr, value|\n table[attr].eq(value)\n end\n end",
"def search_condition\n if search_support? && params[:q].present?\n clause = search_columns.collect {|f| \"#{model_class.table_name}.#{f} LIKE ?\" }.\n join(\" OR \")\n param = \"%#{params[:q]}%\"\n [\"(#{clause})\"] + [param] * search_columns.size\n end\n end",
"def append_matter_date_cond(search,conditions_hash)\n\n \n search += \" AND created_at Between :start_date AND :end_date \" if params[:get_records] == \"My\"\n \n time = nil\n case params[:report][:duration]\n when \"1\" #1 months\n time = Time.zone.now.last_month\n when \"2\" #3 months\n 3.times do |i|\n unless time\n time = Time.zone.now.last_month\n else\n time = time.last_month\n end\n end\n when \"3\" #6 months\n 6.times do |i|\n unless time\n time = Time.zone.now.last_month\n else\n time = time.last_month\n end\n end\n else #date range given\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 if params[:report][:duration] != \"range\"\n conditions_hash[:start_date] = time\n conditions_hash[:end_date] = Time.zone.now\n end\n search\n end",
"def as_conditions\n scope_options = @options.dup\n sorting = scope_options.delete(:sort)\n scope_options[:order_by] = sorting if sorting\n scope_options[:includes] = inclusions.map(&:name) if inclusions.any?\n { :where => @selector }.merge(scope_options)\n end",
"def selected_filter_conditions(filter_class)\n\n @conditions = \"\"\n @included = []\n\n #pass in existing filters\n if params[:selected_filters]\n @selected_filters = params[:selected_filters] \n else \n @selected_filters = {} \n end\n\n #intialise hashes to store filters\n filter_class.filters.each do |j_f|\n @selected_filters[j_f] = {} if !defined?(@selected_filters[j_f]) || @selected_filters[j_f] == nil \n end\n\n @filtered = params[:filter]\n\n #new filter passed in - add or remove from existing as needed\n if @filtered\n\n if params[:remove]\n @selected_filters[@filtered].delete(params[:id])\n else\n @filter_id = params[:id]\n @filter_name = params[:name]\n @selected_filters[@filtered] = {params[:id] => params[:name]}\n end\n\n end\n\n #build up list of conditions to filter results\n if @selected_filters != {}\n @selected_filters.each do |filter, values|\n\n if values != {}\n\t @included << filter.to_sym\n @conditions += \" AND \" if @conditions != \"\"\n @ids = []\n \n values.each do | v | \n @ids << v[0]\n end\n \n @conditions += \"#{filter}.id IN (#{@ids})\"\n\t end \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 matches_conditions?(object, query); end",
"def conditions\n c = []\n c << \"Index='#{new_resource.index}'\" unless new_resource.index.nil?\n c << \"MacAddress='#{new_resource.hw_address}'\" unless new_resource.hw_address.nil?\n raise Chef::Exceptions::UnsupportedAction, 'Failed to find interface, no conditions provided' if c.empty?\n c.join(' AND ')\n end",
"def find options = {}\n init_specification options, CANONICAL_OPTIONS do\n finish_specification_initialization \n end\n return Aquarium::Finders::FinderResult.new if nothing_to_find?\n types_and_objects = input_types + input_objects\n method_names_or_regexps = input_methods\n if method_names_or_regexps.empty?\n not_matched = {}\n types_and_objects.each {|t| not_matched[t] = []}\n return Aquarium::Finders::FinderResult.new(:not_matched => not_matched)\n end\n result = do_find_all_by types_and_objects, method_names_or_regexps\n unless (input_exclude_methods.nil? or input_exclude_methods.empty?)\n result -= do_find_all_by types_and_objects, input_exclude_methods\n end\n result\n end",
"def condition_string(starts_at_attr, ends_at_attr)\n except_option = Array(options[:exclude_edges]).map(&:to_s)\n starts_at_sign = except_option.include?(starts_at_attr.to_s.split(\".\").last) ? \"<\" : \"<=\"\n ends_at_sign = except_option.include?(ends_at_attr.to_s.split(\".\").last) ? \">\" : \">=\"\n query = []\n query << \"(#{ends_at_attr} IS NULL OR #{ends_at_attr} #{ends_at_sign} :starts_at_value)\"\n query << \"(#{starts_at_attr} IS NULL OR #{starts_at_attr} #{starts_at_sign} :ends_at_value)\"\n query.join(\" AND \")\n end",
"def sql_where_clauses opts = { }\n opts = options.merge(opts)\n\n sql = ''\n\n clauses = [ ]\n\n # Construct find :conditions.\n (Content.query_column_names + [ :content_id, :size ]).\n each do | column |\n if params.key?(column)\n value = params[column]\n field_is_int = false\n field = \n case column \n when :content_id\n field_is_int = true\n \"contents.id\"\n when :id, :version\n field_is_int = true\n \"contents.#{column}\"\n when :uuid, :md5sum, :filename, :tasks\n \"contents.#{column}\"\n when :data\n \"(CASE WHEN (content_types.mime_type_id NOT IN (SELECT id FROM mime_types WHERE code LIKE 'text/%')) THEN '' ELSE convert_from(contents.data, 'UTF8') END)\" \n when :size\n field_is_int = true\n 'length(contents.data)'\n when :content_key_uuid\n 'content_keys.uuid'\n when :creator\n 'creator_users.login'\n when :updater\n 'updater_users.login'\n else \n case column.to_s\n when /\\A(.+)_id\\Z/\n field_is_int = true\n \"#{$1.pluralize}.id\"\n else\n \"#{column.to_s.pluralize}.code\"\n end\n end\n \n # Coerce value.\n case value\n when Symbol\n value = value.to_s\n when Regexp\n value = value.inspect\n when String\n value = value\n when ActiveRecord::Base\n value = value.id\n field = \"#{column.to_s.pluralize}.id\"\n end\n\n # $stderr.puts \"#{column} = #{value.inspect}\"\n clauses << _match(column, field, value, field_is_int, opts)\n end\n end\n\n unless clauses.empty?\n sql << \"(\\n #{clauses * (opts[:or] ? \"\\nOR \" : \"\\nAND \")}\\n )\"\n end\n\n # Subquery clauses:\n if @subquery && ! (where = @subquery.sql_where_clauses).empty?\n sql << \"\\nAND \" unless sql.empty?\n sql << where\n end\n\n sql\n end",
"def add_conditions!(sql, conditions)\n sql << \"WHERE #{sanitize_conditions(conditions)} \" unless conditions.nil?\n sql << (conditions.nil? ? \"WHERE \" : \" AND \") + type_condition unless descends_from_active_record?\n end",
"def keyword_conditions\n unless keyword.blank?\n searchable_columns = %w(title description justification project_number) # add any freetext-searchable fields here\n keyword.strip!\n search_str = searchable_columns.map { |x| \"#{x} LIKE :keyword\"}.to_sentence(:words_connector => \" OR \", :last_word_connector => \" OR \")\n CapitalProject.where(search_str, :keyword => \"%#{keyword}%\")\n end\n end",
"def conditions_clause\n cc = conditions.dup\n cc << filter_clause\n cc.compact.map{|c| @resource.send(:sanitize_sql_for_conditions, c)} * ' AND '\n end",
"def to_find_include\n @condition_blocks.inject({}) do |inc, cb|\n if cb.reflection.nil?\n inc.merge_tree(cb.to_find_include)\n else\n inc[cb.reflection] ||= {}\n inc[cb.reflection] = inc[cb.reflection].merge_tree(cb.to_find_include)\n inc\n end\n end\n end",
"def build\n criteria_fields.inject({}) do |criteria_hash, field|\n value = field_value field \n set_criteria(criteria_hash, field, value) unless skip?(field, value)\n criteria_hash\n end\n end",
"def conditions\n return @conditions\n end",
"def conditions\n return @conditions\n end",
"def my_rents_office\n sc = SearchCondition.new(:user_id => session[:user_id],\n :city => \"Москва\", #todo: add code to process several cities in SearchCondition\n :realty_types => [\"office\",\"trading_floor\",\"warehouse\",\"catering\",\"free_app\",\"garage\",\"manufacture\",\"legal_address\",\"autoservice\",\"selling_business\"]\n )\n @entries = Entry.find_with_search_condition(sc)\n \n end",
"def get_conditions\n @conditions\n end"
] | [
"0.7750529",
"0.73080724",
"0.6943984",
"0.6943984",
"0.69348395",
"0.6831513",
"0.68062663",
"0.68055755",
"0.67975813",
"0.6724154",
"0.6724154",
"0.6719735",
"0.66896504",
"0.6653267",
"0.6626202",
"0.66193515",
"0.65248454",
"0.65248454",
"0.6521814",
"0.6506107",
"0.6462601",
"0.6415178",
"0.6414779",
"0.64022934",
"0.6384931",
"0.6375754",
"0.6356737",
"0.63302",
"0.62924457",
"0.62701625",
"0.62636745",
"0.6241526",
"0.62366354",
"0.6236021",
"0.6231473",
"0.6220282",
"0.6202018",
"0.6185281",
"0.6181815",
"0.61603016",
"0.61603016",
"0.6160266",
"0.6153",
"0.61477095",
"0.6137153",
"0.61096674",
"0.61037105",
"0.6100309",
"0.60936695",
"0.6082033",
"0.6071701",
"0.60657895",
"0.6063361",
"0.60627896",
"0.60627896",
"0.60553265",
"0.6047395",
"0.6039334",
"0.603673",
"0.6033842",
"0.6033842",
"0.602758",
"0.6026311",
"0.60190886",
"0.6016613",
"0.60044366",
"0.6002355",
"0.5965413",
"0.594692",
"0.5934983",
"0.5931995",
"0.5924449",
"0.59130335",
"0.5910538",
"0.5899982",
"0.5895792",
"0.58924603",
"0.58894354",
"0.5885067",
"0.58834285",
"0.5866235",
"0.5860539",
"0.58500105",
"0.58492804",
"0.58473116",
"0.5837692",
"0.5831785",
"0.5817795",
"0.58171",
"0.5812178",
"0.5811129",
"0.5807759",
"0.58003306",
"0.5797633",
"0.57961845",
"0.57903427",
"0.57897836",
"0.577302",
"0.577302",
"0.57638955",
"0.57580614"
] | 0.0 | -1 |
Calls the normal AR Find. | def list_all(name, options)
records = find(:all, :limit => options[:limit], :offset => options[:offset])
if options[:skip_count]
record_count = records.size
else
record_count = count
end
return records, record_count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(*args)\n ids = args.__find_args__\n raise_invalid if ids.any?(&:nil?)\n for_ids(ids).execute_or_raise(ids, args.multi_arged?)\n end",
"def find(*args)\n records = super\n @after.call(records) if @after\n records\n end",
"def find\n fail NotImplementedError\n end",
"def find; end",
"def find(*args)\n find_all(*args).first\n end",
"def find(id)\n finder_or_run(:find, id)\n end",
"def find(*args)\n return super if block_given?\n find_with_ids(*args)\n end",
"def find\n raise \"Method not implemented\"\n end",
"def find(query); end",
"def find(query); end",
"def find_all\n finder_or_run(:find_all)\n end",
"def execute *args\n if args.first == :query\n self\n else\n opts = args.last.is_a?(Hash) ? args.last : {}\n results = []\n\n pagination = opts.delete(:paginate) || {}\n model.send(:with_scope, :find => opts) do\n @conditions.paginate(pagination) unless pagination.empty?\n results = model.find args[0], to_find_parameters\n if @conditions.paginate?\n paginate_result_set results, to_find_parameters\n end\n end\n results\n end\n end",
"def find\n super.first\n end",
"def method_missing(method, *args)\n if method =~ /find/\n finder = method.to_s.split('_by_').first\n attributes = method.to_s.split('_by_').last.split('_and_')\n\n chain = Dynamoid::Criteria::Chain.new(self)\n chain.query = Hash.new.tap {|h| attributes.each_with_index {|attr, index| h[attr.to_sym] = args[index]}}\n \n if finder =~ /all/\n return chain.all\n else\n return chain.first\n end\n else\n super\n end\n end",
"def find(object, parent = @base)\n raise NotImplementedError, \"Subclasses must implement public method find\"\n end",
"def execute_find(raw = false)\n get_records\n cached = AridCache::CacheProxy::Result.new\n\n if !records.is_a?(Enumerable) || (!records.empty? && !records.first.is_a?(::ActiveRecord::Base))\n cached = records # some base type, cache it as itself\n else\n cached.ids = records.collect(&:id)\n cached.count = records.size\n if records.respond_to?(:proxy_reflection) # association proxy\n cached.klass = records.proxy_reflection.klass\n elsif !records.empty?\n cached.klass = records.first.class\n else\n cached.klass = object_base_class\n end\n end\n Rails.cache.write(cache_key, cached, opts_for_cache)\n self.cached = cached\n\n # Return the raw result?\n return self.cached if raw\n\n # An order has been specified. We have to go to the database\n # to order because we can't be sure that the current order is the same as the cache.\n if cached.is_a?(AridCache::CacheProxy::Result) && combined_options.include?(:order)\n self.klass = self.cached.klass # TODO used by fetch_from_cache needs refactor\n fetch_from_cache\n else\n process_result_in_memory(records)\n end\n end",
"def find_on_extension(*args)\n if extended?\n define_extended_class\n finder_type, options = args.first, args.extract_options!\n options = prepare_extended_options(options, finder_type)\n sql = construct_finder_sql(options)\n sql = replace_tables_text(sql)\n result = find_by_sql(sql)\n preload_associations(result, options[:include]) if options[:include]\n [:first,:last].include?(finder_type) ? result.first : result\n else\n find(*args)\n end\n end",
"def find(*args)\n select(*args)\n\n=begin\n\n options = args.last.is_a?(Hash) ? args.pop : {}\n case args.first\n when :all then find_every options\n when :first then find_initial options\n else find_from_ids args, options\n end\n\n=end\n\n end",
"def find_by()\n\n end",
"def find(id)\n\nend",
"def find item\n\tend",
"def find(id); end",
"def find(id); end",
"def find(args, mode); end",
"def find_model_find target\n finder = Brakeman::FindModelCall.new target\n\n self.each_method do |definition, set_name, method_name|\n finder.process_source definition, set_name, method_name\n end\n\n self.each_template do |name, template|\n finder.process_source template[:src], nil, nil, template\n end\n\n finder.matches\n end",
"def find(id)\n find_result\n end",
"def find(*args)\n raise Automodel::FindOnCompoundPrimaryKeyError if table[:composite_primary_key]\n super\n end",
"def find(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n warn \"The Wakoopa API doesn\\'t support finding single rows. \\n Please use \\\".all()\\\" or \\\"s.find(:all)\\\" instead of \\\".find()\\\".\" unless args.first == :all\n find_every(options)\n end",
"def find\n\t\tif defined?(@collection)\n\t\t\treturn @collection.find\n \tend\n\tend",
"def find(method, args = {})\n # make calls to the right method based on the method and the arguments\n self.client.call(operations[method], args)\n end",
"def find(*args, &block)\n if args.first.is_a?(Hash)\n super(*args, &block)\n else\n super(id: args)\n end\n end",
"def execute\n klass.collection.find(selector, process_options) || []\n end",
"def find opt = nil, opts = { }\n opt ||= :all\n \n opts[:limit] = 1 if opt == :first\n\n # self.sql sets self.model_class.\n this_sql = self.sql(opts)\n result = model_class.find_by_sql(this_sql)\n\n result = result.first if opt == :first\n\n result\n end",
"def method_missing(method_name, *args)\n\n method = method_name.to_s\n\n if method.end_with? '!'\n method.chop!\n error_on_empty = true\n end\n\n if method.start_with? 'find_all_by_'\n attribs = method.gsub /^find_all_by_/, ''\n elsif method.start_with? 'find_by_'\n attribs = method.gsub /^find_by_/, ''\n limit(1)\n elsif method.start_with? 'find_first_by_'\n limit(1)\n find_first = true\n attribs = method.gsub /^find_first_by_/, ''\n elsif method.start_with? 'find_last_by_'\n limit(1)\n find_last = true\n attribs = method.gsub /^find_last_by_/, ''\n else\n super\n end\n\n attribs = attribs.split '_and_'\n conditions = {}\n attribs.each { |attr| conditions[attr] = args.shift }\n\n where(conditions, *args)\n load\n raise RecordNotFound if error_on_empty && @records.empty?\n return @records.first if limit_value == 1\n @records\n end",
"def simple_find(*args, &blk)\n find(:__no_pretty_finder__, nil, *args, &blk)\n end",
"def find(options={})\n query(options)\n end",
"def find(*arguments)\r\n scope = arguments.slice!(0)\r\n options = arguments.slice!(0) || {}\r\n \r\n case scope\r\n when :all then find_every(options)\r\n when :first then find_every(options).first\r\n else find_single(scope, options)\r\n end\r\n end",
"def find(id)\n fetch([name, id]) do\n super\n end\n end",
"def find!\n @total_found = 0\n @results = nil\n return results\n end",
"def find id, params = {}, &block\n rel = relation params, &block\n rel.where!(config.document_unique_id_param => id) \n rel.load\n rel\n end",
"def find(*arguments)\n scope = arguments.slice!(0)\n options = arguments.slice!(0) || {}\n\n case scope\n when :all then find_every(options)\n when :first then find_every(options).first\n else find_single(scope, options)\n end\n end",
"def find( model, name )\n model( model )[name ] rescue nil\n end",
"def find_record_with_callbacks\n run_callbacks(:before_find)\n result = find_record_without_callbacks\n run_callbacks(:after_find) if result\n result\n end",
"def find method=:all, options={}\r\n if method.is_a? Hash\r\n options = method\r\n method= :all\r\n end\r\n if @scope\r\n model_class.send(:with_scope, @scope) {model_class.find method, find_options(options)}\r\n else\r\n model_class.find method, find_options(options)\r\n end\r\n end",
"def method_missing(method, *args, &block)\n if name?(method.to_sym)\n find(method.to_sym)\n else\n super\n end\n end",
"def find(*args)\n Collection.new(super, @mapped_collection)\n end",
"def method_for_find\n resources_configuration[:self][:finder] || :find\n end",
"def find(id)\n raise NotImplementedError\n end",
"def find(*args)\n list = []\n if args.first == :all\n result = Rhom::RhomDbAdapter::select_from_table(Rhom::TABLE_NAME,\n '*',\n {\"source_id\"=>get_source_id,\"update_type\"=>'query'},\n {\"order by\"=>'object'})\n else\n obj = strip_braces(args.first.to_s)\n result = Rhom::RhomDbAdapter::select_from_table(Rhom::TABLE_NAME,\n '*',\n {\"object\"=>obj})\n end\n list = get_list(result)\n if list.length == 1\n return list[0]\n end\n list\n end",
"def find\n model_class.filterrific_find(self)\n end",
"def find(dn = self.dn, options = {})\n # Some misguided attempts to emulate active record.\n case dn\n when :all then search({:limit => false}.merge(options))\n when :first then first(options)\n when Array then dn.map {|d| fetch(d, options)}\n else fetch(dn, options)\n end\n end",
"def find_record_by(model)\n raise_must_override\n end",
"def method_missing(method, *args)\n begin\n if method != :find_by_symbol\n if obj = find_by_symbol(method)\n redefine_method method do\n find_by_symbol(method)\n end\n return obj\n end\n end\n rescue\n # Ignore errors, and call super\n end\n super\n end",
"def find_relations\n puts '2nd pass: find relations'\n find :relations\n self\n end",
"def method_missing(name, *args)\n dyna = DynamicFinder.new(name, *args)\n finder, conditions = dyna.finder, dyna.conditions\n results = find(finder, :conditions => conditions)\n results ? results : dyna.create(self)\n end",
"def find(name); end",
"def method_for_find\n :find_by_slug!\n end",
"def real(options={})\n @real ||= self.type.constantize.find(self.id, options)\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 find(options = {})\n if(options.class == Integer)\n model = self.new(quickbook_gateway.get(\"#{entity.downcase}/#{options}\")[entity]) \n model.is_new_record = false\n return model\n end\n \n return self.find_all(options, 1)[0]\n end",
"def find\n\t\tif !defined?(@collection)\n\t\t\treturn false\n\t\telse\n\t\t\treturn @collection.find\n\t\tend\n end",
"def find_by(**args)\n where(**args).first\n end",
"def where(*args)\n #self.class.new(layout, layout.find(*args), args)\n get_results(:find, args)\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = FindResultSet.new(resp)\n return results\n end",
"def find(options = {})\n tmp = nil\n @member_class.with_scope(options) do\n tmp = @owner.send(@find_proc, @find_options)\n end\n return tmp\n end",
"def find(conditions)\n self.request.new(self.seed, conditions)\n end",
"def find_obj\n @obj = eval(resource_name).find_by(id: params[:id])\n end",
"def find id\n model.find id\n end",
"def find_record(xero_id)\n raise_must_override\n end",
"def find(command, options = {}, &block)\n case command\n when Fixnum\n record(command)\n when Array\n command.map {|i| record(i)}\n when :all\n find_all(options, &block)\n when :first\n find_first(options)\n end\n end",
"def finder(criteria)\n @finder = criteria\n end",
"def find(*arguments)\n scope = arguments.slice!(0)\n options = arguments.slice!(0) || {}\n\n case scope\n when :all then find_every(options)\n when :first then find_every(options).first\n when :last then find_every(options).last\n else find_single(scope)\n end\n end",
"def execute\n @model_class.search(KEYWORD)\n end",
"def find(conditions)\n @root.find(conditions)\n end",
"def find(sess, what, *args) #:nodoc:\r\n get(sess, *args)\r\n end",
"def find(name, container = nil, findall = false)\n if container.nil?\n if findall\n @game_objects.find_all('@generic', name)\n else\n @game_objects.find(name)\n end\n elsif container.is_a? HasInventory\n container.search_inv(name)\n elsif not container.is_a? GameObject\n container = @game_objects.find(container)\n if container.nil?\n return nil\n else\n return find(name, container)\n end\n end\n end",
"def method_missing(m,*args)\n #find_by_name(\"John\") returns first YamlContentBase object that matches\n if m.to_s.index(\"find_by\") == 0\n attribute = m.to_s.gsub(\"find_by_\",\"\")\n return self.detect{|x| x.send(attribute) == args[0]}\n #find_all_by_name(\"John\") returns array of YamlContentBase objects that match\n elsif m.to_s.index(\"find_all_by\") == 0\n attribute = m.to_s.gsub(\"find_all_by_\",\"\")\n return self.select{|x| x.send(attribute) == args[0]}\n end\n raise \"'#{m}' is not a method\"\n end",
"def after_find\n end",
"def find_each(options = {})\n rows = retrieve_records(options) #private method\n\n rows.each do |row|\n init_object_from_row(row)\n end\n end",
"def method_missing msg, *args, &block\n model = begin;\n Object.const_get msg\n rescue NameError\n end\n \n if model and model.respond_to?(:descends_from_active_record?) and model.descends_from_active_record?\n model.find args.first\n else\n super\n end\nend",
"def find options={}, match_id:\n DynamicModel.new perform_request api_url \"matches/#{match_id}\", options\n end",
"def find_by_sql(sql)\n raise \"not implemented\"\n end",
"def db_find(query=nil)\n return $posts.find(query)\nend",
"def find(value)\n end",
"def find(input)\n end",
"def find( options = {} )\n table = store.table( options.delete(:_table) )\n if GreyscaleRecord.live_reload\n load_table!( table.name )\n end\n\n # TODO: this is where all the meat is\n table.find options\n end",
"def find_with_ferret(q, options = {}, find_options = {})\n if respond_to?(:scope) && scope(:find, :conditions)\n if find_options[:conditions]\n find_options[:conditions] = \"(#{find_options[:conditions]}) AND (#{scope(:find, :conditions)})\"\n else\n find_options[:conditions] = scope(:find, :conditions)\n end\n end\n return ActsAsFerret::find q, self, options, find_options\n end",
"def find( id )\n model.get( id ).extend( InstanceMethods )\n end",
"def find_by_name!(*args)\n proxy = find_by_name(*args)\n raise NotFound, \"#{name} not found in #{all.map(&:name).join(\", \")}\" unless proxy\n\n proxy\n end",
"def prepare_find\n raise Error.new('Cannot find an event without an ID') if id.blank?\n self\n end",
"def find_object(name); end",
"def find(*args, **options, &optional_filter_block)\n LOG.info(\"Capybara find #{args.join(' ')}\")\n super\n end",
"def find(*paths, &block)\n ZK::Find.find(self, *paths, &block)\n end",
"def search params = {}, &block\n rel = relation params, &block\n rel.load\n rel\n end",
"def find_records(predicate)\n raise_must_override\n end",
"def find(*args)\n #self.class.new(layout, data, (queries.dup << args))\n wrap_data(data, (queries.dup << args))\n end",
"def find_by!(values)\n find_by(values) || fail(RecordNotFound.new(\"#{self.query_as(:n).where(n: values).limit(1).to_cypher} returned no results\", name))\n end",
"def _find_record(options)\n if options && options[:lock]\n self.class.preload(strict_loaded_associations).lock(options[:lock]).find_by!(hid: hid)\n else\n self.class.preload(strict_loaded_associations).find_by!(hid: hid)\n end\n end",
"def find_one\n return super if params[klass.primary_key].present?\n @find_one ||= klass.new_collection_from_result(limit(1).fetch).first\n rescue ::Spyke::ConnectionError => error\n fallback_or_reraise(error, default: nil)\n end",
"def find(criteria, options = {})\n criteria = normalize_criteria criteria\n self.collection.find(criteria, options).map do |hash|\n self.normalize hash\n end\n end",
"def find(any_verb_form)\n end"
] | [
"0.68188155",
"0.6641349",
"0.654066",
"0.65130997",
"0.6494829",
"0.64695895",
"0.64359516",
"0.6426932",
"0.6382272",
"0.6382272",
"0.63601744",
"0.626543",
"0.6230573",
"0.6226791",
"0.61963767",
"0.6192396",
"0.6178923",
"0.61661744",
"0.6158785",
"0.61300707",
"0.6088858",
"0.6070258",
"0.6070258",
"0.6064556",
"0.6063847",
"0.60578865",
"0.6051419",
"0.5975106",
"0.5968463",
"0.59575415",
"0.5948497",
"0.5943709",
"0.5938146",
"0.5932589",
"0.59219277",
"0.5914509",
"0.5892422",
"0.5891115",
"0.5890345",
"0.58717275",
"0.5868002",
"0.5860742",
"0.5858901",
"0.5855561",
"0.58416873",
"0.58384615",
"0.5816085",
"0.58159566",
"0.5799743",
"0.57988656",
"0.57812345",
"0.5776464",
"0.57684535",
"0.5766516",
"0.5762656",
"0.57556164",
"0.575074",
"0.5747577",
"0.5714743",
"0.57028455",
"0.56951714",
"0.56886035",
"0.5686419",
"0.567554",
"0.5675431",
"0.5658952",
"0.5653552",
"0.5652975",
"0.5638423",
"0.56365865",
"0.56365466",
"0.5619982",
"0.5619245",
"0.56121516",
"0.5597174",
"0.55925214",
"0.5590595",
"0.5581895",
"0.5580277",
"0.5578115",
"0.5572604",
"0.5570954",
"0.55592537",
"0.5558906",
"0.5552777",
"0.55490893",
"0.55412453",
"0.5538727",
"0.5514441",
"0.5510871",
"0.55069005",
"0.550087",
"0.54954594",
"0.5494779",
"0.5479658",
"0.54782665",
"0.5468269",
"0.54638463",
"0.5461657",
"0.5458404",
"0.5458234"
] | 0.0 | -1 |
Throws InvalidListOptions if options were passed that shouldn't have been. | def sanitize_options(options)
options.keys.each do |key|
unless Facade.options[:valid_find_options].include?(key) || Facade.options[:valid_list_options].include?(key)
raise InvalidListOptions, "Bad key passed: #{key}"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_arguments!(list)\n chk_idx = list.find_index do |item|\n item.start_with?(\"-\")\n end\n if chk_idx\n marker = list.find_index do |item|\n item == \"--\"\n end\n if marker.nil? || chk_idx.to_i < marker\n raise ArgumentError.new \"Unknown CLI option provided `#{list[chk_idx]}`\"\n end\n end\n list\n end",
"def validate_options(options)\n options.assert_valid_keys(:visibility, :null, :enum, :limit, :json)\n\n case options[:visibility]\n when nil then nil\n when :public then nil\n when :private then nil\n else raise ArgumentError, \"Invalid value for :visibility: #{options[:visibility].inspect}\"\n end\n\n case options[:json]\n when nil, String, Symbol then nil\n else raise ArgumentError, \"Invalid value for :json: #{options[:json].inspect}\"\n end\n\n unless [ nil, true, false ].include?(options[:null])\n raise ArgumentError, \"Invalid value for :null: #{options[:null].inspect}\"\n end\n end",
"def check_options(options, *supported)\n unsupported = options.to_hash.keys - supported.flatten\n raise ArgumentError, \"No such option: #{unsupported.join(' ')}\" unless unsupported.empty?\n end",
"def valid_options\n []\n end",
"def validate_options(options)\n return super unless backend\n super(options.slice(*(options.keys - backend.valid_keys)))\n\n # Validate that the default backend from config has valid keys, or if\n # it is overridden by an array input that the array has valid keys.\n if options[:backend].is_a?(Array)\n name, backend_options = options[:backend]\n extra_keys = backend_options.keys - backend.valid_keys\n raise InvalidOptionKey, \"These are not valid #{name} backend keys: #{extra_keys.join(', ')}.\" unless extra_keys.empty?\n end\n end",
"def unrecognized_option(err); end",
"def valid_options!\n @options.keys.uniq.each do |key|\n raise WhmArgumentError.new(\"Not a valid parameter: #{key}\") unless @optional_params.include?(key)\n end\n end",
"def valid_argument_list!(rest, *types)\n if rest.size == types.size\n result = rest.zip(types).collect do |arg, type|\n if String == type\n arg.to_s\n elsif Symbol == type\n arg.to_sym\n elsif Integer\n arg.to_i\n else\n raise OptionParser::InvalidArgument, arg\n end\n end\n result.size == 1 ? result[0] : result\n elsif rest.size < types.size\n raise OptionParser::MissingArgument\n else\n raise OptionParser::NeedlessArgument, rest\n end\n end",
"def allowed_options\n []\nend",
"def allowed_options\n []\nend",
"def allowed_options\n []\nend",
"def allowed_options\n []\nend",
"def allowed_options\n []\nend",
"def allowed_options\n []\nend",
"def allowed_options\n []\nend",
"def allowed_options\n []\nend",
"def allowed_options\n []\nend",
"def allowed_options\n []\nend",
"def allowed_options\n []\nend",
"def options\n validate_or_get_results :options\n end",
"def validate_options(api, options = {})\n options = options.symbolize_keys\n version_args = ARGS[@version.to_sym]\n \n if !version_args\n raise ArgumentError.new(\"Invalid version API call: #{@version}, #{api}\")\n elsif version_args.has_key?(api) && !Set.new(options.keys).subset?(version_args[api])\n raise ArgumentError.new(\"Valid options for #{api} are: #{version_args[api].to_a.join(', ')}, provided: #{options.keys.join(', ')}\")\n end\n end",
"def validate_options!(options)\n return if options[:help] || options[:version]\n validate_date(options)\n raise MissingArgument, \"--repository or --config\" unless\n options[:repository] || options[:config]\n end",
"def invalid_option\n\t\t\t\talert_menu \"Invalid option!\"\n\t\t\tend",
"def validate_options!(_options)\n raise(NotImplemetedError, \"subclass responsability\")\n end",
"def validate_client_options(options)\n # Users can no longer provide their own clients due to rewrite of auth\n # in https://github.com/google/google-api-ruby-client/ version 0.9.\n if options[:google_client]\n raise ArgumentError.new(\"Deprecated argument no longer works: google_client\")\n end\n\n # They can also no longer use pkcs12 files, because Google's new auth\n # library doesn't support them either.\n if options[:google_key_location]\n raise ArgumentError.new(\"Deprecated auth method no longer works: google_key_location\")\n end\n if options[:google_key_string]\n raise ArgumentError.new(\"Deprecated auth method no longer works: google_key_string\")\n end\n\n # Google client email option is no longer needed\n if options[:google_client_email]\n Fog::Logger.deprecation(\"Argument no longer needed for auth: google_client_email\")\n end\n\n # Validate required arguments\n unless options[:google_api_scope_url]\n raise ArgumentError.new(\"Missing required arguments: google_api_scope_url\")\n end\n end",
"def validate(_options = 0)\n []\n end",
"def validate_options!(options)\n if options[:chef_api] == :config\n return true\n end\n\n missing_options = [:node_name, :client_key] - options.keys\n\n unless missing_options.empty?\n missing_options.collect! { |opt| \"'#{opt}'\" }\n msg = \"Source '#{name}' is a 'chef_api' location with a URL for it's value\"\n msg << \" but is missing options: #{missing_options.join(', ')}.\"\n\n raise Berkshelf::InvalidChefAPILocation, msg\n end\n\n self.class.validate_node_name!(options[:node_name])\n self.class.validate_client_key!(options[:client_key])\n self.class.validate_uri!(options[:chef_api])\n end",
"def validate_options\n true\n end",
"def validate_options; end",
"def validate_options(options, *known_options)\n\toptions ||= Hash.new\n\topt, unknown = Kernel.filter_options(options.to_hash, *known_options)\n\tunless unknown.empty?\n\t not_valid = unknown.keys.map { |m| \"'#{m}'\" }.join(\" \")\n\t raise ArgumentError, \"unknown options #{not_valid}\", caller(1)\n\tend\n\n\topt\n end",
"def required_options\n []\n end",
"def make_option_list\n end",
"def make_option_list\n end",
"def validate_options\n required_keys = %w(endpoint user password\n container_name agent ntp blobstore)\n missing_keys = []\n required_keys.each do |key|\n unless @options.has_key?(key)\n missing_keys << key\n end\n end\n message = \"Missing configuration parameters: #{missing_keys}\"\n raise ArgumentError, message unless missing_keys.empty?\n end",
"def validate_options(opts, valid_options = VALID_FIELDS)\n super(opts,valid_options)\n end",
"def validate_options(opts, valid_options = VALID_FIELDS)\n super(opts,valid_options)\n end",
"def try_options\n\t\t\treturn unless request.http_method == :OPTIONS\n\n\t\t\tallow = available_endpoint&.allow\n\t\t\thalt 404 unless allow\n\t\t\tresponse.headers['Allow'] = allow\n\t\tend",
"def update!(**args)\n @list_options = args[:list_options] if args.key?(:list_options)\n end",
"def required_options\n []\n end",
"def list_filter_options(**opt)\n # May be overridden by the subclass.\n end",
"def validate_options(options = {})\n error_messages = []\n\n options.fetch(:ignore_selectors, []).each do | s |\n if s[:pacticipant_name].nil?\n error_messages << \"Please specify the pacticipant name to ignore\"\n else\n if s.key?(:pacticipant_version_number) && s.key?(:latest)\n error_messages << \"A version number and latest flag cannot both be specified for #{s[:pacticipant_name]} to ignore\"\n end\n end\n end\n\n destination_identifiers = [options[:tag], options[:environment_name], options[:main_branch]&.to_s].compact\n\n if destination_identifiers.size > 1\n error_messages << message(\"errors.validation.cannot_specify_more_than_one_destination_identifier\")\n end\n\n if options[:latest] && options[:environment_name]&.not_blank?\n error_messages << message(\"errors.validation.cannot_specify_latest_and_environment\")\n end\n\n if options[:environment_name]&.not_blank? && environment_service.find_by_name(options[:environment_name]).nil?\n error_messages << message(\"errors.validation.environment_with_name_not_found\", name: options[:environment_name])\n end\n\n if options[:limit] && options[:limit].to_i < 1\n error_messages << message(\"errors.validation.invalid_limit\")\n end\n\n error_messages\n end",
"def options(opt)\n []\n end",
"def update(options = {})\n self.merge!(Vermonster::Client.connection.put(\"lists/#{self[\"id\"]}\", \"{\\\"list\\\": #{options.to_json}}\").body)\n end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def missing_option; end",
"def select_valid_options(operation_name, options)\n operation = ::Vips::Operation.new(operation_name)\n introspect = ::Vips::Introspect.get(operation_name)\n operation_options = introspect.required_input.map{ |arg| arg[:arg_name] }.map(&:to_sym)\n\n options.select { |name, value| operation_options.include?(name) }\n end",
"def validate(options); end",
"def check_unknown_options!(options = {})\n @check_unknown_options ||= {}\n options.each do |key, value|\n if value\n @check_unknown_options[key] = Array(value)\n else\n @check_unknown_options.delete(key)\n end\n end\n @check_unknown_options\n end",
"def listOptions\n\n if @assessment.has_partners then\n partnersListOptions()\n end\n \n if @assessment.has_svn then\n svnListOptions()\n end\n \n if @assessment.has_scoreboard then\n scoreboardListOptions()\n end\n end",
"def validate_options(options, attrs)\n matched_attrs = options.keys & attrs\n if matched_attrs.to_set != attrs.to_set\n raise HelpScoutDocs::Error::OptionsError.new(\"#{(attrs - matched_attrs).join(\", \")} required options are missing\")\n end\n end",
"def validate_options!(options)\n unless @config.environments.include?(options[:environment].downcase.to_sym)\n say \"Invalid environment. Run `#{$0} environments` for a list of available environments.\", :red\n abort\n end\n\n unless @config.browsers.include?(options[:browser].downcase.to_sym)\n say \"Invalid browser. Run `#{$0} browsers` for a list of available browsers.\", :red\n abort\n end\n end",
"def valid_options\n self::OPTIONS.map(&:to_s).join(', ')\n end",
"def whitelist\n options.fetch(:except) { [] }\n end",
"def list_filter_options(**opt)\n # TODO: ???\n end",
"def options(opt); end",
"def options(opt); end",
"def valid_options\n %i(\n\n ) # end array\n end",
"def option_req(option_name)\n throw :notimpl\n end",
"def verify_options_hook; end",
"def options(opt)\n end",
"def list_options(lookup = nil)\n field = field(lookup)\n field.dig(:list_options) if field\n end",
"def validate_public_options(options)\n options.each do |k, _v|\n case k\n when :controller_info,\n /enabled_for_/,\n :enabled,\n :whodunnit\n next\n else\n raise InvalidOption, \"Invalid option: #{k}\"\n end\n end\n end",
"def check_required_options(option_set_name, options = {})\n required_options = REQUIRED_OPTIONS[option_set_name]\n missing = []\n required_options.each{|option| missing << option if options[option].nil?}\n \n unless missing.empty?\n raise MissingInformationError.new(\"Missing #{missing.collect{|m| \":#{m}\"}.join(', ')}\")\n end\n end",
"def test_add_option04g\n assert_raise ( RuntimeError ) {\n ArgumentManager.add_option(\n [ 'y' ],\n :type => :string,\n :domain => ['foo', 'foo']\n )\n }\n end",
"def validate_booking_options!(options)\n unpermitted_params = []\n required_params = {}\n\n #\n # Set unpermitted parameters and required parameters depending on Bookable options\n #\n\n # Switch :time_type\n case self.booking_opts[:time_type]\n # when :range, we need :time_start and :time_end\n when :range\n required_params[:time_start] = [Time,Date]\n required_params[:time_end] = [Time,Date]\n unpermitted_params << :time\n when :fixed\n required_params[:time] = [Time,Date]\n unpermitted_params << :time_start\n unpermitted_params << :time_end\n when :none\n unpermitted_params << :time_start\n unpermitted_params << :time_end\n unpermitted_params << :time\n end\n\n # Switch :capacity_type\n case self.booking_opts[:capacity_type]\n when :closed\n required_params[:amount] = [Integer]\n when :open\n required_params[:amount] = [Integer]\n when :none\n unpermitted_params << :amount\n end\n\n #\n # Actual validation\n #\n unpermitted_params = unpermitted_params\n .select{ |p| options.has_key?(p) }\n .map{ |p| \"'#{p}'\"}\n wrong_types = required_params\n .select{ |k,v| options.has_key?(k) && (v.select{|type| options[k].is_a?(type)}.length == 0) }\n .map{ |k,v| \"'#{k}' must be a '#{v.join(' or ')}' but '#{options[k].class.to_s}' found\" }\n required_params = required_params\n .select{ |k,v| !options.has_key?(k) }\n .map{ |k,v| \"'#{k}'\" }\n\n #\n # Raise OptionsInvalid if some invalid parameters were found\n #\n if unpermitted_params.length + required_params.length + wrong_types.length > 0\n message = \"\"\n message << \" unpermitted parameters: #{unpermitted_params.join(',')}.\" if (unpermitted_params.length > 0)\n message << \" missing parameters: #{required_params.join(',')}.\" if (required_params.length > 0)\n message << \" parameters type mismatch: #{wrong_types.join(',')}\" if (wrong_types.length > 0)\n raise ActiveBookings::OptionsInvalid.new(self, message)\n end\n\n #\n # Convert options (Date to Time)\n #\n options[:time_start] = options[:time_start].to_time if options[:time_start].present?\n options[:time_end] = options[:time_end].to_time if options[:time_end].present?\n options[:time] = options[:time].to_time if options[:time].present?\n\n # Return true if everything's ok\n true\n end",
"def handle_failed_option param, value\n @options_ok = false\n end",
"def check_for_illegal_keys!(options)\n if any_unrecognized_keys?(ALLOWED_KEYS, options)\n raise \"Unrecognized options in add_method_tracer_call: #{unrecognized_keys(ALLOWED_KEYS, options).join(', ')}\"\n end\n end",
"def process_options\n options.delete_if { |x,y| y.nil? }\n if options.empty?\n puts @optparse \n exit 0\n end\n options.each do |x,y|\n begin\n if y.to_s.match('^-')\n raise BoilerMakerErr.new(\"Bad args: \\\"#{y}\\\" is not a valid arg to option, \\\"--#{x}\\\". Use the -h flag for syntax help.\")\n end\n rescue => error\n puts error.message + \"\\n\"\n exit 1\n end\n end\n end",
"def options_valid?\n missing = MANDATORY_OPTIONS.select { |arg| @options[arg].nil? }\n missing.empty?\n end",
"def allow_empty_options\n true\n end",
"def checkOptions\n if request.options?\n render nothing: true and return\n end\n end",
"def initialize(options = {})\n (options.keys - DEFAULTS.keys - EXTRA_OPTIONS)[0..1].each do |missing|\n raise ArgumentError, \"Invalid option: #{missing}\"\n end\n @options = options\n end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def validate_options(options)\n unless options.kind_of?(Hash)\n raise ArgumentError, \"You must pass a Hash, not: #{options.inspect}\"\n end\n\n options.assert_valid_keys(:visibility, :prefix, :delegate, :unknown_fields, :compress, :header)\n\n unless [ nil, :private, :public ].include?(options[:visibility])\n raise ArgumentError, \"Invalid value for :visibility: #{options[:visibility.inspect]}\"\n end\n\n unless [ :delete, :preserve, nil ].include?(options[:unknown_fields])\n raise ArgumentError, \"Invalid value for :unknown_fields: #{options[:unknown_fields].inspect}\"\n end\n\n unless [ true, false, nil ].include?(options[:compress]) || options[:compress].kind_of?(Integer)\n raise ArgumentError, \"Invalid value for :compress: #{options[:compress].inspect}\"\n end\n\n unless [ true, false, nil ].include?(options[:header])\n raise ArgumentError, \"Invalid value for :header: #{options[:header].inspect}\"\n end\n\n case options[:prefix]\n when nil then nil\n when String, Symbol then nil\n else raise ArgumentError, \"Invalid value for :prefix: #{options[:prefix].inspect}\"\n end\n\n unless [ nil, true, false, :private, :public ].include?(options[:delegate])\n raise ArgumentError, \"Invalid value for :delegate: #{options[:delegate].inspect}\"\n end\n\n if options[:visibility] == :private && options[:delegate] == :public\n raise ArgumentError, \"You can't have public delegation if methods in the flex column are private; this makes no sense, as methods in the model class would have *greater* visibility than methods on the flex column itself\"\n end\n end",
"def validate_options(opts)\n unless opts.branch_regex || opts.tag_regex\n # If git branches/tags are given, the source path might exist in the branch/tag, thus only check this\n # for non-git executions\n raise OptionParser::InvalidArgument, \"Could not find source path #{opts.srcdir}\" unless opts.srcdir.exist?\n end\n\n if opts.web_path\n raise OptionParser::InvalidArgument, \"The '-w/--web-path' flag is DEPRECATED. Use the --server-css-path and --server--search-path flags instead.\"\n end\n\n if opts.server_css && (opts.resource_dir || opts.style_name)\n raise OptionParser::InvalidArgument, \"The '-w' flag can not be used with either of the '-r' or '-s' flags\"\n end\n\n if opts.server_css && opts.format != \"html\"\n raise OptionParser::InvalidArgument, \"The '-w' flag can only be used for the 'html' format flags\"\n end\n\n if opts.style_name && opts.resource_dir.nil?\n raise OptionParser::InvalidArgument, \"The '-s' flag requires the use of the '-r' flag as well.\"\n end\n\n # if opts.resource_dir.nil? ^ opts.style_name.nil?\n # raise OptionParser::InvalidArgument, \"Either both '-s' and '-r' flags must be given or none of them.\"\n # end\n\n if opts.resource_dir && !opts.resource_dir.exist?\n raise OptionParser::InvalidArgument, \"Could not find resource path #{opts.resource_dir}\"\n end\n\n if opts.make_searchable && opts.format != \"html\"\n raise OptionParser::InvalidArgument, \"Error: The --make-searchable option \" \\\n \"is only supported for html rendering.\"\n end\n\n if opts.search_action_path && !opts.make_searchable\n raise OptionParser::InvalidArgument, \"Error: The --server-search-path \" \\\n \"flag is only supported in combination with the --make-searchable (-m) flag.\"\n end\n end",
"def add_valid_option(option)\n @@valid_options.push(option) unless @@valid_options.include?(option)\n @@valid_options\n end",
"def test_add_option04f\n assert_raise ( RuntimeError ) {\n ArgumentManager.add_option(\n [ 'x' ],\n :type => :string,\n :domain => 0\n )\n }\n end",
"def test_parse04a\n ArgumentManager.add_option([ 'u-opt' ], :type => :string, :mandatory => true, :df_str => 'foo' )\n \n assert_raise( RuntimeError ) {\n options = ArgumentManager.parse( [] )\n }\n end",
"def test_add_option03d\n assert_nothing_raised( Exception ) {\n ArgumentManager.add_option(\n [ 'l' ],\n :type => :integer,\n :mandatory => true\n )\n }\n end",
"def validate_holding_options!(options)\n unpermitted_params = []\n required_params = {}\n\n case holding_opts[:on_hand_type]\n when :closed\n required_params[:amount] = [Integer]\n when :open\n required_params[:amount] = [Integer]\n when :none\n unpermitted_params << :amount\n end\n\n # Actual validation\n unpermitted_params = unpermitted_params.select { |p| options.key?(p) }\n .map { |p| \"'#{p}'\" }\n\n wrong_types = required_params\n .select { |k, v| options.key?(k) && v.select { |type| options[k].is_a?(type) }.length.zero? }\n .map { |k, v| \"'#{k}' must be a '#{v.join(' or ')}' but '#{options[k].class}' found\" }\n\n required_params = required_params.reject { |k, _v| options.key?(k) }\n .map { |k, _v| \"'#{k}'\" }\n\n # Raise OptionsInvalid if some invalid parameters were found\n if (unpermitted_params.length + required_params.length + wrong_types.length).positive?\n message = ''\n message << \" unpermitted parameters: #{unpermitted_params.join(',')}.\" unless unpermitted_params.empty?\n message << \" missing parameters: #{required_params.join(',')}.\" unless required_params.empty?\n message << \" parameters type mismatch: #{wrong_types.join(',')}\" unless wrong_types.empty?\n raise ActsAsHoldable::OptionsInvalid.new(self, message)\n end\n true\n end",
"def getOptions\n [\n ['-h', GetoptLong::NO_ARGUMENT] \n ]\n end",
"def assert_not_empty\n if options.empty?\n raise \":length, :maxmimum or :minimum must be given as option\"\n end\n end",
"def check_option(opt_name, opt_val)\n\n # - Check option name to make sure it's a legal option\n # - Then check the value. If there is a list of values\n # the value must be one of them. Otherwise, the value\n # must be an integer.\n\n if !@@opt_list.has_key?(opt_name)\n return [ nil, \"Unknown option name: #{opt_name}\" ]\n end\n\n allowable_val = @@opt_list[opt_name]\n if !allowable_val.nil?\n if !allowable_val.find { |val| val == opt_val }\n return [ nil, \"Unknown '#{opt_name}' value: #{opt_val}\" ]\n end\n elsif !opt_val.is_a?(Integer)\n if opt_val =~ /^\\d+$/\n opt_val = opt_val.to_i\n else\n return [ nil, \"'#{opt_name}' value (#{opt_val}) should be an integer\" ]\n end\n end\n return [ opt_val, nil ]\n end",
"def required_options\n valid_options - [:label, :reader_options, :ingester_options]\n end",
"def list_filter(**opt)\n # May be overridden by the subclass.\n end",
"def check(cmd)\n # check requisite options\n list.each do |item|\n if item.requisite and not(cmd.model[item.key])\n raise OptionError.new(cmd, 'option \"%s\" is requisite' % [item.long])\n end\n end\n end",
"def valid?(options)\n (@required_options - options.keys).size == 0\n end",
"def merge_list_into_options!(list_id_or_username, options={})\n case list_id_or_username\n when Fixnum\n options[:list_id] = list_id_or_username\n when String\n options[:slug] = list_id_or_username\n end\n options\n end"
] | [
"0.60217386",
"0.5918961",
"0.5694803",
"0.56383955",
"0.5546811",
"0.5538718",
"0.5532386",
"0.5525195",
"0.550749",
"0.550749",
"0.550749",
"0.550749",
"0.550749",
"0.550749",
"0.550749",
"0.550749",
"0.550749",
"0.550749",
"0.550749",
"0.5477994",
"0.54726887",
"0.5431061",
"0.5417745",
"0.5408762",
"0.5392848",
"0.5304162",
"0.5298365",
"0.5275248",
"0.5244214",
"0.524091",
"0.5231719",
"0.5215229",
"0.5215229",
"0.5214576",
"0.5194514",
"0.5194514",
"0.5176443",
"0.5150831",
"0.51491314",
"0.51385146",
"0.5137969",
"0.5122898",
"0.5096324",
"0.50848883",
"0.50848883",
"0.50848883",
"0.50848883",
"0.50848883",
"0.50848883",
"0.50848883",
"0.50848883",
"0.50848883",
"0.50793624",
"0.5032571",
"0.502972",
"0.5021818",
"0.50110173",
"0.5004375",
"0.5000607",
"0.4990219",
"0.49866834",
"0.49837333",
"0.4981715",
"0.4980572",
"0.49778354",
"0.49551663",
"0.49550584",
"0.4932751",
"0.49184152",
"0.4900317",
"0.4892525",
"0.48904818",
"0.48863697",
"0.48779094",
"0.48761547",
"0.4856291",
"0.48425108",
"0.48372933",
"0.48314896",
"0.48278233",
"0.48278233",
"0.48278233",
"0.48278233",
"0.48278233",
"0.48278233",
"0.482271",
"0.48107556",
"0.48105994",
"0.4797713",
"0.4794114",
"0.47925776",
"0.47768542",
"0.4771844",
"0.47539952",
"0.47532034",
"0.4750675",
"0.47409326",
"0.47403973",
"0.4739506",
"0.47341222"
] | 0.6877995 | 0 |
Merge options for a specified name and type into the defaults and return the result. | def merge_default_options(name, type, options = {})
list_options[name][type].merge(options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_defaults(options = {})\n defaults = {}\n # defaults[:character_name] = @charater_name if @charater_name\n defaults[:region] = @region if @region\n defaults[:caching] = @caching if @caching\n defaults[:cache_timeout] = @cache_timeout if @cache_timeout\n defaults[:debug] = @debug if @debug\n\n # overwrite defaults with any given options\n defaults.merge!(options)\n end",
"def merge_defaults(options = {})\n\t\t\tdefaults = {}\n\t\t\t# defaults[:character_name] = @charater_name if @charater_name\n\t\t\t# defaults[:guild_name]\t= @guild_name if @guild_name\n\t\t\tdefaults[:realm] \t\t\t\t\t= @realm \t\t\t\t\tif @realm\n\t\t\tdefaults[:locale] \t\t\t\t= @locale \t\t\t\tif @locale\n\t\t\tdefaults[:lang] \t\t\t\t\t= @lang \t\t\t\t\tif @lang\n\t\t\tdefaults[:caching] \t\t\t\t= @caching \t\t\t\tif @caching\n\t\t\tdefaults[:cache_timeout] \t= @cache_timeout \tif @cache_timeout\n\t\t\tdefaults[:debug] \t\t\t\t\t= @debug \t\t\t\t\tif @debug\n\t\t\tdefaults[:rate_limit] = @rate_limit if @rate_limit\n\t\t\t\n\t\t\t# overwrite defaults with any given options\n\t\t\tdefaults.merge!(options)\n\t\tend",
"def merge_defaults(options = {})\n\t\t\tdefaults = {}\n\t\t\t# defaults[:character_name] = @charater_name if @charater_name\n\t\t\t# defaults[:guild_name]\t= @guild_name if @guild_name\n\t\t\tdefaults[:realm] \t\t= @realm \t\tif @realm\n\t\t\tdefaults[:locale] \t= @locale \tif @locale\n\t\t\tdefaults[:lang] \t\t= @lang \t\tif @lang\n\t\t\tdefaults[:caching] \t= @caching \tif @caching\n\t\t\tdefaults[:debug] \t\t= @debug \t\tif @debug\n\t\t\t\n\t\t\t# overwrite defaults with any given options\n\t\t\tdefaults.merge!(options)\n\t\tend",
"def resolve_defaults(options)\n options.merge(@defaults)\n end",
"def _fill_defaults\n @options.each do |option|\n next unless option.is_optional\n\n unless @matched_options.key? option.name\n @matched_options[option.name] = option.default_value\n end\n end\n\n self\n end",
"def merge!(defaults)\n @options = @options.reverse_merge(defaults)\n end",
"def merge_default_options( opts )\n @default_options.merge!( opts )\n nil\n end",
"def merge_defaults(options = {})\n\t\t\tdefaults = {}\n\t\t\tdefaults[:debug] = @debug if @debug\n\n\t\t\t# overwrite defaults with any given options\n\t\t\tdefaults.merge!(options)\n\t\tend",
"def defaults_and_options options\n options\n end",
"def get_defaults(api_options)\n defaults = {\n :enable_read => true,\n :enable_write => true,\n :enable_options => true,\n :enable_get_all => true,\n :enable_get => true,\n :enable_post => true,\n :enable_put => true,\n :enable_delete => true,\n }\n api_options.merge!(defaults) { |key, v1, v2| v1 }\n end",
"def give_options\n clean_user_options\n @user_options.merge(default_options)\n end",
"def get_options(default_or_custom, items_type)\n default_or_custom == \"default\" ? (return get_default(items_type)) :\n (return get_custom(items_type))\nend",
"def get_defaults( name )\n @defaults[ name ] || {}\n end",
"def _apply_default_options args, defaults\n options = args.extract_options!\n args << options.reverse_merge!(defaults)\n end",
"def defaults\n defaults = self[:defaults] || {}\n return defaults if defaults.any?\n options.fetch 'defaults', {}\n end",
"def option(options)\n default_options.merge! options\n end",
"def options\n defaults.merge!(@options)\n end",
"def options\n defaults.merge!(@options)\n end",
"def calculate_defaults\n # see http://www.ruby-forum.com/topic/185611#811055 for the source of\n # this obtuseness (basically, I wanted Hash.map, but it didn't work)\n opts_with_defaults = @options.select {|_, opt| opt.should_have_default_value? }\n opts_with_defaults.merge(opts_with_defaults) {|_, opt, _| opt.default_value }\n end",
"def merge_options(defaults, options = {})\n options ||= {}\n\n defaults.symbolize_keys!\n options.symbolize_keys!\n\n (defaults.keys & options.keys).each do |key|\n options[key] = \"#{defaults[key]} #{options[key]}\".strip\n end\n\n defaults.merge(options)\n end",
"def method_missing( meth, *args, &block )\n if self.class.types.include?(meth) and args.length.between?(1,2)\n name = args[0]\n default = args.length == 2 ?\n args[1] : meth\n option = @klass.new(name, default)\n option.description, @description =\n @description, nil\n @options << option\n else\n super\n end\n end",
"def default_options\n option_type_config_for :default\n end",
"def default_for name, value\n @default_options[name] = value\n end",
"def _parse_options(options)\n defaults = DEFAULTS.dup\n options = options.dup\n\n defaults.keys.each do |key|\n options[key] ||= defaults[key]\n end\n\n options\n end",
"def merge(options)\n unless options\n return CallSettings.new(timeout: @timeout,\n retry_options: @retry_options,\n page_descriptor: @page_descriptor,\n page_token: @page_token,\n bundler: @bundler,\n bundle_descriptor: @bundle_descriptor,\n metadata: @metadata,\n errors: @errors)\n end\n\n timeout = if options.timeout == :OPTION_INHERIT\n @timeout\n else\n options.timeout\n end\n retry_options = if options.retry_options == :OPTION_INHERIT\n @retry_options\n else\n options.retry_options\n end\n page_token = if options.page_token == :OPTION_INHERIT\n @page_token\n else\n options.page_token\n end\n\n metadata = @metadata || {}\n metadata = metadata.dup\n metadata.update(options.metadata) if options.metadata != :OPTION_INHERIT\n\n CallSettings.new(timeout: timeout,\n retry_options: retry_options,\n page_descriptor: @page_descriptor,\n page_token: page_token,\n bundler: @bundler,\n bundle_descriptor: @bundle_descriptor,\n metadata: metadata,\n errors: @errors)\n end",
"def option_type_config_for(name, result_if_empty: :default)\n return unless option_configs\n\n res = option_configs.find { |s| s.name == name.to_s.underscore.to_sym }\n\n if !res && self.class.allow_empty_options\n res = if result_if_empty == :first_config\n option_configs.first\n else\n self.class.options_provider.new(result_if_empty, {}, self)\n end\n\n end\n res\n end",
"def default_opts\n { :default => default }.merge( opts )\n end",
"def default_options\n sync{ @opts || {} }\n end",
"def fetch_options(what, attr_name, default = nil)\n name = [attr_name, what].join('_')\n return object.send(name) if object.respond_to?(name)\n fetched = options[name.to_sym] || default\n raise \"undefined #{name}\" unless fetched\n fetched\n end",
"def merge_defaults(defaults)\n result = dup\n keys.each do |key|\n if !set?(key) && defaults.key?(key)\n result.set(key, defaults.get(key))\n end\n end\n result\n end",
"def parse_options(person, options)\n returning({}) do |result|\n result[:twitter_field] = options[:twitter_field] || default_field\n result[:size] = 'normal'\n result[:size] = 'bigger' if options[:size] == :big || options[:size] == :medium\n end\n end",
"def insert_defaults(options, defaults = { class: nil })\n options.dup.tap do |results|\n klass = results[:class] || results.delete('class')\n\n results[:class] = \"#{defaults[:class]} #{klass}\"\n end\n end",
"def _get_option(name)\n\n # Start with nothing\n value = nil\n\n # First, get the default value by cycling through the allowed options\n method = self.class.metadata[:allowed_options].each do |allowed_option|\n value = allowed_option[:default] if allowed_option[:name] == name\n end\n\n # Then, cycle through the user-provided options\n @user_options.each do |user_option|\n value = user_option[name] if user_option.key?(name)\n end\n\n value\n end",
"def default_fields_with_name(name=self.class.name.underscore, options={})\n self.default_fields.each do |k, v|\n options[\"#{name}_#{k}\"] = v\n end\n options\n end",
"def default_options=(opts); end",
"def make_default(property_name, type = nil, **opt)\n type = opt.slice(*TYPE_OPTION_KEYS).values.first || type || property_name\n type = type.to_s.classify if type.is_a?(Symbol)\n name = type.to_s.presence || 'String'\n base = name.demodulize.to_sym\n if SCALAR_TYPES.include?(base)\n base = :FalseClass if %i[Boolean TrueClass].include?(base)\n SCALAR_DEFAULTS[base]\n elsif name.start_with?('Ils::')\n type = type.constantize unless type.is_a?(Class)\n ->(**opt) { type.new(nil, opt) }\n elsif !name.include?('::')\n type = \"Ils::#{name}\".constantize\n ->(**opt) { type.new(nil, opt) }\n else\n type = type.constantize unless type.is_a?(Class)\n ->(*) { type.new }\n end\n end",
"def call(format_type: DEFAULT_NEWS_FORMAT_TYPE)\n self.combined_options = defaults.merge(\n format_type: validate_format_type(format_type)\n )\n super\n end",
"def impl_opts(name, env)\n {}.tap do |result|\n env.each do |k, v|\n if k.to_s.start_with?(\"#{name}_\")\n # While I generally don't like the 'rescue' syntax,\n # we do this to just fall back to the default value\n # if it isn't dup-able.\n k = k.dup rescue k\n v = v.dup rescue v\n\n result[k] = v\n end\n end\n end\n end",
"def build_options(options)\n validate_options(options)\n merge_default_options_into(options)\n end",
"def default_options\n @default_options ||= OpenStruct.new\n end",
"def apply_options!(options = {})\n return if options.nil? || options.empty?\n\n default(options[:default]) if options.key?(:default)\n experimental_default_proc(&options[:experimental_default_proc]) if options.key?(:experimental_default_proc)\n env(options[:env]) if options.key?(:env)\n deprecated_env(options[:deprecated_env]) if options.key?(:deprecated_env)\n env_parser(&options[:env_parser]) if options.key?(:env_parser)\n delegate_to(&options[:delegate_to]) if options.key?(:delegate_to)\n depends_on(*options[:depends_on]) if options.key?(:depends_on)\n lazy(options[:lazy]) if options.key?(:lazy)\n on_set(&options[:on_set]) if options.key?(:on_set)\n resetter(&options[:resetter]) if options.key?(:resetter)\n setter(&options[:setter]) if options.key?(:setter)\n type(options[:type], **(options[:type_options] || {})) if options.key?(:type)\n end",
"def options\n original_options = super\n user_defaults = @config\n user_defaults.merge(original_options)\n end",
"def set_default_options(options = {})\n if options.is_a?(Hash)\n options = TemplateOptions.new.tap do |o|\n o.reset_defaults\n o.update(options)\n end\n end\n options.type ||= options.object.type if options.object\n options\n end",
"def list_default_options(name, options = {})\n write_inheritable_attribute(:list_options, {}) if list_options.nil?\n list_options[name] = Facade.options[:default_options].merge(options)\n end",
"def merge_defaults(skin)\n DEFAULTS.each do |k,v|\n skin[k] = v if skin[k].nil?\n end\n end",
"def get(name, default = nil)\n\t\t\t\tname = name.to_sym\n\n\t\t\t\tif @options[name][:value] != nil then\n\t\t\t\t\t@options[name][:value]\n\t\t\t\telsif default != nil then\n\t\t\t\t\tdefault\n\t\t\t\telse\n\t\t\t\t\t@options[name][:default]\n\t\t\t\tend\n\t\t\tend",
"def option(name, default = nil)\n value = self.class.options[name.to_sym]\n value = default if default and !value\n\n if value.respond_to? :call then value.call else value end\n end",
"def process_options(options, defaults={})\n defaults.merge(options).each do |key,value|\n self.send(\"#{key}=\", value)\n end\n end",
"def merge_default(defaults)\n if defaults && !defaults.empty?\n defaults.each do |key, value|\n self[key] = value unless self.key?(key)\n end\n end\n self\n end",
"def as(type, default = :req, opts = {})\n [type, default, opts]\n end",
"def user_options(options)\n merged_options = options.dup\n merged_options[:cpu_cores] = get_option(:cores_per_socket)\n merged_options[:memory] = get_option(:vm_memory)\n merged_options.compact\n end",
"def default_options\n options = {}\n options[:query_options] ||= {}\n options[:resource_name] = name.split(\"::\").last.downcase\n options[:collection_name] = name.split(\"::\").last.downcase + \"ListItem\"\n options\n end",
"def default_options\n options = {}\n options[:query_options] ||= {}\n options[:resource_name] = name.split(\"::\").last.downcase\n options[:collection_name] = name.split(\"::\").last.downcase + \"ListItem\"\n options\n end",
"def set_default_options\n end",
"def defaults_for(type)\n default_parameters = defaults.fetch type.to_s, {}\n fail \"Default for the type: #{type} should be a hash of parameters. Got: #{default_parameters.inspect}\" unless default_parameters.is_a? Hash\n default_parameters\n end",
"def default_emerge_install_options(options)\n default_emerge_options(nil, options)\n end",
"def default!\n clear.merge!(defaults)\n end",
"def combined_options(options)\n resp = @options\n resp[:query].merge! options\n resp\n end",
"def merge_option(key, options)\n my_options = self.send(key) || {}\n my_options.merge(options[key] || {})\n end",
"def defaults(key = nil)\n d = @@defaults[@type] || {}\n key ? d[key] : d\n end",
"def prepare_options(options)\n options = self.class.defaults.merge(self.options).merge(options)\n end",
"def defaults(options = nil)\n @defaults ||= default_options\n if options\n @defaults = default_options.merge!(options)\n else\n @defaults\n end\n end",
"def defaults(options = nil)\n @defaults ||= default_options\n if options\n @defaults = default_options.merge!(options)\n else\n @defaults\n end\n end",
"def merge_settings\n defaults = {\n continue: false,\n format: 135,\n output: \"#{options[:tmp_dir]}/\" +\n Time.now.strftime(\"%d-%m-%Y-%H%M%S\") +\n \".mp4\",\n no_warnings: true\n }\n\n @settings = defaults.merge!(options.select { |k, v| defaults.key?(k) && v })\n end",
"def merge opts\n opts.each do |k,v|\n if configurable.key?(k.to_sym) && !v.nil? then\n self.send(\"#{k}=\".to_sym, v)\n end\n end\n end",
"def option(name, *args)\n opts = args.extract_options!\n type = args.shift\n\n add_params_validations(name, opts.delete(:validates))\n\n if options[name]\n options[name].type = type if type\n options[name].default = opts.delete(:default) if opts.key?(:default)\n options[name].merge!(opts)\n else\n options << Compendium::Option.new(opts.merge(name: name, type: type))\n end\n end",
"def get_default_options(opt={})\n race = [\n {:id => 1, :value => \"Native American/Alaskan\"},\n {:id => 2, :value => \"Asian\"},\n {:id => 3, :value => \"Black\"},\n {:id => 4, :value => \"Hispanic\"},\n {:id => 5, :value => \"White\"},\n {:id => 6, :value => \"Other\"}\n ]\n if opt[:simple]\n return {:race => race}\n else\n absenteeism = [\n {:id => 0, :value => 'Gross'},\n {:id => 1, :value => 'Confirmed Illness'}\n ]\n age = [\n {:id => 1, :value => '0'},\n {:id => 2, :value => '1'},\n {:id => 3, :value => '2'},\n {:id => 4, :value => '3'},\n {:id => 5, :value => '4'},\n {:id => 6, :value => '5'},\n {:id => 7, :value => '6'},\n {:id => 8, :value => '7'},\n {:id => 9, :value => '8'},\n {:id => 10, :value => '9'},\n {:id => 11, :value => '10'},\n {:id => 12, :value => '11'},\n {:id => 13, :value => '12'},\n {:id => 14, :value => '13'},\n {:id => 15, :value => '14'},\n {:id => 16, :value => '15'},\n {:id => 17, :value => '16'},\n {:id => 18, :value => '17'},\n {:id => 19, :value => '18'}\n ]\n grade =[]\n if opt[:nurse]\n grade.push(\n {:id => 1, :value => 'Kindergarten (Pre-K)'},\n {:id => 2, :value => '1st Grade'},\n {:id => 3, :value => '2nd Grade'},\n {:id => 4, :value => '3rd Grade'},\n {:id => 5, :value => '4th Grade'},\n {:id => 6, :value => '5th Grade'},\n {:id => 7, :value => '6th Grade'},\n {:id => 8, :value => '7th Grade'},\n {:id => 9, :value => '8th Grade'},\n {:id => 10,:value => '9th Grade'},\n {:id => 11,:value => '10th Grade'},\n {:id => 12,:value => '11th Grade'},\n {:id => 13,:value => '12th Grade'}\n )\n end\n symptoms = Rollcall::Symptom.all\n gender = [\n {:id => 0, :value => 'Select Gender...'},\n {:id => 1, :value => 'Male'},\n {:id => 2, :value => 'Female'}\n ]\n data_functions = [\n {:id => 0, :value => 'Raw'},\n {:id => 1, :value => 'Average'},\n {:id => 2, :value => 'Average 30 Day'},\n {:id => 3, :value => 'Average 60 Day'},\n {:id => 4, :value => 'Standard Deviation'},\n {:id => 5, :value => 'Cusum'}\n ]\n return {\n :absenteeism => absenteeism,\n :age => age,\n :gender => gender,\n :symptoms => symptoms,\n :data_functions => data_functions,\n :race => race,\n :grade => grade\n }\n end\n end",
"def reset\n @options = VALID_OPTIONS_KEYS.inject({}) do |opts, k|\n default_option = OnTheSnow::Config.const_get(\"DEFAULT_#{k.upcase}\")\n self.send(\"#{k}=\", default_option)\n opts[k.to_s] = default_option #unless default_option.nil?\n opts\n end\n self\n end",
"def merge(other = {})\n branch default_options.merge(other)\n end",
"def with_defaults(defaults); end",
"def _apply_field_defaults args\n _apply_default_options args, field_options.reverse_merge(label: true, wrap_field: true, label_first: true)\n end",
"def options\n @options ||= OpenStruct.new(default_options)\n end",
"def default_options\n {\n appid: app_id,\n device_id: device_id,\n locale: locale,\n ip: ip,\n offer_types: offer_types,\n timestamp: Time.now.to_i\n }\n end",
"def parse_options(options)\n options = options.reject { |key, _value| !permitted_options.key?(key) }\n @default_options = permitted_options.merge(options).reject { |_key, value| value.blank? }\n end",
"def default_url_options(options={})\n if(options[:type].to_s == 'false')\n options[:type] = nil\n else\n options[:type] ||= @card_type_name\n end\n options\n end",
"def merge_with_default(config, config_file, unset_nil:); end",
"def options_by_type(key)\n validation_type_overrides[key] || options[key]\n end",
"def merge_options(options)\n merged_options=@options\n options.each do |passed_option_key,passed_option_value|\n merged_options[passed_option_key] = passed_option_value\n end\n return merged_options\n end",
"def option_or_default(key, default)\n options? ? options.fetch(key, default) : default\n end",
"def default!(defaults = {})\n replace(defaults.merge(self))\n end",
"def merge_owner_into_options!(owner_id_or_owner_screen_name, options={})\n case owner_id_or_owner_screen_name\n when Fixnum\n options[:owner_id] = owner_id_or_owner_screen_name\n when String\n options[:owner_screen_name] = owner_id_or_owner_screen_name\n end\n options\n end",
"def merge_label_options!(options)\n defaults = { :background => :white, :fill => :black, :gravity => :center, :pointsize => 12, :bordersize => 0, :padding => '0x0' }\n options.replace(defaults.merge(options))\n options[:font] = locate_font(options[:font]) if options[:font] && options[:font][0..1] != '/'\n options[:font] ||= locate_font # locate default font\n end",
"def default_options; end",
"def default_options; end",
"def default_options; end",
"def default_options; {} end",
"def merge_attributes(data)\n data.fetch(\"default\", {})\n .merge(data.fetch(\"normal\", {}))\n .merge(data.fetch(\"override\", {}))\n .merge(data.fetch(\"automatic\", {}))\n end",
"def default_options\n DEFAULT_OPTIONS\n end",
"def http_options(type)\n base = self.default_request_options\n if @options.present?\n if type == :get\n base[:query] = @options\n else\n base[:head]['Content-Type'] = \"application/x-www-form-urlencoded\"\n base[:body] = body = {}\n @options.each_pair { |k,v| body[CGI.escape(k.to_s)] = CGI.escape(v) }\n end\n end\n base\n end",
"def type( type, *allowed_defaults )\n @@types ||= Hash.new\n @@types[type] = self\n Caty::OptionConstructor.register(type)\n @allowed_defaults = allowed_defaults\n end",
"def runtime_options\n DEFAULT_OPTIONS.merge(symbolize_keys(options))\n end",
"def makeDefaultOptionHash()\n\t\toptionHash = Hash.new()\n\t\[email protected] do |optDef|\n\t\t\tdefault = optDef.getDefault()\n\t\t\tunless default.nil?\n\t\t\t\toptionHash[optDef.getKey()] = default\n\t\t\tend\n\t\tend\n\t\treturn optionHash\n\tend",
"def merge_finder_options_with_or(options={})\n result = self.dup\n options.reject! {|k,v| v.blank?}\n result[:select] = [self[:select], options.delete(:select)].compact.join(\", \")\n result[:conditions] = ActiveRecord::Base.sanitize_and_merge_conditions_with_or(self[:conditions], options.delete(:conditions))\n result[:order] = ActiveRecord::Base.sanitize_and_merge_order(self[:order], options.delete(:order))\n result[:joins] = ActiveRecord::Base.sanitize_and_merge_joins(self[:joins], options.delete(:joins))\n result.reject {|k,v| v.blank?}.merge(options)\n end",
"def default_options\n {}\n end",
"def default_options\n {}\n end",
"def default_options\n {}\n end",
"def option_from(config, option, default = nil)\n config.respond_to?(option) ? config.send(option) : default\n end",
"def method_missing(meth, opts = {})\n merge_options meth, opts\n end",
"def merge_owner_into_options!(owner_id_or_owner_username, options={})\n case owner_id_or_owner_username\n when Fixnum\n options[:owner_id] = owner_id_or_owner_username\n when String\n options[:owner_username] = owner_id_or_owner_username\n end\n options\n end",
"def merge_user_into_options!(user_id_or_screen_name, options={})\n case user_id_or_screen_name\n when Fixnum\n options[:user_id] = user_id_or_screen_name\n when String\n options[:screen_name] = user_id_or_screen_name\n end\n options\n end"
] | [
"0.6763694",
"0.66728336",
"0.6660936",
"0.6320446",
"0.6311713",
"0.6286139",
"0.62812316",
"0.62222826",
"0.6202263",
"0.6159285",
"0.61196816",
"0.61132604",
"0.6086944",
"0.6043457",
"0.6018442",
"0.5958097",
"0.5932961",
"0.5932961",
"0.5873984",
"0.5847051",
"0.58383256",
"0.5767216",
"0.57664144",
"0.5765224",
"0.5714154",
"0.5705712",
"0.56925607",
"0.56801707",
"0.5661161",
"0.5628619",
"0.5625306",
"0.562433",
"0.5615395",
"0.5612769",
"0.56064993",
"0.5601478",
"0.56002474",
"0.55702585",
"0.55696684",
"0.55352163",
"0.55280966",
"0.55261",
"0.5522122",
"0.55029273",
"0.54913044",
"0.5488295",
"0.54858804",
"0.5481124",
"0.5477845",
"0.5473407",
"0.5468964",
"0.5456991",
"0.5456991",
"0.5456555",
"0.54500633",
"0.5428324",
"0.5425099",
"0.5401939",
"0.5396183",
"0.53956723",
"0.5395564",
"0.53851724",
"0.53851724",
"0.53839123",
"0.53752077",
"0.537461",
"0.5347719",
"0.53440225",
"0.5340697",
"0.53378206",
"0.53329617",
"0.53265965",
"0.5322889",
"0.5322812",
"0.53225493",
"0.52980715",
"0.5297198",
"0.5293121",
"0.5290004",
"0.52873695",
"0.5287184",
"0.5278506",
"0.52750367",
"0.52750367",
"0.52750367",
"0.5271677",
"0.5270236",
"0.5259964",
"0.5255853",
"0.52530926",
"0.5251966",
"0.52484167",
"0.52441466",
"0.5242107",
"0.52414495",
"0.52414495",
"0.5237595",
"0.5229108",
"0.52270985",
"0.5221859"
] | 0.8110009 | 0 |
Determines the :order value that gets passed to find. | def get_list_order(sort, dir)
if sort
column_order_mapping = get_sext_constant('SEXT_COLUMN_ORDER_MAPPING')
# Lookup and use the designated ordering if defined in the model.
if column_order_mapping && column_order_mapping.has_key?(sort.to_sym)
sort = column_order_mapping[sort.to_sym]
# Use the passed in value if it looks complete with table name.
elsif !sort.include?('.')
sort = [self.table_name, sort].join('.')
end
dir ||= "ASC"
order = sort + " " + dir
else
order = get_sext_constant('SEXT_DEFAULT_SORT')
end
return order
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order\n @order ||= detect_order(params[:order]) || default_order\n end",
"def order\n @order || \"99_99\"\n end",
"def to_find_order\n @conditions.to_find_order\n end",
"def order\n return @order\n end",
"def to_find_order\n if @order.blank?\n nil\n else\n @order.collect do |col|\n col.respond_to?(:full_name) ? (col.full_name + (col.negative? ? \" DESC\" : \"\")) : col\n end.join(\", \")\n end\n end",
"def order()\n @options[:order] || DEF_LAST_ORDER\n end",
"def order\n @order || index\n end",
"def order(value)\n\t\t\tparam(\"order\", value)\n\t\tend",
"def order=(value)\n @order = value\n end",
"def set_order( params )\n return 'desc' if (params[:order]=='asc')\n return 'asc'\n end",
"def fetch_order int\n routine = \"\"\n data.routines.each do |id, r|\n if r.order === int\n routine = r\n end\n end\n routine\n end",
"def order\n unless @order\n raise \"'order' must be one of [ASC,DESC]\" if !%w(ASC DESC).include?(@config['order'].to_s.upcase)\n end\n @order ||= @config['order']\n end",
"def define_order(s_order)\n s_order=='Crescente' ? :asc : :desc\n end",
"def order\n @num\n end",
"def order\n order = single_param(\"order\")\n if order.nil?\n return nil\n end\n if order.start_with?('-')\n field = order[1..-1]\n dir = \"desc\"\n else\n field = order\n dir = \"asc\"\n end\n unless ALLOWED_SORT_FIELDS.include?(field)\n @errors << %{\"#{field}\" is not a valid sort field}\n return nil\n end\n return [SORT_MAPPINGS.fetch(field, field), dir]\n end",
"def calc_order\n @order_by = (['name', 'popularity'].include?(params[:order_by]) ? params[:order_by] : 'popularity')\n\n order = (params[:order_name] or '').upcase\n @order_name = (!order.blank? and ['ASC', 'DESC'].include?(order)) ? order : 'ASC'\n\n order = (params[:order_popularity] or '').upcase\n @order_popularity = (!order.blank? and ['ASC', 'DESC'].include?(order)) ? order : 'ASC'\n end",
"def order_by_field\n self.find_field(self.order_by)\n end",
"def cur_ordering\r\n @orderings\r\n end",
"def order(order)\n attribute, order_type = order.gsub(/\\s+/, ' ').split(' ')\n raise 'Invalid attribute in order clause' unless (model.attributes.keys + ['id', 'created_at']).include?(attribute)\n\n attribute = model.map_to_syncano_attribute(attribute)\n order_type = order_type.to_s.downcase == 'desc' ? 'DESC' : 'ASC'\n\n self.parameters.merge!({ order_by: attribute, order: order_type })\n\n self\n end",
"def order_hint\n return @order_hint\n end",
"def order=(_arg0); end",
"def sorting_value\n respond_to?(:ordering) ? ordering : 0\n end",
"def order\n Spree::Order.find(@attributes[:order_id].to_i)\n end",
"def position_in_list\n self[order_column]\n end",
"def ordering\n if params[:order]\n Hash[params[:order].values.map{ |ordering|\n [COLUMNS_TO_ORDER_FIELD[ordering[\"column\"].to_i], ordering[\"dir\"].to_sym]\n }]\n elsif params[:sort]\n params[:sort]\n else\n {_score: :desc}\n end\n end",
"def order(ordering=nil)\n @options[:order] = ordering if ordering.kind_of?(String)\n end",
"def default; return DefaultOrder; end",
"def order_params\n params[:order]\n end",
"def order_params\n params[:order]\n end",
"def order=(order)\n @order = order\n return if order.blank?\n if is_sphinx_scope?(order) # We first check for scopes since they might be named ascend_by_scopename.\n scopes[order.to_sym] = true\n elsif order.to_s =~ /^(ascend|descend)_by_(\\w+)$/\n @order_direction = ($1 == 'ascend') ? :asc : :desc\n if is_sphinx_attribute?($2)\n @order_attribute = $2.to_sym\n elsif [:weight, :relevance, :rank, :id, :random, :geodist].include?($2.to_sym)\n @order_attribute = \"@#{$2} #{@order_direction}\"\n end\n end\n end",
"def order\n \"#{sort} #{dir}\"\n end",
"def sort_order(order)\n \"#{(params[:order] || order.to_s).gsub(/[\\s;'\\\"]/,'')} #{params[:direction] == 'up' ? 'ASC' : 'DESC'}\"\n end",
"def build_order\n\t\t\tp = params.permit(:terms, :order)\n\t\t\tif p['order']\n\t\t\t\tattribute, asc_desc = p['order'].split(\" \")\n\t\t\t\tif ['terms', 'count', 'updated_at'].include?(attribute) && ['asc', 'desc'].include?(asc_desc)\n\t\t\t\t\treturn \"#{attribute} #{asc_desc}\"\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn \"updated_at desc\"\n\t\tend",
"def order\n return nil if return_items.blank?\n return_items.first.inventory_unit.order\n end",
"def another_order_direction\n @mg_params.key?(:order_direction) ? (%w(asc desc) - [@mg_params[:order_direction].to_s]).first : MightyGrid.order_direction\n end",
"def search_order(query) #:nodoc:\n by = []\n query.order.each do |order|\n next unless order.property.kind_of? Sphinx::Attribute\n by << [order.property.field, order.direction].join(' ')\n end\n by.empty? ? nil : by.join(', ')\n end",
"def order; end",
"def order; end",
"def test_order\n @@test_orders[self] || AVAILABLE_ORDERS.first\n end",
"def sort_order\n if @sort_order\n @sort_order.upcase!\n return @sort_order if SORT_ORDERS.include?(@sort_order)\n end\n default_sort_order\n end",
"def order\n end",
"def order\n @order ||= Order.find_by(id: session[:order_id]) if session[:order_id]\n end",
"def ordering_query; end",
"def ordering(order)\n ensure_valid_parameter('ordering', order, %w(ascending descending))\n @request[:ordering] = order.to_s\n self\n end",
"def ordering_by\n order && order.to_s.gsub(/^(ascend|descend)_by_/, '')\n end",
"def order(order)\n params[:sort] = if order.is_a?(Hash) then\n order.reduce([]) do |memo, obj|\n key, value = obj\n\n if (value.to_s != \"asc\" && value.to_s != \"desc\") then\n raise ArgumentError, \"Order must be either :asc or :desc\"\n end\n\n key = \"-#{key}\" if value.to_s == \"desc\"\n memo.push(key)\n end.join(\",\")\n elsif order.is_a?(String) then\n order\n end\n\n self\n end",
"def set_order\n unless params[:order_by]\n @order = @model.typus_order_by\n else\n @order = \"#{params[:order_by]} #{params[:sort_order]}\"\n end\n end",
"def sort_direction\n params[\"order\"][\"0\"][\"dir\"] == \"desc\" ? \"desc\" : \"asc\"\n end",
"def order(*args)\n with_opts(:order=>args.freeze)\n end",
"def order(order_id)\n Order.find(order_id)\n end",
"def find_order\n @order = Order.find(params[:id])\n end",
"def set_order\n @order = Order.friendly.find(params[:id])\n end",
"def set_order\n @order = Order.friendly.find(params[:id])\n end",
"def default_order\n (sort_order if sort_order.present?) ||\n (sort_orders.try(:first) if sort_orders.present?) ||\n SortOrder::DEFAULT\n end",
"def order_string\n \"#{params[:sort]} #{params[:direction]}\"\n end",
"def ordered_by(statement)\n @expected_options[:order] = statement\n self\n end",
"def opts_for_find(ids=nil)\n ids ||= cached.ids\n find_opts = combined_options.reject { |k,v| !OPTIONS_FOR_FIND.include?(k) }\n find_opts[:order] = preserve_order(ids) unless find_opts.include?(:order)\n find_opts\n end",
"def tree_sort_order\n if !tree_use_rational_numbers\n \"#{tree_order} #{tree_depth_field}\"\n else\n tree_nv_div_dv_field.asc\n end\n end",
"def first_ordered_by(attribute_name)\n direction, level = ordering[attribute_name]\n return direction if level == 0\n end",
"def current_order_direction\n direction = nil\n if @mg_params.key?(:order_direction) && %w(asc desc).include?(@mg_params[:order_direction].downcase)\n direction = @mg_params[:order_direction].downcase\n end\n direction\n end",
"def default_order\n \"name\"\n end",
"def number\n @order_number ||= text.select do |line|\n line =~ /order no/i\n end.map do |line|\n line[@number_pattern]\n end.uniq.first\n end",
"def attrs_to_orderings(order)\n order.map do |o|\n Arel::Attribute === o ? o.asc : o\n end\n end",
"def _get_sort_order\n if !params[:sort_order].nil?\n return params[:sort_order] \n end\n if !session[:sort_order].nil?\n @redirect_required = true\n order = session[:sort_order]\n session.delete(:sort_order)\n order\n end\n end",
"def ordering_by_array_position?(order_value)\n order_value.expr.is_a?(Arel::Nodes::NamedFunction) && order_value.expr&.name&.downcase == 'array_position'\n end",
"def set_order\n @order = Order.find_by!(\n guid: params[:guid]\n )\n end",
"def default_sort_order\n ::Mincer.config.sorting.order_attribute\n end",
"def ordered_by(attribute_name)\n ordering[attribute_name]\n end",
"def get_order_by\n @order_by\n end",
"def sort_order\n sort_string = params[:sort]\n if sort_string\n split = sort_string.split '_'\n sort_field = split[0]\n sort_dir = split[1]\n return {sort_field.to_sym => sort_dir}\n end\n return {text: :asc}\n end",
"def order_params\n params.has_key?(:ordering) ? get_order_params( params.require(:ordering) ) : {}\n end",
"def waitlist_position(order)\n @queue.position_of(order)\n end",
"def arel_order\n text_columns = if params[:order]\n params[:order].split(' ')\n elsif self.default_sort\n [self.default_sort].flatten\n else\n [model_class.primary_key].flatten\n end\n sort_columns = text_columns.map do |column|\n if column.to_s.include?('.')\n name,direction = column.to_s.split('.',2)\n raise \"Illegal sort direction: #{direction} in #{column}\" unless %w{asc desc}.include?(direction)\n table[name].send(direction)\n else\n table[column]\n end\n end\n sort_columns\n end",
"def check_order\n return if order.present? && Faq.where(order: order).where.not(id: id).empty?\n self.order = begin\n Faq.order(order: :desc).limit(1).first.order + 1.0\n rescue\n 1\n end\n end",
"def set_order(ordering)\n\t\to = \"\"\n\t\tordering.each do |obj_place|\n\t\t\to << (obj_place.model + \"_\" + obj_place.id.to_s + \"///,\")\n\t\tend\n\t\tself.update_attribute :order, o\n\tend",
"def normalize_order(order); end",
"def getSortingOrder #:doc:\n sorting = @default_sorting.dup\n ordering = [\"DESC\", \"ASC\", \"ASC\", \"ASC\"] # default ordering\n \n if @queryparams[:sort_by]\n # get given sort_by-values\n sorts = @queryparams[:sort_by].split(\" \")\n # get given order-values and make sure sorts.size == orders.size\n orders = Array.new(sorts.size, \"DESC\")\n if @queryparams[:order]\n orders = @queryparams[:order].split(\" \")\n if orders.size < sorts.size\n orders += Array.new(sorts.size - orders.size, \"DESC\")\n elsif orders.size > sorts.size\n orders = orders.slice(0, sorts.size)\n end\n orders.each do |o|\n if not (o.upcase == \"ASC\" or o.upcase == \"DESC\") then o = \"ASC\" end\n end \n end\n \n # first sort_by-value has to be processed last (so it gets first on the list)\n sorts = sorts.reverse\n orders = orders.reverse\n \n # check sort_by-values\n sorts.each_index do |i|\n if @sort_by.has_key?(sorts[i])\n # move the sort-attribute to first\n sort_value = @sort_by[sorts[i]]\n ind = sorting.index(\"LOWER(\" + @sort_by[sorts[i]] + \")\")\n if ind != nil\n sorting.delete_at(ind)\n ordering.delete_at(ind)\n sort_value = \"LOWER(\" + sort_value + \")\"\n end\n sorting.unshift(sort_value)\n ordering.unshift(orders[i].upcase)\n end\n end\n end\n \n #combine everything together\n returnable = sorting[0] + \" \" + ordering[0]\n sorting.each_index do |i|\n next if i == 0\n returnable += \", \" + sorting[i] + \" \" + ordering[i]\n end\n return returnable\n end",
"def original_order\n end",
"def sort_order\n 0\n end",
"def by\n new_params = search.params || {}\n new_params[:order] = definition.request_value\n search.class.new_unwrapped(new_params, search.root)\n end",
"def order(field='id',order='desc')\n case order.downcase.to_s\n when 'asc'\n self.sort { |a,b| b.send(field.to_s) <=> a.send(field.to_s) }\n when 'desc' \n self.sort { |a,b| a.send(field.to_s) <=> b.send(field.to_s) }\n end\n end",
"def apply_search_order( ds, options )\n\t\tif (( fields = options[:order] ))\n\t\t\tds = ds.to_a.sort_by do |uuid|\n\t\t\t\t@storage[ uuid ].values_at( *fields.compact ).map {|val| val || ''}\n\t\t\tend\n\t\tend\n\n\t\treturn ds\n\tend",
"def set_order\n sort = params[:sort].present? ? params[:sort] : 'id'\n # FIXME cambiar puntos por guiones para tener automagia\n if sort == 'terceros_nombre'\n sort = 'terceros.nombre'\n end\n ord = params[:order].present? ? params[:order].upcase() : 'ASC'\n @order = sort + ' ' + ord\n end",
"def ordered?\n @ordered ||= !!options[:ordered]\n end",
"def order\n if terminal?\n 0\n elsif self_referential?\n 1\n else\n r = 0\n @rules.each do |rule|\n # Only interested in rule with recursion\n if rule.size > 1\n rule.each do |elem|\n # Only interested in references\n if elem.is_a? String\n b = @klass.defs.find_all {|i| i.name == elem}[0].order + 1\n r = b if b > r # swap if higher\n end\n end\n end\n end\n r\n end\n end",
"def flexmock_current_order\n @flexmock_current_order ||= 0\n end",
"def order\n @order ||= Glysellin::Order.where(id: order_id).first\n end",
"def get_active_order_direction(parameters)\n parameters[@name]['order'] == @mg_params[:order] ? current_order_direction : nil\n end",
"def ordering_by_case?(order_value)\n order_value.expr.is_a?(Arel::Nodes::Case)\n end",
"def lob_order_by_expression(klass, order)\n return order if order.nil?\n changed = false\n new_order = order.to_s.strip.split(/, */).map do |order_by_col|\n column_name, asc_desc = order_by_col.split(/ +/)\n if column = klass.columns.detect { |col| col.name == column_name && col.sql_type =~ /LOB$/i}\n changed = true\n \"DBMS_LOB.SUBSTR(#{column_name},100,1) #{asc_desc}\"\n else\n order_by_col\n end\n end.join(', ')\n changed ? new_order : order\n end",
"def order!(collection)\n return collection unless params.has_key?(:order)\n\n direction = _direction_for_order_value(params[:order])\n\n # Get raw column value, since it may be prepended with '+' or '-'\n order_value = _strip_order_value(params[:order])\n\n case order_value\n # when 'request_for_proposal'\n # collection = collection.order_by_request_for_proposal(direction)\n # when 'team_rank'\n # if params.has_key?(:team_id)\n # collection = fetch_team_issue_ranks(params[:team_id])\n # new_order = \"issue_ranks.rank #{direction}\"\n # end\n # when 'linked_account_rank'\n # if params.has_key?(:linked_account_id)\n # collection = fetch_linked_account_issue_ranks(params[:linked_account_id])\n # new_order = \"issue_ranks.rank #{direction}\"\n # end\n # when 'rank'\n # new_order = \"issue_ranks.rank #{direction}\"\n when 'bounty'\n new_order = \"issues.bounty_total #{direction}\"\n when 'created'\n new_order = \"issues.remote_created_at #{direction}\"\n when 'updated'\n new_order = \"issues.remote_updated_at #{direction}\"\n when 'comments'\n new_order = \"coalesce(issues.comment_count, 0) #{direction}\"\n when 'participants'\n new_order = \"coalesce(issues.participants_count, 0) #{direction}\"\n when 'thumbs'\n new_order = \"coalesce(issues.thumbs_up_count, 0) #{direction}\"\n when 'votes'\n new_order = \"coalesce(issues.votes_count, 0) #{direction}\"\n when 'thumbed_at'\n new_order = \"thumbs.thumbed_at #{direction}\"\n end\n\n # if primary ordering is thumbs, secondary is bounty. else, secondary is thumbs.\n if new_order == \"coalesce(issues.thumbs_up_count, 0) desc\"\n new_order = \"#{new_order}, coalesce(issues.bounty_total, 0) desc\"\n elsif new_order\n new_order = \"#{new_order}, coalesce(issues.thumbs_up_count, 0) desc\"\n end\n\n collection.reorder(new_order)\n end",
"def find_order(name)\n page.find(:xpath, \"//a/span/p[contains(text(), '#{name}')]\")\nend",
"def find_order\n @order = Order.find_by!(number: params[\"order_refnum\"].to_s)\n authorize! :update, @order\n end",
"def sort_order\n 10 - object.id\n end",
"def order=( o )\n\t\torig = @order\n\t\t@order = o\n\t\traise_on_invalid_column if o\n\t\torig\n\tend",
"def order_params\n params.fetch(:order, {})\n end",
"def order_params\n params.fetch(:order, {})\n end",
"def order_params\n params.fetch(:order, {})\n end",
"def order_params\n params.fetch(:order, {})\n end",
"def order_params\n params.fetch(:order, {})\n end"
] | [
"0.7320525",
"0.7025892",
"0.6825588",
"0.6706693",
"0.66573995",
"0.66351026",
"0.65140915",
"0.65077263",
"0.64128774",
"0.6310201",
"0.6220841",
"0.61830634",
"0.6150113",
"0.61313784",
"0.61237025",
"0.61145365",
"0.6073884",
"0.60714823",
"0.604582",
"0.60305685",
"0.60152483",
"0.6015246",
"0.59856933",
"0.59601545",
"0.5946027",
"0.59260327",
"0.5902203",
"0.58984345",
"0.58984345",
"0.5892619",
"0.58493924",
"0.5808174",
"0.57954884",
"0.57815146",
"0.5768309",
"0.5764762",
"0.5757836",
"0.5757836",
"0.574037",
"0.5731107",
"0.57199603",
"0.57007855",
"0.5686255",
"0.5676815",
"0.56744486",
"0.56653935",
"0.5665092",
"0.5664314",
"0.5662771",
"0.5662682",
"0.56567913",
"0.5626479",
"0.5626479",
"0.56085604",
"0.559223",
"0.5577755",
"0.557748",
"0.55700636",
"0.5528615",
"0.5516252",
"0.5510976",
"0.5504681",
"0.55004513",
"0.5499626",
"0.54987466",
"0.54937285",
"0.5489189",
"0.548773",
"0.54808426",
"0.54791135",
"0.54754114",
"0.54662746",
"0.54614884",
"0.5460232",
"0.5454518",
"0.5447475",
"0.54456836",
"0.5445196",
"0.54399186",
"0.54237384",
"0.54165137",
"0.54147494",
"0.54057187",
"0.5392954",
"0.53908795",
"0.53843546",
"0.53843206",
"0.53556186",
"0.535082",
"0.5348751",
"0.53452",
"0.5344399",
"0.53403026",
"0.53402394",
"0.532831",
"0.532101",
"0.532101",
"0.532101",
"0.532101",
"0.532101"
] | 0.5360437 | 87 |
Returns the default options | def list_options
read_inheritable_attribute(:list_options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_options\n DEFAULT_OPTIONS\n end",
"def default_options\n @default_options ||= {}\n end",
"def default_options\n { }\n end",
"def default_options\n option_type_config_for :default\n end",
"def default_options; end",
"def default_options; end",
"def default_options; end",
"def default_options\n {}\n end",
"def default_options\n {}\n end",
"def default_options\n {}\n end",
"def default_options\n {}\n end",
"def default_options\n {}\n end",
"def default_options\n {}\n end",
"def default_options\n {}\n end",
"def default_options\n @default_options ||= self.class.default_options\n end",
"def default_options; {} end",
"def default_options\n # {}\n end",
"def defaults_and_options options\n options\n end",
"def get_default_options\n get_options([:default_task_heartbeat_timeout, :default_task_schedule_to_close_timeout, :default_task_schedule_to_start_timeout, :default_task_start_to_close_timeout])\n end",
"def default_options\n sync{ @opts || {} }\n end",
"def set_default_options\n end",
"def default_options\n @default_options ||= OpenStruct.new\n end",
"def default\n options[:default]\n end",
"def defaults\n ActiveSupport::OrderedOptions.new\n end",
"def options\n defaults.merge!(@options)\n end",
"def options\n defaults.merge!(@options)\n end",
"def defaults\n defaults = self[:defaults] || {}\n return defaults if defaults.any?\n options.fetch 'defaults', {}\n end",
"def default_options=(opts); end",
"def default_options\n {\n appid: app_id,\n device_id: device_id,\n locale: locale,\n ip: ip,\n offer_types: offer_types,\n timestamp: Time.now.to_i\n }\n end",
"def options\n default_options.merge(all_options).delete_if do |key, value|\n option_not_allowed?(key)\n end\n end",
"def default\r\n @opts[:default]\r\n end",
"def default_options\n options = {}\n options[:verbose] = false\n options[:copy_only] = false\n options[:output_folder] = FileUtils.pwd\n\n options\n end",
"def default_options()\n options = {\n :verbose => 0, # Logger::DEBUG\n :logfile => STDERR\n }\n config_file = File.join(ENV['HOME'],\"#{File.basename($0, \".*\")}.rc.yaml\")\n if File.exists? config_file then\n config_options = YAML.load_file(config_file)\n options.merge!(config_options)\n end\n return options\n end",
"def options\n @options ||= OpenStruct.new(default_options)\n end",
"def default_opts\n { :default => default }.merge( opts )\n end",
"def options()\n {}\n end",
"def calculate_defaults\n # see http://www.ruby-forum.com/topic/185611#811055 for the source of\n # this obtuseness (basically, I wanted Hash.map, but it didn't work)\n opts_with_defaults = @options.select {|_, opt| opt.should_have_default_value? }\n opts_with_defaults.merge(opts_with_defaults) {|_, opt, _| opt.default_value }\n end",
"def default_options\n {\n color: false,\n progress: false,\n print_json: true\n }\n end",
"def default_options\n {\n :description => '', # Name\n :type => 0, # 0 - Email, 1 - External script, 2 - SMS, 3 - Jabber, 100 - EzTexting\n :smtp_server => '',\n :smtp_helo => '',\n :smtp_email => '', # Email address of Zabbix server\n :exec_path => '', # Name of external script\n :gsm_modem => '', # Serial device name of GSM modem\n :username => '', # Jabber user name used by Zabbix server\n :passwd => '' # Jabber password used by Zabbix server\n }\n end",
"def default_options\n {\n \"Created Date Range\" => {:field_type => :date_range, :for => \"short_interaction_created_at\", :from => \"2012-03-01\".to_date, :to => Time.current},\n Institution => {:field_type => :select_tag, :has_dependencies => \"true\"},\n Provider => {:field_type => :select_tag, :dependency => '#institution_id', :dependency_id => 'parent_id'},\n Program => {:field_type => :select_tag, :dependency => '#provider_id', :dependency_id => 'parent_id'},\n }\n end",
"def default_options\n {\n name: '', # Name\n description: '', # Description\n type: 0, # 0 - Email, 1 - External script, 2 - SMS, 3 - Jabber, 100 - EzTexting\n smtp_server: '',\n smtp_helo: '',\n smtp_email: '', # Email address of Zabbix server\n exec_path: '', # Name of external script\n gsm_modem: '', # Serial device name of GSM modem\n username: '', # Jabber user name used by Zabbix server\n passwd: '' # Jabber password used by Zabbix server\n }\n end",
"def list_default_options(name, options = {})\n write_inheritable_attribute(:list_options, {}) if list_options.nil?\n list_options[name] = Facade.options[:default_options].merge(options)\n end",
"def opts\n load_defaults unless @opts\n @opts\n end",
"def defaults\n []\n end",
"def default_options\n { :charset => nil, :line_break => nil, :nomunge => nil,\n :preserve_semi => nil, :disable_optimizations => nil }\n end",
"def defaults\n @defaults\n end",
"def set_default_options!\n @options ||= OpenStruct.new\n @options.skip_uncovered = false\n @options.mute = false\n @options.reports = []\n end",
"def option(options)\n default_options.merge! options\n end",
"def options\n @options ||= {}\n end",
"def options\n @options ||= {}\n end",
"def options\n @options ||= {}\n end",
"def options\n @options ||= {}\n end",
"def options\n @options ||= {}\n end",
"def options\n @options ||= {}\n end",
"def get_options; end",
"def default_options\n recurly_settings = Settings.recurly\n {\n company_subdomain: recurly_settings.company_subdomain,\n default_currency: recurly_settings.default_currency\n }\n end",
"def options\n @options ||= {}\n end",
"def options\n @options ||= {}\n end",
"def get_default_field_options\n @default_field_options ||= {\n :suppress_fields => []\n }\n end",
"def defaults\n {}\n end",
"def defaults\n {}\n end",
"def default_settings\n {}\n end",
"def options\n @options || {}\n end",
"def options\n @env || @default_options\n end",
"def options(opt)\n []\n end",
"def options; [] end",
"def options\n {}\n end",
"def options\n {}\n end",
"def defaults\n {}\n end",
"def default_options\n {\n :name => nil,\n :key_ => nil,\n :hostid => nil,\n :delay => 60,\n :history => 60,\n :status => 0,\n :type => 7,\n :snmp_community => '',\n :snmp_oid => '',\n :value_type => 3,\n :data_type => 0,\n :trapper_hosts => 'localhost',\n :snmp_port => 161,\n :units => '',\n :multiplier => 0,\n :delta => 0,\n :snmpv3_securityname => '',\n :snmpv3_securitylevel => 0,\n :snmpv3_authpassphrase => '',\n :snmpv3_privpassphrase => '',\n :formula => 0,\n :trends => 365,\n :logtimefmt => '',\n :valuemapid => 0,\n :delay_flex => '',\n :authtype => 0,\n :username => '',\n :password => '',\n :publickey => '',\n :privatekey => '',\n :params => '',\n :ipmi_sensor => '',\n }\n end",
"def option_names\n standard_option_names\nend",
"def options\n @options ||= {}\n @options\n end",
"def makeDefaultOptionHash()\n\t\toptionHash = Hash.new()\n\t\[email protected] do |optDef|\n\t\t\tdefault = optDef.getDefault()\n\t\t\tunless default.nil?\n\t\t\t\toptionHash[optDef.getKey()] = default\n\t\t\tend\n\t\tend\n\t\treturn optionHash\n\tend",
"def defaults(options = nil)\n @defaults ||= default_options\n if options\n @defaults = default_options.merge!(options)\n else\n @defaults\n end\n end",
"def defaults(options = nil)\n @defaults ||= default_options\n if options\n @defaults = default_options.merge!(options)\n else\n @defaults\n end\n end",
"def default_options\n { voice: 'en',\n pitch: 50,\n speed: 170,\n capital: 1,\n amplitude: 100,\n quiet: true }\n end",
"def getOptions\n [\n ['-h', GetoptLong::NO_ARGUMENT] \n ]\n end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def defaults; end",
"def configured_default\n @options[:default] || default_entry\n end",
"def default_options\n {\n \"Date Range\" => {:field_type => :date_range, :for => \"created_at\", :from => \"2012-03-01\".to_date, :to => Date.today},\n SystemSurvey => {:field_type => :select_tag, :custom_name_method => :report_title, :required => true},\n \"Include Pending Responses\" => { field_type: :check_box_tag, for: \"show_pending\" }\n }\n end",
"def default_options\n {\n \"Date Range\" => {:field_type => :date_range, :for => \"service_requests_submitted_at\", :from => \"2012-03-01\".to_date, :to => Time.current},\n Institution => {:field_type => :select_tag, :has_dependencies => \"true\"},\n Provider => {:field_type => :select_tag, :dependency => '#institution_id', :dependency_id => 'parent_id'},\n Program => {:field_type => :select_tag, :dependency => '#provider_id', :dependency_id => 'parent_id'},\n Core => {:field_type => :select_tag, :dependency => '#program_id', :dependency_id => 'parent_id'},\n }\n end",
"def default_options(options = nil)\n # initialize from superclass\n @default_options = superclass.default_options if @default_options.nil?\n\n unless options.nil?\n unless options.is_a? Hash\n raise ArgumentError, 'default_options must call with Hash'\n end\n options.each do |option, default_value|\n if @valid_option_keys.include?(option)\n @default_options[option] = default_value\n else\n raise ArgumentError, \"Unknown option '#{option}'\"\n end\n end\n end\n\n @default_options.dup\n end",
"def merge_default_options( opts )\n @default_options.merge!( opts )\n nil\n end",
"def options\n @_options ||= {}\n end",
"def options\n @options ||= if top_class?\n DEFAULT_OPTIONS\n else\n superclass.options\n end.dup\n end",
"def default_options=( opts )\n sync{ @opts = opts.nil? ? nil : opts.dup }\n end",
"def default_data_options\n {}\n end",
"def options\n self.class.instance_variable_get(:@__options) || []\n end",
"def runtime_options\n DEFAULT_OPTIONS.merge(symbolize_keys(options))\n end",
"def options() end",
"def prov_set_default_options\n {\n :reason_text => nil,\n :applied_states => PROV_STATES.keys,\n :type_choice => 'all',\n :user_choice => approver? ? 'all' : current_user.id,\n :time_period => 7,\n }\n end",
"def defaults\n self.class.defaults\n end"
] | [
"0.8982515",
"0.85776526",
"0.8546139",
"0.8536403",
"0.85106725",
"0.85106725",
"0.85106725",
"0.8499063",
"0.8497954",
"0.8497954",
"0.8419924",
"0.8419924",
"0.8419924",
"0.83733994",
"0.83624744",
"0.8357197",
"0.82903224",
"0.81847525",
"0.81025225",
"0.8043845",
"0.800083",
"0.7879673",
"0.78672814",
"0.7846189",
"0.7837984",
"0.7837984",
"0.7814077",
"0.7710397",
"0.7688199",
"0.7666391",
"0.7617362",
"0.7566261",
"0.7563971",
"0.75540805",
"0.75231725",
"0.75016505",
"0.7429318",
"0.7402296",
"0.73907435",
"0.73247087",
"0.7324041",
"0.73233014",
"0.7296969",
"0.72804385",
"0.7230982",
"0.7226983",
"0.7206658",
"0.7201934",
"0.7198211",
"0.7198211",
"0.7198211",
"0.71923906",
"0.71923906",
"0.71923906",
"0.7179597",
"0.7178108",
"0.717527",
"0.717527",
"0.7168847",
"0.71648455",
"0.7164713",
"0.7163725",
"0.71627665",
"0.71625674",
"0.71559274",
"0.71347773",
"0.7124885",
"0.7124885",
"0.711459",
"0.7104569",
"0.7099172",
"0.7090517",
"0.70900697",
"0.70866024",
"0.70866024",
"0.70689833",
"0.70401245",
"0.70390797",
"0.70390797",
"0.70390797",
"0.70390797",
"0.70390797",
"0.70390797",
"0.70390797",
"0.70390797",
"0.70390797",
"0.70390797",
"0.7025325",
"0.70245343",
"0.70219535",
"0.70215726",
"0.70157826",
"0.69910395",
"0.69904935",
"0.6981582",
"0.6961432",
"0.6952923",
"0.69462675",
"0.69228035",
"0.6902836",
"0.69005275"
] | 0.0 | -1 |
Does this questionnaire contain true/false questions? | def true_false_questions?
for question in questions
if question.true_false
return true
end
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def true_false_questions?\n questions.each {|question| return true if question.type == \"Checkbox\" }\n false\n end",
"def accurate?(bools)\n self.answers.map(&:correct) == bools\n end",
"def has_questions?\n all_questions.any?\n end",
"def asks_mentor_questions?\n !mentor_questions.empty?\n end",
"def has_correct_answer?\n self.answers.any? { |answer| answer.correct }\n end",
"def answered?\n !(%w(answered) & flags).empty?\n end",
"def answered?\n !(%w(answered) & flags).empty?\n end",
"def has_answers?\n answer_count > 0\n end",
"def show?\n answers.any?\n end",
"def answered?\n\n if answers.length == 0 \n return false\n end\n\n if answers.last.rationale_choices.size > 0\n\n #\n # The last answer is a list containing only one item, and it\n # does not contain a key for :choice_id. This is the answer we\n # generated in the case of unselecting a previous selection.\n # I.e. user is resetting to the default unselected state.\n # {:answer=>\"not answered\"}\n #\n\n return true\n end\n\n return false\n\n end",
"def answered_questionnaire?(user)\n answered_users.include?(user)\n end",
"def any_questions?\n @questions.length > 0\n end",
"def has_questions_without_visualizer?\n questions.any? { |q| !q.visualizer_set? }\n end",
"def answered?\n return @answered\n end",
"def solved?\n !!self.answers.select {|x| x.correct}[0]\n end",
"def answer_present\n if self.question.qtype == 'one_response' && self.response_id.nil?\n errors.add(:base, 'Please fill in an answer before leaving this page.' )\n return false\n elsif self.question.qtype == 'likert_scale' && self.response_id.nil?\n errors.add(:base, 'Please fill in an answer before leaving this page.' )\n return false\n\n elsif self.question.qtype == 'rank_three' \n responses = self.multianswers.map( &:rank ).compact\n if responses.length == 3 \n array_wanted = [1, 2, 3]\n if array_wanted == responses.sort\n return true\n else \n errors.add(:base, 'Please ensure all items are unique.' )\n return false\n end \n else \n errors.add(:base, 'Please ensure 3 items are ranked.' )\n return false\n end\n\n elsif self.question.qtype == 'rank_five' \n responses = self.multianswers.map( &:rank ).compact\n if responses.length == 5 \n array_wanted = [1, 2, 3, 4, 5]\n if array_wanted == responses.sort\n return true\n else \n errors.add(:base, 'Please ensure all items are unique.' )\n return false\n end \n else \n errors.add(:base, 'Please ensure 5 items are ranked.' )\n return false\n end\n end\n end",
"def answer_correct?(answer)\n @correct_answer == answer\n end",
"def answered?\n return false if question.blank?\n # If the question is option based then see if any options were selected\n return question_options.any? if question.question_format.option_based?\n # Strip out any white space and see if the text is empty\n return text.gsub(%r{</?p>}, '').gsub(%r{<br\\s?/?>}, '').chomp.present? if text.present?\n\n false\n end",
"def disputed?\n !bounty_claim_responses.where(value: false).empty?\n end",
"def can_make_decision?\n self.awaiting_decisions? || self.awaiting_replies? || self.all_rejected?\n end",
"def pending_answer?\r\n\t\t\treturn (@type == 'answer' && @state == 're')\r\n\t\tend",
"def will_answer?\n return true\n end",
"def matrix_question?\n self.questionable_type == \"MatrixQuestion\"\n end",
"def passed?\n voting? && has_met_requirement?\n end",
"def answer?\n return @answer\n end",
"def completed?\n if self.completed == true\n true\n end\n\n if( self.user_quiz_answers.count == self.quiz.quiz_phases.collect{ |p| p.quiz_questions }.size )\n self.completed = true\n true\n else\n false\n end\n end",
"def is_valid?\r\n if self.question.present?\r\n if self.question.question_format.option_based?\r\n return !self.question_options.empty?\r\n else # (e.g. textarea or textfield question formats)\r\n return self.text.present?\r\n end\r\n else\r\n return false\r\n end\r\n end",
"def has_response?\n if @answers.nil? then\n false\n else\n rc = false\n @answers.each do |answer| # loop through Answers\n if !answer.value.blank? then # any response is good enough\n rc = true\n break\n end\n end\n rc\n end\n end",
"def truth?\n truth\n end",
"def to_boolean\r\n\t !!(self.to_s =~ /^(true|t|yes|y|1)$/i)\r\n\tend",
"def hasAnyQuests?\n if $PokemonGlobal.quests.active_quests.length >0 || \n $PokemonGlobal.quests.completed_quests.length >0 ||\n $PokemonGlobal.quests.failed_quests.length >0\n return true\n end\n return false \nend",
"def in_use?\n published? || has_answers? || has_choices?\n end",
"def enough_responses?\n game.current_round.response(self).count >= game.current_round.question.answers\n end",
"def undetermined?\n undetermined == 'true'\n end",
"def true?\n\t\t!empty? && any?{|v| v.true? }\n\tend",
"def check_answer(user_answer)\n self.answers.each do |answer|\n if answer.answer == user_answer\n return true\n end\n end\n return false\n end",
"def complete?\n# self.answers.count == Question.count\n question_set = Question.order(\"order_id asc\").all(:include => :parent_question)\n question_set.reject!{ |q| self.filter_question?(q) }\n\n question_set.each do |q|\n ans = self.answers.find_answer_for_question( q ).first\n if ans.nil?\n return false\n end\n end\n\n return true\n end",
"def hide_answers?\n return false if @hide_answers.nil?\n @hide_answers\n end",
"def enough_answers?\n self.answers.count >= 3\n end",
"def suitable?\n @confines.all?(&:true?)\n end",
"def is_subjective?\n return (is_shortanswer? or is_scale?)\n end",
"def interview_decision_made?\n !application_interview_decision_type.nil?\n end",
"def is_correct\n return object.question_answers.detect {|element| element.answer_id == object.id}.is_correct\n # object.question_answers.map do |questionAnswer|\n # return questionAnswer.is_correct\n # end\n end",
"def accept?(question)\n ! (ask(\"#{question} [YES/no] >\") =~ /n/i)\n end",
"def form_checks_out?\n return false unless abstract_form_valid?\n return false if has_duplicate_db_columns?\n return false if questions.count { |q| q.type == \"tutor_table\" } >= 2\n return false unless find_out_of_scope_variables.empty?\n true\n end",
"def boolean?( item )\n [true,false].include?( item )\n end",
"def used?\n return true unless Counsel.where(survey: self).empty?\n return true unless Solicitation.where(survey: self).empty?\n return true unless Promulgation.for_survey(self).empty?\n return false\n end",
"def can_vote_on? question\n !question.answers.joins(:votes).where('votes.user_id = ?', id).exists?\n end",
"def valid?\n valid = true\n\n if self.choice.nil? || self.choice == \"\"\n valid = false\n end\n\n if self.choice.nil? || self.question_id == \"\"\n valid = false\n end\n\n return valid\n end",
"def display?(flat_answer_data)\n true\n end",
"def passed?\n [\n semester.min_scholarship_index <= scholarship_index,\n community?,\n professional?\n ].count { |p| p == true} >= 2\n end",
"def response_equal_answer?\n @response.to_i == eval(@question)\n end",
"def satisfied?\n postconditions.all? &:met?\n end",
"def has_choice_questions\n self.errors.add(:base, \"Matrix questions must have at least one question\") if self.choice_questions.empty? or self.choice_questions.all? {|q| q.marked_for_destruction? or q.question_content.marked_for_destruction? }\n end",
"def comprehension_question?\n is_comprehension\n end",
"def has_background_check_form_responses?\n return true if crimes_against_persons_or_financial? || drug_related_crimes?\n return true if related_proceedings_crimes? || medicare_healthcare_crimes? || general_convictions?\n false\n end",
"def responded_with_availability?\n !interview_availabilities.empty?\n end",
"def is_correct?(answer)\r\n self.answer.to_s == answer\r\n end",
"def no_questions_matches_no_answers?\n num_questions = question_ids.length\n pre_fetched_answers = Answer\n .includes({ question: :question_format }, :question_options)\n .where(id: answer_ids)\n num_answers = pre_fetched_answers.reduce(0) do |m, a|\n if a.is_valid? \n m+=1\n end\n m\n end\n return num_questions == num_answers\n end",
"def spam?\n p [:spam, @spam]\n (@spam == \"True\" || @spam == \"Yes\") ? true : false\n end",
"def answered?\n !answered_at.nil?\n end",
"def has_correct_choice\n if !quiz_question_choices.any? { |choice| choice.iscorrect }\n errors.add :correct_choice, 'Please select a correct answer for all questions'\n end\n end",
"def boolean?\n !!(self =~ /\\A(true|false)\\z/i)\n end",
"def no_answer?\n return true if @no_answer.nil?\n @no_answer\n end",
"def active_survey?\n !active_survey.blank?\n end",
"def is_true_value?(value)\n /true|yes|on|y|n|s|si|cierto/ === value \n end",
"def no?(question)\r\n !yes?(question)\r\n end",
"def has_correct_options?\n options.corrects.any?\n end",
"def true?\n !false?\n end",
"def exam_and_interview_result_exists\n !exam_result.blank? and !interview_result.blank?\n end",
"def draft_check\n draft_tutorial = self.draft\n draft_chapters = self.chapters.where({draft: true}).empty?\n draft_steps = self.steps.where({draft: true}).empty?\n\n if draft_tutorial == true || draft_chapters == false || draft_steps == false\n return true\n else\n return false\n end\n end",
"def empty?\n questions.empty? and\n answers.empty? and\n nameservers.empty? and\n additional_records.empty?\n end",
"def enough_questions?\n self.questions.count >= 5\n end",
"def blank?\n if title.present? and title != Survey::DEFAULT_TITLE\n return false\n end\n\n [:description, :instructions].each do |attr|\n return false if self.send(attr).present?\n end\n\n questions.each do |question|\n return false unless question.blank?\n end\n\n true\n end",
"def valid_response_for_answer_sheet?(answers)\n return true if !self.required? \n answer = answers.detect {|a| a.question_id == self.id}\n return answer && answer.value.present?\n # raise answer.inspect \n end",
"def compare_answer\n\n if @question.answer == @user_answer \n return true\n end\n\n # return false if incorrect\n false\n\n end",
"def first_answer?( )\n not @first_answer.nil?\n end",
"def correct?\n @correct ||= (answer == correct_answer)\n end",
"def any?\n [\"true\", \"1\", \"yes\"].include? @any.to_s\n end",
"def question?\n question_id.nil?\n end",
"def truthTest\r\n truth = [true, false]\r\n truth.each do |t|\r\n if (t)\r\n return true\r\n end\r\n end\r\n return false\r\nend",
"def resp_pcare_equals_one?(question)\n previous_responses = person.responses_for(\"PARTICIPANT_VERIF.RESP_PCARE\").all\n ri = previous_responses.detect{ |r| r.answer.try(:reference_identifier).to_i == 1 } ? true : false\n answer_for(question, ri)\n end",
"def filter_question?( q )\n return false if q.parent_question_id.blank?\n # if there is parent_question_id, check response value in its answer\n parent_question = q.parent_question\n parent_answer = self.answers.find_answer_for_question( parent_question ).first\n # if question has no answer (e.g. embedded dependency)\n return true if parent_answer.nil?\n\n if parent_answer.get_responses_array.include?( q.parent_response_value )\n return false # don't filter\n else\n return true # filter\n end\n end",
"def accepted_answer?(answer)\n answer.id == answer.question.accepted_answer_id\n end",
"def verb_correct? set\n (set & VERBS).count >= 1\n end",
"def descriptively_ok?\n acceptance & DESCRIPTIVE == DESCRIPTIVE\n end",
"def any?\n @any == true || @any == \"true\" || @any == \"1\" || @any == \"yes\"\n end",
"def pure? \r\n\t\toutcomes = Array.new\r\n\t\tself.examples.each do |e|\r\n\t\t\toutcomes.push(e.outcome)\r\n\t\tend\r\n\t\toutcomes.uniq!\r\n\t\tif outcomes.size == 1\r\n\t\t\treturn true\r\n\t\telse \r\n\t\t\treturn false\r\n\t\tend\r\n\tend",
"def succeeded_in? course\n attended_exam_in?(course) and exams.for_course(course).succeeded.present?\n end",
"def prescriptively_ok?\n acceptance & PRESCRIPTIVE == PRESCRIPTIVE\n end",
"def no_maths_or_physics_qualification?\n !itt_specialism_not_sure? &&\n !initial_teacher_training_specialised_in_maths_or_physics? &&\n (has_uk_maths_or_physics_degree == \"no\")\n end",
"def noun_articles_correct? set\n ((set & NOUNS).count >= 1) || ((set & ARTICLES).count >= 2)\n end",
"def boolean\n any(true, false)\n end",
"def accordion?\n !!(\"#{params[:accordion]}\" =~ /^(1|true)/)\n end",
"def has_feedback?\n\t\treturn false if not self.check_results\n\t\tcheck_results = JSON(self.check_results)\n\t\t(check_results.keys & [\"check50v2\", \"check50\", \"checkpy\", \"check50v3\"]).any?\n\tend",
"def sendable?(counsel) # must have at least one question answered\n Tip.where(counsel: counsel).count > 0\n end",
"def is_correct?\n\t\tself.correctness\n\tend",
"def correct?\n @correct || false\n end",
"def unanswered\n answers.blank?\n end",
"def ask_boolean(question)\n yes? ask(question, true, ['y/n'])\n end"
] | [
"0.81814826",
"0.7937805",
"0.7718431",
"0.74691224",
"0.7414392",
"0.7267982",
"0.72587055",
"0.7108089",
"0.6977733",
"0.69633234",
"0.6924816",
"0.69076",
"0.68839586",
"0.6853858",
"0.6846446",
"0.6827125",
"0.6693314",
"0.6689697",
"0.6688145",
"0.661745",
"0.6606379",
"0.65930516",
"0.6585021",
"0.6567122",
"0.6555871",
"0.6516516",
"0.6506857",
"0.6489371",
"0.6468904",
"0.6403054",
"0.6402117",
"0.6396134",
"0.6384816",
"0.6376352",
"0.63743865",
"0.63668925",
"0.6342877",
"0.6338903",
"0.63243914",
"0.63154113",
"0.6315037",
"0.6296724",
"0.6289642",
"0.6285246",
"0.62849665",
"0.628311",
"0.6279482",
"0.6265527",
"0.6252442",
"0.6230952",
"0.6227667",
"0.62156856",
"0.62034523",
"0.62032956",
"0.61965233",
"0.61931646",
"0.6186608",
"0.6186197",
"0.61815035",
"0.61649805",
"0.61621606",
"0.6161073",
"0.61552656",
"0.6136608",
"0.61318547",
"0.6131205",
"0.6131168",
"0.6130484",
"0.6118489",
"0.61119044",
"0.6106489",
"0.6103398",
"0.61032784",
"0.6101681",
"0.610119",
"0.609947",
"0.6092619",
"0.609074",
"0.6085414",
"0.6073513",
"0.60713905",
"0.60525084",
"0.60483646",
"0.60450274",
"0.6043707",
"0.6042704",
"0.60424423",
"0.6040295",
"0.60378987",
"0.60311484",
"0.6027118",
"0.60215384",
"0.601229",
"0.6009216",
"0.6004193",
"0.6002717",
"0.5996995",
"0.5994079",
"0.5981941",
"0.595586"
] | 0.8456944 | 0 |
validate the entries for this questionnaire | def validate_questionnaire
if max_question_score < 1
errors.add(:max_question_score, "The maximum question score must be a positive integer.")
end
if min_question_score >= max_question_score
errors.add(:min_question_score, "The minimum question score must be less than the maximum")
end
results = Questionnaire.where(["id <> ? and name = ? and instructor_id = ?", id, name, instructor_id])
errors.add(:name, "Questionnaire names must be unique.") if results != nil and results.length > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_entry params\n @quiz_entry = QuizEntry.new params[:quiz_entry]\n @quiz_entry.valid? # Build errors\n\n params[:answers] ||= []\n params[:answers].each do |answer|\n @quiz_entry.answer_entries.build :answer_id => answer\n end\n\n @quiz_entry.quiz.questions.each do |question|\n #if question.answers.find_all_by_id(params[:answers]).length == 0\n # @quiz_entry.errors.add_to_base \"No answer for: #{question.text}\"\n if question.answers.find_all_by_id(params[:answers]).length > 1\n @quiz_entry.errors.add_to_base \"More than one answer for: #{question.text}\"\n end\n end\n\n @quiz_entry\n end",
"def validate\n (1..25).each do |i|\n if resulthash[\"ans\"+i.to_s].blank?\n self.errors.add_to_base \"Question ##{i} cannot be left blank.\"\n end\n end\n super\n end",
"def validate_questionnaire\n errors.add(:max_question_score, \"The maximum question score must be a positive integer.\") if max_question_score < 1\n errors.add(:min_question_score, \"The minimum question score must be less than the maximum\") if min_question_score >= max_question_score\n\n results = Questionnaire.where(\"id <> ? and name = ? and instructor_id = ?\", id, name, instructor_id)\n errors.add(:name, \"Questionnaire names must be unique.\") if results.present?\n end",
"def validate_questions(questions)\n uniq_questions = []\n questions.each do |question|\n qid = question[\"ident\"].to_s\n if (uid_exists?(\"question\", qid))\n if (uniq_questions.include?(question))\n val_warn(\"Duplicate Question Declaration\", qid, \"in Election Definition\")\n else\n val_err(\"Non-Unique Question UID\", qid, \"in Election Definition\")\n end\n else\n uniq_questions.push(question)\n uid_add(\"question\", qid)\n did = question[\"district_ident\"].to_s\n val_err(\"Non-Existent District UID\", did, \"for Question UID\", qid, \"in Question\") unless\n uid_exists?(\"district\", did)\n answers = question[\"answer_list\"].collect {|answer| answer.to_s}\n unless (answers.length == answers.uniq.length)\n val_err(\"Duplicate Answers\", answers.inspect, \"for Question UID\", qid, \"in Question\")\n end\n self.counts_questions[qid] = {\"question_ident\"=>qid,\n \"overvote_count\"=>0,\n \"undervote_count\"=>0,\n \"answer_count_list\"=>answers.collect {|ans| {\"answer\"=> ans,\n \"count\"=> 0}}}\n end\n end\n end",
"def valid_entries\n entries.select(&:valid?)\n end",
"def check_questions_requirements\n if questions.empty? || questions.collect(&:options).empty?\n errors.add(:base, 'Section without questions or options cannot be saved')\n end\n end",
"def validate_line_items\n \n end",
"def validate_inputs(edit_lines)\n valid = true\n edit_lines.each do |key, val|\n if val.text.empty?\n puts \"#{key} is not valid\"\n valid = false\n break\n end\n end\n valid\n end",
"def validations\n []\n end",
"def validate_question params\n @question = Question.new(params[:question])\n @question.valid? # generate errors for question\n\n right_answers = @question.answers.find_all { |ans| ans.right }\n @question.errors.add_to_base \"Must have exactly one right answer\" \\\n if right_answers.length != 1\n\n @question\n end",
"def validate\n # add errors if not validate\n end",
"def validate_question_counts(question_counts)\n all_qids = self.counts_questions.keys\n qids = []\n question_counts.each do |question_count|\n qid = question_count[\"question_ident\"].to_s\n if (! uid_exists?(\"question\", qid))\n val_err(\"Non-Existent Question UID\", qid, \"in Question Count\")\n else\n if (qids.include?(qid)) \n val_err(\"Duplicate Question UID\", qid, \"in Question Count\")\n else\n qids.push(qid)\n end\n all_answers = self.counts_questions[qid][\"answer_count_list\"].\n collect {|anscount| anscount[\"answer\"].to_s}\n answers = []\n question_count[\"answer_count_list\"].each do |anscount|\n answer = anscount[\"answer\"].to_s\n if (all_answers.include?(answer))\n if (answers.include?(answer))\n val_err(\"Duplicate Answer\", answer, \"for Question UID\", qid, \"in Question Count\")\n else\n answers.push(answer)\n end\n else\n val_err(\"Improper Answer\", answer, \"for Question UID\", qid, \"in Question Count\")\n end\n end\n if (answers.length != all_answers.length)\n ansdiff = (all_answers - answers).inspect\n val_err(\"Missing Answers\", ansdiff, \"for Question UID\", qid, \"in Question Count\")\n end\n end\n end\n if (qids.length != all_qids.length)\n qdiff = (all_qids - qids).inspect\n val_err(\"Missing Question UIDs\", qdiff, \"in Question Counts\")\n end\n end",
"def valid_options\n valid = true\n has_one_checked = false\n #logger.debug \"Q#{self.id} OV: #{self.id}: #{self.options ? self.options.size : nil}, #{self._options ? self._options.size : nil}, #{self.json_options ? self.json_options.size : nil}\"\n \n self.options.each do |option|\n valid = false if option.invalid?\n has_one_checked = true if option.correct?\n end\n \n errors.add(:options, 'Question must have at least 1 option!') if self.options.empty?\n errors.add(:options, 'Question must have at least 1 correct option!') if !self.options.empty? && !has_one_checked\n errors.add(:options, 'All must have text!') if !valid\n \n #logger.debug \" ERROR #{errors.full_messages}\"\n end",
"def validations\n {}\n end",
"def valid?\n @errors = []\n \n # checks each field type and adds error messages if it does not meet requirements from the table\n validate_field_types\n \n \n if integer?(\"num_quarter_hours\")\n if num_quarter_hours < 1\n @errors << {message: \"Number of quarter hours must be greater than 0.\", variable: \"num_quarter_hours\"}\n end\n end\n \n @errors.empty?\n end",
"def validate_fields\n @edit[:wf].get_dialog_order.each do |d|\n @edit[:wf].get_all_fields(d, false).each_value do |field|\n if field[:error].present?\n @error_div ||= d.to_s\n add_flash(field[:error], :error)\n end\n end\n end\n end",
"def validate_all\n validate\n items.each do |item|\n definition.validate_item item\n end\n definition.validate_columns items\n end",
"def validate_question params\n\n end",
"def validate_choices\n\t\tunless (self.choice1 != self.choice2) && (self.choice1 != self.choice3) && (self.choice2 != self.choice3)\n\t\t\terrors.add(:Choices, 'must have different answers for each')\n\t\tend\n\tend",
"def validate\n errors = {}\n\n @items.each_with_index do |item, idx|\n begin\n item.validate\n rescue => error\n errors[idx+1] = error\n end\n end\n\n if !errors.empty?\n raise ValidationError.new(_(\"Validation failed for '%{name}' settings list\") % {name: @name}, :errors => errors)\n end\n end",
"def valid_edit_entry_reqs\n if !params[:edit_entry_req].nil?\n edit_reqs_vals = params[:edit_entry_req].values\n edit_reqs_vals.each_slice(3) do |grade, info, remove|\n if grade.empty?\n return false\n end\n end\n end\n return true\n end",
"def validate\r\n\r\n end",
"def valid_add_entry_req\n if !params[:add_entry_req].nil?\n add_er_vals = params[:add_entry_req].values\n add_er_vals.each_slice(3) do |incoming_qual, grade, info|\n if (!incoming_qual.empty? && grade.empty?) ||\n (incoming_qual.empty? && (!grade.empty? || !info.empty?))\n return false\n end\n end\n end\n return true\n end",
"def valid?\n !errors? && entries.values.all?(&:valid?)\n end",
"def validate\n errors.add_to_base \"Enter atleast one product\" if items.empty?\n end",
"def validate\n end",
"def check_constraints\n case self.recordable\n when ExtractionsExtractionFormsProjectsSectionsQuestionRowColumnField\n case self.recordable.question_row_column_field.question_row_column.question_row_column_type.name\n when 'text'\n min_length = self.recordable.question_row_column_field.question_row_column.field_validation_value_for(:min_length).to_i\n max_length = self.recordable.question_row_column_field.question_row_column.field_validation_value_for(:max_length).to_i\n if self.persisted? && self.name.length > 0 && (self.name.length < min_length || self.name.length > max_length)\n errors.add(:length, \"must be between #{ min_length.to_s } and #{ max_length.to_s }\")\n end\n when 'numeric'\n # First check that we aren't trying to validate any of the ~, <, >, ≤, ≥ special characters.\n if self.recordable.question_row_column_field.question_row_column.question_row_column_fields.second == self.recordable.question_row_column_field\n unless (self.name =~ /\\A[-+]?[0-9]*\\.?[0-9]+\\z/) || self.name != ''\n errors.add(:value, 'Must be numeric')\n end\n\n min_value = self.recordable.question_row_column_field.question_row_column.field_validation_value_for(:min_value).to_i\n max_value = self.recordable.question_row_column_field.question_row_column.field_validation_value_for(:max_value).to_i\n if self.persisted? && (self.name.to_i < min_value || self.name.to_i > max_value)\n errors.add(:value, \"must be numeric and between #{ min_value.to_s } and #{ max_value.to_s }\")\n end\n end\n end\n end\n end",
"def validate_attendances_uniqueness\n attendances.each do |attendance|\n next if attendance.justification_ids.blank?\n errors.add(:attendance_ids, \"a falta de #{attendance.date.month}/#{attendance.date.year} já tem justificativo.\")\n end\n end",
"def validate_contests(contests)\n uniq_contests = []\n contests.each do |contest|\n if (uid_exists?(\"contest\", conid = contest[\"ident\"].to_s))\n if (uniq_contests.include?(contest))\n val_warn(\"Duplicate Contest Declaration\", conid, \"in Election Definition\")\n else\n val_err(\"Non-Unique Contest UID\", conid, \"in Election Definition\")\n end\n else\n uniq_contests.push(contest)\n uid_add(\"contest\", conid)\n end\n end\n contests.each do |contest|\n conid = contest[\"ident\"].to_s\n did = contest[\"district_ident\"].to_s\n val_err(\"Non-Existent District UID\", did, \"in Contest UID\", conid, \"in Election Definition\") unless\n uid_exists?(\"district\", did)\n self.counts_contests[conid] = {\"contest_ident\"=>conid,\n \"overvote_count\"=>0,\n \"undervote_count\"=>0,\n \"writein_count\"=>0,\n \"candidate_count_list\"=>[]}\n end\n end",
"def valid?\n @errors << :title if [email protected]_a?(String) || @title.empty?\n @errors << :author if [email protected]_a?(String) || @author.empty?\n @errors << :release_date unless @release_date.is_a?(Date)\n @errors << :publisher if [email protected]_a?(String) || @publisher.empty?\n @errors << :isbn unless @isbn.is_a?(Integer) && @isbn < 10**10 && @isbn >= 10**9\n \n @errors.empty?\n end",
"def validate_answer(answer)\n if rules[:presence] == \"1\"\n answer.validates_presence_of :answer_text\n end\n\n if rules[:minimum].present? || rules[:maximum].present?\n min_max = { minimum: rules[:minimum].to_i }\n min_max[:maximum] = rules[:maximum].to_i if rules[:maximum].present?\n\n answer.validates_length_of :answer_text, min_max\n end\n end",
"def validate_answer(answer)\n if rules[:presence] == \"1\"\n answer.validates_presence_of :answer_text\n end\n\n if rules[:minimum].present? || rules[:maximum].present?\n min_max = { minimum: rules[:minimum].to_i }\n min_max[:maximum] = rules[:maximum].to_i if rules[:maximum].present?\n\n answer.validates_length_of :answer_text, min_max\n end\n end",
"def validate_answer(answer)\n if rules[:presence] == \"1\"\n answer.validates_presence_of :answer_text\n end\n\n if rules[:minimum].present? || rules[:maximum].present?\n min_max = { minimum: rules[:minimum].to_i }\n min_max[:maximum] = rules[:maximum].to_i if rules[:maximum].present?\n\n answer.validates_length_of :answer_text, min_max\n end\n end",
"def validate(entry)\n\tputs \"----------\"\n\tputs entry\n\treturn false if not validate_year(entry[\"byr\"], \"byr\", 1920, 2002)\n\treturn false if not validate_year(entry[\"iyr\"], \"iyr\", 2010, 2020)\n\treturn false if not validate_year(entry[\"eyr\"], \"eyr\", 2020, 2030)\n\treturn false if not validate_hgt(entry[\"hgt\"])\n\treturn false if not validate_color(entry[\"hcl\"])\n\treturn false if not validate_ecl(entry[\"ecl\"])\n\treturn false if not validate_pid(entry[\"pid\"])\n\tputs \"valid\"\n\treturn true\nend",
"def valid?(entry)\n true\n end",
"def validate_answer(answer)\n end",
"def has_choice_questions\n self.errors.add(:base, \"Matrix questions must have at least one question\") if self.choice_questions.empty? or self.choice_questions.all? {|q| q.marked_for_destruction? or q.question_content.marked_for_destruction? }\n end",
"def step_validation\n step_index = form_steps[:pages].index(form_step)\n\n if self.form_steps[:pages].index('title') <= step_index\n self.errors['name'] << 'You must enter a name for the dataset' if self.name.blank? || self.name.strip.blank?\n end\n\n if self.form_steps[:pages].index('connector') <= step_index\n self.errors['type'] << 'You must enter a connector type' unless CONNECTOR_TYPES.include? self.type\n self.errors['provider'] << 'You must enter a connector provider' unless CONNECTOR_PROVIDERS.include? self.provider\n self.errors['connector_url'] << 'You must enter a valid url' \\\n unless self.connector_url && !self.connector_url.blank? && valid_url?(self.connector_url)\n end\n\n if self.form_steps[:pages].index('labels') <= step_index\n unless self.legend && self.legend.is_a?(Hash)\n self.errors['legend'] << 'Labels not correctly defined'\n return\n end\n self.errors['legend'] << 'Latitude and Longitude have to be filled together' if\n self.legend[:lat].blank? ^ self.legend[:long].blank?\n self.errors['legend'] << 'Country and Region have to be filled together' if\n self.legend[:country].blank? ^ self.legend[:region].blank?\n end\n end",
"def valid_embedded_item\n return unless embedded_item && !embedded_item.errors.empty?\n\n embedded_item.errors.each do |k, v|\n errors.add k, v\n end\n end",
"def validate_data\n #first remove any old errors from the table\n self.dataerrors.clear\n \n @s = [] \n # check the necessary fields in the table\n # use the build method so the polymorphic reference is generated cleanly\n # check for the relationships t other tables\n if self.rate_id.blank? && self.rate_override.blank?\n @s.push self.dataerrors.build(:message => \"A rate or override rate must be entered\", :created_user => self.created_user) \n end\n \n #if there are errors, save them to the dataerrors table and return false\n if @s.count > 0\n Dataerror.store(@s) \n return false\n end\n #everything is good, return true\n return true\n end",
"def validate_fields\n %w[email author].each do |field|\n value = self.send(field)\n abort \"Hoe #{field} value not set. aborting\" if value.nil? or value.empty?\n end\n end",
"def valid?\n @errors = []\n # check thename exists and is not empty\n if name.to_s.empty?\n @errors << {message: \"Name cannot be empty.\", variable: \"name\"}\n end\n \n # check the description exists and is not empty\n if description.to_s.empty?\n @errors << {message: \"Description cannot be empty.\", variable: \"description\"}\n end\n \n # check the description exists and is not empty\n # if studio_id.to_s.empty?\n # @errors << {message: \"Studio id cannot be empty.\", variable: \"studio_id\"}\n # elsif studio.blank?\n # @errors << {message: \"Studio id must be a member of the studios table.\", variable: \"studio_id\"}\n # end \n \n if !studio_id.valid?\n @errors += studio_id.errors\n end\n \n # check the description exists and is not empty\n # if rating_id.to_s.empty?\n # @errors << {message: \"Rating id cannot be empty.\", variable: \"rating_id\"}\n # elsif rating.blank?\n # @errors << {message: \"Rating id must be a member of the ratings table.\", variable: \"rating_id\"}\n # end\n \n if !rating_id.valid?\n @errors += rating_id.errors\n end\n # checks the number of time slots\n if length.to_s.empty?\n @errors << {message: \"Length cannot be empty.\", variable: \"length\"}\n elsif length.is_a? Integer\n if length < 1\n @errors << {message: \"Length must be greater than 0.\", variable: \"length\"}\n end\n else\n @errors << {message: \"Length must be a number.\", variable: \"length\"}\n end\n \n # returns whether @errors is empty\n @errors.empty?\n end",
"def validate(entries)\n first = last = nil\n errors = []\n entries.each do |entry|\n if entry[:end] < entry[:start]\n errors << \"#{entry[:raw]} has its end before its start.\"\n end\n first = entry[:start] if first.nil? || first > entry[:start]\n last = entry[:end] if last.nil? || last < entry[:end]\n end\n if last && first && last - first > 14*24*60*60 # 14 days\n errors << \"Time entries span more than two weeks! from #{first} to #{last}\"\n end\n errors\nend",
"def validate\n \n \n end",
"def valid?\n @errors = []\n if id.blank?\n @errors << {message: \"#{class_name} id cannot be blank.\", variable: \"id\"}\n elsif !possible_values.include?(id)\n @errors << {message: \"#{class_name} id must be included in the table.\", variable: \"id\"}\n end\n \n if class_name.blank?\n @errors << {message: \"Class cannot be blank.\", variable: \"class\"}\n end\n \n @errors.empty?\n end",
"def validate(_options = 0)\n []\n end",
"def valid?\n validate_field_types\n # only do a database query if you have good enough data to check the database\n if @errors.length == 0\n if duplicate_user_assignment?\n @errors << \n {message: \n \"The database already has this user and assignment combination. It is record \n #{this_user_and_assignment.id}. Change this assignment or user or the assignment or user of that record.\", \n variabe: \"assignment_id, user_id\"}\n end\n end \n @errors.length == 0\n end",
"def check_active_requirements\n if sections.empty? || sections.collect(&:questions).empty?\n errors.add(:base, 'Survey without sections or questions cannot be saved')\n end\n end",
"def valid?\n @errors = []\n # check thename exists and is not empty\n if name.to_s.empty?\n @errors << {message: \"Name cannot be empty.\", variable: \"name\"}\n end\n \n # check the description exists and is not empty\n if description.to_s.empty?\n @errors << {message: \"Description cannot be empty.\", variable: \"description\"}\n end\n \n # check the description exists and is not empty\n if studio_id.to_s.empty? \n @errors << {message: \"Studio id cannot be empty.\", variable: \"studio_id\"}\n elsif studio.blank?\n @errors << {message: \"Studio id must be a member of the studios table.\", variable: \"studio_id\"}\n end \n \n # check the description exists and is not empty\n if rating_id.to_s.empty?\n @errors << {message: \"Rating id cannot be empty.\", variable: \"rating_id\"}\n elsif rating.blank?\n @errors << {message: \"Rating id must be a member of the ratings table.\", variable: \"rating_id\"}\n end\n \n # checks the number of time slots\n if length.to_s.empty?\n @errors << {message: \"Length cannot be empty.\", variable: \"length\"}\n elsif length.is_a? Integer\n if length < 0\n @errors << {message: \"Length must be greater than 0.\", variable: \"length\"}\n end\n else\n @errors << {message: \"Length must be a number.\", variable: \"length\"}\n end\n \n # returns whether @errors is empty\n @errors.empty?\n end",
"def validate()\n validation_errors = []\n @expected_results.each_pair do |key,expected_result|\n result_key = expected_result[\"population_ids\"].dup\n\n reported_result, errors = extract_results_by_ids(expected_result['measure_id'], result_key)\n @reported_results[key] = reported_result\n validation_errors.concat match_calculation_results(expected_result,reported_result)\n end\n\n validation_errors\n end",
"def valid_sets; end",
"def validate!\n if identifier.to_s.empty?\n raise ValidationError.new(\"identifier is required\")\n else\n [image_changes.created,\n image_changes.updated,\n unit_changes.created,\n unit_changes.updated].each do |collection|\n collection.each(&:validate!)\n end\n\n true\n end\n end",
"def valid?\n @errors = []\n\n if !journal_line_id.nil? && journal_line_id !~ GUID_REGEX\n @errors << ['journal_line_id', 'must be blank or a valid Xero GUID']\n end\n\n unless line_amount\n @errors << ['line_amount', \"can't be blank\"]\n end\n\n unless account_code\n @errors << ['account_code', \"can't be blank\"]\n end\n\n @errors.size == 0\n end",
"def verify_interactive_content\n key = random_string\n while Questionnaire.find_by(key: key)\n key = random_string\n end\n questionnaire = Questionnaire.new(name: key, key: key, content: @raw_questionnaire_content)\n return if questionnaire.valid?\n\n render status: :bad_request, json: { error: questionnaire.errors }\n end",
"def store_validations #:nodoc:\n return if @validations.size == 0\n\n @validations.each do |param|\n store_dv(\n param[:cells],\n param[:validate],\n param[:criteria],\n param[:value],\n param[:maximum],\n param[:input_title],\n param[:input_message],\n param[:error_title],\n param[:error_message],\n param[:error_type],\n param[:ignore_blank],\n param[:dropdown],\n param[:show_input],\n param[:show_error]\n )\n end\n end",
"def validate\n untranslated = self.get_untranslated_keys\n untranslated.each { |key|\n puts \"WARNING: \\\"#{key['id']}\\\" is not translated in #{key['untranslated']} languages\"\n }\n end",
"def validate\r\n self.variables.each do |key, value|\r\n self.errors.add(\r\n :variables,\r\n \"<tt>#{key}</tt> can't be blank\"\r\n ) if value.blank?\r\n end\r\n end",
"def assert_valid_field_list(values)\n if values.length == @entry_fields.length + 1 # values also includes raw_entry\n @field_list_is_valid = true\n else\n raise Indy::Source::FieldMismatchException, \"Number of expected fields does not match those captured via the regexp pattern.\\nThe expected fields are:\\n=> #{@entry_fields.join(\"\\n=> \")}\\nThe log entry and captured fields are:\\n=> #{values.join(\"\\n=> \")}\"\n end\n end",
"def validate_records\n have_enough_items_to_trade?\n end",
"def valid?\n @errors = []\n \n if !item_id.nil? && item_id !~ GUID_REGEX\n @errors << ['line_item_id', 'must be blank or a valid Xero GUID']\n end\n \n unless description\n @errors << ['description', \"can't be blank\"]\n end\n \n @errors.size == 0\n end",
"def validate_all_the_questions(question_id, value)\n question_type = Question.find(question_id).questiontype_id\n if question_type == 2\n if value =~ /^[0-9]+$/ && !value.blank?\n return value\n end\n elsif question_type == 3\n if value =~ /^(3[01]|[12][0-9]|0[1-9])-(1[0-2]|0[1-9])-[0-9]{4}$/ && !value.blank?\n return value\n end\n else\n unless value.blank?\n return value\n end\n end\n end",
"def validate( list )\n # reuse the highline lambda to santize input\n return true if (@allow_empty_list && list.nil?)\n list = highline_question_type.call( list ) if !list.is_a? Array\n return false if !list.is_a?(Array)\n return false if (!@allow_empty_list && list.empty? )\n list.each{ |item|\n return false if !validate_item( item )\n }\n true\n end",
"def check_invariants\n validEvent = true\n\n # This block checks if the start and end times are empty\n if :start_time_date.empty? or :end_time_date.empty?\n errors.add :start_time, \"should be added.\"\n validEvent = false\n end\n \n # This block checks if the number of categories is > 2\n if !categories.nil? and categories.split(',').size > 2\n errors.add :categories, \"section should only have one or two categories selected.\"\n validEvent = false\n end\n\n # This block checks if the start time is greater than the end time\n# #if (Time.strptime(self.start_time, \"%Y-%d-%m %H:%M\") > Time.strptime(self.end_time, \"%Y-%d-%m %H:%M\")) \n# if (self.start_time > self.end_time)\n# errors.add :start_time, \"should be before the end time.\"\n# validEvent = false\n# end\n\n # This block checks if the name field exists\n if (self.name.nil?)\n errors.add :name, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the description field exists\n if (self.description.nil?)\n errors.add :description, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the location field exists\n if (self.location.nil?)\n errors.add :location, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the approval_rating field exists\n if (self.approval_rating.nil?)\n errors.add :approval_rating, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the event_start field exists\n if (self.event_start.nil?)\n errors.add :event_start, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the event_end field exists\n if (self.event_end.nil?)\n errors.add :event_end, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if there are any duplicate events when submitting a new event\n if(self.id == nil) \n if (Event.exists?(:location => self.location, :start_time => self.start_time, :end_time => self.end_time))\n errors.add :location, \"invalid: Cannot be a duplicate event.\"\n validEvent = false\n end\n else\n if (Event.where(\"location = ? AND start_time = ? AND end_time = ? AND NOT id = ?\", self.location, self.start_time, self.end_time, self.id).length >= 1)\n errors.add :location, \"invalid: Created a duplicate event via editing\"\n end\n end\n\n # This block checks to make sure that the organization\n # matches the specified user\n if !can_modify?(self.user)\n errors.add :organization, \"should be one that you are a member of\"\n validEvent = false\n end\n\n return validEvent\n end",
"def validate\n @errors = []\n validate_termination\n validate_freq\n validate_interval\n validate_int_by_list(:bysecond, (0..59))\n validate_int_by_list(:byminute, (0..59))\n validate_int_by_list(:byhour, (0..23))\n validate_int_by_list(:bymonth, (1..12))\n validate_bysetpos\n validate_byday_list\n validate_bymonthday_list\n validate_byyearday_list\n validate_byweekno_list\n validate_wkst\n end",
"def validate\n validate_resources_defined\n validates_unique(:resource_id, :message => \"ARK must point to a unique Resource\")\n validates_unique(:archival_object_id, :message => \"ARK must point to a unique Archival Object\")\n super\n end",
"def validate\n @lines.select! do |line|\n line.include?(\"The configuration is\") || # success\n line.include?(\"Error: \") # error\n end\n end",
"def validate_problem_set\n @problem_set = ProblemSet.find(params[:id]) \n end",
"def run_validations\n true\n end",
"def validate\n # valid if list of headers identical to list of drills and data items combined\n # except that there may be dummy units, algorithm columns\n headers.each do |header|\n if !(definition.drill.keys+definition.data.keys+['units','algorithm','default']).include?(header)\n raise \"Header missing from itemdef: #{header}, itemdef has: #{(definition.drill.keys+definition.data.keys+['units','algorithm','default']).join(',')}\"\n end\n end\n (definition.drill.keys+definition.data.keys+['units']).each do |key|\n raise \"Header missing from data table: #{key}\" if !headers.include?(key)\n end\n end",
"def invalid\n puts \"Invalid entry, please try again.\"\n end",
"def validate\n check_keys qs_plugin, \"QSPlugIn\", %w[author categories description extendedDescription helpPage hidden icon infoFile relatedBundles secret]\n %w[QSActionsTemplate QSDefaultsTemplate QSPresetAdditionsTemplate QSRegistrationTemplate QSRequirementsTemplate].each do |k|\n report_error \"Unknown key: #{k.inspect}\" if @info[k]\n end\n if reg = self['QSRegistration']\n %w[QSPreferencePanesTemplate].each do |k|\n report_error \"Unknown key: QSRegistration/#{k.inspect}\" if @info[k]\n end\n end\n if @info['QSRegistryTables']\n report_error \"Check QSRegistryTables shouldn't be QSRegistration/QSRegistryHeaders instead\"\n end\n end",
"def validations\n valid_page_number? if page_number\n valid_period_name? if period_param\n valid_date? if date_param\n end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:rule_code => self.rule_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_rule\n\t end\nend",
"def validate_associations\n errors.add(:lesson_id, :doesnt_exist) if @lesson.nil?\n end",
"def validate\n validate_string_attributes\n @relations.map(&:validate)\n end",
"def answer_present\n if self.question.qtype == 'one_response' && self.response_id.nil?\n errors.add(:base, 'Please fill in an answer before leaving this page.' )\n return false\n elsif self.question.qtype == 'likert_scale' && self.response_id.nil?\n errors.add(:base, 'Please fill in an answer before leaving this page.' )\n return false\n\n elsif self.question.qtype == 'rank_three' \n responses = self.multianswers.map( &:rank ).compact\n if responses.length == 3 \n array_wanted = [1, 2, 3]\n if array_wanted == responses.sort\n return true\n else \n errors.add(:base, 'Please ensure all items are unique.' )\n return false\n end \n else \n errors.add(:base, 'Please ensure 3 items are ranked.' )\n return false\n end\n\n elsif self.question.qtype == 'rank_five' \n responses = self.multianswers.map( &:rank ).compact\n if responses.length == 5 \n array_wanted = [1, 2, 3, 4, 5]\n if array_wanted == responses.sort\n return true\n else \n errors.add(:base, 'Please ensure all items are unique.' )\n return false\n end \n else \n errors.add(:base, 'Please ensure 5 items are ranked.' )\n return false\n end\n end\n end",
"def validation; end",
"def validation; end",
"def validate!\n # Require that at least one field exist.\n if fields.length == 0\n raise SkyDB::Query::ValidationError.new(\"At least one selection field is required for #{self.inspect}.\")\n end\n\n fields.each do |field|\n field.validate!\n end\n\n groups.each do |group|\n group.validate!\n end\n end",
"def validates_associated_post_records; end",
"def validates_associated_post_records; end",
"def validations_for_diff\n []\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:mark_code => self.mark_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_mark\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def set_validations\n # TODO: Move below this line to the partition class itself\n @keys.each do |key|\n case key.type\n when :continuous\n partition_class.validates_uniqueness_of(\"#{key.column}_begin\", :scope => @keys.remaining_columns(\"#{key.column}_begin\"))\n partition_class.validates_uniqueness_of(\"#{key.column}_end\", :scope => @keys.remaining_columns(\"#{key.column}_end\"))\n when :discrete\n partition_class.validates_uniqueness_of(key.column, :scope => @keys.remaining_columns(key.column))\n end\n end\n end",
"def validate\n errors.add_to_base(\"Your Volume is to long, can only store 4 characters!\") if self.volume.to_s.length > 4\n errors.add_to_base(\"Your Number is to long, can only store 3 characters!\")if self.number.to_s.length > 3\n errors.add_to_base(\"Your Semester is to long, can only store 6 characters!\")if self.semester.to_s.length > 6\n end",
"def check_attributes\n if (@values == nil)\n puts \"Specify necessary informations: \"\n get_input_values\n @additions = Array.new()\n end\n #check_time_string\n end",
"def validate_time_entry\n errors.add :amount, :invalid if amount && (amount < 0 || amount >= 100000)\n errors.add :project_id, :invalid if project.nil?\n errors.add :issue_id, :invalid if (issue_id && !issue) || (issue && project!=issue.project)\n end",
"def set_validations_and_filters\n validates_length_of :numero_publicacion, :in => 6..12, :allow_nil => true, :allow_blank => true\n validates_presence_of :fecha_solicitud, :numero_gaceta\n validates_format_of :numero_solicitud, :with => /^\\d+-\\d{4}/\n validates_uniqueness_of :numero_solicitud#, :scope => :parent_id\n #validates_presence_of :numero_publicacion, :numero_gaceta\n end",
"def exercise2\n parse_data PositionalValidator\n validators.count(&:valid?)\n end",
"def set_errors\n \t@errors = []\n\n \tif self.title == \"\"\n \t@errors << \"Title cannot be blank\"\n \tend\n\n if self.user_id == nil\n @errors << \"Must assign to a user\"\n end\n\n if self.category_id == nil\n @errors << \"Must assign to a category\"\n end\n \tend",
"def check_questionnaires_usage\n @assignment_questionnaires.each do |aq|\n unless aq.used_in_round.nil?\n @reviewvarycheck = 1\n break\n end\n end\n end",
"def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:short_description => self.short_description}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_organization\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:target_market_name => self.target_market_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_target_market\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend",
"def valid_response_for_answer_sheet?(answers)\n return true if !self.required? \n answer = answers.detect {|a| a.question_id == self.id}\n return answer && answer.value.present?\n # raise answer.inspect \n end"
] | [
"0.75722075",
"0.7473526",
"0.71061856",
"0.6753984",
"0.6740886",
"0.6328018",
"0.62869096",
"0.6265097",
"0.6255514",
"0.61619836",
"0.6133373",
"0.6085529",
"0.60642105",
"0.60595024",
"0.6048596",
"0.60276264",
"0.6007795",
"0.59937245",
"0.5977655",
"0.5948401",
"0.59326863",
"0.59160894",
"0.5905734",
"0.5852139",
"0.58311874",
"0.5823068",
"0.58110493",
"0.57980114",
"0.5797295",
"0.5794704",
"0.5790649",
"0.5790649",
"0.5790649",
"0.57889766",
"0.576595",
"0.576158",
"0.57608765",
"0.57601553",
"0.5759407",
"0.57584417",
"0.5739629",
"0.57359904",
"0.573223",
"0.5698",
"0.56848115",
"0.5678692",
"0.56752974",
"0.56720245",
"0.567103",
"0.5668022",
"0.56652796",
"0.566174",
"0.5660347",
"0.5657303",
"0.56439793",
"0.56423205",
"0.56408703",
"0.56354123",
"0.56269956",
"0.56238693",
"0.5620928",
"0.5605747",
"0.55979687",
"0.55927163",
"0.5577613",
"0.5566916",
"0.5564569",
"0.55582255",
"0.5557591",
"0.55492336",
"0.5547409",
"0.55267304",
"0.55259305",
"0.55259305",
"0.55259305",
"0.55259305",
"0.5523732",
"0.5520199",
"0.55139714",
"0.55136055",
"0.55093044",
"0.55093044",
"0.5507056",
"0.5501792",
"0.5501792",
"0.54974884",
"0.5493987",
"0.5489334",
"0.5489334",
"0.5489334",
"0.5486502",
"0.5484359",
"0.5478468",
"0.54750305",
"0.5473112",
"0.54680383",
"0.5466234",
"0.5463488",
"0.5458015",
"0.5453657"
] | 0.7070859 | 3 |
Translation of CommonLisp code | def solve
1.upto(100).inject(:*).to_s.split('').map{|x| x.to_i}.inject(:+)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lang(orig); end",
"def tr_s(p0, p1) end",
"def _lex_trans_targs; end",
"def _lex_trans_targs; end",
"def _lex_trans_targs; end",
"def _lex_trans_targs; end",
"def tr(p0, p1) end",
"def lex_en_interp_string=(_arg0); end",
"def lex_en_interp_string=(_arg0); end",
"def lex_en_interp_string=(_arg0); end",
"def _lex_trans_keys=(_arg0); end",
"def _lex_trans_keys=(_arg0); end",
"def _lex_trans_keys=(_arg0); end",
"def _lex_trans_keys=(_arg0); end",
"def _reduce_582(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_582(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_582(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def lisp(*ops)\n case ops.length\n when 1\n send ops.first\n when 2\n sk!\n lisp *ops[0]\n lisp *ops[1]\n when 3\n sk! ; sk! ; sk! ; s\n lisp *ops[0]\n sk! ; k ; lisp *ops[2]\n lisp *ops[1]\n when 4\n sk! ; sk! ; sk! ; sk! ; s\n lisp *ops[0]\n sk! ; k ; lisp *ops[2]\n lisp *ops[1]\n lisp *ops[3]\n end\nend",
"def _reduce_585(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_585(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_610(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n\n result\nend",
"def _lex_trans_targs=(_arg0); end",
"def _lex_trans_targs=(_arg0); end",
"def _lex_trans_targs=(_arg0); end",
"def _lex_trans_targs=(_arg0); end",
"def _reduce_601(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n\n result\nend",
"def _reduce_580(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_580(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_580(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def lex_en_interp_words=(_arg0); end",
"def lex_en_interp_words=(_arg0); end",
"def lex_en_interp_words=(_arg0); end",
"def _reduce_541(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_542(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_584(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_584(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_584(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def lsi=(_arg0); end",
"def lsi=(_arg0); end",
"def lex_en_expr_value=(_arg0); end",
"def lex_en_expr_value=(_arg0); end",
"def lex_en_expr_value=(_arg0); end",
"def lex_en_expr_variable=(_arg0); end",
"def lex_en_expr_variable=(_arg0); end",
"def lex_en_expr_variable=(_arg0); end",
"def rassoc(p0) end",
"def _lex_trans_keys; end",
"def _lex_trans_keys; end",
"def _lex_trans_keys; end",
"def _lex_trans_keys; end",
"def lsi; end",
"def _reduce_587(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _lex_trans_actions=(_arg0); end",
"def _lex_trans_actions=(_arg0); end",
"def _lex_trans_actions=(_arg0); end",
"def _lex_trans_actions=(_arg0); end",
"def lh(t, s, c)\n\n end",
"def _reduce_603(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n\n result\nend",
"def lang=(_arg0); end",
"def lang=(_arg0); end",
"def _reduce_609(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n\n result\nend",
"def jisx0301(p1 = v1)\n #This is a stub, used for indexing\n end",
"def tr_s!(p0, p1) end",
"def _reduce_607(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n\n result\nend",
"def _reduce_607(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n\n result\nend",
"def lex_en_interp_string; end",
"def lex_en_interp_string; end",
"def lex_en_interp_string; end",
"def translate(str,open_b = false)\n return nil unless str.is_a? Array\n funct = \"\"\n state = 0\n while @i < str.size\n case state\n \n # beginning state\n when 0\n case str[@i]\n when /[\\+\\-]/\n funct += str[@i]\n state = 1\n when /\\p{Alpha}/\n if Tool.f.include? str[@i] then\n funct += \"Math::#{str[@i]}\"\n state = 4 unless str[@i] == \"PI\"\n state = 2 if str[@i] == \"PI\"\n elsif str[@i].size == 1\n ch = str[@i].downcase\n funct += ch\n @vars << ch unless @vars.include? ch\n state = 2\n else\n return nil\n end\n when /[0-9]+/\n if str[@i].integer? or str[@i].float? then\n funct += str[@i]\n state = 2\n else\n return nil\n end\n when \"(\"\n funct += \"(\"\n @i += 1\n part = translate(str,true)\n state = 2\n if part != nil then\n funct += part\n else\n return nil\n end\n else\n return nil\n end\n \n # state 1 expects or a variable (single char) or a number or a function or (\n when 1\n case str[@i]\n when /\\p{Alpha}/\n if Tool.f.include? str[@i] then\n funct += \"Math::#{str[@i]}\"\n state = 4 unless str[@i] == \"PI\"\n state = 2 if str[@i] == \"PI\"\n elsif str[@i].size == 1\n ch = str[@i].downcase\n funct += ch\n @vars << ch unless @vars.include? ch\n state = 2\n else\n return nil\n end\n when /[0-9]+/ \n if str[@i].integer? or str[@i].float? then\n funct += str[@i]\n state = 2\n else\n return nil\n end\n when \"(\"\n funct += \"(\"\n state = 3\n else\n return nil\n \n end\n \n # state 2 expects an operator or )\n when 2\n if /[\\+\\-\\*\\/\\^]{1}/ =~ str[@i] then\n funct += str[@i] if str[@i] != \"^\"\n funct += \"**\" if str[@i] == \"^\"\n state = 1\n elsif str[@i] == \")\"\n if open_b then\n return funct + \")\"\n else\n return nil\n end\n else\n return nil\n end\n \n # state 3 expects a sub_expression not beginnin with (\n when 3\n part = translate(str,true)\n state = 2\n if part != nil then\n funct += part\n else\n return nil\n end\n \n # state 4 expects a sub_expression beginning with (\n when 4\n if str[@i] == '(' then\n @i += 1\n part = translate(str,true)\n state = 2\n if part != nil then\n funct += '(' + part\n else\n return nil\n end\n else\n return nil\n end\n \n else\n return nil\n end\n @i += 1\n end\n return nil if state == 1\n return funct\n end",
"def _lex_trans_actions; end",
"def _lex_trans_actions; end",
"def _lex_trans_actions; end",
"def _lex_trans_actions; end",
"def _reduce_583(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = \"&#{identifier}\".to_sym\n \n result\nend",
"def _reduce_712(val, _values, result)\n _, (id, line) = val\n identifier = id.to_sym\n\n self.env[identifier] = :lvar\n result = [\"&#{identifier}\".to_sym, line]\n\n result\nend",
"def jal(c)\n\n end",
"def lex_en_expr_variable; end",
"def lex_en_expr_variable; end",
"def lex_en_expr_variable; end",
"def lex_en_expr_mid; end",
"def lex_en_expr_mid; end",
"def lex_en_expr_mid; end",
"def expressions_from_iseq(bytecodes, locals)\n bytecodes.reduce([]) do |stack, inst|\n puts \"INST: #{inst}\"\n # annoyingly, labels have have their own format\n # UGGGGLY, TODO: refactor\n if inst.is_a?(Symbol) && inst.to_s =~ /^label/\n if ih = self.half_pop_if(inst, stack)\n stack << ih\n elsif iff = self.pop_if(inst, stack)\n stack << iff \n else \n stack << Label.new(inst)\n end\n\n next stack\n elsif inst.is_a?(Fixnum)\n # TODO: What's with the plain numbers?\n next stack\n end\n\n case inst[0]\n # TODO\n when :throw \n # TODO?\n when :trace, :pop, :putnil, :leave\n \n when :branchunless\n test = stack.pop\n if_hole = IfHole.new(test, inst[1], nil, nil, nil)\n stack << if_hole\n when :branchif\n stack << self.pop_while(inst, stack)\n when :jump\n stack << Jump.new(inst[1])\n\n when :putobject_OP_INT2FIX_O_0_C_ \n stack << Literal.new(0)\n when :putobject_OP_INT2FIX_O_1_C_ \n stack << Literal.new(1)\n when :putobject\n stack << Literal.new(inst[1])\n when :putstring\n stack << Literal.new(inst[1])\n when :putself\n stack << Self.new\n when :newarray\n stack << self.pop_array(inst[1], stack)\n when :duparrray\n stack << ArrayLiteral.new(inst[1].map{ |v| Literal.new(v)})\n\n when :getlocal\n stack << self.get_local(inst[2], inst[1])\n when :getlocal_OP__WC__1\n stack << self.get_local(1, inst[1])\n when :getlocal_OP__WC__0\n stack << self.get_local(0, inst[1])\n\n when :setlocal\n stack << self.pop_assignment(inst[2], inst[1], stack)\n when :setlocal_OP__WC__1\n stack << self.pop_assignment(1, inst[1], stack)\n when :setlocal_OP__WC__0\n stack << self.pop_assignment(0, inst[1], stack)\n\n when :send\n stack << self.pop_expression(inst[1], stack)\n when :opt_send_simple\n stack << self.pop_expression(inst[1], stack)\n when :opt_lt\n stack << self.pop_expression(inst[1], stack)\n when :opt_le\n stack << self.pop_expression(inst[1], stack)\n when :opt_plus\n stack << self.pop_expression(inst[1], stack)\n # TODO: The other opts and sends\n else\n puts \"UNKNOWN\"\n end\n\n stack\n end\n end",
"def robject2csource obj, namespace, strmax, volatilep = false, name = nil, contentsp = false\n decl = 'VALUE'\n vdef = 'Qundef'\n init = nil\n deps = Array.new\n expr = nil\n case obj\n when Quote # hack\n name ||= obj.unquote.to_s\n when Fixnum\n name ||= 'LONG2FIX(%d)' % obj\n when TrueClass, FalseClass, NilClass\n name ||= 'Q%p' % obj\n when Bignum\n # Bignums can be large enough to exceed C's string max. From this\n # method's usage a bignum reaching this stage is sourced from a Ruby\n # source code's bignum literals, so they might not be much larger\n # though.\n name ||= namespace.new 'num_' + obj.to_s\n rstr = robject2csource obj.to_s, namespace, strmax, :volatile\n init = sprintf \"rb_str2inum(%s, 10)\", rstr\n deps << rstr\n when Float\n name ||= namespace.new 'float_' + obj.to_s\n init = sprintf 'rb_float_new(%s)', obj\n when Range\n from = robject2csource obj.begin, namespace, strmax, :volatile\n to = robject2csource obj.end, namespace, strmax, :volatile\n xclp = obj.exclude_end? ? 1 : 0\n init = sprintf \"rb_range_new(%s, %s, %d)\", from, to, xclp\n name ||= namespace.new\n deps << from << to\n when Class\n # From my investigation over the MRI implementation, those three\n # classes are the only classes that can appear in an instruction\n # sequence. Don't know why though.\n init = if obj == Object then 'rb_cObject'\n elsif obj == Array then 'rb_cArray'\n elsif obj == StandardError then 'rb_eStandardError'\n else\n raise TypeError, \"unknown literal object #{obj}\"\n end\n when String\n #if obj.empty?\n ## Empty strings are lightweight enough, do not need encodings.\n #name ||= 'rb_str_new(0, 0)'\n #else\n # Like I write here and there Ruby strings can be much longer than\n # C strings can be. Plus a Ruby string has its encoding. So when\n # we reconstruct a Ruby string, we need a set of C strings plus an\n # encoding object.\n #if obj.ascii_only?\n #name ||= $namespace.new 'str_' + obj\n #aenc = Encoding.find 'US-ASCII'\n #encn = robject2csource aenc, namespace, strmax, :volatile\n #else\n name ||= namespace.new 'str_' + obj.encoding.name + '_' + obj\n encn = robject2csource obj.encoding, namespace, strmax, :volatile, nil, true\n #end\n deps << encn\n argv = rstring2cstr obj, strmax\n argv.each do |i|\n if init\n x = sprintf \";\\nrb_enc_str_buf_cat(%s, %s, %d, %s)\",\n name, *i, encn\n init << x\n else\n init = sprintf \"rb_enc_str_new(%s, %d, %s)\", *i, encn\n end\n end\n if $YARVAOT_DEBUG\n #init << \";\\n /* #{obj} */\"\n end\n #end\n when Encoding\n # Thank goodness, encoding names are short and will never contain\n # multilingual chars.\n rstr = obj.name\n if contentsp\n decl = 'rb_encoding*'\n vdef = '0'\n init = 'rb_enc_find(\"%s\")' % rstr\n name ||= namespace.new 'enc_' + rstr\n else\n encn = robject2csource obj, namespace, strmax, :volatile, nil, true\n deps << encn\n init = 'rb_enc_from_encoding(%s)' % encn\n name ||= namespace.new 'encval_' + rstr\n end\n when Symbol\n str = obj.id2name\n if str.bytesize <= strmax\n # Why a symbol is not cached as a VALUE? Well a VALUE in C static\n # variable needs to be scanned during GC because VALUEs can have\n # links against some other objects in general. But that's not the\n # case for Symbols -- they do not have links internally. An ID\n # variable needs no GC because it's clear they are not related to\n # GC at all. So a Symbol is more efficient when stored as an ID,\n # rather than a VALUE.\n a = rstring2cstr str, strmax\n e = robject2csource str.encoding, namespace, strmax, :volatile, nil, true\n name = namespace.new 'sym_' + obj.to_s\n decl = 'ID'\n vdef = '0'\n init = sprintf 'rb_intern3(%s, %d, %s);', *a[0], e\n expr = 'ID2SYM(%s)' % name.name\n deps << e\n else\n # Longer symbols are much like regexps\n name ||= namespace.new 'sym_' + str\n rstr = robject2csource str, namespace, strmax, :volatile\n init = 'rb_str_intern(%s)' % rstr\n deps << rstr\n end\n when Regexp\n opts = obj.options\n srcs = robject2csource obj.source, namespace, strmax, :volatile\n name ||= namespace.new \"reg#{opts}_\" + srcs.to_s\n init = sprintf 'rb_reg_new_str(%s, %d)', srcs, opts\n deps << srcs\n when Array\n n = obj.length\n if n == 0\n # zero-length arrays need no cache, because a creation of such\n # object is fast enough.\n name ||= 'rb_ary_new2(0)'\n #elsif n == 1\n ## no speedup, but a bit readable output\n #i = obj.first\n #e = robject2csource i, namespace, strmax, :volatile\n #j = as_tr_cpp e.to_s\n #s = 'a' + j\n #name ||= $namespace.new s\n #init = 'rb_ary_new3(1, %s)' % e\n #deps << e\n elsif n <= 30\n # STDC's max # of function arguments are 31, so at most 30 elems\n # are made at once.\n init = 'rb_ary_new3(%d' % obj.length\n obj.each do |x|\n y = robject2csource x, namespace, strmax, :volatile\n init << \",\\n \" << y.to_s\n deps << y\n end\n init << ')'\n s = init.sub %r/\\Arb_ary_new3\\(\\d+,\\s+/, 'a'\n name ||= namespace.new 'ary_' + s\n else\n # Too large to create at once. Feed litte by litte.\n name ||= namespace.new\n init = 'rb_ary_new()'\n obj.each do |i|\n j = robject2csource i, namespace, strmax, :volatile\n k = sprintf 'rb_ary_push(%s, %s)', name, j\n init << \";\\n \" << k\n deps << j\n end\n end\n when Hash\n # Hashes are not computable in a single expression...\n name ||= namespace.new\n init = \"rb_hash_new()\"\n obj.each_pair do |k, v|\n knam = robject2csource k, namespace, strmax, :volatile\n vnam = robject2csource v, namespace, strmax, :volatile\n aset = sprintf 'rb_hash_aset(%s, %s, %s)', name, knam, vnam\n init << \";\\n \" << aset\n deps << knam << vnam\n end\n else\n raise TypeError, \"unknown literal object #{obj.inspect}\"\n end\n\n name ||= namespace.new init\n case name when namespace\n static_decl = \"static #{decl}\"\n if volatilep and name.declaration == static_decl\n # OK? same object, different visibility\n elsif not volatilep and name.declaration == decl\n # OK? same object, different visibility\n name.force_set_decl! static_decl\n else\n name.declaration = volatilep ? decl : static_decl\n end\n name.definition = \"#{name.declaration} #{name.name} = #{vdef};\"\n name.initialization = \"#{name.name} = #{init};\" if init\n name.expression = expr\n deps.each do |i|\n case i when namespace\n name.dependencies.push i\n end\n end\n end\n return name\n end",
"def _lex_indicies=(_arg0); end",
"def _lex_indicies=(_arg0); end",
"def _lex_indicies=(_arg0); end",
"def _lex_indicies=(_arg0); end",
"def lex_en_expr_value; end",
"def lex_en_expr_value; end",
"def lex_en_expr_value; end",
"def _reduce_739(val, _values, result)\n _, (id, line) = val\n identifier = id.to_sym\n\n self.env[identifier] = :lvar\n result = [\"&#{identifier}\".to_sym, line]\n\n result\nend",
"def _reduce_103(val, _values, result)\n result = s(:lit, val[0].to_sym) \n result\nend",
"def _reduce_103(val, _values, result)\n result = s(:lit, val[0].to_sym) \n result\nend",
"def _reduce_103(val, _values, result)\n result = s(:lit, val[0].to_sym) \n result\nend",
"def compileterm\n\n end",
"def lex_en_expr_mid=(_arg0); end",
"def lex_en_expr_mid=(_arg0); end",
"def lex_en_expr_mid=(_arg0); end",
"def _reduce_273(val, _values, result)\n result = lexer.line\n \n result\nend",
"def ruby_convert(tokens)\n expr = \"\"\n for token in tokens\n token = \"=>\" if token == \":\" # Ruby hash syntax\n token = \"nil\" if token == \"null\"\n expr += token\n end\n expr\n end"
] | [
"0.5733104",
"0.5729288",
"0.57260764",
"0.57260764",
"0.57260764",
"0.57260764",
"0.57031924",
"0.56993705",
"0.56993705",
"0.56993705",
"0.56439537",
"0.56439537",
"0.56439537",
"0.56439537",
"0.56269896",
"0.56269896",
"0.56269896",
"0.5622827",
"0.5599281",
"0.5599281",
"0.55955684",
"0.5590382",
"0.5590382",
"0.5590382",
"0.5590382",
"0.55868167",
"0.55522954",
"0.55522954",
"0.55522954",
"0.55456656",
"0.55456656",
"0.55456656",
"0.5538483",
"0.55310255",
"0.5524563",
"0.5524563",
"0.5524563",
"0.55194056",
"0.55194056",
"0.55151755",
"0.55151755",
"0.55151755",
"0.55050325",
"0.55050325",
"0.55050325",
"0.5504364",
"0.55007005",
"0.55007005",
"0.55007005",
"0.55007005",
"0.5490793",
"0.5490741",
"0.5489834",
"0.5489834",
"0.5489834",
"0.5489834",
"0.5485807",
"0.54850996",
"0.5484798",
"0.5484798",
"0.5479335",
"0.5457219",
"0.5453004",
"0.54438573",
"0.54438573",
"0.54412323",
"0.54412323",
"0.54412323",
"0.5432296",
"0.54316044",
"0.54316044",
"0.54316044",
"0.54316044",
"0.54293936",
"0.54223233",
"0.5416387",
"0.5405628",
"0.5405628",
"0.5405628",
"0.53958756",
"0.53958756",
"0.53958756",
"0.53771776",
"0.5371418",
"0.53537357",
"0.53537357",
"0.53537357",
"0.53537357",
"0.5340364",
"0.5340364",
"0.5340364",
"0.53158027",
"0.5289377",
"0.5289377",
"0.5289377",
"0.52848536",
"0.52683073",
"0.52683073",
"0.52683073",
"0.5263723",
"0.5239373"
] | 0.0 | -1 |
Produces a speech from V For Vendetta. | def speech
fetch('v_for_vendetta.speeches')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def speech; end",
"def speak\n object_instance = object_instances.last\n Liquid::Template.parse(text_to_voice).render(object_instance.try(:attributes))\n end",
"def song(verse_a, verse_b)\np \"#{verse_a} #{verse_b}\"\nend",
"def create_speech(*options)\n CreateSpeech.new(self, options).run\n end",
"def speak(message = '', context = [])\n return @mouth.construct_sentence(message,context)\n end",
"def speech(title = nil, hint: nil, result_type: :text)\n args = owner.generate_args_list([['speech'],\n ['-t', title],\n ['-i', hint]\n ])\n single_result(args, result_type)\n end",
"def part_of_speech\n raise NotImplementedError\n end",
"def to_s\n '<Twilio::REST::Voice::V1>';\n end",
"def voice\n reminder = Reminder.find(params[:id])\n \tresponse = Twilio::TwiML::Response.new do |r|\n r.Say 'This is a reminder message from the Remmyo service.',:voice => 'alice'\n \t r.Say reminder.message, :voice => 'alice'\n r.Say 'End of message.',:voice => 'man'\n # r.Play 'http://linode.rabasa.com/cantina.mp3'\n \tend\n\n \trender_twiml response\n end",
"def audio_gen(slide)\n term = slide['term']\n kind = slide['kind'] || nil\n index = slide['index'] || nil\n file_name = file_name_gen(slide, \".WAV\")\n say = command_arg('[[slnc 1000]]' + slide['script'] + '[[slnc 1000]]')\n output = command_arg(file_name)\n `say -v Jill #{say} -o #{output}`\n slide['audio'] = file_name\nend",
"def vox(start, dur, freq, amp, ampfun, freqfun, freqscl, voxfun, index, vibscl)\n f1 = []\n f2 = []\n f3 = []\n (voxfun.length - 1).step(1, -2) do |i|\n phon = Formants[voxfun[i]]\n x = voxfun[i - 1]\n f1.unshift(phon[0])\n f1.unshift(x)\n f2.unshift(phon[1])\n f2.unshift(x)\n f3.unshift(phon[2])\n f3.unshift(x)\n end\n car_os = make_oscil(:frequency, 0)\n of0 = make_oscil(:frequency, 0)\n of1 = make_oscil(:frequency, 0)\n of2 = make_oscil(:frequency, 0)\n of3 = make_oscil(:frequency, 0)\n of4 = make_oscil(:frequency, 0)\n of5 = make_oscil(:frequency, 0)\n ampf = make_env(:envelope, ampfun, :scaler, amp, :duration, dur)\n frmf1 = make_env(:envelope, f1, :duration, dur)\n frmf2 = make_env(:envelope, f2, :duration, dur)\n frmf3 = make_env(:envelope, f3, :duration, dur)\n freqf = make_env(:envelope, freqfun, :duration, dur, :scaler, freqscl * freq, :offset, freq)\n per_vib = make_triangle_wave(:frequency, 6, :amplitude, freq * vibscl)\n ran_vib = make_rand_interp(:frequency, 20, :amplitude, freq * 0.01)\n run_instrument(start, dur) do\n frq = env(freqf) + triangle_wave(per_vib) + rand_interp(ran_vib)\n car = index * oscil(car_os, hz2radians(frq))\n frm = env(frmf1)\n frm0 = frm / frq.to_f\n frm_int = frm0.floor\n if frm_int.even?\n frq0 = hz2radians(frm_int * frq)\n frq1 = hz2radians((frm_int + 1) * frq)\n amp1 = frm0 - frm_int\n amp0 = 1.0 - amp1\n else\n frq1 = hz2radians(frm_int * frq)\n frq0 = hz2radians((frm_int + 1) * frq)\n amp0 = frm0 - frm_int\n amp1 = 1.0 - amp0\n end\n frm = env(frmf2)\n frm0 = frm / frq.to_f\n frm_int = frm0.floor\n if frm_int.even?\n frq2 = hz2radians(frm_int * frq)\n frq3 = hz2radians((frm_int + 1) * frq)\n amp3 = frm0 - frm_int\n amp2 = 1.0 - amp3\n else\n frq3 = hz2radians(frm_int * frq)\n frq2 = hz2radians((frm_int + 1) * frq)\n amp2 = frm0 - frm_int\n amp3 = 1.0 - amp2\n end\n frm = env(frmf3)\n frm0 = frm / frq.to_f\n frm_int = frm0.floor\n if frm_int.even?\n frq4 = hz2radians(frm_int * frq)\n frq5 = hz2radians((frm_int + 1) * frq)\n amp5 = frm0 - frm_int\n amp4 = 1.0 - amp5\n else\n frq5 = hz2radians(frm_int * frq)\n frq4 = hz2radians((frm_int + 1) * frq)\n amp4 = frm0 - frm_int\n amp5 = 1.0 - amp4\n end\n env(ampf) * (0.8 * (amp0 * oscil(of0, frq0 + 0.2 * car) +\n amp1 * oscil(of1, frq1 + 0.2 * car)) +\n 0.15 * (amp2 * oscil(of2, frq2 + 0.5 * car) +\n amp3 * oscil(of3, frq3 + 0.5 * car)) +\n 0.05 * (amp4 * oscil(of4, frq4 + car) +\n amp5 * oscil(of5, frq5 + car)))\n end\nend",
"def to_s\n '#<Twilio::REST::Voice>'\n end",
"def voice\n # Give Twilio the TwiML payload instructions\n twiml_payload\n end",
"def synthesize(message)\n input = { text: message }\n voice = { language_code: \"en-US\" }\n audio_config = { audio_encoding: :MP3 }\n\n @client.synthesize_speech(input, voice, audio_config)\n end",
"def voice\n response = Twilio::TwiML::Response.new do |r|\n r.Say 'Hey there. Congrats on integrating Twilio into your Rails 4 app.', :voice => 'alice'\n r.Play 'http://linode.rabasa.com/cantina.mp3'\n end\n \n render_twiml response\n end",
"def speak\n \"This animal is silent.\"\n end",
"def vd(value=1)\n @music.vd(value.to_i)\n end",
"def speak\n \"#{name} says Assalaam alaykum\"\n end",
"def vobsub_lang \n send_cmd(\"vobsub_lang\")\n end",
"def voice\n twiml do |r|\n r.Say \"Welcome to #{@session.current_state.titleize}... This area is currently under construction.\"\n r.Pause length: 2\n r.Say \"Have a nice day\"\n end\n end",
"def speak(utterance)\n prints utterance\n end",
"def vu(value=1)\n @music.vu(value.to_i)\n end",
"def speak\n \"#{name} says arf!\"\n end",
"def passive_voice_subjunctive_mood_present_tense\n end",
"def fadeSpeech _obj, _args\n \"_obj fadeSpeech _args;\" \n end",
"def speak\n \"#{name} says Arf!\"\n end",
"def speak\r\n \"#{name} say Arf!\"\r\n end",
"def speak \n \"#{self.name} says arf!\"\n end",
"def gong(start, dur, freq, amp, *args)\n degree, distance, reverb_amount = nil\n optkey(args, binding,\n [:degree, 0.0],\n [:distance, 1.0],\n [:reverb_amount, 0.005])\n mfq1 = freq * 1.16\n mfq2 = freq * 3.14\n mfq3 = freq * 1.005\n indx01 = hz2radians(0.01 * mfq1)\n indx11 = hz2radians(0.30 * mfq1)\n indx02 = hz2radians(0.01 * mfq2)\n indx12 = hz2radians(0.38 * mfq2)\n indx03 = hz2radians(0.01 * mfq3)\n indx13 = hz2radians(0.50 * mfq3)\n atpt = 5\n atdur = 100 * (0.002 / dur)\n expf = [0, 0, 3, 1, 15, 0.5, 27, 0.25, 50, 0.1, 100, 0]\n rise = [0, 0, 15, 0.3, 30, 1.0, 75, 0.5, 100, 0]\n fmup = [0, 0, 75, 1.0, 98, 1.0, 100, 0]\n fmdwn = [0, 0, 2, 1.0, 100, 0]\n ampfun = make_env(:envelope, stretch_envelope(expf, atpt, atdur),\n :scaler, amp, :duration, dur)\n indxfun1 = make_env(:envelope, fmup, :scaler, indx11 - indx01,\n :duration, dur, :offset, indx01)\n indxfun2 = make_env(:envelope, fmdwn, :scaler, indx12 - indx02,\n :duration, dur, :offset, indx02)\n indxfun3 = make_env(:envelope, rise, :scaler, indx13 - indx03,\n :duration, dur, :offset, indx03)\n carrier = make_oscil(:frequency, freq)\n mod1 = make_oscil(:frequency, mfq1)\n mod2 = make_oscil(:frequency, mfq2)\n mod3 = make_oscil(:frequency, mfq3)\n run_instrument(start, dur,\n :degree, degree,\n :distance, distance,\n :reverb_amount, reverb_amount) do\n env(ampfun) *\n oscil(carrier,\n env(indxfun1) * oscil(mod1) +\n env(indxfun2) * oscil(mod2) +\n env(indxfun3) * oscil(mod3))\n end\nend",
"def speak\n \"#{@name} says Arf!!\"\n end",
"def generate\n\t\t@vs = \"vitalsource\"\n\t\t@question = [\"What is your Student ID number?\",\"What is your favorite color?\",\"In what city were you born?\",\"What is your pet's name?\",\"What is your mother's maiden name?\"]\n\tend",
"def speakIntoFiles(spanishText, germanText, englishText)\n @spanishText = spanishText\n @germanText = germanText\n @englishText = englishText\n\n\n readingSpeedES = 140\n readingSpeedDE = 180\n readingSpeedEN = 140\n\n spanishVoice = \"Jorge\"\n germanVoice = \"Markus\"\n englishVoice =\"Susan\"\n\n # we set the character length of the file name\n # languageFileDE = \"#{germanText[0,55]}\"\n languageFileES = \"#{spanishText[0,20].chomp}\"\n languageFileEN = \"#{englishText[0,20].chomp}\"\n languageFileDE = \"#{germanText[0,20].chomp}\"\nputs `say -v #{spanishVoice} -r #{readingSpeedES} \"#{spanishText}\" -o \"#{languageFileES}\".aif`\nputs `say -v #{germanVoice} -r #{readingSpeedDE} \"#{germanText}\" -o \"#{languageFileDE}\".aif`\nputs `say -v #{englishVoice} -r #{readingSpeedEN} \"#{englishText}\" -o \"#{languageFileEN}\".aif`\nend",
"def generate_sentence\n # Splitting into an array is required for easily preventing duplicate vals\n sent = Drama::Constants::SENTENCES.sample.split(/\\s/)\n sent.each do |w|\n num = sent.index(w)\n sent[num] = w % {\n things: Drama::Constants::THINGS.sample,\n sites: Drama::Constants::SITES.sample,\n people: Drama::Constants::PEOPLE.sample,\n says: Drama::Constants::SAYS.sample,\n badsoft: Drama::Constants::BADSOFT.sample,\n function: Drama::Constants::FUNCTIONS.sample,\n adj: Drama::Constants::ADJECTIVES.sample,\n enormous: Drama::Constants::SIZES.sample,\n price: Drama::Constants::PRICES.sample,\n ac1: Drama::Constants::BADVERBS.sample,\n packs: Drama::Constants::PACKS.sample,\n drama: Drama::Constants::DRAMA.sample,\n code: Drama::Constants::CODE.sample,\n ban: Drama::Constants::BANS.sample,\n activates: Drama::Constants::ACTIVATES.sample\n }\n end\n\n # add_a_drama\n sent.join(' ')\n end",
"def speak\n \"#{name} says arf!\"\n end",
"def speak\n \"#{@name} says Arf!\"\n end",
"def speak\n \"#{name} says wuff!\"\n end",
"def speak\n \"#{self.name} says arf!\"\n end",
"def pa\n return VasmGrammar.new, VasmTransform.new\nend",
"def speech_to_text(file_contents, type='audio/wav', speech_context='Generic', options = {})\n resource = \"/speech/v3/speechToText\"\n\n # FIXME: Is this necessary?\n if type == \"application/octet-stream\"\n type = \"audio/amr\"\n end\n\n headers = {\n :Authorization => \"Bearer #{@access_token}\",\n :Content_Transfer_Encoding => 'chunked',\n :Accept => 'application/json'\n }\n\n if options.has_key?(:grammar)\n # Assume this is a Speech-To-Text-Custom query\n resource << 'Custom'\n options[:grammar] = \"<?xml version=\\\"1.0\\\"?>\\n#{options[:grammar]}\"\n body = {\n 'x-grammar' => Faraday::UploadIO.new(StringIO.new(options[:grammar]), 'application/srgs+xml'),\n 'x-voice' => Faraday::UploadIO.new(StringIO.new(file_contents), type)\n }\n else\n headers[:X_SpeechContext] = speech_context\n body = file_contents\n end\n\n response = @connection.post resource, body, headers\n\n result = process_response(response)\n result\n end",
"def vat(unknown)\n\t\t#vf = vo + at\n\t\tcase unknown\n\t\twhen :vfy\n\t\t\tvars[:voy] + (vars[:ay] * vars[:t])\n\t\twhen :voy\n\t\t\tvars[:vfy] - (vars[:ay] * vars[:t])\n\t\twhen :t\n\t\t\t(vars[:vfy] - vars[:voy])/vars[:ay]\n\t\tend\n\tend",
"def audio; end",
"def speak\n \"#{@name} says arf!\"\n end",
"def speak\n \"#{@name} says arf!\"\n end",
"def present_conjugate\n\t\tif defined?(@stem)\n\t\t\t[\"ich #{@stem}e\",\n\t\t\t\"du #{@stem}st\",\n\t\t\t\"er,sie, es #{@stem}t\",\n\t\t\t\"wir #{@stem}en\",\n\t\t\t\"ihr #{@stem}t\",\n\t\t\t\"sie,Sie #{@stem}en\"]\n\t\telse\n\t\t\tputs \"Could not work with the verb: #{@infinitive}\"\n\t\tend\n\tend",
"def active_voice_subjunctive_mood_present_tense\n end",
"def setSpeech _obj, _args\n \"_obj setSpeech _args;\" \n end",
"def speak\n puts \"WOOF WOOF\"\n end",
"def passive_voice_indicative_mood_future_tense\n end",
"def set_speech\n @speech = Speech.find(params[:id])\n end",
"def voices\n Say::VOICES\n end",
"def voices\n @voices.each do |name, saying|\n puts name.strip\n end\n end",
"def wookie_sentence; end",
"def speak\n\t`say 'I am a product.`\nend",
"def sound; end",
"def speak\n @arr = 'Shiber Me Timbers You Scurvey Dogs!!'\n @speak_a.push(\"@what\", \"@arr\")\n @speak = speak.a.join(/\\n /)\n end",
"def speak meaning\n MyLogger.debug \"Player ##{id} speaking #{meaning}\"\n word = lookup(meaning, should_invent?)\n Utterance.new(meaning, word) unless word.nil?\n end",
"def vin; end",
"def dance_to_music \n \"Feel the rhythm\"\n end",
"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 speak_as_normal(element)\n reverse_speak_as(element, 'spell-out')\n reverse_speak_as(element, 'literal-punctuation')\n reverse_speak_as(element, 'no-punctuation')\n reverse_speak_as(element, 'digits')\n end",
"def sing_loop(starting_verse, ending_verse=0)\n starting_verse.downto(ending_verse).inject(\"\") do |song, verse_number|\n song << verse(verse_number) + \"\\n\"\n end\n end",
"def initialize\n @villano = 'Siniestro'\n @frase = 'Tacos and Chimichangas!!!!'\n end",
"def speech\n \n @profile = ProfileId.all\n @hello = 'HELLO'\n # @score = @identified['identifiedProfile']['score']\n end",
"def speak\n \"#{@name} says Arf!\" # using instance variables in methods\n end",
"def play\n voice = User.find_by(id: current_user.id).tts_voice\n logger.info '================ START TTS ==============='\n answer_audio_file = TtsService.call(@entry, voice)\n logger.info '================ END TTS ==============='\n respond_to do |format|\n format.html do\n response.headers[\"Cache-Control\"] = \"no-cache, no-store\"\n response.headers[\"Pragma\"] = \"no-cache\"\n response.headers[\"Expires\"] = \"Mon, 01 Jan 1990 00:00:00 GMT\"\n expires_in 1.seconds, public: true\n send_file(answer_audio_file, type: 'audio/mpeg', disposition: 'inline')\n end\n end\n end",
"def call\n system(SPEECH_COMMAND)\n end",
"def to_s\n string = VTT_HEADER.dup\n string << \"\\n\\n\"\n cues.each do |cue|\n string << milliseconds_to_timecode(cue.start_time)\n string << ' --> '\n string << milliseconds_to_timecode(cue.end_time)\n string << \"\\n\"\n string << cue.text\n string << \"\\n\\n\"\n end\n string\n end",
"def speak\n \"#{name} says arf!\"\nend",
"def speak\n \"#{name} says arf!\"\nend",
"def speak\n \"#{name} says arf!\"\nend",
"def to_s\n rval = \"\"\n rval += \" pesa #{@peso} kilos , mide #{@altura} metros, tiene #{@edad} años y es\"\n if(sexo == 1)\n rval+= \" un hombre\"\n else\n rval+= \" una mujer\"\n end\n rval\n end",
"def part_of_speech\n _response_word.fetch(\"partOfSpeech\", nil)\n end",
"def speak\r\n\t\tputs \"Ho, ho, ho! Merry Christmas and Haaaappy holidays to all!\"\r\n\tend",
"def speak\n #\"#{@name} says arf!\"\n #\"#{name} says arf!\"\n \"#{self.name} says arf!\"\n end",
"def synthesize(protein)\n adn = ''\n for a in (0..protein.length-1)\n aminoacido = protein[a,1]\n entropy = rand(100-10) + 10\n \n \n if (@aminoacidos.include?(aminoacido))\n \n adn = adn + @codons[aminoacido][entropy % (@codons[aminoacido].length)]\n end\n \n end\n @synthesize = adn\n end",
"def create\n\n @verse = Verse.new(:text => params[:verse], :song_id => params[:song_id], :user_id => params[:user_id])\n\n @song = Song.find_by_id(params[:song_id])\n\n respond_to do |format|\n if @verse.save\n format.html { redirect_to @song, notice: 'Verse was successfully created.' }\n format.json { render json: @song, status: :created, location: @song }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @verse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def t2pv(v)\n v.direction - 0.5 * PI\n end",
"def fm_v(start = 0, dur = 1, freq = 440, amp = 0.5, fm_index = 1, amp_env = [0, 1, 1, 1])\n frq_scl = hz2radians(freq)\n maxdev = frq_scl * fm_index\n index1 = maxdev * (5.0 / log(freq))\n index2 = maxdev * 3.0 * ((8.5 - log(freq)) / (3.0 + freq / 1000.0))\n index3 = maxdev * (4.0 / sqrt(freq))\n carrier = make_oscil(:frequency, freq)\n fmosc1 = make_oscil(:frequency, freq)\n fmosc2 = make_oscil(:frequency, freq * 3.0)\n fmosc3 = make_oscil(:frequency, freq * 4.0)\n ampf = make_env(:envelope, amp_env, :scaler, amp, :duration, dur)\n indf1 = make_env(:envelope, [0, 1, 25, 0.4, 75, 0.6, 100, 0], :scaler, index1, :duration, dur)\n indf2 = make_env(:envelope, [0, 1, 25, 0.4, 75, 0.6, 100, 0], :scaler, index2, :duration, dur)\n indf3 = make_env(:envelope, [0, 1, 25, 0.4, 75, 0.6, 100, 0], :scaler, index3, :duration, dur)\n pervib = make_triangle_wave(:frequency, 0.5, :amplitude, 0.0025 * frq_scl)\n ranvib = make_rand_interp(:frequency, 16.0, :amplitude, 0.005 * frq_scl)\n run_instrument(start, dur) do\n vib = triangle_wave(pervib) + rand_interp(ranvib)\n env(ampf) * oscil(carrier,\n vib + \\\n env(indf1) * oscil(fmosc1, vib) + \\\n env(indf2) * oscil(fmosc2, 3.0 * vib) + \\\n env(indf3) * oscil(fmosc3, 4.0 * vib))\n end\n end",
"def to_s\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Voice.V1.CountryContext #{context}>\"\n end",
"def speak\n puts 'bark bark bark'\n end",
"def create\n @speech = Speech.new(speech_params)\n\n respond_to do |format|\n if @speech.save\n format.html { redirect_to @speech, notice: 'Speech was successfully created.' }\n format.json { render :show, status: :created, location: @speech }\n else\n format.html { render :new }\n format.json { render json: @speech.errors, status: :unprocessable_entity }\n end\n end\n end",
"def speak\n\t\tputs \"My name is #{@name}. I am a #{@colour} dog. I am #{@age} years old and live in #{@home}\"\n\tend",
"def active_voice_indicative_mood_future_tense\n end",
"def speak\n puts \"ho, ho, ho! happy hollandaise!\"\n end",
"def subject_for(from_name, conversation_with, verb=\"sent\", suffix=\"video\")\n \n case conversation_with.count\n when 0 \n \"#{from_name} #{verb} you #{suffix}\"\n when 1\n \"#{from_name} #{verb} you and #{nickname_for_user_or_email(conversation_with[0])} #{suffix}\"\n when 2\n \"#{from_name} #{verb} you, #{nickname_for_user_or_email(conversation_with[0])} and #{nickname_for_user_or_email(conversation_with[1])} #{suffix}\"\n else\n others = conversation_with[0..1].map { |p| nickname_for_user_or_email(p) } .join(\", \")\n \"#{from_name} #{verb} you, #{others} and #{pluralize(conversation_with.count-2, 'other')} #{suffix}\"\n end\n end",
"def speak\n response = Twilio::TwiML::Response.new do |r|\n r.Say 'hello there', :voice => 'woman'\n end\n @xml=response.text\nend",
"def speak\n \"#{@name} says arf!\"\nend",
"def speak\n \"#{@name} says arf!\"\nend",
"def speak\n \"#{@name} says arf!\"\nend",
"def speak\n \"#{@name} says arf!\"\nend",
"def speak\n \"#{@name} says arf!\"\nend",
"def speak\n \"#{@name} says arf!\"\nend",
"def noun; end",
"def noun; end",
"def to_file(message, filename)\n speech = self.synthesize message\n \n File.open(filename, \"wb\") do |f|\n f.write(speech.audio_content)\n end\n end",
"def speak\n super(\"Woof\")\n end",
"def get_vct\n \"#{@calorias} kcal\" \n end",
"def main_audio ; end",
"def speak\n\t\tputs \"Meow. My name is #{@name.capitalize}.\"\n\t\tputs \"I am #{@age} years old and I live in #{@location}\"\n\t\tputs \"I am a #{@colour.downcase} #{@breed.downcase}.\"\n\tend",
"def speak\n p \"Ho, ho, ho! Haaaappy holidays!\"\n end"
] | [
"0.6464186",
"0.5780375",
"0.57137156",
"0.5661812",
"0.5639414",
"0.54925907",
"0.54823005",
"0.54450345",
"0.54207647",
"0.54061383",
"0.5394538",
"0.53883016",
"0.5357197",
"0.53524727",
"0.5351263",
"0.53418714",
"0.5319124",
"0.5303272",
"0.5272527",
"0.5261624",
"0.525705",
"0.520812",
"0.519717",
"0.51954806",
"0.5185824",
"0.51573384",
"0.5154221",
"0.5150815",
"0.5139347",
"0.5126294",
"0.51187587",
"0.5116978",
"0.51166415",
"0.5116599",
"0.5114206",
"0.5110314",
"0.50965804",
"0.5090399",
"0.5090146",
"0.508091",
"0.50616384",
"0.50594795",
"0.50594795",
"0.5056574",
"0.50559986",
"0.50505275",
"0.50424266",
"0.50109994",
"0.5010291",
"0.50036645",
"0.49961808",
"0.4993809",
"0.4988233",
"0.4984201",
"0.49830958",
"0.49731842",
"0.49712852",
"0.4956687",
"0.49330243",
"0.49278638",
"0.49174765",
"0.49112633",
"0.49009204",
"0.48903248",
"0.48896784",
"0.48814183",
"0.48813298",
"0.48747596",
"0.48747596",
"0.48747596",
"0.4866355",
"0.48645723",
"0.4861632",
"0.48606187",
"0.48515907",
"0.4847617",
"0.48441574",
"0.48426563",
"0.4833196",
"0.48275846",
"0.48250142",
"0.48194435",
"0.48144236",
"0.48138562",
"0.48096707",
"0.4808894",
"0.48060143",
"0.48060143",
"0.48060143",
"0.48060143",
"0.48060143",
"0.48060143",
"0.4805375",
"0.4805375",
"0.4798754",
"0.47952005",
"0.47935468",
"0.4793169",
"0.47875726",
"0.47830507"
] | 0.76637614 | 0 |
Produces a quote from V For Vendetta. | def quote
fetch('v_for_vendetta.quotes')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def marvin_quote; end",
"def king_richard_iii_quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote; end",
"def quote(value); end",
"def quotes; end",
"def quote\n fetch('movie.quote')\n end",
"def quote\n quote_of_the_day[0...second_to_last_index(quote_of_the_day, \"~\")].gsub(/(\\A[^a-zA-z0-9\"']*|\\s*\\z)/, \"\")\n end",
"def quote_date(v)\n quote_string v.strftime(ISO8601_DATE)\n end",
"def get_vct\n \"#{@calorias} kcal\" \n end",
"def quote\n fetch('stargate.quotes')\n end",
"def quote\n fetch('final_space.quotes')\n end",
"def quotes\n end",
"def quote\n fetch('brooklyn_nine_nine.quotes')\n end",
"def quote_identifier(v)\n schema_utility_dataset.quote_identifier(v)\n end",
"def quote_identifier(v)\n schema_utility_dataset.quote_identifier(v)\n end",
"def quote_identifier(v)\n schema_utility_dataset.quote_identifier(v)\n end",
"def quote_identifier(v)\n schema_utility_dataset.quote_identifier(v)\n end",
"def tex_quote\n to_s.tex_quote\n end",
"def quote\n fetch('dumb_and_dumber.quotes')\n end",
"def quote\n fetch('cowboy_bebop.quote')\n end",
"def quote_for_node(v, node, parent)\n case node\n when Nodes::Function, Nodes::Literal\n quote(v)\n when Nodes::Predicate\n quote_for_node(v, node.expr, parent)\n when Symbol, Nodes::Stub # MySQL hates freedom\n quote_for_attribute v, visit(node, parent)\n else\n v\n end\n end",
"def quote\n @quote ||= quote_hash\n end",
"def quote\n fetch('princess_bride.quotes')\n end",
"def quote\n fetch('the_office.quotes')\n end",
"def my_quote\n\tend",
"def quote\n fetch('heroes_of_the_storm.quotes')\n end",
"def quote\n %Q{\"#{self}\"}\n end",
"def literal_string(v)\n \"'#{v.gsub(\"'\", \"''\")}'\"\n end",
"def romeo_and_juliet_quote; end",
"def convert_smart_quote(el)\r\n t = case el.value\r\n when :lsquo\r\n \"\\u2018\"\r\n when :rsquo\r\n \"\\u2019\"\r\n when :ldquo\r\n \"\\u201C\"\r\n when :rdquo\r\n \"\\u201D\"\r\n end\r\n #puts \"smartquote sub #{t}\"\r\n %{para(\"#{t}\", :margin_left => 0, :margin_right => 0)}\r\n end",
"def quote\n fetch('harry_potter.quotes')\n end",
"def to_Qdl\n gsub /\\\"/,\"'\"\n end",
"def quote\n fetch('ghostbusters.quotes')\n end",
"def quote\n fetch('simpsons.quotes')\n end",
"def quote\n fetch('rick_and_morty.quotes')\n end",
"def quote\n fetch('new_girl.quotes')\n end",
"def to_s\n \"#{get_titulo} #{get_porcentaje}\\n#{get_conjunto_platos}\\nV.C.T. | % #{get_vct} | #{get_proteinas} - #{get_grasas} - #{get_hidratos}\" \n end",
"def quote_time(v)\n quote_string v.strftime(ISO8601_DATETIME)\n end",
"def set_quote\n \n end",
"def ver(v, typ)\n v.gsub!(/ (?:^.+ \\sAS\\s (.+$))? | \\s+() | ^v() /nix, \"\\\\1\")\n case typ\n when :deb\n v.gsub!(/[-@](dev|patch).*$/, \"~~\")\n v.gsub!(/[-@](alpha|beta|RC|stable).*$/, \"~\")\n when :rpm\n v.gsub!(/[-@](dev|patch|alpha|beta|RC|stable).*$/, \"\")\n else\n v.gsub!(/@/, \"-\")\n end\n return v\n end",
"def quote\n @gapi.csv_options.quote\n end",
"def quote\n @gapi.csv_options.quote\n end"
] | [
"0.6398001",
"0.5817355",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5687348",
"0.5679043",
"0.5621414",
"0.5611444",
"0.5605798",
"0.5568263",
"0.554693",
"0.55202585",
"0.55125505",
"0.55002666",
"0.54978424",
"0.5448358",
"0.5448358",
"0.54254824",
"0.54254824",
"0.542512",
"0.5408974",
"0.5399404",
"0.53838104",
"0.5383235",
"0.5322393",
"0.5319578",
"0.5316643",
"0.5305993",
"0.5292334",
"0.52794635",
"0.5246101",
"0.52032125",
"0.51942044",
"0.5188767",
"0.51803523",
"0.517993",
"0.51717573",
"0.5118002",
"0.51135886",
"0.5101644",
"0.5079579",
"0.5078078",
"0.50756323",
"0.50756323"
] | 0.74163526 | 0 |
Download a recording of a webinar downloading the webinar records via the download url is only possible if: you enable redirection you use the JWT access token will not work with the Oauth token. This is a known bug in the API. | def meeting_recordings_download_file(download_url)
raise "You must use JWT client" unless self.class == Zoom::Clients::JWT
file=Tempfile.create
file.binmode
response = HTTParty.get("#{download_url}?access_token=#{access_token}",
stream_body: true,
follow_redirects: true
) do |fragment|
if fragment.code == 200
file.write(fragment)
elsif fragment.code != 302
raise StandardError, "Non-success status code while streaming #{fragment.code}"
end
end
file
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download(recording, filename = nil)\n \n # If no filename is given, we default to <title>_<recstartts>.<extension>\n if filename.nil?\n filename = recording.title + \"_\" +\n recording.myth_nondelimited_recstart + File.extname(recording.filename) \n end\n\n File.open(filename, \"wb\") do |f|\n stream(recording.path) { |data| f.write(data); puts \".\" }\n end\n end",
"def download_a_recording_file_with_http_info(recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.download_a_recording_file ...'\n end\n\n # verify the required parameter 'recording_id' is set\n if @api_client.config.client_side_validation && recording_id.nil?\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling DefaultApi.download_a_recording_file\"\n end\n # resource path\n local_var_path = '/Accounts/{accountId}/Recordings/{recordingId}/Download'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'recordingId' + '}', CGI.escape(recording_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['audio/x-wav'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'File'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['fc']\n\n new_options = opts.merge(\n :operation => :\"DefaultApi.download_a_recording_file\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#download_a_recording_file\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def download_file()\n # gets the student we are watching\n @student = Student.find(params[:id]);\n # Here we wanna decrypt the file\n decr_file = decrypt_file(@student)\n # we make the file downloadable\n send_file(decr_file,\n :filename => @student.file,\n :type => @student.file.content_type,\n :disposition => 'attachment',\n :url_based_filename => true)\n end",
"def download_link\n return_hash = {}\n if params.has_key?(\"web_ids\")\n web_ids_str = params[\"web_ids\"]\n web_ids = web_ids_str.split(\"~\")\n if !web_ids.respond_to?(:count) || web_ids.count < 1\n return_hash[\"status\"] = \"error\"\n return_hash[\"error\"] = \"no web_ids after split\"\n render(json: return_hash.to_json, content_type: request.format, layout: false)\n end\n web_ids.each(&:strip!)\n parametrized_doi = @dataset.identifier.parameterize\n download_hash = DownloaderClient.datafiles_download_hash(@dataset, web_ids, \"DOI-#{parametrized_doi}\")\n if download_hash\n if download_hash[\"status\"] == \"ok\"\n web_ids.each do |web_id|\n datafile = Datafile.find_by(web_id: web_id)\n if datafile\n # Rails.logger.warn \"recording datafile download for web_id #{web_id}\"\n datafile.record_download(request.remote_ip)\n else\n # Rails.logger.warn \"did not find datafile for web_id #{web_id}\"\n end\n end\n return_hash[\"status\"] = \"ok\"\n return_hash[\"url\"] = download_hash[\"download_url\"]\n return_hash[\"total_size\"] = download_hash[\"total_size\"]\n else\n return_hash[\"status\"] = \"error\"\n return_hash[\"error\"] = download_hash[\"error\"]\n end\n else\n return_hash[\"status\"] = \"error\"\n return_hash[\"error\"] = \"nil zip link returned\"\n end\n render(json: return_hash.to_json, content_type: request.format, layout: false)\n else\n return_hash[\"status\"] = \"error\"\n return_hash[\"error\"] = \"no web_ids in request\"\n render(json: return_hash.to_json, content_type: request.format, layout: false)\n end\n end",
"def download\n @resume = Resume.find(params[:id])\n if @current_user and ( (@current_user == @resume.person) or (@current_user.in_groups?(['superusers', 'indrel'])) )\n send_file @resume.file, type: 'application/pdf', x_sendfile: true\n else\n redirect_to :root, notice: \"Insufficient privileges to access this page.\"\n end\n end",
"def download\n api_url = build_url\n RestClient::Request.execute(method: 'GET', url: api_url, open_timeout: 20)\n end",
"def download\r\n download = Download.find params[:id]\r\n \r\n # If this download is available only after login, execute an authentication process.\r\n return if download.restrict && !user_authentication\r\n \r\n # Download contains an agreement\r\n if download.agreement\r\n # Redirect to the agreement page if it is a GET request.\r\n unless request.post?\r\n render :partial => 'agreement', :object => download.agreement, :layout => true\r\n return false\r\n end\r\n \r\n if params[:commit] == 'Accept'\r\n # User accept this agreement, log this event and then continue.\r\n agreement_log = AgreementLog.create(\r\n :agreement => download.agreement,\r\n :download => download,\r\n :remote_ip => request.remote_ip,\r\n :store_user => (session[:web_user].nil? ? nil : session[:web_user]),\r\n :http_header => request.env.to_yaml\r\n )\r\n else\r\n # User does not accept this agreement, redirect to support page.\r\n redirect_to :action => 'index'\r\n return false\r\n end\r\n end\r\n \r\n # Generate a symbolic link for this file to download.\r\n # After deploied on server, a CRON job will clean up these links every 30 minutes.\r\n path = Digest::SHA1.hexdigest(\"#{session.session_id} @ #{Time.now.to_f}\")\r\n path << \".u_#{session[:web_user].id}\" if download.restrict\r\n path << \".a_#{agreement_log.id}\" if download.agreement\r\n filename = download.filename\r\n \r\n FileUtils.mkdir \"./public/downloads/#{path}\" unless File.directory? \"./public/downloads/#{path}\"\r\n target_file = \"./public/downloads/#{path}/#{filename}\"\r\n \r\n # Codes for test only. Delete 2 lines below.\r\n # render :text => \"Redirect to /downloads/#{path}/#{filename}\"\r\n # return false\r\n \r\n unless File.symlink(\"#{RAILS_ROOT}/downloads/#{download.filename}\", target_file) == 0\r\n render :text => \"Sorry, system is busy now. Please try again several seconds later.\"\r\n return false\r\n end\r\n \r\n # Log this file name in database.\r\n File.open('log/download.log', 'a') { |file| file.puts \"downloads/#{path}/#{filename}\" }\r\n\r\n redirect_to \"/downloads/#{path}/#{filename}\"\r\n end",
"def download_conference_recording_with_http_info(account_id, conference_id, recording_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConferencesApi.download_conference_recording ...'\n end\n # verify the required parameter 'account_id' is set\n if @api_client.config.client_side_validation && account_id.nil?\n fail ArgumentError, \"Missing the required parameter 'account_id' when calling ConferencesApi.download_conference_recording\"\n end\n # verify the required parameter 'conference_id' is set\n if @api_client.config.client_side_validation && conference_id.nil?\n fail ArgumentError, \"Missing the required parameter 'conference_id' when calling ConferencesApi.download_conference_recording\"\n end\n # verify the required parameter 'recording_id' is set\n if @api_client.config.client_side_validation && recording_id.nil?\n fail ArgumentError, \"Missing the required parameter 'recording_id' when calling ConferencesApi.download_conference_recording\"\n end\n # resource path\n local_var_path = '/api/v2/accounts/{accountId}/conferences/{conferenceId}/recordings/{recordingId}/media'.sub('{' + 'accountId' + '}', CGI.escape(account_id.to_s)).sub('{' + 'conferenceId' + '}', CGI.escape(conference_id.to_s)).sub('{' + 'recordingId' + '}', CGI.escape(recording_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['audio/vnd.wave', 'audio/mpeg', 'application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'File'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['httpBasic']\n\n new_options = opts.merge(\n :operation => :\"ConferencesApi.download_conference_recording\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConferencesApi#download_conference_recording\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def download\n @video = Video.find(params[:id])\n send_file(RAILS_ROOT+\"/public\"[email protected](\"?\")[0], :disposition => 'inline', :stream => false)\n end",
"def download_link\n return_hash = Hash.new\n if params.has_key?('web_ids')\n web_ids_str = params['web_ids']\n web_ids = web_ids_str.split('~')\n if !web_ids.respond_to?(:count) || web_ids.count < 1\n return_hash[\"status\"] = \"error\"\n return_hash[\"error\"] = \"no web_ids after split\"\n render(json: return_hash.to_json, content_type: request.format, :layout => false)\n end\n web_ids.each(&:strip!)\n parametrized_doi = @dataset.identifier.parameterize\n download_hash = DownloaderClient.datafiles_download_hash(@dataset, web_ids, \"DOI-#{parametrized_doi}\")\n if download_hash\n if download_hash['status'] == 'ok'\n web_ids.each do |web_id|\n datafile = Datafile.find_by_web_id(web_id)\n if datafile\n #Rails.logger.warn \"recording datafile download for web_id #{web_id}\"\n datafile.record_download(request.remote_ip)\n else\n #Rails.logger.warn \"did not find datafile for web_id #{web_id}\"\n end\n end\n return_hash[\"status\"] = \"ok\"\n return_hash[\"url\"] = download_hash['download_url']\n return_hash[\"total_size\"] = download_hash['total_size']\n else\n return_hash[\"status\"] = \"error\"\n return_hash[\"error\"] = download_hash[\"error\"]\n end\n else\n return_hash[\"status\"] = \"error\"\n return_hash[\"error\"] = \"nil zip link returned\"\n end\n render(json: return_hash.to_json, content_type: request.format, :layout => false)\n else\n return_hash[\"status\"] = \"error\"\n return_hash[\"error\"] = \"no web_ids in request\"\n render(json: return_hash.to_json, content_type: request.format, :layout => false)\n end\n end",
"def download_note_collection\n collection = Collection.find(params[:id])\n authorize! :download_note_collection, collection\n upload = Upload.find(params[:upload_id])\n \n send_file upload.upfile.path, \n :filename => upload.upfile_file_name, \n :type => 'application/octet-stream'\n end",
"def download_note\n document = Document.find(params[:id])\n authorize! :download_note, document\n \n begin\n upload = Upload.find(params[:upload_id])\n rescue\n puts \"### ERROR: \" + e.message\n redirect_to show_path(document), notice: \"ERROR: file (upload) ID not found. Upload may have been deleted\"\n return\n end\n \n send_file upload.upfile.path, \n :filename => upload.upfile_file_name, \n :type => 'application/octet-stream'\n end",
"def download\n log.warn(log_key) { source[:warning] } if source.key?(:warning)\n\n options = {}\n\n if source[:unsafe]\n log.warn(log_key) { \"Permitting unsafe redirects!\" }\n options[:allow_unsafe_redirects] = true\n end\n\n # Set the cookie if one was given\n options[\"Cookie\"] = source[:cookie] if source[:cookie]\n options[\"Authorization\"] = source[:authorization] if source[:authorization]\n\n download_file!(download_url, downloaded_file, options)\n end",
"def download(save_path=\"\")\n url = prefix + \"download\"\n r = response(url) \n if r.class == String #success\n open(File.join(save_path,@filename), \"wb\").write(open(r).read)\n return r\n else #failed\n return r\n end\n end",
"def download_a_recording_file(recording_id, opts = {})\n data, _status_code, _headers = download_a_recording_file_with_http_info(recording_id, opts)\n data\n end",
"def download\n @paystub = Paystub.find( params[:id] )\n\n if File.exists?(@paystub.filespec)\n send_file @paystub.filespec,\n\t filename: @paystub.filename,\n type: \"application/pdf\",\n disposition: :attachment\n else\n flash.now[:danger] = \"File #{@paystub.filename} was not found - regenerating\" \n redirect_to export_paystub_path(@paystub)\n end\n end",
"def download\n\n session[:current_folder] = params[:folder]\n mixpanel_tab_event(\"My Vault\", \"Download File\")\n download_url = Rails.cache.fetch(\"/download_url/#{params[:id]}\", :expires_in => 10.minutes) do\n user_client.download_url(params[:id])\n end\n redirect_to download_url\n end",
"def download\n document = Document.find(params[:document_id])\n tempfile = open(document.url)\n send_data tempfile.read, :filename => document.title, :type => document.content_type\n end",
"def download\n if Rails.env.production?\n redirect_to @upload.archive.expiring_url(10)\n else\n redirect_to @upload.archive.url\n end\n end",
"def download_response\n {\n url: external_download_url\n }.with_indifferent_access\n end",
"def download(save_path=\"\")\n url = prefix + \"download\"\n r = response(url)\n if r.class == String #success\n open(::File.join(save_path,@filename), \"wb\").write(open(r).read)\n return r\n else #failed\n return r\n end\n end",
"def download\n grade_entry_form = record\n send_data grade_entry_form.export_as_csv(current_role),\n disposition: 'attachment',\n type: 'text/csv',\n filename: \"#{grade_entry_form.short_identifier}_grades_report.csv\"\n end",
"def download_file url\n check_session\n result = api_client.execute(:uri => url)\n if result.status == 200\n return result.body\n else\n puts \"An error occurred: #{result.data['error']['message']}\"\n return nil\n end\n end",
"def download_files(session, dump_folder, episode)\n recordings_folder = session.collection_by_url(ENV['GOOGLE_DRIVE_FOLDER_URL'])\n episode_folder = recordings_folder.subcollections(q: [\"name contains ?\", episode])[0]\n \n if episode_folder == nil\n puts \"No calls for this episode.\"\n else\n episode_folder.files(q: [\"mimeType = ?\", \"audio/mpeg\"]) do |file|\n puts \"Downloading #{file.title} ...\"\n file.download_to_file(\"#{dump_folder}/#{file.title}\")\n end\n \n # Write episode name to file\n puts \"Recording episode name as #{episode_folder.title} ...\"\n File.write(\"#{dump_folder}/episode_name.txt\", episode_folder.title)\n end\nend",
"def download\n file = UserFile.exist_refresh_state(@context, params[:uid])\n\n if file.state != UserFile::STATE_CLOSED\n raise ApiError, \"Files can only be downloaded if they are in the 'closed' state\"\n end\n\n if file.license.present? && !file.licensed_by?(@context)\n raise ApiError, \"You must accept the license before you can download this\"\n end\n\n file_url = file.file_url(@context, params[:inline])\n\n respond_to do |format|\n format.html do\n redirect_to URI.parse(file_url).to_s\n end\n\n format.json do\n render json: {\n file_url: file_url,\n file_size: file.file_size,\n }, adapter: :json\n end\n end\n end",
"def download\n record_activity(\"downloaded \" + params[:file_name])\n send_file Rails.root.join('public', 'uploads', params[:file_name])\n end",
"def nexmo_get_cr(recording_url,file_name,tmp_dir,location=nil)\n\t\t# tmp_dir = 'public/wav/'\n\t\tclaims = {\n\t\t application_id: APP_ID,\n\t\t private_key: APP_KEY,\n\t\t nbf: 1483315200,\n\t\t ttl: 800\n\t\t}\n\n\t\ttoken = Vonage::JWT.generate(claims)\n\t\turl = URI(recording_url)\n\n\t\thttps = Net::HTTP.new(url.host, url.port);\n\t\thttps.use_ssl = true\t\n\t\t# https.set_debug_output(STDOUT)\n\n\t\trequest = Net::HTTP::Get.new(url)\n\t\trequest[\"Content-Type\"] = \"application/json\"\n\t\trequest[\"Authorization\"] = \"Bearer #{token}\"\n\n\t\tfile_loc = open(\"#{tmp_dir}#{file_name}\", 'wb')\n\t\t$app_logger.info \"#{__FILE__.split('/')[-1]}.#{__method__}:#{__LINE__} | CR_DOWNLOAD | Download to : #{file_loc}\"\n\t\t\n\t\tdownload_file_response_code = nil\n\t\tbegin\n\t\t\thttps.request(request) do |response|\n\t\t\t\tdownload_file_response_code = response.code\n\t\t\t\tresponse.read_body do |chunk|\n\t\t\t\t\tfile_loc.write(chunk)\n\t\t\t\tend\n\t\t\tend\n\t\trescue => e\n\t\t\t$app_logger.info \"#{__FILE__.split('/')[-1]}.#{__method__}:#{__LINE__} | CR_DOWNLOAD ERROR | #{e}\"\n\t\tensure\n\t\t\tfile_loc.close\n\t\tend\n\n\t\ts3_object = nil\n\t\tif location == :s3\n\t\t\ts3_object = S3_CLIENT.put_object(\n\t\t\t\t{\n\t\t\t\t\tbody: file_loc,\n\t\t\t\t\tbucket: S3_BUCKET,\n\t\t\t\t\tkey: file_name\n\t\t\t\t}\n\t\t\t)\n\t\t\t$app_logger.info \"#{__FILE__.split('/')[-1]}.#{__method__}:#{__LINE__} | CR_DOWNLOAD | AWS_S3 : #{s3_object}\"\n\t\t\t# File.delete(file_loc)\n\t\tend\n\t\t\n\t\treturn download_file_response_code,s3_object\n\tend",
"def download!(source_url, destination_file); end",
"def download\n if current_user\n filepath = params[:file_path]\n send_file(filepath,filename:filepath.split('/')[-1],type:'application/csv' ,status:202)\n else\n return render 'shared/result',locals:{status:false, error:\"未授權\"}\n end\n end",
"def download\r\n redirect_to(explore_path) and return unless params[:id]\r\n # TODO: cipher this so that someone can't easily download all of the content\r\n @track = Track.downloadable.find_by_id(params[:id])\r\n if @track && @track.public? \r\n KarmaPoint.create_from_id(session[:karma_point_id], :content => @track, :action => :download)\r\n redirect_to @track.s3_url if @track.respond_to?(:s3_url)\r\n Activity.send_message(@track, @track.user, :content_download_initiated, :to_user => current_actor)\r\n else\r\n flash[:error] = 'Track not found or hidden'.t\r\n redirect_to(explore_path)\r\n end\r\n end",
"def download\n res = @stash_identifier.last_submitted_resource\n if res&.download_uri\n res = @stash_identifier.last_submitted_resource\n StashEngine::CounterLogger.version_download_hit(request: request, resource: res) if res\n redirect_to res.merritt_producer_download_uri # latest version, friendly download because that's what we do in UI for object\n else\n render text: 'download for this dataset is unavailable', status: 404\n end\n end",
"def download\n # Retrieve \"file_id\" parameter.\n @file_id = params[:file_id]\n\n # Verify if the :file_id exists with the help of our StorageMock class.\n # This sample can only be executed if the provided file exists.\n unless exist?(@file_id)\n render text: 'Not Found', status: 404 && return\n end\n\n file_path = get_data_path(@file_id)\n\n # Check if doc already has a verification code registered on storage.\n verification_code = get_verification_code(@file_id)\n if verification_code.to_s.empty?\n # If not, generate a code and register it.\n verification_code = generate_verification_code\n set_verification_code(@file_id, verification_code)\n end\n\n # Generate the printer-friendly version.\n pfv_content = generate_printer_friendly_version(file_path, verification_code)\n # Return the generate file.\n send_data pfv_content, :filename => \"printer-friendly.pdf\"\n end",
"def download\n @assessment = Assessment.find(params[:id])\n if current_user.role.name.eql?('Support Team')\n @assessment.update_attribute(:status,5)\n end\n send_file process_zip(@assessment,@assessment.asset)\n end",
"def download\n file = BruseFile.find_by(:download_hash => params[:download_hash])\n if file.identity.user == current_user\n # send the file to the user\n send_data file.identity.get_file(file.foreign_ref), filename: file.name, type: file.filetype\n end\n end",
"def download_asset(asset)\n @user_api.file_download(\n asset.dxid,\n filename: asset.name,\n project: asset.project,\n preauthenticated: true,\n )[\"url\"]\n end",
"def download_sample\n if can?(:>, \"4\")\n send_file Rails.public_path+\"/excel/Import/sample_file_part_upload.csv\", :disposition => \"attachment\"\n else\n redirect_to main_app.unauthorized_url\n end\n end",
"def download\n @plan = Plan.find(params[:id])\n authorize @plan\n @phase_options = @plan.phases.order(:number).pluck(:title, :id)\n @phase_options.insert(0, ['All phases', 'All']) if @phase_options.length > 1\n @export_settings = @plan.settings(:export)\n render 'download'\n end",
"def streaming_download(url, opts)\n params = {\n :content_length_proc => opts[:content_length_proc],\n :progress_proc => opts[:progress_proc],\n 'Authorization' => \"Bearer #{@access_token.token}\"\n }\n \n open(url, params)\n end",
"def download\r\n logger.info(\"UserController::download:---#{params}\")\r\n end",
"def download(server, id)\n make_request(\n :get,\n \"/download/#{server}/#{id}\",\n headers: { 'Accept' => '*/*' },\n base: @media_uri\n )\n end",
"def download_link\n download_params = { :sub => 'download', :fileid => @fileid, :filename => @remote_filename, :cookie => @api.cookie }\n DOWNLOAD_URL % [ @server_id, @short_host, download_params.to_query ]\n end",
"def download_history\n agent = User.find(params[:id])\n respond_to do |format|\n format.pdf do\n pdf = DownloadHistory.new(agent)\n send_data pdf.render, filename: \"#{agent.name}_history\",\n type: 'application/pdf',\n disposition: 'inline'\n end\n end\n end",
"def file_url(context, inline, generate_event = true)\n if challenge_file?\n token = CHALLENGE_BOT_TOKEN\n result = DNAnexusAPI.new(CHALLENGE_BOT_TOKEN).call(\n \"system\",\n \"describeDataObjects\",\n objects: [dxid],\n )[\"results\"][0]\n project = result[\"describe\"][\"project\"]\n else\n token = context.token\n project = self.project\n end\n\n opts = {\n project: project,\n preauthenticated: true,\n filename: name,\n duration: 86_400,\n }\n inline_attribute = inline.present? ? \"?inline\" : \"\"\n\n api = DNAnexusAPI.new(token)\n url = api.file_download(dxid, opts)[\"url\"] + inline_attribute\n Event::FileDownloaded.create_for(self, context.user) if generate_event\n\n url\n end",
"def download(api_params)\n File.open(File.basename(api_params[:download_location]), 'wb') do |file|\n file.write(api_params[\"data\"])\n end\n end",
"def download_to_server full_url, path, ext\n require 'open-uri'\n\n user_directory = IMAGE_DIRECTORY + \"/#{session[:access_token].params['edam_userId']}\"\n unless File.directory? IMAGE_DIRECTORY\n Dir::mkdir( IMAGE_DIRECTORY ) # 第二パラメータ省略時のパーミッションは0777\n end\n\n unless File.directory? user_directory\n Dir::mkdir( user_directory ) # 第二パラメータ省略時のパーミッションは0777\n end\n\n file_name = user_directory + \"/\" + path + '.' + ext\n\n # TODO is this instance variable visible from the controller which include this module?\n @selected_file << file_name\n unless File.exists?(file_name)\n File.open(file_name, 'wb') do |output|\n # Download image\n # TODO: handle if session access token is nil\n open(full_url + \"?auth=#{session[:access_token].token}\") do |input|\n output << input.read\n end\n end\n end\n end",
"def download_file\n @request = Request.find_by_n_request(params[:id])\n send_data(@request.file, type: @request.file_type, filename: @request.file_name,\n disposition: 'attachment')\n end",
"def download_file(method, endpoint, params={})\n params.merge!({ :token => self.token })\n request = self.send(\"format_#{method}\", \"#{@url.path}/#{endpoint}\", params)\n file = Tempfile.new(\"crocodoc-download-#{params[:uuid]}\")\n # use streaming to keep memory usage sane\n @http.request(request) do |response|\n response.read_body {|chunk| file.write chunk }\n end\n file.close\n file\n end",
"def download_url(**opt)\n opt[:expires_in] ||= ONE_TIME_USE_EXPIRATION\n attached_file&.url(**opt)\n end",
"def download\n ExtensionVersion.increment_counter(:web_download_count, @version.id)\n Extension.increment_counter(:web_download_count, @extension.id)\n BonsaiAssetIndex::Metrics.increment('extension.downloads.web')\n DailyMetric.increment(@version.download_daily_metric_key)\n\n redirect_to helpers.download_url_for(@version)\n end",
"def download\n create_agent\n login\n fetch_feed\n create_catalog\n download_catalog\n end",
"def download_link\n s3 = Aws::S3::Client.new\n signer = Aws::S3::Presigner.new(client: s3)\n signer.presigned_url(\n :get_object,\n bucket: ENV['SEATSHARE_S3_BUCKET'],\n key: path,\n expires_in: 86_400\n )\n end",
"def download\n open(download_url, \"rb\")\n end",
"def download\n response = Clickmeetings.with_client(client_options) do\n Clickmeetings.client.connect.get remote_url(__method__, id: id) do |req|\n req.headers.merge! default_headers\n end\n end\n response.body\n end",
"def generate_download\n # TODO: to support scoping by other filters\n # we will have to scope all filter params throughout by their target base\n # e.g. collection_object[param]\n a = nil\n\n q = ::Queries::CollectionObject::Filter.new(params)\n q.project_id = nil\n\n if q.all(true)\n q.project_id = sessions_current_project_id\n a = DwcOccurrence.by_collection_object_filter(\n filter_scope: q.all,\n project_id: sessions_current_project_id)\n else\n a = DwcOccurrence.where(project_id: sessions_current_project_id)\n if params[:dwc_occurrence_start_date]\n a = a.where('dwc_occurrences.updated_at < ? and dwc_occurrences.updated_at > ?', params[:dwc_occurrence_start_date], params[:dwc_occurrence_end_date])\n end\n end\n\n @download = ::Export::Dwca.download_async(a, request.url, predicate_extension_params: predicate_extension_params )\n render '/downloads/show'\n end",
"def download(filename = nil)\n self.get_info\n return nil if @deleted\n resp = nil\n Net::HTTP.start('www.nicovideo.jp') do |http|\n resp = http.get('/watch/' + @video_id,\n {'Cookie' => 'user_session=' + @user_session.session_id})\n end\n adc = {}\n resp.each do |k, v|\n if k.downcase == 'set-cookie'\n z = v.split(';')\n z.map!{|cp| cp.gsub(/(^ +)|( +$)/, '')}\n hsh = {}\n z.each do |ckchr|\n ckchra = ckchr.split('=', 2)\n hsh[ckchra[0]] = ckchra[1]\n end\n hsh.each do |nk, nv|\n adc[nk] = nv unless ['expires', 'path', 'domain', 'secure'].include?(nk)\n end\n end\n end\n movie_url = access_getflv_api['url'][0]\n return if movie_url == nil\n resp3 = nil\n huri = URI.parse(movie_url)\n cks = {'user_session' => @user_session.session_id}.merge(adc)\n ckarr = []\n cks.each do |ckk, ckv|\n ckarr.push(ckk + '=' + ckv)\n end\n ckstr = ckarr.join('; ')\n Net::HTTP.start(huri.host) do |http|\n resp3 = http.get(huri.request_uri, {'Cookie' => ckstr})\n end\n return unless resp3.code.to_i == 200\n if filename == nil\n return resp3.body\n elsif filename.respond_to?(:write)\n filename.write(resp3.body)\n else\n File.open(filename, 'wb') do |file|\n file.write resp3.body\n end\n end\n end",
"def download_provider\n provider_app_detail_ids = ProviderAppDetail.where(fk_audit_trail_id: params[:audit_id]).pluck(:sys_provider_app_detail_id)\n @providers = Provider.where(\"fk_provider_app_detail_id in (?)\", provider_app_detail_ids)\n reg_app = AuditTrail.find(params[:audit_id]).registered_app\n\n respond_to do |format|\n format.html\n format.csv { send_data @providers.to_csv(reg_app, {}), :type => 'text/csv; charset=utf-8; header=present',\n :disposition => \"attachment; filename= #{reg_app.app_name}_Providers_#{DateTime.now.to_s}.csv\" }\n end\n end",
"def download_raw\n document = Document.find(params[:id])\n authorize! :download_raw, document\n \n begin\n upload = Upload.find( document.stuffing_upload_id )\n rescue ActiveRecord::RecordNotFound => e\n puts \"### ERROR: \" + e.message\n redirect_to show_data_path(document), notice: \"ERROR: file (upload) ID not found. Upload may have been deleted\"\n return\n end\n \n send_file upload.upfile.path, \n :filename => upload.upfile_file_name, \n :type => 'application/octet-stream'\n end",
"def download(params, save_as)\n info = self.class.get('/files.info', query: params.merge({token: @token})).tap do |response|\n raise \"error retrieving information for for file #{params[:file]}: #{response.fetch('error', 'unknown error')}\" unless response['ok']\n end.fetch('file')\n\n if download = info['url']\n uri = URI(download)\n name = uri.path.split('/').last\n\n if save_as\n if File.directory?(save_as)\n name = \"#{save_as}/#{name}\"\n else\n name = save_as\n end\n end\n\n File.open(name, 'wb') { |f| f.write HTTParty.get(download).parsed_response }\n return name\n else\n raise \"error determining private download URL for file #{params[:file]}\"\n end\n end",
"def report_file_download(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id } \r\n\t\tfile=nessus_http_request('file/report/download', post)\r\n\t\treturn file\r\n\tend",
"def download_file(file_name, skylink, override_options = {}, stream: true)\n options = Helper::Download.default_options\n options = Helper::Download.default_options.merge(override_options) unless override_options.empty?\n\n portal = options[:portal_url]\n skylink = Helper::Download.strip_prefix(skylink)\n url = \"#{portal}#{skylink}?attachment=#{options[:download]}\"\n\n File.open(file_name, 'w') do |file|\n HTTParty.get(url, follow_redirects: true, stream_body: stream) do |chunk|\n file << chunk unless HTTP_REDIRECT_PERMANENT.include? chunk.code\n end\n end\n\n 'Download successful!'\n end",
"def download\n ExtensionVersion.increment_counter(:web_download_count, @version.id)\n Extension.increment_counter(:web_download_count, @extension.id)\n ManageIQ::Metrics.increment('extension.downloads.web')\n DailyMetric.increment(@version.download_daily_metric_key)\n\n redirect_to @version.download_url\n end",
"def download!\n\t\traise_if_error C.glyr_opt_download(to_native, true)\n\tend",
"def download_video\n\t\t# preview_video_url = \"https://video.tvspielfilm.de/ivideo/video/10/9700610_1.mp4\"\n\n\t\tif preview_video_url.present?\t\n\t\t\tfilename = Pathname.new(preview_video_url).basename\n\t\t\tfilename = filename.to_s rescue \"#{Time.now.to_i}.mp4\"\n\t\t\t\n\t\t\tfilename = \"#{id}_#{filename}\"\n\n\t\t\tnew_file_path = \"#{Rails.root.to_s}/public/videos/#{filename}\"\n\t\t\topen(new_file_path, \"wb\") do |file| \n\t\t\t file.print open(preview_video_url).read\n\t\t\tend\n\t\t\tupload_video_at_s3(filename, new_file_path) \n\t\tend\n\tend",
"def download_exported_file_download(opts = {})\n download_exported_file_download_with_http_info(opts)\n nil\n end",
"def download_receipt\n @slft_return = load_step\n success, attachment = Dashboard::DashboardReturn.return_pdf(current_user,\n @slft_return.back_office_receipt_request, 'Receipt')\n return unless success\n\n # Download the file\n send_file_from_attachment(attachment[:document_return])\n end",
"def instrument_responses_long\n export = ResponseExport.find(params[:id])\n download_file(export.export_file('long').path, 'text/csv', export_name(export.instrument.title, 'long', '.csv')) if export.instrument\n end",
"def download_file\n send_file(@static_page.custom_file.path,\n disposition: 'attachment; filename=\"' + @static_page.custom_file.file.filename + '\"',\n type: @static_page.custom_file.file.content_type,\n url_based_filename: true)\n end",
"def download(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n PUTIO_BASE_URL + (\"/files/%i/download?oauth_token=%s\" % [id, @access_token])\n end",
"def exec_api_download(json_req, download_path)\n begin\n req = sign_request(json_req)\n File.open(download_path, \"w\") do |io|\n return HttpChannel.new(api_uri).execute_download(req) { |d| io << d; d.length }\n end\n rescue Curl::Err::CurlError => ex\n return JsonResponse.new(\"fail\", ex.message)\n end\n end",
"def download\n grade_entry_form = GradeEntryForm.find(params[:id])\n send_data grade_entry_form.export_as_csv,\n disposition: 'attachment',\n type: 'text/csv',\n filename: \"#{grade_entry_form.short_identifier}_grades_report.csv\"\n end",
"def download\n redirect \"public/downloads/index.html\"\n end",
"def report_file1_download(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id, \"v1\" => \"true\" } \r\n\t\tfile=nessus_http_request('file/report/download', post)\r\n\t\treturn file\r\n\tend",
"def download_to_io(io, params = {})\n if !self.api_file.download_url\n raise(GoogleDrive::Error, \"Downloading is not supported for this file.\")\n end\n # TODO Use streaming if possible.\n api_result = @session.execute!(:uri => self.api_file.download_url)\n io.write(api_result.body)\n end",
"def download(file:)\n tenant = file&.resource&.tenant\n if file.blank? || tenant.blank?\n cc.render status: 404, plain: 'Not found'\n return\n end\n\n url = file.merritt_s3_presigned_url\n\n cc.redirect_to url\n rescue HTTP::Error => e\n raise MerrittError, \"HTTP Error while creating presigned URL with Merritt\\n\" \\\n \"#{file.merritt_presign_info_url}\\n\" \\\n \"Original HTTP library error: #{e}\\n\" \\\n \"#{e.full_message}\"\n end",
"def download\n @extension = Extension.with_name(params[:extension]).first!\n @extension_version = @extension.get_version!(params[:version])\n\n ExtensionVersion.increment_counter(:api_download_count, @extension_version.id)\n Extension.increment_counter(:api_download_count, @extension.id)\n BonsaiAssetIndex::Metrics.increment('extension.downloads.api')\n\n redirect_to @extension_version.tarball.url\n end",
"def url\n @client.get_download_link(@path)\n end",
"def download\n # TODO: Find out why this is needed, should be handeled in ability.rb\n authorize! :read, params[:id]\n begin\n send_data @file.datastreams['content'].content, {:filename => @file.original_filename, :type => @file.mime_type}\n rescue ActiveFedora::ObjectNotFoundError => obj_not_found\n flash[:error] = 'The basic_files you requested could not be found in Fedora! Please contact your system administrator'\n logger.error obj_not_found.to_s\n render text: obj_not_found.to_s, status: 404\n rescue => standard_error\n flash[:error] = 'An error has occurred. Please contact your system administrator'\n logger.error standard_error.to_s\n render text: standard_error.to_s, status: 500\n end\n end",
"def download(dest_path)\n response = Crocodoc.connection.get 'download/document',\n :pdf => false,\n :annotated => false,\n :uuid => @uuid\n File.open(dest_path, 'wb') { |fp| fp.write(response.body) }\n end",
"def export_url\n begin\n \"/instruments/#{self.id}/export/#{latest_export.try(:id)}\"\n rescue\n nil\n end\n end",
"def download\n #require 'debugger'; debugger\n generator = Generator.where(id: params[:id], user_id: current_user.id).first\n send_file TerrainLib::Component.generate JSON.parse(generator.generator_hash)\n end",
"def tracks_get_download_link params = { :track_id => nil, :reason => 'save' }\n json = send_request 'tracks_get_download_link', params\n if json['success'] == true\n json['url']\n else\n puts \"Error: \" + json['message']\n exit\n end\n end",
"def csv_download\n @stats = Hyrax::WorkUsage.new(params[:id])\n filename = params[:id] + \"_stats.csv\"\n #This is an example that worked\n #send_data @stats.to_csv, :type => 'text/csv; charset=utf-8; header=present', :disposition => 'attachment; filename=payments.csv'\n target = \"attachment`; filename=#{filename}\"\n send_data @stats.to_csv, :type => 'text/csv; charset=utf-8; header=present', :disposition => target\n end",
"def download\n @document = Document.find(params[:id])\n @filepath = @document.full_filename\n send_file(@filepath,\n :disposition => 'attachment',\n :encoding => 'utf8',\n :type => 'application/octet-stream') \n end",
"def download_file_from_url(url: nil, shipment: nil)\n response = Faraday.get(url)\n redirect_url = response.headers['location']\n\n # The use of `URI::DEFAULT_PARSER` is due to the redirect_url otherwise being invalid according to RFC3986.\n # The default parser follows the RFC2396 standard.\n # Basically the issue is that there are unescaped square brackets in the URL.\n # Bring has been notified about this issue and if they fix it, then we can remove this fix.\n response = Faraday.get(URI::DEFAULT_PARSER.parse(redirect_url))\n data = response.body\n path = \"#{Rails.root}/tmp/#{shipment.unique_shipment_id}-awb_document.pdf\"\n\n pdf_file = File.open(path, 'wb') do |f|\n f.write(data)\n end\n\n return path\n end",
"def download_ror_file(url)\n return nil unless url.present?\n\n puts 'Downloading ROR data file...'\n\n headers = {\n host: 'zenodo.org',\n Accept: 'application/zip'\n }\n resp = HTTParty.get(url, headers: headers)\n unless resp.present? && resp.code == 200\n puts(\"Unable to fetch ROR file from Zenodo -- #{url} -- #{resp}\")\n return nil\n end\n resp.parsed_response\n end",
"def download\n send_file @document.complete_path, :type => @document.mime, :disposition => 'inline'\n end",
"def download\n @businessdocument.create_pdf\n if [email protected]_exists?\n # @businessdocument.create_pdf\n end\n send_file(@businessdocument.pdf.path, filename: @businessdocument.pdf_file_name, type: 'application/pdf', disposition: 'inline')\n end",
"def download_attachment attachment_index\n begin\n \n if @filename == ''\n raise 'filename not specified'\n end\n \n if attachment_index == ''\n raise 'attachment index not specified'\n end\n \n file_info = self.get_attachment(attachment_index)\n \n \n str_uri = $product_uri + '/pdf/' + @filename + '/attachments/' + attachment_index.to_s + '/download'\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri) \n response_stream = RestClient.get(str_signed_uri, {:accept=>'application/json'})\n \n valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)\n \n if valid_output == '' \n output_path = $out_put_location + file_info['Name'];\n Aspose::Cloud::Common::Utils.saveFile(response_stream,output_path)\n return ''\n else\n return valid_output\n end\n \n \n rescue Exception=>e\n print e\n end\n end",
"def download_audit_trail(signature_id, document_id)\n request :get, \"/v3/signatures/#{signature_id}/documents/#{document_id}/download/audit_trail\", {}, false\n end",
"def downloadMetrics\n @concurso = Concurso.find(params[:concurso_id])\n path = File.join(Rails.root, \"data/concursos\",\"contest-\"[email protected]_s,\"metrics\",\"df.pdf\")\n send_file( path,\n :filename => \"df.pdf\",\n :type => \"application/pdf\",\n :stream => \"false\",\n :disposition =>'attachment') ##download\n #:disposition =>\"inline\") #ver no browser\n end",
"def download_all\n authorize!(:manage, @assessment)\n if [email protected]?\n redirect_to course_assessment_submissions_path(current_course, @assessment),\n notice: t('.not_downloadable')\n elsif @assessment.submissions.confirmed.empty?\n redirect_to course_assessment_submissions_path(current_course, @assessment),\n notice: t('.no_submissions')\n else\n job = Course::Assessment::Submission::ZipDownloadJob.\n perform_later(current_course_user, @assessment, params[:students]).job\n respond_to do |format|\n format.html { redirect_to(job_path(job)) }\n format.json { render json: { redirect_url: job_path(job) } }\n end\n end\n end",
"def download_file(agent, url)\n SouvlakiRS.logger.info \" starting download for #{url}\"\n\n data = agent.get(url)\n unless data\n SouvlakiRS.logger.error ' download failed'\n return nil\n end\n\n filename = get_response_filename(data) || filename_from_url(url)\n [data, filename]\n end",
"def odt_download_url(document)\n return [\"/\",self.class.to_s.downcase.pluralize,\"/download_odt/\",id.to_s,'?h=',rand.to_s,'&document=',document].join\n end",
"def download_waste\n success, zip_file, tare_reference, version = DashboardReturn.return_wastes(current_user, dashboard_return_params)\n return unless success\n\n # Download the file\n send_file_from_path zip_file,\n filename: \"#{tare_reference}-#{version}#{File.extname(zip_file)}\",\n disposition: 'attachment'\n end",
"def download_invoice(id, data, filename = nil)\n invoice = find_invoice_or_fail(id)\n\n filename ? invoice.download_as(filename, data) : invoice.download(data)\n end",
"def download\n @audio = Audio.find(params[:id])\n send_file(RAILS_ROOT+\"/public\"[email protected](\"?\")[0], :disposition => 'inline', :stream => false)\n end",
"def download_data\n view = session[:view].dup if session[:view] # Copy session view, if it exists\n options = session[:paged_view_search_options].merge(:page => nil, :per_page => nil) # Get all pages\n view.table, _attrs = view.paged_view_search(options) # Get the records\n\n view.title = _(view.title.pluralize)\n view.headers.map! { |header| _(header) }\n\n case params[:download_type]\n when 'pdf' then download_pdf(view)\n when 'text' then download_txt(view, filename_timestamp(view.title))\n when 'csv' then download_csv(view, filename_timestamp(view.title))\n end\n end",
"def download\n authorize @bookings\n\n BookingsWorker.perform_async(@user.email, params['format'])\n flash[:notice] = \"🎉🎉🎉 We just sent you the booking list in #{params['format']}\"\n redirect_back(fallback_location: root_path)\n end",
"def download_exported_file_download_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyTaskApi.download_exported_file_download_0 ...'\n end\n # resource path\n local_var_path = '/infra/settings/firewall/export?action=download'\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/octet-stream'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyTaskApi#download_exported_file_download_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def download\n\t\tsend_file(params[:path])\n end"
] | [
"0.6099939",
"0.6029227",
"0.595342",
"0.5923552",
"0.58909374",
"0.588413",
"0.5815108",
"0.57964456",
"0.5755457",
"0.5736824",
"0.5724132",
"0.5716938",
"0.5714595",
"0.5707191",
"0.5705633",
"0.5700611",
"0.56973696",
"0.56591284",
"0.5654231",
"0.5643808",
"0.5617047",
"0.56083906",
"0.5606696",
"0.5555892",
"0.5551699",
"0.5551528",
"0.55467147",
"0.552903",
"0.55134356",
"0.5510109",
"0.55080163",
"0.5505214",
"0.54923934",
"0.54910743",
"0.5483174",
"0.5482353",
"0.5479094",
"0.5476718",
"0.5464981",
"0.5464",
"0.5456814",
"0.5447859",
"0.54453844",
"0.5440788",
"0.5438075",
"0.54337853",
"0.54193944",
"0.5417036",
"0.5407633",
"0.54025334",
"0.5392879",
"0.53841245",
"0.5381584",
"0.5373241",
"0.5343514",
"0.530744",
"0.5305083",
"0.53035146",
"0.52897686",
"0.52885616",
"0.52841526",
"0.5281449",
"0.528053",
"0.5279998",
"0.5271956",
"0.5259552",
"0.52540743",
"0.5247195",
"0.52452654",
"0.524318",
"0.52350646",
"0.52329236",
"0.5230477",
"0.52063155",
"0.5205883",
"0.52012855",
"0.5198168",
"0.5194831",
"0.5188868",
"0.5187739",
"0.5180988",
"0.5175059",
"0.51723677",
"0.5171804",
"0.5171782",
"0.51672065",
"0.5163913",
"0.51495063",
"0.51469946",
"0.51456463",
"0.5144782",
"0.51351744",
"0.5128435",
"0.5118858",
"0.5106273",
"0.5097592",
"0.5092405",
"0.50890803",
"0.5088902",
"0.5088615"
] | 0.77112764 | 0 |
Never trust parameters from the scary internet, only allow the white list through. | def phone_call_params
params.require(:phone_call).permit(:domain, :user_id, :from_ip, :from_url, :from_phone, :is_processed, :note)
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 |
Used to perform a mouse down on this view in the remote application | def mouse_down()
mouse_down_at :center, :center
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouse_down locator\r\n command 'mouseDown', locator\r\n end",
"def mouse_down locator\r\n command 'mouseDown', locator\r\n end",
"def right_click()\n right_mouse_down\n right_mouse_up\n stall :right_click\n end",
"def click()\n mouse_down\n mouse_up\n stall :click\n end",
"def right_mouse_down()\n right_mouse_down_at :center, :center\n end",
"def mouseButton()\n @view__.mouseButton\n end",
"def mousedown(btn = 'left')\n compatible_call :mousedown, btn\n end",
"def onLButtonDown(flags,x,y,view)\n [email protected]\n ParametricCopy::run(pickpoint)\n Sketchup.send_action(\"selectSelectionTool:\")\n end",
"def mouse_up *args; end",
"def click\r\n start_point = screen.find ident\r\n click_x = start_point.x + offset_x\r\n click_y = start_point.y + offset_y\r\n\r\n screen.click click_x, click_y\r\n end",
"def click\n `#@native.click()`\n end",
"def left_button_down(sender, selector, event)\n @canvas.grab\n @mouse_down = true\n end",
"def click\n `#@native.click()`\n self\n end",
"def click\n p [ :app_click ]\n view.click\n end",
"def mouseDown(event)\n windowFrame = self.frame\n # grab the mouse location in global coordinates\n @initialLocation = self.convertBaseToScreen(event.locationInWindow)\n @initialLocation.x -= windowFrame.origin.x;\n @initialLocation.y -= windowFrame.origin.y;\n end",
"def scrollDown\n \th = getProperty('height')\n w = getProperty('width')\n mouseClick(waitForObject(@symbolicName, OBJECT_WAIT_TIMEOUT), w/2, h-20, 0, Qt::LEFT_BUTTON)\n end",
"def click; end",
"def click; end",
"def click; end",
"def double_click locator\r\n command 'doubleClick', locator\r\n end",
"def mouse_clicked\n\t\t# Send the mouse click to the Interaction Controller. It'll do the dirty work.\n\t\t@interaction_controller.mouse_clicked\n\t\tputs \"Editor#mouse_clicked\"\n\tend",
"def double_click()\n double_click_at :center, :center\n end",
"def press_mouse(button)\n XDo::FFILib.xdo_mousedown @_xdo_pointer, @_window, button\n end",
"def mouse_down_at locator, coord_string\r\n command 'mouseDownAt', locator, coord_string\r\n end",
"def button_down; end",
"def click_mouse(button)\n XDo::FFILib.xdo_click @_xdo_pointer, @_window, button\n end",
"def doubleclick(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse with double click\n end tell\n `)\n end",
"def click\n Vedeu.log(type: :input,\n message: \"Mouse pressed: '#{button}' (x: #{x}, y: #{y})\")\n\n if left_click?\n Vedeu.trigger(:_cursor_reposition_, Vedeu.focus, y, x)\n\n elsif wheel_up?\n Vedeu.trigger(:_cursor_up_, Vedeu.focus)\n\n elsif wheel_down?\n Vedeu.trigger(:_cursor_down_, Vedeu.focus)\n\n else\n Vedeu.log(type: :input,\n message: 'Vedeu does not support mouse button ' \\\n \"'#{button}' yet.\")\n\n end\n end",
"def clicked(mouse_event)\n end",
"def mouseDown(theEvent)\n window_frame = frame\n \n # grab the mouse location in global coordinates\n @initialLocation = convertBaseToScreen(theEvent.locationInWindow)\n @initialLocation.x -= window_frame.origin.x\n @initialLocation.y -= window_frame.origin.y\n end",
"def click(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse\n end tell\n `)\n end",
"def cursor_pagedown\r\n end",
"def right_mouse_up()\n right_mouse_up_at :center, :center\n end",
"def cursor_pagedown\n end",
"def cursor_pagedown\n end",
"def onRButtonDown(flags, x, y, view)\n ph = view.pick_helper\n ph.do_pick x,y\n ent = ph.best_picked\n focus_control\n end",
"def click(*args)\n\t\t\t# if no argument has been provided, click on the\n\t\t\t# window itself\n\t\t\th = (args.length == 0) ? @handle : child(args[0]).handle\n\t\t\t\n\t\t\trectangle = [0, 0, 0, 0].pack 'LLLL'\n\t\t\tget_window_rect h, rectangle\n\t\t\tleft, top, right, bottom = rectangle.unpack 'LLLL'\n\t\t\t\n\t\t\tcenter = [(left + right) / 2, (top + bottom) / 2]\n\t\t\tset_cursor_pos *center\n\t\t\t\n\t\t\tmouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0\n\t\t\tmouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0\n\t\tend",
"def onRButtonDown(flags, x, y, view)\r\n ph = view.pick_helper\r\n ph.do_pick x,y\r\n ent = ph.best_picked\r\n focus_control\r\n end",
"def mouse_up locator\r\n command 'mouseUp', locator\r\n end",
"def double_click_on(object)\n page.driver.browser.mouse.double_click(object.native)\n end",
"def button_down(id); end",
"def button_down(id)\n fire :button_down, id\n end",
"def right_click(name, *args)\n widget(name, *args).right_click\n end",
"def key_down(key)\n focus\n @driver.sc_key_down action_target, key, *action_locator_args\n stall :key_down\n end",
"def dClick\n doubleClick(waitForObject(@symbolicName))\n Log.AppendLog(@@logCmd.dClick(self))\n end",
"def click(id)\n\t\t\th = child(id).handle\n\t\t\t\n\t\t\trectangle = [0, 0, 0, 0].pack 'LLLL'\n\t\t\tget_window_rect h, rectangle\n\t\t\tleft, top, right, bottom = rectangle.unpack 'LLLL'\n\t\t\t\n\t\t\tcenter = [(left + right) / 2, (top + bottom) / 2]\n\t\t\tset_cursor_pos *center\n\t\t\t\n\t\t\tmouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0\n\t\t\tmouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0\n\t\tend",
"def button_down(id)\n click_handlers.each(&:call) if enabled? && id == Gosu::MS_LEFT &&\n within_bounds?(mouse_point)\n end",
"def onLButtonDoubleClick(flags, x, y, view)\n end",
"def doubleclick(btn = 'left')\n compatible_call :doubleclick, btn\n end",
"def cursor_down(wrap = false)\n Sound.play_cursor\n Input.update\n deactivate\n call_handler(:down)\n end",
"def button_down(key)\n MenuControllerContracts.invariant(self)\n @current_view.button_down(key)\n MenuControllerContracts.invariant(self)\n end",
"def mouseX()\n @view__.mouseX\n end",
"def clicked(e)\n \n end",
"def clicked;end",
"def on_button_down(button_id, point)\n end",
"def key_down locator, keycode\r\n command 'keyDown', locator, keycode\r\n end",
"def key_down locator, keycode\r\n command 'keyDown', locator, keycode\r\n end",
"def click\n @automation_element.get_current_pattern(System::Windows::Automation::InvokePattern.pattern).invoke\n end",
"def click\n @mech.click self\n end",
"def pointer_down(button = T.unsafe(nil), device: T.unsafe(nil), **opts); end",
"def mouseY()\n @view__.mouseY\n end",
"def mouse_release *args\n\t\t\tevent(:mouse_release, *args)\n\t\tend",
"def mouse_up()\n mouse_up_at :center, :center\n end",
"def double_click(name, *args)\n widget(name, *args).double_click\n end",
"def TreeView_SelectDropTarget(hwnd, hitem) TreeView_Select(hwnd, hitem, TreeViewGetNextItem[:DROPHILITE]) end",
"def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, true, o1, o2, o3, o4, o5)\nend",
"def unclicked(e)\n puts \"Unclicked!\"\n end",
"def button_down(id)\r\n $scene.button_down(id)\r\n end",
"def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, true, o1, o2, o3, o4, o5)\nend",
"def ccMouseDown(event)\n @on_mouse_down_block.call(event, :left) if @on_mouse_down_block\n @on_mouse_down_block ? true : false\n end",
"def left_button_up(sender, selector, event)\n @canvas.ungrab\n @mouse_down = false\n flush_commands\n board_draw\n end",
"def on_button_down( button_id )\n end",
"def onKeyDown( *args )\r\n capture = relay_event( :onKeyDown, args )\r\n relay_event( :onSetCursor, [] )\r\n capture\r\n end",
"def action\n trigger :click\n end",
"def onRButtonDoubleClick(flags, x, y, view)\n end",
"def release_mouse(button)\n XDo::FFILib.xdo_mouseup @_xdo_pointer, @_window, button\n end",
"def click_point(x, y, is_double = false)\n if is_double\n @java_obj.doubleClick(org.sikuli.script::Location.new(x, y).offset(x(), y()), 0)\n else\n @java_obj.click(org.sikuli.script::Location.new(x, y).offset(x(), y()), 0)\n end\n end",
"def button_down id\n end",
"def click locator\r\n command 'click', locator\r\n end",
"def click locator\r\n command 'click', locator\r\n end",
"def double_click obj = nil, wait = 0.2\n move_mouse_to obj, wait: 0 if obj\n Mouse.double_click\n sleep wait\n end",
"def button_down(id)\n end",
"def scroll_down()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.Layout_scroll_down(@handle.ptr)\n end",
"def close_menu\n pending\n perform_action('drag', 20, 0, 10, 10, 10)\n end",
"def mouseUp event\n return if viewAtPoint(convertPoint(event.locationInWindow, fromView:nil)).nil?\n super(event) \n end",
"def select_with_click\n if mac_internal?\n press_menu\n else\n click\n end\n selected?\n end",
"def pmouseX()\n @view__.pmouseX\n end",
"def button_down(key)\n end",
"def click\n @clicked_x = @x\n @clicked_y = @y\n fire(:click, @clicked_x, @clicked_y)\n end",
"def onLButtonDown(flags, x, y, view)\n # When the user clicks the first time, we switch to getting the\n # second point. When they click a second time we create the line\n if( @state == 0 )\n @ip1.pick view, x, y\n if( @ip1.valid? )\n @state = 1\n Sketchup::set_status_text $exStrings.GetString(\"Select second end\"), SB_PROMPT\n @xdown = x\n @ydown = y\n end\n else\n # create the line on the second click\n if( @ip2.valid? )\n self.create_geometry(@ip1.position, @ip2.position,view)\n self.reset(view)\n end\n end\n\n # Clear any inference lock\n view.lock_inference\n end",
"def click\n Log.Trace(\"Clicking on #{@symbolicName}\")\n mouseClick(waitForObject(@symbolicName))\n Log.AppendLog(@@logCmd.click(self))\n end",
"def mouseDragged event\n end",
"def mouse_pressed\n super\n\n if mouse_button == RIGHT\n @right_mouse_down_x = mouseX\n @right_mouse_down_y = mouseY\n end\n end",
"def onLButtonDown(flags, x, y, view)\n # When the user clicks the first time, we switch to getting the\n # second point. When they click a second time we create the line\n if @state == 0\n @ip1.pick view, x, y\n if @ip1.valid?\n @state = 1\n Sketchup::set_status_text(\"Draw cut line through geometry. Hold CTRL to cut through nested groups and components.\", SB_PROMPT)\n @xdown = x\n @ydown = y\n @x1=x\n @y1=y\n end\n else\n # create the line on the second click\n if @ip2.valid?\n self.cut_geometry(view)\n self.reset(view)\n end\n end\n\n # Clear any inference lock\n view.lock_inference\n end",
"def click_on(id, x, y)\n # Get the position of this window id\n position = get_position(id)\n # Add the [x, y] passed in by get_position to our x and y\n x += position[0]\n y += position[1]\n # Move the mouse to (x, y), then click\n xdotool \"mousemove #{x} #{y}\"\n xdotool \"click 1\"\n # sleep $sleep_time\nend",
"def unclicked(mouse_event)\n end",
"def pmouseY()\n @view__.pmouseY\n end",
"def process_pagedown\n Sound.play_cursor\n Input.update\n call_handler(:pagedown)\n end",
"def process_pagedown\n Sound.play_cursor\n Input.update\n call_handler(:pagedown)\n end",
"def doubleClick\n\[email protected]_click(@locator)\n end"
] | [
"0.72893816",
"0.72893816",
"0.71459734",
"0.70248765",
"0.68114823",
"0.6753573",
"0.66153777",
"0.6611777",
"0.6490401",
"0.6459126",
"0.64460313",
"0.6442179",
"0.64028645",
"0.6337108",
"0.6327643",
"0.6245845",
"0.6236439",
"0.6236439",
"0.6236439",
"0.62057585",
"0.6180519",
"0.61777073",
"0.6174536",
"0.6153773",
"0.61396796",
"0.6136246",
"0.61208475",
"0.611392",
"0.61099243",
"0.6109407",
"0.60811627",
"0.6066363",
"0.60439736",
"0.60328615",
"0.60328615",
"0.6022177",
"0.6020427",
"0.5996731",
"0.5977121",
"0.593774",
"0.59334135",
"0.59115076",
"0.59062",
"0.5878901",
"0.58641934",
"0.58480674",
"0.58428836",
"0.5822637",
"0.581801",
"0.58174264",
"0.5811416",
"0.57876456",
"0.578457",
"0.57666206",
"0.5765772",
"0.5756923",
"0.5756923",
"0.57505375",
"0.5746406",
"0.5731622",
"0.572964",
"0.57177716",
"0.5702735",
"0.5692908",
"0.56861776",
"0.5678745",
"0.5674442",
"0.56695527",
"0.5667774",
"0.5663995",
"0.5655587",
"0.5654143",
"0.564469",
"0.56442624",
"0.5611067",
"0.56014854",
"0.55961204",
"0.5589224",
"0.55589676",
"0.55589676",
"0.55557895",
"0.554911",
"0.554734",
"0.5544603",
"0.55336547",
"0.5523064",
"0.551473",
"0.5513157",
"0.5499116",
"0.54982126",
"0.5493794",
"0.5490622",
"0.54877526",
"0.54804045",
"0.5466923",
"0.54656917",
"0.54597807",
"0.5458328",
"0.5458328",
"0.54556596"
] | 0.7069864 | 3 |
Used to perform a mouse up on this view in the remote application | def mouse_up()
mouse_up_at :center, :center
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouse_up *args; end",
"def mouse_up locator\r\n command 'mouseUp', locator\r\n end",
"def mouseUp event\n return if viewAtPoint(convertPoint(event.locationInWindow, fromView:nil)).nil?\n super(event) \n end",
"def onLButtonUp(flags, x, y, view)\n end",
"def mouseup(btn = 'left')\n compatible_call :mouseup, btn\n end",
"def onRButtonUp(flags, x, y, view)\n end",
"def right_mouse_up()\n right_mouse_up_at :center, :center\n end",
"def click()\n mouse_down\n mouse_up\n stall :click\n end",
"def scrollUp\n \th = getProperty('height')\n w = getProperty('width')\n mouseClick(waitForObject(@symbolicName, OBJECT_WAIT_TIMEOUT), w/2, 20, 0, Qt::LEFT_BUTTON)\n end",
"def onLButtonUp(flags, x, y, view)\n # If we are doing a drag, then create the line on the mouse up event\n if @dragging && @ip2.valid?\n self.cut_geometry(view)\n self.reset(view)\n end\n end",
"def mouseButton()\n @view__.mouseButton\n end",
"def go_up\n if !self.viewport.nil?\n if $imported[\"H87_SmoothMovements\"]#.nil? && $imported[\"H87_SmoothMovements\"] >= 1.1\n self.viewport.smooth_move(view_x, view_y)\n else\n self.viewport.rect.y = view_y\n end\n end\n end",
"def on_button_up(button_id, point)\n end",
"def mouse_down()\n mouse_down_at :center, :center\n end",
"def right_click()\n right_mouse_down\n right_mouse_up\n stall :right_click\n end",
"def onLButtonDown(flags,x,y,view)\n [email protected]\n ParametricCopy::run(pickpoint)\n Sketchup.send_action(\"selectSelectionTool:\")\n end",
"def cursor_pageup\n end",
"def cursor_pageup\n end",
"def key_up(key)\n focus\n @driver.sc_key_up action_target, key, *action_locator_args\n stall :key_up\n end",
"def pointer_up(button = T.unsafe(nil), device: T.unsafe(nil), **opts); end",
"def mouse_up_at locator, coord_string\r\n command 'mouseUpAt', locator, coord_string\r\n end",
"def cursor_pageup\r\n end",
"def onLButtonUp(flags, x, y, view)\n # If we are doing a drag, then create the line on the mouse up event\n if( @dragging && @ip2.valid? )\n self.create_geometry(@ip1.position, @ip2.position,view)\n self.reset(view)\n end\n end",
"def click\n p [ :app_click ]\n view.click\n end",
"def up(key)\n key = normalize_keys(Array(key)).first\n @page.command(\"Input.dispatchKeyEvent\", slowmoable: true, type: \"keyUp\", **key)\n self\n end",
"def left_button_up(sender, selector, event)\n @canvas.ungrab\n @mouse_down = false\n flush_commands\n board_draw\n end",
"def release_mouse(button)\n XDo::FFILib.xdo_mouseup @_xdo_pointer, @_window, button\n end",
"def button_up(id)\r\n $scene.button_up(id)\r\n end",
"def button_up(id); end",
"def click\n `#@native.click()`\n self\n end",
"def click\n Vedeu.log(type: :input,\n message: \"Mouse pressed: '#{button}' (x: #{x}, y: #{y})\")\n\n if left_click?\n Vedeu.trigger(:_cursor_reposition_, Vedeu.focus, y, x)\n\n elsif wheel_up?\n Vedeu.trigger(:_cursor_up_, Vedeu.focus)\n\n elsif wheel_down?\n Vedeu.trigger(:_cursor_down_, Vedeu.focus)\n\n else\n Vedeu.log(type: :input,\n message: 'Vedeu does not support mouse button ' \\\n \"'#{button}' yet.\")\n\n end\n end",
"def click\n `#@native.click()`\n end",
"def mouseDown(event)\n windowFrame = self.frame\n # grab the mouse location in global coordinates\n @initialLocation = self.convertBaseToScreen(event.locationInWindow)\n @initialLocation.x -= windowFrame.origin.x;\n @initialLocation.y -= windowFrame.origin.y;\n end",
"def process_pageup\n Sound.play_cursor\n Input.update\n call_handler(:pageup)\n end",
"def process_pageup\n Sound.play_cursor\n Input.update\n call_handler(:pageup)\n end",
"def click\r\n start_point = screen.find ident\r\n click_x = start_point.x + offset_x\r\n click_y = start_point.y + offset_y\r\n\r\n screen.click click_x, click_y\r\n end",
"def button_up(key)\n close if key == Gosu::KbEscape\n\n # reset the game\n if @state == :end && key == Gosu::MsLeft\n @board = Board.new(self, 22, @root_dir)\n @state = :game\n return\n end\n\n @player_b.ai_inc if key == Gosu::KbS\n @player_b.ai_dec if key == Gosu::KbD\n\n if @player_on_turn.class == HotseatPlayer && key == Gosu::MsLeft\n if @board.cell_clicked(mouse_x, mouse_y, @player_on_turn.sym)\n\n return if @state == :end\n\n switch_players\n\n if @player_on_turn.class == AIPlayer\n @player_on_turn.make_move(@board)\n switch_players\n end\n end\n end\n end",
"def key_up locator, keycode\r\n command 'keyUp', locator, keycode\r\n end",
"def key_up locator, keycode\r\n command 'keyUp', locator, keycode\r\n end",
"def action_up\n @ui.index -= 1\n end",
"def button_up(id)\n Controllers::ControllerSupervisor.dispatch(:button_up, id)\n end",
"def button_up(id)\n case id\n when Gosu::MsLeft\n if iterate_element() != nil\n element = iterate_element()\n click_event(element)\n end\n end\n end",
"def mouse_down locator\r\n command 'mouseDown', locator\r\n end",
"def mouse_down locator\r\n command 'mouseDown', locator\r\n end",
"def button_up(id)\r\n\r\n # Up-Arrow key\r\n if id == Gosu::KbUp then\r\n @player.reset_jump if @player.is_jumping?\r\n end\r\n end",
"def right_mouse_down()\n right_mouse_down_at :center, :center\n end",
"def resume(view)\n @ctrlDown = false\n @shiftDown = false\n end",
"def click; end",
"def click; end",
"def click; end",
"def button_up(id)\n\n end",
"def interactive_go_up e\n if topic and topic =~ /(.*)(::|#|\\.)/\n @app.go $1\n end\n end",
"def process_up\n Sound.play_cursor\n Input.update\n deactivate\n call_cancel_handler\n end",
"def button_up(id)\n\t\[email protected]_up(id) if @controller\n\tend",
"def onLButtonUp(flags, x, y, view)\n # If we are doing a drag, then create the line on the mouse up event\n if( @dragging && @ip2.valid? )\n self.create_geometry(@ip1.position, @ip2.position,view)\n self.reset(view)\n end\nend",
"def onRButtonDown(flags, x, y, view)\r\n ph = view.pick_helper\r\n ph.do_pick x,y\r\n ent = ph.best_picked\r\n focus_control\r\n end",
"def onRButtonDown(flags, x, y, view)\n ph = view.pick_helper\n ph.do_pick x,y\n ent = ph.best_picked\n focus_control\n end",
"def update_character_select(isUp)\n if isUp\n @status_window.cursor_pageup()\n else \n @status_window.cursor_pagedown()\n end\n end",
"def mouse_clicked\n\t\t# Send the mouse click to the Interaction Controller. It'll do the dirty work.\n\t\t@interaction_controller.mouse_clicked\n\t\tputs \"Editor#mouse_clicked\"\n\tend",
"def button_down; end",
"def scroll_up()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.Layout_scroll_up(@handle.ptr)\n end",
"def button_up(key)\n self.close if key == Gosu::KbEscape\n end",
"def mouseX()\n @view__.mouseX\n end",
"def button_up(id)\n end",
"def click(*args)\n\t\t\t# if no argument has been provided, click on the\n\t\t\t# window itself\n\t\t\th = (args.length == 0) ? @handle : child(args[0]).handle\n\t\t\t\n\t\t\trectangle = [0, 0, 0, 0].pack 'LLLL'\n\t\t\tget_window_rect h, rectangle\n\t\t\tleft, top, right, bottom = rectangle.unpack 'LLLL'\n\t\t\t\n\t\t\tcenter = [(left + right) / 2, (top + bottom) / 2]\n\t\t\tset_cursor_pos *center\n\t\t\t\n\t\t\tmouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0\n\t\t\tmouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0\n\t\tend",
"def clicked(mouse_event)\n end",
"def button_up(id)\n @state.button_up(id)\n end",
"def mouseY()\n @view__.mouseY\n end",
"def cursor_up\n $game_system.se_play($data_system.cursor_se)\n @index += $game_party.actors.size - 1\n @index %= $game_party.actors.size\n end",
"def unclicked(e)\n puts \"Unclicked!\"\n end",
"def on_left_button_up(evt)\n if !evt.left_is_down()\n @dragging = false\n x=evt.get_x ; y=evt.get_y \n if @selection.nil? and \n idx=coords_to_idx(x,y, @cursor.area) and \n @data[idx]\n self.cur_pos = idx\n end\n else\n evt.skip()\n return\n end\n end",
"def up(key)\n description = key_description_for_string key\n\n @modifiers &= ~(modifier_bit description[:key])\n @_pressed_keys.delete description[:code]\n\n client.command(\n Protocol::Input.dispatch_key_event(\n type: 'keyUp',\n modifiers: modifiers,\n key: description[:key],\n windows_virtual_key_code: description[:key_code],\n code: description[:code],\n location: description[:location]\n )\n ).wait!\n end",
"def mouseDown(theEvent)\n window_frame = frame\n \n # grab the mouse location in global coordinates\n @initialLocation = convertBaseToScreen(theEvent.locationInWindow)\n @initialLocation.x -= window_frame.origin.x\n @initialLocation.y -= window_frame.origin.y\n end",
"def click(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse\n end tell\n `)\n end",
"def double_click()\n double_click_at :center, :center\n end",
"def mouse_release *args\n\t\t\tevent(:mouse_release, *args)\n\t\tend",
"def button_up(id)\n current_scene and current_scene.button_up(id)\n end",
"def navigate(view)\n @view = view\n window.scrollTo(0, 0)\n end",
"def add_view(view)\n\n # Enter\n view.signal_connect('motion-notify-event') do |view, event|\n motion_handler(view, event)\n end\n\n # Leave\n view.signal_connect('leave-notify-event') do |view, event|\n leave_handler(view, event)\n end\n end",
"def zoom_in_out(in_out)\n if get_os==\"windows\"\n key=\"control\"\n elsif get_os==\"mac\"\n key=\"command\"\n end\n\n $driver.action.key_down(:\"#{key}\").send_keys(:\"#{in_out}\").key_up(:\"#{key}\").perform\nend",
"def pmouseX()\n @view__.pmouseX\n end",
"def getup\n send_command 0x23, 0x2\n end",
"def MoveUp()\r\n ret = _invoke(1610743821, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end",
"def button_down_main_menu_presenter(id, window, state)\n case id\n when Gosu::MsLeft\n navigate_to(window, Presenter::HOW_TO_PRESENTER) if mouse_over_button(state[:buttons][:how_to], window.mouse_x, window.mouse_y)\n navigate_to(window, Presenter::MAZE_PRESENTER, { algorithm: MazeAlgorithm::DEPTH_FIRST}) if mouse_over_button(state[:buttons][:depth_first], window.mouse_x, window.mouse_y)\n navigate_to(window, Presenter::MAZE_PRESENTER, { algorithm: MazeAlgorithm::ITERATIVE_DIVISION}) if mouse_over_button(state[:buttons][:iterative_division], window.mouse_x, window.mouse_y)\n window.close if mouse_over_button(state[:buttons][:quit], window.mouse_x, window.mouse_y)\n end\nend",
"def move_up(environment)\n @previous_action = 'moved up'\n location[:y] -= 1 if can_move_up?(environment)\n environment.state\n end",
"def cursor_pagedown\n end",
"def cursor_pagedown\n end",
"def unclicked(mouse_event)\n end",
"def suspend(view)\n puts(\"suspend\")\n Sketchup.active_model.select_tool(nil)\n end",
"def pmouseY()\n @view__.pmouseY\n end",
"def cursor_pagedown\r\n end",
"def _interact\n\t\tframework.events.on_session_interact(self)\n\tend",
"def click obj = nil, wait = 0.2\n move_mouse_to obj, wait: 0 if obj\n Mouse.click_down\n yield if block_given?\n ensure\n Mouse.click_up\n sleep wait\n end",
"def action\n trigger :click\n end",
"def action_down\n @ui.index += 1\n end",
"def touches()\n @view__.touches\n end",
"def update\n super\n # Process mouse operations if mouse is on screen and custom method implemented\n #if $mouse.on_screen? and @active_mod_on\n # if mouse_on_window?\n # Mouse.window_add(self)\n # end\n #end\n end",
"def clicked(e)\n \n end",
"def button_down_game_replay_presenter(id, window, state)\n if id == Gosu::KbSpace\n navigate_back(window) if id == Gosu::KbSpace\n end\n level_up(state) if id == Gosu::KbRight\n level_down(state) if id == Gosu::KbLeft\nend",
"def scroll_up\n ESC + 'M'\n end"
] | [
"0.74409336",
"0.70411247",
"0.7015006",
"0.68757945",
"0.66723114",
"0.66310817",
"0.65456325",
"0.643381",
"0.64202833",
"0.6317513",
"0.6235888",
"0.6089067",
"0.6086203",
"0.60452515",
"0.5999381",
"0.59874123",
"0.5944232",
"0.5944232",
"0.59237576",
"0.5908306",
"0.59025604",
"0.5897492",
"0.58860683",
"0.5878382",
"0.58644295",
"0.5860379",
"0.5855129",
"0.5837644",
"0.58148116",
"0.5789587",
"0.5770752",
"0.5769082",
"0.57556623",
"0.5727921",
"0.5727921",
"0.5714724",
"0.57128453",
"0.57069916",
"0.57069916",
"0.56746864",
"0.56200826",
"0.55998534",
"0.55838144",
"0.55838144",
"0.5568616",
"0.55682015",
"0.55478233",
"0.55062133",
"0.55062133",
"0.55062133",
"0.5492311",
"0.5490823",
"0.5488065",
"0.5483641",
"0.547919",
"0.5478681",
"0.5472835",
"0.54647535",
"0.54628164",
"0.5455597",
"0.54536223",
"0.54514945",
"0.5448619",
"0.544584",
"0.5427595",
"0.5417147",
"0.5407934",
"0.5403745",
"0.53913534",
"0.53754175",
"0.5352055",
"0.5347969",
"0.5341607",
"0.53375787",
"0.53220457",
"0.5321724",
"0.53194857",
"0.5311743",
"0.5298553",
"0.52732766",
"0.526538",
"0.5260841",
"0.5246114",
"0.5243675",
"0.524213",
"0.52328575",
"0.52328575",
"0.5224668",
"0.5219008",
"0.5217583",
"0.52164656",
"0.5202053",
"0.5194368",
"0.5190542",
"0.51886904",
"0.51812184",
"0.51732594",
"0.5168866",
"0.5164291",
"0.5160702"
] | 0.7168414 | 1 |
Used to perform a mouse down with right button on this view in the remote application | def right_mouse_down()
right_mouse_down_at :center, :center
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def right_click()\n right_mouse_down\n right_mouse_up\n stall :right_click\n end",
"def right_click(name, *args)\n widget(name, *args).right_click\n end",
"def mouseButton()\n @view__.mouseButton\n end",
"def mousedown(btn = 'left')\n compatible_call :mousedown, btn\n end",
"def doubleclick(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse with double click\n end tell\n `)\n end",
"def right_mouse_up()\n right_mouse_up_at :center, :center\n end",
"def click(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse\n end tell\n `)\n end",
"def onRButtonDown(flags, x, y, view)\n ph = view.pick_helper\n ph.do_pick x,y\n ent = ph.best_picked\n focus_control\n end",
"def onRButtonDoubleClick(flags, x, y, view)\n end",
"def onRButtonDown(flags, x, y, view)\r\n ph = view.pick_helper\r\n ph.do_pick x,y\r\n ent = ph.best_picked\r\n focus_control\r\n end",
"def mouse_down locator\r\n command 'mouseDown', locator\r\n end",
"def mouse_down locator\r\n command 'mouseDown', locator\r\n end",
"def button_down; end",
"def button_down(key)\n MenuControllerContracts.invariant(self)\n @current_view.button_down(key)\n MenuControllerContracts.invariant(self)\n end",
"def click\n `#@native.click()`\n end",
"def mouse_pressed\n super\n\n if mouse_button == RIGHT\n @right_mouse_down_x = mouseX\n @right_mouse_down_y = mouseY\n end\n end",
"def left_button_down(sender, selector, event)\n @canvas.grab\n @mouse_down = true\n end",
"def click\n `#@native.click()`\n self\n end",
"def click\n p [ :app_click ]\n view.click\n end",
"def button_down(id)\n click_handlers.each(&:call) if enabled? && id == Gosu::MS_LEFT &&\n within_bounds?(mouse_point)\n end",
"def press_mouse(button)\n XDo::FFILib.xdo_mousedown @_xdo_pointer, @_window, button\n end",
"def click()\n mouse_down\n mouse_up\n stall :click\n end",
"def doubleclick(btn = 'left')\n compatible_call :doubleclick, btn\n end",
"def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, true, o1, o2, o3, o4, o5)\nend",
"def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, true, o1, o2, o3, o4, o5)\nend",
"def onLButtonDown(flags,x,y,view)\n [email protected]\n ParametricCopy::run(pickpoint)\n Sketchup.send_action(\"selectSelectionTool:\")\n end",
"def onLButtonDoubleClick(flags, x, y, view)\n end",
"def mouse_down()\n mouse_down_at :center, :center\n end",
"def click\n Vedeu.log(type: :input,\n message: \"Mouse pressed: '#{button}' (x: #{x}, y: #{y})\")\n\n if left_click?\n Vedeu.trigger(:_cursor_reposition_, Vedeu.focus, y, x)\n\n elsif wheel_up?\n Vedeu.trigger(:_cursor_up_, Vedeu.focus)\n\n elsif wheel_down?\n Vedeu.trigger(:_cursor_down_, Vedeu.focus)\n\n else\n Vedeu.log(type: :input,\n message: 'Vedeu does not support mouse button ' \\\n \"'#{button}' yet.\")\n\n end\n end",
"def click_mouse(button)\n XDo::FFILib.xdo_click @_xdo_pointer, @_window, button\n end",
"def button_down(id); end",
"def double_click locator\r\n command 'doubleClick', locator\r\n end",
"def button_down(key)\n end",
"def tripleclick(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse\n ES click mouse\n ES click mouse\n end tell\n `)\n end",
"def onRButtonUp(flags, x, y, view)\n end",
"def alt_key_down\r\n command 'altKeyDown'\r\n end",
"def control_key_down\r\n command 'controlKeyDown'\r\n end",
"def button_down id\n end",
"def handle_offscreen_right() end",
"def handle_offscreen_right() end",
"def right_click(locator, offset = {})\n x = offset.fetch(:x, 0)\n y = offset.fetch(:y, 0)\n\n element = find_element(locator)\n action.move_to(element, x, y).context_click.perform\n end",
"def click\r\n start_point = screen.find ident\r\n click_x = start_point.x + offset_x\r\n click_y = start_point.y + offset_y\r\n\r\n screen.click click_x, click_y\r\n end",
"def button_down(id)\r\n $scene.button_down(id)\r\n end",
"def click; end",
"def click; end",
"def click; end",
"def button_down(id)\n fire :button_down, id\n end",
"def mouse_clicked\n\t\t# Send the mouse click to the Interaction Controller. It'll do the dirty work.\n\t\t@interaction_controller.mouse_clicked\n\t\tputs \"Editor#mouse_clicked\"\n\tend",
"def action\n trigger :click\n end",
"def close_menu\n pending\n perform_action('drag', 20, 0, 10, 10, 10)\n end",
"def button_down(id)\n end",
"def shift_key_down\r\n command 'shiftKeyDown'\r\n end",
"def double_click()\n double_click_at :center, :center\n end",
"def mouse_up *args; end",
"def click(*args)\n\t\t\t# if no argument has been provided, click on the\n\t\t\t# window itself\n\t\t\th = (args.length == 0) ? @handle : child(args[0]).handle\n\t\t\t\n\t\t\trectangle = [0, 0, 0, 0].pack 'LLLL'\n\t\t\tget_window_rect h, rectangle\n\t\t\tleft, top, right, bottom = rectangle.unpack 'LLLL'\n\t\t\t\n\t\t\tcenter = [(left + right) / 2, (top + bottom) / 2]\n\t\t\tset_cursor_pos *center\n\t\t\t\n\t\t\tmouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0\n\t\t\tmouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0\n\t\tend",
"def on_button_down( button_id )\n end",
"def key_down locator, keycode\r\n command 'keyDown', locator, keycode\r\n end",
"def key_down locator, keycode\r\n command 'keyDown', locator, keycode\r\n end",
"def button_down_game_replay_presenter(id, window, state)\n if id == Gosu::KbSpace\n navigate_back(window) if id == Gosu::KbSpace\n end\n level_up(state) if id == Gosu::KbRight\n level_down(state) if id == Gosu::KbLeft\nend",
"def key_down(key)\n focus\n @driver.sc_key_down action_target, key, *action_locator_args\n stall :key_down\n end",
"def rightClick?(object=nil,width=-1,height=-1)\n if object.nil?\n return Input.triggerex?(Input::Mouse_Left)\n else\n return (self.over?(object,width,height) && Input.triggerex?(Input::Mouse_Right))\n end\n end",
"def scrollDown\n \th = getProperty('height')\n w = getProperty('width')\n mouseClick(waitForObject(@symbolicName, OBJECT_WAIT_TIMEOUT), w/2, h-20, 0, Qt::LEFT_BUTTON)\n end",
"def button_down(id)\n\t\tcase id\n\t\twhen Gosu::KbEscape\n\t\t\tclose\n\t\tend\n\tend",
"def button_down(id)\r\n if id == Gosu::KB_ESCAPE\r\n close\r\n else\r\n super\r\n end\r\n end",
"def click(btn = 'left')\n compatible_call :click, btn\n end",
"def button_down(id)\r\n if id == Gosu::KB_ESCAPE\r\n close\r\n else\r\n super\r\n end\r\n end",
"def button_down(id)\n case id\n when Gosu::MsLeft\n button_handler\n end\n end",
"def left_button_up(sender, selector, event)\n @canvas.ungrab\n @mouse_down = false\n flush_commands\n board_draw\n end",
"def button_down(id)\r\n case id\r\n when Gosu::KbEscape\r\n close\r\n end\r\n end",
"def button_down(id)\n Controllers::ControllerSupervisor.dispatch(:button_down, id)\n end",
"def dvdnav _button_name\n send_cmd(\"dvdnav #{_button_name}\")\n end",
"def button_down(id)\n\t\[email protected]_down(id) if @controller\n\tend",
"def double_click_on(object)\n page.driver.browser.mouse.double_click(object.native)\n end",
"def on_button_down(button_id, point)\n end",
"def macNativeShortcut(element, key)\n\t\tputs key\n\t\tcase key\n\t\twhen 'x'\n\t\t\tputs \"something\"\n\t\t\tpage.execute_script(\"\n\t\t\t\tvar event = new Event('cut', true, false);\n\t\t\t\t$('.wysihtml5-sandbox').contents().find('body')[0].dispatchEvent(event);\n\t\t\t\t\")\n\n\t\twhen 'p'\n\t\t\tpage.execute_script(\"\n\t\t\t\tvar pasteevent = new Event('paste', true, false);\n\t\t\t\t$('.wysihtml5-sandbox').contents().find('body')[0].dispatchEvent(pasteevent);\n\t\t\t\t\")\n\t\tend\n\n\t\telement.native.send_keys [:command, key]\n\tend",
"def right()\n @view__.right\n end",
"def hotkey\n @link.HotKey\n end",
"def editor_right!\n Vedeu.bind(:_editor_right_) do |name|\n Vedeu.documents.by_name(name).right\n end\n end",
"def onLButtonUp(flags, x, y, view)\n end",
"def click(id)\n\t\t\th = child(id).handle\n\t\t\t\n\t\t\trectangle = [0, 0, 0, 0].pack 'LLLL'\n\t\t\tget_window_rect h, rectangle\n\t\t\tleft, top, right, bottom = rectangle.unpack 'LLLL'\n\t\t\t\n\t\t\tcenter = [(left + right) / 2, (top + bottom) / 2]\n\t\t\tset_cursor_pos *center\n\t\t\t\n\t\t\tmouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0\n\t\t\tmouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0\n\t\tend",
"def press_menu\n driver.pressQuickMenuItem(text, true);\n end",
"def right_mouse_button\n case @lists[:active]\n when @lists['parallax']\n @p_selection = nil\n @p_image = nil\n when @lists['maps']\n when @lists['objects']\n @ob_selection = nil\n @ob_image = nil\n end\n \n end",
"def click\n root_node.click\n end",
"def mouseDown(event)\n windowFrame = self.frame\n # grab the mouse location in global coordinates\n @initialLocation = self.convertBaseToScreen(event.locationInWindow)\n @initialLocation.x -= windowFrame.origin.x;\n @initialLocation.y -= windowFrame.origin.y;\n end",
"def click\n @automation_element.get_current_pattern(System::Windows::Automation::InvokePattern.pattern).invoke\n end",
"def action_down\n @ui.index += 1\n end",
"def click locator\r\n command 'click', locator\r\n end",
"def click locator\r\n command 'click', locator\r\n end",
"def meta_key_down\r\n command 'metaKeyDown'\r\n end",
"def release_mouse(button)\n XDo::FFILib.xdo_mouseup @_xdo_pointer, @_window, button\n end",
"def rightPress?(object=nil,width=-1,height=-1)\n if object.nil?\n return Input.pressed(Input::Mouse_Left)\n else\n return (self.over?(object,width,height) && Input.pressed(Input::Mouse_Right))\n end\n end",
"def click\n @mech.click self\n end",
"def clicked;end",
"def on_left_button_down(evt)\n if evt.left_is_down()\n @hexbyte_started = false\n set_focus()\n x=evt.get_x ; y=evt.get_y \n if ( @dragging or evt.shift_down ) \n if ( idx=coords_to_idx(x,y, @cursor.area) )\n expand_selection(idx)\n refresh\n end\n elsif area=area_for_x(x)\n switch_areas() if area != @cursor.area and not AREAS[area].nil?\n if idx=coords_to_idx(x,y, area)\n clear_selection()\n @cursor.area = area\n @last_pos = self.cur_pos = (idx <= @data.size)? idx : @data.size\n end\n refresh\n end\n else\n evt.skip()\n return\n end\n end",
"def accessibilityPerformPress\n select!\n true\n end",
"def cursor_pagedown\r\n end",
"def leftClicked\n\t\[email protected]\n\tend",
"def cursor_down(wrap = false)\n Sound.play_cursor\n Input.update\n deactivate\n call_handler(:down)\n end",
"def select_with_click\n if mac_internal?\n press_menu\n else\n click\n end\n selected?\n end",
"def button_down_main_menu_presenter(id, window, state)\n case id\n when Gosu::MsLeft\n navigate_to(window, Presenter::HOW_TO_PRESENTER) if mouse_over_button(state[:buttons][:how_to], window.mouse_x, window.mouse_y)\n navigate_to(window, Presenter::MAZE_PRESENTER, { algorithm: MazeAlgorithm::DEPTH_FIRST}) if mouse_over_button(state[:buttons][:depth_first], window.mouse_x, window.mouse_y)\n navigate_to(window, Presenter::MAZE_PRESENTER, { algorithm: MazeAlgorithm::ITERATIVE_DIVISION}) if mouse_over_button(state[:buttons][:iterative_division], window.mouse_x, window.mouse_y)\n window.close if mouse_over_button(state[:buttons][:quit], window.mouse_x, window.mouse_y)\n end\nend"
] | [
"0.8220887",
"0.71045494",
"0.6909964",
"0.68614495",
"0.67855126",
"0.67848325",
"0.6757193",
"0.6700054",
"0.6669304",
"0.6649842",
"0.65229195",
"0.65229195",
"0.6459944",
"0.64044327",
"0.6401079",
"0.6364125",
"0.6337989",
"0.6335398",
"0.6329051",
"0.63116217",
"0.6297584",
"0.62642205",
"0.6251305",
"0.62273246",
"0.62236184",
"0.6178762",
"0.6175631",
"0.61629164",
"0.6161985",
"0.6148318",
"0.61202645",
"0.6110786",
"0.60958266",
"0.6050419",
"0.60273725",
"0.60086966",
"0.6002722",
"0.59737784",
"0.5966258",
"0.5966258",
"0.5951378",
"0.5936814",
"0.59241146",
"0.5915336",
"0.5915336",
"0.5915336",
"0.5914169",
"0.5888189",
"0.5870912",
"0.5862257",
"0.58481795",
"0.584331",
"0.58093184",
"0.58058494",
"0.5800189",
"0.5798627",
"0.5798299",
"0.5798299",
"0.57922626",
"0.5771498",
"0.5762231",
"0.5741904",
"0.57399744",
"0.5734768",
"0.5723474",
"0.5713782",
"0.5704187",
"0.56766856",
"0.5675951",
"0.56659424",
"0.56570715",
"0.5644752",
"0.5643445",
"0.56332994",
"0.5609497",
"0.56083757",
"0.5606807",
"0.5599562",
"0.5599537",
"0.5580696",
"0.5563387",
"0.55548644",
"0.5538625",
"0.5534271",
"0.55260026",
"0.5512812",
"0.55069935",
"0.55069935",
"0.5504273",
"0.5500985",
"0.5500731",
"0.5496469",
"0.5493943",
"0.54844743",
"0.5472479",
"0.5472112",
"0.546679",
"0.54541206",
"0.5444811",
"0.5443655"
] | 0.7414242 | 1 |
Used to perform a mouse up with right button on this view in the remote application | def right_mouse_up()
right_mouse_up_at :center, :center
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def right_click()\n right_mouse_down\n right_mouse_up\n stall :right_click\n end",
"def onRButtonUp(flags, x, y, view)\n end",
"def right_mouse_down()\n right_mouse_down_at :center, :center\n end",
"def onLButtonUp(flags, x, y, view)\n end",
"def mouseButton()\n @view__.mouseButton\n end",
"def mouse_up *args; end",
"def onRButtonDown(flags, x, y, view)\n ph = view.pick_helper\n ph.do_pick x,y\n ent = ph.best_picked\n focus_control\n end",
"def onRButtonDown(flags, x, y, view)\r\n ph = view.pick_helper\r\n ph.do_pick x,y\r\n ent = ph.best_picked\r\n focus_control\r\n end",
"def right_click(name, *args)\n widget(name, *args).right_click\n end",
"def mouseup(btn = 'left')\n compatible_call :mouseup, btn\n end",
"def button_down; end",
"def button_down(key)\n MenuControllerContracts.invariant(self)\n @current_view.button_down(key)\n MenuControllerContracts.invariant(self)\n end",
"def click(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse\n end tell\n `)\n end",
"def onRButtonDoubleClick(flags, x, y, view)\n end",
"def mousedown(btn = 'left')\n compatible_call :mousedown, btn\n end",
"def mouse_pressed\n super\n\n if mouse_button == RIGHT\n @right_mouse_down_x = mouseX\n @right_mouse_down_y = mouseY\n end\n end",
"def mouse_up locator\r\n command 'mouseUp', locator\r\n end",
"def click()\n mouse_down\n mouse_up\n stall :click\n end",
"def click\n Vedeu.log(type: :input,\n message: \"Mouse pressed: '#{button}' (x: #{x}, y: #{y})\")\n\n if left_click?\n Vedeu.trigger(:_cursor_reposition_, Vedeu.focus, y, x)\n\n elsif wheel_up?\n Vedeu.trigger(:_cursor_up_, Vedeu.focus)\n\n elsif wheel_down?\n Vedeu.trigger(:_cursor_down_, Vedeu.focus)\n\n else\n Vedeu.log(type: :input,\n message: 'Vedeu does not support mouse button ' \\\n \"'#{button}' yet.\")\n\n end\n end",
"def button_up(id); end",
"def doubleclick(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse with double click\n end tell\n `)\n end",
"def click\n `#@native.click()`\n end",
"def button_down(key)\n end",
"def click\n p [ :app_click ]\n view.click\n end",
"def button_up(id)\n case id\n when Gosu::MsLeft\n if iterate_element() != nil\n element = iterate_element()\n click_event(element)\n end\n end\n end",
"def button_up(id)\r\n $scene.button_up(id)\r\n end",
"def click\n `#@native.click()`\n self\n end",
"def mouse_up()\n mouse_up_at :center, :center\n end",
"def left_button_up(sender, selector, event)\n @canvas.ungrab\n @mouse_down = false\n flush_commands\n board_draw\n end",
"def button_down_game_replay_presenter(id, window, state)\n if id == Gosu::KbSpace\n navigate_back(window) if id == Gosu::KbSpace\n end\n level_up(state) if id == Gosu::KbRight\n level_down(state) if id == Gosu::KbLeft\nend",
"def onLButtonDown(flags,x,y,view)\n [email protected]\n ParametricCopy::run(pickpoint)\n Sketchup.send_action(\"selectSelectionTool:\")\n end",
"def alt_key_up\r\n command 'altKeyUp'\r\n end",
"def button_up(key)\n self.close if key == Gosu::KbEscape\n end",
"def handle_offscreen_right() end",
"def handle_offscreen_right() end",
"def mouseUp event\n return if viewAtPoint(convertPoint(event.locationInWindow, fromView:nil)).nil?\n super(event) \n end",
"def onLButtonUp(flags, x, y, view)\n # If we are doing a drag, then create the line on the mouse up event\n if @dragging && @ip2.valid?\n self.cut_geometry(view)\n self.reset(view)\n end\n end",
"def key_up locator, keycode\r\n command 'keyUp', locator, keycode\r\n end",
"def key_up locator, keycode\r\n command 'keyUp', locator, keycode\r\n end",
"def action_down\n @ui.index += 1\n end",
"def action_up\n @ui.index -= 1\n end",
"def shift_key_up\r\n command 'shiftKeyUp'\r\n end",
"def release_mouse(button)\n XDo::FFILib.xdo_mouseup @_xdo_pointer, @_window, button\n end",
"def control_key_up\r\n command 'controlKeyUp'\r\n end",
"def button_down(id); end",
"def button_up(id)\n\n end",
"def button_up(id)\n end",
"def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, true, o1, o2, o3, o4, o5)\nend",
"def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, true, o1, o2, o3, o4, o5)\nend",
"def control_key_down\r\n command 'controlKeyDown'\r\n end",
"def button_up(id)\n\t\[email protected]_up(id) if @controller\n\tend",
"def mouse_down()\n mouse_down_at :center, :center\n end",
"def scrollUp\n \th = getProperty('height')\n w = getProperty('width')\n mouseClick(waitForObject(@symbolicName, OBJECT_WAIT_TIMEOUT), w/2, 20, 0, Qt::LEFT_BUTTON)\n end",
"def button_down id\n end",
"def key_up(key)\n focus\n @driver.sc_key_up action_target, key, *action_locator_args\n stall :key_up\n end",
"def press_mouse(button)\n XDo::FFILib.xdo_mousedown @_xdo_pointer, @_window, button\n end",
"def button_up(id)\n Controllers::ControllerSupervisor.dispatch(:button_up, id)\n end",
"def on_button_up(button_id, point)\n end",
"def close_menu\n pending\n perform_action('drag', 20, 0, 10, 10, 10)\n end",
"def mouse_down locator\r\n command 'mouseDown', locator\r\n end",
"def mouse_down locator\r\n command 'mouseDown', locator\r\n end",
"def up(key)\n key = normalize_keys(Array(key)).first\n @page.command(\"Input.dispatchKeyEvent\", slowmoable: true, type: \"keyUp\", **key)\n self\n end",
"def on_left_button_up(evt)\n if !evt.left_is_down()\n @dragging = false\n x=evt.get_x ; y=evt.get_y \n if @selection.nil? and \n idx=coords_to_idx(x,y, @cursor.area) and \n @data[idx]\n self.cur_pos = idx\n end\n else\n evt.skip()\n return\n end\n end",
"def button_down(id)\n click_handlers.each(&:call) if enabled? && id == Gosu::MS_LEFT &&\n within_bounds?(mouse_point)\n end",
"def button_up(key)\n close if key == Gosu::KbEscape\n\n # reset the game\n if @state == :end && key == Gosu::MsLeft\n @board = Board.new(self, 22, @root_dir)\n @state = :game\n return\n end\n\n @player_b.ai_inc if key == Gosu::KbS\n @player_b.ai_dec if key == Gosu::KbD\n\n if @player_on_turn.class == HotseatPlayer && key == Gosu::MsLeft\n if @board.cell_clicked(mouse_x, mouse_y, @player_on_turn.sym)\n\n return if @state == :end\n\n switch_players\n\n if @player_on_turn.class == AIPlayer\n @player_on_turn.make_move(@board)\n switch_players\n end\n end\n end\n end",
"def left_button_down(sender, selector, event)\n @canvas.grab\n @mouse_down = true\n end",
"def resume(view)\n @ctrlDown = false\n @shiftDown = false\n end",
"def alt_key_down\r\n command 'altKeyDown'\r\n end",
"def update\n\t\tif self.button_down?(Gosu::KbLeft)\n \t\tclose\n \tend\n end",
"def onLButtonDoubleClick(flags, x, y, view)\n end",
"def tripleclick(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse\n ES click mouse\n ES click mouse\n end tell\n `)\n end",
"def update\n\t\[email protected]_pressed_down if @controller\n\tend",
"def doubleclick(btn = 'left')\n compatible_call :doubleclick, btn\n end",
"def action\n trigger :click\n end",
"def button_down(id)\r\n $scene.button_down(id)\r\n end",
"def click; end",
"def click; end",
"def click; end",
"def macNativeShortcut(element, key)\n\t\tputs key\n\t\tcase key\n\t\twhen 'x'\n\t\t\tputs \"something\"\n\t\t\tpage.execute_script(\"\n\t\t\t\tvar event = new Event('cut', true, false);\n\t\t\t\t$('.wysihtml5-sandbox').contents().find('body')[0].dispatchEvent(event);\n\t\t\t\t\")\n\n\t\twhen 'p'\n\t\t\tpage.execute_script(\"\n\t\t\t\tvar pasteevent = new Event('paste', true, false);\n\t\t\t\t$('.wysihtml5-sandbox').contents().find('body')[0].dispatchEvent(pasteevent);\n\t\t\t\t\")\n\t\tend\n\n\t\telement.native.send_keys [:command, key]\n\tend",
"def shift_key_down\r\n command 'shiftKeyDown'\r\n end",
"def button_down_main_menu_presenter(id, window, state)\n case id\n when Gosu::MsLeft\n navigate_to(window, Presenter::HOW_TO_PRESENTER) if mouse_over_button(state[:buttons][:how_to], window.mouse_x, window.mouse_y)\n navigate_to(window, Presenter::MAZE_PRESENTER, { algorithm: MazeAlgorithm::DEPTH_FIRST}) if mouse_over_button(state[:buttons][:depth_first], window.mouse_x, window.mouse_y)\n navigate_to(window, Presenter::MAZE_PRESENTER, { algorithm: MazeAlgorithm::ITERATIVE_DIVISION}) if mouse_over_button(state[:buttons][:iterative_division], window.mouse_x, window.mouse_y)\n window.close if mouse_over_button(state[:buttons][:quit], window.mouse_x, window.mouse_y)\n end\nend",
"def button_down(id)\n end",
"def click(btn = 'left')\n compatible_call :click, btn\n end",
"def click_mouse(button)\n XDo::FFILib.xdo_click @_xdo_pointer, @_window, button\n end",
"def button_down(id)\r\n if id == Gosu::KB_ESCAPE\r\n close\r\n else\r\n super\r\n end\r\n end",
"def click\r\n start_point = screen.find ident\r\n click_x = start_point.x + offset_x\r\n click_y = start_point.y + offset_y\r\n\r\n screen.click click_x, click_y\r\n end",
"def press_menu\n driver.pressQuickMenuItem(text, true);\n end",
"def on_button_down( button_id )\n end",
"def hotkey\n @link.HotKey\n end",
"def button_down(id)\r\n case id\r\n when Gosu::KbEscape\r\n close\r\n end\r\n end",
"def cursor_pageup\r\n end",
"def cursor_pageup\n end",
"def cursor_pageup\n end",
"def button_down(id)\n fire :button_down, id\n end",
"def scrollDown\n \th = getProperty('height')\n w = getProperty('width')\n mouseClick(waitForObject(@symbolicName, OBJECT_WAIT_TIMEOUT), w/2, h-20, 0, Qt::LEFT_BUTTON)\n end",
"def button_up(id)\r\n\r\n # Up-Arrow key\r\n if id == Gosu::KbUp then\r\n @player.reset_jump if @player.is_jumping?\r\n end\r\n end",
"def update_right\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Switch to menu screen\r\n $scene = Scene_Menu.new(2)\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # If equipment is fixed\r\n if @actor.equip_fix?(@right_window.index)\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Activate item window\r\n @right_window.active = false\r\n @item_window.active = true\r\n @item_window.index = 0\r\n return\r\n end\r\n # If R button was pressed\r\n if Input.trigger?(Input::R)\r\n # Play cursor SE\r\n $game_system.se_play($data_system.cursor_se)\r\n # To next actor\r\n @actor_index += 1\r\n @actor_index %= $game_party.actors.size\r\n # Switch to different equipment screen\r\n $scene = Scene_Equip.new(@actor_index, @right_window.index)\r\n return\r\n end\r\n # If L button was pressed\r\n if Input.trigger?(Input::L)\r\n # Play cursor SE\r\n $game_system.se_play($data_system.cursor_se)\r\n # To previous actor\r\n @actor_index += $game_party.actors.size - 1\r\n @actor_index %= $game_party.actors.size\r\n # Switch to different equipment screen\r\n $scene = Scene_Equip.new(@actor_index, @right_window.index)\r\n return\r\n end\r\n end",
"def right_click(locator, offset = {})\n x = offset.fetch(:x, 0)\n y = offset.fetch(:y, 0)\n\n element = find_element(locator)\n action.move_to(element, x, y).context_click.perform\n end",
"def button_down(id)\n\t\tcase id\n\t\twhen Gosu::KbEscape\n\t\t\tclose\n\t\tend\n\tend",
"def button_up(id)\n current_scene and current_scene.button_up(id)\n end"
] | [
"0.7615465",
"0.7209488",
"0.6829979",
"0.67707485",
"0.6718878",
"0.66101974",
"0.6556208",
"0.65283513",
"0.64247715",
"0.64025277",
"0.6345036",
"0.62631476",
"0.6256526",
"0.6186642",
"0.61424077",
"0.61206996",
"0.6113832",
"0.6061944",
"0.60308164",
"0.60274345",
"0.600514",
"0.5998108",
"0.59857863",
"0.59814465",
"0.5975809",
"0.59660584",
"0.5953392",
"0.5945235",
"0.59448403",
"0.5918307",
"0.59031063",
"0.58859384",
"0.58648455",
"0.5862466",
"0.5862466",
"0.5846293",
"0.583499",
"0.5823491",
"0.5823491",
"0.5816553",
"0.5807822",
"0.58069366",
"0.58041364",
"0.5793406",
"0.5782838",
"0.57695556",
"0.5748749",
"0.57483816",
"0.5737779",
"0.57297987",
"0.57142735",
"0.57141274",
"0.5704403",
"0.5692045",
"0.5685466",
"0.5678725",
"0.5671506",
"0.56667036",
"0.56664044",
"0.56655145",
"0.56655145",
"0.56573576",
"0.5656803",
"0.5656671",
"0.56544363",
"0.56426454",
"0.5642385",
"0.5636357",
"0.56339025",
"0.56220436",
"0.56030864",
"0.5573923",
"0.5548235",
"0.5542884",
"0.5542702",
"0.5530127",
"0.5530127",
"0.5530127",
"0.5528063",
"0.55271655",
"0.5506678",
"0.550024",
"0.5487968",
"0.5479734",
"0.54726344",
"0.546494",
"0.5462418",
"0.54494196",
"0.5449234",
"0.544711",
"0.5445877",
"0.5445113",
"0.5445113",
"0.5440035",
"0.54372764",
"0.5433548",
"0.5428662",
"0.5427659",
"0.54209787",
"0.54203725"
] | 0.7255497 | 1 |
Used to perform a double click on this view in the remote application | def double_click()
double_click_at :center, :center
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def double_click locator\r\n command 'doubleClick', locator\r\n end",
"def doubleclick(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse with double click\n end tell\n `)\n end",
"def double_click(name, *args)\n widget(name, *args).double_click\n end",
"def double_click_on(object)\n page.driver.browser.mouse.double_click(object.native)\n end",
"def dClick\n doubleClick(waitForObject(@symbolicName))\n Log.AppendLog(@@logCmd.dClick(self))\n end",
"def doubleclick(btn = 'left')\n compatible_call :doubleclick, btn\n end",
"def doubleClick\n\[email protected]_click(@locator)\n end",
"def onLButtonDoubleClick(flags, x, y, view)\n end",
"def click\n p [ :app_click ]\n view.click\n end",
"def onRButtonDoubleClick(flags, x, y, view)\n end",
"def onDoubleClick _obj, _args\n \"_obj onDoubleClick _args;\" \n end",
"def doubleclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil)\n $marathon.click(componentName, false, 2, o1, o2, o3, o4)\nend",
"def doubleclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil)\n $marathon.click(componentName, false, 2, o1, o2, o3, o4)\nend",
"def double_click(*args)\n case args.length\n when 1 then click_image(args[0], true)\n when 2 then click_point(args[0], args[1], true)\n else raise ArgumentError\n end\n end",
"def double_click(element = T.unsafe(nil), device: T.unsafe(nil)); end",
"def tripleclick(btn = 'left')\n compatible_call :doubleclick, btn\n end",
"def double_click obj = nil, wait = 0.2\n move_mouse_to obj, wait: 0 if obj\n Mouse.double_click\n sleep wait\n end",
"def right_click()\n right_mouse_down\n right_mouse_up\n stall :right_click\n end",
"def double_click_at locator, coord_string\r\n command 'doubleClickAt', locator, coord_string\r\n end",
"def click\n `#@native.click()`\n end",
"def click\n `#@native.click()`\n self\n end",
"def tripleclick(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse\n ES click mouse\n ES click mouse\n end tell\n `)\n end",
"def double_click_neighborhood_view_script(neighborhood)\n Analytics::DoubleClick.new(\n :name => neighborhood.respond_to?(:name) ? neighborhood.name : neighborhood.title,\n :type => 'conve135',\n :cat => 'nv01',\n :description => 'Neighborhood View',\n :image => true).floodlight_tag_script\n end",
"def click\n @mech.click self\n end",
"def right_click(name, *args)\n widget(name, *args).right_click\n end",
"def click_point(x, y, is_double = false)\n if is_double\n @java_obj.doubleClick(org.sikuli.script::Location.new(x, y).offset(x(), y()), 0)\n else\n @java_obj.click(org.sikuli.script::Location.new(x, y).offset(x(), y()), 0)\n end\n end",
"def double_click_button(browser_handle, property, property_value)\n browser_handle.button(property.intern, /#{property_value}/).fire_event(\"ondblclick\")\nend",
"def click\n Log.Trace(\"Clicking on #{@symbolicName}\")\n mouseClick(waitForObject(@symbolicName))\n Log.AppendLog(@@logCmd.click(self))\n end",
"def double_click_button_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).fire_event(\"ondblclick\")\nend",
"def click(btn)\n not_supported \"anything other than left clicking\" unless btn == 'left'\n execute_applescript(%Q`\n tell application \"Extra Suites\"\n ES click mouse\n end tell\n `)\n end",
"def click; end",
"def click; end",
"def click; end",
"def action\n trigger :click\n end",
"def click\r\n start_point = screen.find ident\r\n click_x = start_point.x + offset_x\r\n click_y = start_point.y + offset_y\r\n\r\n screen.click click_x, click_y\r\n end",
"def double_click_button_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).fire_event_no_wait(\"ondblclick\")\nend",
"def double_click_button_with_popup(browser_handle, property, property_value)\n browser_handle.button(property.intern, /#{property_value}/).fire_event_no_wait(\"ondblclick\")\nend",
"def double_click_select_a_neighborhood_script(type)\n Analytics::DoubleClick.new(\n :name => type,\n :type => 'conve135',\n :cat => 'san01',\n :description => 'Select a Neighborhood').floodlight_tag_script\n end",
"def item_was_clicked(sender)\n # Find the selected Link instance via the array controller and get its url attribute\n url_string = array_controller.selectedObjects.first.url\n if url_string\n # convert the url into a NSURL instance and open it in the browser.\n url = NSURL.URLWithString(url_string)\n NSWorkspace.sharedWorkspace.openURL(url)\n end\n end",
"def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, true, o1, o2, o3, o4, o5)\nend",
"def rightclick(componentName, o1 = nil, o2 = nil, o3 = nil, o4 = nil, o5 = nil)\n $marathon.click(componentName, true, o1, o2, o3, o4, o5)\nend",
"def double_click(locator, offset = {})\n x = offset.fetch(:x, 0)\n y = offset.fetch(:y, 0)\n\n element = find_element(locator)\n\n action\n .move_to(element, x, y)\n .double_click\n .perform\n end",
"def click_mouse(button)\n XDo::FFILib.xdo_click @_xdo_pointer, @_window, button\n end",
"def click_image(filename, is_double = false)\n begin\n if is_double\n @java_obj.doubleClick(filename, 0)\n else\n @java_obj.click(filename, 0)\n end\n rescue NativeException => e\n raise_exception e, filename\n end\n end",
"def click locator\r\n command 'click', locator\r\n end",
"def click locator\r\n command 'click', locator\r\n end",
"def click()\n mouse_down\n mouse_up\n stall :click\n end",
"def click_view_website\n view_website_link.click\n end",
"def click\n @automation_element.get_current_pattern(System::Windows::Automation::InvokePattern.pattern).invoke\n end",
"def double_click(element_name)\n begin\n $driver.action.double_click(el(element_name)).perform\n rescue Exception => e\n $LOG.error \"error in perform double click on element \\n element name : #{element_name} \"+e.message\n $driver.save_screenshot(\"log/webscreenshot/webScreenshot_#{$webscreenshot}.png\")\n $webscreenshot = $webscreenshot+1\n raise \"error in perform double click on element \\n element name : #{element_name} \"+e.message\n end\n end",
"def double_click_image_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).fire_event(\"ondblclick\")\nend",
"def click\n raise \"Must implement custom click method.\"\n end",
"def double_click_tree(tree, *path)\n path = tree_path(path_elements)\n append_to_script \"double_click_tree \\\"#{tree}\\\",#{path}\"\n end",
"def double_click_image_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val)\n browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).fire_event_no_wait(\"ondblclick\")\nend",
"def click_action\n raise NotImplementedError \"Subclasses must implement this method\"\n end",
"def on_click\n\t\tend",
"def mouse_down locator\r\n command 'mouseDown', locator\r\n end",
"def mouse_down locator\r\n command 'mouseDown', locator\r\n end",
"def clicked(e)\n \n end",
"def click\n root_node.click\n end",
"def mouseButton()\n @view__.mouseButton\n end",
"def triple_click obj = nil, wait = 0.2\n move_mouse_to obj, wait: 0 if obj\n Mouse.triple_click\n sleep wait\n end",
"def double_click_div(browser_handle, property, property_value)\n browser_handle.div(property.intern, /#{property_value}/).fire_event(\"ondblclick\")\nend",
"def click\n @_node.click\n @_node.getPage.getWebClient.waitForBackgroundJavaScriptStartingBefore(3000)\n end",
"def onLButtonDown(flags,x,y,view)\n [email protected]\n ParametricCopy::run(pickpoint)\n Sketchup.send_action(\"selectSelectionTool:\")\n end",
"def click(type, query)\n browser.send(type, query).click\n end",
"def basic_click()\n scroll_to_visible\n @driver.sc_basic_click action_target, *action_locator_args\n stall :click\n end",
"def click(link); end",
"def question_classic_button_click\n MenuControllerContracts.invariant(self)\n @alert_view = @help_view = Views::ConnectInstructionsAlertView.new(@window, self)\n MenuControllerContracts.invariant(self)\n end",
"def mouse_clicked\n\t\t# Send the mouse click to the Interaction Controller. It'll do the dirty work.\n\t\t@interaction_controller.mouse_clicked\n\t\tputs \"Editor#mouse_clicked\"\n\tend",
"def double_click_div_with_popup(browser_handle, property, property_value)\n browser_handle.div(property.intern, /#{property_value}/).fire_event_no_wait(\"ondblclick\")\nend",
"def double_click_list(list, row_index)\n append_to_script \"double_click_list \\\"#{list}\\\" , \\\"#{row_index}\\\"\"\n end",
"def click(*args)\n\t\t\t# if no argument has been provided, click on the\n\t\t\t# window itself\n\t\t\th = (args.length == 0) ? @handle : child(args[0]).handle\n\t\t\t\n\t\t\trectangle = [0, 0, 0, 0].pack 'LLLL'\n\t\t\tget_window_rect h, rectangle\n\t\t\tleft, top, right, bottom = rectangle.unpack 'LLLL'\n\t\t\t\n\t\t\tcenter = [(left + right) / 2, (top + bottom) / 2]\n\t\t\tset_cursor_pos *center\n\t\t\t\n\t\t\tmouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0\n\t\t\tmouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0\n\t\tend",
"def context_click(element = T.unsafe(nil), device: T.unsafe(nil)); end",
"def double_click?(btn)\n @dbl_click[btn]\n end",
"def clicked\n router.navigated\n end",
"def clicked;end",
"def TreeView_SelectDropTarget(hwnd, hitem) TreeView_Select(hwnd, hitem, TreeViewGetNextItem[:DROPHILITE]) end",
"def question_otto_button_click\n MenuControllerContracts.invariant(self)\n @alert_view = @help_view = Views::OttoInstructionsAlertView.new(@window, self)\n MenuControllerContracts.invariant(self)\n end",
"def clicked(mouse_event)\n end",
"def double_click_table_row(table, row_index)\n append_to_script \"double_click_table_row \\\"#{table}\\\" , \\\"#{row_index}\\\"\"\n end",
"def view(name, locator)\n define_method(name) do\n platform.click_view(locator)\n end\n end",
"def click\n @clicked_x = @x\n @clicked_y = @y\n fire(:click, @clicked_x, @clicked_y)\n end",
"def clicked\n if @alert_view != nil\n @alert_view.clicked\n else\n @current_view.clicked\n end\n end",
"def goto_imedidata\n self.imedidatalink.click\n end",
"def unclicked(e)\n puts \"Unclicked!\"\n end",
"def switchto_listview()\n\t\[email protected](:class, \"btn icon-list-view\").click\n\tend",
"def click_act_as_link\n act_as_link.click\n sleep(10)\n end",
"def press_mouse(button)\n XDo::FFILib.xdo_mousedown @_xdo_pointer, @_window, button\n end",
"def click(id)\n\t\t\th = child(id).handle\n\t\t\t\n\t\t\trectangle = [0, 0, 0, 0].pack 'LLLL'\n\t\t\tget_window_rect h, rectangle\n\t\t\tleft, top, right, bottom = rectangle.unpack 'LLLL'\n\t\t\t\n\t\t\tcenter = [(left + right) / 2, (top + bottom) / 2]\n\t\t\tset_cursor_pos *center\n\t\t\t\n\t\t\tmouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0\n\t\t\tmouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0\n\t\tend",
"def run_directly!(duty_cycle = nil)\n self.duty_cycle_setpoint = duty_cycle if duty_cycle\n\n self.command = :'run-direct'\n end",
"def complete_click(publisher_app)\n click_with_rest! publisher_app\n end",
"def click\n `#{@el}.click() || Opal.nil`\n end",
"def goForward(sender)\n web_view.goForward\n end",
"def ctrlShow _obj, _args\n \"_obj ctrlShow _args;\" \n end",
"def open_in_browser\n selection = @list_view.selection\n if iter = selection.selected\n selected_category = iter.parent[0]\n task_index = iter[3]\n url = todo_data.get_trac_url(task_index)\n Launchy.open(url)\n end\n end",
"def mouse_clicked(event)\n \n puts \"IN schemasTreeTable_mouse_clicked : #{event.inspect}\"\n puts \"MOUSE #{event.class} : #{event.getClickCount} : BUTTON #{event.getButton}\"\n\n # Double Click => EDIT\n if(event.getClickCount == 2)\n puts \"edit\"\n \n elsif( event.getButton == java.awt.event.MouseEvent::BUTTON3)\n \n transfer[:event] = event\n\n listener = PopupActionListener.new( self )\n\n items = [\"Select All\", \"Clear\"]\n\n listener.add_callback_method(\"Select All\", :select_all_action_performed )\n\n listener.add_callback(\"Clear\") do\n puts \"CLEAR SCHEMA SELECTION\"\n end\n\n pmenu = PopupMenuController.create_instance\n\n pmenu.open(event, items, listener )\n end\n end",
"def click_web_link(text)\n\t\[email protected](\"Clicking web link #{text}\")\n\t\t\n\t\t@main_window.click(text)\n\tend",
"def onItemClick(parent, view, position, id)\n selectItem(position)\n end",
"def onRButtonDown(flags, x, y, view)\n ph = view.pick_helper\n ph.do_pick x,y\n ent = ph.best_picked\n focus_control\n end"
] | [
"0.75741035",
"0.7281992",
"0.7211197",
"0.71802217",
"0.7144681",
"0.69739574",
"0.69424194",
"0.69363093",
"0.68716615",
"0.681438",
"0.67492074",
"0.66316587",
"0.66234213",
"0.6425598",
"0.64248294",
"0.6347549",
"0.6313054",
"0.6244711",
"0.62425816",
"0.6210441",
"0.61986554",
"0.6193898",
"0.6130139",
"0.61085325",
"0.61034775",
"0.6098022",
"0.60903853",
"0.60592055",
"0.605905",
"0.59590197",
"0.59256744",
"0.59256744",
"0.59256744",
"0.58475447",
"0.5838326",
"0.5820138",
"0.58181584",
"0.5809711",
"0.58030397",
"0.57841825",
"0.5775243",
"0.5774314",
"0.57463866",
"0.5745799",
"0.57336783",
"0.57336783",
"0.5711238",
"0.5668402",
"0.5665528",
"0.56514955",
"0.56493866",
"0.5636541",
"0.5595",
"0.5583151",
"0.5572819",
"0.55220586",
"0.55159235",
"0.55159235",
"0.5513132",
"0.5474811",
"0.54187506",
"0.53991556",
"0.53749925",
"0.5346788",
"0.5346258",
"0.53451663",
"0.5333222",
"0.53047276",
"0.52992254",
"0.52895397",
"0.52857363",
"0.5278631",
"0.5273171",
"0.5250818",
"0.5218806",
"0.52128124",
"0.52107614",
"0.5206159",
"0.51671666",
"0.5156712",
"0.5146023",
"0.51456636",
"0.5121522",
"0.511653",
"0.5113268",
"0.51012754",
"0.5092294",
"0.5083503",
"0.50621563",
"0.5047989",
"0.5016929",
"0.5011659",
"0.5010971",
"0.49833447",
"0.4929047",
"0.4924415",
"0.4921349",
"0.4920196",
"0.4900061",
"0.48938105"
] | 0.7012492 | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.