query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Attempts to determine if the host with Elastic IP is reachable If not reachable then returns false
def eip_healthy?(retries=5) # try to ping elastic IP with eip uri_str = "http://#{@eip}:#{@loadbalancer_healthcheck_port}#{@loadbalancer_healthcheck_path}" uri = URI(uri_str) result = false retries.times.each do case Net::HTTP.get_response(uri) when Net::HTTPSuccess then result = true break else result = false end end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ip_reachable?(ip)\n external = Net::Ping::External.new(ip)\n\n log_info %(attempting to contact host \"#{ip}\")\n reachable = external.ping || external.ping6\n if reachable\n log_success %(host \"#{ip}\" is reachable)\n else\n log_error %(unable to contact host \"#{ip}\")\n end\n\n reachable\n end", "def reachable?\n ping\n true\n rescue Orocos::ComError\n false\n end", "def internal_host?(host)\n Resolv.getaddresses(host).all? { |ip| internal_ip?(ip) }\n rescue URI::Error\n false\n end", "def check_host\n result = `ping -q -c 2 #{@conn[:host]}`\n # return true or false if exit status is 0\n $?.exitstatus == 0\n end", "def ifHostUp(host)\n Net::Ping::TCP.econnrefused = true\n Net::Ping::TCP.new(host).ping?\n end", "def alive?(host)\n puts \"Checking host: #{host}\"\n Timeout::timeout(@timeout) do\n result = `ping -c 1 #{host}`\n if result.include?(\"time=\")\n return true\n end\n end\n rescue\n return false\n end", "def host_avail?(hostname)\n host_available = false\n puts \"Pinging host #{hostname}...\"\n exit_status = system(\"ping -q -c 1 #{hostname} >/dev/null 2>&1\")\n if exit_status\n puts \" --> Host #{hostname} is available.\"\n host_available = true\n else\n puts \" --> Host #{hostname} is unavailable!\"\n end\n host_available\n end", "def is_reachable_url?(url)\n begin\n wait(15, true, 1) {\n RestClient.get url\n }\n\n rescue Exception => e\n @@logger.an_event.debug \"url #{url} unreachable : #{e.message}\"\n false\n\n else\n @@logger.an_event.debug \"url #{url} reachable\"\n true\n\n end\n end", "def alive?(ip)\n\n ping = \"ping -q -c 1 -w 4\"\n result = `#{ping} #{ip}`\n return $?.exitstatus == 0\n\n end", "def host_is_okay\n return false unless @report_data[:host]\n return false unless valid_ip(@report_data[:host])\n return false unless @report_data[:state] == Msf::HostState::Alive\n if @args[:blacklist]\n return false if @args[:blacklist].include?(@report_data[:host])\n end\n return true\n end", "def host_agent_ready?\n # Localhost\n uri = URI.parse(\"http://#{LOCALHOST}:#{@port}/\")\n req = Net::HTTP::Get.new(uri)\n\n response = make_host_agent_request(req)\n\n if response && (response.code.to_i == 200)\n @host = LOCALHOST\n return true\n end\n\n return false unless @is_linux\n\n # We are potentially running on Docker in bridged networking mode.\n # Attempt to contact default gateway\n uri = URI.parse(\"http://#{@default_gateway}:#{@port}/\")\n req = Net::HTTP::Get.new(uri)\n\n response = make_host_agent_request(req)\n\n if response && (response.code.to_i == 200)\n @host = @default_gateway\n return true\n end\n false\n rescue => e\n Instana.logger.error \"#{__method__}:#{File.basename(__FILE__)}:#{__LINE__}: #{e.message}\"\n Instana.logger.debug e.backtrace.join(\"\\r\\n\")\n return false\n end", "def up?(host)\n check = Net::Ping::External.new(host)\n check.ping?\nend", "def check_ip; end", "def server_reachable?\n puts \"Checking #{@address}:#{@port}\"\n res = Net::HTTP.start(@address, @port) {|http| http.get('/') }\n return res.code == \"200\"\n end", "def host_in_use?(hostname)\n @hosts[hostname][:used]\n end", "def eaddrnotavail?() EADDRNOTAVAIL == @error_code; end", "def ping\n stats\n true\n rescue Errno::ECONNREFUSED\n false\n end", "def doi_server_reachable?\n Ezid::Client.new.server_status.up? rescue false\n end", "def doi_server_reachable?\n Ezid::Client.new.server_status.up? rescue false\n end", "def doi_server_reachable?\n Ezid::Client.new.server_status.up? rescue false\n end", "def has_host?(addr)\n\t\tHost.find(:first, :conditions => [ \"address = ?\", addr])\n\tend", "def portainer?(ip, segundos=1) \n Timeout::timeout(segundos) do \n begin\n TCPSocket.new(ip, \"#{$port}\").close # Check Portainer port.\n true\n rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, SocketError\n false # If Exception, do not count this host.\n end\n end\n rescue Timeout::Error # If Timeout, do not count this host.\n false\nend", "def ping(host)\n begin\n Timeout.timeout(5) do\n s = TCPSocket.new(host, 'echo')\n s.close\n return true\n end\n rescue Errno::ECONNREFUSED\n return true\n rescue Timeout::Error, Errno::ENETUNREACH, Errno::EHOSTUNREACH\n return false\n end\n end", "def doi_server_reachable?\n # Invoke the API and get response\n true\n end", "def eaddrinuse?() EADDRINUSE == @error_code; end", "def try(host = 'nodeinfo.hype')\n begin\n Timeout::timeout(5) do\n return true if aaaa(host)\n end\n rescue Timeout::Error\n return false\n end\n end", "def directly_reachable(target)\n number_of_interfaces_checked = 0\n @facts['interfaces'].split(',').each do |inf|\n if @facts[\"ipaddress_#{inf}\"] && @facts[\"netmask_#{inf}\"]\n number_of_interfaces_checked += 1\n infaddr = IPAddr.new(@facts[\"ipaddress_#{inf}\"] + '/' + @facts[\"netmask_#{inf}\"])\n return true if infaddr.include?(IPAddr.new(target))\n end\n end\n if number_of_interfaces_checked > 0\n return false\n else\n # If Facter failed for some reason and didn't send us any interface\n # data we don't want to have etch unconfigure/misconfigure the\n # networking on the client\n abort \"No interface addresses/netmasks received\"\n end\nend", "def valid?\n ping\n end", "def reachable?\n !!client\n end", "def reachable?\n !!client\n end", "def pingable?\n true\n end", "def ping(host)\n begin\n Timeout.timeout(5) do\n s = TCPSocket.new(host, 'echo')\n s.close\n return true\n end\n rescue Errno::ECONNREFUSED\n return true\n rescue Timeout::Error, Errno::ENETUNREACH, Errno::EHOSTUNREACH\n return false\n end\nend", "def host_exists?(host)\n # :nocov:\n # Patch for BZ840938 to support Ruby 1.8 on machines without /etc/resolv.conf\n dns = Resolv::DNS.new((Resolv::DNS::Config.default_config_hash || {}))\n dns.getresources(host, Resolv::DNS::Resource::IN::A).any?\n # :nocov:\n end", "def running?\n begin\n ping\n rescue Errno::EBADF, Errno::ECONNREFUSED => e\n return false\n end\n return true\n end", "def ping?\n false\n end", "def check_connection\n one_wait = 5\n max_wait = 5\n request = Net::HTTP::Get.new('/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@url.host, @url.port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy, \n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy, \n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n puts(\"-- ERROR: couldn't connect to test host on \" + @url.host.to_s)\n return false\n end\n puts(\"-- SUCCESS: test host is alive !\\n\")\n return true\nend", "def is_ok?\n return (self.status == HostResult::STATUS_OK)\n end", "def has_public_ipaddress?\n # Define the test value\n test = false\n\n entries.each do |entry|\n entry.ip_configurations.each do |ip_config|\n if ip_config['public_ipaddress']['attached']\n test = true\n break\n end\n end\n end\n\n test\n end", "def internet_http?\n host_http = 'http://www.google.com/index.html'\n check = Net::Ping::HTTP.new(host_http) #now http not as console\n check.ping?\n end", "def internet_http?\n host_http = 'http://www.google.com/index.html'\n check = Net::Ping::HTTP.new(host_http) #now http not as console\n check.ping?\n end", "def is_alive?\n res = @http_client.get_response( URI.parse(\"#{@url}/admin/ping?wt=ruby\") )\n \n if res.code != \"200\"\n raise IndexUnavailableError, \"Index HTTP error #{res.code}\"\n else\n data = eval(res.body)\n if data[\"status\"] === \"OK\"\n return true\n else\n raise IndexUnavailableError, \"Index Error: #{res.body}\"\n end\n end\n end", "def online?\n return @online unless check_replica_status?\n\n refresh_status\n\n if @online\n ::Gitlab::Database::LoadBalancing::Logger.info(\n event: :host_online,\n message: 'Host is online after replica status check',\n db_host: @host,\n db_port: @port\n )\n else\n ::Gitlab::Database::LoadBalancing::Logger.warn(\n event: :host_offline,\n message: 'Host is offline after replica status check',\n db_host: @host,\n db_port: @port\n )\n end\n\n @online\n rescue *CONNECTION_ERRORS\n offline!\n false\n end", "def is_hostname?\n ip = Rex::Socket.addr_atoi( @dest_ip )\n if( ip & 0xFFFFFF00 == 0x00000000 )\n return true if( ip & 0x000000FF != 0x00 )\n end\n return false\n end", "def is_healthy?\n if @real_socket == nil\n logger.debug \"Performing health check for #{self}\"\n begin\n request = Packet.pack_request(\"echo_req\", \"ping\")\n response = send_request(request, 3)\n logger.debug \"Health check response for #{self} is #{response.inspect}\"\n raise ProtocolError unless response[0] == :echo_res and response[1] == \"ping\"\n return true\n rescue NetworkError\n logger.debug \"NetworkError -- unhealthy\"\n return false\n rescue ProtocolError\n logger.debug \"ProtocolError -- unhealthy\"\n return false\n end\n end\n end", "def is_online?\n #Uses a SYN ping vs ICMP to avoid firewall issues.\n #Tries likely ports to determine if computer is up\n tls = Net::Ping::TCP.new(remote_repository, 443, 1)\n http = Net::Ping::TCP.new(remote_repository, 80, 1)\n ssh = Net::Ping::TCP.new(remote_repository, 22, 1)\n tls.ping or http.ping or ssh.ping\n end", "def reachable?\n state[\"reachable\"]\n end", "def reachable?\n !@unreachable_since\n end", "def is_local_host\n require 'ipaddr'\n begin\n local = IPAddr.new(\"127.0.0.0/8\")\n private1 = IPAddr.new(\"10.0.0.0/8\")\n private2 = IPAddr.new(\"172.16.0.0/12\")\n private3 = IPAddr.new(\"192.168.0.0/16\")\n private4 = IPAddr.new(\"85.230.85.45\")\n private5 = IPAddr.new(\"94.234.170.18\")\n\n if local.include?(request.remote_ip)\n return true\n end\n if private1.include?(request.remote_ip)\n return true\n end\n if private2.include?(request.remote_ip)\n return true\n end\n if private3.include?(request.remote_ip)\n return true\n end\n if private4.include?(request.remote_ip)\n return true\n end\n if private5.include?(request.remote_ip)\n return true\n end\n return false\n rescue\n return false\n end\n end", "def ping?(host = @host, options = {})\n ping(host, options).status_code == 0\n end", "def okIP(addr)\nreturn addr != \"0.0.0.0\" &&\n addr != \"255.255.255.255\" &&\n !addr.match(/^169\\.254.*/) &&\n !addr.match(/^10.*/) &&\n !addr.match(/^172\\.[1-3].*/) && # TODO: match the block better\n !addr.match(/^192\\.168.*/)\nend", "def valid_ip?\n if !@config[:host_allow_ip]\n bool = set_error(:ip_address_forbidden)\n elsif ip_address.include?(\":\")\n bool = ip_address.match(Resolv::IPv6::Regex) ? true : set_error(:ipv6_address_invalid)\n elsif ip_address.include?(\".\")\n bool = ip_address.match(Resolv::IPv4::Regex) ? true : set_error(:ipv4_address_invalid)\n end\n if bool && (localhost? && !@config[:host_local])\n bool = set_error(:ip_address_no_localhost)\n end\n bool\n end", "def online?\n get['state']['reachable']\n end", "def eip?\n !eip.nil?\n end", "def internet?(cmd)\n return true if cmd[:noinetchk]\n\n dns_resolver = Resolv::DNS.new\n begin\n dns_resolver.getaddress('icann.org')\n true\n rescue Resolv::ResolvError => _e\n print \"\\nThere appears to be no internet access on this computer, \".red,\n \"the script cannot continue.\\n\\n\".red\n false\n end\n end", "def alive?\n Utils::NetworkUtils.port_open?(@host, @port)\n end", "def online?\n sock = UDPSocket.new()\n online = false\n begin\n sock.connect('193.0.14.129', 25) # that address is k.root-servers.net\n online = true\n sock.close\n rescue Exception => exception\n puts \"\n------------------------------------------------------------\nCannot bind to socket:\n #{exception}\n\nThis is an indication you have network problems.\nNo online tests will be run!!\n------------------------------------------------------------\n\"\n end\n online\nend", "def check_server\n raise Exception.new(\"Could not reach Apocalypse server please check the address and port and try again.\") unless server_reachable?\n end", "def online?\n r = Reachability.reachabilityForInternetConnection\n !(r.currentReachabilityStatus == NotReachable)\n end", "def ip?(ip_or_name)\n # Get address always returns an IP, so if nothing changes this was one\n Resolv.getaddress(ip_or_name) == ip_or_name\n rescue Resolv::ResolvError\n false\n end", "def reachable?\n @state['reachable']\n end", "def connection?\n check = Netchecker.new() \n @alive = check.check_url(\"google.com\", 80) \n end", "def ping?\n tcp_ping.ping?\n end", "def elastic_ip_address_released?(ec2_client, allocation_id)\n ec2_client.release_address(allocation_id: allocation_id)\n return true\nrescue StandardError => e\n puts(\"Error releasing Elastic IP address: #{e.message}\")\n return false\nend", "def has_host?(wspace,addr)\n\t\twspace.hosts.find_by_address(addr)\n\tend", "def check_host(host, path = '/', timeout = 5)\n begin\n status = Timeout::timeout(timeout) do\n Net::HTTP.start(URI.parse(host).host) do |http|\n response = http.get(path)\n\n if not response.code.match(/200/)\n log_error(\"Web Server down or not responding: #{response.code} #{response.message}\")\n return false;\n end\n\n if @test_regex && ! response.body.match(@test_regex)\n log_error(\"The response did not contain the regex '#{@test_regex}'\")\n return false\n end\n end\n end\n rescue SocketError => socket_error\n log_error(\"Error Connecting To Web: #{socket_error}\")\n return false;\n rescue TimeoutError => timeout_error\n log_error(\"Timeout occured checking #{host}#{path} after #{timeout} seconds.\")\n return false;\n rescue Exception => e\n log_error(\"An unknown error occured checking #{host}#{path}: #{e}\")\n return false;\n end\n\n return true\n end", "def manage_ip?\n case type.hotspot\n when 'hsv1-mem' then true\n when 'hsv2-bam' then false\n else false\n end\n end", "def check_dns_available(vm_name)\n begin\n dns_ip = Resolv.getaddress(vm_name)\n rescue Resolv::ResolvError\n # this is the expected case, swallow the error\n # eg \"no address for blah-daisy.example.com\"\n return ['', true]\n end\n [dns_ip, false]\n end", "def ip_exist?\n return false if current_resource.addresses.nil?\n current_resource.addresses.include?(new_resource.address)\n end", "def has_required_host?\n true\n end", "def check_availability_by_http_request(host, port)\n uri = URI(\"http://#{host}:#{port}/info\")\n request = Net::HTTP::Get.new(uri)\n request[Datadog::Transport::Ext::HTTP::HEADER_DD_INTERNAL_UNTRACED_REQUEST] = '1'\n response = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request(request)\n end\n response.is_a?(Net::HTTPSuccess)\n rescue SocketError\n false\n end", "def ping(host=@host)\n super(host)\n\n bool = false\n start_time = Time.now\n\n # Failure here most likely means bad host, so just bail.\n begin\n addr = Socket.getaddrinfo(host, port)\n rescue SocketError => err\n @exception = err\n return false\n end\n\n begin\n # Where addr[0][0] is likely AF_INET.\n sock = Socket.new(Socket.const_get(addr[0][0]), Socket::SOCK_STREAM, 0)\n\n # This may not be entirely necessary\n sock.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)\n\n begin\n # Where addr[0][3] is an IP address\n sock.connect_nonblock(Socket.pack_sockaddr_in(port, addr[0][3]))\n rescue Errno::EINPROGRESS\n # No-op, continue below\n rescue Exception => err\n # Something has gone horribly wrong\n @exception = err\n return false\n end\n\n resp = IO.select(nil, [sock], nil, timeout)\n\n if resp.nil? # Assume ECONNREFUSED if nil\n if @@service_check\n bool = true\n else\n bool = false\n @exception = Errno::ECONNREFUSED\n end\n else\n sockopt = sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_ERROR)\n\n if sockopt.int != 0\n if @@service_check && sockopt.int == Errno::ECONNREFUSED::Errno\n bool = true\n else\n bool = false\n @exception = SystemCallError.new(sockopt.int)\n end\n else\n bool = true\n end\n end\n ensure\n sock.close if sock\n end\n\n # There is no duration if the ping failed\n @duration = Time.now - start_time if bool\n\n bool\n end", "def alive?\n begin\n alive_check!\n return true\n rescue\n return false\n end\n end", "def host_in_range?(ip, ip_address_start, ip_address_end)\n ip >= ip_address_start && ip <= ip_address_end\n end", "def old_ip_address?\n dns.any? do |answer|\n answer.class == Net::DNS::RR::A && LEGACY_IP_ADDRESSES.include?(answer.address.to_s)\n end if dns?\n end", "def reachable?(url)\n page = MetaInspector.new(url)\n\n if page.response.status < 400\n true\n else\n false\n end\n rescue\n false\n end", "def host_exists?(host)\n `#{cmk} --list-hosts`.split(/\\n/).include?(host)\n end", "def port_bound?(host, port)\n Timeout.timeout(1) do\n s = TCPSocket.new(host, port)\n s.close rescue nil\n return true\n end\nrescue Timeout::Error, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, \\\n Errno::ENETUNREACH, Errno::EACCES, Errno::ENOTCONN, \\\n Errno::EADDRNOTAVAIL\n return false\nend", "def check_existence_publicip(resource_group_name, public_ip_name)\n OOLog.info(\"Checking existance of public IP '#{public_ip_name}' in '#{resource_group_name}' \")\n start_time = Time.now.to_i\n begin\n response = @network_client.public_ips.check_public_ip_exists(resource_group_name, public_ip_name)\n rescue MsRestAzure::AzureOperationError => e\n OOLog.fatal(\"Azure::PublicIp - Exception is: #{e.body}\")\n rescue => e\n OOLog.fatal(\"Exception trying to get public ip #{public_ip_name} from resource group: #{resource_group_name}. Exception: #{e.message}\")\n end\n end_time = Time.now.to_i\n duration = end_time - start_time\n OOLog.info(\"operation took #{duration} seconds\")\n response\n end", "def has_host?(wspace,addr)\n ::ApplicationRecord.connection_pool.with_connection {\n address, scope = addr.split('%', 2)\n wspace.hosts.find_by_address(addr)\n }\n end", "def properly_configured?\n options = {\n open_timeout: 5,\n use_ssl: true, # all connections are forced SSL now\n verify_mode: OpenSSL::SSL::VERIFY_NONE # because we might not have a valid cert yet\n }\n Net::HTTP.start(website_alias, options) do |http|\n response = http.get(\"/tenant_aliases/#{id}/verify\")\n\n return false unless response.is_a?(Net::HTTPSuccess)\n\n response.body == \"TRUE\"\n end\n rescue SocketError, Net::OpenTimeout, Errno::ECONNREFUSED\n # SocketError if the server name doesn't exist in DNS\n # OpenTimeout if no server responds\n # ECONNREFUSED if the server responds with \"No\"\n false\n end", "def accessible?\n # convenience method to check if wordpress is accessible\n # if we don't have this, the connection will take a long time to timeout\n timeout = 5 #seconds\n RestClient::Request.execute(:method => :head, :url => cms_host, :timeout => timeout)\n return true\n rescue RestClient::Exceptions::OpenTimeout => e\n Rails.logger.debug \"Could not connect to wordpress within #{timeout} seconds - Are you connected to the VPN?\"\n return false\n end", "def host_is_app_host?(hostname)\n hostname == \"adapt.127.0.0.1.xip.io\"\n end", "def connection?\n begin\n TCPSocket.new 'google.com', 80\n return true\n rescue SocketError\n return false\n end\n end", "def is_error?\n return (self.status == HostResult::STATUS_ERROR)\n end", "def host?\n self.host\n end", "def connectable?\n begin; ping; rescue; false; end\n end", "def check_address(ip)\n @r.rule(:check, src: ip, chain: @allow, jump: 'ACCEPT').do?\n end", "def check_address(ip)\n @r.rule(:check, src: ip, chain: @allow, jump: 'ACCEPT').do?\n end", "def checkConnect(dns, sshport)\n connectionTimeout = Time.now \n connectionTimeout = connectionTimeout + (10 * 10)\n connection = false\n\n while ((connection == false) && ( Time.now < connectionTimeout )) do \n if dns.nil? || dns.empty? then\n log(\"ERROR\", \"Invalid dns\" + dns)\n return false\n end\n log(\"INFO\", \"Checking connectivity to: \" + dns)\n\n connection = ssh2_connect(dns, sshport)\n if connection == false then\n sleep(10)\n end\n end\n\n if connection == false then\n log(\"ERROR\", \"Failed to connect to \" + dns )\n return false\n else\n return true\n end\n end", "def ping\n true\n end", "def reachable?\n return true if (page_ref && (page_ref.good? || (page_ref.http_status == 200))) || (gleaning && gleaning.good?)\n return false if (page_ref && @@BadResponseCodes.include?(page_ref.http_status)) &&\n (gleaning && @@BadResponseCodes.include?(gleaning.http_status))\n end", "def connected?()\n (self.remote_address rescue nil) ? true : false\n end", "def host_allowed?(arg)\n true\n end", "def check\n\t\tres = Host.find(:first)\n\tend", "def ping\n http_get('/') == 'Consul Agent'\n rescue\n false\n end", "def attempt_connection\n begin\n response = Net::HTTP.get_response(uri)\n unless response.code == \"200\"\n Puppet.notice \"HTTP request (#{uri}) failed: (#{response.code} #{response.body})\"\n return false\n end\n return true\n rescue Errno::ECONNREFUSED => e\n Puppet.notice \"Unable to establish HTTP connection to '#{uri}'; #{e}\"\n return false\n end\n end", "def local?\n ip = server_ip.to_s\n is_localhost = ip == '127.0.0.1'\n is_in_ifconfig = `/sbin/ifconfig -a`.include? ip\n is_in_ip_addr = `/sbin/ip addr show`.include? ip\n is_localhost || is_in_ifconfig || is_in_ip_addr\n rescue => err\n (MorLog.my_debug '#{err.message}') && (return false)\n end", "def valid_dns?\n @host.exchanger.has_dns_a_record?\n end", "def ip?\n return (proto == 'ip')\n end", "def ping(host)\n res = `ping #{host} -c 1`\n res.include?(\"0% packet loss\")\n end" ]
[ "0.77561027", "0.7622043", "0.7440091", "0.7254343", "0.71805686", "0.70520025", "0.7047166", "0.7031645", "0.69743425", "0.6959839", "0.69502234", "0.6913312", "0.69023716", "0.6899562", "0.6868326", "0.6863509", "0.6821681", "0.68003833", "0.68003833", "0.68003833", "0.67844915", "0.6772359", "0.6729341", "0.67270184", "0.6724236", "0.6722495", "0.67095464", "0.6693834", "0.66788185", "0.66788185", "0.6671077", "0.6666326", "0.6645147", "0.66421866", "0.6635677", "0.66274124", "0.6568177", "0.65533805", "0.6527056", "0.6527056", "0.6516829", "0.6498367", "0.64898115", "0.64890677", "0.64603686", "0.6459863", "0.6453914", "0.6445376", "0.6444527", "0.6443811", "0.64408267", "0.64205796", "0.64122677", "0.64112383", "0.64102775", "0.63845384", "0.6380418", "0.63732785", "0.63730025", "0.637037", "0.63518125", "0.6338568", "0.63377655", "0.6327024", "0.630808", "0.63022363", "0.62959564", "0.62842053", "0.6267253", "0.6262335", "0.62348366", "0.6226448", "0.6200905", "0.61883974", "0.61796665", "0.6171123", "0.61680025", "0.6166476", "0.61658037", "0.61592555", "0.615902", "0.61581576", "0.61561686", "0.6152581", "0.6142046", "0.6141684", "0.6135981", "0.6135981", "0.61354464", "0.6125616", "0.61248815", "0.61237484", "0.6123042", "0.61138916", "0.6111651", "0.6105717", "0.61022645", "0.6100965", "0.60948694", "0.60945386" ]
0.71398634
5
reload/restart nginx, uses /etc/init.d/nginx
def reload_nginx if nginx_running? `/etc/init.d/nginx reload` else `/etc/init.d/nginx restart` end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload_proxy\n\t\t$LOGGER.info 'Reloading nginx'\n\t\tcmd = 'service nginx reload'\n\t\tsystem(cmd)\n\tend", "def reload_nginx(server, container_id)\n Net::SSH.start( server.host, server.user, :password => server.password) do|ssh|\n ssh.exec!(\"docker exec #{container_id} service nginx reload\")\n end\n end", "def restart\n if @time < @next_restart\n log.info \"synapse: at time #{@time} waiting until #{@next_restart} to restart\"\n return\n end\n\n @next_restart = @time + @restart_interval\n @next_restart += rand(@restart_jitter * @restart_interval + 1)\n\n # do the actual restart\n res = `#{opts['reload_command']}`.chomp\n unless $?.success?\n log.error \"failed to reload haproxy via #{opts['reload_command']}: #{res}\"\n return\n end\n log.info \"synapse: restarted nginx\"\n\n @restart_required = false\n end", "def reload\n run \"#{try_sudo} /sbin/service puppet reload\"\n end", "def reload\n run \"touch #{current_path}/rack/tmp/restart.txt\"\n end", "def ensure_nginx_executable_is_installed!\n if not e.file?(\"/etc/init.d/nginx\")\n message \"Installing NginX executable for starting/stopping/restarting/reloading Nginx.\"\n e.download_packages!('$HOME', :root)\n e.execute_as_root(\"cp $HOME/gitpusshuten-packages/modules/nginx/nginx /etc/init.d/nginx\")\n e.clean_up_packages!('$HOME', :root)\n end\n end", "def reload_server\n restart_server\n end", "def reload_systemd()\n bash 'reload systemd daemon' do\n user 'root'\n code 'systemctl daemon-reload'\n end\nend", "def forcereload\n run \"#{try_sudo} /sbin/service puppet force-reload\"\n end", "def regenerate_nginx_config_files()\n Djinn.log_debug(\"Regenerating nginx config files for App Engine apps\")\n my_public = my_node.public_ip\n my_private = my_node.private_ip\n login_ip = get_login.private_ip\n\n Djinn.log_debug(\"@app_info_map is #{@app_info_map.inspect}\")\n @apps_loaded.each { |app| \n http_port = @app_info_map[app]['nginx']\n https_port = @app_info_map[app]['nginx_https']\n proxy_port = @app_info_map[app]['haproxy']\n Djinn.log_debug(\"Regenerating nginx config for app #{app}, on http \" +\n \"port #{http_port}, https port #{https_port}, and haproxy port \" +\n \"#{proxy_port}.\")\n\n static_handlers = HelperFunctions.parse_static_data(app)\n Nginx.write_fullproxy_app_config(app, http_port, https_port,\n my_public, my_private, proxy_port, static_handlers, login_ip)\n }\n Djinn.log_debug(\"Done writing new nginx config files!\")\n Nginx.reload()\n end", "def restart\n raise _(\"Server restart is only supported on Linux\") unless MiqEnvironment::Command.is_linux?\n\n _log.info(\"Server restart initiating...\")\n update_attribute(:status, \"restarting\")\n\n shutdown_and_exit(RESTART_EXIT_STATUS)\n end", "def reload\n restart_and_ping\n end", "def hot_restart\n system \"kill -s USR2 #{pid} > /dev/null 2>&1\"\n end", "def restart_service\n service 'consul-haproxy' do\n action :restart\n end\nend", "def clear_nginx\n config.vm.provision :shell do |s|\n s.name = 'Clear the old Nginx sites'\n s.inline = 'rm -f /etc/nginx/sites-enabled/* /etc/nginx/sites-available/*'\n end\n end", "def autorestart \n rebang = @rebang \n restart\n @suppress_rebang = rebang\n end", "def restart\n if @restart_command\n run_command(@restart_command)\n else\n stop\n start\n end\n end", "def reload_node_web_proxy\n out, err, rc = shellCmd(\"service openshift-node-web-proxy reload\")\n Syslog.alert(\"ERROR: failure from openshift-node-web-proxy(#{rc}): #{@uuid} stdout: #{out} stderr:#{err}\") unless rc == 0\n return out, err, rc\n end", "def reload_node_web_proxy\n out, err, rc = shellCmd(\"service openshift-node-web-proxy reload\")\n Syslog.alert(\"ERROR: failure from openshift-node-web-proxy(#{rc}): #{@uuid} stdout: #{out} stderr:#{err}\") unless rc == 0\n return out, err, rc\n end", "def restart\n\trequire_relative '../../lib/falcon/command/supervisor'\n\t\n\tFalcon::Command::Supervisor[\"restart\"].call\nend", "def run\n `#{@apachectl} restart`\n end", "def hot_restart\n fork do\n # Let the new server know where to find the file descriptor server\n ENV[FILE_DESCRIPTOR_SERVER_VAR] = file_descriptor_server.socket_path\n\n Dir.chdir(ENV['APP_ROOT']) if ENV['APP_ROOT']\n ENV.delete('BUNDLE_GEMFILE') # Ensure a fresh bundle is used\n\n exec(\"bundle exec #{server_configuration.start_command}\")\n end\n end", "def reload_haproxy\n info \"Reloading haproxy: '#{@reload_cmd}'\"\n\n if @pretend\n @pretend_reloads += 1\n else\n info `#{@reload_cmd}`\n end\n end", "def restart!\n # Permissions are handled by the script, use: :sudo => false\n run_script! :restart, :sudo => false\n end", "def perform_setup!\n find_nginx!\n \n if not e.execute_as_root(\"cat '#{@nginx_conf}'\").include?('GIT PUSSHUTEN GENERATED NGINX CONFIGURATION FILE')\n \n ##\n # Make a backup of the old nginx.conf\n Spinner.return :message => \"Creating a backup of the current NginX configuration file..\" do\n e.execute_as_root(\"cp '#{@nginx_conf}' '#{@nginx_conf}.backup.#{Time.now.to_i}'\")\n g('Done!')\n end\n \n ##\n # Replace the old NginX configuration file with the pre-configured one\n Spinner.return :message => \"Generating pre-configured NginX configuration file..\" do\n e.download_packages!(\"$HOME\", :root)\n e.execute_as_root(\"cp $HOME/gitpusshuten-packages/modules/nginx/nginx.conf '#{@nginx_conf}'\")\n e.clean_up_packages!(\"$HOME\", :root)\n g('Done!')\n end\n \n ##\n # Create the vhosts dir on the server\n Spinner.return :message => \"Creating #{@nginx_vhosts_dir} directory..\" do\n e.execute_as_root(\"mkdir -p #{@nginx_vhosts_dir}\")\n g('Done!')\n end\n \n if e.installed?('passenger')\n perform_update_configuration!\n end\n \n end\n \n ##\n # Create NginX directory\n # Create NginX vhost file (if it doesn't already exist)\n create_vhost_template_file!\n end", "def automatic_restart\n @automatic_restart = true if @automatic_restart.nil?\n @automatic_restart\n end", "def find_nginx!\n ##\n # NginX Conf path you get from Passenger\n if e.file?('/etc/nginx/conf/nginx.conf')\n @nginx_conf = '/etc/nginx/conf/nginx.conf'\n @nginx_conf_dir = '/etc/nginx/conf'\n end\n \n ##\n # NginX Conf path you get from Aptitude\n if e.file?('/etc/nginx/nginx.conf')\n @nginx_conf = '/etc/nginx/nginx.conf'\n @nginx_conf_dir = '/etc/nginx'\n end\n \n ##\n # Determines whether the configuration file was found or not\n if @nginx_conf.nil?\n error \"Could not find the NginX configuration file. Has NginX been installed?\"\n exit\n end\n \n ##\n # Set additional configuration\n @nginx_conf_name = @nginx_conf.split('/').last\n @nginx_vhosts_dir = @nginx_conf_dir + '/sites-enabled'\n end", "def restart_soon\n @restart = true\n @shutdown = true\n end", "def hot_restart\n fork do\n Dir.chdir(ENV['APP_ROOT']) if ENV['APP_ROOT']\n ENV.delete('BUNDLE_GEMFILE') # Ensure a fresh bundle is used\n exec(\"bundle exec --keep-file-descriptors #{server_configuration.start_command}\", :close_others => false)\n end\n end", "def restart\n request('restart')\n end", "def on_restart(&block); end", "def refresh_linux_service(service_name)\n restart_service(service_name)\n return\nend", "def action_reload\n return if options['never_reload']\n if running?\n converge_by(\"reload service #{new_resource}\") do\n Process.kill(new_resource.reload_signal, pid)\n Chef::Log.info(\"#{new_resource} reloaded\")\n end\n end\n end", "def restart\n\tcall 'falcon:supervisor:restart'\nend", "def restart\n\tcall 'falcon:supervisor:restart'\nend", "def restart\n\tcall 'falcon:supervisor:restart'\nend", "def reload(env, app)\n system \"ey ssh -e #{translate_env(env,app)} 'rm -rf /data/#{translate_app(env,app)}/current/tmp/cache/*'\" # clear out cache\n if env == 'production' # total hack to clear cache on app2\n system \"ssh deploy@ec2-50-18-83-188.us-west-1.compute.amazonaws.com 'rm -rf /data/#{translate_app(env,app)}/current/tmp/cache/*'\"\n end\n restart(env, app)\nend", "def restart_unicorn\n stop_unicorn\n start_unicorn\nend", "def ReloadOrRestart\n if IsActive()\n if Modified()\n # reload is not sufficient\n RunSystemCtl(\"network\", \"stop\")\n EnableDisableNow()\n RunSystemCtl(\"network\", \"start\")\n else\n # reload may be unsupported\n RunSystemCtl(\"network\", \"reload-or-try-restart\")\n end\n else\n # always stop, it does not hurt if the net was stopped.\n RunSystemCtl(\"network\", \"stop\")\n EnableDisableNow()\n RunSystemCtl(\"network\", \"start\")\n end\n\n nil\n end", "def restart!\n CouchRest.post \"#{@uri}/_restart\"\n end", "def restart_server\n stop_server\n sleep 1\n start_server\n end", "def reload\n Guard::Compat::UI.info \"[Guard::WebPacker] Restarting #{@bin} ...\"\n restart\n end", "def reload\n restart\n end", "def restart()\n shutdown()\n start()\n end", "def perform_update_configuration!\n find_nginx!\n \n message \"Checking the #{y(@nginx_conf)} for current Passenger configuration.\"\n config_contents = e.execute_as_root(\"cat '#{@nginx_conf}'\")\n if not config_contents.include? 'passenger_root' or not config_contents.include?('passenger_ruby')\n error \"Could not find Passenger configuration, has it ever been set up?\"\n exit\n end\n \n message \"Checking if Passenger is installed under the #{y('default')} Ruby.\"\n if not e.installed?('passenger')\n message \"Passenger isn't installed for the current Ruby\"\n Spinner.return :message => \"Installing latest Phusion Passenger Gem..\" do\n e.execute_as_root('gem install passenger --no-ri --no-rdoc')\n g(\"Done!\")\n end\n end\n \n Spinner.return :message => \"Finding current Phusion Passenger Gem version...\" do\n if e.execute_as_root('passenger-config --version') =~ /(\\d+\\.\\d+\\..+)/\n @passenger_version = $1.chomp.strip\n g('Found!')\n else\n r('Could not find the current Passenger version.')\n end\n end\n \n exit if @passenger_version.nil?\n \n Spinner.return :message => \"Finding current Ruby version for the current Phusion Passenger Gem..\" do\n if e.execute_as_root('passenger-config --root') =~ /\\/usr\\/local\\/rvm\\/gems\\/(.+)\\/gems\\/passenger-.+/\n @ruby_version = $1.chomp.strip\n g('Found!')\n else\n r(\"Could not find the current Ruby version under which the Passenger Gem has been installed.\")\n end\n end\n \n exit if @ruby_version.nil?\n \n puts <<-INFO\n\n\n [Detected Versions]\n\n Ruby Version: #{@ruby_version}\n Phusion Passenger Version: #{@passenger_version}\n\n\n INFO\n \n message \"NginX will now be configured to work with the above versions. Is that OK?\"\n exit unless yes?\n \n ##\n # Checks to see if Passengers WatchDog is available in the current Passenger gem\n # If it is not, then Passenger needs to run the \"passenger-install-nginx-module\" so it gets installed\n if not e.directory?(\"/usr/local/rvm/gems/#{@ruby_version}/gems/passenger-#{@passenger_version}/agents\")\n message \"Phusion Passenger has not yet been installed for this Ruby's Passenger Gem.\"\n message \"You need to update #{y('NginX')} and #{y('Passenger')} to proceed with the configuration.\\n\\n\"\n message \"Would you like to update #{y('NginX')} and #{y('Phusion Passenger')} #{y(@passenger_version)} for #{y(@ruby_version)}?\"\n message \"NOTE: Your current #{y('NginX')} configuration will #{g('not')} be lost.\"\n \n if yes?\n Spinner.return :message => \"Ensuring #{y('Phusion Passenger')} and #{y('NginX')} dependencies are installed..\" do\n e.install!(\"build-essential libcurl4-openssl-dev bison openssl libreadline5 libreadline5-dev curl git-core zlib1g zlib1g-dev libssl-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev\")\n g(\"Done!\")\n end\n \n message \"Installing NginX with the Phusion Passenger Module.\"\n Spinner.return :message => \"Installing, this may take a while..\" do\n e.execute_as_root(\"passenger-install-nginx-module --auto --auto-download --prefix='/etc/nginx'\")\n g(\"Done!\")\n end\n else\n exit\n end\n end\n \n ##\n # Creates a tmp dir\n local.create_tmp_dir!\n \n ##\n # Downloads the NGINX configuration file to tmp dir\n message \"Updating Phusion Passenger paths in the NginX Configuration.\"\n Spinner.return :message => \"Configuring NginX..\" do\n e.scp_as_root(:download, @nginx_conf, local.tmp_dir)\n \n local_configuration_file = File.join(local.tmp_dir, @nginx_conf_name)\n update = File.read(local_configuration_file)\n update.sub! /passenger_root \\/usr\\/local\\/rvm\\/gems\\/(.+)\\/gems\\/passenger\\-(.+)\\;/,\n \"passenger_root /usr/local/rvm/gems/#{@ruby_version}/gems/passenger-#{@passenger_version};\"\n \n update.sub! /passenger_ruby \\/usr\\/local\\/rvm\\/wrappers\\/(.+)\\/ruby\\;/,\n \"passenger_ruby /usr/local/rvm/wrappers/#{@ruby_version}/ruby;\"\n \n ##\n # Uncomment any Phusion Passenger configuration if it is commented out\n # since Phusion Passenger is enabled\n update.sub!(/\\#.+(passenger_ruby.+\\;)/) { $1 }\n update.sub!(/\\#.+(passenger_root.+\\;)/) { $1 }\n update.sub!(/\\#.+(passenger_spawn_method.+\\;)/) { $1 }\n update.sub!(/\\#.+(passenger_min_instances.+\\;)/) { $1 }\n update.sub!(/\\#.+(passenger_max_pool_size.+\\;)/) { $1 }\n update.sub!(/\\#.+(passenger_pool_idle_time.+\\;)/) { $1 }\n \n File.open(local_configuration_file, 'w') do |file|\n file << update\n end\n \n ##\n # Create a backup of the current configuration file\n e.execute_as_root(\"cp '#{@nginx_conf}' '#{@nginx_conf}.backup.#{Time.now.to_i}'\")\n \n ##\n # Upload the updated NginX configuration file\n e.scp_as_root(:upload, local_configuration_file, @nginx_conf)\n \n ##\n # Remove the local tmp directory\n local.remove_tmp_dir!\n \n g(\"Done!\")\n end\n \n message \"NginX configuration file has been updated!\"\n message \"#{y(@nginx_conf)}\\n\\n\"\n \n warning \"If you changed #{y('Ruby versions')}, be sure that all your application gems are installed.\"\n warning \"If you only updated #{y('Phusion Passenger')} and did not change #{y('Ruby versions')}\"\n warning \"then you should be able to just restart #{y('NginX')} right away since all application gems should still be in tact.\\n\\n\"\n \n message \"When ready, run the following command to restart #{y('NginX')} and have the applied updates take effect:\"\n standard \"\\n\\s\\s#{y(\"heavenly nginx restart for #{e.name}\")}\\n\\n\"\n end", "def action_restart\n proxy_action(:restart)\n end", "def restart_apache\n FileUtils.touch \"#{config.get(:current_path)}/tmp/restart.txt\"\n monit_command \"restart apache2\"\n end", "def prepare_reconfiguration\n unless @prepared\n # cmd = \"/etc/init.d/puppetmaster restart\"\n # run_command_on(cmd, master)\n @prepared = true\n end\n end", "def reload\n return interpreter.service_manager.tell(self.service, \"force-reload\")\n end", "def restart \n log \"Restarting\"\n puts config.inspect if config[:debug]\n \n @svns = (YAML.load_file config[:svns] rescue {})\n @atoms = (YAML.load_file config[:atoms] rescue {})\n\n @socket.close if @socket\n connect\n listen\n end", "def reload\n stop\n start\n end", "def restart\n if config.managed? && started?\n stop\n start\n end\n end", "def run_restart(options={}, &block)\n with_each_host { stop(options); start(options) }\n end", "def restart_container\n do_service_action :restart_container\n end", "def install_frontends\n package 'nginx'\n end", "def start_or_restart\n if isup?\n restart()\n else\n up()\n end\n end", "def restart(filename)\n start (filename) if shutdown(filename) == true\n end", "def ssh_service_restart\n exec(Beaker::Command.new(\"stopsrc -g ssh\"))\n exec(Beaker::Command.new(\"startsrc -g ssh\"))\n end", "def write_nginx_conf(config)\n config.vm.provision 'nginx',\n type: 'shell',\n inline: <<-SHELL\n echo '#{NGINX_CONF}' > /etc/nginx/conf.d/proxy.conf\n SHELL\nend", "def nginx_running?\n if File.exists?('/var/run/nginx.pid')\n pid = File.open('/var/run/nginx.pid', 'r').readline\n begin\n Process.getpgid(pid)\n true\n rescue Errno::ESRCH\n false\n end\n else\n false\n end\n end", "def config_nginx(app_name, instance_name)\n app_config = RailsPwnerer::Config[app_name, instance_name]\n first_port = app_config[:port0]\n\n # Can be specified as comma-separated string or array.\n if app_config[:dns_name].respond_to? :to_str\n dns_names = app_config[:dns_name].split(',')\n else\n dns_names = app_config[:dns_name]\n end\n\n default_app_port = app_config[:ssl_key] ? 443 : 80\n app_port = app_config[:port] || default_app_port\n\n nginx_config = File.join(RailsPwnerer::Config.path_to(:nginx_configs),\n app_name + '.' + instance_name)\n File.open(nginx_config, 'w') do |f|\n # link to the frontends\n f << \"upstream #{app_name}_#{instance_name} {\\n\"\n RailsPwnerer::Config.app_frontends(app_name, instance_name).times do |instance|\n f << \" server 127.0.0.1:#{first_port + instance};\\n\"\n end\n f << \"}\\n\\n\"\n\n # server configuration -- big and ugly\n f << <<NGINX_CONFIG\nserver {\n listen #{app_port}#{app_config[:ssl_key] ? ' ssl' : ''};\n #{(app_config[:ssl_key] && app_config[:non_ssl_port] != 0) ? \"listen #{app_config[:non_ssl_port]};\" : \"\" }\n charset utf-8;\n #{app_config[:ssl_key] ? \"ssl_certificate #{app_config[:ssl_cert]};\" : ''}\n #{app_config[:ssl_key] ? \"ssl_certificate_key #{app_config[:ssl_key]};\" : ''}\n #{(dns_names.empty? ? '' : \"server_name \" + dns_names.join(' ') + \";\")}\n root #{app_config[:app_path]}/public;\n client_max_body_size #{app_config[:max_request_mb]}M;\n error_page 404 /404.html;\n error_page 500 502 503 504 /500.html;\n try_files $uri @rails;\n\n location ~ ^/assets/ {\n try_files $uri @rails;\n gzip_static on;\n expires max;\n add_header Cache-Control public;\n\n open_file_cache max=1000 inactive=500s;\n open_file_cache_valid 600s;\n open_file_cache_errors on;\n }\n\n location @rails {\n proxy_set_header X-Real-IP $remote_addr;\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n proxy_set_header X-Forwarded-Proto $scheme;\n proxy_set_header Host $http_host;\n proxy_redirect off;\n proxy_connect_timeout 2;\n proxy_read_timeout 86400;\n proxy_pass http://#{app_name}_#{instance_name};\n }\n}\nNGINX_CONFIG\n end\n end", "def restart_process\n puts 'restarting'\n exec RbConfig.ruby, File.expand_path(__FILE__), *ARGV\nend", "def restart # :nodoc:\n put :restart\n end", "def reload\n @reloaded = true\n restart\n end", "def drb_restart!\n Vedeu.bind(:_drb_restart_) { Vedeu::Distributed::Server.restart }\n end", "def try_autoreload env, &block\n return block.call if env[GIN_RELOADED] || !autoreload\n env[GIN_RELOADED] = true\n reload!\n reload_lock.read_sync{ block.call }\n end", "def restart\n client.restart\n end", "def action_reload\n return if options['never_reload']\n notify_if_service do\n service_resource.run_action(:hup)\n end\n end", "def init_command\n restart_winrm_service if config[:restart_winrm]\n end", "def restart(config = nil)\n config ||= agent&.config\n stop if running?\n start(config)\n end", "def automatic_restart=(value)\n @automatic_restart = value\n end", "def restart_server(connection)\n signal :USR2\n\n connection.write \"GET / HTTP/1.1\\r\\n\\r\\n\" # trigger it to start by sending a new request\n\n wait_for_server_to_boot\n end", "def restart\n # Permissions are handled by the script, use: :sudo => false\n run_script :stop, :sudo => false\n end", "def restart\n if booted then\n kill\n end\n start\n end", "def restart!\n start!\n end", "def initd_file(svc, pidfile, initd_location, status)\n <<INITD\n#!/bin/bash\n# #{svc} daemon\n# chkconfig: 2345 20 80\n# description: #{svc} daemon\n\nDESC=\"#{svc} daemon\"\nPIDFILE=#{pidfile}\nSCRIPTNAME=#{initd_location}\n\ncase \"$1\" in\nstart)\n PID=`/usr/bin/#{svc} 120 > /dev/null 2>&1 & echo $!`\n if [ -z $PID ]; then\n echo \"Failed to start\"\n else\n echo $PID > $PIDFILE\n echo \"Started\"\n fi\n;;\n\n#{if status then \"status)\" else \"status-ignored)\" end}\n if [ -f $PIDFILE ]; then\n PID=`cat $PIDFILE`\n if [ -z \"`ps axf | grep ${PID} | grep -v grep `\" ]; then\n printf \"Process dead but pidfile exists\"\n exit 2\n else\n echo \"Running\"\n fi\n else\n echo \"Service not running\"\n exit 3\n fi\n;;\n\nstop)\n PID=`cat $PIDFILE`\n if [ -f $PIDFILE ]; then\n kill -TERM $PID\n rm -f $PIDFILE\n else\n echo \"pidfile not found\"\n fi\n;;\n\nrestart)\n $0 stop\n $0 start\n;;\n\n*)\n echo \"Usage: $0 (start|stop|restart)\"\n exit 1\nesac\n\nexit 0\nINITD\n end", "def restart\n\t\tself.stop_heartbeat\n\t\tsuper\n\t\tself.start_heartbeat\n\tend", "def restart_hybris(startup_script)\n stop_hybris(startup_script)\n start_hybris(startup_script)\n end", "def initialize(config_file = \"/etc/haproxy.cfg\",\n reload_cmd = \"/etc/init.d/haproxy reload\",\n extra_server_args = \"check inter 1000\",\n per_service_server_args = {})\n @config_file = config_file\n @reload_cmd = reload_cmd\n @extra_server_args = extra_server_args\n @per_service_server_args = per_service_server_args\n @pretend = false\n @pretend_reloads = 0\n end", "def god(options = {})\n god_version = options[:version] || configuration[:god][:version]\n gem 'god', :version => god_version,\n :notify => exec('restart_god')\n\n # tells god where to find the main config file\n file '/etc/default/god',\n :require => package('god'),\n :content => \"GOD_CONFIG=/etc/god/god.conf\"\n\n file '/etc/god', :ensure => :directory\n file \"/etc/god/#{ENV['RAILS_ENV']}\", :ensure => :directory\n\n # tells god to load all of the /etc/god/APPNAME.god\n file '/etc/god/god.conf',\n :require => file('/etc/god'),\n :backup => false,\n :notify => exec('restart_god'),\n :content => template(god_template_dir.join('god.conf.erb'), binding)\n\n # tells god to load all of the watches for this application\n file \"/etc/god/#{configuration[:application]}.god\",\n :require => file('/etc/god/god.conf'),\n :content => \"God.load '#{configuration[:deploy_to]}/current/config/god/*.god'\",\n :notify => exec('restart_god')\n\n upstart_path = if Facter.value(:lsbdistrelease).to_f < 10\n \"/etc/event.d/god\"\n else\n \"/etc/init/god.conf\"\n end\n\n upstart_template = if Facter.value(:lsbdistrelease).to_f < 10\n god_template_dir.join('god.upstart')\n else\n god_template_dir.join('god.upstart.lucid')\n end\n\n file upstart_path,\n :content => template(upstart_template, binding),\n :notify => exec('restart_god')\n\n exec 'restart_god',\n :command => 'stop god || true && start god',\n :require => file(upstart_path),\n :refreshonly => true\n\n logrotate '/var/log/god.log',\n :options => ['copytruncate', 'daily','rotate 7','compress','missingok','sharedscripts']\n end", "def php\n oputs <<-eos\n location ~ \\.php$ {\n fastcgi_pass 127.0.0.1:9000;\n fastcgi_index index.php;\n fastcgi_param SCRIPT_FILENAME $root_pub/$subdomain/$fastcgi_script_name;\n include /etc/nginx/fastcgi_params;\n }\n eos\nend", "def conf\n home.join('nginx.conf')\n end", "def phased_restart; end", "def fcgi(port, additional = '')\n oputs <<-eos\n location / {\n fastcgi_pass 127.0.0.1:#{port};\n fastcgi_param SCRIPT_FILENAME $root_pub/$subdomain/$fastcgi_script_name;\n include /etc/nginx/fastcgi_params;\n #{additional}\n }\n eos\nend", "def restart config={}\n stop\n start(config)\n end", "def reload!\n ivar_cache(\"_rack_reloader\") do\n Mack::Reloader.new(nil)\n end.reload!\n end", "def restart_or_shutdown_node_restart(opts = {})\n restart_or_shutdown_node_restart_with_http_info(opts)\n return nil\n end", "def reload(pid)\n `kill -s HUP #{pid}`\n end", "def refresh \n if (@parameters[:ensure].value == :running)\n provider.restart\n else\n debug \"Skipping restart; service is not running\"\n end\n end", "def config_nginx(source_file, target_file, app_name)\n if source_file == nil || target_file == nil || app_name == nil\n puts\n puts \"******************************************************************************************************************************************\"\n puts\n puts \"You need to specify three paramters to use this script:\\n\\n1: The Source File.\\n2: The Target File.\\n3: The App Name.\".yellow\n puts\n puts \"e.g. nginx_auto_config /Users/i0n/Sites/bin/templates/rails/config/nginx.local.conf /usr/local/nginx/conf/nginx.conf test_app\"\n puts\n puts \"******************************************************************************************************************************************\"\n puts\n else\n puts\n puts \"******************************************************************************************************************************************\"\n puts\n puts \"Configuring NginX at: #{target_file}\"\n puts\n if File.writable?(target_file)\n nginx_config = IO.readlines(target_file)\n while nginx_config.last !~ /^\\}[\\n]*/\n nginx_config.pop\n end\n @nginx_last_line = nginx_config.pop\n source_config = IO.read(source_file)\n nginx_config.push source_config\n nginx_config.push @nginx_last_line\n nginx_config.each {|line| line.gsub!(/PROJECT_NAME/, \"#{app_name}\")}\n File.open(target_file, \"w\") do |file|\n file.puts nginx_config\n end\n puts \"Success! NginX config for #{app_name.green} has been added to #{target_file.green}\"\n puts\n puts \"******************************************************************************************************************************************\"\n puts\n else\n puts \"It doesn't look like you have write access for #{target_file}. Would you like to use sudo to change them?\".yellow\n puts \"Type yes (\" + \"y\".green + \") or no (\" + \"n\".red + \")\"\n input = gets.chomp\n if input == \"yes\" || input == \"y\"\n puts \"Setting permissions for #{target_file.green}\"\n system \"sudo chmod 755 #{target_file}\"\n config_nginx(source_file, target_file, app_name)\n else\n puts \"Skipping automatic NginX config.\"\n end\n end\n end\n end", "def iyyov_install_init!\n rput( 'etc/init.d/iyyov', :user => 'root' )\n\n # Add to init.d\n dist_install_init_service( 'iyyov' )\n end", "def restart!\n IbmCloudRest.post \"#{@uri}/_restart\"\n end", "def restart_kubelet\n cmd = ['systemctl', 'restart', 'kubelet.service']\n stdout, stderr, status = Open3.capture3(*cmd)\n raise Puppet::Error, _(\"stderr: '%{stderr}'\" % { stderr: stderr }) if status != 0\n { status: stdout.strip }\nend", "def action_restart\n return if options['never_restart']\n action_stop\n action_start\n end", "def restart_running_instances_services\n nodes.each do |node|\n node.restart_with_monit\n end\n end", "def reload\n # reload the app file\n load(config.app.path)\n\n # reset config\n envs = config.app.loaded_envs\n config.reset\n\n # reload config\n self.class.load_config(*envs)\n\n load_app\n end", "def restart_server(connection, log: false)\n Process.kill :USR2, @pid\n connection.write \"GET / HTTP/1.1\\r\\n\\r\\n\" # trigger it to start by sending a new request\n wait_for_server_to_boot(log: log)\n end", "def restart_command(cmd); end", "def reload_templates(reload = nil)\n @reload_templates = reload unless reload == nil\n @reload_templates\n end", "def action_reload\n return if options['never_reload']\n if !upstart_features[:reload_signal] && new_resource.reload_signal != 'HUP'\n if options[:reload_shim]\n Process.kill(new_resource.reload_signal, pid)\n else\n check_reload_signal!\n end\n else\n super\n end\n end" ]
[ "0.79236126", "0.7102322", "0.67666537", "0.6441044", "0.6416849", "0.6408178", "0.6153345", "0.61178225", "0.60874027", "0.6076844", "0.60494095", "0.5964963", "0.59200037", "0.5871789", "0.5871153", "0.58465207", "0.5839313", "0.5826008", "0.5826008", "0.5814474", "0.58046216", "0.5777349", "0.57751256", "0.57697386", "0.57494473", "0.5732751", "0.57255626", "0.5692325", "0.5687642", "0.56625694", "0.5642348", "0.563647", "0.56329954", "0.56317157", "0.56317157", "0.56317157", "0.5572479", "0.55636835", "0.55506194", "0.55493987", "0.5542389", "0.5537678", "0.55204225", "0.55148816", "0.5500638", "0.5497782", "0.5485826", "0.548291", "0.54652905", "0.54486454", "0.5393388", "0.53831404", "0.5376747", "0.53475994", "0.53394455", "0.5335289", "0.53183746", "0.53092045", "0.5309062", "0.5299638", "0.52909267", "0.52841115", "0.52816314", "0.52792776", "0.5250861", "0.52499956", "0.52380496", "0.52325964", "0.5200453", "0.51701385", "0.5168117", "0.5166441", "0.515443", "0.5151358", "0.51476187", "0.51358765", "0.51214516", "0.512017", "0.51090807", "0.5102638", "0.51001775", "0.5094171", "0.50808334", "0.5057638", "0.5049669", "0.5039567", "0.50342387", "0.5014425", "0.5004457", "0.5000232", "0.49986386", "0.49889988", "0.49856317", "0.49850175", "0.49748212", "0.49692598", "0.49568287", "0.49423", "0.4941019", "0.4933311" ]
0.88950115
0
Determine if nginx is running by looking at the pidfile
def nginx_running? if File.exists?('/var/run/nginx.pid') pid = File.open('/var/run/nginx.pid', 'r').readline begin Process.getpgid(pid) true rescue Errno::ESRCH false end else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_running?\n result = \"\"\n result = `ps -p #{pid} -o cmd=`.gsub(\"\\n\", \"\") unless pid.empty?\n\n result.split.first == \"unicorn\" ? true : false\n end", "def server_running?\n if File.exist? pid_path\n pid = read_pid\n begin\n Process.kill(0, pid)\n rescue Errno::ESRCH\n return false\n end\n else\n false\n end\n end", "def server_running?\n if File.exist? pid_path\n pid = read_pid\n begin\n Process.kill(0, pid)\n rescue Errno::ESRCH\n return false\n end\n else\n false\n end\n end", "def running?\n pid = `ps x -o pid,command|grep [K]EWatcher|awk '{print $1}'`.to_i\n pid == 0 ? false : pid\n end", "def running?\n if File.exist?(\"#{@server_root}/httpd.pid\")\n pid = File.read(\"#{@server_root}/httpd.pid\").strip\n begin\n Process.kill(0, pid.to_i)\n return true\n rescue Errno::ESRCH\n return false\n rescue SystemCallError\n return true\n end\n else\n return false\n end\n end", "def reload_nginx\n if nginx_running?\n `/etc/init.d/nginx reload`\n else\n `/etc/init.d/nginx restart`\n end\n end", "def check_running?(pid_file)\n return false unless File.file?(pid_file)\n is_running?(pid_in(pid_file))\n end", "def is_running?\n result = \"\"\n result = `ps -p #{pid} -o cmd=`.gsub(\"\\n\", \"\") unless pid.empty?\n\n running = result.split.first == \"redis-server\" ? true : false\n\n running\n end", "def find_nginx!\n ##\n # NginX Conf path you get from Passenger\n if e.file?('/etc/nginx/conf/nginx.conf')\n @nginx_conf = '/etc/nginx/conf/nginx.conf'\n @nginx_conf_dir = '/etc/nginx/conf'\n end\n \n ##\n # NginX Conf path you get from Aptitude\n if e.file?('/etc/nginx/nginx.conf')\n @nginx_conf = '/etc/nginx/nginx.conf'\n @nginx_conf_dir = '/etc/nginx'\n end\n \n ##\n # Determines whether the configuration file was found or not\n if @nginx_conf.nil?\n error \"Could not find the NginX configuration file. Has NginX been installed?\"\n exit\n end\n \n ##\n # Set additional configuration\n @nginx_conf_name = @nginx_conf.split('/').last\n @nginx_vhosts_dir = @nginx_conf_dir + '/sites-enabled'\n end", "def running?\n pidfile.running?\n end", "def _process_running?\n return _pid == _pid_file_pid\n end", "def tomcat?\n system \"ps aux| grep tomcat | grep catalina\"\n end", "def is_felix_running?(params) \n Felixwrapper.configure(params)\n pid = Felixwrapper.instance.pid\n return false unless pid\n true\n end", "def pidfile_exists?\n self.class.pidfile_exists?(pidpath)\n end", "def pidfile_exists?\n self.class.pidfile_exists?(pidpath)\n end", "def ensure_nginx_executable_is_installed!\n if not e.file?(\"/etc/init.d/nginx\")\n message \"Installing NginX executable for starting/stopping/restarting/reloading Nginx.\"\n e.download_packages!('$HOME', :root)\n e.execute_as_root(\"cp $HOME/gitpusshuten-packages/modules/nginx/nginx /etc/init.d/nginx\")\n e.clean_up_packages!('$HOME', :root)\n end\n end", "def remote_process_exists?(pid_file)\n capture(\"ps -p $(cat #{pid_file}) ; true\").strip.split(\"\\n\").size == 2\n end", "def pid_file?\n return true if File.exist?(pid_path)\n false\n end", "def running?\n # First check if we have a pid file and if it exists\n return false if @pid_file.nil? || !File.exists?(@pid_file)\n\n # Then make sure we have a pid\n return false if pid.nil?\n\n # If we can get the process id then we assume it is running\n begin\n Process.getpgid(pid)\n true\n rescue Errno::ESRCH\n false\n end\n end", "def running?\n begin\n ping\n rescue Errno::EBADF, Errno::ECONNREFUSED => e\n return false\n end\n return true\n end", "def _pid_file_process_running?\n begin\n Process.getpgid(_pid_file_pid)\n return true\n rescue\n return false\n end\n end", "def srv_running\n return unless RUBY_PLATFORM =~ /linux/\n cmdobj = Mixlib::ShellOut.new(\"ps -ef | grep #{@new_resource.name} | grep java\")\n cmdobj.run_command.stdout.split(\"\\n\").reject { |e| e.include? \"sh -c\" }.size >= 1 # true or false\nend", "def passenger_rack_app?\n workdir.directory? &&\n workdir.join(\"config.ru\").file? &&\n workdir.join(\"tmp\").directory? &&\n workdir.join(\"public\").directory?\n end", "def status_server\n return -1 unless FileTest.exist?(PID_FILE)\n\n begin\n Process.getpgid(server_pid)\n return 0\n rescue\n return 1\n end\nend", "def running_process?\n Process.getpgid @pid\n true\n rescue Errno::ESRCH\n false\n end", "def process_exists?(pid)\n run(\"ps -p #{pid}\").success?\n end", "def running?\n !pid.nil? && status == 'running'\n end", "def alive?\n return false unless pid && (pid == Process.pid)\n\n self.class.process_exists?(pid)\n end", "def is_running?(pid)\n Process.getpgid(pid)\n true\n rescue Errno::ESRCH\n false\n end", "def instruments_app_running?\n ps_output = `ps x -o pid,comm | grep Instruments.app | grep -v grep`.strip\n if ps_output[/Instruments\\.app/, 0]\n true\n else\n false\n end\n end", "def is_alive pid\n begin\n return Process.kill(0, pid) == 1\n rescue Errno::ESRCH\n return false\n end\nend", "def is_alive pid\n begin\n return Process.kill(0, pid) == 1\n rescue Errno::ESRCH\n return false\n end\nend", "def pid_file_process_running?(pid_file)\n return false unless File.exist? pid_file\n Rails.logger.warn \"#{pid_file} appears to be running.\"\n pid = File.read(pid_file).to_i\n return true if Process.kill 0, pid\n rescue Errno::ESRCH\n Rails.logger.warn \"Process #{pid} not found. Deleting #{pid_file}.\"\n File.delete pid_file\n return false\n end", "def status\n return true unless config.managed?\n return false if pid.nil?\n\n begin\n Process.getpgid(pid)\n rescue Errno::ESRCH\n return false\n end\n\n begin\n TCPSocket.new(host, port).close\n\n Net::HTTP.start(host, port) do |http|\n http.request(Net::HTTP::Get.new('/'))\n end\n\n true\n rescue Errno::ECONNREFUSED, Errno::EINVAL\n false\n end\n end", "def server_running?\n http = Net::HTTP.new(\"localhost\", @port)\n req = Net::HTTP::Get.new(\"/index.html\")\n http.request(req).is_a?(Net::HTTPOK)\n rescue Errno::ECONNREFUSED\n false\n end", "def client_is_zypp?\n File.stat(\"/usr/bin/zypper\").executable?\nend", "def running?\n return false if pid == 0\n begin\n Process.getpgid(pid)\n true\n rescue Errno::ESRCH\n false\n end\n end", "def unicorn_pid\n begin\n File.read(ENV['UNICORN_PID'] || \"#{Rails.root}/tmp/pids/unicorn.pid\").to_i\n rescue Errno::ENOENT\n raise \"Unicorn doesn't seem to be running\"\n end\n end", "def perform\n server_has_new_pid_file? && pid and kill_pid\n end", "def running?\n processes = if node[\"platform_family\"] == \"windows\" then\n `powershell.exe -Command \\\"(Get-Process | Where-Object {$_.Name -eq \\'*aria*\\'}).count\\\"`.chop.to_i\n else \n cmd = Mixlib::ShellOut.new(\"pgrep -f #{new_resource.name}\")\n pgrep = cmd.run_command\n pgrep.stdout.length\n end\n processes > 0\nend", "def process_running?(pid)\n return false unless pid\n Process.getpgid(pid) != -1\n rescue Errno::ESRCH\n false\n end", "def sim_is_running?\n not sim_pid.nil?\n end", "def _pid_file_exists?\n File.exist?(_pid_filename) \n end", "def instance_running? instance\n\t\t\tunless instance.host == host\n\t\t\t\traise ArgumentError, \"Cannot check instances on remote hosts!\"\n\t\t\tend\n\t\t\t# This seems like a reasonable way to check without `ps ...`.\n\t\t\tFile.directory?(\"/proc/#{instance.pid}\")\n\t\tend", "def running?\n res = shell_out('ps -A -c -o command | grep ^Fantastical\\ 2$ || true')\n res.stdout.strip.empty? ? false : true\n end", "def alive?\n return false unless self.pid && (self.pid == Process.pid)\n\n self.class.process_exists?(self.pid)\n end", "def status\n return true unless managed?\n return false if pid.nil?\n\n begin\n Process.getpgid(pid)\n\n TCPSocket.new('127.0.0.1', port).close\n true\n rescue Errno::ESRCH, Errno::ECONNREFUSED\n false\n end\n end", "def alive?\n !@pid.nil?\n end", "def verifyStart\n `/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg`\n `service nagios restart`\n `service httpd restart`\n end", "def running?\n !!@pid\n end", "def unicorn_installed?\n result = `which unicorn`.gsub(\"\\n\", \"\")\n \n puts \"unicorn-binary not found\" if result.empty?\n \n result.empty? ? false : true\n end", "def php\n oputs <<-eos\n location ~ \\.php$ {\n fastcgi_pass 127.0.0.1:9000;\n fastcgi_index index.php;\n fastcgi_param SCRIPT_FILENAME $root_pub/$subdomain/$fastcgi_script_name;\n include /etc/nginx/fastcgi_params;\n }\n eos\nend", "def systemctl?\n systemctl.present?\n end", "def systemctl?\n systemctl.present?\n end", "def is_app_instance?\n if @service_type == 'http' && @path_name == '/' && @balancer_configuration == 'app'\n return true\n end\n\n false\n end", "def first_run?\n ::File.exist?(node['tomcat']['validation_script'])\n end", "def dockerized?\n File.read(\"/proc/1/cgroup\").include?(\"docker\")\nend", "def is_started?\n\t\treturn self.pid ? true : false\n\tend", "def started?\n !@pid.nil? && @pid > 0\n end", "def running?\n @pid.exist? and Pid.running? @pid.pid\n end", "def start_unicorn\n puts \"Starting unicorn...\"\n for app in @apps\n # unicorn\n @config_file = \"-c #{@config_file}\" if @config_file != ''\n cmd = \"unicorn -p #{app[:port]} -E #{@env.to_s} -o #{app[:ip]} #{@daemonize} #{@config_file} #{@config}\"\n puts \"=> #{cmd}\"\n system(cmd)\n break\n end\n puts \"Did they start?\"\n system(\"ps -aux | grep unicorn\")\nend", "def nginx_version\n return nil unless node.key?('nginx')\n node['nginx']['version']\n end", "def running?\n if get_pid\n begin\n Process.kill(0, get_pid)\n rescue Exception\n return false\n end\n end\n\n false\nend", "def running?\n return RUN_MODE if RUN_MODE.present?\n Rails.env.production?\n end", "def is_daemon?\n false\n end", "def tmux_available?\n system \"which tmux >/dev/null 2>&1\"\nend", "def launchctl?\n launchctl.present?\n end", "def launchctl?\n launchctl.present?\n end", "def control_pid?\n !!self[:daemonize]\n end", "def control_pid?\n !!self[:daemonize]\n end", "def is_rake_running?\n `ps -ef | grep rake | grep #{Process.ppid} | grep -v 'grep'`.size > 0\n end", "def is_pid_running?(pid)\n begin\n return Process.getpgid(pid) != -1\n rescue Errno::ESRCH\n return false\n end\n end", "def is_daemon?\n return false\n end", "def is_process_alive(pid)\n ps_ret = `ps | grep #{pid} | grep -v 'grep'`\n #puts \"PS: [#{ps_ret}]\"\n ps_ret != \"\" ? true : false\n end", "def process_by_pid?(pidfile)\n begin\n if File.exists?(pidfile)\n pid = File.read(pidfile).to_i\n if pid != 0\n Process.kill(0, pid)\n return true\n end\n end\n rescue Errno::ENOENT, Errno::ESRCH\n end\n false\n end", "def dropbox_running?\n `pgrep Dropbox` && $?.exitstatus.zero?\n end", "def is_running\n !`/etc/init.d/minecraft status`.include?('not')\nend", "def is_process_running?(image_name)\n puts \"Looking for instances of #{image_name}\"\n command = 'tasklist /FI \"IMAGENAME eq ' + \"#{image_name}\"\"\"\n command_output = `#{command}`\n command_output.each_line do |line|\n if line =~ /^#{image_name}/\n return true\n end\n end\n return false\n end", "def web_server\n if %{apache apache2}.include? node[:webapp][:web_server]\n \"apache2\"\n else\n \"nginx\"\n end\nend", "def nginx_version_satisfies?(requirement)\n return false if nginx_version.nil?\n version = Gem::Version.new(nginx_version)\n Gem::Requirement.new(requirement).satisfied_by?(version)\n end", "def running?(pid)\n begin\n return true if Process.getpgid(pid)\n rescue Errno::ESRCH\n false\n end\n end", "def karaf_started?\n n = `netstat -ao | grep 8101 | wc -l`\n n.to_i > 0\n end", "def running?(pid)\n !(pid.nil? || Sys::ProcTable.ps(pid.to_i).nil?)\n end", "def detect\n dynatrace_service_exist? ? process_config : nil\n end", "def alive?(port)\n pidfile = pid_file(port)\n pid = pid_in_file(pidfile)\n Process.kill(0, pid)\n true\n rescue Errno::ESRCH, Errno::ENOENT\n false\n rescue Errno::EACCES => e\n Merb.fatal!(\"You don't have access to the PID file at #{pidfile}: #{e.message}\")\n end", "def systemd?\n `ps -o comm= 1`.chomp == 'systemd'\n end", "def systemd?\n `ps -o comm= 1`.chomp == 'systemd'\n end", "def process_running?(pid)\n ::Process.getpgid(pid) != -1\n rescue Errno::EPERM\n true\n rescue Errno::ESRCH\n false\n end", "def service_running?\n response = `#{setup_docker_env_vars_str} docker-compose ps #{project_config['docker-compose']['service']}`\n return false if response =~ /No such service/i\n\tservice_state = response.split(\"\\n\")[2].split(/\\s{2,}/)[2]\n\tservice_state =~ /up/i ? true : false\nend", "def on_localhost?\n process && process.on_localhost?\n end", "def started?\n server_exist = false\n begin\n @soc = UDPSocket.open\n @soc.bind(\"\", DiscoverableServer::DEFAULT_PORT)\n @soc.close\n rescue Errno::EADDRINUSE\n server_exist = true\n end\n\n server_exist\n end", "def watchdog?\n ENV.include?(\"WATCHDOG_USEC\") &&\n (!ENV.include?(\"WATCHDOG_PID\") || ENV[\"WATCHDOG_PID\"].to_i == $$)\n end", "def started?\n !!@pid\n end", "def is_running?\n Faraday.get(@base_url + \"/\").status == 200\n end", "def daemon_running?; end", "def has_process?(processname)\n\t\t\t\tif(!processname.kind_of?(Regexp))\n\t\t\t\t\tprocessname = Regexp.new(Regexp.escape(processname))\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tprocesses().each_value() { |runningprocess|\n\t\t\t\t\tif(processname.match(runningprocess.program))\n\t\t\t\t\t\tCfruby.controller.inform('debug', \"\\\"#{processname.source}\\\" is running\")\n\t\t\t\t\t\treturn(runningprocess)\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tCfruby.controller.inform('debug', \"\\\"#{processname.source}\\\" is not running\")\n\t\t\t\treturn(false)\n\t\t\tend", "def rackserver?\n physical_type == \"RACK\"\n end", "def started?\n begin\n ping\n return true\n rescue => ex\n return false\n end\n end", "def conf\n home.join('nginx.conf')\n end", "def is_running?\n omnibus_helper = OmnibusHelper.new(node)\n omnibus_helper.service_up?(service_name) || (delegated? && omnibus_helper.service_up?(delegate_service_name) && is_ready?)\n end" ]
[ "0.6798805", "0.66890997", "0.66890997", "0.6441783", "0.6401759", "0.63586205", "0.6339175", "0.62783784", "0.62556356", "0.6184505", "0.61761665", "0.6166316", "0.6106308", "0.6073686", "0.6073686", "0.60048926", "0.5990481", "0.5972232", "0.59679294", "0.5958081", "0.5944631", "0.5933812", "0.5916837", "0.5889623", "0.5885995", "0.5763848", "0.5730228", "0.57069874", "0.567544", "0.5657304", "0.5642399", "0.5642399", "0.56393176", "0.56372327", "0.56371135", "0.56275636", "0.5601869", "0.5592393", "0.5580101", "0.55793655", "0.55780745", "0.55431265", "0.55371934", "0.5531401", "0.55284965", "0.5527218", "0.5508193", "0.5500332", "0.5498118", "0.54867536", "0.5481972", "0.54761505", "0.54728746", "0.54728746", "0.547029", "0.5464677", "0.54499227", "0.54485565", "0.54469204", "0.5446849", "0.5445553", "0.5435512", "0.5434296", "0.5427884", "0.54223067", "0.54143846", "0.54127395", "0.54127395", "0.54113775", "0.54113775", "0.5410436", "0.54074013", "0.54053795", "0.5405316", "0.5404012", "0.5394318", "0.53906715", "0.5390267", "0.53729624", "0.53722435", "0.5370515", "0.53674644", "0.53667927", "0.53662485", "0.53508365", "0.53501064", "0.53501064", "0.53483546", "0.53459203", "0.53434914", "0.53308886", "0.53120834", "0.5308618", "0.53050685", "0.53000253", "0.5298865", "0.5293811", "0.5283738", "0.528366", "0.52763575" ]
0.87879604
0
application_id is duplicated across supported_permissions and user_application_permissions to efficiently address common queries for a user's permissions for a particular application
def assign_application_id self.application_id = supported_permission.application_id if supported_permission.present? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def application_id=(value)\n @application_id = value\n end", "def application_id\n return @application_id\n end", "def set_application\n @application = current_user.oauth_applications.find(params[:id])\n end", "def current_application\n fail 'Application ID is missing' unless params.key?(:application_id)\n applications = current_user.applications\n applications.where(id: params[:application_id]).first\n end", "def set_application\n @application = current_user.applications.find(params[:id])\n end", "def application_id\n get_key('ALGOLIA_APPLICATION_ID', 'application_id')\n end", "def app_id=(value)\n @app_id = value\n end", "def app_id=(value)\n @app_id = value\n end", "def app_id=(value)\n @app_id = value\n end", "def get_applications\n\t\tApplication.where(\"api_user_id = ?\", id)\n\tend", "def app_id\n @app.id\n end", "def fetch_user_application\n @user_application = UserApplication.find(params[:id])\n end", "def application_id=(value)\n @children['application-id'][:value] = value\n end", "def application_id\n @application_id || YodleeApi.application_id\n end", "def app_id\n return @app_id\n end", "def app_id\n return @app_id\n end", "def app_id\n return @app_id\n end", "def set_application\n @application = Application.where(token: params[:id]).first\n end", "def set_application\n @application = applications_scope.find(params[:id])\n end", "def resource_app_id\n return @resource_app_id\n end", "def resource_app_id=(value)\n @resource_app_id = value\n end", "def app_id; end", "def app_id; end", "def app_id\n fb_app.id\n end", "def set_userapplication\n @userapplication = Userapplication.find(params[:id])\n end", "def set_user_application\n @user_application = UserApplication.find(params[:id])\n end", "def created_by_app_id=(value)\n @created_by_app_id = value\n end", "def user_app_id(force=false)\n @user_app_id = nil if force\n @user_app_id ||= read_user_app_id\n end", "def apps_permissions_users_list\n return {} unless !skip_info? && is_app_token? && is_not_excluded?\n semaphore.synchronize {\n @apps_permissions_users_list_raw ||= access_token.get('/api/apps.permissions.users.list')\n @apps_permissions_users_list ||= @apps_permissions_users_list_raw.parsed['resources'].inject({}){|h,i| h[i['id']] = i; h}\n }\n end", "def set_app\n @app = current_user.apps.find(params[:app_id])\n end", "def set_application\n @application = @application_scope.find(params[:id])\n @current_application = @application\n end", "def app_scope_id\n return @app_scope_id\n end", "def app_id\n @values.fetch('appId') { \n @values['appId'] = nil\n }\n end", "def index\n @app_instances = parent_organization.app_instances.active.where(\"updated_at.gt\" => Time.at(timestamp)).select do |i|\n # force owner assignment to avoid a refetch in ability can?(:access,i)\n i.owner = parent_organization\n can?(:access,i)\n end\n end", "def current_application\n @current_application ||= Application.find(params[:application_id]) if params[:application_id]\n end", "def set_application\n join_arg = 'INNER JOIN applicants ON applicants.id=applications.applicants_id\n AND applications.id=' + params[:id].to_s\n @application = Application\n .joins(ActiveRecord::Base::sanitize_sql(join_arg))\n .select('applicants.\"AName\", applicants.\"BackgroundCheckCompleted\",\n applicants.\"BackgroundCheckDate\", applicants.\"BCWaived\", applications.*')\n .first()\n end", "def set_app\n @app = current_user.apps.find(params[:id])\n end", "def apps_permissions_users_list(_user_id=nil)\n #raise StandardError, \"APUL caller #{caller_method_name} user #{_user_id}\"\n return {} unless is_app_token?\n semaphore.synchronize {\n @apps_permissions_users_list ||= (\n r = get('/api/apps.permissions.users.list').parsed\n r['resources'].to_a.inject({}){|h,i| h[i['id']] = i; h} || {}\n )\n _user_id ? @apps_permissions_users_list[_user_id].to_h['scopes'] : @apps_permissions_users_list\n }\n end", "def set_application\n @application = Application.find_by!(number: params[:application_token])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def app_type_requested_id\n @app_type_requested_id ||= if app_type_requested.to_i > 0\n all_user_app_type_ids.find { |app_id| app_id == app_type_requested.to_i }\n else\n Admin::AppType\n .all_available_to(current_user)\n .find { |app| app.name == app_type_requested }&.id\n end\n\n raise FphsException, \"App type requested was not found: #{app_type_requested}\" unless @app_type_requested_id\n\n @app_type_requested_id\n end", "def user_application_params\n params.require(:user_application).permit(:user_id, :application_id, :environment_spec)\n end", "def app_scope_id=(value)\n @app_scope_id = value\n end", "def app_id=(id)\n @app_id = id.to_s\n end", "def user_apps\n Application.with_user(session[:user_id])\n end", "def validate_app_from_app_id(app_id)\n Rails.logger.info(\"Enter Validate App from App Id\")\n \n # there should be no request for account in this context (access_origin)\n if params[:controller] == \"accounts\" \n return false\n elsif params[:controller] == \"apps\"\n return params[:id] == app_id\n else\n return params[:app_id] == app_id # this case handles any other controller..\n # app_id must be there for anyother request other than account \n end\n rescue => e \n Rails.logger.error(\"**** ERROR **** #{e.message}\")\n false\n end", "def app_identifier\n return @app_identifier\n end", "def app_id\n @object.send(Innsights.user_id)\n end", "def app_user_model_id=(value)\n @app_user_model_id = value\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_application\n @application = Application.find(params[:id])\n end", "def set_app\n @app = App.with_roles(%i[admin notifier], current_user).find(params[:id] || params[:app_id])\n end", "def app_user_model_id\n return @app_user_model_id\n end", "def app_id=(value)\n if value == @defaults['appId']\n @values.delete 'appId' if @values.key? 'appId'\n else\n @values['appId'] = value\n end\n end", "def app_id=(_arg0); end", "def app_id=(_arg0); end", "def app_activity_id\n return @app_activity_id\n end", "def set_app_user\n @app_user = AppUser.find(params[:id])\n end", "def created_by_app_id\n return @created_by_app_id\n end", "def set_application\n @application = CollaborationApplication.find(params[:id])\n end", "def app_item_id\n read_integer('app_item_id')\n end", "def check_app!(user)\n if !user['app_ids'].include?(@app['_id']) && @app['app_type'] == Apps::OPEN_APP\n UsersManager.update(user, {\n 'app_ids' => user['app_ids'] + [ @app['_id'] ]\n })\n end\n\n unless user['app_ids'].include?(@app['_id'])\n raise Uasthree::UserAppNoMatchError.new(params[:username], params[:app_uname])\n end\n end", "def index\n @user ||= current_user\n @apps = @user.apps.all\n # @app = @user.apps.find(params[:id]) \n\n end", "def select_application(app_id)\n ber_data = iso_apdu! :ins => 0xA4, :p1 => 0x04, :p2 => 0x00, :data => app_id\n app_tags = Asn1Ber.decode ber_data\n app_data = {}\n Asn1Ber.visit app_tags do |path, value|\n case path\n when [0x6F, 0xA5, 0x9F65]\n app_data[:max_apdu_length] = value.inject(0) { |acc, v| (acc << 8) | v }\n when [0x6F, 0x84]\n app_data[:aid] = value\n end\n end\n app_data\n end", "def show\n @user ||= current_user\n @app = @user.apps.find(params[:id]) \n end", "def user_application_params\n params.require(:user_application).permit(:user_id, :user_application_status_id, :first_choice_volunteer_position_id, :second_choice_volunteer_position_id, :third_choice_volunteer_position_id)\n end", "def app_identifier=(value)\n @app_identifier = value\n end", "def app_instance_params\n params.require(:app_instance).permit(:parent_app_id, :unique_identifier, :user_id)\n end", "def for(app_id, user_id)\n if user_id.nil?\n return app_id if app_id !~ TOKEN_HAS_USER_RE\n # unlikely that an app starts with \"user_len:\\d+/\"... but we can\n # support it by just using user_len:0//user_len:\\d+/.\n user_id = ''.freeze\n end\n \"#{TOKEN_HAS_USER_FIELD}:#{user_id.size}/#{user_id}/#{app_id}\"\n end", "def retrieve_user_access_list_for_app(user,app)\n user.groups.where(app_id: app.id)\n end", "def applications\n select_application gp_card_manager_aid\n secure_channel\n gp_get_status :apps\n \n # TODO(costan): there should be a way to query the AIDs without asking the\n # SD, which requires admin keys.\n end", "def set_application\n @application = Oread::Application.find(params[:id])\n end", "def create_application_id(application_name)\n applicaiton_id = VaultDriver.generate_uid\n applicaiton_create_uri = URI(@url + \"auth/#{application_name}/map/app-id/#{applicaiton_id}\")\n req = Net::HTTP::Post.new(applicaiton_create_uri)\n req['X-Vault-Token'] = @token\n res = Net::HTTP.start(applicaiton_create_uri.hostname, applicaiton_create_uri.port) do |http|\n req.body = { 'value' => 'root', 'display_name' => application_name.to_s }.to_json\n http.request(req)\n end\n [applicaiton_id, res.code.to_i]\n end", "def app_item_id\n read('app_item_id')\n end", "def matching_user_app_type\n @matching_user_app_type || matching_user&.app_type\n end", "def applications_with_status(status_name, include_cancelled = false, respect_sequence = false)\n apps = []\n \n if respect_sequence\n offering_status = statuses.find(:first, \n :joins => :application_status_type, \n :conditions => { \"application_status_types.name\" => status_name.to_s })\n status_sequence_mapping = {}\n for os in statuses.find(:all)\n status_sequence_mapping[os.application_status_type_id] = os.sequence\n end\n end\n \n app_ids = ApplicationForOffering.find(:all,\n :select => \"application_for_offerings.id\",\n :joins => { :statuses => :application_status_type },\n :conditions => { :offering_id => self.id, \n \"application_status_types.name\" => status_name.to_s \n }\n ).collect(&:id)\n \n raw_apps = ApplicationForOffering.find(app_ids.uniq, \n :select => \"application_for_offerings.*\",\n :include => [{:current_application_status => :application_status_type }, :person],\n :joins => :person,\n :order => \"lastname, firstname\"\n )\n \n for app in raw_apps\n next if !include_cancelled && app.current_status_name == 'cancelled'\n if respect_sequence\n current_status_sequence = status_sequence_mapping[app.current_application_status.application_status_type_id]\n next if current_status_sequence && current_status_sequence < offering_status.try(:sequence)\n end\n apps << app\n end\n \n apps\n\n\n # apps = []\n # raw_apps = application_for_offerings.find(:all, \n # :include => [{:current_application_status => :application_status_type }, \n # {:application_statuses => :status_type }])\n # raw_apps.each do |app|\n # app.application_statuses.each do |status|\n # if status.status_type.name == status_name.to_s\n # apps << app unless !include_cancelled && app.current_status_name == 'cancelled'\n # end\n # end\n # end\n # apps.uniq\n end", "def filtered_primary_model(_ = nil)\n pm = primary_model\n a = filter_params_permitted[:app_type_id] if filter_params_permitted\n if a.present?\n # A filter was selected. Limit the results to just users that can access the specified app.\n a = a.to_i\n # Set the app_type_id param to nil, so the super method doesn't attempt to filter on it\n filter_params_permitted[:app_type_id] = nil\n ids = pm.all.select { |u| a.in?(u.accessible_app_type_ids) }.map(&:id)\n pm = pm.where(id: ids)\n end\n\n # Filter on everything (except the specified app_type_id, which has beem temporarily removed)\n res = super(pm)\n\n # Reset the filter params so that the buttons appear correctly\n filter_params_permitted[:app_type_id] = a.to_s if a.present?\n res\n end", "def userapplication_params\n params.require(:userapplication).permit(:user_id, :applicationclient_id, :application_id, :client_id, :state)\n end", "def app_activity_id=(value)\n @app_activity_id = value\n end", "def decide\n @meta = { title: 'Select Application', description: 'Select the application you want to login to' }\n @user_app_access_list = retrieve_user_access_list_for_app(current_user,current_app)\n end", "def set_membership_application\n @membership_application = MembershipApplication.find(params[:id])\n end", "def validate_application_available_to_user\n return unless membership\n\n unless membership.has_access_to_application?(application)\n errors.add :application, :application_not_available, app_name: application_name, organisation_name: membership.organisation.name\n end\n end", "def create_appplication_key\n\t\t# set guid key for current application_id\n\t\t# self.application_id = Admin::Guid.new.key\n\t\t@application_id = Admin::Guid.new.key\n\tend" ]
[ "0.6681327", "0.6640151", "0.6611282", "0.6348934", "0.6262077", "0.62194884", "0.6131442", "0.6131442", "0.6131442", "0.612916", "0.6129045", "0.6113676", "0.6101291", "0.6096036", "0.6041295", "0.6041295", "0.6041295", "0.60290617", "0.6013088", "0.59781474", "0.59571505", "0.5956195", "0.5956195", "0.59054136", "0.5903442", "0.5902787", "0.58585197", "0.5829491", "0.5821323", "0.58064264", "0.5793042", "0.5764243", "0.576351", "0.5759111", "0.57494485", "0.5743757", "0.5743021", "0.5740176", "0.57044095", "0.56862605", "0.56862605", "0.56862605", "0.56862605", "0.56677914", "0.5653047", "0.5647208", "0.56444776", "0.56121945", "0.56035817", "0.56031734", "0.55965674", "0.55854225", "0.558367", "0.558367", "0.558367", "0.558367", "0.558367", "0.558367", "0.558367", "0.558367", "0.558367", "0.558367", "0.558367", "0.558367", "0.558367", "0.558367", "0.558367", "0.55832785", "0.55817866", "0.556456", "0.5556765", "0.5556765", "0.554276", "0.55414116", "0.55117524", "0.5509735", "0.55074507", "0.55061674", "0.5481808", "0.54789335", "0.5470086", "0.5467303", "0.5455424", "0.54543024", "0.5437601", "0.54267615", "0.5415162", "0.54082984", "0.5400571", "0.5389085", "0.5386354", "0.53734183", "0.53685606", "0.53684425", "0.53677684", "0.53630835", "0.5361854", "0.5360058", "0.53588307" ]
0.7259442
0
Most of the input will be in USASCII, but an encoding can be set per buffer for the input. For just about all purposes, UTF8 should be what you want to input, and it's what Tk can handle best.
def string(text) common_string(text, text.event.unicode) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_encoding(string)\n ## removing newline (needed for pty/expect newlines)\n string[0, 2] = '' if string.start_with? \"\\r\\n\"\n string[0, 3] = '' if string.start_with? \"\\r\\r\\n\"\n string.gsub!(\"\\r\\n\", \"\\n\")\n # string.chomp!\n string\n end", "def force_default_encoding=(_arg0); end", "def default_encoding=(_arg0); end", "def input_answer\n STDIN.gets.encode('UTF-8').chomp\n end", "def set_text_input(input); end", "def force_utf8(buf) \n buf.force_encoding('ISO-8859-1').encode('UTF-8', 'UTF-8', replace: nil) \n end", "def latin\n @input = I18n.transliterate(@input)\n end", "def set_encoding(text)\n unless text.encoding.name == \"UTF-8\"\n text = text.encode(\"UTF-8\", \n invalid: :replace, \n undef: :replace, \n replace: \"\"\n )\n end\n end", "def force_encoding(*args) settings.force_encoding(*args) end", "def isutf8;\tKconv.isutf8(self) end", "def encoding\n @stdin.external_encoding\n end", "def encoding\n @stdin.external_encoding\n end", "def encoding\n @stdin.external_encoding\n end", "def encoding\n @stdin.external_encoding\n end", "def encoding\n @stdin.external_encoding\n end", "def force_utf8(buf)\n return buf if buf.valid_encoding?\n buf.force_encoding('ISO-8859-1').encode('UTF-8', 'UTF-8', replace: nil)\n end", "def force_encoding(*); self; end", "def safe_encode_utf8(text)\n text.force_encoding('ASCII-8BIT').encode(\"UTF-8\", :invalid => :replace, :undef => :replace, :universal_newline => true)\nend", "def process_encoding(source)\n source.force_encoding(Encoding::UTF_8)\n end", "def default_encoding; end", "def default_encoding; end", "def force_default_encoding; end", "def encoding\n @stdin.external_encoding\n end", "def encoding\n @stdin.external_encoding\n end", "def encoding\n @stdin.external_encoding\n end", "def default_encoding\n Encoding::UTF_8\n end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def encoding=(_arg0); end", "def transcode(str)\n str.force_encoding('UTF-8')\nend", "def charset; end", "def charset; end", "def charset; end", "def encoding(encoding); end", "def text_input; end", "def set_encoding\n Encoding.default_external = Encoding::UTF_8\n Encoding.default_internal = Encoding::UTF_8\n nil\n end", "def suppress_encoding; end", "def charset=(_arg0); end", "def utf8\n self.encode('UTF-8', 'binary', :invalid => :replace, :undef => :replace, :replace => '?')\n end", "def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n exit(1) if input == \"\\u0003\"\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.cooked!\n STDIN.echo = true\n \n\n return input\nend", "def force_to_utf8(text)\n ActiveSupport::Multibyte::Unicode.tidy_bytes(text)\n end", "def charset=(_); end", "def can_write_only_latin?(input)\n !!(input.match(LATIN_LOOKING_CHARS))\n end", "def _utf8(str)\n return str.force_encoding(Encoding::UTF_8)\nend", "def encode(input)\n return '' if input.nil?\n input.to_s.encode(Encoding::UTF_8)\n rescue Encoding::UndefinedConversionError\n input.dup.force_encoding(Encoding::UTF_8)\n end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def force_utf32=(_arg0); end", "def force_utf32=(_arg0); end", "def force_utf32=(_arg0); end", "def toutf8; Kconv.toutf8(self) end", "def iconv() end", "def utf8(string)\n string.force_encoding('utf-8') unless string.nil?\n end", "def transcode(str)\n return str.force_encoding(Encoding::UTF_8)\nend", "def suppress_encoding=(_arg0); end", "def text(text_input_handle)\n end", "def default_space_encoding=(_arg0); end", "def text( text )\n @buffer << encode(text.to_s)\n end", "def force_utf8_encoding(msg)\n msg.respond_to?(:force_encoding) && msg.encoding.name != 'UTF-8' ? msg.force_encoding('UTF-8') : msg\nend", "def fix_encoding(str)\n str.force_encoding(Encoding.default_external) if str.respond_to?(:force_encoding)\n str\nend", "def charset\n #@data.charset ||= CharGuess.guess(document).downcase\n end", "def plaintext_utf8(delim=\"\\n\")\n plaintext(delim).encode('UTF-8', invalid: :replace, undef: :replace, \n replace: '?')\n end", "def force_utf32; end", "def force_utf32; end", "def force_utf32; end", "def encoding\n\t'ISO-8859-1'\nend", "def to_utf8 untrusted_string=\"\"\n ic = Iconv.new('UTF-8//IGNORE', 'ISO-8859-15')\n ic.iconv(untrusted_string)\n #ic.iconv(untrusted_string + ' ')[0..-2]\n end", "def to_utf8 untrusted_string=\"\"\n ic = Iconv.new('UTF-8//IGNORE', 'ISO-8859-15')\n ic.iconv(untrusted_string)\n #ic.iconv(untrusted_string + ' ')[0..-2]\n end", "def normalize_encoding(text)\n text.encode('windows-1252')\n rescue ::Encoding::InvalidByteSequenceError,\n ::Encoding::UndefinedConversionError\n\n raise Prawn::Errors::IncompatibleStringEncoding,\n \"Your document includes text that's not compatible with the \" \\\n \"Windows-1252 character set.\\n\" \\\n \"If you need full UTF-8 support, use TTF fonts instead of PDF's \" \\\n \"built-in fonts.\\n\"\n end", "def wputs(str)\n puts str.encode(\"cp866\", str.encoding)\nend", "def utf8(string)\n string.force_encoding(Encoding::UTF_8)\n end", "def is_utf8?\n ActiveSupport::Multibyte::Handlers::UTF8Handler.consumes?(self)\n end", "def utf8_enforcer_tag\n # Use raw HTML to ensure the value is written as an HTML entity; it\n # needs to be the right character regardless of which encoding the\n # browser infers.\n '<input name=\"utf8\" type=\"hidden\" value=\"&#x2713;\" autocomplete=\"off\" />'.html_safe\n end", "def found_encoding; end", "def found_encoding; end", "def try_with_encoding(string, encoding); end", "def try_with_encoding(string, encoding); end", "def process_encoding(source)\n ::Temple::Filters::Encoding.new.call(source)\n end", "def to_ascii; convert_format(UTF8, ASCII8BIT);end", "def utf8\n c = self.class\n if String.method_defined? :force_encoding\n replace c.new(map(&:utf8))\n else\n self\n end\n end", "def external_encoding()\n #This is a stub, used for indexing\n end", "def encoding=(enc); end", "def do_encoding_terminal(string)\n string = string.to_s\n string.gsub!(\"\\r\\r\", \"\\r\")\n string.gsub!(\"\\r\\n\", \"\\n\")\n string.gsub!(\"\\r\\$\\s\", \"\")\n\n string.gsub!(/.\\r/, \"\")\n string.gsub!(/\\x1B\\[\\d*?[ABCDsuKJ]/, '')\n string\n end", "def text\n txt = @text\n if @compressed\n txt = PngMethods::inflate(@text)\n end\n\n if @international\n txt.force_encoding(\"UTF-8\")\n else\n txt.force_encoding(\"ISO-8859-1\")\n end\n end" ]
[ "0.62089545", "0.61749285", "0.61656094", "0.61618555", "0.61497504", "0.612917", "0.6125854", "0.6116351", "0.61144567", "0.6085761", "0.6085222", "0.6085222", "0.6085222", "0.6085222", "0.6085222", "0.6082992", "0.6065431", "0.60567236", "0.6053171", "0.60266197", "0.60266197", "0.60003495", "0.59956944", "0.59956944", "0.59956944", "0.59449583", "0.5928733", "0.5928733", "0.5928733", "0.5928733", "0.5928733", "0.59281754", "0.59281754", "0.5844396", "0.58073694", "0.58073694", "0.58073694", "0.5799648", "0.5796094", "0.5792382", "0.5789205", "0.57638127", "0.572634", "0.57247585", "0.5724397", "0.56957453", "0.5671697", "0.5667541", "0.5665118", "0.562797", "0.562797", "0.562797", "0.562797", "0.562797", "0.562797", "0.562797", "0.562797", "0.562797", "0.562797", "0.562797", "0.562797", "0.562797", "0.562797", "0.562797", "0.5623313", "0.5623313", "0.5623313", "0.56171817", "0.56124383", "0.56102496", "0.5607779", "0.56024384", "0.55914736", "0.5571122", "0.5538553", "0.55244267", "0.55161697", "0.55124426", "0.55094576", "0.5507035", "0.5507035", "0.5507035", "0.550116", "0.5501115", "0.5501115", "0.5490181", "0.5484141", "0.5482576", "0.5471127", "0.546996", "0.5460781", "0.5460781", "0.54603827", "0.54603827", "0.5459295", "0.5444105", "0.54430497", "0.5434752", "0.5414043", "0.5402986", "0.54006654" ]
0.0
-1
Insert characters literally, or enter decimal byte value (3 digits). This means we try to get up to 3 digits, but possibly don't get any. This code is less than elegant, but so is the behaviour we try to achieve. (none)decimal 3255 o or Ooctal 3377 (255) x or Xhexadecimal 2ff (255) uhexadecimal 4ffff (65535) Uhexadecimal 87fffffff (2147483647)
def literal(buffer) reader = lambda { |string = ''| buffer.major_mode.read(1) do |event| if unicode = event.unicode string += unicode # copy buffer.message string.inspect case result = literal_handle(buffer, string) when nil reader.call(string) when String literal_insert(buffer, result) end else return # Unverrichteter Dinge end end } reader.call end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decimal_digits\n pos0 = @pos\n if (code = @codes[@pos]) >= 0x30 and code <= 0x39\n @pos += 1\n while code = @codes[@pos] and code >= 0x30 and code <= 0x39\n @pos += 1\n end\n return @codes[pos0...@pos].pack(\"U*\")\n else\n nil\n end\n end", "def replace_invalid_chars(price)\n decimalised = price[/[.]/] ? price : \"0.\" + price \n decimalised.gsub(/[£p]/, '').to_f\nend", "def escape_bytea(str)\n # each_byte used instead of [] for 1.9 compatibility\n str.gsub(/[\\000-\\037\\047\\134\\177-\\377]/n){|b| \"\\\\#{sprintf('%o', b.each_byte{|x| break x}).rjust(3, '0')}\"}\n end", "def characters(number: T.unsafe(nil), min_alpha: T.unsafe(nil), min_numeric: T.unsafe(nil)); end", "def encode_digit(d)\n d + 22 + 75 * (d < 26 ? 1 : 0)\n # 0..25 map to ASCII a..z\n # 26..35 map to ASCII 0..9\n end", "def test_ber_integers\n assert_equal( \"\\002\\001\\005\", 5.to_ber )\n assert_equal( \"\\002\\002\\001\\364\", 500.to_ber )\n assert_equal( \"\\x02\\x02\\xC3P\", 50000.to_ber )\n assert_equal( \"\\002\\005\\001*\\005\\362\\000\", 5000000000.to_ber )\n end", "def convert_q_to_phred33(q_value)\r\n return (q_value.round() + 33).chr\r\nend", "def extra_characters\n if @number[0] == '+' && @number[1..2] != '00' && @number[1] != ' '\n @number = remove_plus\n elsif @number[0..1] == '00'\n @number = remove_double_zero\n end\n end", "def fixnum\n Util.from_bytes :fixnum, value\n end", "def encode_digit(d)\n d + 22 + 75 * (d < 26 ? 1 : 0)\n # 0..25 map to ASCII a..z or A..Z \n # 26..35 map to ASCII 0..9\n end", "def pres(x)\n\tif x<10\n\t\treturn x = \"0\" + x.to_s\n\telse\n\t\treturn x = x.to_s\n\tend\nend", "def convert_decimal_octet_to_hexadecimal(octet)\n unless is_valid_decimal_octet? octet\n raise Valshamr::InvalidDecimalOctetError, \"Expected decimal value in the range of 0..255, but received: #{octet}\"\n end\n\n hexadecimal = octet.to_s(base=16).upcase\n hexadecimal.insert(0, \"0\") if hexadecimal.length == 1\n\n hexadecimal\n end", "def convert_3_digits_number(value)\n word = ''\n division_result = value / 100\n mod_result = value % 100\n\n if division_result > 0\n word = \"#{LESS_THAN_20[division_result]} hundred\"\n word = \"#{word} \" if mod_result > 0\n end\n\n word = \"#{word}#{convert_2_digits_number(mod_result)}\" if mod_result > 0\n word\n end", "def e010_cep(pedido)\n return \"%08d\" % 13073340\n end", "def decimal_literal\n pos0 = @pos\n code = @codes[@pos]\n\n if code.nil?\n return nil\n elsif code == 0x2e #.\n @pos += 1\n f = decimal_digits\n if f.nil? #=> this period is punctuator\n @pos = pos0 + 1\n return ECMA262::PUNC_PERIOD\n end\n if (code = @codes[@pos]) == 0x65 || code == 0x45\n @pos += 1\n e = exponent_part\n end\n if identifier_start?(@codes[@pos])\n raise ParseError.new(\"The source character immediately following a NumericLiteral must not be an IdentifierStart or DecimalDigit\", self)\n end\n\n return ECMA262::ECMA262Numeric.new('0', f, e)\n elsif code == 0x30 # zero\n i = \"0\"\n @pos += 1\n if @codes[@pos] == 0x2e #.\n @pos += 1\n f = decimal_digits\n if (code = @codes[@pos]) == 0x65 || code == 0x45 #e or E\n @pos += 1\n e = exponent_part\n end\n elsif (code = @codes[@pos]) == 0x65 || code == 0x45 #e or E\n @pos += 1\n e = exponent_part\n end\n if identifier_start?(@codes[@pos])\n raise ParseError.new(\"The source character immediately following a NumericLiteral must not be an IdentifierStart or DecimalDigit\", self)\n end\n\n return ECMA262::ECMA262Numeric.new(i, f, e)\n elsif code >= 0x31 and code <= 0x39\n i = decimal_digits\n if @codes[@pos] == 0x2e #.\n @pos += 1\n f = decimal_digits\n if (code = @codes[@pos]) == 0x65 || code == 0x45 #e or E\n @pos += 1\n e = exponent_part\n end\n elsif (code = @codes[@pos]) == 0x65 || code == 0x45 #e or E\n @pos += 1\n e = exponent_part\n end\n if identifier_start?(@codes[@pos])\n raise ParseError.new(\"The source character immediately following a NumericLiteral must not be an IdentifierStart or DecimalDigit\", self)\n end\n\n return ECMA262::ECMA262Numeric.new(i, f, e)\n end\n\n nil\n end", "def fake_bin(s)\n s.tr('1-9', '00001')\nend", "def str_val(val, pre = \"\")\n (\"#{pre}#{\"%.8f\" % (val / 1e8)}\").rjust(20)\nend", "def _dearmor6b(c, len = 6)\n val = c.ord\n ret = val - (val >= 96 ? 56 : 48) # Mapped to 2 separate contiguous blocks of ascii, so choose which\n ret.to_s(2).rjust(6, \"0\")[0..(len - 1)]\n end", "def hexadecimal(digits: T.unsafe(nil)); end", "def reformat(number)\n num_without_decimal = number.gsub('.','') \n unless num_without_decimal.length == 4\n num_without_decimal = '0' + num_without_decimal \n end\n num_without_decimal\n end", "def decode_digit(cp)\n cp - 48 < 10 ? cp - 22 : cp - 65 < 26 ? cp - 65 : cp - 97 < 26 ? cp - 97 : BASE\n end", "def decode_digit(cp)\n cp - 48 < 10 ? cp - 22 : cp - 65 < 26 ? cp - 65 : cp - 97 < 26 ? cp - 97 : BASE\n end", "def format(number)\n \tif number.to_s.include? '255' and not number.to_s.include? '+'\n \t number = \"+#{number}\"\n \tend\n\n \treturn number\n end", "def char_escape_helper(base, regex, n)\n number = \"\"\n\n n.times do\n number << @char\n next_char\n break if @char !~ regex\n end\n\n number.to_i(base).chr\n end", "def set_last_digits\n end", "def gsubber(money)\n money.split(/^[\\D|$]{2,3}/).pop\n money.gsub!(/^[\\D|$]{2,3}/,'')\n money.gsub!(/k$/i,'000')\n money.gsub!(/,/,'')\n money.gsub!(/\\.0+/,'')\n end", "def insertChar(str, length)\n if str.is_a?(String) && length.is_a?(Integer)\n str = str[0...length]\n new_str = str.split(' ').join('%20')\n return new_str\n else\n \"input a string and integer\"\n end\nend", "def number_builder( number_as_string )\n\n number_array = number_as_string.each_char.to_a\n\n pos_flag = true\n had_sign = false\n\n # handle the sign\n case number_array.first\n when '-'\n pos_flag = false\n had_sign = true\n number_array.shift\n when '+'\n had_sign = true\n number_array.shift\n end\n\n total = 0 \n decimal_position = -1\n\n number_array.each_with_index do |character,index|\n \n # record this position if decimal\n if character.eql?('.')\n decimal_position = index\n else\n # don't validate the number \n total = total*10 + character.to_i\n end\n end\n \n ( total = 0 - total ) if not pos_flag\n\n # account for decimal point placement\n \n if (decimal_position != -1)\n # Example: 15.5\n # 0123 (length 4, decimal_position = 2)\n\n # Example: 19.26\n # 01234 (length 5, decimal_position = 2)\n\n # Example: -23.26\n # 012345 (length 6, decimal_position = 3)\n\n\n power = number_array.length - decimal_position -1\n\n total = total * 10**(0-power)\n\n end\n\n return total.to_f\n\nend", "def convertRawEntry(num)\n @num = num\n if @num > 8192 || @num < -8192\n puts \"Please enter a number between -8192 and 8192\"\n else\n @num = @num + 8192\n end\n return @num\nend", "def value_with (char)\n temp_val = @value\n \n if @cursor_location == @value.length\n temp_val = @value + char\n else\n temp_val = @value.slice(0..@cursor_location-1) + char + @value.slice(@cursor_location..@value.length-1)\n end\n \n temp_val\n end", "def standardize_number(num)\n #for testing we will accept +1 numbers\n if num.grep(/^\\+*\\s*1/).length == 1\n num = num.gsub(/^\\+/,'')\n num = \"+\" + num\n else\n num = num.gsub(/^\\+/,'')\n num = num.gsub(/^\\s*88/,'')\n num = \"+88\" + num\n end\n num.gsub(/\\s+/,'')\nend", "def blob(val)\n val.gsub(/[\\000-\\037\\047\\134\\177-\\377]/) do |b|\n \"\\\\#{ b[0].to_s(8).rjust(3, '0') }\"\n end\n end", "def from_hex(val)\n if val.is_a?(String)\n # Double up if single char form\n val *= 2 if val.size == 1\n # Convert to integer\n val = val.hex\n end\n # Clamp\n val = 0 if val < 0\n val = 255 if val > 255\n val\n end", "def getThreeDigitNumberStr(thrDigitVal)\n\t\tnumStr = \"\"\n\t\tunless getNumberAsStr[thrDigitVal].blank?\n\t\t\tnumStr = getNumberAsStr[thrDigitVal]\n\t\telse\n\t\t\tif thrDigitVal > 0\n\t\t\t\thundredStr = getNumberAsStr[thrDigitVal/100].blank? ? \"\" : (getNumberAsStr[thrDigitVal/100] + \" \" + l(:label_hundred))\n\t\t\t\ttwoDigStr = getTwoDigitNumberStr(thrDigitVal%100)\n\t\t\t\tnumStr = hundredStr.blank? || twoDigStr.blank? ? (hundredStr + twoDigStr) : (hundredStr + \" \"+ l('support.array.sentence_connector') + twoDigStr)\n\t\t\tend\n\t\tend\n\t\tnumStr = \" \" + numStr unless numStr.blank?\n\t\tnumStr\n\tend", "def net_pack_int(int)\n net_error \"#{__method__}: '#{int}' is too low allowed range #{NET_MIN_INT}-#{NET_MAX_INT}\" if int < NET_MIN_INT\n net_error \"#{__method__}: '#{int}' is too high allowed range #{NET_MIN_INT}-#{NET_MAX_INT}\" if int > NET_MAX_INT\n int += NET_INT_OFFSET\n int.chr\nend", "def literal_handle(_buffer, string)\n case string\n when /^\\d{,3}$/\n return if string.size < 3\n [string.to_i].pack('U')\n when /^o([0-7]{,3})$/i\n return if Regexp.last_match(1).size < 3\n [Integer(\"0#{Regexp.last_match(1)}\")].pack('U')\n when /^x(\\h{,2})$/i\n return if Regexp.last_match(1).size < 2\n [Integer(\"0x#{Regexp.last_match(1)}\")].pack('U')\n when /^u(\\h{,4})$/\n return if Regexp.last_match(1).size < 4\n [Integer(\"0x#{Regexp.last_match(1)}\")].pack('U')\n when /^U(\\h{,8})$/\n return if Regexp.last_match(1).size < 8\n [Integer(\"0x#{Regexp.last_match(1)}\")].pack('U')\n end\n end", "def teletext_add_digit _value\n send_cmd(\"teletext_add_digit #{_value}\")\n end", "def decimal_part(digits: T.unsafe(nil)); end", "def non_zero_digit; end", "def DashInsert(num)\n\n # step1: convert the integer to a string\n # step2: determine whether a number is odd or not and grab index \n # step3: insert a dash after it \n\n num.scan(/[13597]{2}|.+/).join(\"-\")\n # num_arr = num.to_s\n # num_arr.each_char do |n|\n # \tif n % 3 = 0 \n # \t\tstr.insert(i+1, '-')\n # \tend\n # end\n # code goes here \n \nend", "def hex_format(value, digits: nil, upper: nil)\n hex = upper.is_a?(FalseClass) ? 'x' : 'X'\n fmt = (digits &&= positive(digits)) ? \"%0#{digits}#{hex}\" : \"%#{hex}\"\n fmt % value\n rescue ArgumentError, TypeError\n # noinspection RubyScope\n fmt % 0\n end", "def convert_phred33_to_q(phred)\r\n return (phred.ord - 33)\r\nend", "def call\n clean_value = remove_commas\n PURE_NUMERIC_REGEX.match?(clean_value) ? clean_value : @original_value\n end", "def ascii!(replacement=\"\")\n n = bytes\n \n slice!(0..size)\n \n n.each { |b|\n if b < 33 || b > 127 then\n concat(replacement)\n else\n concat(b.chr)\n end\n }\n \n to_s\n end", "def say_digits(digits, escapeDigits=ALL_SPECIAL_DIGITS) \r\n\t\tmsg=\"SAY DIGITS #{digits} #{escape_digit_string(escapeDigits)}\"\r\n\t\tsend(msg)\r\n\t\treturn get_int_result()\r\n\tend", "def format_abnf_char(c)\n if /[\\x20-\\x21\\x23-\\x7E]/.match?(c)\n @options[:html] ? %(\"<code class=\"grammar-literal\">#{@coder.encode c}</code>\") : c.inspect\n else\n escape_abnf_hex(c)\n end\n end", "def next_char c, number\n new_ord = c.ord + filter_by_95(number)\n if new_ord > 126\n new_ord -= (126 - 31)\n end\n return new_ord.chr\nend", "def add_zero_to_1_to_9(str)\n str.sub(/(?<=\\D)\\d\\D?$/, '0\\0' )\n end", "def insert_commas(positive_int)\n\n string = positive_int.to_s.reverse\n int_array = []\n\n until string.length <= 0 do int_array << string.slice!(0,3) end\n\n int_array.join(\",\").reverse\n\nend", "def hex_for_non_alphanumeric_code(input)\n if input < LOW_HEX_CODE_LIMIT\n HEX_CODES[input]\n else\n input.to_s(HEX_BASE)\n end\n end", "def prev_char c, number\n new_ord = c.ord - filter_by_95(number)\n if new_ord < 32\n new_ord += (126 - 31)\n end\n return new_ord.chr\nend", "def decode(hex_num)\n if hex_num.hex > 32639\n puts \"Your hex string must be less than '7f7f'\"\n else\n convertHex(hex_num)\n end\n puts \"========================================\"\n puts \"Your decoded integer is #{@final_decimal}\"\n puts \"========================================\"\n puts \"\"\nend", "def shell_escape\n inspect.gsub(/\\\\(\\d{3})/) { $1.to_i(8).chr }\n end", "def decToHex(decNum)\n #Between 0 and 9\n if decNum >= 0 and decNum <= 9\n return decNum.to_s\n else\n case decNum \n when 10\n return 'A' \n when 11\n return 'B' \n when 12\n return 'C' \n when 13\n return 'D' \n when 14\n return 'E' \n when 15\n return 'F'\n end\n end \nend", "def format_ebnf_char(c)\n case c.ord\n when (0x21) then (@options[:html] ? %(\"<code class=\"grammar-literal\">#{@coder.encode c}</code>\") : %{\"#{c}\"})\n when 0x22 then (@options[:html] ? %('<code class=\"grammar-literal\">&quot;</code>') : %{'\"'})\n when (0x23..0x7e) then (@options[:html] ? %(\"<code class=\"grammar-literal\">#{@coder.encode c}</code>\") : %{\"#{c}\"})\n when (0x80..0xFFFD) then (@options[:html] ? %(\"<code class=\"grammar-literal\">#{@coder.encode c}</code>\") : %{\"#{c}\"})\n else escape_ebnf_hex(c)\n end\n end", "def number_or_string(input) #helper for pick_a_story\n new_input = input.gsub(/[^\\d]/, \"\")\n if new_input.empty?\n input\n else #return a valid number\n new_input.to_i.between?(1,146) ? new_input.to_i : 555\n end\n end", "def zero_insert(n)\n result = ''\n index, n = 0, n.to_s\n while index < n.length - 1\n a, b = n[index].to_i, n[index + 1].to_i\n result += a.to_s\n result += '0' if a == b || (a + b) % 10 == 0\n index += 1\n end\n result += n[index]\n result\nend", "def insert_commas(positive_int)\n\n string = positive_int.to_s\n i = 0\n\n until i > string.length / 4\n if i > 0\n string = string.insert( i * -4,\",\")\n end\n i += 1\n end\n\n return string\nend", "def number_encoding(str)\n result = ''\n str.downcase.each_char do |char|\n if char =~ /[a-z]/\n result << (char.ord - 96).to_s\n else\n result << char\n end\n end\n result\nend", "def to_decimal(str)\n str&.hex\n end", "def fancy_number(num)\n \"$\" + num.to_s.reverse.scan(/\\d{3}|.+/).join(\",\").reverse\n end", "def insert_commas(positive_int)\n positive_int.to_s.reverse.chars.each_slice(3).map{|s| s.join}.join(\",\").reverse\nend", "def string\n chars.map {|x| \"%0.2x\" % x }.join(':')\n end", "def clean\n @number.gsub!(/\\D/,\"\")\n\n if has_11_digits? and starts_with_1?\n @number = @number[1..-1] \n elsif invalid_length?\n @number = nil\n end\n end", "def formata_numero number, opts={}\n number = number.to_s\n opts = { loop: 10, insert: :\"0\" }.merge opts\n # remove as virgulas e pontos caso seja um valor de dinheiro\n number.gsub! /[,\\.\\ ]/ , ''\n (opts[:loop] - number.length).times { number = \"#{opts[:insert]}#{number}\" }\n number\n end", "def digits_to_str a, b, c, d\n [a,b,c,d].map{|x|x.to_i & 0xff}.join '.'\nend", "def fmtstr_advance_count(prec)\n\t\t\n\t\t# no need to advance :)\n\t\treturn \"\" if prec == 0\n\t\t\n\t\t# asumming %x max normal length is 8...\n\t\tif prec >= 8\n\t\t\treturn \"%0\" + prec.to_s + \"x\"\n\t\tend\n\t\t\n\t\t# anything else, we just put some chars in...\n\t\treturn rand_text(prec)\n\tend", "def append_check_digit(input)\n input + check_digit(input).to_s\n end", "def solution(value)\n answer = \"\"\n number_string = value.to_s\n ( 5 - number_string.length).times do\n answer += \"0\"\n end\n answer = answer + number_string\n \"Value is #{answer}\"\nend", "def add_commas(number)\n original = number.to_s\n length = original.length\n result = \"\"\n index = 0\n\n while index < length\n result = \",\" + result if index % 3 == 0 && index != 0\n index += 1\n result = original[ length - index ] + result\n end\n\n result\nend", "def make(byte, length)\n while byte.length < length\n byte = \"0\" + byte\n end\n return byte\nend", "def DashInsert(num)\n\n num.to_s.gsub(/[13579]{2,}/){|x| x.split('').join(\"-\")}\n \nend", "def reduce_non_digit(_production, _range, _tokens, _children)\n char_shorthand('D')\n end", "def decode_char(input)\n\n input.mark\n first = input.next\n if first.nil?\n input.reset\n return nil\n end\n # check to see if we are dealing with an encoded char\n if first!= \"\\\\\"\n input.reset\n return nil\n end\n second = input.next\n if second.nil?\n input.reset\n return nil\n end\n\n #Check octal codes\n return 0x08.chr if second == \"b\"\n return 0x09.chr if second == \"t\"\n return 0x0a.chr if second == \"n\"\n return 0x0b.chr if second == \"v\"\n return 0x0c.chr if second == \"f\"\n return 0x0d.chr if second == \"r\"\n return 0x22.chr if second == \"\\\"\"\n return 0x27.chr if second == \"\\'\"\n return 0x5c.chr if second == \"\\\\\"\n if second.downcase == \"x\" # Hex encoded value\n temp = ''\n for i in 0..1 do\n c = input.next_hex\n temp << c unless c.nil?\n if c.nil?\n input.reset\n return nil\n end\n end\n i = temp.hex\n begin\n return i.chr(Encoding::UTF_8) if i >= START_CODE_POINT and i <= END_CODE_POINT\n rescue Exception => e\n input.reset\n return nil\n end\n elsif second.downcase == \"u\" # Unicode encoded value\n temp = ''\n for i in 0..3 do\n c = input.next_hex\n temp << c unless c.nil?\n if c.nil?\n input.reset\n return nil\n end\n end\n i = temp.hex\n begin\n return i.chr(Encoding::UTF_8) if i >= START_CODE_POINT and i <= END_CODE_POINT\n rescue Exception => e\n input.reset\n return nil\n end\n elsif input.octal?(second) # Octal encoded value\n temp = second\n c = input.next\n unless input.octal?(c)\n input.push(c)\n else\n temp << c\n c = input.next\n unless input.octal?(c)\n input.push(c)\n else\n temp << c\n end\n end\n # build a number\n i = temp.to_i(8)\n begin\n return i.chr(Encoding::UTF_8) if i >= START_CODE_POINT and i <= END_CODE_POINT\n rescue Exception => e\n input.reset\n return nil\n end\n end\n second\n end", "def to_byte_val(s)\n val = 0\n s.each_char do |x|\n val *= 2\n val += x.to_i\n end\n return val\nend", "def read_number(c)\n b = c.dup\n last = c\n while true\n c = readc\n flonum = \"eEpP\".freeze.include?(last) && \"+-\".freeze.include?(c)\n if !Libc.isdigit(c) && !Libc.isalpha(c) && c != '.' && !flonum\n unreadc(c)\n return @token_gen.make_number(b)\n end\n b << c\n last = c\n end\n raise \"Must not reach here\"\n end", "def unicode_chr(val)\n\t\t[val].inject('') {|s, cp| s << cp }\n\tend", "def double_digit(num)\n if num.to_s.length < 2\n \"0\" + num.to_s\n else\n num.to_s\n end\n end", "def hex(digits)\n string(HEX_DIGITS, digits)\n end", "def number_builder( number_as_string )\n\n number_array = number_as_string.each_char.to_a\n\n pos_flag = true\n\n # handle the sign\n case number_array.first\n when '-'\n pos_flag = false\n number_array.shift\n when '+'\n number_array.shift\n end\n\n total = 0 \n\n number_array.each do |character|\n # don't validate the number \n total = total*10 + character.to_i\n end\n \n ( total = 0 - total ) if not pos_flag\n\n return total\n\nend", "def dig(dig,num)\n\tnum/dig%10\nend", "def entero_pelado(num)\n if num.is_a? String\n num.replace(',', '') if num.include? ','\n num = num.to_f if num.include? '.'\n end\n num.to_i\nend", "def assert_numeric(value, pos)\n if value =~ /^0[xX]/\n lex_error(Issues::INVALID_HEX_NUMBER, {:value => value}, pos) unless value =~ /^0[xX][0-9A-Fa-f]+$/\n\n elsif value =~ /^0[^.]/\n lex_error(Issues::INVALID_OCTAL_NUMBER, {:value => value}, pos) unless value =~ /^0[0-7]+$/\n\n elsif value =~ /^\\d+[eE.]/\n lex_error(Issues::INVALID_DECIMAL_NUMBER, {:value => value}, pos) unless value =~ /^\\d+(?:\\.\\d+)?(?:[eE]-?\\d+)?$/\n\n else\n lex_error(Issues::ILLEGAL_NUMBER, {:value => value}, pos) unless value =~ /^\\d+$/\n end\n end", "def base_encode(digits)\n return digits unless @code\n digits.map do |i|\n case i\n when '-', DOT, DIV\n i\n else\n code[i]\n end\n end\n end", "def to_char(c)\n x = c / 100\n y = c % 100\n c = valid?(x, y) ? (0xA0 + x) * 0x100 + (0xA0 + y) : nil\n c.chr(@encoding).encode(Encoding::UTF_8) rescue (return nil)\n end", "def char_valid?(ord)\n ord .between?(48, 57)\n end", "def dhcp_option_value_byte(data, value)\r\n data << 0x01.chr\r\n data << value.chr\r\n end", "def separate_comma(number)\n case number.to_s.length\n when 0..3\n puts number.to_s\n when 4..6\n puts number.to_s.insert(-4,\",\")\n when 7..9\n puts number.to_s.insert(-4,\",\").insert(-8,\",\")\n when 10..12\n puts number.to_s.insert(-4,\",\").insert(-8,\",\").insert(-12,\",\")\n end\nend", "def numeric_literal\n hex_integer_literal || octal_integer_literal || decimal_literal\n end", "def separate_comma(input)\n num = input.to_s\n if num.length > 3 && num.length <= 6\n num.insert(-4, \",\")\n elsif num.length > 6 && num.length < 10\n num.insert(-4, \",\")\n num.insert(-8, \",\")\n end\n num\nend", "def set_last_digits\n if number\n number.to_s.gsub!(/\\s/,'')\n self.digits ||= number.to_s.length <= 4 ? number : number.to_s.slice(-4..-1)\n end\n end", "def validateBE(vat_number)\r\n # Nine digit numbers have a 0 inserted at the front\r\n vat_number = (\"0\" + vat_number.to_s) if vat_number.to_S.length == 9\r\n # Check digits\r\n return true if (97 - vat_number[0..8].to_i) % 97 == vat_number[8..10].to_i\r\n return false\r\n end", "def get_hex(x)\n val = x.to_i.to_s(16)\n val = \"0#{val}\" if val.length < 2\n val\n end", "def non_utf8_character\n [0x92].pack('C*')\n end", "def make_hex_like(regval, size_in_nibbles)\n outstr = ''\n regex = '^(.?.?.?.)'\n (size_in_nibbles - 1).times { regex += '(....)' }\n regex += '$'\n Regexp.new(regex) =~ regval\n\n nibbles = []\n size_in_nibbles.times do |n| # now grouped by nibble\n nibbles << Regexp.last_match[n + 1]\n end\n\n nibbles.each_with_index do |nibble, i|\n # If contains any special chars...\n if nibble =~ /[#{UNKNOWN_CHAR}#{DONT_CARE_CHAR}#{STORE_CHAR}#{OVERLAY_CHAR}]/\n # If all the same...\n if nibble[0] == nibble[1] && nibble[1] == nibble[2] && nibble[2] == nibble[3]\n outstr += nibble[0, 1] # .to_s\n # Otherwise present this nibble in 'binary' format\n else\n outstr += \"[#{nibble.downcase}]\"\n end\n # Otherwise if all 1s and 0s...\n else\n outstr += '%1X' % nibble.to_i(2)\n end\n end\n outstr\n end", "def decimal!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 5)\n\n type = DECIMAL\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 25:5: ( '-' )? '1' .. '9' ( '0' .. '9' )*\n # at line 25:5: ( '-' )?\n alt_9 = 2\n look_9_0 = @input.peek(1)\n\n if (look_9_0 == ?-) \n alt_9 = 1\n end\n case alt_9\n when 1\n # at line 25:5: '-'\n match(?-)\n\n end\n match_range(?1, ?9)\n # at line 25:20: ( '0' .. '9' )*\n loop do #loop 10\n alt_10 = 2\n look_10_0 = @input.peek(1)\n\n if (look_10_0.between?(?0, ?9)) \n alt_10 = 1\n\n end\n case alt_10\n when 1\n # at line 25:21: '0' .. '9'\n match_range(?0, ?9)\n\n else\n break #loop 10\n end\n end\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 5)\n\n end", "def three_digit_format(n)\r\n # your code here\r\n n.to_s.rjust(3, \"0\")\r\nend", "def dhcp_option_value_str(data, value)\r\n data << value.length.chr\r\n data << value\r\n end", "def seperator(num)\n num_string = num.to_s\n num_integer_count = num.to_s.length\n num_counter = num_integer_count\n loop do \n num_counter -= 3\n if num_counter <= 0 \n break \n else \n num_string.insert(num_counter, ',')\n end\n\n end\n num_string\nend", "def pad(val, number_of_places)\n str = val.to_s\n while(str.length < number_of_places) do\n str = '0' + str\n end\n str\n end", "def reduce_digit(_production, _range, _tokens, _children)\n char_shorthand('d')\n end" ]
[ "0.5902599", "0.5863495", "0.5655377", "0.56372917", "0.56148946", "0.5612942", "0.56124073", "0.5566831", "0.5557327", "0.55543005", "0.5542366", "0.5522904", "0.55095077", "0.5495558", "0.5483823", "0.5466012", "0.5429842", "0.54259497", "0.54177266", "0.53689665", "0.5331856", "0.5331856", "0.5320974", "0.53138494", "0.5312611", "0.5306892", "0.53018385", "0.52979255", "0.5277094", "0.5252647", "0.52504927", "0.52440864", "0.52413464", "0.5235331", "0.52336377", "0.5231916", "0.52080494", "0.5207034", "0.52057636", "0.5200973", "0.5170758", "0.5126831", "0.5124907", "0.51205873", "0.51197773", "0.51065665", "0.50989753", "0.5097088", "0.5096395", "0.5088642", "0.5077542", "0.50775194", "0.5069734", "0.50678885", "0.5066357", "0.5063908", "0.5061943", "0.5048202", "0.504701", "0.50427216", "0.5042524", "0.5041474", "0.50402707", "0.5035394", "0.5034999", "0.5030368", "0.5030313", "0.50286776", "0.50235116", "0.5018717", "0.50180864", "0.5016735", "0.5015114", "0.50150067", "0.50139767", "0.50138974", "0.50120884", "0.50056136", "0.5002892", "0.5002426", "0.4996809", "0.49918127", "0.49875742", "0.49864426", "0.4984708", "0.49741194", "0.49450046", "0.49432388", "0.49431762", "0.49367675", "0.49322155", "0.4927483", "0.49267197", "0.4922651", "0.492139", "0.49134573", "0.4912133", "0.49105045", "0.49066263", "0.49031663", "0.48973235" ]
0.0
-1
returning nil means read next char returning a String means you're done and want the result inserted. returning anything else means you're giving up.
def literal_handle(_buffer, string) case string when /^\d{,3}$/ return if string.size < 3 [string.to_i].pack('U') when /^o([0-7]{,3})$/i return if Regexp.last_match(1).size < 3 [Integer("0#{Regexp.last_match(1)}")].pack('U') when /^x(\h{,2})$/i return if Regexp.last_match(1).size < 2 [Integer("0x#{Regexp.last_match(1)}")].pack('U') when /^u(\h{,4})$/ return if Regexp.last_match(1).size < 4 [Integer("0x#{Regexp.last_match(1)}")].pack('U') when /^U(\h{,8})$/ return if Regexp.last_match(1).size < 8 [Integer("0x#{Regexp.last_match(1)}")].pack('U') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readchar() end", "def readchar() end", "def readchar() end", "def next()\n return \" \" unless has_next()\n if(@count <= 0)\n @char = @compressed_string[@i]\n @i += 1\n @count = get_count()\n end\n @count -= 1\n return @char\n end", "def stringNextChar\r\n\t\t@Line.slice!(0, 1)\r\n\t\tcheckLine\r\n\tend", "def read characters\n forward characters\n end", "def nextchar\n c = self.more?() ? @source[@index,1] : \"\\0\"\n @index += 1\n return(c)\n end", "def readchar\n end", "def read_character\n unless @input.empty?\n result(@input.at(0), advance(1))\n else\n failure(\"less than one character available\")\n end\n end", "def next\n ret = peek_next\n @str.slice! @last_re if ret.type != :eos\n\n ret\n end", "def readChar\n\tinput = STDIN.read_nonblock(1) rescue nil\n\tif input == \"\\e\" then\n\t\tinput << STDIN.read_nonblock(1) rescue nil\n\t\tinput << STDIN.read_nonblock(1) rescue nil\n\tend\n\t\n\treturn input\nend", "def parse(char = \" \")\n consumed = \"\"\n while c = consume\n break if c == char || c == \"\\n\"\n consumed += c\n end\n return consumed\nend", "def read_string; end", "def next_char\n @current_char_pos += 1\n @current_char = @string[@current_char_pos, 1]\n end", "def get()\n i = @source_io.getc\n return EOF if(!i)\n c = i.chr\n return c if (i >= SPACE || i == ?\\n || c.unpack(\"c\") == EOF)\n return \"\\n\" if (i == ?\\r)\n return \" \"\n end", "def read\n buf = \"\"\n term = [\"\\r\\n\"]\n\n while true do\n char = @sp.getc\n \n # die if we couldn't read\n # (nil signifies an error)\n raise StandardError if char.nil?\n \n # convert the character to ascii,\n # and append it to the tmp buffer\n buf << sprintf(\"%c\", char)\n\n # if a terminator was just received,\n # then return the current buffer\n term.each do |t|\n len = t.length\n if buf[-len, len] == t\n return buf.strip\n end\n end\n end\n end", "def next()\n if has_next()\n @strings[0][1]-=1\n c = @strings[0][0]\n while has_next() and @strings[0][1] == 0\n @strings.shift\n end\n return c\n end\n return \" \"\n end", "def next_char(char)\n #if the char is capitalized we have to ask for uppercased vowels\n vowels = is_upcase?(char) ? \"AEIOU\" : \"aeiou\"\n if char == \" \"\n char\n elsif vowels.include?(char)\n get_next_vowel(char,vowels)\n else\n get_next_consonant(char,vowels)\n end\nend", "def read_character\n lit = read_literal\n\n return \" \" if lit.empty? && peek_char == \" \"\n CHARACTERS.fetch(lit.downcase) do\n # Return just the first character\n unread(lit[1..-1])\n lit[0,1]\n end\n end", "def read_char\n STDIN.raw!\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n return input\nend", "def readchar\n getc || raise(EOFError)\n end", "def next()\n @index += 1\n @string[@index...(@index+1)]\n end", "def next_is(expected_char)\n next_char = input.peek(1)\n if next_char == expected_char\n append input.getch\n end\n end", "def next_char\n @pos += 1\n if (c = @source[@pos..@pos]) == BACKSLASH\n @pos += 1\n [true, @source[@pos..@pos]]\n else\n [false, c]\n end\n end", "def pirates_say_arrrrrrrrr(string)\n to_return = \"\"\n add_next = false\n string.size.times do |index|\n current_char = string[index, 1] # kindly enough, Josh Cheek put in a comment\n# explainging the above line, that the second param tells Ruby to get a string of\n# length 1, which is only necessary on version 1.8 and if you're on 1.9 and above\n# that you should just go with string[index]. This makes me wonder about the \n# value this tutorial offers, just saying.\n to_return << current_char if add_next\n add_next = (current_char == \"r\" || current_char == \"R\")\n end\n to_return\nend", "def consume(str, char)\n raise AssertionError.new(\"Expected '#{char}'\") unless str[0] == char\n return str[1..-1].strip\n end", "def consume_character\n unless @input.empty?\n success(advance(1))\n else\n failure(\"less than one character available\")\n end\n end", "def consume_string(ending = T.unsafe(nil)); end", "def NextChar\r\n\t\t@Line.slice!(0, 1)\r\n\tend", "def read_string\n val = ''\n while (res = read)\n break if res == 10\n\n val << res\n end\n val\n end", "def gets\n str = \"\"\n str << (r = self.read(1)) until r == \"\\n\"\n str\n end", "def read_string\n\t\t\n\t\t# TODO: Add the ability to have escape characters.\n\t\tstart_char \t= @chars.next # Don't add quotation marks to the string value\n\t\tline_num \t= @chars.get_cur_line\n\t\tcol_num \t= @chars.get_cur_col\n\t\ttok_val \t= ''\n\n\t\twhile true\n\t\t\tbegin\n\t\t\t\tchar = @chars.peak\n\t\t\trescue EOFError\n\t\t\t\traise \"LEXER ERROR: At line: #{line_num}, col: #{col_num} >> String does not end.\"\n\t\t \t\treturn nil\n\t\t \tend\n\n\t\t \tif char == start_char\n\t\t \t\treturn Token.new(\"String\", tok_val, line_num, col_num)\n\t\t \tend\n\t\t \ttok_val += char\n\t\t \t@chars.next\n\t\tend\n\tend", "def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end", "def readString(endMarker, hadError) # returns...string!\n if (endMarker != nil) \n endMarker[0] = !isConnected()\n end\n if (hadError != nil) \n hadError[0] = !isConnected()\n end\n if (!isConnected())\n return nil\n end\n buffer = String.new\n gotCR = false\n while true\n begin\n byte = @socket.readbyte # read one byte\n rescue EOFError => emsg\n if (hadError != nil) \n hadError[0] = true\n end\n if @loglevel ==2\n puts \"EOFError\"\n end\n return nil\n end \n if (byte == END_MARKER)\n if (endMarker != nil) \n endMarker[0] = true\n end\n break\n end\n if (gotCR && byte == 10) # CR-LF\n break\n end\n if (byte == 13) \n gotCR = true\n else \n if (gotCR) \n buffer << 13 # we got a CR without a LF, so keep it in.\n gotCR = false\n end\n buffer << byte\n end\n end\n \n retVal = buffer\n return retVal\n end", "def read_char\n raw_tty! do\n input = $stdin.getc.chr\n return input unless input == \"\\e\"\n\n input << begin\n $stdin.read_nonblock(3)\n rescue\n ''\n end\n input << begin\n $stdin.read_nonblock(2)\n rescue\n ''\n end\n input\n end\n rescue IOError\n \"\\e\"\n end", "def get_string\n\n zero_byte = @buffer.index(\"\\0\",@position)\n\n if zero_byte == nil\n string = ''\n else\n string = get(zero_byte-@position)\n @position+=1\n end\n\n string\n\n\t\t\n\n end", "def read_char\n\tSTDIN.echo = false\n\tSTDIN.raw!\n\tinput = STDIN.getc.chr\n\tif input == \"\\e\" then\n \tinput << STDIN.read_nonblock(3) rescue nil\n \tinput << STDIN.read_nonblock(2) rescue nil\n \tend\nensure\n \tSTDIN.echo = true\n \tSTDIN.cooked!\n \treturn input\nend", "def getChar\n $look = ARGF.readchar\nend", "def read_char\n\tSTDIN.echo = false\n\tSTDIN.raw!\n\tinput = STDIN.getc.chr\n\tif input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n return input\nend", "def must_see(char)\n spaces\n if next_is char\n # All good, input as expected.\n char\n elsif input.eos?\n # Finally, the case we've been waiting for:\n # Input exhausted, but still elements to close.\n append char\n else\n append char\n # The magic trick:\n # We implicitly use the stack to count how many closing tags we have/need.\n # We pair with exception's `ensure` mechanism to actually write them out.\n if debug\n msg = \"Seen so far: %s\" % result.clone\n raise UnexpectedTokenError, msg\n else\n raise UnexpectedTokenError\n end\n end\n end", "def read_char\n STDIN.echo = false\n STDIN.raw!\n \n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n \n return input\nend", "def read_char\n STDIN.echo = false\n STDIN.raw!\n \n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n \n return input\nend", "def read_char\n STDIN.echo = false\n STDIN.raw!\n \n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n \n return input\nend", "def peek()\n lookaheadChar = @source_io.getc\n @source_io.ungetc(lookaheadChar)\n return lookaheadChar.chr\n end", "def read_next()\n return nil if @at_end\n\n begin\n pos = @marker.position\n\n if @marker.character == ?\\n\n pos.line += 1\n pos.column = 0\n end\n\n @marker.character = @reader.next\n @marker.source_index += 1\n pos.column += 1\n rescue StopIteration\n @at_end = true\n @marker.character = nil\n end\n\n @marker.character\n end", "def pirates_say_arrrrrrrrr(string)\n to_return = \"\"\n add_next = false\n string.size.times do |index|\n current_char = string[index,1] # the second param here tells it to get a str of length 1. This is only necessary on 1.8. If you are on 1.9, just go with string[index]\n to_return << current_char if add_next\n add_next = (current_char == \"r\" || current_char == \"R\")\n end\n to_return\nend", "def get_next_char(file)\n orig = file.tell\n while true\n next_char = file.read(1)\n #End of file\n if (not next_char) \n break\n #Not whitespace, so this is the next valid character\n elsif (not (next_char =~ /[\\r|\\t|\\n|\\f| ]/)) \n break\n end\n end\n #Set file back to original position\n file.seek(orig, IO::SEEK_SET)\n return next_char\n end", "def read_char\nSTDIN.echo = false\nSTDIN.raw!\ninput = STDIN.getc.chr\nif input == \"\\e\" then\ninput << STDIN.read_nonblock(3) rescue nil\ninput << STDIN.read_nonblock(2) rescue nil\nend\nensure\nSTDIN.echo = true\nSTDIN.cooked!\nreturn input\nend", "def pirates_say_arrrrrrrrr(string)\nto_return = \"\"\nr_last = false\n\nstring.downcase.each_char do |c|\n\tto_return << c if r_last\n\tr_last = (c == \"r\")\n\tend\n\nto_return\nend", "def next_char\n temp = @file.eof? ? '^' : @file.getc\n @line += temp;\n @columnCount+=1\n return temp\n end", "def peek_read\n @read.join('')\n end", "def next_char\n self.cursor += 1\n end", "def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n exit(1) if input == \"\\u0003\"\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.cooked!\n STDIN.echo = true\n \n\n return input\nend", "def receive()\r\n complete = \"\"\r\n while (t = read) != 0.chr\r\n if t == @char_lead_byte then\r\n t = read\r\n end\r\n complete << t\r\n end\r\n return complete\r\n end", "def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end", "def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end", "def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end", "def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end", "def nextCh()\r\n\t\tif (! @f.eof?)\r\n\t\t\t@c = @f.getc()\r\n\t\telse\r\n\t\t\t@c = \"!eof!\"\r\n\t\tend\r\n\t\t\r\n\t\treturn @c\r\n\tend", "def read_chr\n @file.getc unless @file.eof?\n end", "def getc\n # Read c\n c = @input.getc\n\n # Maintain counters\n if c == \"\\n\"\n @line += 1\n @pos = 1\n else\n @pos += 1\n end\n\n # Return char\n return c\n end", "def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\nend", "def pirates_say_arrrrrrrrr(string)\n\nreturn_string = \"\" # !> assigned but unused variable - return_string\n\nr_character = false\n\nstring.chars.each do |char| \n\nreturn_string << char if r_character == true\n\nr_character = (char.upcase == \"R\")\n\nend\n\nreturn_string\n\nend", "def getChar\n if @index <= @code.size - 1\n return @code[@index] if !@code[@index].nil?\n end\n # If nil return empty string.\n return nil\n end", "def readline\n str = \"\"\n while ($_ = self.read(1)) != \"\\n\"\n str << $_\n end\n str << \"\\n\"\n end", "def pirates_say_arrrrrrrrr(string)\n\tnewString = \"\"\n\tindex = 0\n\tadd_next = false\n\tstring = string.split(\"\").each do |letter|\n\t\tif letter == \"r\" || letter ==\"R\"\n\t\t\t#puts string[index], index\n\t\t\tif index + 1 < string.size\n\t\t\t#if index < string.size\n\t\t\t\tadd_next= index + 1\n\t\t\t\tnewString << string[add_next]\n\t\t\tend\n\t\t\n\t\tend\n\n\t\t\n\n\t\t\n\t\t\n\n\t\t\t#puts add_next\n\t\t\t#puts letter, index\n\t\t\n\t\t\t#string.index(letter)\n\t\t\n\n\n\t\t# if letter == \"r\" || letter == \"R\"\n\t\t# \tstring.index(letter)\n\t\t# \t#puts index\n\t\t\t\n\t\t\t\n\n\n\t\t\t\n\t\t\n\t\t#print string.index(letter),letter\n\n\t\t# if letter == \"r\" || \"R\"\n\t\t# \tputs string.index(letter)\n\n\t\t# #print letter, string.index(letter)\n\t\t# end\n\n\n\n\t\t#newString << current_char if add_next\n\t\t#\tadd_next = (current_char == \"r\" || current_char==\"R\")\n\t\t\n\t\t\n\t\t#puts letter\n\t\tindex += 1\n\tend\n\treturn newString\n\nend", "def next_string(c)\n q = c\n @pos += 1\n t = ''\n while @pos < @length\n c = @sql[@pos, 1]\n case c\n when q\n if @pos + 1 < @length && @sql[@pos + 1, 1] == q # double quote\n t += q\n @pos += 1\n else\n @pos += 1\n return t\n end\n when '\\\\'\n @pos += 1\n return t if @pos >= @length\n t << @sql[@pos, 1]\n else\n t << c\n end\n @pos += 1\n end\n raise \"unterminated string in SQL: #{@sql}\"\n end", "def pirates_say_arrrrrrrrr(string)\n new_string = \"\"\n add_next = false\n string.size.times do |index|\n current_char = string[index]\n new_string << current_char if add_next #if add next has been set true in previous loop, it will add the current character\n add_next = (current_char == \"r\" || current_char == \"R\") #will set the value of add_next var to true or false\n end\n new_string\nend", "def nextChar\n if getChar == \"\\n\"\n @line += 1\n @column = @lastLineSize\n end\n @index += 1\n @column += 1\n end", "def progress_input(ch)\n #puts \"At position #{@pos}\"\n success = @dfa[@state].success\n if !success.empty?\n @last_success = success\n @last_str = @str\n @last_pos = @pos\n end\n next_state = @dfa[@state].lookup[ch]\n if next_state.nil?\n if @last_success.nil?\n if @str.empty? && @pos == @size && @state == @start_state\n throw :done\n else\n #puts \"#{@str} #{@pos} #{@size} #{@state.inspect} #{@start_state.inspect}\"\n raise LexError.new(@pos, @size)\n end\n else\n @pos = @last_pos\n return success(@last_success, @last_str, @last_pos)\n end\n else\n @state = next_state\n @str += ch\n @pos += 1\n return nil\n end\n end", "def nextstring(quot)\n\t\t\tc = buf = \"\"\n\t\t\twhile true\n\t\t\t\tc = self.nextchar()\n\t\t\t\tcase c\n\t\t\t\twhen /\\0|\\n\\r/\n\t\t\t\t\traise \"Unterminated string\"\n\t\t\t\twhen \"\\\\\"\n\t\t\t\t\tchr = self.nextchar()\n\t\t\t\t\tcase chr\n\t\t\t\t\twhen 'b'\n\t\t\t\t\t\tbuf << \"\\b\"\n\t\t\t\t\twhen 't'\n\t\t\t\t\t\tbuf << \"\\t\"\n\t\t\t\t\twhen 'n'\n\t\t\t\t\t\tbuf << \"\\n\"\n\t\t\t\t\twhen 'f'\n\t\t\t\t\t\tbuf << \"\\f\"\n\t\t\t\t\twhen 'r'\n\t\t\t\t\t\tbuf << \"\\r\"\n\t\t\t\t\twhen 'u'\n\t\t\t\t\t\tbuf << utf8str(Integer(\"0x\" + self.nextchars(4)))\n\t\t\t\t\telse\n\t\t\t\t\t\tbuf << chr\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\treturn(buf) if (c == quot)\n\t\t\t\t\tbuf << c\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def pirates(string)\nto_return = ''\n#you are setting a variable into an empty string\n\nstring.length.times do |index|\n# you are calculating the length of the string and the times it has to\n#go through every character of that string\n current_char = string[index]\n #setting a variable to the string index\n next_char = string[index + 1] || ''\n #setting another variable to string index + 1 which is the letter after\n #the called index. We also have a or empty string after that line.\n #you need the or empty space if not the last r, will try print osmething\n #and that ain't happening cause it doesn't exist\n\n to_return << next_char if (current_char == \"r\" || current_char == \"R\")\n #your reversed if statement where if there is an r or R, the next character\n #is printed and all of them is put into the return\nend\nputs to_return\n#printing the result\nend", "def ungetc(string)\n #This is a stub, used for indexing\n end", "def read_char\n STDIN.echo = false\n STDIN.raw!\n\n input = STDIN.getc.chr\n if input == \"\\e\"\n begin\n input << STDIN.read_nonblock(3)\n rescue StandardError\n nil\n end\n begin\n input << STDIN.read_nonblock(2)\n rescue StandardError\n nil\n end\n end\n ensure\n STDIN.echo = true\n STDIN.cooked!\n\n return input\n end", "def pirates_say_arrrrrrrrr(string)\n new_string = \"\"\n add_next = false\n string.size.times do |index|\n char = string[index]\n new_string << char if add_next\n add_next = (char == \"r\" || char == \"R\")\n end\n new_string\n\n\nend", "def get(str)\n puts \"getting \" + str\n char = str[0] || TERM_CHAR\n next_node = find_child(char)\n return nil if next_node.nil?\n if str == ''\n next_node\n else\n next_node.get(str[1..-1])\n end\n end", "def advance \n \n @pos += 1\n if @pos > @text.length - 1\n @currentChar = nil\n else \n @currentChar = @text[@pos]\n end\n \n end", "def read_ascii(cursor, size)\n lst_strings = @data[cursor..cursor+size-1].gsub(TRAILING_00_REGEXP, '').strip.split(NULL_TERMINATING_CHAR)\n return (lst_strings.size == 1) ? lst_strings[0] : lst_strings\n end", "def rl_get_char()\r\n if (@push_index == @pop_index)\r\n return nil\r\n end\r\n key = @ibuffer[@pop_index]\r\n @pop_index += 1\r\n\r\n if (@pop_index >= @ibuffer_len)\r\n @pop_index = 0\r\n end\r\n\r\n return key\r\n end", "def pirates_say_arrrrrrrrr(string)\n\n# Defines a method that takes one argument, a \"string\".\n\n to_return = \"\"\n\n# Creates a new variable and assigns it an empty string.\n\n add_next = false\n\n# Creates a new variable with a boolean value, which is initially set to 'false' as we will never add the first character (in this case 'R') to the output because the first character of any string never follows an 'r' or anything else!\n\n string.size.times do |index|\n\n# This calculates the string size and uses the returned value to loop the block of code that many times.\n\n# E.g. for \"Rare\" the string size is \"4\" so it will loop 4 times, i.e. over each character in the string.\n\n current_char = string[index]\n\n# Creates a new variable which is initially set to the value of the current character.\n\n# First iteration:\n# => current_char = \"R\"\n\n# Second iteration:\n# => current_char = \"a\"\n\n# etc\n\n to_return << current_char if add_next\n# Updates to_return with the current_char only if add_next evaluates to true.\n\n# First iteration:\n# => to_return << \"R\" if false\n# => do nothing because add_next is false;\n# => to_return is still \"\"\n\n# Second iteration:\n# => to_return << \"a\" if true\n# => add \"a\" to to_return because add_next is true\n\n# etc\n\n add_next = (current_char == \"r\" || current_char == \"R\")\n# Updates add_next to true or false.\n# add_next will update to true if the current character is either \"r\" or \"R\", otherwise it will remain false.\n\n# First iteration:\n# => add_next = (\"R\" == \"r\" || \"R\" == \"R\")\n# => add_next = (false || true)\n# => add_next = true\n\n# Second iteration:\n# => add_next = (\"a\" == \"r\" || \"a\" == \"R\")\n# => add_next = (false || false)\n# => add_next = false\n\n# etc\n\n end\n\n to_return\n\n# Returns the final value of the to_return variable.\n\nend", "def nextChar(n, char)\n\tif n > 0\n\t\treturn nextChar(n-1, char.next)\n\telse\n\t\treturn char\n\tend\nend", "def getChar(c)\n c.chr\nend", "def getChar(c)\n c.chr\nend", "def peekChar\r\n\t\tcheckLine\r\n\t\tcheckSpace\r\n\t\treturn @Line[0]\r\n\tend", "def pirates_say_arrrrrrrrr(string) \n to_return = \"\" # return a string\n add_next = false \n string.size.times do |index| #iterate upwards adding to the index for each look\n current_char = string[index,1] # the present character is index 1 ont he string\n to_return << current_char if add_next #move to the next character\n add_next = (current_char == \"r\" || current_char == \"R\") # only add if the current character is an upper or lower case \n end\n to_return\nend", "def next_words_on_error\n if n = @src.rest.index(\"\\n\")\n @src.rest[0 .. (n-1)]\n else\n @src.rest\n end\nend", "def pirates_say_arrrrrrrrr(string)\n to_return = \"\"\n next_letter = false\n string.size.times do |letter|\n current_letter = string[letter]\n to_return << current_letter if next_letter\n next_letter = (current_letter == \"r\" or current_letter == \"R\")\n end\n to_return\n \nend", "def forward characters\n @char += characters\n char || false\n end", "def pirates_say_arrrrrrrrr(string)\n\n #This is the string that will be returned at the end, we will be pushing letters to it.\n to_return = \"\"\n\n #We need to create a variable that will change to true or false after each iteration depending on the letter of the current iteration. We will set this to false initially because the first character doesn't have one preceeding it.\n add_next = false\n\n\n #Now we need to iterate through the string, each time adding the current character to the return string if add_next is true.\n string.length.times { |x|\n to_return << string[x] if add_next\n #Here we change the value of add_next to either true or false depending on whether the current character is an r or R.\n add_next = (string[x] == \"r\" || string [x] == \"R\")\n }\n\n to_return\n\nend", "def eat_until(char)\n length = 0\n\n loop do\n c = @stream.getc\n\n return nil if c.nil?\n\n if c == '\\\\'\n @stream.getc\n length += 1\n next\n end\n\n length += 1\n\n break if c == char\n end\n return length\n end", "def next_match char\n data = get_content\n row = focussed_index + 1\n row.upto(data.length-1) do |ix|\n val = data[ix].chomp rescue return # 2010-01-05 15:28 crashed on trueclass\n #if val[0,1] == char #and val != currval\n if val[0,1].casecmp(char) == 0 #AND VAL != CURRval\n return ix\n end\n end\n row = focussed_index - 1\n 0.upto(row) do |ix|\n val = data[ix].chomp\n #if val[0,1] == char #and val != currval\n if val[0,1].casecmp(char) == 0 #and val != currval\n return ix\n end\n end\n return -1\n end", "def get_command(_str=\"\")\n @read_pt.next\n rescue StopIteration\n @eoi = true\n \"\\n\"\n end", "def next_char(options = {})\n ix = column\n ix = skip_space(ix, :right) if options[:skip_space]\n char_at(ix) || ''\n end", "def get\n @source_index += 1\n\n # Maintain line count.\n prev_char = @source_text[@source_index - 1]\n if @source_index.positive? && prev_char == \"\\n\"\n @line_index += 1\n @col_index = -1\n end\n\n @col_index += 1\n char = if @source_index > @last_index\n # Read past the end of source text.\n END_MARK\n else\n @source_text[@source_index]\n end\n Character.new(char, @line_index, @col_index, @source_index, @source_text)\n end", "def read_char\n STDIN.echo = false\n STDIN.raw!\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n input\n ensure\n STDIN.echo = true\n STDIN.cooked!\n end", "def skip\n @str.slice! @last_re if peek_next_type != :eos\n end", "def next_letter(char)\n # checking consonant first since more common\n if next_consonant(char) == nil\n if next_vowel(char) == nil\n # puts \"Character neither consonant nor vowel\"\n return nil\n end\n else\n return next_consonant(char)\n end\n\n return next_vowel(char)\nend", "def get_next\n return if eof?\n\n @buffer << @io.gets if @buffer.empty?\n\n until @io.eof?\n line = @io.gets\n next unless line\n\n if @parser.start_new?(line) || @buffer.empty?\n @buffer << line\n break\n else\n @buffer.last << line\n end\n end\n\n return if @buffer.empty?\n @parser.parse(@buffer.slice!(0)) || self.get_next\n end", "def get_next\n return if eof?\n\n @buffer << gets if @buffer.empty?\n\n until @io.eof? && @io_buf.empty?\n line = gets\n next unless line\n\n if @parser.start_new?(line) || @buffer.empty?\n @buffer << line\n break\n else\n @buffer.last << line\n end\n end\n\n return if @buffer.empty?\n @parser.parse(@buffer.slice!(0)) || self.get_next\n end", "def next_char c, number\n new_ord = c.ord + filter_by_95(number)\n if new_ord > 126\n new_ord -= (126 - 31)\n end\n return new_ord.chr\nend", "def scan_single_char()\n\t\tresult = if metachar?(lexeme)\n\t\t\t# A Meta-character...\n\t\t\tenqueue_token(lexeme.dup)\n\t\telse\n\t\t\tenqueue_token(:T_CHARLIT)\n\t\tend\n\t\t\n\t\treturn result\n\tend" ]
[ "0.69239044", "0.69239044", "0.69239044", "0.6786132", "0.67764235", "0.674922", "0.674434", "0.67269707", "0.6571746", "0.6544318", "0.6481572", "0.6429834", "0.64214915", "0.6400068", "0.63948834", "0.6358198", "0.630603", "0.63028765", "0.6298821", "0.6281659", "0.6229167", "0.6190752", "0.6168399", "0.61612016", "0.6145114", "0.61389965", "0.6138985", "0.6126159", "0.61260897", "0.6116216", "0.61112416", "0.6074712", "0.6056295", "0.6054773", "0.6044513", "0.6020251", "0.6015766", "0.59956753", "0.59938484", "0.5990025", "0.5972322", "0.5972322", "0.5972154", "0.59652305", "0.5961767", "0.5959636", "0.5948448", "0.5941867", "0.5941672", "0.5933952", "0.5932584", "0.5929707", "0.59280866", "0.59156394", "0.5897756", "0.5897756", "0.5897756", "0.5897756", "0.58919996", "0.5890356", "0.5886712", "0.5878018", "0.5876176", "0.5875797", "0.5864647", "0.58641934", "0.5863641", "0.5859362", "0.5854066", "0.58500004", "0.58429503", "0.5841505", "0.5840216", "0.5826555", "0.57997906", "0.57997656", "0.57790166", "0.5775975", "0.577289", "0.5756547", "0.57423407", "0.5730064", "0.5730064", "0.57293606", "0.5715463", "0.5707926", "0.57061195", "0.57046294", "0.57009375", "0.5699934", "0.568883", "0.5687992", "0.5677441", "0.56772065", "0.5671555", "0.5655278", "0.56527925", "0.5643749", "0.56358516", "0.5625851", "0.562058" ]
0.0
-1
CONSTRUCTOR Creates OpenNebula section if not exists
def initialize(nsx_client) super(nsx_client) # Construct base URLs @base_url = NSXConstants::NSXT_DFW_BASE @url_sections = @base_url + \ NSXConstants::NSXT_DFW_SECTIONS @one_section_id = init_section end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def section_new\n @section = Section.new\n @section_count = Section.count + 1\n @section_position = @section_count\n end", "def add_new_section\n @section = Section.new\n end", "def init_section; end", "def create_section(section_name)\n section_spec = %(\n {\n \"display_name\": \"#{section_name}\",\n \"section_type\": \"LAYER3\",\n \"stateful\": true\n }\n )\n section_id = @nsx_client.post(@url_sections, section_spec)\n result = section_by_id(section_id)\n raise 'Section was not created in DFW' unless result\n\n result\n end", "def create_new_section(title, options={})\n send_request('create_new_section', normalize_options(title, options))\n end", "def new\n @section = Section.new\n end", "def new\n @section = Section.new\n end", "def create_sections\n @sections = if @options.configure_sections?\n parse_sections(@options[:configure_sections])\n elsif @options.add_sections?\n default_sections.concat parse_sections(@options[:add_sections])\n else\n default_sections\n end\n nil\n end", "def create_new_section(title, options={})\n send_audit(:kind => :new_section, :text => title, :category => options[:category])\n end", "def add_section(section, selected_page_layout=nil, attrs={})\n # check section.section_piece.is_container?\n obj = nil\n if section.root? \n section_instance = 1\n if selected_page_layout.present?\n raise ArgugemntError, 'only container could has child section' unless selected_page_layout.section.section_piece.is_container \n whole_tree = selected_page_layout.root.self_and_descendants\n section_instance = whole_tree.select{|xnode| xnode.section_id==section.id}.size.succ\n end\n attrs[:title]||=\"#{section.title}#{section_instance}\" \n obj = PageLayout.create do|obj|\n obj.section_id, obj.section_instance=section.id, section_instance\n obj.assign_attributes( attrs )\n obj.root_id = selected_page_layout.root_id if selected_page_layout.present?\n obj.site_id = SpreeTheme.site_class.current.id\n obj.is_full_html = section.section_piece.is_root?\n end\n if selected_page_layout.present?\n obj.move_to_child_of(selected_page_layout)\n else\n obj.update_attribute(\"root_id\",obj.id)\n end\n #copy the default section param value to the layout\n obj.add_param_value(self)\n end\n obj\n end", "def initialize\n @sections = {}\n end", "def create_first\n\n @section = Section.find(params[:id])\n\n @new_subsection = Subsection.new\n @new_subsection.section_id = @section.id \n @new_subsection.name = ''\n @new_subsection.note = ''\n \n @new_subsection.date_code_check = @section.date_code_check\n @new_subsection.dot_rev_check = @section.dot_rev_check\n\n end", "def init_section\n one_section = section_by_name(NSXConstants::ONE_SECTION_NAME)\n one_section ||= create_section(NSXConstants::ONE_SECTION_NAME)\n return one_section['id'] if one_section\n end", "def initialize(parent = nil, level = nil, numbered = true)\n super(parent, :section)\n @template_name = 'section'\n if level.nil?\n if !parent.nil?\n @level = parent.level + 1\n elsif @level.nil?\n @level = 1\n end\n else\n @level = level\n end\n @numbered = numbered && @level > 0 && @level < 4\n @special = parent.is_a?(Section) && parent.special\n @index = 0\n @number = 1\n end", "def new\n @section = Section.new(:page_id => @page.id)\n end", "def sell_shop_section_create (section_name, params={})\r\n url = api_url \"/sell/shop/sections\"\r\n req = request_params(params)\r\n load = MultiJson.dump name: section_name\r\n\r\n feed_or_retry do\r\n RestClient.post url, load, req\r\n end \r\n end", "def section; end", "def unique_section_object(key, container)\n Object.const_set(\"EDSLSpecSection#{key}\", Class.new(EDSL::PageObject::Section)).new(container)\nend", "def add_section(s_ident, off=0, sz=nil, name=nil, \n flgs=Section::DEFAULT_FLAGS, arch_info=nil)\n sz ||= size - off\n s = Bgo::Section.new(s_ident, name, image, image_offset + off, off, sz, \n flgs)\n s.arch_info = arch_info if arch_info\n add_section_object s\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.onenoteSection\"\n end", "def create_default_sections!\n if self.project.present?\n account = self.project.account\n account.quote_default_sections.position_ordered.each do |quote_default_section|\n section = self.quote_sections.new(title: quote_default_section.title, content: quote_default_section.content)\n section.cost_section = quote_default_section.cost_section\n section.save!\n end\n end\n end", "def section\n return @section if @section\n\n @section = parent.add_section @section_title if parent\n end", "def start_section(level, title)\n end", "def add_section title, comment = nil\n if section = @sections[title] then\n section.add_comment comment if comment\n else\n section = Section.new self, title, comment\n @sections[title] = section\n end\n\n section\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.sectionGroup\"\n end", "def create\n @section = Section.new(section_params)\n @section.title = @section.title || \"\"\n\n document = @section.document\n @section.order = 1\n unless document.sections.blank?\n @section.order = document.sections.last.order + 1\n end\n\n @section.visibility = document.visibility\n @section.status = document.status\n\n update_user_attribution @section, true\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.any(:json, :js) { render :show, status: :created, location: @section }\n else\n puts @section.errors.full_messages\n format.html { render :new }\n format.any(:json, :js) { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize(name)\n @name = name\n @sections = {}\n end", "def create_section(name, section_name, slide_index, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = create_section_with_http_info(name, section_name, slide_index, password, folder, storage)\n data\n end", "def section_created_hook(sender,new_section)\n unless root?\n parent.section_created_hook(sender, new_section)\n else\n new_section\n end\n end", "def section=(section)\n section = Section.find_or_create_by(name: section[:name])\n self.section_id = section.id\n end", "def initialize( configFileDNE=Conf.filename_proposal )\n#p :xxx\n raise unless configFileDNE\n @configFileDNE = configFileDNE.dup.strip.gsub('\\\\', '/')\n @instant_save = false\n @section = nil\n \n if File.file?( @configFileDNE )\n dataFromFile = read\n self.replace( dataFromFile ) if dataFromFile\n end\n#exit\n self.section = nil unless self.has_key?(nil) # section \"nil\" always needed\n\n super()\n save() # writeable?\n end", "def add_section(fields={})\n section_data = fields.merge({\n :suite_id => data.id,\n })\n return add_entity(Section, data.project_id, section_data)\n end", "def add_section(name, *fields)\n send(\"#{name}=\", Struct.new(*fields).new)\n end", "def instantiate_section_nodes(mode)\n raise(DescriptorError, \"RepeatingSection#instantiate_section_nodes accepts only two modes: :xml or :model\") unless [:xml, :model].include?(mode)\n debug \"instantiate_section_nodes mode: #{mode}\"\n clear\n# The Array() call below is the source of these warnings:\n# /opt/jruby-1.4.0/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_proxy.rb:217 warning: default 'to_a' will be obsolete\n# This warning will only show up when send(mode) returns an AssociationProxy for a\n# single object (such as from a has_one relation). The warning should be \n# irrelevant for us because Array() tries #to_ary #to_a and then wraps in a []\n# if they fail. The warning is bloody irritating though.\n# (Array(extracted_value || send(mode))).try(:each_with_index) do |node,i|\n# Here's a hamfisted, but hopefully quiet alternative.\n extracted = extracted_value || send(mode)\n extracted = extracted.proxy_target if extracted.respond_to?(:proxy_target)\n Array(extracted).try(:each_with_index) do |node,i|\n node_position = i + 1\n debug(\"instantiate_section_node node ##{node_position} -> #{node.inspect}\")\n section_locator = \"#{locator}[#{node_position}]\"\n section = DSL.create(:repeating_section_instance, nil, section_locator, :logger => logger, :mapping => mapping_class, :matches_by => matches_by, &descriptors)\n section.parent = self # without this, we can't access root options like :validation_type\n section.send(\"#{mode}=\", node)\n section.extracted_value = node unless section.extracted_value\n section.section_key = section.locator unless section.section_key\n store(section.section_key, section)\n end\n end", "def create\n @join_section = JoinSection.new(params[:join_section])\n\n respond_to do |format|\n if @join_section.save\n format.html { redirect_to(@join_section, :notice => 'JoinSection was successfully created.') }\n format.xml { render :xml => @join_section, :status => :created, :location => @join_section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @join_section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(section_params)\n\n if @section.save\n render :show, status: :created, location: @section\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end", "def initialize_section( identifier, project )\n @identifier = identifier\n @project = project\n @customer = project.try( :customer )\n end", "def section(*args, &descriptors)\n _instantiate_and_store(:section, *args, &descriptors)\n end", "def section=(_arg0); end", "def insert\n\n @section = Section.find(params[:id])\n @checklist = Checklist.find(@section.checklist_id)\n \n @new_section = @section.dup\n \n @new_section.name = ''\n @new_section.background_color = ''\n\n end", "def prepare_section(sun_state, irradiance, section)\n end", "def initialize(sections)\n @section = sections\n end", "def create\n @section = Section.new(section_params)\n if @section.save\n render json: SectionSerializer.new(@section)\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end", "def nocreate()\n merge(nocreate: 'true')\n end", "def create\n if !has_right?(:create)\n redirect_to :unauthorized\n return\n end\n @section_preview = SectionPreview.new(params[:section_preview])\n create_new_objects(:property => params[:property],\n \t\t\t\t\t\t\t\t\t :image_storage => params[:image_storage],\n \t\t\t\t\t\t\t\t\t :asset => params[:asset],\n \t\t\t\t\t\t\t\t\t :resource => @section_preview) ### Add to all resources\n end", "def initialize(object, section_options, objects = nil, parent_section_options = nil, object_index: nil)\n use_parent_title = (parent_section_options || {})[:use_parent_title]\n # Pass the parent options down for initialisation if needed\n initialize_section_options(section_options, (use_parent_title ? parent_section_options : {}))\n\n @sectiontitle = object.section_name(section_options, parent_section_options)\n\n if sectiontype == :list\n list_specific_items(object, section_options, object_index: object_index)\n else\n table_specific_items(objects)\n end\n end", "def initialize_new_stone\n create_skeleton\n copy_clean_extent\n rescue Exception\n destroy!\n raise\n end", "def create\n @section = Section.new(params[:section])\n\n Course.find(params[:section][:add_section]).sections << @section if params[:section][:add_section]\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render json: @section, status: :created, location: @section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to(admin_sections_path, :notice => 'Section was successfully created.') }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to(@section, :notice => 'Section was successfully created.') }\n format.xml { render :xml => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def createSection(section)\r\n uri = sprintf(\"/api/v1/courses/%d/sections/\", $tocid) \r\n \r\n dbg(\"POST #{uri}\")\r\n dbg(\"course_section[name]=#{section[\"name\"]}\")\r\n newSection = $canvas.post(uri, {'course_section[name]' => section[\"name\"]})\r\n dbg(newSection)\r\n return newSection\r\nend", "def start_section!(name)\n @io.pos = @index[name]\n self\n end", "def new\n params_hash = {institution_id: params[:institution_id],\n center_id: params[:center_id],\n academic_class_id: params[:academic_class_id]}\n @section = Section.new(params_hash)\n @section.build_profile\n @section.build_build_info\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @section }\n end\n end", "def create_section_response\n response = Hash.new\n response[:is_searchable] = DocumentPlatform.searchable?\n response[:has_description] = DocumentPlatform.has_description?\n response[:has_metadata] = DocumentPlatform.has_metadata?\n response[:supports_permissions] = DocumentPlatform.supports_permissions?\n response[:sections] = []\n return response\n end", "def initialize\n super\n\n @in_files = []\n\n @name ||= \"unknown\"\n @comment ||= \"\"\n @parent = nil\n @visibility = :public\n\n @current_section = Section.new self, nil, nil\n @sections = [@current_section]\n\n initialize_methods_etc\n initialize_classes_and_modules\n end", "def new\n @sections = Section.find(:all) # TODO: refactor so I don't have to repeat this all over the place\n @section = Section.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @section }\n end\n end", "def create\n @sections = Section.find(:all)\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n flash[:notice] = 'Section was successfully created.'\n format.html { redirect_to(@section) }\n format.xml { render :xml => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render json: @section, status: :created, location: @section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def section_properties; end", "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[section]\n end", "def add_section(position = nil, section_type = nil)\n section = self.sections.create(Section::DEFAULT_PARAMS)\n section.move_to_bottom\n end", "def about_section_E\n OpenStruct.new(\n :header => \"About section E\",\n :context => [\n \"The environmental, social, and corporate governance (ESG) section is an opportunity for you to highlight your responsible business conduct and its impact within your organisation, supply chain and the wider community.\",\n \"We expect all King's Award for Enterprise applicants to adhere to commonly accepted standards for environmentally and socially responsible corporate governance. Failure to demonstrate that will result in your application not being successful.\"\n ]\n )\n end", "def initialize(hash_or_file = self.class.source, section = nil)\n case hash_or_file\n when Hash\n self.replace hash_or_file\n else\n hash = YAML.load(ERB.new(File.read(hash_or_file)).result).to_hash\n default_hash = hash[self.class.default_namespace] || {} \n hash = hash[self.class.namespace] if self.class.namespace\n self.replace default_hash.deep_merge(hash)\n end\n @section = section || hash_or_file # so end of error says \"in application.yml\"\n create_accessors!\n end", "def create_section_with_http_info(name, section_name, slide_index, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.create_section ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.create_section\"\n end\n # verify the required parameter 'section_name' is set\n if @api_client.config.client_side_validation && section_name.nil?\n fail ArgumentError, \"Missing the required parameter 'section_name' when calling SlidesApi.create_section\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.create_section\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'sectionName'] = @api_client.prepare_for_query(section_name) unless section_name.nil?\n query_params[:'slideIndex'] = @api_client.prepare_for_query(slide_index) unless slide_index.nil?\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end", "def initialize\n super\n\n @in_files = []\n\n @name ||= \"unknown\"\n @parent = nil\n @visibility = :public\n\n @current_section = Section.new self, nil, nil\n @sections = { nil => @current_section }\n @temporary_section = nil\n\n @classes = {}\n @modules = {}\n\n initialize_methods_etc\n end", "def initialize_container_file\n container_file.create true if container_file && !container_file.exists?\n end", "def create\n @community_section = CommunitySection.new(community_section_params)\n\n respond_to do |format|\n if @community_section.save\n format.html { redirect_to @community_section, notice: 'Community section was successfully created.' }\n format.json { render :show, status: :created, location: @community_section }\n else\n format.html { render :new }\n format.json { render json: @community_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(section_params.merge!({ document: Document.find(params[:document_id]) }))\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def createProgramXMLSection( houseElements )\n loc = \"HouseFile\"\n houseElements[loc].add_element(\"Program\")\n\n loc = \"HouseFile/Program\"\n houseElements[loc].attributes[\"class\"] = \"ca.nrcan.gc.OEE.ERS.ErsProgram\"\n houseElements[loc].add_element(\"Labels\")\n\n loc = \"HouseFile/Program/Labels\"\n houseElements[loc].attributes[\"xmlns:xsi\"] = \"http://www.w3.org/2001/XMLSchema-instance\"\n houseElements[loc].attributes[\"xmlns:xsd\"] = \"http://www.w3.org/2001/XMLSchema\"\n houseElements[loc].add_element(\"English\")\n loc = \"HouseFile/Program/Labels/English\"\n houseElements[loc].add_text(\"EnerGuide Rating System\")\n loc = \"HouseFile/Program/Labels\"\n houseElements[loc].add_element(\"French\")\n loc = \"HouseFile/Program/Labels/French\"\n houseElements[loc].add_text(\"Système de cote ÉnerGuide\")\n\n loc = \"HouseFile/Program\"\n houseElements[loc].add_element(\"Version\")\n loc = \"HouseFile/Program/Version\"\n houseElements[loc].attributes[\"xmlns:xsi\"] = \"http://www.w3.org/2001/XMLSchema-instance\"\n houseElements[loc].attributes[\"xmlns:xsd\"] = \"http://www.w3.org/2001/XMLSchema\"\n houseElements[loc].attributes[\"major\"] = \"15\"\n houseElements[loc].attributes[\"minor\"] = \"1\"\n houseElements[loc].attributes[\"build\"] = \"19\"\n houseElements[loc].add_element(\"Labels\")\n loc = \"HouseFile/Program/Version/Labels\"\n houseElements[loc].add_element(\"English\")\n loc = \"HouseFile/Program/Labels/English\"\n houseElements[loc].add_text(\"v15.1b19\")\n loc = \"HouseFile/Program/Version/Labels\"\n houseElements[loc].add_element(\"French\")\n loc = \"HouseFile/Program/Labels/French\"\n houseElements[loc].add_text(\"v15.1b19\")\n\n loc = \"HouseFile/Program\"\n houseElements[loc].add_element(\"SdkVersion\")\n loc = \"HouseFile/Program/SdkVersion\"\n houseElements[loc].attributes[\"xmlns:xsi\"] = \"http://www.w3.org/2001/XMLSchema-instance\"\n houseElements[loc].attributes[\"xmlns:xsd\"] = \"http://www.w3.org/2001/XMLSchema\"\n houseElements[loc].attributes[\"major\"] = \"1\"\n houseElements[loc].attributes[\"minor\"] = \"11\"\n houseElements[loc].add_element(\"Labels\")\n loc = \"HouseFile/Program/SdkVersion/Labels\"\n houseElements[loc].add_element(\"English\")\n loc = \"HouseFile/Program/Labels/English\"\n houseElements[loc].add_text(\"v1.11\")\n loc = \"HouseFile/Program/SdkVersion/Labels\"\n houseElements[loc].add_element(\"French\")\n loc = \"HouseFile/Program/Labels/French\"\n houseElements[loc].add_text(\"v1.11\")\n\n loc = \"HouseFile/Program\"\n houseElements[loc].add_element(\"Options\")\n loc = \"HouseFile/Program/Options\"\n houseElements[loc].attributes[\"xmlns:xsi\"] = \"http://www.w3.org/2001/XMLSchema-instance\"\n houseElements[loc].attributes[\"xmlns:xsd\"] = \"http://www.w3.org/2001/XMLSchema\"\n houseElements[loc].add_element(\"Main\")\n loc = \"HouseFile/Program/Options/Main\"\n houseElements[loc].attributes[\"applyHouseholdOperatingConditions\"] = \"false\"\n houseElements[loc].attributes[\"applyReducedOperatingConditions\"] = \"false\"\n houseElements[loc].attributes[\"atypicalElectricalLoads\"] = \"false\"\n houseElements[loc].attributes[\"waterConservation\"] = \"false\"\n houseElements[loc].attributes[\"referenceHouse\"] = \"false\"\n houseElements[loc].add_element(\"Vermiculite\")\n loc = \"HouseFile/Program/Options/Main/Vermiculite\"\n houseElements[loc].attributes[\"code\"] = \"1\"\n houseElements[loc].add_element(\"English\")\n loc = \"HouseFile/Program/Options/Main/Vermiculite/English\"\n houseElements[loc].add_text(\"Unknown\")\n loc = \"HouseFile/Program/Options/Main/Vermiculite\"\n houseElements[loc].add_element(\"French\")\n loc = \"HouseFile/Program/Options/Main/Vermiculite/French\"\n houseElements[loc].add_text(\"Inconnu\")\n loc = \"HouseFile/Program/Options\"\n houseElements[loc].add_element(\"RURComments\")\n loc = \"HouseFile/Program/Options/RURComments\"\n houseElements[loc].attributes[\"xml:space\"] = \"preserve\"\n\n loc = \"HouseFile/Program\"\n houseElements[loc].add_element(\"Results\")\n loc = \"HouseFile/Program/Results\"\n houseElements[loc].attributes[\"xmlns:xsi\"] = \"http://www.w3.org/2001/XMLSchema-instance\"\n houseElements[loc].attributes[\"xmlns:xsd\"] = \"http://www.w3.org/2001/XMLSchema\"\n houseElements[loc].add_element(\"Tsv\")\n houseElements[loc].add_element(\"Ers\")\n houseElements[loc].add_element(\"RefHse\")\n\nend", "def add_section_piece(section_piece, default_param_values={})\n raise \"section_piece is nil\" if section_piece.blank?\n # section_piece = SectionPiece.find(section_piece_id)\n tree = self.root.self_and_descendants\n section_piece_instance = tree.select{|xnode| xnode.section_piece_id==section_piece.id}.size.succ\n atts = { :section_piece_id=>section_piece.id}\n section = nil\n self.class.transaction do\n section = self.class.create!(atts)do|obj|\n obj.root_id= self.root_id\n obj.section_piece_instance=section_piece_instance\n end\n section.move_to_child_of(self)\n section.add_section_piece_param(default_param_values)\n end\n section\n end", "def create_new_sections!(chapter)\n return if chapter['mampf_chapter'].nil?\n mampf_chapter = chapter['mampf_chapter']\n new_sections_in_chapter(chapter).each do |s|\n sect = Section.new(chapter_id: mampf_chapter.id, title: s.second)\n sect.insert_at(s.first)\n corresponding = @sections.find { |d| d['counter'] == s.third }\n corresponding['mampf_section'] = sect\n end\n end", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n @section.check_index()\n form_wrapper = FormWrapper.find(@section.form_wrapper_id)\n format.html { redirect_to sections_section_path(form_wrapper), alert: I18n.t('activerecord.models.section.single') + I18n.t('helpers_locale.models.created') }\n format.json { render action: 'show', status: :created, location: @section }\n else\n format.html { render action: 'new' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(params[:section])\n @section.account = @account\n \n # This serves to retreive any article attached to this new section so we can access that article's apge\n @article = find_article if params[:article_id]\n\n respond_to do |format|\n if @section.save\n flash[:notice] = 'Section was successfully created.'\n format.js { redirect_to(account_article_sortings_url(@account, @article, :format=>:js)) if @article}\n format.html { redirect_to(account_sections_url(@account)) }\n format.xml { render :xml => [@account, @section], :status => :created, :location =>[@account, @section] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\r\n @section = Section.new(params[:section])\r\n\r\n respond_to do |format|\r\n if @section.save\r\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\r\n format.json { render json: @section, status: :created, location: @section }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @section.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def build_heading level\n heading = super\n\n @section = heading.text\n\n heading\n end", "def create\n @section = Section.new(section_params)\n\n if @section.save\n redirect_to sections_path, primary: 'Section was successfully created.'\n else\n render :new\n end\n end", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def section_by_name(section_name); end", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section,\n notice: 'Section was successfully created.' }\n format.json { render :show,\n status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def section(elem_id, elem_title)\n section(elem_id, elem_title, :elem_name=>'section')\n end", "def init\n File.open(ORENONO_FILE, 'w') { |f|f.puts ORENONO_TEMPLATE }\n end", "def add_section(name, file)\n raise \"A section with name #{name} already exists\" if include?(name)\n result = Section.new(name, file)\n @files[file] ||= []\n @files[file] << result\n result\n end", "def section_id\n 'generic'\n end", "def create_section \n begin\n #@user = User.find(params[:id])\n #if(@user)\n @newsection = Section.new(\n :userId => params[:id], \n :title => params[:title],\n :shows => params[:shows],\n :actors => params[:actors])\n if @newsection.save\n render_xml_output(\"Success\")\n else \n render_xml_output(\"Section could not be added\")\n end\n #else\n #render_xml_output(\"No user id Match\")\n #end\n rescue ActiveRecord::RecordNotFound \n render_xml_output(\"No User Id matched\")\n end\nend", "def create\n @home = Home.first\n @about = About.first\n\n @section = Section.new(section_params)\n @section.order = Section.all.count+1\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to [:admin, @section], notice: 'Section was successfully created.' }\n format.json { render action: 'show', status: :created, location: @section }\n else\n format.html { render action: 'new' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render json: @section }\n else\n format.html { render action: 'new' }\n format.json { render json: ErrorSerializer.serialize(@section.errors), status: :unprocessable_entity }\n end\n end\n end", "def section?\n !@section.nil?\n end", "def about_section_C_innovation\n OpenStruct.new(\n :header => \"About section C\",\n :context => [\n \"This section is structured to enable you to tell your success story of the innovation's development, implementation and impact, enabling the assessing team to understand the role innovation plays within your overall business and how this impacts the performance of your business.\"\n ]\n )\n end", "def section_params\n params.fetch(:section, {}).permit(:title, :headless)\n end", "def append\n\n @section = Section.find(params[:id])\n @checklist = Checklist.find(@section.checklist_id)\n \n @new_section = @section.dup\n \n @new_section.name = ''\n @new_section.background_color = ''\n\n end", "def section\n @section || path_section\n end", "def load_contentful_structure_file\n file_exists? ? load_existing_contentful_structure_file : create_empty_contentful_structure_file\n end", "def reject_section(attributes)\n exists = attributes[:id].present?\n blank = (attributes[:title].blank? and attributes[:link].blank? and\n (attributes[:structure_ids].blank? and attributes[:indexable_card_ids].blank?))\n\n if blank and exists\n attributes.merge!({:_destroy => 1})\n end\n\n (blank and !exists)\n end", "def create\n @model_section = ModelSection.new(params[:model_section])\n\n respond_to do |format|\n if @model_section.save\n format.html { redirect_to(@model_section, :notice => 'Model section was successfully created.') }\n format.xml { render :xml => @model_section, :status => :created, :location => @model_section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @model_section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @domicile_type_section = DomicileTypeSection.new(params[:domicile_type_section])\n\n respond_to do |format|\n if @domicile_type_section.save\n format.html { redirect_to(@domicile_type_section, :notice => 'Domicile type section was successfully created.') }\n format.xml { render :xml => @domicile_type_section, :status => :created, :location => @domicile_type_section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @domicile_type_section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def initialize(hash_or_file = self.class.source, section = nil)\n #puts \"new! #{hash_or_file}\"\n case hash_or_file\n when nil\n raise Errno::ENOENT, \"No file specified as Settingslogic source\"\n when Hash\n self.replace hash_or_file\n else\n file_contents = open(hash_or_file).read\n hash = file_contents.empty? ? {} : YAML.load(ERB.new(file_contents).result).to_hash\n if self.class.namespace\n hash = hash[self.class.namespace] or return missing_key(\"Missing setting '#{self.class.namespace}' in #{hash_or_file}\")\n end\n self.replace hash\n end\n @section = section || self.class.source # so end of error says \"in application.yml\"\n create_accessors!\n end", "def section=(section)\n self[:section] = section\n end", "def section\n @section ||= @hash[@default]\n end" ]
[ "0.6728407", "0.6633708", "0.662286", "0.64252007", "0.6407727", "0.6273686", "0.6273686", "0.627082", "0.6105464", "0.60184807", "0.59704065", "0.593554", "0.5924141", "0.5922524", "0.59101486", "0.57467073", "0.5740243", "0.57074213", "0.5653471", "0.56439894", "0.5643729", "0.56290835", "0.56254244", "0.5618769", "0.5607704", "0.55933034", "0.5589132", "0.55290365", "0.54963213", "0.5495667", "0.5494689", "0.54936117", "0.5483331", "0.54818887", "0.5469846", "0.5467761", "0.54645044", "0.54600143", "0.5440163", "0.5428222", "0.5422518", "0.54176164", "0.5411088", "0.54048043", "0.5399218", "0.53828263", "0.5370436", "0.5366364", "0.53624094", "0.5360604", "0.53535646", "0.5352645", "0.5348708", "0.5341412", "0.5300115", "0.5277763", "0.5275401", "0.5273643", "0.52677256", "0.5266693", "0.52662146", "0.5261991", "0.52504915", "0.52453667", "0.5219154", "0.5214527", "0.52138394", "0.52126116", "0.5194662", "0.5193457", "0.51922095", "0.51821625", "0.51813185", "0.5176344", "0.51671606", "0.51642656", "0.5161647", "0.5161647", "0.5161647", "0.5161647", "0.5161232", "0.51556873", "0.51501596", "0.51471317", "0.5141751", "0.5138607", "0.51365775", "0.51337975", "0.51196223", "0.5115883", "0.5100334", "0.50968695", "0.5089978", "0.5070141", "0.5069799", "0.5057663", "0.50545555", "0.5048296", "0.50440216", "0.50419897", "0.50336003" ]
0.0
-1
Sections Creates OpenNebula section if not exists and returns its section_id. Returns its section_id if OpenNebula section already exists
def init_section one_section = section_by_name(NSXConstants::ONE_SECTION_NAME) one_section ||= create_section(NSXConstants::ONE_SECTION_NAME) return one_section['id'] if one_section end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_section(section_name)\n section_spec = %(\n {\n \"display_name\": \"#{section_name}\",\n \"section_type\": \"LAYER3\",\n \"stateful\": true\n }\n )\n section_id = @nsx_client.post(@url_sections, section_spec)\n result = section_by_id(section_id)\n raise 'Section was not created in DFW' unless result\n\n result\n end", "def unique_section_id\n @section_id += 1\n end", "def section_id\n \"section-#{name}\"\n end", "def add_section(section, selected_page_layout=nil, attrs={})\n # check section.section_piece.is_container?\n obj = nil\n if section.root? \n section_instance = 1\n if selected_page_layout.present?\n raise ArgugemntError, 'only container could has child section' unless selected_page_layout.section.section_piece.is_container \n whole_tree = selected_page_layout.root.self_and_descendants\n section_instance = whole_tree.select{|xnode| xnode.section_id==section.id}.size.succ\n end\n attrs[:title]||=\"#{section.title}#{section_instance}\" \n obj = PageLayout.create do|obj|\n obj.section_id, obj.section_instance=section.id, section_instance\n obj.assign_attributes( attrs )\n obj.root_id = selected_page_layout.root_id if selected_page_layout.present?\n obj.site_id = SpreeTheme.site_class.current.id\n obj.is_full_html = section.section_piece.is_root?\n end\n if selected_page_layout.present?\n obj.move_to_child_of(selected_page_layout)\n else\n obj.update_attribute(\"root_id\",obj.id)\n end\n #copy the default section param value to the layout\n obj.add_param_value(self)\n end\n obj\n end", "def section_by_id(section_id); end", "def section=(section)\n section = Section.find_or_create_by(name: section[:name])\n self.section_id = section.id\n end", "def add_new_section\n @section = Section.new\n end", "def add_section(fields={})\n section_data = fields.merge({\n :suite_id => data.id,\n })\n return add_entity(Section, data.project_id, section_data)\n end", "def sell_shop_section_create (section_name, params={})\r\n url = api_url \"/sell/shop/sections\"\r\n req = request_params(params)\r\n load = MultiJson.dump name: section_name\r\n\r\n feed_or_retry do\r\n RestClient.post url, load, req\r\n end \r\n end", "def create_sections\n @sections = if @options.configure_sections?\n parse_sections(@options[:configure_sections])\n elsif @options.add_sections?\n default_sections.concat parse_sections(@options[:add_sections])\n else\n default_sections\n end\n nil\n end", "def section\n return @section if @section\n\n @section = parent.add_section @section_title if parent\n end", "def section_new\n @section = Section.new\n @section_count = Section.count + 1\n @section_position = @section_count\n end", "def create_section(name, section_name, slide_index, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = create_section_with_http_info(name, section_name, slide_index, password, folder, storage)\n data\n end", "def section_by_name(section_name)\n section = sections.find do |s|\n s.name == section_name\n end\n if section.nil?\n raise RTrail::NotFound.new(\n \"Section '#{section_name}' not found in Suite '#{data.name}'\")\n end\n return section\n end", "def create_new_section(title, options={})\n send_request('create_new_section', normalize_options(title, options))\n end", "def find_section\n @section = Section.find(params[:section_id])\n end", "def section_by_id(section_id = @one_section_id)\n url = @url_sections + '/' + section_id\n @nsx_client.get(url)\n end", "def create\n @section = Section.new(params[:section])\n\n Course.find(params[:section][:add_section]).sections << @section if params[:section][:add_section]\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render json: @section, status: :created, location: @section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(section_params)\n\n if @section.save\n redirect_to sections_path, primary: 'Section was successfully created.'\n else\n render :new\n end\n end", "def create\n @section = Section.new(section_params)\n\n if @section.save\n render :show, status: :created, location: @section\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def section\n return @section if @section\n\n resp = HTTP\n .headers(authorization: \"Bearer #{access_token[:access_token]}\")\n .get(LIST_SECTIONS_ENDPOINT % notebook[:id], params: {\n select: 'id,name',\n filter: \"name eq '#{Config[:section]}'\"\n })\n if resp.code.to_s.start_with? '2'\n json = response_body(resp)\n @section = JSON.parse(json, symbolize_names: true)[:value].first\n end\n return @section\n end", "def create\n @sections = Section.find(:all)\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n flash[:notice] = 'Section was successfully created.'\n format.html { redirect_to(@section) }\n format.xml { render :xml => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to(admin_sections_path, :notice => 'Section was successfully created.') }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(section_params)\n if @section.save\n render json: SectionSerializer.new(@section)\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end", "def section_created_hook(sender,new_section)\n unless root?\n parent.section_created_hook(sender, new_section)\n else\n new_section\n end\n end", "def set_section\n @section = Section.friendly.find(params[:id])\n end", "def section_id\n 'generic'\n end", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n # Add section to course.\n if params.has_key?('course_id')\n course_id = params['course_id']\n add_section_to_course(@section, course_id)\n end\n \n format.js { render \"\", json: @section }\n else\n format.js { render json: @section.errors, status: :unprocessable_entity }\n end\n # if add_section_to_course(@section, course_id)\n # # Use the sections helper to create the relation between the section and its course.\n # format.html { redirect_to Course.find(course_id), notice: 'Section was successfully created.' }\n # format.json { render :show, status: :created, location: @section }\n # else\n # format.html { render :new }\n # format.json { render json: @section.errors, status: :unprocessable_entity }\n # end\n end\n end", "def set_section\n @section = @form.sections.find(params[:id])\n end", "def get_section_id(testsuite,parent_id=nil)\n # some elements don't have names\n return nil if testsuite.attributes['name'].value.empty?\n section = sections.detect{|s| s['name'] == testsuite.attributes['name'].value}\n unless section\n section = testrail_api_client.send_post(\"add_section/#{project_id}\",{suite_id:suite_id,name:testsuite.attributes['name'].value,parent_id:parent_id})\n sections << section\n end\n section['id']\n end", "def set_section\n @section = EventGroup.find(params[:id] || params[:section_id])\n end", "def section?\n !@section.nil?\n end", "def insert_section\n\n new_section = Section.new(params[:new_section])\n existing_section = Section.find(params[:section][:id])\n\n new_section.insert(existing_section.checklist_id,\n existing_section.position)\n\n if new_section.errors.empty?\n flash['notice'] = 'Section insert successful.'\n redirect_to(:controller => 'checklist',\n :action => 'edit',\n :id => existing_section.checklist_id)\n else\n flash['notice'] = 'Section insert failed - Contact DTG'\n redirect_to(:controller => 'section',\n :action => 'insert',\n :id => existing_section.id)\n end\n end", "def get_section(section_id)\n self.sections.find { |s| s.id == section_id }\n end", "def new\n @section = Section.new(:page_id => @page.id)\n end", "def sections\n temp_sections = []\n if @section_ids.count > 0\n @section_ids.each do |section_id|\n temp_sections.push @client.section(@org_id, section_id)\n end\n end\n return temp_sections\n end", "def add_section(project_id, data = {})\n post(\"add_section/#{project_id}\", body: data.to_json)\n end", "def create\n @section = Section.new(params[:section])\n @section.account = @account\n \n # This serves to retreive any article attached to this new section so we can access that article's apge\n @article = find_article if params[:article_id]\n\n respond_to do |format|\n if @section.save\n flash[:notice] = 'Section was successfully created.'\n format.js { redirect_to(account_article_sortings_url(@account, @article, :format=>:js)) if @article}\n format.html { redirect_to(account_sections_url(@account)) }\n format.xml { render :xml => [@account, @section], :status => :created, :location =>[@account, @section] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_section \n begin\n #@user = User.find(params[:id])\n #if(@user)\n @newsection = Section.new(\n :userId => params[:id], \n :title => params[:title],\n :shows => params[:shows],\n :actors => params[:actors])\n if @newsection.save\n render_xml_output(\"Success\")\n else \n render_xml_output(\"Section could not be added\")\n end\n #else\n #render_xml_output(\"No user id Match\")\n #end\n rescue ActiveRecord::RecordNotFound \n render_xml_output(\"No User Id matched\")\n end\nend", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n @section.check_index()\n form_wrapper = FormWrapper.find(@section.form_wrapper_id)\n format.html { redirect_to sections_section_path(form_wrapper), alert: I18n.t('activerecord.models.section.single') + I18n.t('helpers_locale.models.created') }\n format.json { render action: 'show', status: :created, location: @section }\n else\n format.html { render action: 'new' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_section\n if (params[:id] == nil)\n params[:id] = session[:active_block]\n if (session[:active_block])\n # TODO: try to infer the section based on the current time.\n params[:id] = 1\n end\n end\n session[:active_block] = params[:id].to_i\n @section = Section.find(params[:id])\n end", "def create\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to(@section, :notice => 'Section was successfully created.') }\n format.xml { render :xml => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def section(ident)\n @sections[ident]\n end", "def create\n @home = Home.first\n @about = About.first\n\n @section = Section.new(section_params)\n @section.order = Section.all.count+1\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to [:admin, @section], notice: 'Section was successfully created.' }\n format.json { render action: 'show', status: :created, location: @section }\n else\n format.html { render action: 'new' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_new_section(title, options={})\n send_audit(:kind => :new_section, :text => title, :category => options[:category])\n end", "def create\n @post = find_post\n @post_section = @post.sections.build(post_section_params)\n\n respond_to do |format|\n if @post_section.save\n format.html { redirect_to admin_post_section_url(@post, @post_section), notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: admin_post_section_url(@post, @post_section) }\n else\n format.html { render :new }\n format.json { render json: @post_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_new_sections!(chapter)\n return if chapter['mampf_chapter'].nil?\n mampf_chapter = chapter['mampf_chapter']\n new_sections_in_chapter(chapter).each do |s|\n sect = Section.new(chapter_id: mampf_chapter.id, title: s.second)\n sect.insert_at(s.first)\n corresponding = @sections.find { |d| d['counter'] == s.third }\n corresponding['mampf_section'] = sect\n end\n end", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section,\n notice: 'Section was successfully created.' }\n format.json { render :show,\n status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def sections_exist?\n @top_level.items.present?\n end", "def create\n @section = Section.new(section_params)\n @section.title = @section.title || \"\"\n\n document = @section.document\n @section.order = 1\n unless document.sections.blank?\n @section.order = document.sections.last.order + 1\n end\n\n @section.visibility = document.visibility\n @section.status = document.status\n\n update_user_attribution @section, true\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.any(:json, :js) { render :show, status: :created, location: @section }\n else\n puts @section.errors.full_messages\n format.html { render :new }\n format.any(:json, :js) { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def has_section?(name)\n sections.has_key?(name)\n end", "def has_section?(name)\n sections.has_key?(name)\n end", "def create\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render json: @section, status: :created, location: @section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def section_by_name(section_name); end", "def add_section(section)\n @section_counter[section] += 1\n end", "def section(elem_id, elem_title)\n section(elem_id, elem_title, :elem_name=>'section')\n end", "def createSection(section)\r\n uri = sprintf(\"/api/v1/courses/%d/sections/\", $tocid) \r\n \r\n dbg(\"POST #{uri}\")\r\n dbg(\"course_section[name]=#{section[\"name\"]}\")\r\n newSection = $canvas.post(uri, {'course_section[name]' => section[\"name\"]})\r\n dbg(newSection)\r\n return newSection\r\nend", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render json: @section }\n else\n format.html { render action: 'new' }\n format.json { render json: ErrorSerializer.serialize(@section.errors), status: :unprocessable_entity }\n end\n end\n end", "def section\n BSection.store[@section_id]\n end", "def create\n @section = Section.new(section_params.merge!({ document: Document.find(params[:document_id]) }))\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_first\n\n @section = Section.find(params[:id])\n\n @new_subsection = Subsection.new\n @new_subsection.section_id = @section.id \n @new_subsection.name = ''\n @new_subsection.note = ''\n \n @new_subsection.date_code_check = @section.date_code_check\n @new_subsection.dot_rev_check = @section.dot_rev_check\n\n end", "def set_section_row\n @section_row = SectionRow.find(params[:id])\n end", "def create\r\n @section = Section.new(params[:section])\r\n\r\n respond_to do |format|\r\n if @section.save\r\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\r\n format.json { render json: @section, status: :created, location: @section }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @section.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def unique_section_object(key, container)\n Object.const_set(\"EDSLSpecSection#{key}\", Class.new(EDSL::PageObject::Section)).new(container)\nend", "def create\n @join_section = JoinSection.new(params[:join_section])\n\n respond_to do |format|\n if @join_section.save\n format.html { redirect_to(@join_section, :notice => 'JoinSection was successfully created.') }\n format.xml { render :xml => @join_section, :status => :created, :location => @join_section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @join_section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n # Instantiate new object using form params\n @section = Section.new(section_params) #use private method below to get permited data for mass assignment\n @section.page = @page\n # Save object\n if @section.save\n # If successful, redirect to index action\n flash[:notice] = \"Section created successfully.\"\n redirect_to(sections_path(:page_id => @page.id))\n else\n # Else, redisplay form so user can fix problems\n render('new') # renders form template with original user data pre-populated\n end\n end", "def section\n @section ||= @hash[@default]\n end", "def next_section\n @current_section = Elf.elf_nextscn(self,@current_section)\n\n if @current_section.null?\n @current_section = nil\n return nil\n else\n return Section.new(@current_section)\n end\n end", "def content_api_has_root_sections(slugs_or_sections)\n content_api_has_root_tags(\"section\", slugs_or_sections)\n end", "def delete\n @section = Section.find(params[:id])\n end", "def create_section_with_http_info(name, section_name, slide_index, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.create_section ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.create_section\"\n end\n # verify the required parameter 'section_name' is set\n if @api_client.config.client_side_validation && section_name.nil?\n fail ArgumentError, \"Missing the required parameter 'section_name' when calling SlidesApi.create_section\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.create_section\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'sectionName'] = @api_client.prepare_for_query(section_name) unless section_name.nil?\n query_params[:'slideIndex'] = @api_client.prepare_for_query(slide_index) unless slide_index.nil?\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end", "def section?\n type == \"Section\"\n end", "def sell_shop_item_section_add(item_id, section_name, params={})\r\n url = api_url \"/sell/shop/items/#{item_id}/add_section\"\r\n req = request_params({currency: @currency, locale: @locale}.merge(params))\r\n load = MultiJson.dump section: section_name\r\n\r\n feed_or_retry do\r\n RestClient.post url, load, req\r\n end \r\n end", "def add_section(position = nil, section_type = nil)\n section = self.sections.create(Section::DEFAULT_PARAMS)\n section.move_to_bottom\n end" ]
[ "0.6829747", "0.66241634", "0.6505443", "0.64422566", "0.6417074", "0.6398628", "0.6339004", "0.6321444", "0.62967265", "0.6289301", "0.62361777", "0.6213183", "0.6184537", "0.61252946", "0.60952663", "0.6063346", "0.6035641", "0.60046005", "0.595171", "0.59381676", "0.5933144", "0.59320277", "0.59320277", "0.59320277", "0.59320277", "0.59320277", "0.59320277", "0.59320277", "0.59320277", "0.59320277", "0.59320277", "0.59320277", "0.59320277", "0.59320277", "0.59320277", "0.59320277", "0.59320277", "0.59320277", "0.59320277", "0.59320277", "0.5930104", "0.5930104", "0.59059775", "0.5904766", "0.5866065", "0.58505416", "0.5829635", "0.5803299", "0.5765035", "0.5764137", "0.5761524", "0.57551163", "0.5745131", "0.57389164", "0.5729426", "0.5701922", "0.5697184", "0.568652", "0.56860435", "0.56836784", "0.56822944", "0.5681214", "0.56759775", "0.5664838", "0.56638455", "0.5650344", "0.5647157", "0.56412345", "0.5637806", "0.56374854", "0.5631241", "0.5629526", "0.56273025", "0.56273025", "0.56273025", "0.56273025", "0.561726", "0.561726", "0.5617183", "0.56110114", "0.56048274", "0.5587707", "0.55856746", "0.55823666", "0.558168", "0.55501145", "0.5531351", "0.5529434", "0.5517453", "0.55149394", "0.55048895", "0.5503118", "0.5497893", "0.5490351", "0.54880524", "0.5476669", "0.54762673", "0.54720414", "0.5459973", "0.54389423" ]
0.66754615
1
Get all sections Params: None Return nil | sections
def sections result = @nsx_client.get(@url_sections) result['results'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sections\n parsed {\n @sections\n }\n end", "def sections\n @sections.values\n end", "def sections\n return @sections\n end", "def sections\n temp_sections = []\n if @section_ids.count > 0\n @section_ids.each do |section_id|\n temp_sections.push @client.section(@org_id, section_id)\n end\n end\n return temp_sections\n end", "def all_sections\n [ header_section ] + sections\n end", "def sections\n @pages.collect { |p| p.sections }.flatten\n end", "def list_sections\n \n end", "def section_contents\n used_sections = {}\n\n each_method do |method|\n next unless method.display?\n\n used_sections[method.section] = true\n end\n\n # order found sections\n sections = sort_sections.select do |section|\n used_sections[section]\n end\n\n # only the default section is used\n return [] if\n sections.length == 1 and not sections.first.title\n\n sections\n end", "def sections\n @body.xpath('.//a:section', a: NS)\n end", "def sections\n respond_with @page.sections\n end", "def sections\n respond_with @page.sections\n end", "def sections\n @sections ||= context\n .public_methods\n .grep(/\\A(?!wait_)\\w+_section$\\z/)\n .map { |el| Meta::Section.new(el.to_s.gsub('_section', ''), context) }\n end", "def sections\n @data.keys\n end", "def sections\n @blocks.inject([]) {|collector, block|\n collector << block if block.is_a?(Section)\n collector\n }\n end", "def list_sections(opts = {})\n data, _status_code, _headers = list_sections_with_http_info(opts)\n data\n end", "def sections(project_id, suite_id)\n get(\"get_sections/#{project_id}&suite_id=#{suite_id}\")\n end", "def sections\n @sections ||= @account.sections\n end", "def get_sections (subdomain,course_id)\n token = get_token\n courses = get_all_pages(\n token,\n \"https://#{subdomain}.instructure.com/api/v1/courses/#{course_id}/sections\"\n )\n end", "def sections(*args); end", "def sections\n self.entries.select { |e| e.is_a?(ListSection) }\n end", "def index\n @sections = params[:path].nil? ? Section.all : Section.where(path: params[:path])\n\n respond_to do |format|\n format.html { render html: @sections }\n format.json { render json: @sections }\n end\n end", "def index\n @sections = Section.all.paginate(:page => params[:page], :per_page => 100)\n end", "def sections\n children.select { |child| child.is_a? DocumentSection }\n end", "def index\n @sections = Section.all\n end", "def index\n @sections = Section.all\n end", "def index\n @sections = Section.all\n end", "def index\n @sections = Section.all\n end", "def index\n @sections = Section.all\n end", "def index\n @sections = Section.all\n end", "def index\n @sections = Section.all\n end", "def sections(*values)\n values.inject(self) { |res, val| res._sections(val) or fail ArgumentError, \"Unknown value for sections: #{val}\" }\n end", "def sections(*values)\n values.inject(self) { |res, val| res._sections(val) or fail ArgumentError, \"Unknown value for sections: #{val}\" }\n end", "def index\n @sections=Section.all\n end", "def index\n @sections = @page.sections.sorted\n end", "def list_by_sections\n\n @list_options = Section.find_alpha\n\n if params[:key] then\n @viewing_by = params[:key]\n elsif session[:last_content_list_view] then\n @viewing_by = session[:last_content_list_view]\n else\n @viewing_by = @list_options[0].id\n end\n\n @section = Section.find(:first, :conditions => [\"#{Section.connection.quote_column_name(\"id\")}=?\", @viewing_by])\n if @section == nil then\n\t\t\tredirect_to :action => 'list'\n\t\t\treturn\n end\n\n @title = \"Content List For Section - '#{@section.name}'\"\n\n conditions = nil\n\n session[:last_content_list_view] = @viewing_by\n\n # Paginate that will work with will_paginate...yee!\n per_page = 30\n list = @section.content_nodes\n pager = Paginator.new(list, list.size, per_page, params[:page])\n @content_nodes = WillPaginate::Collection.new(params[:page] || 1, per_page, list.size) do |p|\n p.replace list[pager.current.offset, pager.items_per_page]\n end\n \n render :action => 'list'\n end", "def sections\n @ini.keys\n end", "def sections\n @ini.keys\n end", "def section_params\n params.fetch(:section, {})\n end", "def index\n #@sections = Section.find(params[:course_id])\n #@sections = Section.all\n end", "def users_sections\n unless session[:mySections]\n session[:mySections] = []\n end\n session[:mySections]\n end", "def get_sections\n symbolize! @rules\n raise \"[body] section on YAML file is needed to generate the report.\" if @rules[:body].nil?\n @sections = {:page => @rules[:page], :body => @rules[:body], :defaults => @rules[:defaults], :groups => {}}\n @sections[:body][:settings][:groups].each { |group| @sections[:groups][group.to_sym] = @rules[group.to_sym] } if has_groups?\n end", "def home\n @sections = Section.visible.sorted\n end", "def course_sections\n ['1', '2']\n end", "def sections=(value)\n @sections = value\n end", "def index\n @page_sections = PageSection.all\n end", "def show\n @sections = @course.sections.all.to_a\n end", "def sections\n account.accessible_sections if account\n end", "def subsections\n return suite.sections.select do |sect|\n sect.parent_id == data.id\n end\n end", "def index\n @cms_page_sections = Cms::PageSection.all\n end", "def sell_shop_sections (params={})\r\n url = api_url \"/sell/shop/sections\"\r\n req = request_params(params)\r\n\r\n feed_or_retry do\r\n RestClient.get url, req\r\n end \r\n end", "def get_sections(name, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = get_sections_with_http_info(name, password, folder, storage)\n data\n end", "def subsections\n Section.where(parent_id: id)\n end", "def sections\n @section_ids.collect { |idx| BSection.store[idx] }\n end", "def index\n # XXX: This is fragile, should be sorting on the block sort order.\n # Or better, there should be a section sort method.\n @sections = Section.order(:block_id)\n end", "def index\n course = Course.find(params[:course_id])\n sections = course.sections.all\n render json: sections.order(:id)\n end", "def section_groups\n return @section_groups\n end", "def sections\n @sections || [:backtrace, :request, :session, :environment]\n end", "def sections(ident_only=false, &block)\n return to_enum(:sections, ident_only) if ! block_given?\n @sections.values.each do |sec|\n yield(ident_only ? sec.ident : sec)\n end\n end", "def section_ids\n sections.map { |co| co.id }\n end", "def index\n if current_user.has_role? :admin\n @sectionalizations = Sectionalization.all\n else\n @classroom = Classroom.find(session[:classroom_id])\n @sectionalizations = Sectionalization.where(classroom_id: @classroom.id)\n session[:sectionalization_id] = nil\n end\n end", "def index\n @section_configurations = SectionConfiguration.all.sort\n end", "def page_items\n sections.map(&:page_items).flatten\n end", "def section\n return @section if @section\n\n resp = HTTP\n .headers(authorization: \"Bearer #{access_token[:access_token]}\")\n .get(LIST_SECTIONS_ENDPOINT % notebook[:id], params: {\n select: 'id,name',\n filter: \"name eq '#{Config[:section]}'\"\n })\n if resp.code.to_s.start_with? '2'\n json = response_body(resp)\n @section = JSON.parse(json, symbolize_names: true)[:value].first\n end\n return @section\n end", "def set_sections\n @sections = Section.find_ordered_parents\n end", "def each_section\n @sections.each_value do | section |\n yield( section )\n end\n end", "def sections_info(plan)\n return [] if plan.nil?\n\n info = []\n plan.sections.each do |section|\n info.push(section_info(plan, section))\n end\n info\n end", "def index\n @title = \"Prima Lingua: Viewing all sections\"\n if teacher_signed_in?\n @teacher = Teacher.find(current_teacher)\n @sections = Section.where(:teacher_id => @teacher.id)\n elsif params[:teacher_id]\n @teacher = Teacher.find(:teacher_id)\n @sections = Section.where(:teacher_id => @teacher.id)\n elsif admin_signed_in?\n @sections = Section.all\n end\n render_flex_layout\n end", "def index\n @survey_sections = SurveySection.page(params[:page]).per(100)\n end", "def index\n @section_rows = SectionRow.all\n end", "def section_params\n params.require(:section)\n end", "def get_sections(request)\n data, _status_code, _headers = get_sections_with_http_info(request)\n request_token if _status_code == 401\n data\n end", "def sections(layout, parent_section = nil, first_object: false, object_index: nil)\n layout_print = send(layout)\n\n section_list = []\n\n # loop around each section rendering it in turn\n layout_print.each_with_index do |section, i|\n next if section.nil?\n\n Rails.logger.debug { \"Section #{section[:code]} Type #{section[:type]} Object Index: #{object_index}\" }\n next if skip_section(section, parent_section, object_index: object_index)\n\n section_list += process_section(layout, section, parent_section,\n (first_object && i.zero?), object_index: object_index)\n end\n section_list # return the section list\n end", "def index\n @user_sections = UserSection.all\n end", "def default_sections\n [\n Section.new(name: \"summary\", prefix: @options[:summary_prefix], labels: @options[:summary_labels], options: @options, body_only: true),\n Section.new(name: \"breaking\", prefix: @options[:breaking_prefix], labels: @options[:breaking_labels], options: @options),\n Section.new(name: \"enhancements\", prefix: @options[:enhancement_prefix], labels: @options[:enhancement_labels], options: @options),\n Section.new(name: \"bugs\", prefix: @options[:bug_prefix], labels: @options[:bug_labels], options: @options),\n Section.new(name: \"deprecated\", prefix: @options[:deprecated_prefix], labels: @options[:deprecated_labels], options: @options),\n Section.new(name: \"removed\", prefix: @options[:removed_prefix], labels: @options[:removed_labels], options: @options),\n Section.new(name: \"security\", prefix: @options[:security_prefix], labels: @options[:security_labels], options: @options)\n ]\n end", "def get_sections_for_user(userId)\n @sections = Section.find(:all,:conditions => [\"userId = ?\", userId])\n return @sections\nend", "def show\n @sections = Section.find(params[:id])\n end", "def index\n @section_headings = SectionHeading.all\n end", "def index\n @about_us_sections = AboutUsSection.all\n end", "def parse_sections(nodes)\n return {} if nodes.blank?\n\n # Keep track of what section we're in\n section = nil\n nodes.each_with_object({}) do |node, out|\n # Set up a fresh NodeSet for the current section if we haven't yet\n out[section] ||= Nokogiri::XML::NodeSet.new(page)\n # These nodes have a content but it are invisible\n node.css('script, style, iframe').each(&:remove)\n\n # Process the node\n if node.name == 'h2' || node['class'] == 'normal_header'\n section = node.xpath('./text()').map(&:content).join.strip\n else\n out[section] << node\n end\n end\n end", "def index\n @sections = case current_user.rc\n when 'EA'\n Section.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'IA','EO'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'MOE'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'CR'\n current_user.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n when 'ET'\n current_user.center.sections.includes(:profile).order('profiles.firstname').page(params[:page])\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end", "def view_all_sections \n @section = Section.find(:all)\n render_sections_xml(@section)\nend", "def create_get_all_sections(section_class, element_name, *find_args)\n method_name = \"get_all_#{element_name}\"\n create_helper_method(method_name, *find_args) do\n define_method(method_name) do |*runtime_args|\n args = merge_args(find_args, runtime_args)\n wait_until_get_not_empty(*args).map do |element|\n section_class.new(self, element)\n end\n end\n end\n end", "def index\n @language_sections = LanguageSection.all\n end", "def get_all()\n @params\n end", "def getEnrollmentsInSection(sid)\r\n\turi = sprintf(\"/api/v1/sections/%d/enrollments?type[]=StudentEnrollment&per_page=999\", sid)\r\n\tenrollments = $canvas.get(uri)\r\n\treturn enrollments\r\nend", "def getEnrollmentsInSection(sid)\r\n\turi = sprintf(\"/api/v1/sections/%d/enrollments?type[]=StudentEnrollment&per_page=999\", sid)\r\n\tenrollments = $canvas.get(uri)\r\n\treturn enrollments\r\nend", "def get_sections_with_http_info(name, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.get_sections ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.get_sections\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end", "def config_sections\n # init all sections\n base_locale\n internal_locale\n locales\n data_config\n @config_sections[:search] ||= search_config\n translation_config\n IGNORE_TYPES.each do |ignore_type|\n ignore_config ignore_type\n end\n @config_sections\n end", "def sections\n (1..section_size).inject([]) do |array, row_offset|\n (1..section_size).inject(array) do |array, column_offset|\n array << section_coordinates(row_offset - 1, column_offset - 1)\n end\n end\n end", "def index\n @course = Course.find(params[:course_id])\n items_per_page = 20\n if params[:grade_id]\n @course_sections = CourseSection.with_grade_level(params[:grade_id]).paginate(page: params[:page], per_page: items_per_page)\n elsif params[:course_id]\n @course_sections = @course.course_sections\n end\n end", "def index\n @sections = Section.order(\"position asc\")\n\n authorize Section\n end", "def section_list_for record\n tags_for_context_and_taggable(context: :sections, taggable: record)\n end", "def all(params = {})\n begin\n parse get nil, params\n rescue Exception => e\n []\n end\n end", "def all(params = {})\n begin\n parse get nil, params\n rescue Exception => e\n []\n end\n end", "def all(params = {})\n begin\n parse get nil, params\n rescue Exception => e\n []\n end\n end", "def all(params = {})\n begin\n parse get nil, params\n rescue Exception => e\n []\n end\n end", "def all(params = {})\n begin\n parse get nil, params\n rescue Exception => e\n []\n end\n end", "def index\n @sections = Section.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end", "def section_courses\n all_sections = sections.to_a.concat(sections_as_student).uniq\n\n # In the future we may want to make it so that if assigned a script, but that\n # script has a default course, it shows up as a course here\n all_sections.map(&:course).compact.uniq\n end", "def index\n @admin_sections = HomeSection.all\n end" ]
[ "0.7926308", "0.78306144", "0.7696838", "0.768655", "0.7659663", "0.7604488", "0.7522771", "0.7380303", "0.72824776", "0.7250462", "0.7250462", "0.71212864", "0.71003234", "0.70289266", "0.69745666", "0.6932351", "0.6836086", "0.6812029", "0.6782918", "0.6763463", "0.6700529", "0.66890144", "0.66855043", "0.66588247", "0.66588247", "0.66588247", "0.66588247", "0.66588247", "0.66588247", "0.66588247", "0.66449094", "0.66449094", "0.65938574", "0.6583338", "0.6565164", "0.65626496", "0.65626496", "0.65375704", "0.6537467", "0.65263706", "0.6493334", "0.6452349", "0.6438585", "0.6438235", "0.64217657", "0.6420361", "0.64021885", "0.63953185", "0.63949054", "0.6347765", "0.63475585", "0.6330974", "0.6327884", "0.6314005", "0.6311581", "0.63026845", "0.62926537", "0.6253708", "0.6235415", "0.62173545", "0.6205334", "0.61831146", "0.6168414", "0.6154186", "0.6128123", "0.61100227", "0.6108926", "0.61044455", "0.60980195", "0.6084074", "0.6073562", "0.606257", "0.60578907", "0.6054529", "0.60530525", "0.6041893", "0.602853", "0.6024234", "0.6021382", "0.6019995", "0.6019013", "0.6008216", "0.59478545", "0.59450155", "0.59381616", "0.59381616", "0.59360826", "0.5932889", "0.59325004", "0.59316695", "0.59273416", "0.59179413", "0.5916693", "0.5916693", "0.5916693", "0.5916693", "0.5916693", "0.59084404", "0.590699", "0.59019774" ]
0.77827084
2
Get section by id Params:
def section_by_id(section_id = @one_section_id) url = @url_sections + '/' + section_id @nsx_client.get(url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_section(section_id)\n self.sections.find { |s| s.id == section_id }\n end", "def section_by_id(section_id); end", "def get_section(id)\n @doc.at_css(\"##{id}\").parent.next_element\n end", "def find_section\n @section = Section.find(params[:section_id])\n end", "def section(elem_id, elem_title)\n section(elem_id, elem_title, :elem_name=>'section')\n end", "def get_section(section_id, opts = {})\n data, _status_code, _headers = get_section_with_http_info(section_id, opts)\n data\n end", "def section(ident)\n @sections[ident]\n end", "def set_section\n @section = Section.friendly.find(params[:id])\n end", "def show\n @sections = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def section_id\n \"section-#{name}\"\n end", "def section_id\n match_in_id /\\/(\\w+)$/\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def section\n return @section if @section\n\n resp = HTTP\n .headers(authorization: \"Bearer #{access_token[:access_token]}\")\n .get(LIST_SECTIONS_ENDPOINT % notebook[:id], params: {\n select: 'id,name',\n filter: \"name eq '#{Config[:section]}'\"\n })\n if resp.code.to_s.start_with? '2'\n json = response_body(resp)\n @section = JSON.parse(json, symbolize_names: true)[:value].first\n end\n return @section\n end", "def section(name)\n sections.find { |el| el.name == name.to_s }\n end", "def show\n \n begin\n @section = @account.sections.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n @section = @account.sections.find_by_name(params[:id]) \n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @section }\n end\n end", "def find(id)\n end", "def subsection(subsection_name_or_id)\n if is_id?(subsection_name_or_id)\n return Section.get(subsection_name_or_id)\n else\n return subsection_by_name(subsection_name_or_id)\n end\n end", "def edit\n @section = Section.find(params[:id])\n end", "def title(section_id)\n @sections[section_id || 1]\n end", "def load_section!\n if @extra_page\n @section = current_cookbook.sections.find @extra_page.section_id\n else\n @section = current_cookbook.sections.find params[:section_id]\n end\n end", "def section_by_name(section_name)\n section = sections.find do |s|\n s.name == section_name\n end\n if section.nil?\n raise RTrail::NotFound.new(\n \"Section '#{section_name}' not found in Suite '#{data.name}'\")\n end\n return section\n end", "def set_section\n @section = @form.sections.find(params[:id])\n end", "def show\n @section = Section.find(params[:id])\n\t\t@page = @section.pages[0]\n end", "def get id\n @services[id]\n end", "def show\n @sections = Section.where(\"course_id = ?\", params[:course_id])\n\n end", "def section_by_name(section_name); end", "def find(id)\n @data[id]\n end", "def find(id)\n first(\"Id = '#{id}'\")\n end", "def find_by_id(client, id, params = {})\n params = default_params.merge(params)\n\n client.get(\"#{resource_name}/#{id}\", params).data[resource_name_singular]\n end", "def set_section_configuration\n @section_configuration = SectionConfiguration.find(params[:id])\n end", "def show\n @home = Home.first\n @about = About.first\n\n @section = Section.find(params[:id])\n end", "def delete\n @section = Section.find(params[:id])\n end", "def get_section_with_http_info(section_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesFirewallApi.get_section ...'\n end\n # verify the required parameter 'section_id' is set\n if @api_client.config.client_side_validation && section_id.nil?\n fail ArgumentError, \"Missing the required parameter 'section_id' when calling ManagementPlaneApiServicesFirewallApi.get_section\"\n end\n # resource path\n local_var_path = '/firewall/sections/{section-id}'.sub('{' + 'section-id' + '}', section_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FirewallSection')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesFirewallApi#get_section\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def section_by_name(section_name)\n result = nil\n all_sections = sections\n return result unless all_sections\n\n all_sections.each do |section|\n result = section if section['display_name'] == section_name\n end\n result\n end", "def set_section_p\n @section = Section.find(params[:section_id])\n end", "def find(id)\n return nil if id.blank?\n path = build_association_path -> { \"#{@parent.request_path(@params)}#{@opts[:path]}/#{id}\" }\n @klass.get_resource(path, @params)\n end", "def section( task_id_str )\n @task_to_section_map[ task_id_str ]\n end", "def [](id)\n @by_id[id]\n end", "def find(id)\n @collection[id.to_s]\n end", "def get id\n if id.is_a?(Integer) || id.to_s.is_numeric?\n c = @courses[id.to_i]\n c ? [c] : []\n else\n @courses.select { |course| course.title.match(/^#{id}/) }\n end\n end", "def getObject(id)\n\t\tdoc.search(\"[@id='#{id}']\").first\n\tend", "def show\n @sections = Section.find(:all)\n params[:section_id] ||= params[:id] # kludgey workaround: for some reason :section_id is getting lost and its value put into :id:\n @section = Section.find(params[:section_id])\n @breaking_story ||= Story.find(:first, \n :conditions => ['is_breaking = ? and published = ?', true, true], \n :order => 'publish_at DESC')\n\n\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @section }\n end\n end", "def find(id)\n where({'id' => \"#{id}\"}).first\n end", "def show\n @section = Section.find(params[:id]) \t\n @nav_sections = Section.where(scenario_id: @section.scenario_id).order(:order)\n @inquests = Inquest.where(section_id: params[:id]).order(:order)\n @scenario = Scenario.where(id: @section.scenario_id)[0]\n end", "def [](name)\n name = name.to_s\n each_section do |section|\n return section if section.name == name\n end\n nil\n end", "def find(id)\n find_by_index(id: id)\n end", "def get_by_id(id)\n raise(ArgumentError, \"Argument 'id' must be a Fixnum\") unless id.is_a?(Fixnum)\n @data.find{ |entry| entry[:id] == id }\n end", "def show\n @sectiontemplates = Admin::Sectiontemplate.find(:all,:select=>\"SectionTemplate_Id,SectionTitle\")\n @sectiontemplate = Admin::Sectiontemplate.find(params[:id])\n end", "def sections(project_id, suite_id)\n get(\"get_sections/#{project_id}&suite_id=#{suite_id}\")\n end", "def subsections\n Section.where(parent_id: id)\n end", "def lookup(id)\n id_num = id\n settings.data[id_num]\n end", "def set_section\n @course = Course.find(params[:course_id])\n @section = @course.sections.find(params[:section_id])\n end", "def find(id)\n @api.get(\"api/#{id.to_s}.json\")\n end", "def section(name)\n self[section_index(name)]\n end", "def find_section\n Section.joins(course: :department).where({\n number: @row.number,\n term: @row.term,\n 'departments.subject_code': @department.subject_code,\n 'courses.course_number': @course.course_number,\n }).first\n end", "def find(id); end", "def find(id); end", "def section\n @section.call\n end", "def find_by_id(id)\n find(id)\n end", "def edit\n @subsection = Subsection.find(params['id'])\n end", "def set_section\n @section = EventGroup.find(params[:id] || params[:section_id])\n end", "def set_section_row\n @section_row = SectionRow.find(params[:id])\n end", "def section_id\n 'generic'\n end", "def get_param_by_id(id)\n param = nil\n @params.each do |p|\n if p['id'] == id\n param = p\n end\n end\n return param\n end", "def get_param_by_id(id)\n param = nil\n @params.each do |p|\n if p['id'] == id\n param = p\n end\n end\n return param\n end", "def find_by_id(id)\n find_by_attributes(:id => id).first\n end", "def get_section(experiment,section_to_find)\n section = experiment[\"experiment_procedures\"].find(){|ep| ep[\"experiment_procedure\"][\"section_type\"] == section_to_find}\n section[\"experiment_procedure\"] if section\nend", "def section\n @section || path_section\n end", "def get!(id)\n klass.find(:all, params: { id: wrap_key(id) })\n end", "def find_by_id(id)\n id = id.to_i\n\n @id_hash[id]\n end", "def find(id, params = {})\n from_base id, params\n end", "def get_by_id(id)\n if @data == nil\n url = make_url(:fq => \"id:#{id}\")\n\n begin\n @data = Net::HTTP.get(URI.parse(url))\n rescue Exception => e\n @error = \"Unable to connect to #{url}\"\n end\n end\n \n return @data\n end", "def get_by_id(class_name, id)\n @data = get_all()\n for item in @data[class_name]\n if item[\"id\"] == id\n return item\n end\n end\n raise \"#{class_name} id #{id} not found.\"\n end", "def get(id, params={})\n response = Shippo.request(:get, \"#{url}/#{CGI.escape(id)}/\", params)\n self.construct_from(response)\n end", "def find_by_id(client, id, options: {})\n\n self.new(parse(client.get(\"/stories/#{id}\", options: options)).first, client: client)\n end", "def load_by_id(name = nil)\n load_by(:id, name)\n end", "def find(id)\n fetch([name, id]) do\n super\n end\n end", "def get_element id\n @elements[id.to_s]\n end", "def get_sections_for_user(userId)\n @sections = Section.find(:all,:conditions => [\"userId = ?\", userId])\n return @sections\nend" ]
[ "0.83322215", "0.812857", "0.76840365", "0.76193494", "0.70402133", "0.70201045", "0.6900585", "0.6798192", "0.67924684", "0.6786544", "0.6786544", "0.6690141", "0.6687336", "0.6653467", "0.6653467", "0.6653467", "0.6653467", "0.6653467", "0.6653467", "0.6653467", "0.6653467", "0.6653467", "0.6653467", "0.6653467", "0.6653467", "0.6653467", "0.6653467", "0.6653467", "0.6653467", "0.6653467", "0.6653467", "0.6653467", "0.66529787", "0.659771", "0.6578466", "0.653097", "0.6529405", "0.64639217", "0.64564174", "0.6447964", "0.64017874", "0.6391672", "0.6344149", "0.6318752", "0.63020134", "0.62903386", "0.62613255", "0.62428474", "0.62170875", "0.62066567", "0.6205169", "0.6201868", "0.61806065", "0.6180535", "0.61659706", "0.6165887", "0.6162805", "0.6161428", "0.61571974", "0.6156896", "0.6143321", "0.6124322", "0.6115047", "0.61070997", "0.6088804", "0.6086835", "0.6085405", "0.6080714", "0.60798466", "0.60777414", "0.60690093", "0.60665727", "0.60641044", "0.60625273", "0.6053401", "0.6050223", "0.6031718", "0.6031718", "0.60289407", "0.6027358", "0.6021", "0.6012246", "0.60119957", "0.6007897", "0.6004758", "0.6004758", "0.597928", "0.5975429", "0.59610534", "0.59608483", "0.5943617", "0.59389263", "0.59324783", "0.5928025", "0.5905555", "0.5898907", "0.58902633", "0.5880299", "0.5857549", "0.5856343" ]
0.7901185
2
Get section by name Params: section_name: Name of the section Return nil | section
def section_by_name(section_name) result = nil all_sections = sections return result unless all_sections all_sections.each do |section| result = section if section['display_name'] == section_name end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def section_by_name(section_name)\n section = sections.find do |s|\n s.name == section_name\n end\n if section.nil?\n raise RTrail::NotFound.new(\n \"Section '#{section_name}' not found in Suite '#{data.name}'\")\n end\n return section\n end", "def section(name)\n sections.find { |el| el.name == name.to_s }\n end", "def section_by_name(section_name); end", "def [](name)\n name = name.to_s\n each_section do |section|\n return section if section.name == name\n end\n nil\n end", "def section(name)\n self[section_index(name)]\n end", "def get( key_name )\n raise ArgumentError, \"Cannot get from a Nil section name.\" if @section_to_use.nil?\n read( @section_to_use, key_name )\n end", "def get_section(section_id)\n self.sections.find { |s| s.id == section_id }\n end", "def section_of(file, section_name) \n File.read(file).split(/^(?==)/).each do |section|\n lines = section.split(\"\\n\")\n return lines[1..-1].join(\"\\n\").strip if lines.first =~ /#{section_name}/i\n end\n nil\n end", "def as(section_name = nil)\n section section_name\n end", "def section_index(name)\n 0.upto(length - 1) do |index|\n return index if section_name(index) == name\n end\n nil\n end", "def section\n return @section if @section\n\n resp = HTTP\n .headers(authorization: \"Bearer #{access_token[:access_token]}\")\n .get(LIST_SECTIONS_ENDPOINT % notebook[:id], params: {\n select: 'id,name',\n filter: \"name eq '#{Config[:section]}'\"\n })\n if resp.code.to_s.start_with? '2'\n json = response_body(resp)\n @section = JSON.parse(json, symbolize_names: true)[:value].first\n end\n return @section\n end", "def section(ident)\n @sections[ident]\n end", "def [](section_name)\n config[section_name]\n end", "def section\n @section || path_section\n end", "def find_section\n @section = Section.find(params[:section_id])\n end", "def get_section_header section_name\n\t\t\tsec_idx = @sh_idx_map[section_name]\n\n\t\t\t# No such section\n\t\t\treturn nil if sec_idx.nil?\n\n\t\t\tsec_pos = @e_shoff + (sec_idx * @sh_size)\n\t\t\t@bin[sec_pos, @sh_size]\n\t\tend", "def section_by_id(section_id = @one_section_id)\n url = @url_sections + '/' + section_id\n @nsx_client.get(url)\n end", "def has_section?(name)\n sections.has_key?(name)\n end", "def has_section?(name)\n sections.has_key?(name)\n end", "def section_by_id(section_id); end", "def subsection_by_name(subsection_name)\n subsect = subsections.find do |s|\n s.name == subsection_name\n end\n if subsect.nil?\n raise RTrail::NotFound.new(\n \"Sub-Section '#{subsection_name}' not found within Section '#{data.name}'\")\n end\n return subsect\n end", "def section\n @section ||= @hash[@default]\n end", "def section_of( file, section_name )\n re = /^[=#]+ (.*)$/\n sectional = project_path( file )\n parts = sectional.read.split( re )[1..-1]\n parts.map! { |p| p.strip }\n\n sections = Hash.new\n Hash[*parts].each do |k,v|\n sections[k] = v.split(\"\\n\\n\")\n end\n return sections[section_name]\n end", "def get_config_section(section_name)\r\n parse_config unless config_parsed?\r\n JSON.parse exec(\"echo json_encode($config[#{section_name.to_s.inspect}]);\").strip\r\n end", "def []( section )\n return nil if section.nil?\n @ini[section.to_s]\n end", "def section\n section_test.section\n end", "def get_section_data section_name\n\t\t\treturn nil unless @section_h_map.has_key?(section_name)\n\n\t\t\t# ファイル中に実体を持たないセクション\n\t\t\treturn nil if @section_h_map[section_name][:type] == SH_TYPE_NOBITS\n\n\t\t\toffset = @section_h_map[section_name][:offset]\n\t\t\tsize = @section_h_map[section_name][:size]\n\t\t\tsection_data = @bin[offset, size]\n\t\tend", "def section_id\n \"section-#{name}\"\n end", "def get_section(section_id, opts = {})\n data, _status_code, _headers = get_section_with_http_info(section_id, opts)\n data\n end", "def [](section)\n return nil if section.nil?\n\n @ini[section.to_s]\n end", "def section(comment=\"\")\n eval(SECTION, binding, __FILE__, SECTION_LINE)\n nil\nend", "def section_name(index)\n # all sections must be resolved for negative indicies to\n # work correctly (since otherwise @section_names may not\n # have the same length as self)\n resolve_sections if index < 0\n @section_names[index] ||= parse_section_name(index)\n end", "def section\n @section.call\n end", "def section\n return @section if @section\n\n @section = parent.add_section @section_title if parent\n end", "def getSectionNo(section)\r\n\treturn section[\"name\"][-2,2]\r\nend", "def getSectionNo(section)\r\n\treturn section[\"name\"][-2,2]\r\nend", "def subsection(subsection_name_or_id)\n if is_id?(subsection_name_or_id)\n return Section.get(subsection_name_or_id)\n else\n return subsection_by_name(subsection_name_or_id)\n end\n end", "def select_section(section_name)\n result = super(section_name.to_s)\n raise get_message(result) if result != TPL_OK\n @stack.push(section_name.to_sym)\n return true\n end", "def section(name, *args, **options, &block)\n section_class.send(:section, name, *args, **options, &block)\n end", "def find_section_by_usage( usage )\n PageLayout.includes(:section=>:section_piece).where([\"#{PageLayout.table_name}.root_id=? and #{SectionPiece.table_name}.usage=?\",self.page_layout_root_id, usage]).first\n end", "def section(section_name, section_class, element_hash)\n define_method(section_name) do\n section_class.new(find(element_hash.keys[0], element_hash.values[0]))\n end\n end", "def section_name(type, name)\n if type.nil?\n name\n elsif name == 'default'\n type\n else\n \"#{type}:#{name}\"\n end\n end", "def parse_section_name(index) # :nodoc:\n return nil unless index = io_index[index]\n io.pos = index[0] + 1\n parse_content_type(io.readline)[:section_name]\n end", "def show\n \n begin\n @section = @account.sections.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n @section = @account.sections.find_by_name(params[:id]) \n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @section }\n end\n end", "def find_section_by_usage( usage )\n # [\"#{PageLayout.table_name}.root_id=? and #{SectionPiece.table_name}.usage=?\",self.page_layout_root_id, usage]\n PageLayout.includes(:section).where( spree_sections:{usage: usage}, template_theme_id: original_template_theme.id ).first\n end", "def section(name) # :nodoc:\n warn('Config#section is deprecated; use Config#[]')\n @data[name] || {}\n end", "def get_section(id)\n @doc.at_css(\"##{id}\").parent.next_element\n end", "def next_section\n @current_section = Elf.elf_nextscn(self,@current_section)\n\n if @current_section.null?\n @current_section = nil\n return nil\n else\n return Section.new(@current_section)\n end\n end", "def get_section(experiment,section_to_find)\n section = experiment[\"experiment_procedures\"].find(){|ep| ep[\"experiment_procedure\"][\"section_type\"] == section_to_find}\n section[\"experiment_procedure\"] if section\nend", "def section_selected?(section_name)\n if article_id_present?\n current_article.section.name == section_name\n elsif section_id_present?\n current_section.name == section_name\n else # none of the necessary controllers/actions is active\n false\n end\n end", "def has_section?( section_name )\n\n KeyError.not_new( section_name, self )\n\n raise ArgumentError.new \"No file found at [ #{@file_path} ]\" unless File.exists? @file_path\n the_text = File.read @file_path\n raise ArgumentError.new \"This file is empty => [ #{@file_path} ]\" if the_text.empty?\n\n the_data = IniFile.load @file_path\n return the_data.has_section?( section_name )\n\n end", "def section\n return @section unless @section.nil?\n\n comment_sections.each do |text|\n if text =~ /Styleguide \\d/i\n cleaned = text.strip.sub(/\\.$/, '') # Kill trailing period\n @section = cleaned.match(/Styleguide (.+)/)[1]\n end\n end\n\n @section\n end", "def display_resource(section)\n section.name\n end", "def load_section!\n if @extra_page\n @section = current_cookbook.sections.find @extra_page.section_id\n else\n @section = current_cookbook.sections.find params[:section_id]\n end\n end", "def create_section(section_name)\n section_spec = %(\n {\n \"display_name\": \"#{section_name}\",\n \"section_type\": \"LAYER3\",\n \"stateful\": true\n }\n )\n section_id = @nsx_client.post(@url_sections, section_spec)\n result = section_by_id(section_id)\n raise 'Section was not created in DFW' unless result\n\n result\n end", "def section\n BSection.store[@section_id]\n end", "def section?\n !@section.nil?\n end", "def section\n comment_sections.map(&:section).select { |section| section }.last\n end", "def get_section(key)\n return {} unless @config.has_key? key\n\n section = @config[key]\n\n infos = {}\n infos[TITLE] = get_title(section)\n infos[SECTION] = get_unique_values(section)\n infos[SECTION].merge!(get_multiple_values(section))\n\n infos\n end", "def section_name(section_options, parent_section_options)\n section_name = extract_name(parent_section_options)\n section_name = extract_name(replace_section_name(section_options)) if section_name.nil?\n section_name\n end", "def section; end", "def find_pet_by_name(section, name)\n for pet in section[:pets]\n if pet[:name] == name\n return pet\n end\n end\n return nil\nend", "def section?\n type == \"Section\"\n end", "def title(section_id)\n @sections[section_id || 1]\n end", "def section(section_name, parent_id = nil)\n html = \"\"\n parent_id = get_parent_id(parent_id)\n objects_to_render = {}\n Base.where(:'connections.parent_id' => parent_id, :'connections.section' => section_name, :'connections.file'.ne => nil).each do |record|\n connection = record.connections.where(:parent_id => parent_id, :section => section_name, :file.ne => nil).first\n\n if objects_to_render[connection.order_id] == nil\n number = connection.order_id\n else\n number = get_unique_number(objects_to_render, connection.order_id)\n end\n objects_to_render[number] = {:record => record, :connection => connection}\n end\n Hash[objects_to_render.sort].each do |k, object|\n html += show object[:connection].file, {views: [\"app/views/#{object[:record]._type}\", \"app/views/#{object[:record]._type.downcase}\"]}, {record: object[:record]}\n end\n return html\n end", "def _get_section_title(line)\n section_matcher = line.match(SECTION_REGEX)\n unless section_matcher\n return nil\n end\n\n section = section_matcher[0]\n\n # Remove the brackets around the name\n section = section[1..section.length - 2]\n\n if section =~ /\\s/\n raise 'Section name may not contain whitespace: ' << section\n end\n\n section\n end", "def section(section)\n query_filters << \"section_name:#{section}\"\n self\n end", "def current_section_name()\n section_name = @stack[-1]\n return section_name.nil? ? :template : section_name\n end", "def section(name)\n out \"===== #{name} ==== Begin...\"\n @out_sections = [] unless defined?(@out_sections)\n @out_sections << name\n begin\n yield\n ensure\n @out_sections.pop\n out \"===== #{name} ==== ...End\"\n out\n end\n end", "def section?(section)\n @ini.key? section.to_s\n end", "def section(elem_id, elem_title)\n section(elem_id, elem_title, :elem_name=>'section')\n end", "def set_section\n @section = Section.friendly.find(params[:id])\n end", "def section(index)\n nodes.at(index)\n end", "def section=(section)\n section = Section.find_or_create_by(name: section[:name])\n self.section_id = section.id\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def assert_page_section(section_heading)\n Helpers::MobileBrowserHelper.open_section_if_required(section_heading)\n page.all(\".cucumber__clarkordion__item__header--active\").each do |section|\n return nil if section.text.include?(section_heading)\n end\n raise Capybara::ElementNotFound.new(\"Section #{section_heading} was not found\")\n end", "def section_selector\n \"s_#{page_layout.id}_#{page_layout.section_id}\"\n end", "def fetch_section(section)\n if guardian_sections.include? section\n response = $redis.get(\"news_#{section}\")\n if response.nil?\n @section = \"&section=\" + section.to_s\n base_uri = \"http://content.guardianapis.com/search?order-by=newest&type=article\"\n response = JSON.generate(HTTParty.get(base_uri + @section + \"&api-key=\" + ENV['GUARDIAN_API_KEY'])[\"response\"][\"results\"])\n $redis.set(\"news_#{section}\", response)\n $redis.expire(\"news_#{section}\", 1.hours.to_i)\n end\n @response = JSON.load(response)\n else\n fetch_articles\n end\n end", "def find_section\n Section.joins(course: :department).where({\n number: @row.number,\n term: @row.term,\n 'departments.subject_code': @department.subject_code,\n 'courses.course_number': @course.course_number,\n }).first\n end", "def get_child(section, line)\n section.children.each do |child|\n return child if child.line == line\n end\n nil\nend", "def current_section\n if section = @temporary_section then\n @temporary_section = nil\n else\n section = @current_section\n end\n\n section\n end", "def section_contents\n used_sections = {}\n\n each_method do |method|\n next unless method.display?\n\n used_sections[method.section] = true\n end\n\n # order found sections\n sections = sort_sections.select do |section|\n used_sections[section]\n end\n\n # only the default section is used\n return [] if\n sections.length == 1 and not sections.first.title\n\n sections\n end", "def test_list_by_section\n a_section = sections(:pseudoscientific_claims)\n \n get :list_by_section, :section_name => a_section.name\n assert_response :success\n assert_equal assigns(:title), \"Blog entries for #{a_section.name}\"\n assert_template 'index.rhtml'\n assert_not_nil assigns(:content_nodes)\n \n # Assert the blog posts are being shown.\n assert assigns(:sections).size > 0\n assert_select \"a\", :count => 1, :text => content_nodes(:pigasus_awards).title\n assert_select \"a\", :count => 1, :text => content_nodes(:silent_birth).title\n\n\n # Now using an invalid name.\n get :list_by_section, :section_name => \"bleargh\"\n assert_response :missing\n end", "def find_section(file, tag)\n # The generator doesn't support generating only one section.\n # We find the line numbers of the section start and stop.\n lines = file.split(\"\\n\")\n start = nil\n stop = lines.length\n in_section = false\n lines.each_with_index do |line, i|\n if $section_header_regex.match?(line)\n if in_section\n stop = i\n break\n elsif /\\[#{tag}\\]/.match?(line)\n start = i\n in_section = true\n end\n end\n end\n\n raise 'Start of section was not found' if start.nil?\n\n # Join the slice together and process the text a bit.\n lines[start...stop]\n .join(\"\\n\")\n .gsub($number_regex, '(#\\1)')\n .sub($ack_regex, '')\n .sub($changelog_regex, '[Diff since \\2](\\1/compare/\\2...\\3)')\n .strip\nend", "def section title, sym = nil, &block\n raise \"Section already defined\" if @current_section\n raise \"Section #{title} already defined\" if @sections.include? title\n @sections << title\n @current_section = title\n\n @current_keys.push sym.nil? ? title.parameterize.underscore.to_sym : sym.to_sym\n @view_engine&.section&.call title\n instance_eval(&block)\n @current_keys.pop\n\n @current_section = nil\n end", "def process_section(section_name, doc)\n entries = doc.xpath(@sections[section_name])\n if(entries.size == 0)\n return\n end\n @ccr_hash[section_name] = []\n entries.each do | e |\n entry = QME::Importer::Entry.new\n process_codes(e, entry)\n @ccr_hash[section_name] << entry\n end\n end", "def init_section\n one_section = section_by_name(NSXConstants::ONE_SECTION_NAME)\n one_section ||= create_section(NSXConstants::ONE_SECTION_NAME)\n return one_section['id'] if one_section\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end", "def set_section\n @section = Section.find(params[:id])\n end" ]
[ "0.8861133", "0.8657203", "0.8520992", "0.82854223", "0.80107296", "0.76988924", "0.75796956", "0.7544971", "0.74713176", "0.7404547", "0.71865743", "0.71547246", "0.71189713", "0.7028655", "0.70078534", "0.69828504", "0.69499475", "0.69382983", "0.69382983", "0.68813527", "0.6860477", "0.6816968", "0.6753591", "0.67193836", "0.669011", "0.6679029", "0.66283005", "0.6624244", "0.6547556", "0.6484537", "0.64318144", "0.64292085", "0.64160854", "0.64052534", "0.64022887", "0.64022887", "0.6388964", "0.6388251", "0.63735414", "0.63419884", "0.6328806", "0.6311719", "0.6300019", "0.6297219", "0.62665224", "0.6246578", "0.6246076", "0.62007624", "0.6130443", "0.6115331", "0.61081916", "0.60810024", "0.60513264", "0.60372096", "0.6032301", "0.6026672", "0.6021151", "0.60068285", "0.59979665", "0.5992909", "0.5982095", "0.5972818", "0.5969324", "0.5955969", "0.59126365", "0.58853614", "0.58619267", "0.5854777", "0.58129066", "0.58116364", "0.58091867", "0.5801085", "0.57626295", "0.5758651", "0.57521003", "0.57521003", "0.57395744", "0.5734209", "0.5714797", "0.5713964", "0.5708944", "0.5702887", "0.56994706", "0.5696477", "0.56931716", "0.5687543", "0.5666081", "0.56521887", "0.5650935", "0.5650333", "0.5650333", "0.5650333", "0.5650333", "0.5650333", "0.5650333", "0.5650333", "0.5650333", "0.5650333", "0.5650333", "0.5650333" ]
0.86222774
2
Create new section and return the section
def create_section(section_name) section_spec = %( { "display_name": "#{section_name}", "section_type": "LAYER3", "stateful": true } ) section_id = @nsx_client.post(@url_sections, section_spec) result = section_by_id(section_id) raise 'Section was not created in DFW' unless result result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def section_new\n @section = Section.new\n @section_count = Section.count + 1\n @section_position = @section_count\n end", "def add_new_section\n @section = Section.new\n end", "def create_new_section(title, options={})\n send_request('create_new_section', normalize_options(title, options))\n end", "def create_new_section(title, options={})\n send_audit(:kind => :new_section, :text => title, :category => options[:category])\n end", "def new\n @section = Section.new\n end", "def new\n @section = Section.new\n end", "def new\n @section = Section.new(:page_id => @page.id)\n end", "def createSection(section)\r\n uri = sprintf(\"/api/v1/courses/%d/sections/\", $tocid) \r\n \r\n dbg(\"POST #{uri}\")\r\n dbg(\"course_section[name]=#{section[\"name\"]}\")\r\n newSection = $canvas.post(uri, {'course_section[name]' => section[\"name\"]})\r\n dbg(newSection)\r\n return newSection\r\nend", "def create_section(name, section_name, slide_index, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = create_section_with_http_info(name, section_name, slide_index, password, folder, storage)\n data\n end", "def create_sections\n @sections = if @options.configure_sections?\n parse_sections(@options[:configure_sections])\n elsif @options.add_sections?\n default_sections.concat parse_sections(@options[:add_sections])\n else\n default_sections\n end\n nil\n end", "def create\n @section = Section.new(params[:section])\n\n Course.find(params[:section][:add_section]).sections << @section if params[:section][:add_section]\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render json: @section, status: :created, location: @section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def sell_shop_section_create (section_name, params={})\r\n url = api_url \"/sell/shop/sections\"\r\n req = request_params(params)\r\n load = MultiJson.dump name: section_name\r\n\r\n feed_or_retry do\r\n RestClient.post url, load, req\r\n end \r\n end", "def add_section(section, selected_page_layout=nil, attrs={})\n # check section.section_piece.is_container?\n obj = nil\n if section.root? \n section_instance = 1\n if selected_page_layout.present?\n raise ArgugemntError, 'only container could has child section' unless selected_page_layout.section.section_piece.is_container \n whole_tree = selected_page_layout.root.self_and_descendants\n section_instance = whole_tree.select{|xnode| xnode.section_id==section.id}.size.succ\n end\n attrs[:title]||=\"#{section.title}#{section_instance}\" \n obj = PageLayout.create do|obj|\n obj.section_id, obj.section_instance=section.id, section_instance\n obj.assign_attributes( attrs )\n obj.root_id = selected_page_layout.root_id if selected_page_layout.present?\n obj.site_id = SpreeTheme.site_class.current.id\n obj.is_full_html = section.section_piece.is_root?\n end\n if selected_page_layout.present?\n obj.move_to_child_of(selected_page_layout)\n else\n obj.update_attribute(\"root_id\",obj.id)\n end\n #copy the default section param value to the layout\n obj.add_param_value(self)\n end\n obj\n end", "def create_new_sections!(chapter)\n return if chapter['mampf_chapter'].nil?\n mampf_chapter = chapter['mampf_chapter']\n new_sections_in_chapter(chapter).each do |s|\n sect = Section.new(chapter_id: mampf_chapter.id, title: s.second)\n sect.insert_at(s.first)\n corresponding = @sections.find { |d| d['counter'] == s.third }\n corresponding['mampf_section'] = sect\n end\n end", "def create\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to(admin_sections_path, :notice => 'Section was successfully created.') }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_first\n\n @section = Section.find(params[:id])\n\n @new_subsection = Subsection.new\n @new_subsection.section_id = @section.id \n @new_subsection.name = ''\n @new_subsection.note = ''\n \n @new_subsection.date_code_check = @section.date_code_check\n @new_subsection.dot_rev_check = @section.dot_rev_check\n\n end", "def create\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to(@section, :notice => 'Section was successfully created.') }\n format.xml { render :xml => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(section_params)\n if @section.save\n render json: SectionSerializer.new(@section)\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end", "def create\n @section = Section.new(section_params)\n\n if @section.save\n render :show, status: :created, location: @section\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end", "def create\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render json: @section, status: :created, location: @section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_section(name, *fields)\n send(\"#{name}=\", Struct.new(*fields).new)\n end", "def create\n @section = Section.new(section_params)\n\n if @section.save\n redirect_to sections_path, primary: 'Section was successfully created.'\n else\n render :new\n end\n end", "def create\r\n @section = Section.new(params[:section])\r\n\r\n respond_to do |format|\r\n if @section.save\r\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\r\n format.json { render json: @section, status: :created, location: @section }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @section.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @section = Section.new(section_params)\n @section.title = @section.title || \"\"\n\n document = @section.document\n @section.order = 1\n unless document.sections.blank?\n @section.order = document.sections.last.order + 1\n end\n\n @section.visibility = document.visibility\n @section.status = document.status\n\n update_user_attribution @section, true\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.any(:json, :js) { render :show, status: :created, location: @section }\n else\n puts @section.errors.full_messages\n format.html { render :new }\n format.any(:json, :js) { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section,\n notice: 'Section was successfully created.' }\n format.json { render :show,\n status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def add_section(position = nil, section_type = nil)\n section = self.sections.create(Section::DEFAULT_PARAMS)\n section.move_to_bottom\n end", "def section\n return @section if @section\n\n @section = parent.add_section @section_title if parent\n end", "def create\n @sections = Section.find(:all)\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n flash[:notice] = 'Section was successfully created.'\n format.html { redirect_to(@section) }\n format.xml { render :xml => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def insert\n\n @section = Section.find(params[:id])\n @checklist = Checklist.find(@section.checklist_id)\n \n @new_section = @section.dup\n \n @new_section.name = ''\n @new_section.background_color = ''\n\n end", "def add_section title, comment = nil\n if section = @sections[title] then\n section.add_comment comment if comment\n else\n section = Section.new self, title, comment\n @sections[title] = section\n end\n\n section\n end", "def section_created_hook(sender,new_section)\n unless root?\n parent.section_created_hook(sender, new_section)\n else\n new_section\n end\n end", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n # Add section to course.\n if params.has_key?('course_id')\n course_id = params['course_id']\n add_section_to_course(@section, course_id)\n end\n \n format.js { render \"\", json: @section }\n else\n format.js { render json: @section.errors, status: :unprocessable_entity }\n end\n # if add_section_to_course(@section, course_id)\n # # Use the sections helper to create the relation between the section and its course.\n # format.html { redirect_to Course.find(course_id), notice: 'Section was successfully created.' }\n # format.json { render :show, status: :created, location: @section }\n # else\n # format.html { render :new }\n # format.json { render json: @section.errors, status: :unprocessable_entity }\n # end\n end\n end", "def new\n @sections = Section.find(:all) # TODO: refactor so I don't have to repeat this all over the place\n @section = Section.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @section }\n end\n end", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n @section.check_index()\n form_wrapper = FormWrapper.find(@section.form_wrapper_id)\n format.html { redirect_to sections_section_path(form_wrapper), alert: I18n.t('activerecord.models.section.single') + I18n.t('helpers_locale.models.created') }\n format.json { render action: 'show', status: :created, location: @section }\n else\n format.html { render action: 'new' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def insert\n\n @subsection = Subsection.find(params['id'])\n @section = Section.find(@subsection.section_id)\n \n @new_subsection = @subsection.dup\n \n @new_subsection.name = ''\n @new_subsection.note = ''\n\n end", "def section=(section)\n section = Section.find_or_create_by(name: section[:name])\n self.section_id = section.id\n end", "def add_template_in_new_section(page_content, template)\n \"#{page_content}\\n\\n#{section_header}\\n#{template}\\n\"\n end", "def append\n\n @section = Section.find(params[:id])\n @checklist = Checklist.find(@section.checklist_id)\n \n @new_section = @section.dup\n \n @new_section.name = ''\n @new_section.background_color = ''\n\n end", "def add_section(project_id, data = {})\n post(\"add_section/#{project_id}\", body: data.to_json)\n end", "def add_section(fields={})\n section_data = fields.merge({\n :suite_id => data.id,\n })\n return add_entity(Section, data.project_id, section_data)\n end", "def create_section_with_http_info(name, section_name, slide_index, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.create_section ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.create_section\"\n end\n # verify the required parameter 'section_name' is set\n if @api_client.config.client_side_validation && section_name.nil?\n fail ArgumentError, \"Missing the required parameter 'section_name' when calling SlidesApi.create_section\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.create_section\"\n end\n # resource path\n local_var_path = '/slides/{name}/sections'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'sectionName'] = @api_client.prepare_for_query(section_name) unless section_name.nil?\n query_params[:'slideIndex'] = @api_client.prepare_for_query(slide_index) unless slide_index.nil?\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Sections')\n return data, status_code, headers\n end", "def section(name, segname, data='', vmsize=data.size,\n segment=@current_segment, type=S_REGULAR)\n\n # Create the new section.\n section = Section.new(name, segname, @section_offset, vmsize, 0, 0, 0, 0, 0, 0, type)\n\n # Add this section to the map of segment names to sections.\n (@sections[segment[:segname]] ||= []) << section\n @section_disk_size[name] = data.size\n @section_offset += data.size\n @data << data if data.size > 0\n\n # Update the header.\n @header[:sizeofcmds] += section.bytesize\n\n # Update the segment.\n segment[:nsects] += 1\n segment[:cmdsize] += section.bytesize\n\n yield(section) if block_given?\n\n return section\n end", "def create\n @section = Section.new(params[:section])\n @section.page = @page\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @page, :notice => 'Section was successfully created.' }\n format.json { render :json => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def <<(section)\n @sections << section\n self\n end", "def create\n # Instantiate new object using form params\n @section = Section.new(section_params) #use private method below to get permited data for mass assignment\n @section.page = @page\n # Save object\n if @section.save\n # If successful, redirect to index action\n flash[:notice] = \"Section created successfully.\"\n redirect_to(sections_path(:page_id => @page.id))\n else\n # Else, redisplay form so user can fix problems\n render('new') # renders form template with original user data pre-populated\n end\n end", "def add_section(name, file)\n raise \"A section with name #{name} already exists\" if include?(name)\n result = Section.new(name, file)\n @files[file] ||= []\n @files[file] << result\n result\n end", "def create\n @make_section = MakeSection.new(params[:make_section])\n\n respond_to do |format|\n if @make_section.save\n format.html { redirect_to(@make_section, :notice => 'Make section was successfully created.') }\n format.xml { render :xml => @make_section, :status => :created, :location => @make_section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @make_section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(section_params)\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render json: @section }\n else\n format.html { render action: 'new' }\n format.json { render json: ErrorSerializer.serialize(@section.errors), status: :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(params[:section])\n @section.account = @account\n \n # This serves to retreive any article attached to this new section so we can access that article's apge\n @article = find_article if params[:article_id]\n\n respond_to do |format|\n if @section.save\n flash[:notice] = 'Section was successfully created.'\n format.js { redirect_to(account_article_sortings_url(@account, @article, :format=>:js)) if @article}\n format.html { redirect_to(account_sections_url(@account)) }\n format.xml { render :xml => [@account, @section], :status => :created, :location =>[@account, @section] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def process_section(section, content)\n bindings = {\n :section => section,\n :name => @definition.get_name,\n :version => @definition.get_version,\n :description => content,\n }\n page = Calamum::DocGenerator.new(:section)\n page.save_template(\"#{section}.html\", bindings)\n end", "def init_section; end", "def section(*args, &descriptors)\n _instantiate_and_store(:section, *args, &descriptors)\n end", "def create\n @section = Section.new(params[:section])\n \n @section.user_id=session[:userid]\n @section.subject_id=session[:subjectid]\n respond_to do |format|\n if @section.save\n format.html { redirect_to(@section, :notice => 'Section was successfully created.') }\n format.xml { render :xml => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end \n end\n \n end", "def create\n @home = Home.first\n @about = About.first\n\n @section = Section.new(section_params)\n @section.order = Section.all.count+1\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to [:admin, @section], notice: 'Section was successfully created.' }\n format.json { render action: 'show', status: :created, location: @section }\n else\n format.html { render action: 'new' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @join_section = JoinSection.new(params[:join_section])\n\n respond_to do |format|\n if @join_section.save\n format.html { redirect_to(@join_section, :notice => 'JoinSection was successfully created.') }\n format.xml { render :xml => @join_section, :status => :created, :location => @join_section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @join_section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_section_response\n response = Hash.new\n response[:is_searchable] = DocumentPlatform.searchable?\n response[:has_description] = DocumentPlatform.has_description?\n response[:has_metadata] = DocumentPlatform.has_metadata?\n response[:supports_permissions] = DocumentPlatform.supports_permissions?\n response[:sections] = []\n return response\n end", "def add_section(s_ident, off=0, sz=nil, name=nil, \n flgs=Section::DEFAULT_FLAGS, arch_info=nil)\n sz ||= size - off\n s = Bgo::Section.new(s_ident, name, image, image_offset + off, off, sz, \n flgs)\n s.arch_info = arch_info if arch_info\n add_section_object s\n end", "def create\n @section = Section.new(section_params.merge!({ document: Document.find(params[:document_id]) }))\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @example_section = ExampleSection.new(params[:example_section])\n\n respond_to do |format|\n if @example_section.save\n flash[:notice] = 'ExampleSection was successfully created.'\n format.html { redirect_to(@example_section) }\n format.xml { render :xml => @example_section, :status => :created, :location => @example_section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @example_section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @section = Section.new(:name => params[:value])\n @section.resume_id = params[:pk]\n\n if @section.save\n render json: { :results => true }\n else\n render json: { :results => false }\n end\n end", "def create\n @form_section = FormSection.new(form_section_params)\n @form_section.save\n respond_with( [ :admin, @form_section] )\n end", "def create\n @manage_section = Manage::Section.new(manage_section_params)\n\n respond_to do |format|\n if @manage_section.save\n format.html { redirect_to manage_compete_url(@compete), notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @manage_section }\n else\n format.html { render :new }\n format.json { render json: @manage_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = find_post\n @post_section = @post.sections.build(post_section_params)\n\n respond_to do |format|\n if @post_section.save\n format.html { redirect_to admin_post_section_url(@post, @post_section), notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: admin_post_section_url(@post, @post_section) }\n else\n format.html { render :new }\n format.json { render json: @post_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @model_section = ModelSection.new(params[:model_section])\n\n respond_to do |format|\n if @model_section.save\n format.html { redirect_to(@model_section, :notice => 'Model section was successfully created.') }\n format.xml { render :xml => @model_section, :status => :created, :location => @model_section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @model_section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def section; end", "def create_section_event_context\n \n end", "def new\n @section = Section.new(:name => params[:value])\n @section.resume_id = params[:pk]\n\n if @section.save\n render json: { :results => true }\n else\n render json: { :results => false }\n end\n end", "def create\n @post_section = PostSection.new(post_section_params)\n\n respond_to do |format|\n if @post_section.save\n format.html { redirect_to @post_section, notice: 'Post section was successfully created.' }\n format.json { render :show, status: :created, location: @post_section }\n else\n format.html { render :new }\n format.json { render json: @post_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def append_section\n\n new_section = Section.new(params[:new_section])\n existing_section = Section.find(params[:section][:id])\n \n new_section.insert(existing_section.checklist_id, \n existing_section.position + 1) \n\n if new_section.errors.empty?\n flash['notice'] = 'Section appended successfully.'\n redirect_to :controller => 'checklist', \n :action => 'edit',\n :id => existing_section.checklist_id\n else\n flash['notice'] = 'Section append failed - Contact DTG'\n redirect_to :controller => 'section',\n :action => 'append',\n :id => existing_section.id\n\n end\n end", "def create\n @section = Section.new(section_params)\n @course = Course.find(params[:course_id])\n @section.course_id = @course.id\n respond_to do |format|\n if @section.save\n format.html { redirect_to course_section_url(@section.course_id, @section), notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n format.js {}\n else\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n format.js {}\n end\n end\n end", "def create\n product_category = ProductCategory.find(params[:product_section][:product_category_id])\n @product_section = product_category.product_sections.create(params[:product_section])\n \n #@product_section = ProductSection.new(params[:product_section])\n\n respond_to do |format|\n if @product_section.save\n format.html { redirect_to(@product_section, :notice => 'ProductSection was successfully created.') }\n format.xml { render :xml => @product_section, :status => :created, :location => @product_section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @product_section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def insert_section\n\n new_section = Section.new(params[:new_section])\n existing_section = Section.find(params[:section][:id])\n\n new_section.insert(existing_section.checklist_id,\n existing_section.position)\n\n if new_section.errors.empty?\n flash['notice'] = 'Section insert successful.'\n redirect_to(:controller => 'checklist',\n :action => 'edit',\n :id => existing_section.checklist_id)\n else\n flash['notice'] = 'Section insert failed - Contact DTG'\n redirect_to(:controller => 'section',\n :action => 'insert',\n :id => existing_section.id)\n end\n end", "def new\n params_hash = {institution_id: params[:institution_id],\n center_id: params[:center_id],\n academic_class_id: params[:academic_class_id]}\n @section = Section.new(params_hash)\n @section.build_profile\n @section.build_build_info\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @section }\n end\n end", "def create\n @section = Section.new(section_params)\n\n authorize Section\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @section }\n else\n @section_count = Section.count + 1\n\n format.html { render :new }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page_section = PageSection.new(page_section_params)\n\n respond_to do |format|\n if @page_section.save\n format.html { redirect_to @page_section,\n notice: t('shared.msgs.success_created',\n obj: t('activerecord.models.page_section', count: 1)) }\n format.json { render :show, status: :created, location: @page_section }\n else\n format.html { render :new }\n format.json { render json: @page_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def section_by_name(section_name); end", "def create\n @store_section = StoreSection.new(params[:store_section])\n\n respond_to do |format|\n if @store_section.save\n format.html { redirect_to @store_section, notice: 'Store section was successfully created.' }\n format.json { render json: @store_section, status: :created, location: @store_section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @section_configuration = SectionConfiguration.new(section_configuration_params)\n\n respond_to do |format|\n if @section_configuration.save\n format.html { redirect_to @section_configuration, notice: 'Section configuration was successfully created.' }\n format.json { render :show, status: :created, location: @section_configuration }\n else\n format.html { render :new }\n format.json { render json: @section_configuration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @section_heading = SectionHeading.new(params[:section_heading])\n\n respond_to do |format|\n if @section_heading.save\n format.html { redirect_to @section_heading, notice: 'Section heading was successfully created.' }\n format.json { render json: @section_heading, status: :created, location: @section_heading }\n else\n format.html { render action: \"new\" }\n format.json { render json: @section_heading.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize! :manage, CourseSection\n @course_section = CourseSection.new(course_section_params)\n\n respond_to do |format|\n if @course_section.save\n format.html { redirect_to @course_section, notice: 'Course section was successfully created.' }\n format.json { render :show, status: :created, location: @course_section }\n else\n format.html { render :new }\n format.json { render json: @course_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_section = AHomeSection.new(admin_section_params)\n\n respond_to do |format|\n if @admin_section.save\n format.html { redirect_to @admin_section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @admin_section }\n else\n format.html { render :new }\n format.json { render json: @admin_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @course_section = CourseSection.new(course_section_params)\n\n respond_to do |format|\n if @course_section.save\n format.html { redirect_to @course_section, notice: 'Course section was successfully created.' }\n format.json { render action: 'show', status: :created, location: @course_section }\n else\n format.html { render action: 'new' }\n format.json { render json: @course_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def append\n \n @subsection = Subsection.find(params['id'])\n \n @new_subsection = @subsection.dup\n \n @new_subsection.name = ''\n @new_subsection.note = ''\n\n end", "def create\n @survey_section = SurveySection.new(survey_section_params)\n\n respond_to do |format|\n if @survey_section.save\n format.html { redirect_to @survey_section, notice: 'Survey section was successfully created.' }\n format.json { render :show, status: :created, location: @survey_section }\n else\n format.html { render :new }\n format.json { render json: @survey_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def <<(section)\n @sections << section.to_s\n end", "def section_id\n \"section-#{name}\"\n end", "def create\n @play = Play.find(params[:play_id])\n @section = Section.new(params[:section])\n @section.play = @play\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to edit_play_url(@play), notice: 'section was successfully created.' }\n format.json { render json: @section, status: :created, location: @section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @section = Section.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @section }\n end\n end", "def new\n @section = Section.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @section }\n end\n end", "def new\n @section = Section.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @section }\n end\n end", "def section=(section)\n self[:section] = section\n end", "def new\r\n @section = Section.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @section }\r\n end\r\n end", "def section_by_id(section_id); end", "def create\n @menu_section = MenuSection.new(params[:menu_section])\n\n respond_to do |format|\n if @menu_section.save\n format.html { redirect_to @menu_section, notice: 'Menu section was successfully created.' }\n format.json { render json: @menu_section, status: :created, location: @menu_section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @menu_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @section_heading = SectionHeading.new(section_heading_params)\n\n respond_to do |format|\n if @section_heading.save\n format.html { redirect_to @section_heading, notice: 'Section heading was successfully created.' }\n format.json { render :show, status: :created, location: @section_heading }\n else\n format.html { render :new }\n format.json { render json: @section_heading.errors, status: :unprocessable_entity }\n end\n end\n end", "def section(elem_id, elem_title)\n section(elem_id, elem_title, :elem_name=>'section')\n end" ]
[ "0.78976536", "0.7784763", "0.7682556", "0.74519515", "0.7380818", "0.7380818", "0.71151096", "0.70988476", "0.70961267", "0.70697796", "0.6939649", "0.6892472", "0.6851308", "0.66867197", "0.6641996", "0.65986806", "0.6597911", "0.6589953", "0.6589928", "0.6580961", "0.6504052", "0.6494183", "0.6484773", "0.6462522", "0.64566845", "0.6454998", "0.6443884", "0.64427423", "0.64416176", "0.64416176", "0.64416176", "0.64416176", "0.64193046", "0.6418465", "0.6400674", "0.63744724", "0.6360321", "0.6358677", "0.63538134", "0.63375026", "0.633692", "0.6311489", "0.62891364", "0.62885344", "0.6282954", "0.6282503", "0.62799484", "0.62721837", "0.62681186", "0.6260791", "0.6252771", "0.62315273", "0.6212937", "0.61787367", "0.6177174", "0.615964", "0.6155982", "0.61556387", "0.61519194", "0.61505204", "0.61488646", "0.61442137", "0.61429536", "0.6140241", "0.6128558", "0.6124857", "0.6085176", "0.6049486", "0.6017827", "0.601637", "0.601074", "0.6006332", "0.59653926", "0.5948466", "0.59373045", "0.5899638", "0.58914423", "0.5881447", "0.5879105", "0.5861342", "0.5859631", "0.5836326", "0.5834628", "0.58323073", "0.5831285", "0.58238393", "0.5820327", "0.58183485", "0.58175886", "0.58063996", "0.58009756", "0.5779738", "0.5779738", "0.5767389", "0.5765503", "0.5753901", "0.57476753", "0.5744436", "0.57401085", "0.5733208" ]
0.7249533
6
Rules Get all rules of a Section, OpenNebula section if it's not defined Return: [Array]
def rules(section_id = @one_section_id) url = @url_sections + '/' + section_id + '/rules' @nsx_client.get(url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rules\n @rules ||= []\n end", "def rules\n @rules ||= []\n end", "def rules\n @rules=get_endpoint('rule').keys\n end", "def rules_by_name(rule_name, section_id = @one_section_id)\n rules = []\n return rules unless section_id\n\n all_rules = rules(section_id)\n return rules unless all_rules\n\n all_rules['results'].each do |rule|\n rules << rule if rule['display_name'] == rule_name\n end\n rules\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def get_rules(section_id, opts = {})\n data, _status_code, _headers = get_rules_with_http_info(section_id, opts)\n data\n end", "def rules\n @rules.map{|r| [r.name, r.rule]}.to_h\n end", "def get_sections\n symbolize! @rules\n raise \"[body] section on YAML file is needed to generate the report.\" if @rules[:body].nil?\n @sections = {:page => @rules[:page], :body => @rules[:body], :defaults => @rules[:defaults], :groups => {}}\n @sections[:body][:settings][:groups].each { |group| @sections[:groups][group.to_sym] = @rules[group.to_sym] } if has_groups?\n end", "def rules\n return @rules\n end", "def get_rules\r\n @rules\r\n end", "def rules\n @rules ||= {}\n end", "def rules\n cluster.configurationEx.rule\n end", "def rules\n cluster.configurationEx.rule\n end", "def rules\n return [] if @rules.empty?\n @rules.sort_by { |k| k['priority'] }.map { |h| h['rule_name'] }\n end", "def all\n @rules\n end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def get_section_with_rules_list_with_rules(section_id, opts = {})\n data, _status_code, _headers = get_section_with_rules_list_with_rules_with_http_info(section_id, opts)\n data\n end", "def rules_by_regex(regex, section_id = @one_section_id)\n rules = []\n return rules unless section_id\n\n all_rules = rules(section_id)\n return rules unless all_rules\n\n all_rules['results'].each do |rule|\n rules << rule if rule['display_name'].match(regex)\n end\n rules\n end", "def rules\n @rules ||= begin\n @rules = []\n resolve_permissions\n @rules\n end\n end", "def all_defined_rules\n if @group\n @defined_rules.merge(@group.all_defined_rules)\n else\n @defined_rules\n end\n end", "def to_rules\n Array.new.tap do |rules|\n new_rule = Rule.new(rule.chain)\n new_rule.description = \"#{rule.description} (#{self.description})\"\n new_rule.rule = rule.rule.gsub(/\\{\\{(\\w+)\\}\\}/) do\n if value = self.options[$1.to_sym]\n value\n else\n \"{{#{$1}}}\"\n end\n end\n new_rule.action = rule.action\n new_rule.conditions = rule.conditions | self.conditions\n if self.version\n new_rule.versions = [self.version]\n end\n\n if has_host_group?\n host_group = @rule.chain.table.base.host_groups[self.options[:ip]]\n host_group.hosts.each do |key, host|\n host.ips.each do |v, ip|\n hg_rule = new_rule.dup\n hg_rule.description += \" (#{host.name} via #{host_group.name})\"\n hg_rule.rule.gsub!(host_group.name.to_s, ip)\n hg_rule.versions = [v]\n rules << hg_rule\n end\n end\n else\n rules << new_rule\n end\n end\n end", "def rules\n self.class.rules\n end", "def ruleset_rules\n @rulesets.collect do |r|\n [\"# Begin [#{r.name}]\",\n r.firewall_rules,\n \"# End [#{r.name}]\",\n \"\"]\n end\n end", "def all\n @rules ||= raw.values.flatten.map { |rule| Accessibility::Rule.new(rule) }\n end", "def rules\n @rules.dup.freeze\n end", "def get_rules\n rules = Array.new\n\n RULE_TYPES.each do |reg|\n ebtables_exit = `#{CONF[:ebtables]} -L FORWARD`\n\n rules << ebtables_exit.split(\"\\n\")[3..-1].collect do |l|\n line = l.strip\n m = line.match(reg)\n\n if m\n interface=m[1]\n {\n :interface => interface, \n :rule => line\n }\n else\n nil\n end\n end.compact\n end\n\n rules.flatten\nend", "def rules\n rule_applier.rules\n end", "def rules_by_name; end", "def rules\n return @rules unless @rules.nil?\n\n # this initialization code runs only once\n @rules = {}\n 7.downto(0).each do |rule_key|\n key = rule_key.to_s(2).rjust(3, '0') # convert to binary, pad left with 0\n @rules[key.to_sym] = RULE_NAME >> rule_key & 1 # just the one bit\n end\n\n @rules\n end", "def defined_rules\n @defined_rules ||= {}\n end", "def rules\n #\n # This is called first in case any preable needs to be declared (chains, specifically)\n #\n _ruleset_rules = ruleset_rules\n\n [\n Asbestos.firewall.preamble(self),\n _ruleset_rules,\n Asbestos.firewall.postamble(self)\n ].flatten\n end", "def rules(rule_name:, kind:)\n Rules::RuleSet.build_for(calendar: calendar, kind: kind).rules_with_name(rule_name)\n end", "def rules\n @rules ||= Rules.new(path, logger)\n end", "def load_rules; end", "def parse_rules(rules)\n rules.split(\"\\n\").each_with_object({}) do |rule, rule_hsh|\n mdata = /\\s{3}(\\w+)\\s/.match(rule)\n case mdata.nil? ? nil : mdata[1]\n when 'match'\n rule_hsh[:match] = [] unless rule_hsh.include?(:match)\n rule_hsh[:match] << rule.sub('match', '').strip\n when 'set'\n rule_hsh[:set] = [] unless rule_hsh.include?(:set)\n rule_hsh[:set] << rule.sub('set', '').strip\n when 'continue'\n rule_hsh[:continue] = nil unless rule_hsh.include?(:continue)\n rule_hsh[:continue] = rule.sub('continue', '').strip.to_i\n when 'description'\n rule_hsh[:description] = nil unless rule_hsh.include?(:description)\n rule_hsh[:description] = rule.sub('description', '').strip\n end\n end\n end", "def get_all_config_rules\n config_rules = []\n\n # Fetch all rules with pagination\n response = @client.describe_config_rules\n config_rules += response.config_rules\n while response.next_token\n response = @client.describe_config_rules(next_token: response.next_token)\n config_rules += response.config_rules\n end\n config_rules = config_rules.map(&:to_h)\n\n # Add necessary data to rules using helpers\n add_compliance_to_config_rules(config_rules)\n add_results_to_config_rules(config_rules)\n end", "def GetRules\n Builtins.y2milestone(\"Getting Rules: %1\", @tomerge)\n\n scheme = AutoinstConfig.scheme\n host = AutoinstConfig.host\n filepath = AutoinstConfig.filepath\n directory = AutoinstConfig.directory\n\n valid = []\n stop = false\n Builtins.foreach(@tomerge) do |file|\n if !stop\n dir = dirname(file)\n if dir != \"\"\n SCR.Execute(\n path(\".target.mkdir\"),\n Ops.add(Ops.add(AutoinstConfig.local_rules_location, \"/\"), dir)\n )\n end\n\n localfile = Ops.add(\n Ops.add(AutoinstConfig.local_rules_location, \"/\"),\n file\n )\n if !Get(\n scheme,\n host,\n Ops.add(Ops.add(directory, \"/\"), file),\n localfile\n )\n Builtins.y2error(\n \"Error while fetching file: %1\",\n Ops.add(Ops.add(directory, \"/\"), file)\n )\n else\n stop = true if @Behaviour == :one\n valid = Builtins.add(valid, file)\n end\n end\n end\n @tomerge = deep_copy(valid)\n if Builtins.size(@tomerge) == 0\n Builtins.y2milestone(\"No files from rules found\")\n return false\n else\n return true\n end\n end", "def sections\n @body.xpath('.//a:section', a: NS)\n end", "def rules=(value)\n @rules = value\n end", "def consume_rules(flags = {})\n rules = []\n\n while token = @tokens.consume\n case token[:node]\n when :comment, :whitespace\n rules << token\n\n when :cdc, :cdo\n unless flags[:top_level]\n @tokens.reconsume\n rule = consume_qualified_rule\n rules << rule if rule\n end\n\n when :at_keyword\n @tokens.reconsume\n rule = consume_at_rule\n rules << rule if rule\n\n else\n @tokens.reconsume\n rule = consume_qualified_rule\n rules << rule if rule\n end\n end\n\n rules\n end", "def to_list\n rules.map do |rule|\n object = { actions: rule.actions, subject: rule.subjects.map{ |s| s.is_a?(Symbol) ? s : s.name } }\n object[:conditions] = rule.conditions unless rule.conditions.blank?\n object[:inverted] = true unless rule.base_behavior\n object\n end\n end", "def rulelist(ruleset, ctx)\r\n\r\n outlist = \"\"\r\n\r\n ruleset.rules.each do |ralias|\r\n rname = ctx.rules[ralias].name\r\n outlist += reference(\"rule\", rname)\r\n\r\n end # rules.each\r\n\r\n return outlist\r\n\r\n end", "def get_relevant_rules\r\n @relevant_rules = Array.new\r\n @facts.each { |k,f| \r\n add_relevant_rules_for_fact f\r\n }\r\n sort_relevant_rules\r\n end", "def load_cop_rules(rules); end", "def construct_rules rules\n parsed_rules = {:rules => []}\n rules.each do |rule|\n parsed_rules[:rules] << rule.attributes\n end\n parsed_rules.to_json\n end", "def rules(event)\n @rules[event]\n end", "def validation_rules\n []\n end", "def sections\n temp_sections = []\n if @section_ids.count > 0\n @section_ids.each do |section_id|\n temp_sections.push @client.section(@org_id, section_id)\n end\n end\n return temp_sections\n end", "def get_rules(service=Azure::ServiceBus::Rules)\n service.all(self)\n end", "def list_plugin_rules\n nessus_rest_get('plugin-rules')['plugin-rules']\n end", "def rules_from_step_content\n @rules_from_step_content ||= content_items.each_with_object({}) do |content_item, items|\n items[content_item[\"content_id\"]] = build_rule(content_item)\n end\n end", "def rules\n Gorilla.units[name] ||= {}\n end", "def all\n rules = []\n\n raw.each do |type, details|\n # Add general rules\n Array(details['prefix']).each do |prefix|\n rules.push({\n prefix: prefix.to_s,\n length: details['length'],\n type: type\n })\n end\n\n # Process each country\n Array(details['countries']).each do |country, prefixes|\n # Add a rule for each prefix\n Array(prefixes).each do |prefix|\n rules.push({\n prefix: prefix.to_s,\n length: details['length'],\n type: type,\n country: country,\n })\n end\n end\n\n end\n\n # Sort by prefix length\n rules.sort { |x, y| y[:prefix].length <=> x[:prefix].length }\n end", "def rules(options={})\n get('getNotificationRules', options)\n end", "def rule(expression, &block)\n case expression\n when Hash\n expression.each do |fact, task|\n fact = define_fact(fact)\n task = define_task(task)\n @rules << Rule.new(fact, &task)\n end\n else\n fact = define_fact(expression)\n @rules << Rule.new(fact, &block)\n end\n\n #rule = Rule.new(@_facts, get_rule_options, &procedure)\n #@rules << rule\n #clear_rule_options\n\n return @rules\n end", "def printRules\n\t\n\t@i = 1\n\t@@rulesArray.each do |rule|\n\t\tputs \"#{@i}-#{rule.fetch('src_ip')}/#{rule.fetch('src_netmask')}:#{rule.fetch('src_port')} #{rule.fetch('dest_ip')}/#{rule.fetch('dest_netmask')}:#{rule.fetch('dest_port')} #{rule.fetch('protocol')} #{rule.fetch('action')}\"\n\t\t@i += 1\n\tend\n\n\tif @i == 1\n\t\tputs \"No rules to print!\"\n\telse\n\t\tputs \"Rules Loaded!\"\n\tend\nend", "def get_rules(scope = nil)\n path = scope ? \"/pushrules/#{scope}\" : '/pushrules'\n make_request(:get, path).parsed_response\n end", "def rule_names\n @rule_names ||= []\n end", "def rule_names\n @rule_names ||= []\n end", "def when_rules\n @when_rules ||= []\n end", "def rules_containing(production)\n rules = []\n @rules.each do |rule|\n rules << rule if rule.productions.include?(production)\n end\n rules\n end", "def parse_rules(rules)\n rules.split(\"\\n\").map do |rule|\n rule_name,r1,r2,r3,r4 = rule.match(/^([\\w\\s]+): (\\d+)-(\\d+) or (\\d+)-(\\d+)$/i).captures\n [rule_name,[(r1.to_i..r2.to_i),(r3.to_i..r4.to_i)]]\n end.to_h\n end", "def included_rules\n @included_rules ||= {}\n end", "def risk_rules\n @risk.rules.map { |rule| Item.new(resolve(rule)) }.compact.reject { |i| i.disabled? }\n end", "def properties\n properties = []\n\n rules.values.each do |declarations|\n declarations.each {|property, value| properties << [property, value] }\n end\n \n properties\n end", "def known_rules\n @table.keys\n end", "def sections\n result = @nsx_client.get(@url_sections)\n result['results']\n end", "def security_rules\n return unless exists?\n @security_rules ||= properties.securityRules\n end", "def rule_set\n @rule_set ||= Rules::RuleSet.build_for(calendar: calendar, kind: kind)\n end", "def rules # :nodoc:\n # Rules should always be returned sorted with oldest first.\n @rules.sort! { |a, b| b[:age] <=> a[:age] }\n end", "def load_rules\n # Find rules file\n rules_filename = [ 'Rules', 'rules', 'Rules.rb', 'rules.rb' ].find { |f| File.file?(f) }\n raise Nanoc3::Errors::NoRulesFileFound.new if rules_filename.nil?\n\n # Get rule data\n @rules = File.read(rules_filename)\n @rules_mtime = File.stat(rules_filename).mtime\n\n # Load DSL\n dsl.instance_eval(@rules)\n end", "def section_contents\n used_sections = {}\n\n each_method do |method|\n next unless method.display?\n\n used_sections[method.section] = true\n end\n\n # order found sections\n sections = sort_sections.select do |section|\n used_sections[section]\n end\n\n # only the default section is used\n return [] if\n sections.length == 1 and not sections.first.title\n\n sections\n end", "def rules( *new_values )\n\t\tself.rules = new_values unless new_values.empty?\n\t\treturn @rules\n\tend", "def sections\n @blocks.inject([]) {|collector, block|\n collector << block if block.is_a?(Section)\n collector\n }\n end", "def all_sections\n [ header_section ] + sections\n end", "def applicable_reources\n self.section.self_and_descendants(:include=>:section_piece).select{|node|\n node.section_piece.resources\n }.select{|resource| resource.present?}\n end", "def get_section_with_rules_list_with_rules_with_http_info(section_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesFirewallApi.get_section_with_rules_list_with_rules ...'\n end\n # verify the required parameter 'section_id' is set\n if @api_client.config.client_side_validation && section_id.nil?\n fail ArgumentError, \"Missing the required parameter 'section_id' when calling ManagementPlaneApiServicesFirewallApi.get_section_with_rules_list_with_rules\"\n end\n # resource path\n local_var_path = '/firewall/sections/{section-id}?action=list_with_rules'.sub('{' + 'section-id' + '}', section_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(: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 => 'FirewallSectionRuleList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesFirewallApi#get_section_with_rules_list_with_rules\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def sections\n return @sections\n end", "def external_rules\n @external_rules ||= rules.dup.external\n end", "def each(&block)\n @rules.each(&block)\n end", "def rules(enabled: nil, fields: nil, include_fields: nil, stage: nil, page: nil, per_page: nil)\n request_params = {\n enabled: enabled,\n fields: fields,\n include_fields: include_fields,\n stage: stage,\n page: page,\n per_page: per_page\n }\n get(rules_path, request_params)\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end", "def then_rules\n @then_rules ||= []\n end", "def rules_ids\n @rules_registry.rules.map(&:id)\n end", "def section_groups\n return @section_groups\n end", "def export_rules(hits_per_page = 100, request_options = {}, &_block)\n res = []\n page = 0\n loop do\n curr = search_rules('', { :hitsPerPage => hits_per_page, :page => page }, request_options)['hits']\n curr.each do |rule|\n res << rule\n yield rule if block_given?\n end\n break if curr.size < hits_per_page\n page += 1\n end\n res\n end", "def rules1\n @rules1\nend", "def rules_for(aNonTerm)\n rules.select { |a_rule| a_rule.lhs == aNonTerm }\n end", "def read_rules\n fields = table.auditor.config[:audit][:tables][table.name.to_sym][:fields]\n config = fields && fields[name.to_sym]\n config = config ? config[:rules] : { insert: [], update: [] }\n\n if config[:update].empty? \n config[:update] << Watchy::DefaultUpdateRule.new(name)\n end\n\n config\n end" ]
[ "0.7178252", "0.7178252", "0.6827643", "0.6758144", "0.67529285", "0.67529285", "0.67529285", "0.6748341", "0.6725025", "0.66927266", "0.6680149", "0.664293", "0.66340744", "0.6482018", "0.6482018", "0.639741", "0.63935256", "0.63638026", "0.63638026", "0.63638026", "0.63638026", "0.63638026", "0.63638026", "0.63638026", "0.6324629", "0.62904185", "0.62710106", "0.6084333", "0.6047062", "0.60422677", "0.6041956", "0.59906423", "0.59816617", "0.59806013", "0.59620684", "0.5961389", "0.5940432", "0.59183484", "0.5860001", "0.58490115", "0.58054274", "0.578059", "0.57774955", "0.5763898", "0.5723071", "0.56977224", "0.56879056", "0.56797385", "0.5660758", "0.5618894", "0.5595352", "0.55924976", "0.5590184", "0.55862", "0.55801874", "0.55742705", "0.55727625", "0.556895", "0.5566534", "0.55474997", "0.55459243", "0.55329514", "0.55328864", "0.55319124", "0.55243456", "0.5522086", "0.5522086", "0.55060613", "0.5493912", "0.54811436", "0.5473417", "0.5467313", "0.5428033", "0.54267305", "0.5420171", "0.5415896", "0.54091847", "0.54050595", "0.538625", "0.5383353", "0.5382548", "0.5366743", "0.53503287", "0.53484195", "0.5339772", "0.5339167", "0.5317445", "0.5309053", "0.530162", "0.529602", "0.529602", "0.529602", "0.529602", "0.52925956", "0.5291159", "0.5279197", "0.5273428", "0.52699697", "0.5255128", "0.52505034" ]
0.7895761
0
Get rule by id Return: rule | nil
def rule_by_id(rule_id) url = @base_url + '/rules/' + rule_id valid_codes = [NSXConstants::CODE_CREATED, NSXConstants::CODE_OK, NSXConstants::CODE_BAD_REQUEST, NSXConstants::CODE_NOT_FOUND] additional_headers = [] @nsx_client.get(url, additional_headers, valid_codes) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rule(rule_id)\n get(\"rules/#{rule_id}\")\n end", "def by_id(id)\n @rules.select { |rule| rule.id == id }\n end", "def find_rule(id)\n @sec_grp_objs.select { |security_group| security_group.rules.select{ |rule| rule.id == id }}\n end", "def rule_by_id; end", "def get_rule(rule)\n @rules[rule]\n end", "def get_rule(scope, kind, id)\n make_request(:get, \"/pushrules/#{scope}/#{kind}/#{id}\").parsed_response\n end", "def retrieve_rule(rule_name)\n\n # convert to symbol\n rule_name = rule_name.to_sym\n\n # raise error if rule doesn't exist\n raise \"Rule with name '#{rule_name}' doesn't exist\" unless @rules.has_key? rule_name\n\n # return the rule\n @rules[rule_name]\n\n end", "def get_rule(section_id, rule_id, opts = {})\n data, _status_code, _headers = get_rule_with_http_info(section_id, rule_id, opts)\n data\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule(rule_id, fields: nil, include_fields: nil)\n raise Auth0::InvalidParameter, 'Must supply a valid rule id' if rule_id.to_s.empty?\n path = \"#{rules_path}/#{rule_id}\"\n request_params = {\n fields: fields,\n include_fields: include_fields\n }\n get(path, request_params)\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def set_rule\n @rule = Rule.find(params[:id])\n end", "def rule\n @rule ||= resolve!\n end", "def rule\n @rule ||= resolve!\n end", "def rule(name)\n begin\n @name=name\n @content=get_rest \"rules/#{@name}\"\n rescue Stingray::NotFoundError \n nil\n end\n end", "def get_rule(rule_name)\n r = @grammar.get_locally_defined_rule(rule_name)\n i = 0\n while (r).nil? && !(@children).nil? && i < @children.size\n child = @children.get(i)\n r = child.get_rule(rule_name)\n i += 1\n end\n return r\n end", "def rule_get(ref)\n rule_table.get(self, setup_package_id(ref))\n end", "def get_budget_rule(id, opts = {})\n data, _status_code, _headers = get_budget_rule_with_http_info(id, opts)\n data\n end", "def id\n @id ||= Rule.new_id\n end", "def get_bre_rule(id, opts = {})\n data, _status_code, _headers = get_bre_rule_with_http_info(id, opts)\n return data\n end", "def find_rule(input)\r\n result = nil\r\n @rules.each do |rule|\r\n result = rule if rule.input == input\r\n end\r\n result\r\n end", "def get_area_rule(id, opts = {})\n data, _status_code, _headers = get_area_rule_with_http_info(id, opts)\n data\n end", "def get_rule(name, service=Azure::ServiceBus::Rules)\n service.get(self, name)\n end", "def read_firewall_rule(rule_id, opts = {})\n data, _status_code, _headers = read_firewall_rule_with_http_info(rule_id, opts)\n data\n end", "def rule_line_match(rule_id)\n rule_id = rule_id.chomp\n matches = /^([a-zA-Z]*?[0-9]+)\\s*(.*)/.match(rule_id)\n return false if matches.nil?\n\n matches.captures.first\n end", "def get_rule(method)\n return Rules::Rule.enabled if rule_engine.nil?\n control_id = rule_control_id(method).to_sym\n rule_engine.evaluate(control_id)\n end", "def for_rule(rule_name)\n @rules.fetch(rule_name.to_sym, {})\n end", "def get_timeframe_rule(id, opts = {})\n data, _status_code, _headers = get_timeframe_rule_with_http_info(id, opts)\n data\n end", "def resolve!\n rule = grammar.rule(rule_name)\n\n unless rule\n raise Error, \"No rule named \\\"#{rule_name}\\\" in grammar #{grammar}\"\n end\n\n rule\n end", "def find_location_rule\n @rule = Locationrule.where(:id => params[:id]).first\n unless @rule\n flash[:notice]=_('Location_rule_was_not_found')\n redirect_to :action => :localization and return false\n end\n check_location_rule_owner\n end", "def rule_at(key)\n begin\n ( defined?(key.to_int) ? @rules[key.to_int] : @rules[@names.find_index(key.to_s)] )\n rescue TypeError # no implicit conversion from nil to integer\n nil\n # raise TypeError, \"Specified key (#{key.inspect}) is not found for the rules among the registered names=#{@names.inspect}\"\n end\n end", "def set_rule\n @rule = Rule.find_by id: params[:id], user: current_user\n end", "def rule(rule_str, player: :any, default: nil)\n @rule_heirarchy.each do |rule_set|\n # check rule unless it doesn't apply to player\n next unless rule_set.affects? player\n # lookup rule -- move to next if rule not found\n return rule_set[rule_str, default: default] rescue next\n end\n raise RuleSet::UnknownRule, rule_str\n end", "def update(id, rule)\n rule = fix_conditions(rule)\n @rule = Rule.get(id)\n raise NotFound unless @rule\n if @rule.update(rule)\n redirect resource(@rule)\n else\n display @rule, :edit\n end\n end", "def rules_by_name(rule_name, section_id = @one_section_id)\n rules = []\n return rules unless section_id\n\n all_rules = rules(section_id)\n return rules unless all_rules\n\n all_rules['results'].each do |rule|\n rules << rule if rule['display_name'] == rule_name\n end\n rules\n end", "def rule\n verify_ajax_request\n require_parameters :id\n rule_key = params[:id].split(':')\n @rule = Rule.first(:conditions => ['plugin_name=? and plugin_rule_key=?', rule_key[0], rule_key[1]], :include => :rule_note)\n render :partial => 'issue/rule'\n end", "def set_field_rule\n @field_rule = FieldRule.find(params[:id])\n end", "def rules(section_id = @one_section_id)\n url = @url_sections + '/' + section_id + '/rules'\n @nsx_client.get(url)\n end", "def resolve!\n rule = grammar.rule(rule_name)\n raise RuntimeError, 'No rule named \"%s\" in grammar %s' %\n [rule_name, grammar.name] unless rule\n rule\n end", "def get_rules(section_id, opts = {})\n data, _status_code, _headers = get_rules_with_http_info(section_id, opts)\n data\n end", "def get_time_of_order_rule(id, opts = {})\n data, _status_code, _headers = get_time_of_order_rule_with_http_info(id, opts)\n data\n end", "def rule=(rule)\n write_attribute :rule_id, case rule\n when ReputationRule\n rule.id\n else \n ReputationRule.find_by_name( rule ).try(:id)\n end\n end", "def delete_rule(rule_id)\n request({\n 'Action' => 'DeleteRule',\n 'RuleArn' => rule_id,\n :parser => Fog::Parsers::AWS::ELBV2::Empty.new\n })\n end", "def rule(rule)\r\n\r\n # Rule output is generated in GdlDoc.visitRule()\r\n return rule.src\r\n\r\n end", "def find_rule(aRuleName) abstract_method\n end", "def get_area_rule_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AreaRulesApi.get_area_rule ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling AreaRulesApi.get_area_rule\"\n end\n # resource path\n local_var_path = '/area_rules/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Basic']\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 => 'AreaRule')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AreaRulesApi#get_area_rule\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def read_gateway_rule_0(domain_id, gateway_policy_id, rule_id, opts = {})\n data, _status_code, _headers = read_gateway_rule_0_with_http_info(domain_id, gateway_policy_id, rule_id, opts)\n data\n end", "def resource(id)\n CODES.select{|hash| hash.has_key?(id.to_s)}[0]\n end", "def set_event_rule\n @event_rule = EventRule.find(params[:id])\n end", "def show\n @field_rule = FieldRule.find(params[:id])\n @object_rule = ObjectRule.find(params[:object_rule_id])\n end", "def get_ruleset(application_id, campaign_id, ruleset_id, opts = {})\n data, _status_code, _headers = get_ruleset_with_http_info(application_id, campaign_id, ruleset_id, opts)\n data\n end", "def parse_firewall_rule(rule_name)\n raise \"Firewall rule '#{rule_name}' does not exist.\" unless firewall_rule_exists?(rule_name)\n\n script_code = \"netsh advfirewall firewall show rule name=\\'#{rule_name}\\' verbose\"\n cmd = log_powershell_out('parse', script_code)\n rule = {}\n parse_key_value_lines(rule, cmd.stdout)\n return rule\n end", "def first\n sort_if_needed\n @rules.first\n end", "def get_bre_rule_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RuleEngineRulesApi.get_bre_rule ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling RuleEngineRulesApi.get_bre_rule\"\n end\n # resource path\n local_var_path = \"/bre/rules/{id}\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\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 => 'BreRule')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RuleEngineRulesApi#get_bre_rule\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def read_firewall_rule_with_http_info(rule_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesFirewallApi.read_firewall_rule ...'\n end\n # verify the required parameter 'rule_id' is set\n if @api_client.config.client_side_validation && rule_id.nil?\n fail ArgumentError, \"Missing the required parameter 'rule_id' when calling ManagementPlaneApiServicesFirewallApi.read_firewall_rule\"\n end\n # resource path\n local_var_path = '/firewall/rules/{rule-id}'.sub('{' + 'rule-id' + '}', rule_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FirewallRule')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesFirewallApi#read_firewall_rule\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_rule\n\n current_rule = Rule.find_by(id: params[:rule_id])\n\n #rule information\n @rule = current_rule\n # @rule_last_triggered = current_rule.last_triggered\n if @rule != nil\n #portfolio information\n @portfolio = current_rule.portfolio\n end\n\n if params[:type] == \"iframe\"\n render :layout=> \"iframe_rule\"\n else\n render :layout=> \"application\"\n end\n\n\n end", "def set_test_rule\n @test_rule = TestRule.find(params[:id])\n end", "def get_rule(method)\n object_name = self.name\n key = \"#{object_name}::#{method}\"\n method_validation = validator.methods_loaded[key.to_sym]\n unless method_validation.nil?\n return method_validation.parameters\n end\n nil\n end", "def super_rule(name)\n sym = name.to_sym\n included_grammars.each do |grammar|\n rule = grammar.rule(sym)\n return rule if rule\n end\n nil\n end", "def rule name\n @rule_map[name.downcase]\n end", "def get_budget_rule_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BudgetRulesApi.get_budget_rule ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling BudgetRulesApi.get_budget_rule\"\n end\n # resource path\n local_var_path = '/budget_rules/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Basic']\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 => 'BudgetRule')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BudgetRulesApi#get_budget_rule\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_rulemaking\n @rulemaking = Rulemaking.find(params[:id])\n end", "def set_certificate_rule\n @certificate_rule = CertificateRule.find(params[:id])\n end", "def get_forwarding_rule(identifier, opts = {})\n data, _status_code, _headers = get_forwarding_rule_with_http_info(identifier, opts)\n return data\n end", "def [](key)\n @@rules[key]\n end", "def get_timeframe_rule_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TimeframeRulesApi.get_timeframe_rule ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling TimeframeRulesApi.get_timeframe_rule\"\n end\n # resource path\n local_var_path = '/timeframe_rules/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Basic']\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 => 'TimeframeRule')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TimeframeRulesApi#get_timeframe_rule\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_site_rule\n @site_rule = SiteRule.find(params[:id])\n end", "def set_reminder_rule\n @reminder_rule = ReminderRule.find(params[:id])\n end", "def get_rule_with_http_info(section_id, rule_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesFirewallApi.get_rule ...'\n end\n # verify the required parameter 'section_id' is set\n if @api_client.config.client_side_validation && section_id.nil?\n fail ArgumentError, \"Missing the required parameter 'section_id' when calling ManagementPlaneApiServicesFirewallApi.get_rule\"\n end\n # verify the required parameter 'rule_id' is set\n if @api_client.config.client_side_validation && rule_id.nil?\n fail ArgumentError, \"Missing the required parameter 'rule_id' when calling ManagementPlaneApiServicesFirewallApi.get_rule\"\n end\n # resource path\n local_var_path = '/firewall/sections/{section-id}/rules/{rule-id}'.sub('{' + 'section-id' + '}', section_id.to_s).sub('{' + 'rule-id' + '}', rule_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'FirewallRule')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesFirewallApi#get_rule\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_lar_rule\n @lar_rule = LarRule.find(params[:id])\n end", "def applied_by_rule=(rule_id)\n\t\t\t@dict.set_attribute 'IterativeSG', 'applied_by_rule', rule_id\n\t\t\t@applied_by_rule = rule_id\n\t\tend", "def find(id)\n resource_hash = PrestaShop.get :resource => self.resource,\n :id => id\n\n resource_hash.nil? ? nil : self.new(resource_hash)\n end", "def set_rule_assignment\n @rule_assignment = RuleAssignment.find(params[:id])\n end", "def rule_name\n return @rule_name\n end", "def read_gateway_rule(domain_id, gateway_policy_id, rule_id, opts = {})\n data, _status_code, _headers = read_gateway_rule_with_http_info(domain_id, gateway_policy_id, rule_id, opts)\n data\n end", "def find\n Campaign.find(:first, :id => @id)\n end", "def find(id)\n where({'id' => \"#{id}\"}).first\n end", "def match_with_rules(line)\n matched_rule = @rules.detect {|rule| rule.match(line)}\n matched_rule ? matched_rule.last_diff : nil\n end", "def get_rules\r\n @rules\r\n end", "def resolve!\n rule = grammar.super_rule(rule_name)\n\n unless rule\n raise Error,\n \"No rule named \\\"#{rule_name}\\\" in hierarchy of grammar #{grammar}\"\n end\n\n rule\n end", "def has_rule?(name)\n rules.key?(name.to_sym)\n end", "def has_rule?(name)\n rules.key?(name.to_sym)\n end", "def rule; end", "def rule; end", "def rule; end", "def get_rules(store_id, opts = {})\n data, _status_code, _headers = get_rules_with_http_info(store_id, opts)\n return data\n end", "def check_valid_rule_id(rule_id)\n return true unless @rules_registry.by_id(rule_id).nil?\n\n raise \"#{rule_id} is not a legal rule identifier from: #{rules_ids}\"\n end", "def add_rule(name, rule, &action)\n m = @rules.find {|r| r.name == name}\n action = @default_action if action.nil?\n if m.nil?\n @rules << Rule.new(name, rule, action)\n else\n m.rule = rule\n m.action = action\n end\n end", "def set_host_rule\n @host_rule = HostRule.find(params[:id])\n end", "def find(id)\n # Used where so no exception will be raised if the instance\n # does not exist.\n @model.unscoped.where(@model_data['mappings']['id'].to_sym => id).first\n end", "def plugin_rule_delete(rule_id)\n nessus_rest_delete(\"plugin-rules/#{rule_id}\")\n end" ]
[ "0.85478216", "0.7914231", "0.7713439", "0.7683067", "0.7523674", "0.72039235", "0.7026709", "0.70066994", "0.70030755", "0.70030755", "0.70030755", "0.70030755", "0.70030755", "0.6923857", "0.6869011", "0.6869011", "0.6869011", "0.6869011", "0.6817288", "0.6817288", "0.6817288", "0.67493236", "0.67493236", "0.6735445", "0.6718482", "0.6684701", "0.66727525", "0.66674405", "0.66268665", "0.65689737", "0.6535285", "0.64972466", "0.6425288", "0.63815725", "0.63702327", "0.63492024", "0.6340494", "0.6297314", "0.6244702", "0.622881", "0.6209467", "0.61322325", "0.6101138", "0.6084637", "0.6070849", "0.60286963", "0.600591", "0.60033447", "0.59307206", "0.59065825", "0.58989435", "0.58854383", "0.5884483", "0.5846465", "0.5810104", "0.57928365", "0.5718415", "0.56962997", "0.5680915", "0.5678274", "0.5659614", "0.56594414", "0.564451", "0.5643512", "0.56297827", "0.56061596", "0.5595679", "0.5558223", "0.5558181", "0.55316997", "0.5527206", "0.55033666", "0.5501713", "0.54961985", "0.5490525", "0.54776615", "0.54770696", "0.5473374", "0.5437442", "0.5435275", "0.54246217", "0.5423234", "0.53956", "0.53647804", "0.5344912", "0.5315111", "0.5314922", "0.531443", "0.53138894", "0.53050953", "0.53050953", "0.5301978", "0.5301978", "0.5301978", "0.52952707", "0.52895993", "0.52857745", "0.5278539", "0.52750885", "0.5267928" ]
0.7895726
2
Get rules by name Return: Array with rules or an empty array
def rules_by_name(rule_name, section_id = @one_section_id) rules = [] return rules unless section_id all_rules = rules(section_id) return rules unless all_rules all_rules['results'].each do |rule| rules << rule if rule['display_name'] == rule_name end rules end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rules_by_name; end", "def rules\n @rules ||= []\n end", "def rules\n @rules ||= []\n end", "def rules\n return [] if @rules.empty?\n @rules.sort_by { |k| k['priority'] }.map { |h| h['rule_name'] }\n end", "def rules\n @rules.map{|r| [r.name, r.rule]}.to_h\n end", "def get_rules\r\n @rules\r\n end", "def rules(rule_name:, kind:)\n Rules::RuleSet.build_for(calendar: calendar, kind: kind).rules_with_name(rule_name)\n end", "def rules\n return @rules\n end", "def rules\n @rules=get_endpoint('rule').keys\n end", "def rule(name)\n begin\n @name=name\n @content=get_rest \"rules/#{@name}\"\n rescue Stingray::NotFoundError \n nil\n end\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def all\n @rules\n end", "def rules\n @rules ||= {}\n end", "def for_rule(rule_name)\n @rules.fetch(rule_name.to_sym, {})\n end", "def rule_names\n @rule_names ||= []\n end", "def rule_names\n @rule_names ||= []\n end", "def rules\n @rules ||= begin\n @rules = []\n resolve_permissions\n @rules\n end\n end", "def rules_check(name)\n @rules.map { |rule| rule.check(variable: name) }.join(' && ')\n end", "def rules_for(path)\n @rules.reverse.select do |rule| path.match(rule.pattern) end\n end", "def list\n @driver.getRuleNames\n end", "def key(name)\n res = rules.values.flatten.find_all { |rule| rule[:key] == name }\n FilterArray.new(res)\n end", "def available_rules\n\t\tif @rules.nil?\n\t\t\t@rules = []\n\t\t\tDir.glob(File.join(@rule_directory,\"**\",\"*.yar*\")).each do |yara_rule_file|\n\t\t\t\trule = YaraRule.new\n\t\t\t\trule.file_path = yara_rule_file.gsub(\"/\",\"\\\\\\\\\")\n\t\t\t\t@rules << rule\n\t\t\tend\n\t\tend\n\t\treturn @rules\n\tend", "def rules\n self.class.rules\n end", "def content_rules_get(authorization, web_application_name, opts = {})\n data, status_code, headers = content_rules_get_with_http_info(authorization, web_application_name, opts)\n [data, status_code, headers]\n end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules\n @rules ||= Rules.new(path, logger)\n end", "def rules\n rule_applier.rules\n end", "def rules_by_regex(regex, section_id = @one_section_id)\n rules = []\n return rules unless section_id\n\n all_rules = rules(section_id)\n return rules unless all_rules\n\n all_rules['results'].each do |rule|\n rules << rule if rule['display_name'].match(regex)\n end\n rules\n end", "def rules(section_id = @one_section_id)\n url = @url_sections + '/' + section_id + '/rules'\n @nsx_client.get(url)\n end", "def has_rule?(name)\n rules.key?(name.to_sym)\n end", "def has_rule?(name)\n rules.key?(name.to_sym)\n end", "def [](*args)\n sort_if_needed\n @rules[*args]\n end", "def rules\n cluster.configurationEx.rule\n end", "def rules\n cluster.configurationEx.rule\n end", "def all\n @rules ||= raw.values.flatten.map { |rule| Accessibility::Rule.new(rule) }\n end", "def rules\n @rules.dup.freeze\n end", "def result\n\n # start the matching of the ruleby engine if not yet called\n unless @engine_has_matched\n @engine.match\n @engine_has_matched = true\n end\n\n # return the result array\n @result_rules\n\n end", "def get_all_config_rules\n config_rules = []\n\n # Fetch all rules with pagination\n response = @client.describe_config_rules\n config_rules += response.config_rules\n while response.next_token\n response = @client.describe_config_rules(next_token: response.next_token)\n config_rules += response.config_rules\n end\n config_rules = config_rules.map(&:to_h)\n\n # Add necessary data to rules using helpers\n add_compliance_to_config_rules(config_rules)\n add_results_to_config_rules(config_rules)\n end", "def rules_for_type(type)\n FILTER_VALUES.each do |rule|\n return rule if rule[:type] == type\n end\n nil\n end", "def to_rules\n Array.new.tap do |rules|\n new_rule = Rule.new(rule.chain)\n new_rule.description = \"#{rule.description} (#{self.description})\"\n new_rule.rule = rule.rule.gsub(/\\{\\{(\\w+)\\}\\}/) do\n if value = self.options[$1.to_sym]\n value\n else\n \"{{#{$1}}}\"\n end\n end\n new_rule.action = rule.action\n new_rule.conditions = rule.conditions | self.conditions\n if self.version\n new_rule.versions = [self.version]\n end\n\n if has_host_group?\n host_group = @rule.chain.table.base.host_groups[self.options[:ip]]\n host_group.hosts.each do |key, host|\n host.ips.each do |v, ip|\n hg_rule = new_rule.dup\n hg_rule.description += \" (#{host.name} via #{host_group.name})\"\n hg_rule.rule.gsub!(host_group.name.to_s, ip)\n hg_rule.versions = [v]\n rules << hg_rule\n end\n end\n else\n rules << new_rule\n end\n end\n end", "def rules( *new_values )\n\t\tself.rules = new_values unless new_values.empty?\n\t\treturn @rules\n\tend", "def rule name\n @rule_map[name.downcase]\n end", "def rules=(value)\n @rules = value\n end", "def to_a\n @rules.keys\n end", "def all_defined_rules\n if @group\n @defined_rules.merge(@group.all_defined_rules)\n else\n @defined_rules\n end\n end", "def rules(options={})\n get('getNotificationRules', options)\n end", "def rules1\n @rules1\nend", "def rules_for(configuration, character)\n # note that it is select (filter), not detect (find)\n rules.select {|rule| rule.applies_to?(configuration, character)}\n end", "def ruleset_rules\n @rulesets.collect do |r|\n [\"# Begin [#{r.name}]\",\n r.firewall_rules,\n \"# End [#{r.name}]\",\n \"\"]\n end\n end", "def get_rules(scope = nil)\n path = scope ? \"/pushrules/#{scope}\" : '/pushrules'\n make_request(:get, path).parsed_response\n end", "def read_rules\n fields = table.auditor.config[:audit][:tables][table.name.to_sym][:fields]\n config = fields && fields[name.to_sym]\n config = config ? config[:rules] : { insert: [], update: [] }\n\n if config[:update].empty? \n config[:update] << Watchy::DefaultUpdateRule.new(name)\n end\n\n config\n end", "def get_rules\n rules = Array.new\n\n RULE_TYPES.each do |reg|\n ebtables_exit = `#{CONF[:ebtables]} -L FORWARD`\n\n rules << ebtables_exit.split(\"\\n\")[3..-1].collect do |l|\n line = l.strip\n m = line.match(reg)\n\n if m\n interface=m[1]\n {\n :interface => interface, \n :rule => line\n }\n else\n nil\n end\n end.compact\n end\n\n rules.flatten\nend", "def rulelist(ruleset, ctx)\r\n\r\n outlist = \"\"\r\n\r\n ruleset.rules.each do |ralias|\r\n rname = ctx.rules[ralias].name\r\n outlist += reference(\"rule\", rname)\r\n\r\n end # rules.each\r\n\r\n return outlist\r\n\r\n end", "def validation_rules\n []\n end", "def super_rule(name)\n sym = name.to_sym\n included_grammars.each do |grammar|\n rule = grammar.rule(sym)\n return rule if rule\n end\n nil\n end", "def get_rule(rule_name)\n r = @grammar.get_locally_defined_rule(rule_name)\n i = 0\n while (r).nil? && !(@children).nil? && i < @children.size\n child = @children.get(i)\n r = child.get_rule(rule_name)\n i += 1\n end\n return r\n end", "def rules\n return @rules unless @rules.nil?\n\n # this initialization code runs only once\n @rules = {}\n 7.downto(0).each do |rule_key|\n key = rule_key.to_s(2).rjust(3, '0') # convert to binary, pad left with 0\n @rules[key.to_sym] = RULE_NAME >> rule_key & 1 # just the one bit\n end\n\n @rules\n end", "def rules\n Gorilla.units[name] ||= {}\n end", "def get_rule(name, service=Azure::ServiceBus::Rules)\n service.get(self, name)\n end", "def rules_containing(production)\n rules = []\n @rules.each do |rule|\n rules << rule if rule.productions.include?(production)\n end\n rules\n end", "def get_candidates(rules)\n candidates = []\n rules.each { |rule| candidates << rule if rule.ever_matched? && rule.time_to_report? }\n candidates\n end", "def rules # :nodoc:\n # Rules should always be returned sorted with oldest first.\n @rules.sort! { |a, b| b[:age] <=> a[:age] }\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def get_relevant_rules\r\n @relevant_rules = Array.new\r\n @facts.each { |k,f| \r\n add_relevant_rules_for_fact f\r\n }\r\n sort_relevant_rules\r\n end", "def rules(event)\n @rules[event]\n end", "def to_list\n rules.map do |rule|\n object = { actions: rule.actions, subject: rule.subjects.map{ |s| s.is_a?(Symbol) ? s : s.name } }\n object[:conditions] = rule.conditions unless rule.conditions.blank?\n object[:inverted] = true unless rule.base_behavior\n object\n end\n end", "def external_rules\n @external_rules ||= rules.dup.external\n end", "def rules_ids\n @rules_registry.rules.map(&:id)\n end", "def validate(name = nil, type = nil)\n entries = self.find(name, type)\n entries.each {|entry| entry.validate if entry.result.nil? }\n return entries\n end", "def get_rules(section_id, opts = {})\n data, _status_code, _headers = get_rules_with_http_info(section_id, opts)\n data\n end", "def load_rules; end", "def get_bre_rules(opts = {})\n data, _status_code, _headers = get_bre_rules_with_http_info(opts)\n return data\n end", "def list_plugin_rules\n nessus_rest_get('plugin-rules')['plugin-rules']\n end", "def GetRules\n Builtins.y2milestone(\"Getting Rules: %1\", @tomerge)\n\n scheme = AutoinstConfig.scheme\n host = AutoinstConfig.host\n filepath = AutoinstConfig.filepath\n directory = AutoinstConfig.directory\n\n valid = []\n stop = false\n Builtins.foreach(@tomerge) do |file|\n if !stop\n dir = dirname(file)\n if dir != \"\"\n SCR.Execute(\n path(\".target.mkdir\"),\n Ops.add(Ops.add(AutoinstConfig.local_rules_location, \"/\"), dir)\n )\n end\n\n localfile = Ops.add(\n Ops.add(AutoinstConfig.local_rules_location, \"/\"),\n file\n )\n if !Get(\n scheme,\n host,\n Ops.add(Ops.add(directory, \"/\"), file),\n localfile\n )\n Builtins.y2error(\n \"Error while fetching file: %1\",\n Ops.add(Ops.add(directory, \"/\"), file)\n )\n else\n stop = true if @Behaviour == :one\n valid = Builtins.add(valid, file)\n end\n end\n end\n @tomerge = deep_copy(valid)\n if Builtins.size(@tomerge) == 0\n Builtins.y2milestone(\"No files from rules found\")\n return false\n else\n return true\n end\n end", "def retrieve_rule(rule_name)\n\n # convert to symbol\n rule_name = rule_name.to_sym\n\n # raise error if rule doesn't exist\n raise \"Rule with name '#{rule_name}' doesn't exist\" unless @rules.has_key? rule_name\n\n # return the rule\n @rules[rule_name]\n\n end", "def rule_set\n @rule_set ||= Rules::RuleSet.build_for(calendar: calendar, kind: kind)\n end", "def parse_ruleset_name(name)\n if Hash === name\n raise ArgumentError if name.size > 1 \n list = [name.values].flatten.map{ |b| b.to_sym }\n name = name.keys.first\n else\n list = []\n end\n return name.to_sym, list\n end", "def parse_ruleset_name(name)\n if Hash === name\n raise ArgumentError if name.size > 1 \n list = [name.values].flatten.map{ |b| b.to_sym }\n name = name.keys.first\n else\n list = []\n end\n return name.to_sym, list\n end", "def rules\n #\n # This is called first in case any preable needs to be declared (chains, specifically)\n #\n _ruleset_rules = ruleset_rules\n\n [\n Asbestos.firewall.preamble(self),\n _ruleset_rules,\n Asbestos.firewall.postamble(self)\n ].flatten\n end", "def LIST_RULES\n return @legacy.LIST_RULES if @legacy\n raise 'Using legacy auditd_rules LIST_RULES interface with non-legacy audit package. Please use the new syntax.'\n end", "def consume_rules(flags = {})\n rules = []\n\n while token = @tokens.consume\n case token[:node]\n when :comment, :whitespace\n rules << token\n\n when :cdc, :cdo\n unless flags[:top_level]\n @tokens.reconsume\n rule = consume_qualified_rule\n rules << rule if rule\n end\n\n when :at_keyword\n @tokens.reconsume\n rule = consume_at_rule\n rules << rule if rule\n\n else\n @tokens.reconsume\n rule = consume_qualified_rule\n rules << rule if rule\n end\n end\n\n rules\n end", "def get_rules(store_id, opts = {})\n data, _status_code, _headers = get_rules_with_http_info(store_id, opts)\n return data\n end", "def rule(code, name, &block)\n @rules = [] if @rules.nil?\n @rules << Rule.new(code, name)\n yield self\n end", "def patterns\n #@rules.every.pattern\n @rules.map {|r| r.pattern }\n end", "def find_rules(dir)\n if File.directory?(dir)\n Dir.entries(dir).grep(/_rule.rb$/)\n else\n @logger.debug(\"The argument %s is not a directory while looking for rules\" % dir)\n []\n end\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end", "def index\n @rules = Rule.all\n end" ]
[ "0.79867315", "0.74063736", "0.74063736", "0.73643637", "0.71903485", "0.7157202", "0.7052736", "0.70458055", "0.6990094", "0.6828639", "0.68274844", "0.68274844", "0.68274844", "0.6779544", "0.6777009", "0.6730316", "0.6652361", "0.6652361", "0.65962505", "0.6592785", "0.6566847", "0.6491369", "0.644878", "0.64323753", "0.64249545", "0.63777846", "0.62806433", "0.62806433", "0.62806433", "0.62806433", "0.62806433", "0.62806433", "0.62806433", "0.6246115", "0.6231697", "0.6228646", "0.62282073", "0.6215381", "0.6215381", "0.6177469", "0.616699", "0.616699", "0.6165211", "0.6037182", "0.60342103", "0.6033456", "0.60329014", "0.5996998", "0.5977146", "0.59699553", "0.5969042", "0.5963102", "0.5925372", "0.5914918", "0.59066594", "0.5904878", "0.58905077", "0.58886504", "0.5881405", "0.5878665", "0.58751136", "0.5859415", "0.5858985", "0.58537674", "0.58202016", "0.5807572", "0.5803883", "0.5802497", "0.579702", "0.5760857", "0.5760628", "0.5760628", "0.5760628", "0.5760628", "0.5760628", "0.5756325", "0.5755903", "0.5754484", "0.57184446", "0.5707816", "0.56939834", "0.5690466", "0.5689633", "0.5682697", "0.5682388", "0.56704", "0.5661545", "0.5641366", "0.56193674", "0.56193674", "0.56013674", "0.5596506", "0.55942655", "0.55891246", "0.5576155", "0.55628747", "0.5552504", "0.55510074", "0.55510074", "0.55510074" ]
0.7983357
1
Get rule by regex Return: Array with rules or an empty array
def rules_by_regex(regex, section_id = @one_section_id) rules = [] return rules unless section_id all_rules = rules(section_id) return rules unless all_rules all_rules['results'].each do |rule| rules << rule if rule['display_name'].match(regex) end rules end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patterns\n #@rules.every.pattern\n @rules.map {|r| r.pattern }\n end", "def rules\n @rules ||= []\n end", "def rules\n @rules ||= []\n end", "def rules_for(path)\n @rules.reverse.select do |rule| path.match(rule.pattern) end\n end", "def rules\n @rules.map{|r| [r.name, r.rule]}.to_h\n end", "def get_rules\n rules = Array.new\n\n RULE_TYPES.each do |reg|\n ebtables_exit = `#{CONF[:ebtables]} -L FORWARD`\n\n rules << ebtables_exit.split(\"\\n\")[3..-1].collect do |l|\n line = l.strip\n m = line.match(reg)\n\n if m\n interface=m[1]\n {\n :interface => interface, \n :rule => line\n }\n else\n nil\n end\n end.compact\n end\n\n rules.flatten\nend", "def rules\n return [] if @rules.empty?\n @rules.sort_by { |k| k['priority'] }.map { |h| h['rule_name'] }\n end", "def regexps; end", "def rules_by_name(rule_name, section_id = @one_section_id)\n rules = []\n return rules unless section_id\n\n all_rules = rules(section_id)\n return rules unless all_rules\n\n all_rules['results'].each do |rule|\n rules << rule if rule['display_name'] == rule_name\n end\n rules\n end", "def rules_for_type(type)\n FILTER_VALUES.each do |rule|\n return rule if rule[:type] == type\n end\n nil\n end", "def extract_regexps(line)\n r = []\n line.scan(/\\s@(rx|dfa) (?:\"((?:\\\\\"|[^\"])+)\"|([^ ]+?))(\\s|$)/) {r << $2}\n r\nend", "def rules\n @rules=get_endpoint('rule').keys\n end", "def rules_by_name; end", "def rules\n return @rules\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def rules\n @rules ||= {}\n end", "def result\n\n # start the matching of the ruleby engine if not yet called\n unless @engine_has_matched\n @engine.match\n @engine_has_matched = true\n end\n\n # return the result array\n @result_rules\n\n end", "def rules\n @rules ||= {}\n end", "def get_rules\r\n @rules\r\n end", "def matching_lines(regex); end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule\n rules[0]\n end", "def rule_names\n @rule_names ||= []\n end", "def rule_names\n @rule_names ||= []\n end", "def available_rules\n\t\tif @rules.nil?\n\t\t\t@rules = []\n\t\t\tDir.glob(File.join(@rule_directory,\"**\",\"*.yar*\")).each do |yara_rule_file|\n\t\t\t\trule = YaraRule.new\n\t\t\t\trule.file_path = yara_rule_file.gsub(\"/\",\"\\\\\\\\\")\n\t\t\t\t@rules << rule\n\t\t\tend\n\t\tend\n\t\treturn @rules\n\tend", "def possible_regexes(w)\n possible = []\n w_as_regex = escape_regex(w)\n\n # Here we specify many different functions that generate regex criterias,\n #\n # For example, /\\$10/ and /\\$[0-9]+/ for $10\n possible << w_as_regex\n possible << w_as_regex.gsub(/[0-9]/, \"[0-9]+\")\n\n possible.uniq.map { |p| Regexp.new(p, Regexp::IGNORECASE) }\n end", "def to_rules\n Array.new.tap do |rules|\n new_rule = Rule.new(rule.chain)\n new_rule.description = \"#{rule.description} (#{self.description})\"\n new_rule.rule = rule.rule.gsub(/\\{\\{(\\w+)\\}\\}/) do\n if value = self.options[$1.to_sym]\n value\n else\n \"{{#{$1}}}\"\n end\n end\n new_rule.action = rule.action\n new_rule.conditions = rule.conditions | self.conditions\n if self.version\n new_rule.versions = [self.version]\n end\n\n if has_host_group?\n host_group = @rule.chain.table.base.host_groups[self.options[:ip]]\n host_group.hosts.each do |key, host|\n host.ips.each do |v, ip|\n hg_rule = new_rule.dup\n hg_rule.description += \" (#{host.name} via #{host_group.name})\"\n hg_rule.rule.gsub!(host_group.name.to_s, ip)\n hg_rule.versions = [v]\n rules << hg_rule\n end\n end\n else\n rules << new_rule\n end\n end\n end", "def match(*pattern, &block)\n\t\t\t@rules << Rule.new(pattern, block)\n\t\tend", "def parse_rules(rules)\n rules.split(\"\\n\").each_with_object({}) do |rule, rule_hsh|\n mdata = /\\s{3}(\\w+)\\s/.match(rule)\n case mdata.nil? ? nil : mdata[1]\n when 'match'\n rule_hsh[:match] = [] unless rule_hsh.include?(:match)\n rule_hsh[:match] << rule.sub('match', '').strip\n when 'set'\n rule_hsh[:set] = [] unless rule_hsh.include?(:set)\n rule_hsh[:set] << rule.sub('set', '').strip\n when 'continue'\n rule_hsh[:continue] = nil unless rule_hsh.include?(:continue)\n rule_hsh[:continue] = rule.sub('continue', '').strip.to_i\n when 'description'\n rule_hsh[:description] = nil unless rule_hsh.include?(:description)\n rule_hsh[:description] = rule.sub('description', '').strip\n end\n end\n end", "def regexp_variables\n return @regexp_variables if @regexp_variables\n @regexp_variables = Array.new\n @base_theme.scan(VARIABLE_MATCHER) { @regexp_variables << $2 }\n @regexp_variables\n end", "def get_rule(rule)\n @rules[rule]\n end", "def parse_matching_rules( needles, haystack, include_wildcard = true )\n needles = [*needles]\n\n needles.push( WILDCARD_KEY ) if include_wildcard\n\n matched_values = []\n\n needles.each do | needle |\n matched_values += haystack[needle].split( /\\s*,\\s*/ ) if haystack.key?( needle )\n end\n\n return matched_values\n end", "def get_candidates(rules)\n candidates = []\n rules.each { |rule| candidates << rule if rule.ever_matched? && rule.time_to_report? }\n candidates\n end", "def rule(regex, &action)\n states, reg_string = parse_rule(regex)\n states.each do |s|\n if s.nil?\n @open_states.each do |o|\n @state_rules[o][reg_string] = action\n end\n else\n @state_rules[s] = { reg_string => action }\n end\n end\n puts(\"Rule '#{regex}' defined\") if @verbose\n end", "def get_all(regexp)\n Jamie::Config::Collection.new(\n __getobj__.find_all { |i| i.name =~ regexp }\n )\n end", "def matches\n parse_file.lines.each_with_object([]) do |line, matches|\n matches << line.scan(REGEXP[:name_and_score])\n end\n end", "def get_patterns(pattern_string)\r\n split_and_strip(pattern_string, \";\").select do |name|\r\n name != \"\"\r\n end.map {|name| Regexp.new(name, true)}\r\n end", "def patterns\n @patterns ||= []\n end", "def find_rule(input)\r\n result = nil\r\n @rules.each do |rule|\r\n result = rule if rule.input == input\r\n end\r\n result\r\n end", "def match(input, offset=0)\n matches = []\n os = offset\n rules.each do |rule|\n m = input.match(rule, os)\n break unless m\n matches << m\n os += m.length\n end\n create_match(matches, offset) if matches.length == rules.length\n end", "def read_regexps_from_file(file_name)\n matchers = []\n File.open(file_name).each_line do |l|\n next if (l =~ /^(#.*|\\s*)$/) # emtpy lines and lines starting with #\n matchers << Regexp.new(l.strip)\n end\n end", "def find_all_regex(sCOMMAND)\n array = Array.new()\n search =/#{sCOMMAND}/\n @commands.each do |command|\n if (command.commandName.match(search) )\n array.push(command)\n end\n\n end\n return array\n end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rules; end", "def rulelist(ruleset, ctx)\r\n\r\n outlist = \"\"\r\n\r\n ruleset.rules.each do |ralias|\r\n rname = ctx.rules[ralias].name\r\n outlist += reference(\"rule\", rname)\r\n\r\n end # rules.each\r\n\r\n return outlist\r\n\r\n end", "def parse_rules(rules)\n rules.split(\"\\n\").map do |rule|\n rule_name,r1,r2,r3,r4 = rule.match(/^([\\w\\s]+): (\\d+)-(\\d+) or (\\d+)-(\\d+)$/i).captures\n [rule_name,[(r1.to_i..r2.to_i),(r3.to_i..r4.to_i)]]\n end.to_h\n end", "def scan\n list = []\n io.each do |input|\n # TODO: limit to text files, how?\n begin\n text = read(input)\n text.scan(regex) do\n list << Match.new(input, $~)\n end\n rescue => err\n warn(input.inspect + ' ' + err.to_s) if $VERBOSE\n end\n end\n list\n end", "def lex_rule start_state, regexp, action = nil\n rules << Rule.new(start_state, regexp, action)\n end", "def rule(expression, &block)\n case expression\n when Hash\n expression.each do |fact, task|\n fact = define_fact(fact)\n task = define_task(task)\n @rules << Rule.new(fact, &task)\n end\n else\n fact = define_fact(expression)\n @rules << Rule.new(fact, &block)\n end\n\n #rule = Rule.new(@_facts, get_rule_options, &procedure)\n #@rules << rule\n #clear_rule_options\n\n return @rules\n end", "def match_with_rules(line)\n matched_rule = @rules.detect {|rule| rule.match(line)}\n matched_rule ? matched_rule.last_diff : nil\n end", "def all\n @rules\n end", "def pattern\n Regexp.union(pattern_classifiers.map(&:pattern))\n end", "def rules_for(state, char)\n rules.select { |rule| rule.applies_to?(state, char) }\n end", "def list\n @driver.getRuleNames\n end", "def match(regexp); end", "def rules_for(configuration, character)\n # note that it is select (filter), not detect (find)\n rules.select {|rule| rule.applies_to?(configuration, character)}\n end", "def validation_rules\n []\n end", "def rules\n @rules ||= Rules.new(path, logger)\n end", "def pattern2regex(pattern); end", "def consume_rules(flags = {})\n rules = []\n\n while token = @tokens.consume\n case token[:node]\n when :comment, :whitespace\n rules << token\n\n when :cdc, :cdo\n unless flags[:top_level]\n @tokens.reconsume\n rule = consume_qualified_rule\n rules << rule if rule\n end\n\n when :at_keyword\n @tokens.reconsume\n rule = consume_at_rule\n rules << rule if rule\n\n else\n @tokens.reconsume\n rule = consume_qualified_rule\n rules << rule if rule\n end\n end\n\n rules\n end", "def grep(pattern, &block)\n ary = []\n self.each{|*val|\n sv = val.__svalue\n if pattern === sv\n ary.push((block)? block.call(*val): sv)\n end\n }\n ary\n end", "def regex_files(files, regex=nil)\n array = files.nil? ? [] : files\n if !files.nil? && !regex.nil?\n exp = Regexp.new(regex)\n array = files.select do |file|\n file_name = File.basename(file, \".*\")\n match = exp.match(file_name)\n !match.nil? # return this line\n end\n end\n return array\nend", "def init_rule(rule)\n # categories get square brackets and ? becomes <, also split rule\n r = rule.gsub(/\\p{Lu}/,'[\\\\0]').gsub('?', '<').split('/')\n unless r[0].gsub!('#', '*').nil?\n # change # to * (in TRG) or % (in CHG) when not with _\n r[1].gsub!(/(?<!_)#(?!_)/, '%')\n end\n r[1].gsub!(/(?<!@)\\-/, '#') # - becomes # for word-insertions\n r # return ruleset as initialised array\n end", "def get_courses_by_property_by_regex(property, regex)\n puts \"[+] Searching for courses using regex: #{regex}\".yellow +\n + \" -- And property: #{property}\"\n courses_results = []\n results = get_all_courses\n results.each do |x|\n courses_results.push(x) unless (x[property] =~ regex).nil?\n end\n courses_results\n # returns array of all matching courses in JSON format.\nend", "def rules_containing(production)\n rules = []\n @rules.each do |rule|\n rules << rule if rule.productions.include?(production)\n end\n rules\n end", "def find_rules(dir)\n if File.directory?(dir)\n Dir.entries(dir).grep(/_rule.rb$/)\n else\n @logger.debug(\"The argument %s is not a directory while looking for rules\" % dir)\n []\n end\n end", "def regex(pattern)\n Regexp.new pattern.regex\n end", "def from_with_regex(cmd, *regex_list)\n regex_list.flatten.each do |regex|\n _status, stdout, _stderr = run_command(command: cmd)\n return \"\" if stdout.nil? || stdout.empty?\n\n stdout.chomp!.strip\n md = stdout.match(regex)\n return md[1]\n end\n end", "def rules_with_epsilon()\n rules = []\n @rules.each do |rule|\n rules << rule if rule.epsilon?\n end\n rules\n end", "def all\n @rules ||= raw.values.flatten.map { |rule| Accessibility::Rule.new(rule) }\n end", "def r regex\n raise 'First use `use`!' if @use.empty?\n \n @use.each_line do |line|\n line.gsub! /\\n$/, ''\n puts '---- ---- ---- ---- ---- ---- ----'\n puts line.inspect\n results = line.match(regex)\n if results.nil?\n puts \"No match\"\n next\n end\n puts \"Match: #{results[0].inspect}\"\n results.captures.each do |capture|\n puts \"Capture #{results.captures.index capture}: #{capture.inspect}\"\n end\n end\n puts '---- ---- ---- ---- ---- ---- ----'\nend", "def process(items) \n out = []\n \n if items.is_a?(Array)\n items.each do |item|\n out << item.scan(@regex).flatten\n end\n \n elsif items.is_a?(String)\n out = items.scan(@regex).flatten#{|m| m.to_s}\n \n else\n out = items\n end\n \n out.flatten\n end", "def ruleset_rules\n @rulesets.collect do |r|\n [\"# Begin [#{r.name}]\",\n r.firewall_rules,\n \"# End [#{r.name}]\",\n \"\"]\n end\n end", "def regexp; end", "def regexp; end", "def search(*rules); end", "def search(*rules); end", "def grep(file, regexp, &block)\n if block_given?\n File.open(file, 'r').each {|line| line.chomp!; block[line] if line =~ regexp }\n else\n lines = []\n File.open(file, 'r').each {|line| line.chomp!; lines << line if line =~ regexp }\n lines\n end\n end", "def matchtask(regex, split = nil)\n tasks = []\n regex.each do |r|\n @message.scan(eval(r['pattern'])).each do |arr|\n if split.nil?\n task = PACTask.new(arr[0])\n task.add_commit(self)\n self.referenced = true\n task.label = r['label']\n tasks << task\n else\n arr[0].split(split).each do |s|\n task = PACTask.new(s)\n task.add_commit(self)\n task.label = r['label']\n self.referenced = true\n tasks << task\n end\n end\n end\n end\n\n tasks\n end", "def extract_regex line\n if line =~ /^(Then|Given|When|And)[ (]\\/(.+)\\/[^\\/]+$/\n return [$1, $2]\n else\n return nil\n end\n end", "def get_patterns\n patterns = BASE_PATTERNS\n # add the colour keywords. generate these from the colour wheel's constants\n colours = Yay::ColourWheel::all_names.join('|')\n patterns.unshift [:colour, Regexp.new(\"\\\\b(#{colours})\\\\b\", Regexp::IGNORECASE)]\n return patterns\n end", "def extract(regex)\n data = self.match(regex)\n return nil unless data\n if data.size > 2\n return *(data.to_a[1..-1])\n elsif data.size == 2\n return data[1]\n else\n return data[0]\n end\n end", "def match(input, offset=0)\n rules.each do |rule|\n m = input.match(rule, offset)\n return extend_match(m, name) if m\n end\n nil\n end", "def rules\n self.class.rules\n end", "def rules\n rule_applier.rules\n end", "def match regexp, opt = {}, &block\n opt = { in: :line, match: :first }.merge opt\n (opt[:in] == :output ? receive_update_callbacks : receive_line_callbacks) << lambda do |data|\n matches = data.scan regexp\n if matches.length > 0\n case opt[:match]\n when :first\n EM.next_tick do\n block.call *matches[0]\n end\n when :last\n EM.next_tick do\n block.call *matches[matches.length-1]\n end\n end\n end\n end\n end", "def rules_at(keys, *rest)\n if defined?(keys.exclude_end?)\n return @rules[keys]\n end\n ([keys]+rest).flatten.map{ |i| rule_at(i) }\n end", "def rules\n return @rules unless @rules.nil?\n\n # this initialization code runs only once\n @rules = {}\n 7.downto(0).each do |rule_key|\n key = rule_key.to_s(2).rjust(3, '0') # convert to binary, pad left with 0\n @rules[key.to_sym] = RULE_NAME >> rule_key & 1 # just the one bit\n end\n\n @rules\n end", "def to_a\n @patterns\n end", "def find_regex(words)\n Array(words).map do |w|\n regexes_for_word = []\n\n possible_regexes(w).each do |regex|\n #puts \"Word: #{w} against #{regex} -> #{w =~ regex}\"\n if w =~ regex\n regexes_for_word << regex\n end\n end\n\n regexes_for_word.uniq\n end\n end", "def [](*args)\n sort_if_needed\n @rules[*args]\n end" ]
[ "0.6460382", "0.63995034", "0.63995034", "0.630223", "0.62057614", "0.6033021", "0.6027661", "0.60276264", "0.6020229", "0.5895967", "0.5850633", "0.57945204", "0.5789702", "0.57661474", "0.57350147", "0.57350147", "0.57350147", "0.57267535", "0.57172036", "0.5707666", "0.56828547", "0.5635989", "0.5635989", "0.5635989", "0.5635989", "0.5635989", "0.5623598", "0.5623598", "0.5607384", "0.55835944", "0.55470896", "0.5524551", "0.55210316", "0.55194724", "0.54842865", "0.5475565", "0.5469665", "0.5446957", "0.5441186", "0.5411992", "0.54119205", "0.540731", "0.539814", "0.5394549", "0.5379947", "0.5368183", "0.5362628", "0.5362628", "0.5362628", "0.5362628", "0.5362628", "0.5362628", "0.5362628", "0.53584564", "0.535772", "0.53275144", "0.53257984", "0.5311196", "0.52906716", "0.5288925", "0.52874744", "0.5287397", "0.5286119", "0.52741504", "0.5266828", "0.5263485", "0.5246061", "0.5218298", "0.52143896", "0.52052206", "0.51995784", "0.5196344", "0.51922625", "0.5190598", "0.51828736", "0.51740646", "0.51480186", "0.51404977", "0.5140113", "0.5130501", "0.5128031", "0.51205564", "0.51051503", "0.51051503", "0.51041126", "0.51041126", "0.5104096", "0.510074", "0.5091399", "0.50716", "0.5067948", "0.5067805", "0.50612175", "0.50595444", "0.50589347", "0.5057065", "0.5050398", "0.50502306", "0.50396514", "0.5036441" ]
0.7893675
0
Use callbacks to share common setup or constraints between actions.
def set_supplier_type @supplier_type = SupplierType.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def supplier_type_params params.require(:supplier_type).permit(:name, :description) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
This method gets the very first content page plugin's contents FIXME: make it more robust
def get_contents_for(path) out = get_path(path) out.css("#content").inner_html end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contents\n @contents ||= begin\n # First collect the localized content\n contents_data = localized_contents\n contents_data = [] if contents_data.blank?\n # Then grab the content that belongs directly to the page\n contents_data << non_localized_contents\n unless contents_data.blank?\n contents_data = contents_data.flatten.sort{|a,b| a.section_position <=> b.section_position}\n end\n end\n @contents\n end", "def first_part\n self.parsed_page ||= @connect.page self.name\n self.parsed_page.search(\"p\").first.children.first\n end", "def set_resource_content\n @page = Page.available.homepage.first!\n end", "def active_page\n stack(:__cms_active_page).first || original_content\n end", "def content\n return @content if @content\n content, id = self.get_page_content\n content = master.render(content)\n Ruhoh::Converter.convert(content, id)\n end", "def first\n\t\t@first.content\n\tend", "def info\n\t\treturn \"\"\n\t\tp = localized_page\n\t\treturn \"\" unless p && p.content\n\t\tlogger.debug \"parsing page #{p.title}\"\n\t\t\t\n\t\t# extract the top-most section (the one before any ToC)\n\t\tc = WikiCloth::Parser.new({ :data => WikiParser::sanitize(p.content) })\n\t\tc = c.sections.first\n\t\t\n\t\tl = I18n.locale\n\t\tret = WikiParser.new({ :data => c }).to_html\n\t\t#I18n.locale = l\n\t\treturn ret\n\tend", "def content\n return @content if @content\n matches = class_const(:CONTENT_RE).match(page)\n if matches\n @content = class_const(:KILL_CHARS_RE).gsub(matches[1].to_s, '')\n content_processor\n @content.collect! { |p| decode_entities(p.strip) }\n @content.delete_if { |p| p == '' or p.nil? }\n end\n @content = [] if @content.nil?\n @content\n end", "def all_page_part_content\n\t content = \"\"\n\t \n\t self.parts.each do |part|\n\t content << \" #{part.body}\"\n\t end\n\t \n\t content\n\tend", "def first_page\n # TODO are there cases where main_page = 'README' for 'lib/README'?\n if @options.main_page && (main_file = @all_files.find { |f| f.full_name == @options.main_page })\n main_file\n elsif (file = @simple_files.first)\n file\n elsif (cm = @unique_classes_and_modules.find { |k| !k.comment.empty? })\n cm\n elsif (file = @files_with_comment.first)\n file\n elsif !@unique_classes_and_modules.empty?\n @unique_classes_and_modules.find { |k| k.any_content } or\n @unique_classes_and_modules.first\n else\n @all_files.first\n end\n end", "def get_page_content(page_title)\n response = mediawiki('get_wikitext', page_title)\n case response&.status\n when 200\n response.body.force_encoding('UTF-8')\n when 404\n ''\n end\n end", "def first\n contents[0]\n end", "def next_contents\n content.to_a.compact\n end", "def extract_content(doc)\n content = ''\n ce = content_element(doc)\n ce = ce.inner_html if ce.respond_to? :inner_html\n content = strip_tags(strip_comments(ce)) if ce\n # (ce/'h1, h2, h3, h4, h5, h6, p, li, dt, dd, td, address, option, ').each do |child|\n # extract_text child, content\n return content.strip\n end", "def default_page\n self.children.first\n end", "def get_page_contents()\n JSON.parse( \n @client.api.get(\"#{@client.base_uri.path}/api.php?#{URI.encode_www_form({\n :action => 'query',\n :prop => 'info|revisions',\n :titles => BAN_PAGE,\n :rvprop => 'content',\n :intoken => 'edit',\n :indexpageids => 1,\n :format => 'json',\n :cb => rand(1000000)\n })}\", @headers).body,\n :symbolize_names => true\n )[:query]\n end", "def content\n return gleaning.content if gleaning&.content_ready?\n return mercury_result.content if mercury_result&.content_ready?\n end", "def content\n page.formatted_data\n end", "def content\n @content ||= content!\n end", "def extract_homepage\n\t\treturn fail_extraction( :homepage, \"no README\" ) unless self.readme\n\n\t\tlist = self.readme.parts.find {|part| RDoc::Markup::List === part && part.type == :NOTE } or\n\t\t\treturn fail_extraction(:homepage, \"No NOTE list\")\n\t\titem = list.items.find {|item| item.label.include?('home') } or\n\t\t\treturn fail_extraction(:homepage, \"No `home` item\")\n\n\t\treturn item.parts.first.text\n\tend", "def header_content_for_page(slug)\n content = \"\"\n \n @slug_page ||= Page.find_by_slug(slug)\n \n if @slug_page\n content = @slug_page.part_content(\"header_content\")\n end\n \n content\n end", "def get_raw_page_content(article_titles)\n query_parameters = { titles: article_titles,\n prop: 'revisions',\n rvprop: 'content' }\n info = mediawiki('query', query_parameters)\n return if info.nil?\n page = info.data['pages']\n page.nil? ? nil : page\n end", "def content\n @content ||= if valid_attrs?(:content_id, :content_type)\n Object.const_get(content_type).find_by_id(content_id)\n end\n end", "def page_content(title)\n\tFile.read(\"pages/#{title}.txt\")\n rescue Errno::ENOENT\n \treturn nil\n end", "def content\n raise NotLoadedError.new(:content) unless content_loaded?\n @content\n end", "def contents()\n html = Nokogiri::HTML(@markdown_document.to_html())\n\n # Fixup refs to other markdown documents\n html.css(\"a\").each do |anchor|\n anchor[\"href\"] = anchor[\"href\"].sub(%r{\\.md$}, \".html\")\n end\n\n # Since we transform device-specific $device/README.md pages into\n # discrete $device.html, we need to fixup cross-linking into its namespace\n # This could be generalized some more, to be fixed once we have other internal links to mismatched README.md/index.html locations.\n if File.dirname(relative_output) == \"devices\"\n html.css(\"a\").each do |anchor|\n if anchor[\"href\"].match(%r{\\.\\./[^\\.]+$})\n anchor[\"href\"] = anchor[\"href\"].sub(%r{\\.\\./}, \"devices/\") + \".html\"\n end\n end\n end\n\n # Since Nokogiri produces a complete document from our fragment, we\n # have to pick only what's in the body; so strip the body added tags and higher-up tags.\n html\n .at_css(\"body\").to_s()\n .sub(%r{^<body>}, \"\").sub(%r{</body>$}, \"\")\n end", "def non_localized_contents\n @non_localized_contents ||= begin\n # grab the content that belongs directly to the page\n contents_data = Gluttonberg::Content.non_localized_associations.inject([]) do |memo, assoc|\n memo += page.send(assoc).all\n end\n contents_data = contents_data.sort{|a,b| a.section_position <=> b.section_position}\n end\n @non_localized_contents\n end", "def page\n get_page\n nil\n end", "def content\n\t\tlast_revision = revisions.last\n\t\treturn nil if last_revision.nil?\n\t\treturn last_revision.content\n\tend", "def get_page_contents(title)\n JSON.parse( \n @client.api.get(\"#{@client.base_uri.path}/api.php?#{URI.encode_www_form({\n :action => 'query',\n :prop => 'info|revisions',\n :titles => title,\n :rvprop => 'content',\n :intoken => 'edit',\n :indexpageids => 1,\n :format => 'json',\n :cb => rand(1000000)\n })}\", @headers).body,\n :symbolize_names => true\n )[:query]\n end", "def content\n div :id => 'doc3' do\n div :id => 'hd' do\n render_top_line\n h1 @page_title || 'Missing :page_title' \n end\n div :id => 'bd' do\n render_body\n end\n div :id => 'ft' do\n render_footer\n end\n end\n end", "def first_page\n @links['first']\n end", "def index\n @contents = Content.site_text_items(@site.id)\n end", "def contents\n self.content\n end", "def content\n @content ||= revisions['master'].content\n end", "def content\n content = \"No Content\"\n if (@language.present?)\n nt = Newstext.where(news_id: self.id).where(language: @language)\n if (nt != nil && nt.size > 0)\n content = nt.first.content\n end\n end\n\n content\n end", "def get_contents \n @contents = []\n\n sub_directory_names = Dir[CONTENT_ROOT_DIRECTORY + \"/*\"]\n\n sub_directory_names.each do |sub_directory_name|\n sub_directory_basename = File.basename(sub_directory_name)\n @contents.push(Content.new(sub_directory_basename))\n end\n end", "def content_to_render\n\t\t\tcontent_to_render = []\n\n\t\t\t@wiki_query.pages.each do |key, page|\n\t\t\t\tcontent_to_render << get_content_needed(key, page)\n\t\t\tend\n\n\t\t\tcontent_to_render\n\t\tend", "def content\n PlainTextExtractor.extract_content_from(complete_path)\n end", "def content\n @content ||= @client.get(@link)\n end", "def contents\n children.select { |child| child.is_a? DocumentContent }\n end", "def get_content_for_layout()\n get_partial(@type)\n # if @type == \"home\"\n # get_partial('home')\n # elsif @type == \"page\"\n # get_partial('page')\n # elsif @type == \"article\"\n # get_partial('article')\n # elsif @type == \"category\"\n # get_partial('category')\n # end\n end", "def selected_page_content\n parse_uri_from_env\n case\n\n when @uri.to_s == \"http://favicon.ico\" # automatic request from most browsers\n true # ignore it\n\n when @uri.class == URI::Generic\n WebStrip.welcome_page # put up a default page\n\n when @uri.class == URI::HTTP\n parse_page_handler_from_uri\n load_page_handler_definition_file\n get_filtered_page_from_page_handler\n\n else\n msg = \"PageRouter: URI::class '#{@uri.class}' not handled.\"\n @logger.write \"#{msg}\\n\"\n raise NotImplementedError, msg\n end\n end", "def switch_to_main_content\n $driver.switch_to.default_content\nend", "def contentByType( type )\n\t\tcontent = nil\n\t\t@content.each_index { |i|\n\t\t\tif @content[i].type == type\n\t\t\t\tcontent = @content[i]\n\t\t\tend\n\t\t}\n\t\tcontent\n\tend", "def template_content\n if respond_to? :contents and contents\n contents.elements.map do |item|\n if item.content.respond_to? :template\n item.content.template.renderable.template.render\n else\n ::Alongslide::render item.text_value, plain: true\n end\n end\n end\n end", "def all_page_part_content\n parts.map(&:body).join \" \"\n end", "def sub_content \n sub_contents = []\n\n if @is_post == false\n root_regexp = Regexp.new(@root, Regexp::IGNORECASE)\n sub_directories = Dir.glob(@absolute_path + '*');\n\n sub_directories.each do |sub_directory|\n begin\n # Remove the root from the path we pass to the new Content instance.\n # REVIEW: Should we be flexible and allow for the root dir to be present?\n content = Content.new(sub_directory.sub(root_regexp, ''))\n sub_contents.push(content)\n rescue ArgumentError\n next\n end\n end\n end\n\n sub_contents.reverse\n end", "def get_content_param\n self.content_param == 0 ? section.content_param : self.content_param\n end", "def content\n return @content if @content\n raise Puppet::DevError, \"No source for content was stored with the metadata\" unless metadata.source\n\n unless tmp = Puppet::FileServing::Content.indirection.find(metadata.source, :environment => resource.catalog.environment)\n fail \"Could not find any content at %s\" % metadata.source\n end\n #debug 'fragment get content from source'\n @content = tmp.content\n end", "def get_footer_content\n @footer = Content.where(\"name = 'Footer'\").first.body \n end", "def contents\n rendered_contents\n end", "def page_source; end", "def content\n @content \n end", "def index\n\t\t@page = ContentPage.find_by_home(true)\n\tend", "def default_content\n @bridge.switch_to_default_content\n end", "def load_page\n page_not_found! unless Language.current\n\n @page ||= Language.current.pages.contentpages.find_by(\n urlname: params[:urlname],\n language_code: params[:locale] || Language.current.code\n )\n end", "def content\n super\n @renderer = @widget.content\n div :id => 'doc3' do\n if @renderer.render? :header\n div :id => 'hd' do\n if @renderer.render? :top_line\n render_top_line\n end\n if @renderer.render? :title\n h1 @page_title || 'Missing :page_title'\n end \n end\n end\n div :id => 'bd' do\n render_body\n end\n if @renderer.render? :footer\n div :id => 'ft' do\n render_footer\n end\n end\n end\n end", "def find_page_content_by_title(title: nil, space_key: nil)\n parameters = {\n title: title,\n spaceKey: space_key,\n expand: 'ancestors,version,body.storage'\n }\n target_url = @base_url + \"/content\"\n\n resp = Typhoeus.get(target_url, params: parameters, userpwd: \"#{@user}:#{@pass}\")\n\n if resp.response_code == 401\n puts \"Unauthenticated. User or password was incorrect?\"\n hsh = Hash.new\n else\n hsh = JSON.parse(resp.response_body)\n end\n\n # Return page content or empty string\n return \"\" unless hsh['results'][0]\n hsh['results'][0]['body']['storage']['value']\n end", "def content\n return @content if application.cache_pages? && @content\n\n @content = if file?\n IO.read(path)\n elsif io?\n path.read\n else\n path\n end\n end", "def content\n @content\n end", "def content\n @content\n end", "def content\n\t\t@content\n\tend", "def default_content\n logger.info 'EyesTargetLocator.default_content()'\n unless driver.frame_chain.empty?\n logger.info 'Making preparations...'\n on_will_switch.will_switch_to_frame :default_content, nil\n logger.info 'Done! Switching to default content...'\n __getobj__.default_content\n logger.info 'Done!'\n end\n driver\n end", "def display_content\n return nil unless display_content_allowed?\n\n return image_content if solr_document.image?\n return video_content if solr_document.video?\n return audio_content if solr_document.audio?\n end", "def next_page\n @page_content = []\n pagefile = File.open(@pagefilename, \"r\")\n while (l = pagefile.gets)\n @page_content << l\n end\n \n @nextpagenum += 1\n @pagefilename = @pagefile_prefix + @nextpagenum.to_s + \".txt\"\n \n return @page_content \n end", "def content \n @content\n end", "def page\n # We need duplicated JSON parse since standart\n # chromedriver giving an error here if the page is too large\n page = execute_script(File.read(\"#{HOME}/scripts/page.js\"))\n JSON.parse(page, max_nesting: false)['result']\n end", "def url\n\t\t\t@data[\"content_urls\"][\"desktop\"][\"page\"]\n\t\tend", "def content_parent\n if episode?\n return content.show\n else\n return content\n end\n end", "def localized_contents\n @contents ||= begin\n Content.content_associations.inject([]) do |memo, assoc|\n memo += send(assoc).all_with_localization(:page_localization_id => current_localization.id)\n end\n end\n end", "def short_content\n if self.content.include?(PAGEBREAK)\n # Also look for pagebreaks wrapped in paragraph tags\n if self.content.include?(\"<p>#{PAGEBREAK}</p>\")\n pagebreak_pos = self.content.index(\"<p>#{PAGEBREAK}</p>\")\n else\n pagebreak_pos = self.content.index(PAGEBREAK)\n end\n c = close_tags(self.content[0, pagebreak_pos])\n end\n return c || self.content\n end", "def content_for_version(version_no)\n content_root_for_version(version_no).self_and_descendants\n end", "def get_content()\r\n result=''\r\n if self.children.empty?\r\n result=self.content\r\n else\r\n # Display line by line them if it has childern, but no layout\r\n if self.content.nil? || self.content.empty?\r\n self.children.each do |w|\r\n result +=w.get_content()\r\n result +='</br>' # Each child takes a new line\r\n end\r\n end\r\n end\r\n result\r\n end", "def contents_from_html\n types_ids = []\n html = introduction + links\n page = Hpricot(html)\n as = page.search('//a')\n as.each do |a|\n href = a.attributes['href']\n ActiveRecord::Acts::Content.model_types.each do |t|\n underscore = t.underscore\n if href =~ /\\/#{underscore.pluralize}\\/(.+)/ # The URL must be in the form /plural/id\n id = $1.to_i\n types_ids << [t, id]\n end\n end\n end\n\n ret = []\n types_ids.uniq!\n types_ids.each do |t, id|\n klass = t.constantize\n content = klass.find_by_id(id)\n ret << content unless content.nil?\n end\n ret\n end", "def first_page\n Page.find(self.first_page_id)\n end", "def content\n nil\n end", "def all\n Dir.chdir(content_dir) do\n files = Dir.glob(File.join(\"**\", \"*#{SOURCE_FILE_EXT}\")).delete_if {|p| p =~ Regexp.new(\"\\\\.[0-9]+\\\\#{SOURCE_FILE_EXT}$\")}\n files.collect {|f| Page.new(uri_from_path(f), File.open(f, 'r') {|b| b.read})}\n end\n end", "def page\n nil\n end", "def content\n return @content\n end", "def content\n return @content\n end", "def content\n return @content\n end", "def content\n return @content\n end", "def content\n return @content\n end", "def content\n return @content\n end", "def content_based_description\n first_long_paragraph = parsed_search('//p[string-length() >= 120]').first\n first_long_paragraph ? first_long_paragraph.text : ''\n end", "def getContent\r\n\t\t\t\t\treturn @content\r\n\t\t\t\tend", "def getContent\r\n\t\t\t\t\treturn @content\r\n\t\t\t\tend", "def content\n\t @content_hash[@parsing_library].content \n\t end", "def get\n @contents\n end", "def content\n @content\n end", "def content\n return @content unless @content.nil?\n\n @content = @ref\n @opts[:content_path].each do |node|\n @content = @content.send(node)\n end\n @content\n end", "def get_content(content_ref_path)\n puts \" get_content() #{@curl_get_prefix} #{content_ref_path}\" if @debug\n content_details = Jive_ruby_api.cleanse_security_string(`#{@curl_get_prefix} #{content_ref_path}`)\n content_details = JSON.parse(content_details)\n html_string = content_details['content']['text']\n\n return html_string\n\n end", "def first\n return nil unless first_page_uri\n perform_request(first_page_uri)\n end", "def get_content(key = nil)\n @content[key]\n end", "def content_from(html, url)\n \n def extract_pre_from(html)\n regex = /<pre.*?>.*?<\\/pre>/m\n pre_list = html.scan regex\n html.gsub! regex, 'DUMMY-STRING'\n [pre_list, html]\n end\n\n def add_domain(html, domain)\n html.gsub! /a href=\\\"(\\/.*?\\\")/, \"a href=\\\"#{domain}\\\\1\"\n html.gsub! /img src=\\\"(\\/.*?\\\")/, \"img src=\\\"#{domain}\\\\1\"\n html\n end\n\n def add_pre(html, pre_list)\n pre_list.each do |p|\n html.sub!('DUMMY-STRING', p)\n end\n html\n end\n \n pre_list, replaced = extract_pre_from html\n params = { :tags => %w[div span p a b i pre h1 h2 h3 h4 h5 h6 strong small em\n blockquote ul ol li img],\n :attributes => %w[href src] }\n html = HtmlPress.press Readability::Document.new(replaced, params).content\n domain = domain_of url\n output = add_pre(add_domain(html, domain), pre_list)\n output = sanitize_with_img output\n output.gsub /<img /, \"<img onError=\\\"this.style.display='none';\\\" \"\n \n end", "def the_content(content=nil, raw=false) \n \n if node = content || @content || Content.get(params[:id])\n \n # Show raw markdown, or html translation\n raw ? node.body : Maruku.new(\"#{node.body}\").to_html\n\n else\n \"<strong>Error:</strong> No content could be found\" unless ENV['RACK_ENV'] == 'production'\n end\n \n end", "def content\n return @content if @content\n raise Puppet::DevError, \"No source for content was stored with the metadata\" unless metadata.source\n\n unless tmp = Puppet::FileServing::Content.indirection.find(metadata.source)\n fail \"Could not find any content at %s\" % metadata.source\n end\n @content = tmp.content\n end", "def resolve_content\n @content_model == :simple ? %(<p>#{content}</p>) : content\n end", "def scrape_page( page, regex )\n\t\t@my_node=@content=nil\n\n\t\t# Find the node which should be the desired content, title tags only\n\t\t['h1', 'h2', 'h3', 'h4', 'h5'].each do |h|\n\t\t\tpage.search(h).children.each do |node|\n\t\t\t\t@my_node=node if node.inner_text =~ regex\n\t\t\tend\n\t\t\tbreak unless @my_node.nil?\n\t\tend\n\n\t\t# Handle the case where nothing was found\n\t\tunless @my_node.nil?\n\t\t\t# Searched-for content will be the next \n\t\t\t# parent node which is not blank\n\t\t\t@content = @my_node.parent.next\n\t\t\t@content = @content.next until !@content.blank?\n\t\tend\n\n\t\tif !@content.nil? \n\t\t\treturn @content.inner_text \n\t\telse\n\t\t\tnil\n\t\tend\n\tend" ]
[ "0.6848077", "0.6744682", "0.6472699", "0.6437753", "0.63907194", "0.6331798", "0.6328279", "0.6266156", "0.6252447", "0.6235979", "0.6228377", "0.62120765", "0.6173939", "0.6155813", "0.6138418", "0.61300296", "0.60946107", "0.59651005", "0.5962457", "0.59218055", "0.58882046", "0.5881253", "0.5879722", "0.5879569", "0.58765656", "0.5862337", "0.5850572", "0.5849672", "0.58438575", "0.5820202", "0.57945675", "0.5791411", "0.57625365", "0.57482475", "0.57437646", "0.5725542", "0.57161915", "0.5712999", "0.57087797", "0.5699468", "0.5697007", "0.56936914", "0.5690653", "0.5685349", "0.56835586", "0.56825554", "0.5676361", "0.56741434", "0.5664697", "0.56517124", "0.56482667", "0.5648055", "0.5643608", "0.5643372", "0.56369233", "0.5635172", "0.5626199", "0.5620417", "0.5618321", "0.5608951", "0.5608447", "0.5608447", "0.56074274", "0.55975384", "0.559053", "0.5589898", "0.55822843", "0.5579562", "0.5578877", "0.5577656", "0.55770576", "0.5569288", "0.55628717", "0.556096", "0.5560004", "0.5557", "0.5551108", "0.5550285", "0.5545142", "0.5537033", "0.5537033", "0.5537033", "0.5537033", "0.5537033", "0.5537033", "0.5527941", "0.5522149", "0.5522149", "0.5521329", "0.5520263", "0.55198836", "0.55157816", "0.5507718", "0.550263", "0.5494421", "0.5492819", "0.5491876", "0.5490639", "0.5490166", "0.54696286" ]
0.5858667
26
The 'product' is a Netvisor::Product object
def send_product(product) request(product, "product", :post, {method: "add"}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product\n nic_view.product\n end", "def product\n Zapi::Models::Product.new\n end", "def for(product)\n @product = product\n self\n end", "def product\n FarMar::Product.find(self.product_id)\n end", "def product\n CiscoISE::Product.new(@xml.elements['product'])\n end", "def product\n self[\"ProductName\"]\n end", "def product(product)\n products.find(product.id)\n end", "def set_product\n \n end", "def product\n FarMar::Product.find(@product_id)\n end", "def products\n end", "def product\n self.product_size.product\n end", "def product\n @card_product\n end", "def product_instance\n IMS::LTI::Models::ProductInstance.new.from_json(\n guid: 'be42ae52-23fe-48f5-a783-40ecc7ef6d5c',\n product_info: product_info\n )\n end", "def get_result\n @product\n end", "def product\n sale_product = Product.new(:id, :name, :vendor_id)\n Product.all.each do |pro_id, pro|\n if pro_id == product_id\n sale_product = pro\n break\n end\n end\n return sale_product\n end", "def product_information\n super\n end", "def product\n id = self.product_id\n found_product = FarMar::Product.find(id)\n return found_product\n end", "def product\n FarMar::Product.all.select { |product| product.product_id == product_info }\n end", "def product_data\n AsinOMator::Product.new(asin: @asin).data\n end", "def product\n @product ||= Product.find(params[:id])\n end", "def set_product_product\n @product_product = Product::Product.find(params[:id])\n end", "def product \r\n\t\tcase self.likeable_type.downcase\r\n\t\twhen 'bounty'\r\n\t\t\tself.likeable.product\r\n\t\twhen 'features'\r\n\t\t\tself.likeable.features_group.product\r\n\t\twhen 'product'\r\n\t\t\tself.likeable\r\n\t\telse\r\n\t\t\tnil\r\n\t\tend\r\n\tend", "def product\n Reggora::Resources::Product.new(config)\n end", "def set_product\n #@product = Product.find(params[:id])\n end", "def get_product\n Rpc::GetProductResp.new(\n product: Rpc::Product.new(\n id: 1,\n name: 'name',\n price: 2\n )\n )\n end", "def product\n case self._parent.class\n when Product\n self._parent\n when OrderItem\n self._parent.product\n end\n end", "def set_product\n @product = Product.find(params[:id])\n @item = Product.find(params[:id])\n end", "def save_product!\n product = nil\n if product_id.blank?\n product = Inventory::Product.new\n product.name = name\n product.sku = sku\n product.catalogue_id = catalogue_id\n product.facility_strain_id = facility_strain_id\n product.facility_id = facility_id\n product.transaction_limit = transaction_limit\n product.status = 'available'\n product.save!\n else\n product = Inventory::Product.find(product_id)\n end\n\n product\n end", "def set_product\n #クライアントから入力された商品IDの情報をすでに登録されているDBから取ってくる \n #/product/1\n @product = Product.find(params[:id])\n \n end", "def product_info\n {\n product_name: {\n default_value: 'similarity detection reference tool'\n },\n product_version: '1.0',\n description: {\n default_value: 'LTI 2.1 tool provider reference implementation'\n },\n product_family: {\n code: 'similarity detection reference tool',\n vendor: {\n code: 'Instructure.com',\n vendor_name: {\n default_value: 'Instructure'\n },\n description: {\n default_value: 'Canvas Learning Management System'\n }\n }\n }\n }\n end", "def set_product\n @product = Product.includes(:lotteries, :ranking_config_items).find(params[:id])\n end", "def product_name; end", "def new\n\t \t@product = Product.new\n\t end", "def relation_method\n :product\n end", "def product options = {}\n Diffbot::APIClient::Product.new self, options\n end", "def set_product\n\t\t@product = Item.find(params[:id])\n\tend", "def currentProduct()\n @products[@current_product]\n end", "def set_product\r\n\t\t\t@product = @application.products.find(params[:id])\r\n\t\tend", "def set_product\n\t\t @product = Product.find(params[:id])\n\t\t end", "def new\n\t\t@product = Product.new\n\tend", "def new\n\t\t@product = Product.new\n\tend", "def new\n\t\t@product = Product.new\n\tend", "def new\n\t\t@product = Product.new\n\tend", "def new\n\t\t@product = Product.new\n\tend", "def name\n @product.name\n end", "def set_product\n @product = product.find(params[:id])\n end", "def new\n @object = Spree::Product.new()\n @status = true\n @suppliers = Supplier.all\n end", "def set_product\n\t\t\t@product = Product.find(params[:product_id])\n\t\tend", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\r\n @product = Product.find(params[:id])\r\n end", "def set_product\r\n @product = Product.find(params[:id])\r\n end", "def set_product\n @product = current_api_v1_user.products.find(params[:id])\n end", "def initialize(product)\n @product = product\n @quantity = 1\n end", "def set_product\n\t @product = Product.find(params[:id])\n\t end", "def set_product\n #@product = Product.find params[:id]\n @product = Product.where(id: params[:id]).includes(\n {product_impact_line_items: [:impact_line_item, :impact_entries]}).first\n end", "def set_product\n\n # @product = Product.find(params[:id])\n\n end", "def set_product\n @product = Product.find(params[:product_id])\n end", "def get_product_info\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def new\n @product = Product.new\n end", "def set_product\n\t\t@product = Product.find(params[:id])\n\tend", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = @products.find(params[:id])\n end", "def find(product_asin)\n new( SpreeEcs::Product.find(product_asin, { :response_group => \"Large, Variations\" }))\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_prod\n @product = Product.find(params[:id])\n end", "def product(product_id)\n FarMar::Product.all.find { |product| product.id == product_id }\n end", "def set_product\n @product = Product.friendly.find(params[:product_id])\n # logger.debug \"product #{@product.id}\"\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end" ]
[ "0.78556895", "0.7513931", "0.73981184", "0.738854", "0.73283046", "0.7292463", "0.7279387", "0.72631866", "0.7232251", "0.72064364", "0.716114", "0.71467215", "0.71439165", "0.70951134", "0.7041157", "0.6988913", "0.6973837", "0.69716287", "0.6953211", "0.694975", "0.6941382", "0.6921309", "0.691197", "0.68887365", "0.68652177", "0.684703", "0.6822425", "0.680445", "0.6766678", "0.67657244", "0.6735489", "0.67337483", "0.6732994", "0.6712958", "0.6706522", "0.67036897", "0.6701252", "0.667838", "0.6674386", "0.6660134", "0.6660134", "0.6660134", "0.6660134", "0.6660134", "0.66583806", "0.66580015", "0.6643597", "0.66410106", "0.66251075", "0.66213244", "0.66213244", "0.6619718", "0.66159225", "0.66068965", "0.6605414", "0.6596286", "0.65958077", "0.65944856", "0.658928", "0.65857285", "0.6575609", "0.6567434", "0.6562708", "0.65599215", "0.65599215", "0.65599215", "0.65599215", "0.65599215", "0.6552059", "0.6546327", "0.6542576", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921", "0.6534921" ]
0.67535573
30
The 'product' is a Netvisor::Product object the 'id' is the nexudus id of the product
def update_product(product, id) request(customer, "product", :post, {id: id, method: "edit"}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product(product_id)\n FarMar::Product.all.find { |product| product.id == product_id }\n end", "def product(product)\n products.find(product.id)\n end", "def set_product\n #クライアントから入力された商品IDの情報をすでに登録されているDBから取ってくる \n #/product/1\n @product = Product.find(params[:id])\n \n end", "def set_product\n \n @product = Product.find(params[:id].to_i)\n end", "def product\n FarMar::Product.find(@product_id)\n end", "def product\n @product ||= Product.find(params[:id])\n end", "def product\n FarMar::Product.all.select { |product| product.product_id == product_info }\n end", "def set_product\n\t\t@product = params[:id]\n\tend", "def product\n FarMar::Product.find(self.product_id)\n end", "def product_id\n read('product_id')\n end", "def set_product\n #@product = Product.find(params[:id])\n end", "def set_product_product\n @product_product = Product::Product.find(params[:id])\n end", "def product_id; nil end", "def set_product\n @product = Product.find_by( :id => params[:id] )\n end", "def set_product\n\t\t @product = Product.find(params[:id])\n\t\t end", "def set_product\n @product = current_api_v1_user.products.find(params[:id])\n end", "def set_product\n @product = product.find(params[:id])\n end", "def set_product\n begin \n @product = Product.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n puts e\n end\n end", "def set_product\n\t\t@product = Item.find(params[:id])\n\tend", "def set_product\n @product = Product.find(params[:id])\n @item = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\r\n @product = Product.find(params[:id])\r\n end", "def set_product\r\n @product = Product.find(params[:id])\r\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n\t @product = Product.find(params[:id])\n\t end", "def product_id\n params['product_id']\n end", "def set_product\n @product = Product.find_by_hashid(params[:id])\n end", "def get_product_by_id(product_id)\n return Product.find(product_id)\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = @products.find(params[:id])\n end", "def product\n id = self.product_id\n found_product = FarMar::Product.find(id)\n return found_product\n end", "def get_product\n @product = Product.find(params[:id])\n end", "def getProduct(id)\n @products.find {|prod| prod.productId.to_i == id.to_i}\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end", "def set_product\n @product = Product.find(params[:id])\n end" ]
[ "0.7668423", "0.7643721", "0.7594649", "0.7494921", "0.74871963", "0.74462867", "0.74221015", "0.7419703", "0.7418802", "0.7375472", "0.7372648", "0.73545283", "0.73473233", "0.7329036", "0.73284996", "0.730528", "0.7303518", "0.7284543", "0.72837985", "0.72697645", "0.72674215", "0.7262202", "0.7262202", "0.726159", "0.72557366", "0.72383976", "0.7235393", "0.7222787", "0.7202419", "0.7202419", "0.7202419", "0.7202419", "0.7202419", "0.72014517", "0.719897", "0.7191893", "0.7191702", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085", "0.71828085" ]
0.0
-1
The 'customer' is a Netvisor::Customer object
def send_customer(customer) request(customer, "customer", :post, {method: "add"}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def customer_info(customer)\n return customer\n end", "def customer\n @customer ||= Customer.new(value_for('customer'))\n end", "def customer\n @customer ||= fetcher.get(Customer, customer_id)\n end", "def customer(customer)\n id = epages_id(customer)\n perform_get_with_object(\"/customers/#{id}\", {}, Epages::Customer)\n end", "def customer\n self.customer\n end", "def set_customer\n @customer = Tang.customer_class.find(params[:id])\n end", "def set_customer_customer\n @customer_customer = Customer::Customer.find(params[:id])\n end", "def customer(customer_id)\n client.get \"customers/#{inst_id}/#{customer_id}\"\n end", "def customer(customer)\n self.all.select {|rev| rev.customer == customer}\n end", "def customer\n CustomerDrop.new(@voucher.customer)\n end", "def set_customer\n @customer = current_unit.customers.find(params[:customer_id])\n end", "def customer(customer_id)\n perform_get_request(\"/customer/#{customer_id}\")\n end", "def customer_name\n customer.name\n end", "def new_customer\n end", "def set_customer\n @customer = Customer.find(params[:id])\n @address = @customer.addresses.first || Address.new\n @address_business = @customer.addresses.second || Address.new\n @phones = @customer.phones\n \n @phoneRes = @phones[0] || Phone.new\n @phoneCel = @phones[1] || Phone.new\n @phoneRec = @phones[2] || Phone.new\n @phoneRecCel = @phones[3] || Phone.new\n @phoneCom = @phones[4] || Phone.new\n \n end", "def set_customer(customer)\n @fields.merge!(customer.to_hash)\n end", "def show\n @customer = current_customer\n end", "def set_customer\n @customer = current_customer_user\n end", "def account_info_edit\n result = ChargeBee::Customer.retrieve(@customer_id)\n @customer = result.customer\n end", "def add_customer(customer)\n respond_with customer.to_vaulted_billing\n end", "def add_customer(customer)\n respond_with customer.to_vaulted_billing\n end", "def customer\n @customer ||= create_customer\n rescue StandardError\n nil\n end", "def customer_id\n return @customer_id\n end", "def set_customer\n @customer = Customer.find(params[:customer_id])\n end", "def set_customer\n @customer = Customer.find(params[:customer_id])\n end", "def get_customer_id\n return @customer_id\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def customers\n self.customers\n end", "def customer_id\n customer.id\n end", "def customer(options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests/\" + CGI.escape(@id) + \"/customers\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = logged_in_store.customers.find(params[:customer_id]) #Customer.find(params[:customer_id])\n end", "def load_customer_info(customer)\n self.customer_id = customer.id\n self.cardholder_email = customer.email\n\n customer_card = get_default_card(customer)\n\n self.cardholder_name = customer_card.name\n self.card_type = customer_card.type\n self.last4 = customer_card.last4\n self.expiration = customer_card.exp_month.to_s +\n '/' + customer_card.exp_year.to_s\n end", "def customer_order\n @customer_order\n end", "def customers\n @customers ||= new_resource(self, :customer, :customers)\n end", "def set_customer\n @customer = Customer.with_deleted.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = @organization.customers.find(params[:customer_id]) if params[:customer_id]\n end", "def show_customer\n @customer = Customer.find(params[:id])\n end", "def create_customer\n @customer = ::Customer.create!(client_id: @client.id,\n status: GlobalConstant::Customer.active_status,\n details: @customer_details\n )\n success\n end", "def set_customer_info\n @customer_info = CustomerInfo.find(params[:id])\n end", "def id\n customer_id\n end" ]
[ "0.78705794", "0.78291947", "0.769265", "0.7560057", "0.7452757", "0.7316684", "0.72371924", "0.7195455", "0.71931905", "0.7189734", "0.71513337", "0.7150798", "0.7141059", "0.7130278", "0.7121548", "0.71116644", "0.70989114", "0.7091971", "0.70737773", "0.70663786", "0.70663786", "0.70451504", "0.70267844", "0.7019943", "0.7019943", "0.69606787", "0.6937168", "0.6937168", "0.6937168", "0.6928569", "0.69259924", "0.6910241", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.6893531", "0.68882906", "0.6882478", "0.68752223", "0.6833967", "0.6829358", "0.6828", "0.6828", "0.6828", "0.6828", "0.6828", "0.68147117", "0.6782603", "0.6777192", "0.67658806", "0.67641413" ]
0.73114
6
The 'customer' is a Netvisor::Customer object the 'id' is the nexudus id of the customer
def update_customer(customer, id) request(customer, "customer", :post, {id: id, method: "edit"}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id\n customer_id\n end", "def customer(customer_id)\n perform_get_request(\"/customer/#{customer_id}\")\n end", "def customer(id)\n response = get(\"customers/#{id}\")\n response.customer\n end", "def customer(customer_id)\n client.get \"customers/#{inst_id}/#{customer_id}\"\n end", "def customer_id\n customer.id\n end", "def customer_id\n return @customer_id\n end", "def customer_id=(value)\n @customer_id = value\n end", "def get_customer_id\n return @customer_id\n end", "def set_customer_customer\n @customer_customer = Customer::Customer.find(params[:id])\n end", "def customer() #in the tickets (join) table so we can grab customer_id easily, the _id's are already bundled in this table\n sql = \"SELECT * FROM customers WHERE id = $1\"\n values = [@customer_id]\n customer = SqlRunner.run(sql, values).first\n return Customer.new(customer)\n end", "def set_customer\n @customer = Customer.with_deleted.find(params[:id])\n end", "def set_customer\n @customer = Tang.customer_class.find(params[:id])\n end", "def customer(customer)\n id = epages_id(customer)\n perform_get_with_object(\"/customers/#{id}\", {}, Epages::Customer)\n end", "def customer_id\n params['customer_id']\n end", "def find_customer\n if params[:customer_id]\n print \"I made it heree ))))))))))))))))))))))))))))\"\n @customer = Customer.find_by_id(params[:customer_id])\n end\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def customer\n @customer ||= fetcher.get(Customer, customer_id)\n end", "def set_customer\n @customer = Customer.find(params[:id]) rescue nil\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = Customer.find(params[:customer_id])\n end", "def set_customer\n @customer = Customer.find(params[:customer_id])\n end", "def set_customer_info\n @customer_info = CustomerInfo.find(params[:id])\n end", "def set_customer\n @customer = current_unit.customers.find(params[:customer_id])\n end", "def set_customer_detail\n @customer_detail = CustomerDetail.find(params[:id])\n end", "def set_customer_detail\n @customer_detail = CustomerDetail.find(params[:id])\n end", "def set_customers\n @customer = Customer.find(params[:id])\n end", "def show_customer\n @customer = Customer.find(params[:id])\n end", "def set_customer\n @customer = User.find(params[:id])\n end", "def add_customer(customer_id)\n self.customer_id = customer_id\n self.save\n end", "def get_customer(id)\n get(\"customers/#{id}\")\n end", "def get_customer(id)\n get(\"customers/#{id}\")\n end", "def set_customer\n @customer = User.find(params[:id])\n end", "def retrieve_customer(customer_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/customers/{customer_id}',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def find(customer_id)\n response, status = BeyondApi::Request.get(@session, \"/customers/#{customer_id}\")\n\n handle_response(response, status)\n end", "def customer()\n sql = \"SELECT * FROM customers WHERE id = $1\"\n values = [@customer_id]\n pg_result = SqlRunner.run(sql, values)\n customer_hash = pg_result[0]\n customer = Customer.new(customer_hash)\n return customer\nend", "def create_customer(id)\n item = DirectedEdge::Item.new(@database, \"customer#{id}\")\n item.add_tag('customer')\n item.save\n end", "def show\n @customer = customers.find(params[:id])\n end", "def set_customer\n @customer = Customer.includes(:bank).find(params[:id])\n end", "def customer()\n sql = \"SELECT * FROM customers INNER JOIN rentals ON rentals.customer_id\n = customers.id WHERE rentals.id = $1\"\n values = [@id]\n result = SqlRunner.run(sql, values)[0]\n return Customer.new(result)\n end", "def set_customer\n @customer = Customer.where(\"customer_id=? and shop=?\", params[:id],params[:shop]).first\n end", "def find_customer(c_id)\n Customer.find(:all,:conditions => {:C_Id => c_id})\n end" ]
[ "0.8284351", "0.7942699", "0.78741604", "0.78025436", "0.77851367", "0.778428", "0.7749018", "0.74207723", "0.740835", "0.74030113", "0.7401913", "0.7364476", "0.7340759", "0.73258257", "0.72953635", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.72932094", "0.7286153", "0.7286153", "0.7286153", "0.7262387", "0.72120315", "0.719767", "0.719767", "0.719767", "0.719767", "0.719767", "0.7182642", "0.7182642", "0.7163154", "0.7158745", "0.71352714", "0.71352714", "0.7129575", "0.7109776", "0.7082113", "0.70736533", "0.7071969", "0.7071969", "0.7028093", "0.69930136", "0.69875515", "0.6977516", "0.69504875", "0.69256586", "0.69249916", "0.69056284", "0.6889241", "0.68864" ]
0.72594714
72
Returns an array of ancestors above this object. Note that a) this array is ordered with the most senior ancestor at the beginning of the list, and b) this is an _array_, not a _relation_. For that reason, you can pass any additional scope options to the method.
def ancestors(options={}) return [] if top_level? objects = self.class.ancestors_of(self).scoped(options).group_by(&:id) index_path.map { |id| objects[id].first } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ancestors\n ancestors = []\n current_ancestor = self\n \n while !current_ancestor.nil?\n \n if current_ancestor.respond_to?(:parent)\n ancestors << current_ancestor\n current_ancestor = current_ancestor.parent\n else\n current_ancestor = nil\n end\n \n end\n \n ancestors\n end", "def ancestors\n []\n end", "def ancestors\n itr = self\n res = []\n until itr.top_level?\n itr = itr.parents.first\n res << itr\n end\n res\n end", "def ancestors\n parents = []\n\n this_parent = self.parent\n\n while this_parent != nil\n parents << this_parent\n this_parent = this_parent.parent\n end\n parents\n end", "def ancestors(scope = {})\n self_and_ancestors(scope) - [self]\n end", "def ancestors\n @ancestors ||= [self] + (self.parent.try(:ancestors) || [])\n end", "def ancestors\n if parent.nil?\n []\n else\n parent.ancestors + [parent]\n end\n end", "def ancestors\n parents + parents.map(&:ancestors).flatten\n end", "def ancestors\n @ancestors ||= parent ? parent.ancestors + [parent] : []\n end", "def ancestors\n parent ? [parent, *parent.ancestors].reverse : []\n end", "def ancestors\n parent ? [parent, parent.ancestors].flatten : []\n end", "def ancestors\n []\n end", "def ancestors\n model_base_class.scoped(:conditions => ancestor_conditions, :order => :ancestry_string)\n end", "def ancestors \n \t\tres=parents\n \t\tparents.each {|c| res += c.ancestors}\n \t\treturn res.uniq\n \tend", "def ancestors\n return [] if root?\n tree_search_class.find(self[tree_path_field])\n end", "def ancestors(upto: nil)\n base_and_ancestors(upto: upto).where.not(id: ancestors_base.select(:id))\n end", "def ancestors\n node_ancestors.map(&:ancestor)\n end", "def ancestors\n self.class.find(:all, :conditions => \"#{acts_as_nested_set_options[:scope]} AND (#{acts_as_nested_set_options[:left_column]} < #{self[acts_as_nested_set_options[:left_column]]} and #{acts_as_nested_set_options[:right_column]} > #{self[acts_as_nested_set_options[:right_column]]})\", :order => acts_as_nested_set_options[:left_column] )\n end", "def ancestors\n records = self_and_ancestors - [self]\n\n scope = self_and_ancestors.where(arel[:id].not_eq(id))\n scope.records(records)\n end", "def ancestors_r(*args)\n # fetch all parents\n pending = [self]\n ans = []\n while !pending.empty?\n e = pending.pop\n e.parents(*args).each do |p|\n if !ans.include?(p)\n ans << p\n pending.push(p)\n end\n end\n end\n ans\n end", "def ancestors\n node, nodes = self, []\n nodes << node = node.parent while node.parent\n nodes\n end", "def ancestors\n node, nodes = self, []\n nodes << node = node.parent while node.parent\n nodes\n end", "def ancestors\n node, nodes = self, []\n nodes << node = node.parent while node.parent\n nodes\n end", "def ancestors\n self_and_ancestors - [self]\n end", "def ancestors\n @ancestors ||=\n begin\n x = [ self ]\n if ss = superstate\n x.push(*ss.ancestors)\n end\n NamedArray.new(x.freeze, :state)\n end\n end", "def ancestors\n node, nodes = self, []\n nodes << node = node.parent while node.parent\n nodes\n end", "def ancestors\n node, nodes = self, []\n nodes << node = node.parent while node.parent\n nodes\n end", "def ancestors\n nested_set_class.find_with_nested_set_scope(:all, :conditions => \"(#{nested_set_left} < #{self[nested_set_left]} and #{nested_set_right} > #{self[nested_set_right]})\", :order => nested_set_left )\n end", "def ancestors\n without_self self_and_ancestors\n end", "def ancestors\n TreeNode.find(:all,\n :from => \"cms_treenode_ancestors(#{self.id}, #{AuthenticationModel.current_user}) tree_nodes\") rescue []\n end", "def ancestors\n model_base_class.where(ancestor_conditions).order(:materialized_path)\n end", "def ancestors() end", "def ancestors\n @cache[:ancestors]\n end", "def ancestors\n \tif parent_name.blank?\n\t \tancestors = [] \n \telse\n \t\tp = Category.where(name: parent_name).first\n \t\tancestors = p.ancestors\n \t\tancestors << parent_name\n \tend\n \tancestors\n end", "def ancestors\n end", "def ancestors\n without_self(self_and_ancestors)\n end", "def ancestors(list=[])\n return list if parent.nil?\n\n list << parent\n parent.ancestors(list)\n end", "def ancestors\n self.class.ancestors_of(self)\n end", "def ancestors(*args)\n return [] if self.ancestor_ids.blank?\n conditions=[[]]\n ids = self.ancestor_ids.split('.').delete_if{|c|c.empty?}\n ids.each do |id|\n conditions[0] << \"#{self.class.table_name}.id = ?\"\n conditions << id\n end\n conditions[0]=conditions[0].join(' OR ')\n self.class.send(:with_scope, :find=>{:conditions=>conditions}) do\n self.class.find(:all, *args)\n end\n end", "def self_and_ancestors\n \t\tres = [self] + self.ancestors\n \t\treturn res.uniq\n \tend", "def ancestors; end", "def ancestors; end", "def ancestors; end", "def ancestors; end", "def ancestors(*args)\n return call_ancestry_method(:ancestors) if use_ancestry?\n\n Relationship.resources(ancestor_rels(*args))\n end", "def ancestors\n self.root? ? [] : self.parent.ancestors_and_self\n end", "def ancestors_through_parents(result = [self], start = self)\n if start.parent.nil?\n return result.reverse\n else\n result << start.parent\n ancestors_through_parents(result, start.parent)\n end\n end", "def ancestors_through(other, scope = {})\n ancestors_and_self_through(other, scope) - [self]\n end", "def ancestors\n (parent ? parent.ancestors : []) << self\n end", "def all_ancestors(ancestors=[])\n # Assumes only one parent\n result = []\n c = self\n while c && c.parent_groups\n result += c.parent_groups\n c = c.parent_groups[0]\n end\n result\n end", "def matching_ancestors\n []\n end", "def ancestors(options={})\n @ancestors ||= begin\n return [] if top_level?\n objects = self.class.ancestors_of(self).scoped(options).group_by(&:id)\n index_path.map { |id| objects[id].first }\n end\n end", "def ancestors_for(namespace)\n ancestors = []\n current = namespace\n\n while current&.parent_id\n # We're using find_by(id: ...) here to deal with cases where the\n # parent_id may point to a missing row.\n current = Namespace.unscoped.select([:id, :parent_id])\n .find_by(id: current.parent_id)\n\n ancestors << current.id if current\n end\n\n ancestors\n end", "def ancestors\n self.class.where(['auditable_id = ? AND auditable_type = ? AND version <= ?', auditable_id, auditable_type, version])\n end", "def ancestors_ids\n node, nodes = self, []\n while node.parent\n node = node.parent\n nodes << node.id\n end\n nodes\n end", "def ancestors\n @space.ancestors\n end", "def ldap_ancestors\n ancestors.select {|o| o.respond_to?(:oid) && o.oid }\n end", "def all_ancestor_ids\n ancestors.pluck(:id)\n end", "def self_and_ancestors\n # 1. recursively load ancestors\n nodes = []\n node = self\n\n while node\n nodes << node\n node = node.parent\n end\n\n # 2. first ancestor is a root\n nodes.reverse!\n\n # 3. create fake scope\n ActsAsOrderedTree::Relation::Preloaded.new(self.class).\n where(:id => nodes.map(&:id).compact).\n extending(Arrangeable).\n records(nodes)\n end", "def ancestors\n self.class.where(['auditable_id = ? and auditable_type = ? and version <= ?',\n auditable_id, auditable_type, version])\n end", "def ancestors(labels=[])\n ancs = []\n if primary_label and !labels.include?(primary_label.id)\n ancs << primary_label\n ancs = primary_label.ancestors(labels << primary_label.id) + ancs\n end\n ancs\n end", "def self_and_ancestors\n ancestors + [self]\n end", "def self_and_ancestors\n ancestors + [self]\n end", "def ancestors_until_node_not_ancestor_of(klass)\n\t\t\tif !self.parent || !self.node.class.ancestors.include?(klass)\n\t\t\t\treturn []\n\t\t\tend\n\n\t\t\t[self] + self.parent.ancestors_until_node_not_ancestor_of(klass)\n\t\tend", "def ancestors_upto(top = nil, hierarchy_order: nil)\n return super unless use_traversal_ids_for_ancestors_upto?\n\n # We can't use a default value in the method definition above because\n # we need to preserve those specific parameters for super.\n hierarchy_order ||= :desc\n\n # Get all ancestor IDs inclusively between top and our parent.\n top_index = top ? traversal_ids.find_index(top.id) : 0\n ids = traversal_ids[top_index...-1]\n ids_string = ids.map { |id| Integer(id) }.join(',')\n\n # WITH ORDINALITY lets us order the result to match traversal_ids order.\n from_sql = <<~SQL\n unnest(ARRAY[#{ids_string}]::bigint[]) WITH ORDINALITY AS ancestors(id, ord)\n INNER JOIN namespaces ON namespaces.id = ancestors.id\n SQL\n\n self.class\n .from(Arel.sql(from_sql))\n .order('ancestors.ord': hierarchy_order)\n end", "def ancestors(label = nil)\n Pipeline.dsl(self).ancestors(label)\n end", "def ancestors\n return @ancestors unless @ancestors.nil?\n # Stop if this is already the root node\n return @ancestors = [self] if File.basename(tree).empty?\n # Path for parent is blank if parent is root node\n parent_path = if File.dirname(tree) == '.'\n \"\"\n # Otherwise it is the directory in which this node is located\n else\n File.dirname tree\n end\n parent = git_flow_repo.working_file parent_path\n @ancestors = parent.ancestors + [ self ]\n end", "def ancestor_rels(*args)\n options = args.extract_options!\n rel = relationship(:raise_on_multiple => true) # TODO: Handle multiple nodes with a way to detect which node you want\n rels = rel.nil? ? [] : rel.ancestors\n Relationship.filter_by_resource_type(rels, options)\n end", "def ancestors(label = nil)\n append(Traverse.new(:in, label))\n end", "def ancestors_of klass\n ancestors = []\n unexamined = [klass]\n seen = []\n loop do\n break if unexamined.empty?\n current = unexamined.shift\n seen << current\n stores = classes[current]\n break unless stores and not stores.empty?\n klasses = stores.map do |store|\n store.ancestors[current]\n end.flatten.uniq\n klasses = klasses - seen\n ancestors.push(*klasses)\n unexamined.push(*klasses)\n end\n ancestors.reverse\n end", "def ancestors(versions)\n versions.inject([]) do |ancestors, version|\n ancestors + tc_previous_versions(version)\n end\n end", "def ancestors\n includes.map { |i| i.module }.reverse\n end", "def ancestors_of klass\n ancestors = []\n\n unexamined = [klass]\n seen = []\n\n loop do\n break if unexamined.empty?\n current = unexamined.shift\n seen << current\n\n stores = classes[current]\n\n next unless stores and not stores.empty?\n\n klasses = stores.flat_map do |store|\n store.ancestors[current] || []\n end.uniq\n\n klasses = klasses - seen\n\n ancestors.concat klasses\n unexamined.concat klasses\n end\n\n ancestors.reverse\n end", "def generate_ancestor_list(c)\n c.ancestors.find_all { |a| a != c }\n end", "def netzke_ancestors\n if self == Netzke::Base\n []\n else\n superclass.netzke_ancestors + [self]\n end\n end", "def each_ancestor\n ancestors = [self]\n while not ancestors.last.parent.nil?\n ancestors << ancestors.last.parent\n end\n ancestors.reverse_each { |a| yield a }\n end", "def ancestors(node, root = nil)\n root ||= @root\n (self.path(root, node) - [ node ]).reverse\n end", "def ancestors\n if @hash.values.include? :null\n s = []\n build_hash = proc do |attributes, current_hypothesis|\n if attributes.empty?\n s << self.class.new(Hash[*current_hypothesis])\n else\n attributes[0].each do |value|\n build_hash[attributes[1..attributes.length], current_hypothesis + value]\n end\n end\n end\n build_hash[attributes.map { |key, values| values.map { |value| [key, value] } }, []]\n return s\n else\n @hash.select { |attr, value| value != :undefined }.map do |attr, value|\n self.class.new(@hash.merge({ attr => :undefined }))\n end\n end\n end", "def ancestors(selector = T.unsafe(nil)); end", "def ancestors(selector = T.unsafe(nil)); end", "def taxons_with_ancestors\n taxons.flat_map(&:breadcrumb_trail)\n end", "def get_parents\n return @parents\n end", "def ancestor_ids\n read_attribute(self.base_class.ancestry_column).to_s.split(%r|[,/]|).uniq.map { |id| cast_primary_key(id) }\n end", "def all_branches_to_top\n\n res=[]\n if parents.count == 0\n res = [[self]]\n else\n parents.each do |parent|\n parent_b = parent.all_branches_to_top\n parent_b.each do |pb|\n res << pb.unshift(self)\n end\n end\n end\n\n return res\n\n end", "def parents\n unless @parents\n @parents = []\n object = self\n while object.respond_to?(:parent) && object.parent\n @parents << object.parent\n object = object.parent\n end\n end\n @parents\n end", "def self_and_ancestors(scope = {})\n self.class.find_in_nested_set(:all, { :conditions => \"#{scope_condition} AND (#{self[left_col_name]} BETWEEN #{prefixed_left_col_name} AND #{prefixed_right_col_name})\", :order => \"#{prefixed_left_col_name}\" }, scope)\n end", "def ancestors_string\n @ancestors.join(\" &rarr; \")\n end", "def ancestors(child_flow = self)\n parents = []\n parents << child_flow\n parents << child_flow.parent_steps.map { |s| ancestors(s.flow) } if child_flow.parent_steps.present?\n parents.flatten.uniq\n end", "def ancestors(cidr)\n # validate object\n if ( !cidr.kind_of?(IPAdmin::CIDR) )\n begin\n cidr = IPAdmin::CIDR.new(:CIDR => cidr)\n rescue Exception => error\n raise ArgumentError, \"Provided argument raised the following \" +\n \"errors: #{error}\"\n end\n end\n \n list = []\n parent = find_parent(cidr,@root)\n \n until (parent == @root)\n list.push(parent.cidr)\n parent = parent.parent\n end\n\n return(list)\n end", "def persisted_ancestors(node)\n queue = []\n\n parent = node\n\n while (parent = parent.parent)\n break if parent && parent.persisted?\n\n queue.unshift(parent)\n end\n\n ancestors(parent) + [parent].compact + queue\n end", "def ancestors_scope(node, &block)\n if columns.depth?\n build_ancestors_query(node, &block).reorder(depth)\n else\n build_ancestors_query(node) do |query|\n query.start_with { |start| start.select Arel.sql('0').as('__depth') }\n .select(query.prior['__depth'] - 1, :start_with => false)\n\n yield query if block_given?\n end.reorder('__depth')\n end\n end", "def ancestor_ids(*args)\n return call_ancestry_method(:ancestor_ids) if use_ancestry?\n\n Relationship.resource_pairs(ancestor_rels(*args))\n end", "def ancestors(cidr)\n # validate object\n if ( !cidr.kind_of?(NetAddr::CIDR) )\n begin\n cidr = NetAddr::CIDR.create(cidr)\n rescue Exception => error\n raise ArgumentError, \"Provided argument raised the following \" +\n \"errors: #{error}\"\n end\n end\n\n list = []\n parent = find_parent(cidr)\n until (!parent.tag[:Parent])\n list.push( NetAddr.cidr_build(parent.version, parent.to_i(:network), parent.to_i(:netmask)) )\n parent = parent.tag[:Parent]\n end\n\n return(list)\n end", "def parents\n @parents ||= parent ? parent.parents + Array(parent) : []\n end", "def ancestors_affected\n ancestors\n end", "def parents_and_self\n ret = []\n if self.parent\n ret.concat(self.parent.parents_and_self)\n end\n ret << self\n ret\n end", "def parents_and_self\n ret = []\n if self.parent\n ret.concat(self.parent.parents_and_self)\n end\n ret << self\n ret\n end", "def ancestors_string\n @ancestors.join(\"|\")\n end", "def ancestors(selector = nil)\n return NodeSet.new(document) unless respond_to?(:parent)\n return NodeSet.new(document) unless parent\n\n parents = [parent]\n\n while parents.last.respond_to?(:parent)\n break unless ctx_parent = parents.last.parent\n parents << ctx_parent\n end\n\n return NodeSet.new(document, parents) unless selector\n\n root = parents.last\n search_results = root.search(selector)\n\n NodeSet.new(document, parents.find_all { |parent|\n search_results.include?(parent)\n })\n end", "def parents\n if parent.nil?\n [self]\n else\n parent.parents + [self]\n end\n end" ]
[ "0.79718834", "0.79634565", "0.7911822", "0.7903616", "0.78238004", "0.77665204", "0.7740373", "0.76524514", "0.76252556", "0.75986385", "0.7576189", "0.7547435", "0.75416523", "0.75060815", "0.74637353", "0.7448128", "0.7435253", "0.74239385", "0.74226195", "0.7411003", "0.7398833", "0.7367918", "0.7367918", "0.73506385", "0.7330559", "0.72876096", "0.72876096", "0.72425723", "0.72407573", "0.72378963", "0.7071251", "0.7042538", "0.7027104", "0.7003719", "0.6992298", "0.6990496", "0.697654", "0.69764596", "0.69571525", "0.695331", "0.69464576", "0.69464576", "0.69464576", "0.69464576", "0.6895961", "0.6871173", "0.6853721", "0.6841397", "0.68114483", "0.6708471", "0.6698652", "0.6696257", "0.66790825", "0.6633584", "0.66124135", "0.660471", "0.65911186", "0.6586832", "0.65845686", "0.65596414", "0.65281045", "0.65257543", "0.65180165", "0.648466", "0.64811987", "0.6465544", "0.64201987", "0.64073694", "0.6397994", "0.63759995", "0.6336736", "0.63247323", "0.6309892", "0.6308547", "0.62996644", "0.62695605", "0.6254085", "0.6235533", "0.6231183", "0.6231183", "0.6219171", "0.6206937", "0.61391586", "0.6118104", "0.61176497", "0.6107746", "0.60949594", "0.6086279", "0.6082902", "0.6078661", "0.6074046", "0.60736525", "0.6032347", "0.60311663", "0.6019043", "0.6018044", "0.60179675", "0.5983304", "0.5977811", "0.5973509" ]
0.6575926
59
Makes a request to the service
def make_request(method, path, query, headers = {}, body = nil) full_path = @api_base_path + path request = ProxyClientUtils.build_request(method, full_path, query, headers, body) begin response = @connection.request(request) from_headers = ProxyClientUtils.normalize_headers( ProxyClientUtils.filter_response_headers(response.to_hash) ) [response.code.to_i, from_headers, [response.body]] rescue Errno::ECONNREFUSED => e raise RemoteConnectionError.new("#{self.class.base_uri} - #{e.class}: #{e.message}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_request\n response = @http.request(@request)\n end", "def make_request url, parameters={}, method=:get, settings={}\n raise 'not implemented'\n end", "def service_request(service); end", "def make_request\n query = {'income': @income, 'zipcode': @zipcode, 'age': @age}\n begin\n response = HTTParty.get(BASE_URL, query: query)\n # I know I can do better than this\n rescue Exception => e\n raise RequestException\n else\n response\n end\n end", "def run\n make_request(@path)\n end", "def request(service_name, params = {})\n self.class.request(service_name, params.merge(:cookie => @cookie))\n end", "def make_request\n url = 'https://www.googleapis.com/qpxExpress/v1/trips/search?key=' + @api_key\n request = compose_request\n response = RestClient.post url, request, content_type: :json, accept: :json\n response.body\n end", "def request(params)\n\n # Add auth header\n headers = params[:headers] || {}\n headers['x-vcloud-authorization'] = @auth_key if !@auth_key.nil? || !@auth_key.equal?('')\n\n # set connection options\n options = {:url => params[:url],\n :body => params[:body] || '',\n :expects => params[:expects] || 200,\n :headers => headers || {},\n :method => params[:method] || 'GET'\n }\n\n # connect\n res = RestClient::Request.execute options\n\n raise res if (res.code!=params[:expects] && res.code!=200)\n\n res\n\n\n end", "def request(method, message = nil)\n @client.call(method, message:)\n end", "def do_request(params)\n # Convert the uri to a URI if it's a string.\n if params[:uri].is_a?(String)\n params[:uri] = URI.parse(params[:uri])\n end\n host_url = \"#{params[:uri].scheme}://#{params[:uri].host}#{params[:uri].port ? \":#{params[:uri].port}\" : ''}\"\n\n # Hash connections on the host_url ... There's nothing to say we won't get URI's that go to\n # different hosts.\n @connections[host_url] ||= Fog::Connection.new(host_url, @persistent, @connection_options)\n\n # Set headers to an empty hash if none are set.\n headers = params[:headers] || {}\n\n # Add our auth cookie to the headers\n if @cookie\n headers.merge!('Cookie' => @cookie)\n end\n\n # Make the request\n response = @connections[host_url].request({\n :body => params[:body] || '',\n :expects => params[:expects] || 200,\n :headers => headers,\n :method => params[:method] || 'GET',\n :path => params[:uri].path\n })\n\n # Parse the response body into a hash\n #puts response.body\n unless response.body.empty?\n if params[:parse]\n document = Fog::ToHashDocument.new\n parser = Nokogiri::XML::SAX::PushParser.new(document)\n parser << response.body\n parser.finish\n\n response.body = document.body\n end\n end\n\n response\n end", "def request(*args)\n Request.request(self, *args)\n end", "def request(http_method, path, body = '', headers = {})\n puts \"#{http_method}: #{path} - [#{body}]\" if @http_debug\n @request_client.request(http_method, path, body, headers)\n end", "def perform_request(method, path, params={}, body=nil, headers=nil)\n client.perform_request method, path, params, body, headers\n end", "def send_request; end", "def request(*args); end", "def run_request(method, url, body, headers); end", "def request(*args)\n end", "def do_request(params)\n # Convert the uri to a URI if it's a string.\n if params[:uri].is_a?(String)\n params[:uri] = URI.parse(params[:uri])\n end\n host_url = \"#{params[:uri].scheme}://#{params[:uri].host}#{params[:uri].port ? \":#{params[:uri].port}\" : ''}\"\n\n # Hash connections on the host_url ... There's nothing to say we won't get URI's that go to\n # different hosts.\n @connections[host_url] ||= Fog::XML::Connection.new(host_url, @persistent, @connection_options)\n\n # Set headers to an empty hash if none are set.\n headers = params[:headers] || {}\n headers['Accept'] = 'application/*+xml;version=1.5' if version == '1.5'\n\n # Add our auth cookie to the headers\n if @cookie\n headers.merge!('Cookie' => @cookie)\n end\n\n # Make the request\n response = @connections[host_url].request({\n :body => params[:body] || '',\n :expects => params[:expects] || 200,\n :headers => headers,\n :method => params[:method] || 'GET',\n :path => params[:uri].path\n })\n\n # Parse the response body into a hash\n unless response.body.empty?\n if params[:parse]\n document = Fog::ToHashDocument.new\n parser = Nokogiri::XML::SAX::PushParser.new(document)\n parser << response.body\n parser.finish\n response.body = document.body\n end\n end\n\n response\n end", "def request(method, path, *arguments)\n puts \"REQUEST #{path} #{arguments.inspect}\"\n uri = URI.parse( path )\n request_http = http\n if uri.host\n path = uri.request_uri #includes params unlike path()\n request_http = Net::HTTP.new(uri.host, uri.port) #ignores @timeout and @proxy\n else\n uri = site\n end\n puts \"URI #{uri.inspect}\"\n result = ActiveSupport::Notifications.instrument(\"request.active_resource\") do |payload|\n payload[:method] = method\n payload[:request_uri] = \"#{uri.scheme}://#{uri.host}:#{uri.port}#{path}\"\n payload[:result] = request_http.send(method, path, *arguments)\n end\n handle_response(result)\n rescue Timeout::Error => e\n raise TimeoutError.new(e.message)\n rescue OpenSSL::SSL::SSLError => e\n raise SSLError.new(e.message)\n end", "def request(method, path, *arguments)\n method = method.to_s.upcase\n result = ActiveSupport::Notifications.instrument(\"request.active_resource\") do |payload|\n payload[:method] = method\n payload[:request_uri] = \"#{site.scheme}://#{site.host}:#{site.port}#{path}\"\n arguments.unshift(nil) if arguments.length == 1\n payload[:body] = arguments[0]\n payload[:result] = http.send_request(method, path, *arguments)\n end\n handle_response(result)\n rescue Timeout::Error => e\n raise TimeoutError.new(e.message)\n rescue OpenSSL::SSL::SSLError => e\n raise SSLError.new(e.message)\n end", "def make_request!(options = {})\n\t\t\toptions[:client] = client\n\t\t\tself.client.transporter.make_request(options)\n\t\tend", "def request(*args)\n Request.new(self).request(*args)\n end", "def do_request()\n uri = URI.parse(API_BASE_URL + build_request_path())\n response = Net::HTTP.get_response(uri)\n response.body\n end", "def request(method, path, *arguments)\n result = ActiveSupport::Notifications.instrument(\"request.active_resource\") do |payload|\n payload[:method] = method\n payload[:request_uri] = \"#{site.scheme}://#{site.host}:#{site.port}#{path}\"\n payload[:request_arguments] = arguments\n payload[:result] = http.send(method, path, *arguments)\n end\n handle_response(result)\n rescue Timeout::Error => e\n raise TimeoutError.new(e.message)\n rescue OpenSSL::SSL::SSLError => e\n raise SSLError.new(e.message)\n end", "def request\n http_segments = @segments.clone\n @params.each do |key,value|\n http_segments[key] = value\n end\n \n # avoid using URI.encode\n query = ''\n http_segments.each do |key, value|\n query += \"&#{key}=#{value}\"\n end\n query = query[1..-1]\n \n uri = URI::HTTP.build(\n :host => HOST,\n :path => @action_path,\n :query => query\n ).to_s\n result = JSON.parse(HTTParty.get(uri).parsed_response)\n Baidumap::Response.new(result,self)\n end", "def request(method)\n setup_client\n respond_with @client.request(method, @request.url, nil, @request.body, @request.headers, &@request.on_body)\n rescue OpenSSL::SSL::SSLError\n raise SSLError\n rescue Errno::ECONNREFUSED # connection refused\n $!.extend ConnectionError\n raise\n end", "def send_request(method, url)\n @response = client.run_request(method, url, @body, headers) do |req|\n req.params = params\n end\n end", "def _request(verb, path, params)\n Rester.wrap_request do\n Rester.request_info[:producer_name] = name\n Rester.request_info[:path] = path\n Rester.request_info[:verb] = verb\n logger.info('sending request')\n\n _set_default_headers\n start_time = Time.now.to_f\n\n begin\n response = adapter.request(verb, path, params)\n _process_response(start_time, verb, path, *response)\n rescue Errors::TimeoutError\n logger.error('timed out')\n raise\n end\n end\n end", "def _request(url, type, key)\n url = URI(url)\n type ||= :GET\n req_path = \"#{url.path}?#{url.query}\"\n\n if type == :GET\n req = Net::HTTP::Get.new(req_path)\n elsif type == :POST\n req = Net::HTTP::Post.new(req_path)\n end\n\n req.add_field('X-Vermillion-Key', key)\n req.add_field('Accept', 'application/json')\n req.add_field('Cache-Control', 'no-cache')\n req.add_field('From', @config.get(:user))\n req.add_field('User-Agent', 'Vermillion Client 1.0')\n\n res = Net::HTTP.new(url.host, url.port).start do |http|\n http.request(req)\n end\n\n res\n end", "def request(action, data = nil)\n session.request(\n Endpoint.new.soap_action_name(self.class, action),\n data\n )\n end", "def make_request(url)\n res = Typhoeus::Request.new(\n url,\n method: :get,\n headers: {\n \"Accept-Charset\": \"application/x-www-form-urlencoded; charset=UTF-8\",\n \"Accept-Language\" => \"en-US,en;q=0.9,pt;q=0.8\",\n \"X-Riot-Token\" => @api_key.to_s,\n \"User-Agent\": \"https://github.com/drish/rioter\"\n }\n ).run\n parse!(res)\n end", "def make_request(method, url, params = {})\n path = \"#{EbanqApi.base_url}/#{url}\"\n response = case method\n when :get then get(path, headers, params)\n when :post then post(path, headers, params)\n when :put then put(path, headers, params)\n when :delete then delete(path, headers)\n else raise 'Error'\n end\n process_raw_response(response)\n rescue RestClient::ResourceNotFound, SocketError, Errno::ECONNREFUSED => e\n raise e\n end", "def request(*args, &blk)\n (@client ||= connect).request(*args, &blk)\n end", "def request\n EventMachine::HttpRequest.new(url)\n end", "def run\n\n action Colors.grey(\"REQUEST \") + Colors.light_blue(\"#{options[:method].upcase} #{url}\")\n Console.instance.indent\n # run the request\n options[:ssl_verifypeer] = false\n options[:followlocation] = true\n\n Injector.decorate(options)\n\n # convert all headers keys to strings to avoid having symbols like :\"header\" when\n # declaring headers with colons instead of arrows\n if options.key?(:headers)\n new_opts = {}\n options[:headers].map do |k, v|\n new_opts[k.to_s] = v\n end\n options[:headers] = new_opts\n end\n\n if options.key?(:headers) and options[:headers].key?('Content-Type')\n ctype = options[:headers]['Content-Type']\n if ctype.include?('application/json')\n # automatically encode json content\n options[:body] = JSON.generate(options[:body], quirks_mode: true)\n end\n end\n\n\n\n self.response = Typhoeus::Request.new(url, options).run\n\n self.req_response = RequestResponse.new.tap { |r|\n r.raw_body = response.body\n r.headers = response.headers\n r.code = response.code\n r.total_time = response.total_time\n\n if !r.headers.nil? && r.headers.key?('Content-Type') && r.headers['Content-Type'].include?('application/json')\n r.body = JSON.parse(response.body)\n else\n r.body = response.body\n end\n }\n\n # reset assertion counter\n self.assert_no = 1\n\n # evaluate response against expectations\n begin\n instance_eval(&expectations)\n rescue AssertionException\n error error_msg + \" at #{expectations.source_location}\"\n raise RequestException\n rescue StandardError => e\n error 'Exception ' + e.message\n info e.backtrace.inspect\n _debug_info\n error error_msg\n raise RequestException\n ensure\n Console.instance.unindent\n end\n\n req_response\n\n end", "def request(*)\n raise 'HttpApiBuilder::BaseClient#request must be implemented, see documentation'\n end", "def make_request(uri)\n request = Net::HTTP::Get.new uri\n\n request[\"Authorization\"] = \"Basic #{credentials}\"\n request[\"Content-Type\"] = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n\n Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|\n http.request request\n end\n end", "def make_request(uri)\n http_client.start do |http|\n req = Net::HTTP::Get.new(uri.request_uri, @headers)\n req.basic_auth(@username, @password)\n http.request(req)\n end\n end", "def perform_request(request_method, path, options = {})\n Teamsupport::REST::Request.new(self, request_method, path, options).perform\n end", "def make_request(url,headers,query)\n c = HTTPClient.new\n c.get_content(url,query,headers)\nend", "def make_request(resource_name, method_name, params = {}, response_key = nil)\n end", "def start\n call :get, @endpoint\n end", "def make_request(operation, params, headers = {})\n path = Restool::Service::UriUtils.build_path(operation)\n\n Restool::Service::RemoteConnector.execute(\n @remote_client, operation, path, params, headers, @response_handler,\n @service_config.representations, @service_config.basic_auth\n )\n end", "def request(action, data = nil)\n session.request(\n Endpoint.new.soap_action_name(entity_class, action),\n data\n )\n end", "def send_request(req); end", "def request(method, *args)\n public_send(method, *args)\n end", "def perform_get_request\n # Validate preventing request error\n\n # setup params, like API Key if needed\n\n # Perform the request\n get_request\n end", "def request(method, url, payload, format)\n opts = {\n :method => method,\n :url => url,\n :payload => payload,\n :headers => {:content_type => CONTENT_TYPES[format]},\n :timeout => TIMEOUT,\n :open_timeout => OPEN_TIMEOUT\n }\n \n RestClient::Request.execute(opts)\n end", "def request(*args, &block); end", "def build_request\n client.request request_name\n end", "def request(service, method = :get, payload = {})\n res = Infosimples::Data::HTTP.request(\n url: BASE_URL.gsub(':service', service),\n http_timeout: timeout,\n method: method,\n payload: payload.merge(\n token: token,\n timeout: timeout,\n max_age: max_age,\n header: 1\n )\n )\n JSON.parse(res)\n end", "def request(method, path, options, headers)\n headers.merge!({\n 'User-Agent' => user_agent\n })\n\n options.merge!({\n :api_key => api_key\n })\n\n response = connection.send(method) do |request|\n request.url \"#{endpoint}#{path}\", options\n request.body = options\n request.headers = headers\n end\n Shirtsio::Utils.handle_api_error(response) if response.status != 200\n\n Shirtsio::Utils.parse_json(response.body)[:result]\n end", "def request(verb, uri, options = {})\n client = HTTP::Client.new(headers: headers)\n client = client.via(*proxy) if proxy\n handle_response(client.request(verb, uri, options))\n end", "def make_api_request(request_url)\n url = URI.parse(request_url)\n request = Net::HTTP::Get.new(url.path)\n connection = Net::HTTP.new(url.host, url.port)\n connection.use_ssl = true\n connection.request(request)\n end", "def request(path, params={})\n request_url = \"#{API_URL}#{path}\"\n perform_get_request(request_url, params)\n end", "def make_get_request url, headers = []\n make_request url, headers: headers\n end", "def request(method, args = {})\n params = args.merge({@method_param => method})\n params = params.merge(@default_params)\n endpoint = api_endpoint ? api_endpoint.base_url : @endpoint\n url = endpoint + URI.encode_www_form( params.reject{ |k,v| k == :force_update } )\n request_uri = URI.parse(url)\n response = nil\n begin\n MetaService.fetch_request_uri(args.merge(request_uri: request_uri, timeout: @timeout,\n api_endpoint: api_endpoint,\n user_agent: \"#{Site.default.name}/#{self.class}/#{SERVICE_VERSION}\"))\n rescue Timeout::Error\n raise Timeout::Error, \"#{@service_name} didn't respond within #{@timeout} seconds.\"\n end\n end", "def make_request(http, request)\n response = http.request(request)\n Response.new(response)\n end", "def request(verb, uri, body = \"\", query = nil)\n send(verb, HTTParty.normalize_base_uri(Solve360::Config.config.url) + uri,\n :headers => {\"Content-Type\" => \"application/xml\", \"Accepts\" => \"application/json\"},\n :body => body,\n :query => query,\n :basic_auth => auth_credentials)\n end", "def request(verb, uri, body = \"\", query = nil)\n send(verb, HTTParty.normalize_base_uri(Solve360::Config.config.url) + uri,\n :headers => {\"Content-Type\" => \"application/xml\", \"Accepts\" => \"application/json\"},\n :body => body,\n :query => query,\n :basic_auth => {:username => Solve360::Config.config.username, :password => Solve360::Config.config.token})\n end", "def send()\n uri = URI.parse(@service_end_point)\n signature = Amazon::FPS::SignatureUtils.sign_parameters({parameters: @params, \n aws_secret_key: @secret_key,\n host: uri.host,\n verb: @http_method,\n uri: uri.path })\n @params[Amazon::FPS::SignatureUtils::SIGNATURE_KEYNAME] = signature\n\n request = log_request(@params)\n response = self.class.get(@service_end_point, query: @params)\n response = strip_response(response)\n\n log_response(response, request)\n return response\n end", "def request\n self.http_response = http_client.get(url, request_options)\n self\n end", "def call(request_context)\n # convert service_url to uri\n uri = URI.parse(request_context.service_url)\n # get options from request context\n options = request_context.options || {}\n\n # merge default headers with headers from request context\n headers = headers(options)\n # merge default client options with options from request context\n http_options = http_options(uri, request_context.options)\n\n # get path and params from request context and combine them\n path = to_url(request_context.path, (request_context.params || {}))\n @debug = options.fetch(:debug, false)\n\n # Now it's getting interesting\n # create the request object depending on the provided method\n request = create_request(\n request_context.http_method, path, headers, request_context.data\n )\n\n # do the http request\n response = perform(uri, request, http_options)\n parse(response)\n end", "def do_request(request, want_reply, data); end", "def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n return JSON.parse(site.get(:accept=>\"application/json\"))\nend", "def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n return JSON.parse(site.get(:accept=>\"application/json\"))\nend", "def http_send url, form_data, headers, &block\n if form_data['action'] == 'query'\n log.debug(\"GET: #{form_data.inspect}, #{@cookies.inspect}\")\n headers[:params] = form_data\n RestClient.get url, headers, &block\n else\n log.debug(\"POST: #{form_data.inspect}, #{@cookies.inspect}\")\n RestClient.post url, form_data, headers, &block\n end\n end", "def request(type)\n request = case type\n when :wsdl then Net::HTTP::Get.new @endpoint.request_uri\n when :soap then Net::HTTP::Post.new @soap.endpoint.request_uri, soap_headers.merge(headers)\n end\n\n request.basic_auth(*@basic_auth) if @basic_auth\n yield request if block_given?\n request\n end", "def request(verb, path, options)\n options_type = %w[post put].include?(verb.to_s) ? :body : :query\n options[options_type] = {:realm => service.realm_uuid, :service => this.uuid}.merge(options[options_type] || {})\n uri = build_uri(path)\n Vidibus::Secure.sign_request(verb, uri, options[options_type], secret)\n begin\n self.class.send(verb, uri, options)\n rescue StandardError, Exception => e\n raise(RequestError, e.message, e.backtrace)\n end\n end", "def request\n @req\n end", "def get(request)\n do_request(request) { |client| client.http_get }\n end", "def execute_request service, other = {}, headers = {}\n request = build_request(service, other, headers)\n if Typhoeus::Config.verbose\n puts \"< \" + request.inspect\n end\n\n response = request.run\n\n if Typhoeus::Config.verbose\n puts \"> \" + response.body\n end\n\n return Response.new(response.success?, JSON.parse(response.body))\n end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request\n raise 'need to be implemented'\n end", "def request(verb, params)\n params = build_url(params)\n\n if access_token\n params.merge!(:access_token => access_token)\n end\n\n Connection.new(verb, params).fetch\n end", "def send_auth_request \n request = AuthorizeRequest.new(:get, action_to_call) do |req|\n req.request_params = params\n end\n request.send_request(Config.url)\n end", "def create_service_request\n # Geocode the address\n lat, long = Geocoder.coordinates(\"#{self.restaurant_address} , Chicago, IL\") \n\n HTTParty.post('http://311api.cityofchicago.org/open311/v2/requests.json', :body => { \n :api_key => SETTINGS[\"OPEN_311_KEY\"],\n :service_code => '4fd6e4ece750840569000019',\n :attribute => {\n :PLEASESE => 'FOODPOIS',\n :WHATISTH => self.restaurant_name,\n :ONWHATDA => self.date\n },\n :address_string => self.restaurant_address,\n :description => self.description,\n :lat => lat, \n :long => long, \n :first_name => self.first_name,\n :last_name => self.last_name,\n :email => self.email,\n :phone => self.phone\n })\n end", "def request(method, path, params = {})\n req = create_request path\n req.request method.upcase, params do |response|\n if (200..300).cover?(response.status)\n yield response.json if block_given?\n else\n warn response.json['error']\n end\n end\n end", "def make_rest_call(method, url, payload = nil, headers = nil)\n options = call_options_builder(method, url, payload, headers)\n RestClient::Request.execute(options)\n rescue => e\n raise e\n end", "def make_request(request)\n parsed_url = request.url\n\n raise ArgumentError, \"Expecting get argument url to be a valid_url?, got #{request.url}\" if !parsed_url.valid_url? && current_url.nil?\n\n parsed_url = current_url.join_url(request.url) if !request.url.valid_url? && !current_url.nil?\n\n client_resource = RestClient::Resource.new(parsed_url, ssl_version: 'SSLv23_client')\n response = client_resource.send(request.type, params: request.params)\n\n self.xml = Nokogiri::HTML.parse(response)\n end", "def request(klass, path, data={})\n url = url(path)\n http = http(url)\n req = build_request(klass, url, data)\n resp = http.request(req) # send request\n load_json(resp)\n end", "def get endpoint\n do_request :get, endpoint\n end", "def execute\n uri = request_uri\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n retries = Europeana.max_retries\n \n begin\n response = http.request(request)\n rescue Timeout::Error, Errno::ECONNREFUSED, EOFError\n retries -= 1\n raise unless retries > 0\n sleep Europeana.retry_delay\n retry\n end\n \n json = JSON.parse(response.body)\n raise Errors::RequestError, json['error'] unless json['success']\n json\n rescue JSON::ParserError\n raise Errors::ResponseError\n end", "def request\n self.response = prepare_response(http_communication.content)\n end", "def make_request(request)\n result = self.class.post('/', body: request.to_json)\n\n if result.code >= 500\n raise Webceo::Api::ServerError.new(result.code, result.body)\n end\n\n if result.code >= 400\n raise Webceo::Api::ClientError.new(result.code, result.body)\n end\n\n Webceo::Api::Response.new(result.code, result.body, result.headers, result.message)\n end", "def request(resource, options)\n @uri = request_uri(resource, options)\n @parallel ? make_parallel_request : make_normal_request(resource)\n end", "def request\n @rpc.request\n end", "def get_request\n# Use our @http_object object's request method to call the\n# Net::HTTP::Get class and return the resulting response object\n @http_object.request(Net::HTTP::Get.new(@url.request_uri))\n end", "def perform_request(method, path, params, body)\n CONNECTION.run_request \\\n method.downcase.to_sym,\n path,\n ( body ? MultiJson.dump(body): nil ),\n {'Content-Type' => 'application/json'}\n end", "def do_request\n\t\t\tself.response = post_request(options)\n\t\tend", "def request(method, path, query = {}, body = nil, headers = {})\n AwsRequest.new(aws_http_connection).tap do |aws_request|\n aws_request.credentials = credentials\n aws_request.path = path\n aws_request.region = region\n aws_request.service = service\n aws_request.method = method\n aws_request.query = query\n aws_request.body = body\n aws_request.headers = headers\n aws_request.make_request\n end\n end" ]
[ "0.762387", "0.7271272", "0.7071317", "0.7026036", "0.6994136", "0.6906404", "0.6895634", "0.68669", "0.68506193", "0.6819396", "0.68122923", "0.67917764", "0.6784509", "0.67726475", "0.67551833", "0.675154", "0.6730632", "0.6723861", "0.67039114", "0.66909206", "0.6685219", "0.6681169", "0.6679633", "0.6674682", "0.66672164", "0.6663342", "0.66288", "0.6624325", "0.6616874", "0.6614096", "0.6613623", "0.6589829", "0.658655", "0.6586003", "0.6574943", "0.65652406", "0.6560148", "0.655676", "0.6553709", "0.65489167", "0.654303", "0.65427804", "0.6540112", "0.65396816", "0.65299547", "0.652685", "0.6508882", "0.65040666", "0.650332", "0.6502251", "0.6485077", "0.64666986", "0.6456232", "0.64542985", "0.6428499", "0.64280665", "0.64008486", "0.6396756", "0.63902456", "0.6382351", "0.6379595", "0.63767976", "0.6375404", "0.6372507", "0.636533", "0.636533", "0.6361003", "0.63556254", "0.6349077", "0.6348879", "0.6341824", "0.6326709", "0.6325995", "0.6325995", "0.6325995", "0.6325995", "0.6325995", "0.6325995", "0.6325995", "0.6325995", "0.6325995", "0.6325995", "0.6325995", "0.63235044", "0.6321124", "0.63180137", "0.63124025", "0.6309539", "0.6300556", "0.6297242", "0.6292064", "0.6291437", "0.6289727", "0.62822366", "0.62792015", "0.62773836", "0.62725395", "0.6271932", "0.6270941", "0.62693036", "0.62656707" ]
0.0
-1
POST /personas_nota_seguimiento POST /personas_nota_seguimiento.json
def create @persona = Persona.find(params[:persona_id]) @persona_nota_seguimiento = PersonaNotaSeguimiento.new(persona_nota_seguimiento_params) @persona_nota_seguimiento.persona = @persona @persona_nota_seguimiento.usuario = current_usuario if @persona_nota_seguimiento.save redirect_to @persona, notice: 'Guardado Correctamente.' else render :new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def persona_nota_seguimiento_params\n params.require(:persona_nota_seguimiento).permit(:fecha, :notas)\n end", "def set_persona_nota_seguimiento\n @persona_nota_seguimiento = PersonaNotaSeguimiento.find(params[:id])\n @persona = @persona_nota_seguimiento.persona\n end", "def create\n @nota_reparacion = NotaReparacion.new(nota_reparacion_params)\n\n respond_to do |format|\n if @nota_reparacion.save\n format.html { redirect_to @nota_reparacion, notice: 'Nota reparacion was successfully created.' }\n format.json { render :show, status: :created, location: @nota_reparacion }\n else\n format.html { render :new }\n format.json { render json: @nota_reparacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nota_progreso = NotaProgreso.new(nota_progreso_params)\n \n @nota_progreso.historia_clinica_id = @historia_clinica.id\n\n\n\n\n respond_to do |format|\n if @nota_progreso.save\n format.html { redirect_to paciente_historia_clinica_nota_progreso_path(@paciente, @historia_clinica, @nota_progreso), notice: 'Nota de Evolución creada Satisfactoriamente.' }\n\n format.json { render :show, status: :created, location: @nota_progreso }\n else\n format.html { render :new }\n format.json { render json: @nota_progreso.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n params.permit(:intitule, :estObligatoire, :nombreDeCaractere, :ordre, :sondage_id)\n ajout = QuestionOuverteService.instance.creerQuestionOuverte(params[:intitule], params[:estObligatoire], params[:nombreDeCaractere], params[:ordre], params[:sondage_id])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end", "def create\n @noto = Noto.new(params[:noto])\n\n respond_to do |format|\n if @noto.save\n format.html { redirect_to @noto, :notice => 'Noto was successfully created.' }\n format.json { render :json => @noto, :status => :created, :location => @noto }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @noto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n if params[:propietario]\n @negocio_propio = Negocio.find(params[:negocio_id])\n @propietario = Usuario.find(params[:usuario_id])\n authorize! :update, @propietario\n if @propietario.negocios_propios << @negocio_propio\n render json: @propietario.negocios_propios, status: :created\n else\n render json: @propietario.negocios_propios.errors, status: :unprocessable_entity\n end\n else\n @negocio = Negocio.new(parametros_negocio)\n authorize! :create, Negocio\n if @negocio.save\n render json: @negocio, status: :created\n else\n render json: @negocio.errors, status: :unprocessable_entity\n end\n end\n end", "def create\n @persona_punto_ventum = PersonaPuntoVentum.new(persona_punto_ventum_params)\n\n respond_to do |format|\n if @persona_punto_ventum.save\n format.html { redirect_to @persona_punto_ventum.punto_venta, notice: 'Persona punto ventum was successfully created.' }\n format.json { render :show, status: :created, location: @persona_punto_ventum }\n else\n format.html { render :new }\n format.json { render json: @persona_punto_ventum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @regra_negocio = RegraNegocio.new(regra_negocio_params)\n\n respond_to do |format|\n if @regra_negocio.save\n format.html { redirect_to @regra_negocio, notice: 'Regra negocio was successfully created.' }\n format.json { render :show, status: :created, location: @regra_negocio }\n else\n format.html { render :new }\n format.json { render json: @regra_negocio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nota_aluno = NotaAluno.new(nota_aluno_params)\n\n respond_to do |format|\n if @nota_aluno.save\n format.html { redirect_to @nota_aluno, notice: 'Nota aluno was successfully created.' }\n format.json { render :show, status: :created, location: @nota_aluno }\n else\n format.html { render :new }\n format.json { render json: @nota_aluno.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @notadedebito = Notadedebito.find(params[:notadedebito_id])\n @renglon_notadebito = @notadedebito.renglon_notadebitos.create(params[:renglon_notadebito])\n\n respond_to do |format|\n if @renglon_notadebito.save\n format.html { redirect_to @notadebito, notice: 'Renglon notadebito was successfully created.' }\n format.json { render json: @renglon_notadebito}\n else\n format.html { render action: \"new\" }\n format.json { render json: @renglon_notadebito.errors}\n end\n end\n end", "def create\n @personaje_mision = PersonajeMision.new(params[:personaje_mision])\n\n respond_to do |format|\n if @personaje_mision.save\n format.html { redirect_to @personaje_mision, notice: 'Personaje mision was successfully created.' }\n format.json { render json: @personaje_mision, status: :created, location: @personaje_mision }\n else\n format.html { render action: \"new\" }\n format.json { render json: @personaje_mision.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @laboratorio = Laboratorio.new(laboratorio_params)\n get_responsavel\n puts \"O responsavel é: #{@laboratorio.responsavel_id}\"\n if (@responsavel != \"sem_responsavel\")\n @laboratorio.docentes << Docente.find(@laboratorio.responsavel_id)\n puts \"Add relação entre #{@laboratorio.nome} e #{Docente.find(@laboratorio.responsavel_id).user.nome}\"\n end\n respond_to do |format|\n if @laboratorio.save\n format.html { redirect_to @laboratorio, notice: 'Laboratorio was successfully created.' }\n format.json { render :show, status: :created, location: @laboratorio }\n else\n format.html { render :new }\n format.json { render json: @laboratorio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ventas_seguimiento = Ventas::Seguimiento.new(params[:ventas_seguimiento])\n @ventas_seguimiento.usuario = current_user.name\n @ventas_seguimiento.user = current_user\n\n respond_to do |format|\n if @ventas_seguimiento.save\n format.html { redirect_to @ventas_seguimiento, notice: 'Seguimiento was successfully created.' }\n format.json { render json: @ventas_seguimiento, status: :created, location: @ventas_seguimiento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ventas_seguimiento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @persona_proyecto = PersonaProyecto.new(persona_proyecto_params)\n\n respond_to do |format|\n if @persona_proyecto.save\n format.html { redirect_to @persona_proyecto, notice: 'Persona proyecto was successfully created.' }\n format.json { render :show, status: :created, location: @persona_proyecto }\n else\n format.html { render :new }\n format.json { render json: @persona_proyecto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @personaje = Personaje.new(params[:personaje])\n\n respond_to do |format|\n if @personaje.save\n format.html { redirect_to @personaje, notice: 'Personaje was successfully created.' }\n format.json { render json: @personaje, status: :created, location: @personaje }\n else\n format.html { render action: \"new\" }\n format.json { render json: @personaje.errors, status: :unprocessable_entity }\n end\n end\n end", "def nota_tecnica_params\n params.require(:nota_tecnica).permit(:data_nota, :numero_nota, :numero_processo, :status, :nome_do_analista, :area)\n end", "def create\n @tipo_pregunta = TipoPregunta.new(params[:tipo_pregunta])\n\n if @tipo_pregunta.save\n render json: @tipo_pregunta, status: :created, location: @tipo_pregunta\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end", "def create\n @solicitacao_repass = SolicitacaoRepasse.new(solicitacao_repasse_params)\n @entregas_externas = EntregaExterna.all\n @entregas_externas_usuario = []\n @entregas_externas.each { |entrega|\n if !@current_user.isMorador || entrega.encomenda.usuario.id == @current_user.id\n @entregas_externas_usuario.push(entrega)\n end\n }\n\n respond_to do |format|\n if @solicitacao_repass.save\n format.html { redirect_to @solicitacao_repass, notice: \"Solicitacao repasse was successfully created.\" }\n format.json { render :show, status: :created, location: @solicitacao_repass }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @solicitacao_repass.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #params[:estudiante][:persona] = Persona.find_by_nombre_completo(params[:estudiante][:persona])\n @estudiante = Estudiante.new(params[:estudiante])\n\n # Asociar persona a estudiante\n #begin\n @estudiante.persona_id = params[:persona][:id]\n #rescue\n #end\n\n respond_to do |format|\n if @estudiante.save\n format.html { redirect_to @estudiante, notice: 'Estudiante creado' }\n format.json { render json: @estudiante, status: :created, location: @estudiante }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estudiante.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @puntaje = Puntaje.new(params[:puntaje])\n\n respond_to do |format|\n if @puntaje.save\n format.html { redirect_to @puntaje, notice: 'El puntaje ha sido registrado con exito. ' }\n CustomLogger.info(\"Un nuevo puntaje: #{@puntaje.puntaje.to_i.inspect} correspondiente a la tarea: #{@puntaje.planificacion_tarea.inspect} del alumno: #{@puntaje.alumno.user_full_name.inspect} , Descripcion:#{@puntaje.descripcion.inspect} ha sido registrado por el usuario: #{current_user.full_name.inspect}, #{Time.now}\")\n format.json { render json: @puntaje, status: :created, location: @puntaje }\n else\n atributos\n format.html { render action: \"new\" }\n CustomLogger.error(\"Se ha producido un error al querer registrar el puntaje: #{@puntaje.puntaje.to_i.inspect} y sus demas atributos, por el usuario: #{current_user.full_name.inspect}, #{Time.now}\")\n format.json { render json: @puntaje.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @notificaciones_admin_actualouse = NotificacionesAdminActualouse.new(params[:notificaciones_admin_actualouse])\n\n respond_to do |format|\n if @notificaciones_admin_actualouse.save\n format.html { redirect_to :back, notice: 'Notificaciones admin actualouse was successfully created.' }\n format.json { render json: @notificaciones_admin_actualouse, status: :created, location: @notificaciones_admin_actualouse }\n else\n format.html { render action: \"new\" }\n format.json { render json: @notificaciones_admin_actualouse.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @consultorio_n = ConsultorioN.new(consultorio_n_params)\n\n respond_to do |format|\n if @consultorio_n.save\n format.html { redirect_to @consultorio_n, notice: 'Consultorio n was successfully created.' }\n format.json { render :show, status: :created, location: @consultorio_n }\n else\n format.html { render :new }\n format.json { render json: @consultorio_n.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @palabra = Palabra.new(params[:palabra])\n @palabra.significados = params[:significados] \n respond_to do |format|\n if @palabra.save\n format.html { redirect_to @palabra, notice: 'La palabra fue guardada correctamente.' }\n format.json { render json: @palabra, status: :created, location: @palabra }\n else\n format.html { render action: \"new\" }\n format.json { render json: @palabra.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @estado_persona = EstadoPersona.new(estado_persona_params)\n @estado_persona.estado_id = params[:estado_persona][:estado_id]\n @estado_persona.vendedor_id = params[:estado_persona][:vendedor_id]\n @estado_persona.fecha_inicio = params[:estado_persona][:fecha_inicio]\n\n respond_to do | format|\n if @estado_persona.save\n format.html { redirect_to @estado_persona, notice: 'Estado creado con exito.' }\n format.json { render :show, status: :created, location: @estado_persona }\n else\n format.html { render :new }\n format.json { render json: @estado_persona.errors, status: :unprocessable_entity }\n end\n end\n end", "def estado_notificacion_params\n params.require(:estado_notificacion).permit(:estado_not_id, :estado_not_nombre)\n end", "def create\n @paciente = Paciente.new(paciente_params)\n @persona = @paciente.personas.new(persona_params)\n\n respond_to do |format|\n if @persona.save\n format.html { redirect_to pacientes_url, notice: 'Datos del paciente fueron guardados' }\n else\n format.html { render :new }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end", "def repuesto_params\n params.require(:repuesto).permit(:articulo, :precio, :id_interna, :descripcion)\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 notificacione_params\n params.require(:notificacione).permit(:mensaje, :fecha, :id_tipo_notificacion)\n end", "def create\n @tipo_negocio = TipoNegocio.new(params[:tipo_negocio])\n\n respond_to do |format|\n if @tipo_negocio.save\n format.html { redirect_to @tipo_negocio, notice: 'Tipo negocio was successfully created.' }\n format.json { render json: @tipo_negocio, status: :created, location: @tipo_negocio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_negocio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @repuesto = Repuesto.new(repuesto_params)\n\n respond_to do |format|\n if @repuesto.save\n format.html { redirect_to @repuesto, notice: 'Repuesto was successfully created.' }\n format.json { render :show, status: :created, location: @repuesto }\n else\n format.html { render :new }\n format.json { render json: @repuesto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sitio_entrega = SitioEntrega.new(params[:sitio_entrega])\n\n respond_to do |format|\n if @sitio_entrega.save\n format.html { redirect_to @sitio_entrega, notice: 'Sitio entrega was successfully created.' }\n format.json { render json: @sitio_entrega, status: :created, location: @sitio_entrega }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sitio_entrega.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nota_tecnica = NotaTecnica.new(nota_tecnica_params)\n\n respond_to do |format|\n if @nota_tecnica.save\n format.html { redirect_to action: :index, notice: 'Nota Técnica criada com sucesso.' }\n else\n format.html { render action: 'new' }\n end\n end\n end", "def create\n\t\tauthorize! :create, Presupuesto\n @presupuesto = Presupuesto.new(presupuesto_params)\n\n respond_to do |format|\n if @presupuesto.save\n sesion = Sesion.find_by(usuario_id: current_usuario.id, fechaFin: nil)\n\n Transaccion.create!(descripcion: \"Creación del presupuesto del proyecto #{@presupuesto.proyecto.nombre}: #{@presupuesto.attributes}\",\n sesion_id: sesion.id, \n proyecto_id: @presupuesto.proyecto.id)\n\n\n# Transaccion.create!(\n# descripcion: 'Creacion del presupuesto del proyecto'+@presupuesto.proyecto.nombre,\n# ‪ sesion_id‬: sesion.id,\n# ‪ proyecto_id‬: @presupuesto.proyecto.id\n# )\n format.html { redirect_to gestionar_presupuesto_path(@presupuesto) }#, notice: 'El Presupuesto fue creado exitosamente.' }\n #format.json { render :show, status: :created, location: @presupuesto }\n else\n format.html { redirect_to proyectos_mis_proyectos_path }\n #render :new }\n #format.json { render json: @presupuesto.errors, status: :unprocessable_entity }\n end\n end\n end", "def noticia_params\n params.require(:noticia).permit(:titulo, :texto, :semestre, :fecha, :imagen_url)\n end", "def create\n @pessoacondominio = Pessoacondominio.new(pessoacondominio_params)\n\n respond_to do |format|\n if @pessoacondominio.save\n format.html { redirect_to @pessoacondominio, notice: 'Pessoa cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @pessoacondominio }\n else\n format.html { render :new }\n format.json { render json: @pessoacondominio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_persona = TipoPersona.new(tipo_persona_params)\n\n respond_to do |format|\n if @tipo_persona.save\n format.html { redirect_to @tipo_persona, notice: 'Tipo persona was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_persona }\n else\n format.html { render :new }\n format.json { render json: @tipo_persona.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @persona = Persona.new(persona_params)\n\n respond_to do |format|\n if @persona.save\n format.html { redirect_to @persona, notice: 'Datos personales registrados exitosamente.' }\n format.json { render :show, status: :created, location: @persona }\n else\n format.html { render :new }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end", "def persona_params\n params.require(:persona).permit(:pers_documentoIdentidad, :pers_nombres, :pers_apellidos, :pers_alias, :pers_sexo, :pers_pesoCorporal, :pers_paisOrigen, :pers_fechaNacimiento, :pers_estadoCivil, :pers_direccionDomicilio, :pers_ciudadDomicilio, :pers_telefonoPersonal1, :pers_telefonoPersonal2, :pers_correoElectrPersonal, :pers_correoElectrLaboral, :pers_perfilLaboral, :sucursalEmpresaId, :empresaCargo, :pers_telefonoLaboral1, :pers_telefonoLaboral2, :pers_estadoRegistro)\n end", "def novedad_mecanica_params\n params.require(:novedad_mecanica).permit(:observacion, :fecha)\n end", "def nota_reparacion_params\n params.require(:nota_reparacion).permit(:numeroserie, :fecha)\n end", "def create\n @notificacione = Notificacione.new(notificacione_params)\n\n respond_to do |format|\n if @notificacione.save\n format.html { redirect_to @notificacione, notice: 'Notificacione was successfully created.' }\n format.json { render :show, status: :created, location: @notificacione }\n else\n format.html { render :new }\n format.json { render json: @notificacione.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 simulacion=@Empresa.simulacions.new(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 @sesiune = Sesiune.new(sesiune_params)\n\n respond_to do |format|\n if @sesiune.save\n\n # duplic temele si domeniile din ultima sesiune si le adaug in baza de date cu sesiune_id asta pe care tocmai am creat-o\n @ultima_sesiune = Sesiune.where(este_deschisa: false).last\n Domeniu.where(sesiune_id: @ultima_sesiune.id).each do |dom|\n nou_dom = Domeniu.create(nume: dom.nume, descriere: dom.descriere, user_id: dom.user_id, sesiune_id: @sesiune.id)\n Tema.where(sesiune_id: @ultima_sesiune.id).where(domeniu_id: dom.id).each do |tema|\n Tema.create(nume: tema.nume, descriere: tema.descriere, domeniu_id: nou_dom.id, este_libera: true, user_id: tema.user_id, sesiune_id: @sesiune.id)\n # ce faci dc user_id-ul temei este un student care a terminat? si th i se desfiinteaza contul?\n end\n end\n\n format.html { redirect_to controlPanel_path, notice: 'Sesiune was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sesiune }\n else\n format.html { render action: 'new' }\n format.json { render json: controlPanel_path.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @repuesto = Repuesto.new(repuesto_params)\n\n respond_to do |format|\n if @repuesto.save\n format.html { redirect_to @repuesto, notice: 'Repuesto creado exitosamente' }\n format.json { render :show, status: :created, location: @repuesto }\n else\n format.html { render :new }\n format.json { render json: @repuesto.errors, status: :unprocessable_entity }\n end\n end\n end", "def criar_sobrevivente\n @suvivor = Sobrevivente.create(\n name: params[:name], genero: params[:genero], idade: params[:idade],\n lat: params[:lat], lon: params[:lon],\n agua: params[:agua], comida: params[:comida], medicamento: params[:medicamento],\n municao: params[:municao]\n )\n render json: @suvivor\n end", "def create\n @reuniao = Reuniao.new(reuniao_params)\n @pautum=Pautum.new\n @reuniao.pautum =@pautum\n @reuniao.atum=Atum.new\n @reuniao.status=\"Preparação\"\n @pautum.status=\"Preparação\"\n \n respond_to do |format|\n if @reuniao.save\n @pautum.titulo=@reuniao.titulo\n @pautum.save\n format.html { redirect_to @reuniao, notice: 'Reuniao was successfully created.' }\n format.json { render :show, status: :created, location: @reuniao }\n else\n format.html { render :new }\n format.json { render json: @reuniao.errors, status: :unprocessable_entity }\n end\n end\n end", "def nota_params\n params.require(:nota).permit(:nota, :pesquisa_id)\n end", "def create\n @tipo_notificacione = TipoNotificacione.new(tipo_notificacione_params)\n\n respond_to do |format|\n if @tipo_notificacione.save\n format.html { redirect_to @tipo_notificacione, notice: 'Tipo notificacione was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_notificacione }\n else\n format.html { render :new }\n format.json { render json: @tipo_notificacione.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nota_credito = NotaCredito.new(nota_credito_params)\n\n respond_to do |format|\n if @nota_credito.save\n format.html { redirect_to @nota_credito, notice: 'Nota credito was successfully created.' }\n format.json { render :show, status: :created, location: @nota_credito }\n else\n format.html { render :new }\n format.json { render json: @nota_credito.errors, status: :unprocessable_entity }\n end\n end\n end", "def presupuestooo_params\n params.require(:presupuestooo).permit(:fecha, :turno, :cantHora, :cantGuardia, :montoMensual, :turno_id)\n end", "def create\n @persona = Persona.new(params[:persona])\n\n respond_to do |format|\n if @persona.save\n format.html { redirect_to @persona, notice: 'la Persona fue creada exitosamente.' }\n format.json { render json: @persona, status: :created, location: @persona }\n else\n format.html { render action: \"new\" }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @anteproyecto_observacion = AnteproyectoObservacion.new(anteproyecto_observacion_params)\n\n respond_to do |format|\n if @anteproyecto_observacion.save\n format.html { redirect_to @anteproyecto_observacion, notice: 'Anteproyecto observacion was successfully created.' }\n format.json { render :show, status: :created, location: @anteproyecto_observacion }\n else\n format.html { render :new }\n format.json { render json: @anteproyecto_observacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @solicitud_servicio = SolicitudServicio.new(params[:solicitud_servicio])\n\n respond_to do |format|\n if @solicitud_servicio.save\n format.html { redirect_to @solicitud_servicio, notice: 'Solicitud servicio was successfully created.' }\n format.json { render json: @solicitud_servicio, status: :created, location: @solicitud_servicio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @solicitud_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def peso_params\n params.require(:peso).permit(:fecha, :peso, :usuario_id)\n end", "def create\n @nossos_servico = NossosServico.new(params[:nossos_servico])\n\n respond_to do |format|\n if @nossos_servico.save\n format.html { redirect_to(@nossos_servico, :notice => 'Nossos servico was successfully created.') }\n format.xml { render :xml => @nossos_servico, :status => :created, :location => @nossos_servico }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @nossos_servico.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @alumno = Alumno.new(params[:alumno])\n\n respond_to do |format|\n if @alumno.save\n render json: @alumno.as_json(include: :persona), status: :created, location: @alumno\n else\n render json: @alumno.errors, status: :unprocessable_entity\n end\n end\n end", "def regra_negocio_params\n params.require(:regra_negocio).permit(:siglaRegra, :nomeRegra, :descricaoRegra)\n end", "def create\n @notificacao = Notificacao.new(notificacao_params)\n\n respond_to do |format|\n if @notificacao.save\n format.html { redirect_to @notificacao, notice: 'Notificacao foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @notificacao }\n else\n format.html { render :new }\n format.json { render json: @notificacao.errors, status: :unprocessable_entity }\n end\n end\n end", "def paciente_params\n params.require(:persona).require(:paciente).permit(:domicilio, :civil, :nss, :edad, :peso, :talla, :imc, :t_sangre, :nutriologo_id)\n end", "def create\n @persona = Persona.find(params[:persona_id])\n @info_extra_paciente = @persona.info_extra_pacientes.new(info_extra_paciente_params)\n respond_to do |format|\n if @info_extra_paciente.save\n format.html { redirect_to @persona, notice: 'Informacion de Contacto agregada.' }\n format.json { render :show, status: :created, location: @persona }\n else\n format.html { render :new }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @estado_notificacion = EstadoNotificacion.new(estado_notificacion_params)\n\n respond_to do |format|\n if @estado_notificacion.save\n format.html { redirect_to @estado_notificacion, notice: 'Estado notificacion was successfully created.' }\n format.json { render action: 'show', status: :created, location: @estado_notificacion }\n else\n format.html { render action: 'new' }\n format.json { render json: @estado_notificacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params.permit(:pseudo_administrateur, :email_administrateur, :motDePasse_administrateur)\n ajout = AdministrateurService.instance.creerNouveauAdmin(params[:pseudo_administrateur], params[:email_administrateur], params[:motDePasse_administrateur])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end", "def create\n @pregoestitulo = Pregoestitulo.new(pregoestitulo_params)\n\n pregao = Pregao.where('data = ?', @pregoestitulo.date).first\n\n if pregao.blank?\n pregao = Pregao.new\n pregao.data = @pregoestitulo.date\n pregao.flagativo = true\n pregao.save\n end\n\n @pregoestitulo.pregao_id = pregao.id\n\n respond_to do |format|\n if @pregoestitulo.save\n format.html { redirect_to @pregoestitulo, notice: 'Título incluído com sucesso.' }\n format.json { render :show, status: :created, location: @pregoestitulo }\n else\n format.html { render :new }\n format.json { render json: @pregoestitulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def noticium_params\n params.require(:noticium).permit(:fecha, :cuerpo, :bajada, :titular)\n end", "def create\n @persona = Persona.new(params[:persona])\n \n respond_to do |format|\n if @persona.save\n format.json { render :json => @persona,\n :status => :created, :location => @persona }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def create\n \n params[:empresa_servicio][:prefijo] = params[:empresa_id]\n @empresa = Empresa.find(:first, :conditions => [\"prefijo = ?\", params[:empresa_id]])\n @empresa_servicio = @empresa.empresa_servicio.build(params[:empresa_servicio])\n\n respond_to do |format|\n if @empresa_servicio.save\n \n format.html { redirect_to empresa_empresa_servicios_path, notice: \"El servicio #{@empresa_servicio.servicio.nombre} fue asociado a la empresa #{@empresa_servicio.empresa.nombre_empresa}\"}\n \n else\n format.html { render action: \"new\" }\n end\n end\n end", "def create\r\n\r\n respond_to do |format|\r\n if @sistemas_consejero.save\r\n format.html { redirect_to @sistemas_consejero, notice: 'Se añadió un nombre de consejero de ingeniería de sistemas correctamente.' }\r\n format.json { render :show, status: :created, location: @sistemas_consejero }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @sistemas_consejero.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @prospecto_telefono = ProspectoTelefono.new(prospecto_telefono_params)\n\n respond_to do |format|\n if @prospecto_telefono.save\n format.html { redirect_to @prospecto_telefono, notice: 'Prospecto telefono was successfully created.' }\n format.json { render :show, status: :created, location: @prospecto_telefono }\n else\n format.html { render :new }\n format.json { render json: @prospecto_telefono.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @asiento_de_servicio = AsientoDeServicio.new(asiento_de_servicio_params)\n\n respond_to do |format|\n if @asiento_de_servicio.save\n format.html { redirect_to @asiento_de_servicio, notice: 'Asiento de servicio was successfully created.' }\n format.json { render :show, status: :created, location: @asiento_de_servicio }\n else\n format.html { render :new }\n format.json { render json: @asiento_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @datos_personal = DatosPersonal.new(datos_personal_params)\n\n respond_to do |format|\n if @datos_personal.save\n format.html { redirect_to @datos_personal, notice: 'Datos personal was successfully created.' }\n format.json { render :show, status: :created, location: @datos_personal }\n else\n format.html { render :new }\n format.json { render json: @datos_personal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @perfilnegocio = Perfilnegocio.new(params[:perfilnegocio])\n\n respond_to do |format|\n if @perfilnegocio.save\n format.html { redirect_to @perfilnegocio, notice: 'Perfilnegocio was successfully created.' }\n format.json { render json: @perfilnegocio, status: :created, location: @perfilnegocio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @perfilnegocio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nota = Nota.new(params[:nota]) \n \n #@nota.lote_id = 172\n \n respond_to do |format|\n if @nota.save\n flash[:notice] = 'Nota was successfully created.'\n format.html { redirect_to(@nota) }\n format.xml { render :xml => @nota, :status => :created, :location => @nota }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @nota.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @notadisciplinare = Notadisciplinare.new(notadisciplinare_params)\n\n respond_to do |format|\n if @notadisciplinare.save\n format.html { redirect_to @notadisciplinare, notice: 'Notadisciplinare was successfully created.' }\n format.json { render :show, status: :created, location: @notadisciplinare }\n else\n format.html { render :new }\n format.json { render json: @notadisciplinare.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params.permit(:email, :adresseIp)\n ajout = UtilisateurService.instance.creerNouveauUtilisateur(params[:email], params[:adresseIp])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end", "def notificacao_params\n params.require(:notificacao).permit(:texto, :motivo, :state, :origem_id, :entidade_id, :posto_id)\n end", "def create \n @lancamentorapido = Lancamentorapido.new(params[:lancamentorapido])\n \n #Validações padrão\n @lancamentorapido.tipo = :receita if @lancamentorapido.tipo.blank?\n @lancamentorapido.valor = 0 if @lancamentorapido.valor.blank? \n \n respond_to do |format|\n if @lancamentorapido.save\n format.html { redirect_to lancamentorapidos_path, notice: 'Lancamento was successfully created.' } \n# format.html { redirect_to '/lancamentorapidos'}\n format.json { render json: lancamentorapidos_path, status: :created, location: @lancamentorapido }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lancamentorapido.errors, status: :unprocessable_entity }\n end\n end\n end", "def noticium_params\n params.require(:noticium).permit(:id, :titulo, :bajada, :contenido, :id_user, :comentario)\n end", "def create\n @noticium = Noticium.new(params[:noticium])\n @entidade = Entidade.where(\" user_id = ?\", current_user.id)\n unless @entidade.nil? or @entidade.empty?\n @noticium.entidade_id = @entidade[0].id\n end\n\n respond_to do |format|\n if @noticium.save\n flash[:notice] = 'Noticia criado(a) com sucesso.'\n format.html { redirect_to(@noticium) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "def persona_params\n params.require(:persona).permit(:tipo_documento_id, :numero_documento, :cuit, :apellido, :nombre, :domicilio, :telefono, :email, :fecha_nacimiento)\n end", "def create\n @status_de_la_notificacion = StatusDeLaNotificacion.new(params[:status_de_la_notificacion])\n\n respond_to do |format|\n if @status_de_la_notificacion.save\n format.html { redirect_to @status_de_la_notificacion, notice: 'Status de la notificacion was successfully created.' }\n format.json { render json: @status_de_la_notificacion, status: :created, location: @status_de_la_notificacion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status_de_la_notificacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prueba = Prueba.new(prueba_params)\n\n cantidadAlmacenada = @prueba.cantidad_almacenada\n cantidadDesechada = @prueba.cantidad_desechada\n\n @prueba.cantidad = cantidadAlmacenada + cantidadDesechada \n\n respond_to do |format|\n if @prueba.save\n\n @etiqueta = Etiqueta.new\n\n etiquetaAnalisis = @prueba.etiqueta.etiqueta\n idAnalisis = @prueba.id\n idAnalisisString = idAnalisis.to_s\n\n @etiqueta.etiqueta = etiquetaAnalisis + idAnalisisString + \"-\"\n @etiqueta.formato_id = 2\n @etiqueta.save\n\n format.html { redirect_to etiqueta_mostrar_path(@etiqueta.id), notice: 'Prueba was successfully created.' }\n format.json { render :show, status: :created, location: @prueba }\n else\n format.html { render :new }\n format.json { render json: @prueba.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @t_nota_credito = TNotaCredito.new(t_nota_credito_params)\n\n respond_to do |format|\n if @t_nota_credito.save\n format.html { redirect_to @t_nota_credito, notice: 'T nota credito was successfully created.' }\n format.json { render :show, status: :created, location: @t_nota_credito }\n else\n format.html { render :new }\n format.json { render json: @t_nota_credito.errors, status: :unprocessable_entity }\n end\n end\n end", "def notadisciplinare_params\n params.require(:notadisciplinare).permit(:data, :oggetto, :docenza_id, :alunno_id)\n end", "def create\n @persona_tipo = PersonaTipo.new(params[:persona_tipo])\n\n respond_to do |format|\n if @persona_tipo.save\n format.html { redirect_to @persona_tipo, notice: 'Tipo de Participante registrado correctamente.' }\n format.json { render json: @congreso, status: :created, location: @persona_tipo }\n else\n if current_user.is_admin?\n @congresos = Congreso.all(:order => \"nombre\")\n else\n @congresos = current_user.congresos(:order => \"nombre\")\n end\n format.html { render action: \"new\" }\n format.json { render json: @persona_tipo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @puntaje = Puntaje.new(params[:puntaje])\n\n respond_to do |format|\n if @puntaje.save\n format.html { redirect_to @puntaje, notice: 'Puntaje was successfully created.' }\n format.json { render json: @puntaje, status: :created, location: @puntaje }\n else\n atributos\n format.html { render action: \"new\" }\n format.json { render json: @puntaje.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @seguimiento = Seguimiento.new(seguimiento_params)\n\n respond_to do |format|\n if @seguimiento.save\n format.html { redirect_to @seguimiento.caso, notice: \"Seguimiento creado.\" }\n format.json { render :show, status: :created, location: @seguimiento }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @seguimiento.errors, status: :unprocessable_entity }\n end\n end\n end", "def persona_params\n params.require(:persona).permit(:nombre, :descripcion, :tipo, :telefono, :email, :direccion, :piso, :depto)\n end", "def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n respond_to do |format|\n if @respuesta.save\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully created.' }\n format.json { render json: @respuesta, status: :created, location: @respuesta }\n else\n format.html { render action: \"new\" }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end", "def respuesta_params\n params.require(:respuesta).permit(:consulta_id, :pregunta_id, :valor)\n end", "def simulado_params\n params.require(:simulado).permit(:end, :vestibulando_id, :prova_id)\n end", "def seguimiento_params\n params.require(:seguimiento).permit(:fecha, :caso_id, :numero, :glosa)\n end", "def create\n @pedido_responsabilidade = PedidoResponsabilidade.new(pedido_responsabilidade_params)\n if (@permissao_novo && Laboratorio.find(@pedido_responsabilidade.id_laboratorio).responsavel == nil)\n @pedido_responsabilidade.id_docente = current_user.id\n respond_to do |format|\n if @pedido_responsabilidade.save\n format.html { redirect_to account_path, notice: 'Pedido responsabilidade was successfully created.' }\n format.json { render :show, status: :created, location: @pedido_responsabilidade }\n else\n format.html { render :new }\n format.json { render json: @pedido_responsabilidade.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to account_path, notice: 'Não foi possível solicitar responsabilidade.' }\n format.json { head :no_content }\n end\n end\n end", "def socioeduk_contato_params\n params.require(:socioeduk_contato).permit(:jovem_id, :tipo_contato_id, :ddd, :numero)\n end", "def create\n @notion = Notion.new(notion_params)\n\n respond_to do |format|\n if @notion.save\n format.html { redirect_to @notion, notice: 'Notion was successfully created.' }\n format.json { render :show, status: :created, location: @notion }\n else\n format.html { render :new }\n format.json { render json: @notion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ponderacion = Ponderacion.new(ponderacion_params)\n\n respond_to do |format|\n if @ponderacion.save\n format.html { redirect_to @ponderacion, notice: 'Ponderacion was successfully created.' }\n format.json { render :show, status: :created, location: @ponderacion }\n else\n format.html { render :new }\n format.json { render json: @ponderacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def tiponovedad_params\n params.require(:tiponovedad).permit(:nombre)\n end", "def create\n @basico_persona_juridica = Basico::PersonaJuridica.new(basico_persona_juridica_params)\n\n respond_to do |format|\n if @basico_persona_juridica.save\n format.html { redirect_to @basico_persona_juridica, notice: 'Persona juridica was successfully created.' }\n format.json { render :show, status: :created, location: @basico_persona_juridica }\n else\n format.html { render :new }\n format.json { render json: @basico_persona_juridica.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @simulado = Simulado.new(simulado_params)\n\n respond_to do |format|\n if @simulado.save\n format.html { redirect_to @simulado, notice: 'Simulado was successfully created.' }\n format.json { render :show, status: :created, location: @simulado }\n else\n format.html { render :new }\n format.json { render json: @simulado.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7370511", "0.6545128", "0.6458106", "0.64423764", "0.6388305", "0.63723826", "0.62660915", "0.6233119", "0.6227858", "0.62270534", "0.62227035", "0.6217265", "0.6158079", "0.6150249", "0.61256623", "0.6123591", "0.6121697", "0.6101684", "0.6089453", "0.6079128", "0.6058509", "0.6051221", "0.60481536", "0.604495", "0.60345626", "0.603444", "0.6028999", "0.6027365", "0.60263723", "0.60212624", "0.60207", "0.6017982", "0.60092807", "0.59984577", "0.59945816", "0.59889716", "0.5976894", "0.5974293", "0.5973779", "0.5970908", "0.59662133", "0.59629273", "0.5960751", "0.59606797", "0.5955149", "0.59505904", "0.59427434", "0.5942673", "0.5942232", "0.59411377", "0.5939429", "0.5938836", "0.59356564", "0.5934965", "0.592556", "0.59219944", "0.591771", "0.59124976", "0.5903027", "0.5895501", "0.5885798", "0.5882109", "0.58792174", "0.58761466", "0.58719885", "0.58539367", "0.58521795", "0.5850109", "0.5847947", "0.584606", "0.584121", "0.5840609", "0.58377033", "0.58351034", "0.5834335", "0.5833272", "0.5827436", "0.58174264", "0.5817124", "0.5815551", "0.5812626", "0.5811593", "0.5809771", "0.58056384", "0.5802716", "0.58001447", "0.579951", "0.57957995", "0.57942194", "0.5791977", "0.57918775", "0.57905525", "0.5787181", "0.57870007", "0.5785625", "0.57749856", "0.5769845", "0.5767495", "0.576561", "0.5762464" ]
0.67692447
1
PATCH/PUT /personas_nota_seguimiento/1 PATCH/PUT /personas_nota_seguimiento/1.json
def update if @persona_nota_seguimiento.update(persona_nota_seguimiento_params) redirect_to @persona, notice: 'Actualizado Correctamente.' else render :edit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def update\n @personaje = Personaje.find(params[:id])\n\n respond_to do |format|\n if @personaje.update_attributes(params[:personaje])\n format.html { redirect_to @personaje, notice: 'Personaje was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @personaje.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipo_persona.update(tipo_persona_params)\n format.html { redirect_to @tipo_persona, notice: 'Tipo persona was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_persona }\n else\n format.html { render :edit }\n format.json { render json: @tipo_persona.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.html { redirect_to personas_path, notice: 'Persona was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @persona_proyecto.update(persona_proyecto_params)\n format.html { redirect_to @persona_proyecto, notice: 'Persona proyecto was successfully updated.' }\n format.json { render :show, status: :ok, location: @persona_proyecto }\n else\n format.html { render :edit }\n format.json { render json: @persona_proyecto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @persona.update(persona_params)\n format.html { redirect_to @persona, notice: 'Datos personales actualizados exitosamente.' }\n format.json { render :show, status: :ok, location: @persona }\n else\n format.html { render :edit }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @personaje_mision = PersonajeMision.find(params[:id])\n\n respond_to do |format|\n if @personaje_mision.update_attributes(params[:personaje_mision])\n format.html { redirect_to @personaje_mision, notice: 'Personaje mision was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @personaje_mision.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "def update\n @persona_tipo = PersonaTipo.find(params[:id])\n\n respond_to do |format|\n if @persona_tipo.update_attributes(params[:persona_tipo])\n format.html { redirect_to @persona_tipo, notice: 'Tipo de participante actualizado correctamente.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @persona_tipo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @persona = Persona.find(params[:persona_id])\n respond_to do |format|\n if @persona.info_extra_pacientes.update(info_extra_paciente_params)\n format.html { redirect_to @info_extra_paciente, notice: 'Info extra actualizada.' }\n format.json { render :show, status: :ok, location: @info_extra_paciente }\n else\n format.html { render :edit }\n format.json { render json: @info_extra_paciente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @persona.update(persona_params)\n format.html { redirect_to @persona, notice: 'Persona was successfully updated.' }\n format.json { render :show, status: :ok, location: @persona }\n else\n format.html { render :edit }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @persona.update(persona_params)\n format.html {redirect_to personas_url, notice: 'Persona was successfully updated.'}\n format.json {render :show, status: :ok, location: @persona}\n else\n format.html {render :edit}\n format.json {render json: @persona.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n #parametros_autocomplete!(params[:estudiante][:persona])\n @estudiante = Estudiante.find(params[:id])\n \n begin\n @estudiante.persona_id = params[:persona][:id]\n rescue\n end\n\n respond_to do |format|\n if @estudiante.update_attributes(params[:estudiante])\n format.html { redirect_to @estudiante, notice: 'Estudiante actualizado' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estudiante.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @person = @profissional.person\n if @person.update(profissional_params[:person_attributes])\n if profissional_params[:specialization].present?\n @profissional.update_attributes(:specialization => profissional_params[:specialization])\n format.html { redirect_to @profissional, notice: 'Profissional was successfully updated.' }\n format.json { render :show, status: :ok, location: @profissional }\n else\n format.html { render :edit }\n format.json { render json: @profissional.errors, status: :unprocessable_entity }\n end\n\n end\n end\n end", "def update\n respond_to do |format|\n if @repuesto_servicio.update(repuesto_servicio_params)\n format.html { redirect_to @repuesto_servicio, notice: 'Repuesto o servicio fue actualizado con éxito.' }\n format.json { render :show, status: :ok, location: @repuesto_servicio }\n else\n format.html { render :edit }\n format.json { render json: @repuesto_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Данные клиента обновлены.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @estado_persona.update(estado_persona_params)\n format.html { redirect_to @estado_persona, notice: 'Se ha editado el Estado con exito.' }\n format.json { render :show, status: :ok, location: @estado_persona }\n else\n format.html { render :edit }\n format.json { render json: @estado_persona.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @paciente = Paciente.find(params[:id])\n\n @upersona = @paciente.personas.last\n @paciente_edit = @upersona.perstable\n respond_to do |format|\n if @paciente_edit.update(params[:paciente].permit(:domicilio, :civil, :nss, :edad, :peso, :talla, :imc, :t_sangre, :persona))\n format.html { redirect_to pacientes_path , notice: 'Paciente was successfully updated.' }\n format.json { render :show, status: :ok, location: pacientes_path }\n else\n format.html { render :edit }\n format.json { render json: @paciente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @nota_progreso.update(nota_progreso_params)\n format.html { redirect_to paciente_historia_clinica_nota_progreso_path(@paciente, @historia_clinica, @nota_progreso), notice: 'Nota de Evolución actualizada Satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @nota_progreso }\n else\n format.html { render :edit }\n format.json { render json: @nota_progreso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person.update_attributes(params[:person])\n respond_with(@person)\n end", "def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n @persona = Persona.find(params[:persona_id])\n respond_to do |format|\n if @persona.info_contacto.update(info_contacto_params)\n format.html { redirect_to @info_contacto, notice: 'Info contacto was successfully updated.' }\n format.json { render :show, status: :ok, location: @info_contacto }\n else\n format.html { render :edit }\n format.json { render json: @info_contacto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: t('.update_ok') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Cadastro atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prospecto_telefono.update(prospecto_telefono_params)\n format.html { redirect_to @prospecto_telefono, notice: 'Prospecto telefono was successfully updated.' }\n format.json { render :show, status: :ok, location: @prospecto_telefono }\n else\n format.html { render :edit }\n format.json { render json: @prospecto_telefono.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n @person.delete_offices\n @person.delete_addresses\n @person.delete_phone_numbers\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to people_path, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @noto = Noto.find(params[:id])\n\n respond_to do |format|\n if @noto.update_attributes(params[:noto])\n format.html { redirect_to @noto, :notice => 'Noto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @noto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @repuesto.update(repuesto_params)\n format.html { redirect_to @repuesto, notice: 'Repuesto was successfully updated.' }\n format.json { render :show, status: :ok, location: @repuesto }\n else\n format.html { render :edit }\n format.json { render json: @repuesto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @persona_punto_ventum.update(persona_punto_ventum_params)\n format.html { redirect_to @persona_punto_ventum, notice: 'Persona punto ventum was successfully updated.' }\n format.json { render :show, status: :ok, location: @persona_punto_ventum }\n else\n format.html { render :edit }\n format.json { render json: @persona_punto_ventum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person_info = PersonInfo.find(params[:id])\n\n if @person_info.update(person_info_params(params[:person_info]))\n head :no_content\n else\n render json: @person_info.errors, status: :unprocessable_entity\n end\n end", "def update\n @tipo_pregunta = TipoPregunta.find(params[:id])\n\n if @tipo_pregunta.update(params[:tipo_pregunta])\n head :no_content\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end", "def update\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n #@persona.attributes = params[:persona] if params[:persona]\n \n if @persona.update_attributes(params[:persona])\n format.html { redirect_to(@persona, :notice => 'Persona was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @persona.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @consultorio_n.update(consultorio_n_params)\n format.html { redirect_to @consultorio_n, notice: 'Consultorio n was successfully updated.' }\n format.json { render :show, status: :ok, location: @consultorio_n }\n else\n format.html { render :edit }\n format.json { render json: @consultorio_n.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @registro_servicio.update(registro_servicio_params)\n format.html { redirect_to @registro_servicio, notice: 'Servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @registro_servicio }\n else\n format.html { render :edit }\n format.json { render json: @registro_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @person = Person.find(params[:id])\n # @person.pct_complete = @person.requirement_progress\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, :notice => 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @missing_person = MissingPerson.find(params[:id])\n\n respond_to do |format|\n if @missing_person.update_attributes(params[:missing_person])\n format.html { redirect_to @missing_person, notice: 'Missing person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @missing_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @request_person.update(request_person_params)\n format.html { redirect_to @request_person, notice: 'Request person was successfully updated.' }\n format.json { render :show, status: :ok, location: @request_person }\n else\n format.html { render :edit }\n format.json { render json: @request_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n populate_attributes(@person, params[:person])\n respond_to do |format|\n \n if @person.save && @person.identifiable_entries.each(&:save!)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @patient = Patient.find(params[:id])\n\n respond_to do |format|\n if @patient.update_attributes(params[:patient].except(:person_attributes))\n format.html { redirect_to people_url, notice: 'Patient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n errors = {}\n if ! ensure_same_as_logged_person(params['user_id'])\n render_json :status => :forbidden and return\n end\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n if params[:person]\n begin\n if @person.json_update_attributes(params[:person])\n render_json :entry => @person.to_hash(@user, @client) and return\n end\n rescue NoMethodError => e\n errors = e.to_s\n end\n end\n\n render_json :status => :bad_request, :messages => @person.errors.full_messages\n @person = nil\n end", "def update\n respond_to do |format|\n if @paciente_serviciocomplementario.update(paciente_serviciocomplementario_params)\n format.html {redirect_to @paciente_serviciocomplementario, notice: 'Paciente serviciocomplementario was successfully updated.'}\n format.json {render :show, status: :ok, location: @paciente_serviciocomplementario}\n else\n format.html {render :edit}\n format.json {render json: @paciente_serviciocomplementario.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n @ventas_presupuesto = Ventas::Presupuesto.find(params[:id])\n\n respond_to do |format|\n if @ventas_presupuesto.update_attributes(params[:ventas_presupuesto])\n format.html { redirect_to @ventas_presupuesto, notice: 'Presupuesto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ventas_presupuesto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @datos_personal.update(datos_personal_params)\n format.html { redirect_to @datos_personal, notice: 'Datos personal was successfully updated.' }\n format.json { render :show, status: :ok, location: @datos_personal }\n else\n format.html { render :edit }\n format.json { render json: @datos_personal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @basico_persona_juridica.update(basico_persona_juridica_params)\n format.html { redirect_to @basico_persona_juridica, notice: 'Persona juridica was successfully updated.' }\n format.json { render :show, status: :ok, location: @basico_persona_juridica }\n else\n format.html { render :edit }\n format.json { render json: @basico_persona_juridica.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tasks_person = TasksPerson.find(params[:id])\n\n respond_to do |format|\n if @tasks_person.update_attributes(params[:tasks_person])\n format.html { redirect_to @tasks_person, notice: 'Tasks person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tasks_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: \"#{@person.name} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to @person, notice: \"Person was successfully updated.\" }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @people.update(people_params)\n format.html { redirect_to root_path(@people), notice: 'VIP ' + @people.name.to_s + ' foi atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @people }\n else\n format.html { render :edit }\n format.json { render json: @people.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n if @respuesta.update_attributes(params[:respuesta])\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html do\n redirect_to @person, notice: 'Person was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json do\n render json: @person.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def update\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n if @solicitud_servicio.update_attributes(params[:solicitud_servicio])\n format.html { redirect_to @solicitud_servicio, notice: 'Solicitud servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @solicitud_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @nota_tecnica.update(nota_tecnica_params)\n format.html { redirect_to @nota_tecnica, notice: 'Nota tecnica was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @nota_tecnica.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n if current_user\n if current_user.user?\n current_user.person_id = @person.id\n current_user.save\n end\n end\n format.html { redirect_to @person, notice: 'Uppgifterna uppdaterades. Tack' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @perfilnegocio = Perfilnegocio.find(params[:id])\n\n respond_to do |format|\n if @perfilnegocio.update_attributes(params[:perfilnegocio])\n format.html { redirect_to @perfilnegocio, notice: 'Perfilnegocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @perfilnegocio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n if @pessoa.update_attributes(params[:pessoa])\n format.html { redirect_to pessoas_path, notice: 'Pessoa atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.html { redirect_to(admin_path(@persona), :notice => t('adminactualizado')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @persona.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @contact = Contact.find(params[:id])\n @contact.person_id = nil if params[:contact][:person_name].present?\n respond_to do |format|\n if @contact.update_attributes(params[:contact].merge(:updated_by => current_user.id))\n format.html { redirect_to client_contacts_path(@firm), :notice => \"#{ Contact.model_name.human } успешно изменен.\"}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @sivic_participantecelula.update(sivic_participantecelula_params)\r\n format.html { redirect_to @sivic_participantecelula, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_participantecelula.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def set_persona_nota_seguimiento\n @persona_nota_seguimiento = PersonaNotaSeguimiento.find(params[:id])\n @persona = @persona_nota_seguimiento.persona\n end", "def update\n @user_person = UserPerson.find(params[:id])\n\n respond_to do |format|\n if @user_person.update_attributes(params[:user_person])\n format.html { redirect_to @user_person, notice: 'User person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @respuesta = Respuesta.find(params[:id])\n\n if @respuesta.update(params[:respuesta])\n head :no_content\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @os_entregavel.update(os_entregavel_params)\n if @os_entregavel.ordem_servico.id!=nil\n format.html { redirect_to \"/ordem_servicos/\"+@os_entregavel.ordem_servico.id.to_s, notice: 'Os entregavel foi atualizado(a)' }\n format.json { head :no_content }\n else\n format.html { redirect_to @os_entregavel, notice: 'Os entregavel foi atualizado(a)' }\n format.json { render :show, status: :ok, location: @os_entregavel }\n end\n else\n format.html { render :edit }\n format.json { render json: @os_entregavel.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.js {}\n format.html { redirect_to people_url, notice: \"Person #{@person.first_name} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @person }\n else\n format.js {}\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update(person_params)\n format.html { redirect_to admin_person_url(@person), notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @person }\n else\n format.html { render :edit }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def activo_update\n respond_to do |format|\n activo = params[:presentacion][:activo]\n id = params[:id]\n Presentacion.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n respond_to do |format|\n if @servico.update(servico_params)\n format.html { redirect_to servicos_url, notice: 'Serviço atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @servico }\n else\n format.html { render :edit }\n format.json { render json: @servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipo_de_servicio.update(tipo_de_servicio_params)\n format.html { redirect_to @tipo_de_servicio, notice: 'Tipo de servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_de_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tipo_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tiposveiculo.update(tiposveiculo_params)\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tiposveiculo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @palabra = Palabra.find(params[:id])\n @palabra.significados = params[:significados] \n respond_to do |format|\n if @palabra.update_attributes(params[:palabra])\n format.html { redirect_to @palabra, notice: 'La Palabra fue actualizada correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @palabra.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @empresa_servicio = EmpresaServicio.find(params[:id])\n respond_to do |format|\n if @empresa_servicio.update_attributes(params[:empresa_servicio])\n\n format.html { redirect_to empresa_empresa_servicios_path, notice: \"Los datos del servicio fueron actualizados para la empresa #{@empresa_servicio.empresa.nombre_empresa}\"}\n \n else\n format.html { render action: \"edit\" }\n format.json { render json: @empresa_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @missing_person.update(missing_person_params)\n format.html { redirect_to @missing_person, notice: 'Missing person was successfully updated.' }\n format.json { render :show, status: :ok, location: @missing_person }\n else\n format.html { render :edit }\n format.json { render json: @missing_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @detalle_ot_presupuesto.update(detalle_ot_presupuesto_params)\n format.html { redirect_to @detalle_ot_presupuesto, notice: 'Detalle ot presupuesto was successfully updated.' }\n format.json { render :show, status: :ok, location: @detalle_ot_presupuesto }\n else\n format.html { render :edit }\n format.json { render json: @detalle_ot_presupuesto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person = Person.find(params[:id])\n @provider = Provider.find(params[:provider_id]) unless params[:provider_id].blank?\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n\n path = people_path\n msg = 'Person was successfully updated.'\n if @participant\n path = participant_path(@participant, :anchor => \"relationships_tab\")\n msg = 'Person was successfully updated.'\n end\n if @provider\n path = provider_path(@provider)\n msg = \"Person was successfully updated for #{@provider}.\"\n end\n\n format.html { redirect_to(path, :notice => msg) }\n format.json { render :json => @person }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.6841325", "0.6619079", "0.65937996", "0.6589062", "0.65454906", "0.6499792", "0.6499037", "0.64868534", "0.64754456", "0.64686185", "0.64641", "0.6438015", "0.6416083", "0.640001", "0.6390569", "0.63641244", "0.6339741", "0.6337494", "0.63334876", "0.6330799", "0.6292913", "0.6279271", "0.6272945", "0.627224", "0.6270323", "0.6263229", "0.6253696", "0.6247194", "0.62424976", "0.6214348", "0.6192579", "0.6191093", "0.619104", "0.61870396", "0.6178969", "0.6178969", "0.6178969", "0.6165047", "0.6164578", "0.6149114", "0.614108", "0.614108", "0.6133155", "0.6132514", "0.61300683", "0.612897", "0.6127868", "0.6127469", "0.61095124", "0.6107786", "0.6107786", "0.6107786", "0.6107786", "0.6107786", "0.6106578", "0.6102418", "0.6099422", "0.6085537", "0.6083256", "0.60787964", "0.60781026", "0.60764414", "0.60728794", "0.6072049", "0.6072049", "0.6072049", "0.6072049", "0.6072049", "0.6072049", "0.6072049", "0.6072049", "0.6070336", "0.6070336", "0.60674936", "0.6064914", "0.60631615", "0.60598373", "0.6058523", "0.6051946", "0.60483265", "0.60430694", "0.60392386", "0.60381734", "0.60375553", "0.6036927", "0.6036668", "0.6029927", "0.6028326", "0.6024858", "0.6022994", "0.6022295", "0.60210586", "0.6016014", "0.601586", "0.6014834", "0.6011373", "0.6010472", "0.6009477", "0.599922", "0.59956306" ]
0.662769
1
DELETE /personas_nota_seguimiento/1 DELETE /personas_nota_seguimiento/1.json
def destroy if @persona_nota_seguimiento.destroy redirect_to @persona, notice: 'Eliminado Correctamente.' else render :edit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end", "def destroy\n @personaje_mision = PersonajeMision.find(params[:id])\n @personaje_mision.destroy\n\n respond_to do |format|\n format.html { redirect_to personaje_misions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @personaje = Personaje.find(params[:id])\n @personaje.destroy\n\n respond_to do |format|\n format.html { redirect_to personajes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @persona_tipo = PersonaTipo.find(params[:id])\n @persona_tipo.destroy\n\n respond_to do |format|\n format.html { redirect_to persona_tipos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @persona.destroy\n respond_to do |format|\n format.html { redirect_to personas_url, notice: 'Datos personales eliminados exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to personas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to personas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.html { redirect_to personas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datos_personal.destroy\n respond_to do |format|\n format.html { redirect_to datos_personals_url, notice: 'Datos personal was successfully destroyed.' }\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 @estado_persona.destroy\n respond_to do |format|\n format.html { redirect_to estado_personas_url, notice: 'Se ha eliminado el estado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @repuestum = Repuestum.find(params[:id])\n @repuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to repuesta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reconocimiento = Reconocimiento.find(params[:id])\n @reconocimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to reconocimientos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @persona_proyecto.destroy\n respond_to do |format|\n format.html { redirect_to personas_proyectos_url, notice: 'Persona proyecto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @persona.destroy\n respond_to do |format|\n format.html { redirect_to administradores_path, notice: 'Persona was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @basico_persona_juridica.destroy\n respond_to do |format|\n format.html { redirect_to basico_persona_juridicas_url, notice: 'Persona juridica was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end", "def destroy\n @tipo_persona.destroy\n respond_to do |format|\n format.html { redirect_to tipos_personas_url, notice: 'Tipo persona was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @nota_tecnica.destroy\n respond_to do |format|\n format.html { redirect_to nota_tecnicas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @requerimiento = Requerimiento.find(params[:id])\n @requerimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to requerimientos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @servicio = Servicio.find(params[:id])\n @servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to servicios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sitio_entrega = SitioEntrega.find(params[:id])\n @sitio_entrega.destroy\n\n respond_to do |format|\n format.html { redirect_to sitio_entregas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Клиент удален из базы.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @person = Person.find((params[:person_id]))\n @person_identification_doc = PersonIdentificationDoc.find(params[:id])\n @person_identification_doc.destroy\n\n respond_to do |format|\n format.html { redirect_to person_person_identification_docs_path, :notice => 'Documentação excluída.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n @solicitud_servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to solicitudes_servicios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @detalle_ot_presupuesto.destroy\n respond_to do |format|\n format.html { redirect_to detalle_ot_presupuestos_url, notice: 'Detalle ot presupuesto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @respuestum.destroy\n respond_to do |format|\n format.html { redirect_to comentarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @anteproyecto_observacion.destroy\n respond_to do |format|\n format.html { redirect_to anteproyecto_observaciones_url, notice: 'Anteproyecto observacion was successfully destroyed.' }\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 @servico_pacote.destroy\n respond_to do |format|\n format.html { redirect_to servico_pacotes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @estudiante = Estudiante.find(params[:id])\n @estudiante.destroy\n\n respond_to do |format|\n format.html { redirect_to estudiantes_url, :notice => \"#{@estudiante.persona.nombre_completo} eliminado\" }\n format.json { head :no_content }\n end#do\n end", "def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @persona.cargo.update(disponible: true)\n @persona.destroy\n respond_to do |format|\n format.html { redirect_to personas_url, notice: 'Persona was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @consultorio_n.destroy\n respond_to do |format|\n format.html { redirect_to consultorio_ns_url, notice: 'Consultorio n was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n \n @laboratorio.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 @people.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Persona eliminada con éxito.' }\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 @seguidore = Seguidore.find(params[:id])\n @seguidore.destroy\n\n respond_to do |format|\n format.html { redirect_to seguidores_url }\n format.json { head :ok }\n end\n end", "def destroy_by_body\n @person = Person.find(person_delete_param[:id])\n id = @person.id\n\n if @person.destroy\n render json: { status: 'DELETE Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error deleting person', person: @person.errors }, status: :unprocessable_entity\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 @ordem_servico.destroy\n respond_to do |format|\n format.html { redirect_to ordem_servicos_url, notice: t('messages.cadastro_removido') }\n format.json { head :no_content }\n end\n end", "def destroy\n @persona = Persona.find(params[:persona_id])\n @info_extra_paciente = @persona.info_extra_pacientes.find(params[:id])\n @info_extra_paciente.destroy\n respond_to do |format|\n format.html { redirect_to @persona, notice: 'Contacto Eliminado' }\n format.json { head :no_content }\n end\n end", "def destroy\n idPer = params[:id]\n person = Persona.find(idPer)\n person.borrado = Time.now.strftime(\"%Y-%m-%d %H:%M:%S\")\n person.save\n respond_to do |format|\n format.html {redirect_to personas_url, notice: 'La Persona fue eliminado correctamente'}\n format.json {head :no_content}\n end\n\n\n end", "def destroy\n @repuesto.destroy\n respond_to do |format|\n format.html { redirect_to repuestos_url, notice: 'Repuesto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @repuesto.destroy\n respond_to do |format|\n format.html { redirect_to repuestos_url, notice: 'Repuesto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @datosgenerale.destroy\n respond_to do |format|\n format.html { redirect_to datosgenerales_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @puntaje = Puntaje.find(params[:id])\n @puntaje.destroy\n\n respond_to do |format|\n format.html { redirect_to puntajes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @notificaciones_admin_actualouse = NotificacionesAdminActualouse.find(params[:id])\n @notificaciones_admin_actualouse.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end", "def destroy\n @nota_reparacion.destroy\n respond_to do |format|\n format.html { redirect_to nota_reparaciones_url, notice: 'Nota reparacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @alumno.destroy\n respond_to do |format|\n format.html { redirect_to grupos_path }\n format.json { head :no_content }\n end\n end", "def destroy\n # @person = Person.find(params[:id])\n @person.destroy\n\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_contrato = TipoContrato.find(params[:id])\n @tipo_contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_contratos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ocorrencia.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url, notice: 'Uppgifterna om personen raderades.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @biometria.destroy\n respond_to do |format|\n format.html { redirect_to index_biometria_path(params[:paciente_id]), notice: 'Biometria elimino correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @estacionamiento = Estacionamiento.find(params[:id])\n @estacionamiento.destroy\n\n respond_to do |format|\n format.html { redirect_to estacionamientos_url }\n format.json { head :ok }\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 @paciente_serviciocomplementario.destroy\n respond_to do |format|\n format.html {redirect_to paciente_serviciocomplementarios_url, notice: 'Paciente serviciocomplementario was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n head :no_content\n end", "def destroy\n @datos_estudiante.destroy\n respond_to do |format|\n format.html { redirect_to datos_estudiantes_url, notice: 'Datos estudiante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @competency_pertenece_asignatura = CompetencyPerteneceAsignatura.find(params[:id])\n @competency_pertenece_asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to competency_pertenece_asignaturas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @person = Person.find(params[:id])\n id = @person.id\n\n if @person.destroy\n render json: { status: 'DELETE Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error deleting person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def destroy\n @punto_venta = PuntoVentum.find(@persona_punto_ventum.punto_venta_id)\n @persona_punto_ventum.destroy\n respond_to do |format|\n format.html { redirect_to @punto_venta, notice: 'Persona punto ventum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ventas_presupuesto = Ventas::Presupuesto.find(params[:id])\n @ventas_presupuesto.destroy\n\n respond_to do |format|\n format.html { redirect_to ventas_presupuestos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @presupuestooo.destroy\n respond_to do |format|\n format.html { redirect_to presupuestooos_url, notice: 'Presupuesto Eliminado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @consulta_viaje.destroy\n respond_to do |format|\n format.html { redirect_to consulta_viajes_url, notice: 'Consulta viaje was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_documento = TipoDocumento.find(params[:id])\n @tipo_documento.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_documentos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to datos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asociado = Asociado.find(params[:id])\n @asociado.destroy\n\n respond_to do |format|\n format.html { redirect_to asociados_url }\n format.json { head :ok }\n end\n end", "def destroy\n @tipo_de_servicio.destroy\n respond_to do |format|\n format.html { redirect_to tipo_de_servicios_url, notice: 'Tipo de servicio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicituds_url, notice: \"Solicitud was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicituds_url, notice: 'Solicitud was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to referencia_bases_url, notice: \"Referencia base was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @asiento_de_servicio.destroy\n respond_to do |format|\n format.html { redirect_to asiento_de_servicios_url, notice: 'Asiento de servicio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @datoscontacto = Datoscontacto.find(params[:id])\n @datoscontacto.destroy\n\n respond_to do |format|\n format.html { redirect_to datoscontactos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #--ADICIONADO\n @cliente.perfilclientes.destroy\n #--ADICIONADO\n @cliente.destroy\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_consulta.destroy\n respond_to do |format|\n format.html { redirect_to tipo_consultas_url, notice: 'Tipo consulta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destroy\n\n respond_to do |format|\n format.html { redirect_to estatutos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @registro_servicio.destroy\n respond_to do |format|\n format.html { redirect_to registro_servicios_url, notice: 'Servicio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sivic_discipulo.destroy\n respond_to do |format|\n format.html { redirect_to sivic_discipulos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to tipo_referencia_bases_url, notice: \"Tipo referencia base was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @personal_rubro.destroy\n respond_to do |format|\n format.html { redirect_to personal_rubros_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mantenimiento.destroy\n respond_to do |format|\n format.html { redirect_to mantenimientos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @donante.destroy\n respond_to do |format|\n format.html { redirect_to donantes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @residencia.destroy\n respond_to do |format|\n format.html { redirect_to programa_residencia_url(@programa), notice: 'residencia was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @patrocinio = Patrocinio.find(params[:id])\n @patrocinio.destroy\n\n respond_to do |format|\n format.html { redirect_to patrocinios_url }\n format.json { head :ok }\n end\n end", "def destroy\n @anteproyecto_estudiante.destroy\n respond_to do |format|\n format.html { redirect_to anteproyecto_estudiantes_url, notice: 'Anteproyecto estudiante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @datos_de_pasaje.destroy\n respond_to do |format|\n format.html { redirect_to datos_de_pasajes_url, notice: 'Datos de pasaje was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @clientes_servico.destroy\n respond_to do |format|\n format.html { redirect_to clientes_servicos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reprogramacion = Reprogramacion.find(params[:id])\n @reprogramacion.destroy\n\n respond_to do |format|\n format.html { redirect_to reprogramaciones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_unidad.destroy\n respond_to do |format|\n format.html { redirect_to tipo_unidades_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @colegio = Colegio.find(params[:id])\n @colegio.destroy\n\n respond_to do |format|\n format.html { redirect_to colegios_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.753221", "0.74338907", "0.7379955", "0.7349902", "0.73273027", "0.7255175", "0.7255175", "0.7255175", "0.7242137", "0.72409093", "0.72394776", "0.7230385", "0.7212412", "0.7210099", "0.7205289", "0.72016984", "0.71847427", "0.7179976", "0.7166997", "0.71551627", "0.71209604", "0.71128833", "0.7094136", "0.7090927", "0.7086459", "0.70844656", "0.7079938", "0.7079054", "0.7038473", "0.7028211", "0.70250344", "0.70185405", "0.7016709", "0.7016121", "0.7015885", "0.7014502", "0.6993292", "0.69899184", "0.69824976", "0.69753164", "0.69748306", "0.6972874", "0.69668496", "0.69666487", "0.69596696", "0.69596696", "0.6958441", "0.6957734", "0.6956049", "0.69560105", "0.69560105", "0.6955888", "0.69457984", "0.69423324", "0.693996", "0.69385177", "0.6935095", "0.6933295", "0.6931385", "0.6929297", "0.6926582", "0.6926403", "0.69253427", "0.6918511", "0.6916325", "0.69087976", "0.6907358", "0.6904716", "0.6903262", "0.69027644", "0.69025964", "0.6900413", "0.6893183", "0.6892905", "0.68921256", "0.6890778", "0.6889794", "0.6889161", "0.68873894", "0.68873113", "0.68867016", "0.68865114", "0.6885296", "0.68849117", "0.688481", "0.68838394", "0.6878342", "0.6877702", "0.6876694", "0.6874728", "0.6874554", "0.68698865", "0.68679523", "0.68677384", "0.68669367", "0.6866835", "0.6866138", "0.6863922", "0.6863696", "0.686339", "0.6863279" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_persona_nota_seguimiento @persona_nota_seguimiento = PersonaNotaSeguimiento.find(params[:id]) @persona = @persona_nota_seguimiento.persona 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 persona_nota_seguimiento_params params.require(:persona_nota_seguimiento).permit(:fecha, :notas) 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
An image field for forms to upload
def image_field(field, options = {}) # Build options options = build_options(options, field) options['method_name'] = 'image_field' options.reverse_merge!(:image_size => :mini, :id => "image", :image_object => @object) # Create content html = content_tag :span, image_for(options[:image_object], options[:image_size], :default_image_from => options[:default_image_from]), :id => "image-#{@object.object_id}", :class => "image-field" html << self.hidden_field(field, :id => options[:id]) html << link_to("Bild auswählen", url_for(:controller => "/images", :action => "lightbox", :image_input => options[:id], :image_size => options[:image_size], :part => "image-#{@object.object_id}"), :class => 'remote-link chose-image') if options[:delete_link] == true html << content_tag(:span, :class => "remove-image-span") do " | " + link_to("Bild löschen", "javascript:void(0);", :class => "remove-form-image", :rel => options[:id]) end end # Get rid of unoppropriate options options.delete_if { |key, value| not [:rel, :style, :class, :id, :name, :value, :type, :size].include?(key.to_sym)} # Build html wrap_field(html, field, options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_file_field(form_builder)\n image = form_builder.object\n form_builder.file_field :file, as: :file, class: 'image_file', id: 'image_files'\n end", "def image_file_field(field, options={})\n options.reverse_merge!(:id => field_id(field))\n options.merge!(:class => field_error(field, options))\n html = ''\n html += @template.file_field_tag field_name(field), options\n if object.send(field).url\n html += \"<img src='#{object.send(field).url}' class='image_file_field_thumbnail' alt='#'/>\"\n end\n html\n end", "def image_upload_input(f, params, current_instance, name = 'primary_image', required = false)\n image_input = f.input name.to_sym, as: :file, required: required\n main = image_input + image_preview(current_instance, name)\n main\n end", "def image_upload_input(f, params, current_instance, name = 'primary_image', required = false)\n image_input = f.input name.to_sym, as: :file, required: required\n main = image_input + image_preview(current_instance, name)\n main\n end", "def pic_field form, options={}\n # We work with a decorator, whether provided or not\n decorator = options[:decorator] || form.object\n # The form may be working with an object, not its decorator\n decorator = decorator.decorate unless decorator.is_a?(Draper::Decorator)\n\n pic_area = image_with_error_recovery decorator,\n id: pic_preview_img_id(decorator),\n fill_mode: 'fixed-width',\n fallback_img: options[:fallback_img] || true\n\n form_field = form.hidden_field decorator.picable_attribute,\n {\n rel: 'jpg,png,gif',\n class: 'hidden_text',\n onchange: ('RP.submit.enclosing_form' if options[:submit_on_change])\n }.compact\n content_tag :div, pic_area+form_field, class: 'pic_preview'\n end", "def pic_field(form, pic_attribute, page_attribute=nil, options={})\n obj = form.object\n picurl = obj.send(pic_attribute)\n pageurl = page_attribute && obj.send(page_attribute)\n if home = options[:home]\n picurl = valid_url(picurl, home) unless picurl.blank?\n pageurl = valid_url(pageurl, home) if pageurl\n end\n input_id = pic_preview_input_id(obj, pic_attribute)\n img_id = pic_preview_img_id(obj)\n link_id = \"golink#{obj.id}\"\n pic_area = page_width_pic picurl, img_id, options[:fallback_img]\n preview = content_tag :div,\n pic_area+form.hidden_field(pic_attribute, rel: \"jpg,png,gif\", class: \"hidden_text\"),\n class: \"pic_preview\"\n preview << content_tag(:div,\n pic_preview_golink(pageurl, picurl, link_id, img_id, input_id),\n class: \"pic_picker_link\") unless options[:nopicker]\n preview\n end", "def image_submit(img_path, options = {})\n @template.image_submit_tag(img_path, options)\n end", "def form_image_select(post)\n return image_tag post.image.url,\n id: 'image-preview',\n class: 'img-responsive'\n\n\nend", "def image_submit(img_path, options = {})\n @template.image_submit_tag(img_path, options)\n end", "def file_field; end", "def image\n end", "def image\n end", "def image\n\n end", "def image\n end", "def image\n end", "def file_form_field\n @attributes[:file_form_field]\n end", "def form_image_select(post)\n return image_tag post.image.url(:medium),\n id: 'image-preview',\n class: 'img-responsive' if post.image.exists?\n image_tag 'placeholder.jpg', id: 'image-preview', class: 'img-responsive'\n end", "def image= value\n self.image_custom = value\n write_attribute :image_custom, value\n end", "def image(key, image_path, options = {})\n # Idea from here http://itext.ugent.be/library/question.php?id=31 \n # Thanks Bruno for letting me know about it.\n img = Image.get_instance(image_path)\n coords = @form.get_field_positions(key.to_s)\n rect = coords[0].position\n img.set_absolute_position(rect.left, rect.bottom)\n img.scale_to_fit(rect)\n image_content = @stamp.get_over_content(options.fetch(:page, 1))\n image_content.add_image(img)\n end", "def edit_particular_image\n \n end", "def image_file=(value)\n @image_file = value\n end", "def image; end", "def image_library\n @title = \"Insert image\"\n # Only interested in images\n get_files(params.merge({:key => 'Image'}))\n render :layout => 'admin_modal'\n end", "def file_field_tag(name, options = {})\n text_field_tag(name, nil, convert_direct_upload_option_to_url(options.merge(type: :file)))\n end", "def set_ImageType(value)\n set_input(\"ImageType\", value)\n end", "def set_ImageType(value)\n set_input(\"ImageType\", value)\n end", "def edit_real_picture\n end", "def image(key, image_path)\n # Idea from here http://itext.ugent.be/library/question.php?id=31 \n # Thanks Bruno for letting me know about it.\n img = @image_class.getInstance(image_path)\n img_field = @form.getFieldPositions(key.to_s)\n\n \n rect = @rectangle.new(img_field[1], img_field[2], img_field[3], img_field[4])\n img.scaleToFit(rect.width, rect.height)\n img.setAbsolutePosition(\n img_field[1] + (rect.width - img.getScaledWidth) / 2,\n img_field[2] + (rect.height - img.getScaledHeight) /2\n )\n\n cb = @stamp.getOverContent(img_field[0].to_i)\n cb.addImage(img)\n end", "def file_field(object_name, method, options = {})\n InstanceTag.new(object_name, method, self, nil, options.delete(:object)).to_input_field_tag(\"file\", options)\n end", "def set_classfield_image\n @classfield_image = ClassfieldImage.find(params[:id])\n end", "def ui_file_field(name, options = nil, html_options = nil, &block)\n UiBibz::Ui::Core::Forms::Files::FileField.new(name, options, html_options, &block).render\n end", "def normal_file_field(field, options={})\n options.reverse_merge!(:id => field_id(field))\n options.merge!(:class => field_error(field, options))\n html = ''\n html += @template.file_field_tag field_name(field), options\n if object.send(field).url\n html += \"<span class='normal_file_field_name'>File: #{object.send(field).url}</span>\"\n end\n html\n end", "def field_file libelle, prop, value = nil, options = nil\n Field.new(:file, libelle, prop, value, options).form_row\n end", "def classfield_image_params\n params.require(:classfield_image).permit(:classfield, :url)\n end", "def initialize(model, image_field, options = {})\n @model = model\n @image_field = image_field.to_sym\n @options = options\n end", "def image_file_name= value\n super if value.present?\n end", "def image\n @path\n end", "def pic_picker_magic decorator, f, options={}\n divopts = {\n class: 'preview',\n id: 'pic-picker-magic',\n contenteditable: true\n }\n do_glean = (options[:gleanable] != false) && @decorator.object.respond_to?(:gleaning)\n divopts[:data] = { :'gleaning-url' => polymorphic_path( [:glean, decorator.as_base_class], what: 'images') } if do_glean\n image = image_with_error_recovery decorator,\n id: 'rcpPic',\n fallback_img: true,\n explain: true,\n fill_mode: 'fixed-width'\n preview = content_tag :div, image, divopts\n preview << uploader_field(decorator, input_id: 'pic-picker-url', img_id: 'rcpPic') if options[:uploadable]\n preview << gleaning_field(decorator, :images) if do_glean\n preview + f.hidden_field(decorator.picable_attribute, id: 'pic-picker-url')\n end", "def image_url_upload\n ar_object = Kernel.const_get(params[:ar_object_class]).find(params[:ar_object_id])\n ar_object.image_file_url = params[:image_file_url]\n if ar_object.save\n @messages = 'fleximage updated'\n else\n @messages = 'Oups updating fleximage'\n ar_object.errors.each { |field, msg| puts \"********* field:#{field} --> #{msg}\" }\n end\n render :update do |page| \n page.replace(MainController.image_domid(ar_object),\n render(:partial => \"/main/image_editor\", :locals => {:title => params[:title], :ar_object => ar_object }))\n\t\tend\n end", "def form_image(image, size)\n html = link_to_function image_tag(\"icons/image-delete.gif\"), \"$(this).parent().remove();\", :class => \"image-delete-icon\", :style => \"position: absolute; right: 0px; top: 0px\"\n html << image_tag(image.public_filename(size), :width => image.size_for_thumbnail(size).width, \n :height => image.size_for_thumbnail(size).height) \n end", "def permit_upload_image_param\n args = strong_upload_image_param\n args[:image] = params[:upload][:image]\n args\n end", "def add_inputimage_property(image_source, options: nil, keep_static: nil)\n self.add_image_property(:inputImage, image_source: image_source,\n options: options,\n keep_static: keep_static)\n end", "def image=(img)\n @image__ = img\n end", "def image_submit_button(image_file, options={})\n @renderer.image_submit_tag(image_file, options)\n end", "def upload_url\n return unless @data['image']\n # Isn't actually displayed in-app without this set\n return unless image['property'] == 'image'\n file(@data['image'])\n end", "def display_image\n image.variant resize_to_limit: Settings.validation.post.img_resize\n end", "def image_params\n params.require(:image).permit(:option_id, :file)\n end", "def image_params\n params.permit(:user_id, :image)\n end", "def img_params\n\n end", "def image_params\n params.require(:image).permit(:image_file)\n end", "def image_params\n params.require(:image).permit(:image_file)\n end", "def image_params\n params.require(:image).permit(:title, :alt, :imageFile)\n end", "def upload_image\n \t@person = Person.find(params[:id])\n \t@person.image = params[:person][:image]\n \t@person.save!\n \tredirect_to @person\n end", "def set_image\n @upload = Medium.find(params[:id])\n end", "def profile_image_params\n params.permit(:image_file)\n\n end", "def uploaded_photo=(field)\n self.photo = FileDocument.new if self.photo.nil?\n self.photo.uploaded_file = field\n end", "def image\n options.fetch(:image, nil)\n end", "def image_params\n params[:image]\n \n end", "def complete_upload_image\n @dom_id = \"##{params[:photo][:dom_id]}\"\n\n @asset = Image.new(uploaded_asset_attributes.reverse_merge(uploaded_by: current_user))\n @asset.add_meta(params[:photo])\n @asset.save\n render template: \"/dash/chooser/complete_upload\"\n end", "def swfupload_file=(data)\r\n data.content_type = MIME::Types.type_for(data.original_filename).to_s if data\r\n self.image = data\r\n end", "def imagedemo_params\n params.require(:imagedemo).permit(:fname, :lname, :image)\n end", "def img_params\n params.require(:img).permit(:caption, :image, :user_id)\n end", "def image_params\n params.require(:image).permit(:file, :description, :user_id, :location_id)\n end", "def edit\n if params[:submit_failed]\n add_image_upload_errors\n end\n end", "def upload_entry\n e = Entry.new\n e.image = uploaded_file(\"skanthak.png\", \"image/png\")\n return e\n end", "def upload_entry\n e = Entry.new\n e.image = uploaded_file(\"skanthak.png\", \"image/png\")\n return e\n end", "def img\n if self.upload.try(:image).present?\n self.upload.try(:image).url(:thumb)\n else\n 'images/cmn1.jpg'\n end\n end", "def image_params\n params.require(:image).permit(:caption, :file, :is_public, :user_id)\n end", "def add_image \n image = CARMD.image(self.vin)\n if image == \"\"\n image = \"http://clipart-library.com/img/2050778.png\"\n end\n self.auto_image = image \n self.save \n end", "def image_params\n params.require(:image).permit(:name, :description, :file)\n end", "def bike_image=(file_data)\n @file_data = file_data\n end", "def image_params\n # params.require(:image).permit(:name, :desc, :author, :verse, :image_file_path)\n params.require(:image).permit(:name, :desc, :author, :verse)\n end", "def image_button(src = \"\", name = nil, alt = nil)\n attributes = if src.kind_of?(String)\n { \"TYPE\" => \"image\", \"SRC\" => src, \"NAME\" => name,\n \"ALT\" => alt }\n else\n src[\"TYPE\"] = \"image\"\n src[\"SRC\"] ||= \"\"\n src\n end\n input(attributes)\n end", "def file_upload_to_field(file_path)\n control = @field.all(:css, 'input[type=\"file\"]').first[:id]\n upload_file(control, file_path)\n end", "def image\n self['image'] || self['image_src']\n end", "def upload_image\n render template: \"/dash/chooser/upload_image\"\n end", "def audio_file_field(field, options={})\n options.reverse_merge!(:id => field_id(field))\n options.merge!(:class => field_error(field, options))\n html = ''\n html += @template.file_field_tag field_name(field), options\n if object.send(field).url\n html += \"<span class='audio_file_field_name'>File: #{object.send(field).url}</span>\"\n end\n html\n end", "def content_element_form_extension(context={})\n \n app = context[:app]\n \n locals = {:photo_album => SystemConfiguration::Variable.get('content_album_name').value, \n :width => SystemConfiguration::Variable.get('content_album_photo_width').value, \n :height => SystemConfiguration::Variable.get('content_album_photo_height').value}\n \n renderer = UIFieldSetRender::FieldSetRender.new('photo', app) \n photo_form_extension = renderer.render('formextension', 'em', locals)\n \n \n end", "def set_image\n @image = Image.find(params[:id]).decorate\n end", "def set_img\n\n end", "def image_params\n params.require(:image).permit(:name, :tags, :image_file)\n end", "def image=(image)\n @upload_image = image.respond_to?(:original_filename) || image == false ? image : nil\n end", "def image_params\n params.require(:images).permit(:file)\n end", "def image_column(record)\n image_tag url_for_file_column(record, 'image') if record.image\nend", "def upload_params\n params[:upload].permit :image\n end", "def set_image_file\n @image_file = ImageFile.find(params[:id])\n end", "def set_image_file\n @image_file = ImageFile.find(params[:id])\n end", "def image_params\n params.require(:image).permit(:image)\n end", "def image_params\n params.require(:image).permit(:image)\n end", "def image_params\n params.require(:image).permit(:company_id, :name, :image)\n end", "def image_params\n params.require(:image).permit(:image, :title, :delete_code, :homepage)\n end", "def edit\n @builder.build_image unless @builder.image.present?\n end", "def image=(file_data)\n unless file_data.blank?\n # assign uploaded data to instance variable\n @file_data = file_data\n # assign image type (extension) to self.image_type\n self.image_type = file_data.original_filename.split('.').last.downcase\n end \n end", "def set_image_upload\n @image_upload = ImageUpload.find(params[:id])\n end", "def insert_image(post_image)\n post_image.attributes.delete(:file)\n emit(:on_image_selected, post_image)\n end", "def image_file=(input_data)\n# If the image type is valid, process the image for saving\n# to the database\n if ((input_data.content_type.eql? 'image/jpeg') || \\\n (input_data.content_type.eql? 'image/png'))\n image = Image.from_blob(input_data.read).first\n \tself.photo_name = input_data.original_filename\n \tself.photo_type = input_data.content_type\n \tself.photo_image = image.resize_to_fill(640,480, \n gravity=CenterGravity).to_blob\n else\n# If the image type is not valid, set the photo_type to invalid\n# and let the custom validation method handle the problem\n self.photo_type = \"invalid\"\n end\n end", "def default_image\n end", "def professor_image\n image_tag(\"professor.jpg\", :size => \"50x50\", :border => \"0\", :alt => \"These fields can be edited by a faculty role\", :title => \"Faculty role\")\n end", "def upload_image\r\n load_projects if params[:is_from_setting_center]\r\n @content = Image.new\r\n @content.user_id = @user.id\r\n @content.cat_id = (params[:cat_id].blank? ? Content::CATEGORIES[:image][:id] : params[:cat_id])\r\n end", "def image_params\n params.require(:image).permit(:site_id,:name,:caption,:copyright_year,:copyright_by,:description,:image,:image_preview_id)\n end" ]
[ "0.78787106", "0.7773775", "0.75542104", "0.75542104", "0.68560266", "0.6854362", "0.68429154", "0.67766774", "0.6744543", "0.66198164", "0.6582745", "0.6582745", "0.65782267", "0.6563947", "0.6563947", "0.65605044", "0.64935327", "0.6433617", "0.6419984", "0.64116323", "0.6380096", "0.6356121", "0.63257325", "0.63134146", "0.62966573", "0.62966573", "0.6296552", "0.6284032", "0.626377", "0.6261608", "0.62536263", "0.6231323", "0.6220129", "0.6212991", "0.62052554", "0.61818457", "0.61412317", "0.61400694", "0.6139551", "0.61390114", "0.6128248", "0.61188096", "0.6115704", "0.61107874", "0.6109238", "0.6096434", "0.6090991", "0.609008", "0.6084271", "0.60801846", "0.60801846", "0.60742664", "0.6071045", "0.6064487", "0.60585773", "0.6058529", "0.60476035", "0.6033307", "0.603063", "0.60302407", "0.6027176", "0.60206705", "0.6013495", "0.6005263", "0.60044265", "0.60044265", "0.6004169", "0.60020876", "0.5995785", "0.5985317", "0.59761643", "0.5970653", "0.59642863", "0.59586555", "0.5954616", "0.59504515", "0.59470123", "0.5931621", "0.59275025", "0.5923719", "0.5922135", "0.5919074", "0.5916085", "0.5907523", "0.59033465", "0.5903204", "0.5903204", "0.5898383", "0.5898383", "0.589817", "0.5897699", "0.58932257", "0.5880828", "0.5878652", "0.58729666", "0.5870812", "0.5864845", "0.58640516", "0.5860989", "0.5857455" ]
0.6783711
7
Replace this with your real tests.
def we_can_find_the_current_configuration assert ! Confguration.current.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testing\n # ...\n end", "def __dummy_test__\n end", "def tests; end", "def tests; end", "def spec; end", "def spec; end", "def self_test; end", "def self_test; end", "def test \n end", "def test_0_dummy\n\t\tend", "def test\n\n end", "def test\n end", "def test\n end", "def test\n end", "def private; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def test_method\n end", "def before_test(test); end", "def before_test(test); end", "def graffiti_test\n end", "def test_truth\n end", "def test_should_get_index \n get :index\n assert_response :success #making sure the request was successful\n assert_not_nil (:products) # ensuring that it assigns a valid products instance variable.\n end", "def test_case; end", "def test_cases; end", "def running_test_case; end", "def test_connection\n end", "def testloop\n \n end", "def should; super end", "def test_nothing\n end", "def default_test\r\n end", "def my_tests\n end", "def test_setup\r\n \r\n end", "def test_intialize\r\n\tassert_equal 0, @test_prospector.current_gold\r\n\tassert_equal 0, @test_prospector.current_silver\r\n\tassert_equal 0, @test_prospector.total_gold\r\n\tassert_equal 0, @test_prospector.total_silver\r\n\tassert_equal 0, @test_prospector.move_count\r\n\tassert_nil @test_prospector.previous_location\r\n\tassert_equal 0, @test_prospector.num_days\r\n\tassert_equal 'Sutter Creek', @test_prospector.current_location\r\n end", "def testing_end\n end", "def test_next_song\n \n \n assert true\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def assertions; end", "def assertions; end", "def test_hack\n assert(true)\n end", "def setup\n\n end", "def setup\n\n end", "def setup\n\n end", "def test_attributes\n assert_equal \"Gallery 1\", @gallery.title\n assert @gallery.active?\n assert_equal \"f82dd0bd-4711-4578-ac47-4661257e69a6\", @gallery.guid\n end", "def teardown; end", "def teardown; end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def before_assert\n end", "def test_fake_rubies_found\n\t\ttest_main = Main.new(3, 4, 6)\n\t\ttest_graph = Graph.new(10)\n\t\ttest_main.fake_rubies_found(7)\n\t\ttest_main.fake_rubies_found(7)\n\t\tassert test_main.num_fake_rubies, 14\n\tend", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def test_entry\n raise \"Implement this method in your test class\"\n end", "def tests_song_not_found\n assert_equal =\n end\n\nend", "def test_playlist\n end", "def test_listchunk_attributes\n\t\t\n\tend", "def love_test\nend", "def test_entry_attrs\n raise \"Implement this method in your test class\"\n end", "def test_truth\n assert true\n end", "def stest_method_1(test); end", "def teardown\r\n end", "def default_test\n end", "def test_037\n\n login\n\n #Create some PUs\n\n for i in 0..2\n create_pu('sample_pu'+i.to_s)\n end\n\n pus = Pu.find_all_by_name('sample_pu1')\n pu = pus.last\n pu.created_at =\"2009-05-08 11:30:50\"\n pu.save\n pus = Pu.find_all_by_name('sample_pu2')\n pu = pus.last\n pu.created_at =\"2008-05-08 14:30:50\"\n pu.save\n @@year = \"2009\"\n @@hour = \"14\"\n\n # Open PU management page\n open_pu_management_page_1\n\n # Arbitrary filtering is performed to PU name.\n assert_equal _(\"PU name\"), get_selected_label(\"find_box\")\n\n\n # you have no relevance\n filtering('3')\n assert !is_text_present('sample_pu1')\n assert !is_text_present('sample_pu2')\n assert is_text_present(_('A PU does not exist.'))\n sleep 2\n\n # Delete created data\n @@pu= Pu.find_by_name('sample_pu1')\n @@pu2= Pu.find_by_name('sample_pu2')\n @@pu.destroy\n @@pu2.destroy\n logout\n end", "def run_fe_tests\n end", "def after_test(_test); end", "def after_test(_test); end", "def after_test(_test); end", "def setup; end", "def tests=(_arg0); end", "def tests=(_arg0); end", "def test_truth\n april = riders(:rider_1)\n assert_equal \"April Jones\", april.name\n trigger = horses(:horse_1)\n assert_equal \"Trigger\", trigger.name\n event2 = events(:event_2)\n assert_equal \"5 Horse Scramble\", event2.name\n \n end", "def test_BooksForAnAuthor\n loginRegisterBazzarVoice\n writeReview \n assert true \n end" ]
[ "0.7446459", "0.6956364", "0.69155836", "0.69155836", "0.6864151", "0.6864151", "0.66406286", "0.66406286", "0.66253287", "0.6547665", "0.6524571", "0.6484549", "0.6484549", "0.6484549", "0.6403847", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6385941", "0.6354074", "0.6354074", "0.6350063", "0.6317573", "0.6271346", "0.62341285", "0.6210424", "0.6183045", "0.61626923", "0.61574936", "0.6137384", "0.61362237", "0.61194503", "0.611745", "0.61087", "0.6098303", "0.606717", "0.6058555", "0.6057699", "0.6057699", "0.6057699", "0.6057699", "0.6045397", "0.6045397", "0.6029009", "0.60160005", "0.60160005", "0.60160005", "0.6014079", "0.5998994", "0.5998994", "0.5991374", "0.5991374", "0.5991374", "0.5991374", "0.5991374", "0.5991374", "0.5991374", "0.5989936", "0.59822077", "0.59556234", "0.59556234", "0.59556234", "0.59556234", "0.59556234", "0.59556234", "0.5950605", "0.59497803", "0.5943133", "0.59424186", "0.5932352", "0.59296894", "0.5929659", "0.5917424", "0.59144044", "0.5913393", "0.5905494", "0.5899468", "0.58910733", "0.58910733", "0.58910733", "0.5889112", "0.5883961", "0.5883961", "0.5880121", "0.5877717" ]
0.0
-1
FOR EXAMPLE, IF HE ALREADY HAVE "a1", "a2" and "a3" IN HIS ARRAY (LOOK AT LINE 56 IN APP.RB) HE WINS
def winner? (self.array & ["a1","a2","a3"]).length == 3 || (self.array & ["b1","b2","b3"]).length == 3 || (self.array & ["c1","c2","c3"]).length == 3 || (self.array & ["a1","b1","c1"]).length == 3 || (self.array & ["a2","b2","c2"]).length == 3 || (self.array & ["a3","b3","c3"]).length == 3 || (self.array & ["a1","b2","c3"]).length == 3 || (self.array & ["c1","b2","a3"]).length == 3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contain_a(array)\n has_a = []\n\n array.each do |word|\n has_a << word if word.include?('a')\n end\n has_a\nend", "def winner1\n if [$a[1,3], $a[4,3], $a[7,3], [$a[1],$a[4],$a[7]], [$a[2],$a[5],$a[8]], [$a[3],$a[6],$a[9]], [$a[1],$a[5],$a[9]], [$a[3],$a[5],$a[7]]].any? { |e| e==['X','X','X']} \n puts \"Congratulations, player 1 has won!\"\n $w=true\n end\nend", "def winner2\n if [$a[1,3], $a[4,3], $a[7,3], [$a[1],$a[4],$a[7]], [$a[2],$a[5],$a[8]], [$a[3],$a[6],$a[9]], [$a[1],$a[5],$a[9]], [$a[3],$a[5],$a[7]]].any? { |e| e==['O','O','O']} \n puts \"Congratulations, player 2 has won!\"\n $w=true \n end\nend", "def got_three?(array_list)\n a=nil \n for i in array_list\n if array_list.join.include?(\"#{i.to_s*3}\")\n a=true \n break \n else \n a=false \n end \n end \n a\nend", "def true_for_ravenclaw(array, item)\n for i in array\n status= i.include?(item)\n end\n return status\nend", "def array_test\n @words.each_with_index do |word, i|\n # binding.pry\n seq = \"#{word} #{@words[i+1]} #{@words[i+2]}\"\n if @three_word_sequences.include? seq\n return true\n end\n end\n return false\n end", "def contain_a(array)\n new_array = [ ]\n array.each do |word|\n if word.include?(\"a\") == true\n then new_array << word\n end\n end\n new_array\nend", "def contain_a (array)\n\tarray.select {|element| element.include?(\"a\")}\nend", "def got_three? a\n b = a.uniq.sort\n arr = []\n x = 0\n while x < b.count\n c = (b[x].to_s + ' ') * 2 + b[x].to_s\n arr << (a.join(\" \").include? c) \n x = x + 1\n end\n arr.include? true\nend", "def got_three?(array)\n\tnew_arr = []\n\tarray.each_with_index { |e,i| (array[i] == array[i+1] && array[i+1] == array[i+2]) ? new_arr << 'yes' : new_arr << 'no' }\n\tnew_arr.include?('yes') ? true : false\nend", "def contain_a(array)\n array.select do |element|\n element.include?('a')\n end\nend", "def test3(array)\n\tputs \"Test3: Should return an array of arrays -> \"\n\tabg_maker(array).any? {|x| x.class != Array} ? false : true\nend", "def match_array(input)\n case input\n in [a, b, c]\n \"matching - #{a}, #{b}, #{c}\"\n else\n \"no match\"\n end\nend", "def contain_a(array)\n array.select do |string|\n string.include?('a')\n end\nend", "def ac_added_final_arr(final_arr, filename, row)\n\tfinal_arr.each do |final_tuple|\n\t\tif final_tuple.filename == filename && Integer(row) == Integer(final_tuple.row)\n\t\t\treturn true\n\t\tend\n\tend\n\treturn false\nend", "def proctition_platinum(arr, *prcs)\n\n hash = Hash.new{|h,k| h[k] = []}\n i = 1\n while i < prcs.length\n prcs.each do |prc|\n arr.each do |ele|\n if !(hash.include?(ele)) && prc.call(ele)\n hash[i] << ele\n end\n end\n i += 1\n #i want it to check if the word has already beed added to a value in the has, if so, dont add it to the next one. \n end\n end\n hash\nend", "def got_three?(array)\n r = []\n r_2 = []\n array.each_cons(2) { |a, b| r << [a, b] }\n r.each_cons (2) {|e1, e2| r_2 << (e1 == e2)}\n r_2.include? true\nend", "def include?(array, search_value)\n if array.count(search_value) == 1\n return true\n else\n return false\n end\nend", "def long_planeteer_calls(array)\n array.any? do |word|\n word.size > 4\n end\nend", "def contain_a(arr)\n arr.select do |element|\n element.include?(\"a\")\n end\nend", "def contain_a(array)\n array.select { |word| word.include?(\"a\") }\nend", "def test_rack_contains_a_word_with_duplicate_letters\n [:A,:B,:A,:C].each{|x| @newTileRack.append(x)}\n assert_equal(true,@newTileRack.has_tiles_for?('AAB'))\n end", "def test_extra_array\narray = ['Hufflepuff','Slytherin','Gryffindor','Ravenclaw']\nitem = 'Hufflepuff'\n\nresult = array_check(array,item)\nif result == nil\n puts \"didn't work\"\nelse\n puts \"did work\"\n assert_equal(array[0], array[result])\nend\nend", "def include_str_ary?(instr_ary)\n last_match = 0\n found = 0\n instr_ary.each do |instr|\n self[last_match..-1].each_with_index do |g_ins, idx|\n if g_ins.to_s.index instr\n found += 1\n last_match += idx + 1\n break\n end\n end\n end\n found == instr_ary.size\n end", "def got_three? array\n\n array.each_with_object(Hash.new(0)) do |word,counts|\n counts[word] += 1\n return true if counts[word] >= 3\n\n end\n\nend", "def maybe_matching(ingredient_long_name,item)\n return (item.downcase.split(\" \") & ingredient_long_name.split(\" \")).size >= 1\nend", "def indexes_exist?(vegie_arr, choice_arr)\n vegie_index = []\n vegie_arr.each_index {|index| vegie_index << index}\n if choice_arr.length > vegie_arr.length\n return false\n else\n choice_arr.each do |value|\n return false if !vegie_index.include?(value - 1)\n end\n end\n true\n end", "def check_matchness(aa_sequence_hash,nt_sequence_hash)\n missing_nt_sequence = Array.new\n aa_sequence_hash.each do |defi, seq|\n if nt_sequence_hash[defi].nil? \n # miss that stuff\n missing_nt_sequence << defi\n end\n end\n\n missing_aa_sequence = Array.new\n nt_sequence_hash.each do |defi, seq|\n if aa_sequence_hash[defi].nil?\n missing_aa_sequence << defi\n end\n end\n\n\n return missing_aa_sequence, missing_nt_sequence\n end", "def supply_check(array)\n index = 0\n array.each do |item|\n if item == \"batteries\"\n true\n else\n false\n end\n index += 1\n end\nend", "def probable_matching(ingredient_long_name,item)\n return (item.downcase.split(\" \") & ingredient_long_name.split(\" \")).size >= 2\nend", "def contain_a(arr)\n arr.select do |word| \n word.include?(\"a\")\n end\nend", "def item_included?(str, arr)\n arr.each do |item|\n return true if item == str\n end\n false\nend", "def include?(array, value)\r\n array.count(value) > 0\r\nend", "def game_won_2?(guess_arr)\n SECRET.all? { |letter| guess_arr.include?(letter) }\nend", "def can_capture(arr)\n arr.join().split('').uniq.count != arr.join().split('').count\nend", "def got_three?(arr)\n !!(arr.map(&:to_s).join =~ /(.)\\1\\1/)\nend", "def got_three? array\n\tarray.each_cons(3){ |x| return true if x.all?{|y| y==x[0]} }\n\tfalse\nend", "def test_rack_contains_some_but_not_all_needed_letters\n [:A,:B,:C,:D].each{|x| @newTileRack.append(x)}\n assert_equal(false,@newTileRack.has_tiles_for?('IABJ'))\n end", "def array_42(a)\n\ta.any?{|x| x == 42}\nend", "def is_abba?(a)\n 0.upto(a.length) do |index|\n if (a[index+3] == nil)\n next\n else\n if (a[index] == a[index+3] && a[index+1] == a[index+2] && a[index] != a[index+1])\n return true\n end\n end\n end\n return false\nend", "def combicheck(ref_arr, result)\r\n found_combi = []\r\n not_found_combi = []\r\n ref_arr.each do |item|\r\n #p item\r\n if combifind_in(item, result)\r\n found_combi << item\r\n else\r\n not_found_combi << item\r\n end\r\n end\r\n if found_combi.size == ref_arr.size\r\n log \"Combicheck is ok\"\r\n return true\r\n else\r\n log \"Combicheck failed, NOT found #{not_found_combi.size}/#{ref_arr.size} combi, they are:\"\r\n not_found_combi.each{|e| puts e.join(\",\") }\r\n end\r\n return false\r\n end", "def long_planeteer_calls(array)\n array.any? { |word| word.length > 4}\nend", "def find_a(array)\n if words_has_a = array.select {|words| words.start_with? (\"a\")}\n words_has_a\n end\nend", "def long_planeteer_calls(array)\n array.any? do |word|\n word.length > 4 \n end \nend", "def test4(array)\n\tputs \"Test4: Groups should have 4 members max -> \"\n\tabg_maker(array).any? {|x| x.length > 4} ? false : true\nend", "def in_arr? (arr, text, exact)\n\tif exact\n\t\treturn arr.include? text\n\telse\n\t\treturn arr.any?{|s| s.include? text}\n\tend\nend", "def include_array?(array)\n array.any? { |member| array?(member) }\n end", "def test3(array)\n\tputs \"Test3: Should return an array of arrays -> \"\n\tgroupMaker(array).any? {|x| x.class != Array} ? false : true\nend", "def got_three?(array)\n\noutcome =false\ni = 0\n\tuntil i == array.length\n\t\toutcome = true if array[i] == array[i + 1] && array[i + 1] == array[i + 2]\n\t\ti += 1\n\tend\n\treturn outcome\nend", "def test_rack_doesnt_contain_enough_duplicate_letters\n [:A,:B,:A,:C].each{|x| @newTileRack.append(x)}\n assert_equal(false,@newTileRack.has_tiles_for?('AAAA'))\n end", "def long_planeteer_calls(array)\n array.any? do\n |word| word.length > 4\n end\nend", "def contain_a(array2)\n # return all elements that contain the letter 'a'\n array2.select{|word| word.include?(\"a\")}\nend", "def check_three_and_two(arr)\n answer = Hash.new\n arr.each { |x| answer[x] = arr.count(x)}\n if answer.keys.count == 2 && (answer.values.include?(2) && answer.values.include?(3))\n p true\n else\n p false\n end\nend", "def contains_anagram?(array, word) \r\n array.each { |elt|\r\n if(are_anagrams?(elt, word))\r\n return true\r\n end\r\n }\r\n\r\n false\r\nend", "def got_three?(elements)\n elements.each_cons 3 do |a, b, c|\n if a == b && b == c \t\n \t return true\n end \n end \n \treturn false\nend", "def test_rack_has_needed_letters_when_letters_are_in_order_no_duplicates\n [:A,:B,:C,:D].each{|x| @newTileRack.append(x)}\n assert_equal(true,@newTileRack.has_tiles_for?('ABD'))\n end", "def array_42(z)\n if z.include? 42\n return true\n else\n return false\n end\n\nend", "def match(array)\n #selects and returns array elements that match condition\n array.select do |array_word|\n #Anagram class word split into characters and sort and compare\n (@word.split(\"\").sort) == (array_word.split(\"\").sort)\n end\n end", "def include?(array, search_value)\n # array.each do |element|\n # return true if element == search_value\n # end\n # false\n array.count(search_value) > 0\nend", "def exes_and_ohs(input_string)\n unique_array = input_string.downcase.split('').uniq\n input_array = input_string.downcase.split('')\n if (unique_array.length == 2)\n count_1 = input_array.count(unique_array[0])\n count_2 = input_array.count(unique_array[1])\n if count_1 == count_2\n return true\n else\n return false\n end\n else \n return false\n end\nend", "def has?(arr, e)\n end", "def additional?(cleaved_amino_acids)\n cleaved_amino_acids.window_search(1) do |aa|\n if basic_count(aa) == 1\n return true\n elsif acidic_count(aa) == 1\n return false\n end\n end\n return nil\n end", "def array_includes?(array, given_thing)\n answer = false\n\n array.each do |thing|\n if thing == given_thing\n answer = true\n end\n end\n\n return answer\nend", "def contain_a(elements)\n elements.select do |i|\n has_a = []\n if i.chars.include?\"a\" \n has_a.unshift(i)\n end\n end\nend", "def match_maker(a, *b)\n\tarray = (0...b.count).to_a\n\tnew_array = []\n\tanswer = []\n\tarray.each_slice(2){ |i| new_array << i }\n\t\nif a == false\n\tnew_array.each { |i| \n\t\tb[i[0]], b[i[1]] = !!b[i[0]], !!b[i[1]]\n\t\tb[i[0]] == b[i[1]] ? answer << true : answer << false }\n\nelsif a == true\n\tnew_array.each { |i|\t\t\n\t\tb[i[0]], b[i[1]] = !!b[i[0]], !!b[i[1]]\n\t\tb[i[0]] != b[i[1]] ? answer << true : answer << false }\nelse\nend\nanswer\nend", "def find_a(array)\n\tarray.select do |a_strings|\n\t\ta_strings.start_with?(\"a\")\n\tend\nend", "def mutation(array)\n p first_word = array[0].downcase.chars.sort.join(\" \")\n p second_word = array[1].downcase.chars.sort.join(\" \")\n p first_word.include?(second_word) ? true: false\nend", "def test_xyz_not_in_arr\n refute_includes(list, 'ttt')\n end", "def got_three? array\n\tarray.each.with_index{|x,i| return true if (x == array[i+1] && x == array[i+2])}\n\treturn false\nend", "def long_planeteer_calls(array)\n return array.any?{|item| item.length > 4}\n # code an argument here\n # Your code here\nend", "def contain_a(collections)\n collections.select{|element| element.include?(\"a\")}\nend", "def test_rack_has_needed_letters_when_letters_are_not_in_order_no_duplicates\n [:A,:B,:C,:D].each{|x| @newTileRack.append(x)}\n assert_equal(true,@newTileRack.has_tiles_for?('DAC'))\n end", "def compound_words?(array, target)\n # MY SOLUTION\n for i in 0..array.length-2\n for j in i+1..array.length-1\n if array[i] + array[j] == target || array[j] + array[i] == target\n return true\n end\n end\n end\n return false\nend", "def check_twolast_include name_array, letters\n if name_array.length < 2 # If the name lenght is inferior to two,\n return false # return a negative answer,\n else # or else,\n return name_array.last(2).all? { |char| letters.include? char } # return if the two last characters of the name are from the same group or not.\n end\nend", "def match(array)\n array.keep_if do |string|\n #keep_if is a method that removes anything false and keep only elements that are true\n #binding.pry\n name.split(\"\").sort == string.split(\"\").sort\n #<- name here is being split and then being sorted and checking if it is equal to string element also being splitted and sorted\n #<- once its false, keep_if will remove both of them and only keep the elements that are true.\n end\nend", "def won?\nfor sub_array in WIN_COMBINATIONS do\nindex_1 = sub_array[0]\nindex_2 = sub_array[1]\nindex_3 = sub_array[2]\n\nboard_index_1 = @board[index_1]\nboard_index_2 = @board[index_2]\nboard_index_3 = @board[index_3]\n\n if (board_index_1 == \"X\" && board_index_2 == \"X\" && board_index_3 == \"X\") || (board_index_1 == \"O\" && board_index_2 == \"O\" && board_index_3 == \"O\") \n return sub_array\nend\nend\nfalse\nend", "def match_array_with_values(input)\n case input\n in [1, b, 3]\n \"matching - #{input}, second element is #{b}\"\n else\n \"no match\"\n end\nend", "def long_planeteer_calls(array)\n array.any?{|call| call.length > 4}\n #any?=>returns TRUE if ar least 1 (in this case,4) element is true\nend", "def won?(board)\n WIN_COMBINATIONS.find do |subarray|\n board[subarray[0]] == board[subarray[1]] && board[subarray[1]] == board[subarray[2]] && board[subarray[0]] != \" \"\n end\nend", "def long_planeteer_calls(arr)\n arr.any? {|call|call.length > 4}\nend", "def find_socks_in_array(array)\n array.include? \"socks\"\n puts \"Found #{num_socks} socks!\"\nend", "def got_three?(a) #no idea why thisis not working #wasn't calling the method got_three?\n #iterating over each index and using the .any? method (which returns true as long as the block is not false or nil)\n #so when a[index 1] is the same as index 2 AND index 3, the block is true and the any? method returns true.\n #if not it will return false.\n a.each_index.any? {|i| a[i] == a[i+1] && a[i+1] == a[i+2]}\nend", "def array_42(array)\n a = false\n\tarray.each {|i| if i == 42 then a = true end}\n return a \nend", "def dup_args_ms(arr)\n arr.any? {|e| arr.count(e) > 1} ? true : false\nend", "def arr_in_phrase? (arr, string)\n\t#might be unefficient to recreate the reg each time, maybe better to return a regex?\n\treg = arr.map {|str| Regexp.escape(str)}\n\treg = /#{arr.join(\"|\")}/ \n\treturn reg === string\nend", "def got_three?(array)\n comp = ''\n num = 0\narray.each do |value|\n if value == comp && num == 1\n return true\n elsif value == comp\n num = 1\n else\n comp = value\n num = 0\n end\nend\n false\nend", "def array_flash(n)\nhash = Hash[\n'&','name: Set Intersection---Returns a new array\ncontaining elements common to the two arrays, with no duplicates.\n\n [ 1, 1, 3, 5 ] _____ [ 1, 2, 3 ] #=> [ 1, 3 ]' ,\n'*','name: Repetition---With a String argument, equivalent to\nself.join(str). Otherwise, returns a new array\nbuilt by concatenating the _int_ copies of self.\n[ 1, 2, 3 ] _____ 3 #=> [ 1, 2, 3, 1, 2, 3, 1, 2, 3 ]\n[ 1, 2, 3 ] _____\",\" #=> \"1,2,3\" ',\n'+','name: Concatenation---Returns a new array built by concatenating the\ntwo arrays together to produce a third array.',\n'-','Array Difference---Returns a new array that is a copy of\nthe original array, removing any items that also appear in\nother_ary.\n [ 1, 1, 2, 2, 3, 3, 4, 5 ]____[ 1, 2, 4 ] #=> [ 3, 3, 5 ]',\n'<=>','Comparison---Returns an integer (-1, 0,\nor +1) if this array is less than, equal to, or greater than\nother_ary.\n[ \"a\", \"a\", \"c\" ] _____[ \"a\", \"b\", \"c\" ] #=> -1\n [ 1, 2, 3, 4, 5, 6 ]______[ 1, 2 ] #=> +1',\n 'any?','Passes each element of the collection to the given block. The method\nreturns true if the block ever returns a value other\nthan false or nil. If the block is not\ngiven, Ruby adds an implicit block of {|obj| obj} (that\nis any? will return true if at least one\nof the collection members is not false or\nnil.\n%w{ant bear cat}._____ {|word| word.length >= 3} #=> true\n %w{ant bear cat}._____ {|word| word.length >= 4} #=> true\n [ nil, true, 99 ]._____ #=> true',\n'assoc','Searches through an array whose elements are also arrays\ncomparing _obj_ with the first element of each contained array\nusing obj.==.\nReturns the first contained array that matches (that\nis, the first associated array),\nor nil if no match is found.\n s1 = [ \"colors\", \"red\", \"blue\", \"green\" ]\n s2 = [ \"letters\", \"a\", \"b\", \"c\" ]\n s3 = \"foo\"\n a = [ s1, s2, s3 ]\n a._______ #=> [ \"letters\", \"a\", \"b\", \"c\" ]\n a._______ #=> nil(foo is not an array)',\n'clear','Removes all elements from self\na = [ \"a\", \"b\", \"c\", \"d\", \"e\" ] \n______ #=> [ ]',\n'combination','When invoked with a block, yields all combinations of length n\nof elements from ary and then returns ary itself.\nThe implementation makes no guarantees about the order in which\nthe combinations are yielded.\n\nIf no block is given, an enumerator is returned instead.\n a = [1, 2, 3, 4]\n a.______(1).to_a #=> [[1],[2],[3],[4]]\n a.______(2).to_a #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]\n a.______(3).to_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]\n a.______(4).to_a #=> [[1,2,3,4]]\n a.______(0).to_a #=> [[]] # one combination of length 0\n a.______(5).to_a #=> [] # no combinations of length 5',\n'compact','Returns a copy of self with all nil elements removed.\n [ \"a\", nil, \"b\", nil, \"c\", nil ]._________ #=> [ \"a\", \"b\", \"c\" ]',\n'concat','Appends the elements of other_ary to SELF.\n[ \"a\", \"b\" ]._________( [\"c\", \"d\"] ) #=> [ \"a\", \"b\", \"c\", \"d\" ]',\n'','Returns the number of elements. If an argument is given, counts\nthe number of elements which equals to obj. If a block is\ngiven, counts the number of elements yielding a true value.\n \tary = [1, 2, 4, 2]\n ary._______ #=> 4\n ary._______(2) #=> 2\n ary._______{|x|x%2==0} #=> 3',\n'cycle','Calls block for each element repeatedly _n_ times or\nforever if none or nil is given. If a non-positive number is\ngiven or the array is empty, does nothing. Returns nil if the\nloop has finished without getting interrupted.\n\nIf no block is given, an enumerator is returned instead.\n\n\n a = [\"a\", \"b\", \"c\"]\n a.______ {|x| puts x } # print, a, b, c, a, b, c,.. forever.\n a.______(2) {|x| puts x } # print, a, b, c, a, b, c.',\n'delete','\nDeletes items from self that are equal to obj.\nIf any items are found, returns obj. If\nthe item is not found, returns nil. If the optional\ncode block is given, returns the result of block if the item\nis not found. (To remove nil elements and\nget an informative return value, use #compact!)\na = [ \"a\", \"b\", \"b\", \"b\", \"c\" ]\n a.______(\"b\") #=> \"b\"\n a #=> [\"a\", \"c\"]\n a.______(\"z\") #=> nil\n a.______(\"z\") { \"not found\" } #=> \"not found\"',\n'delete_at','Deletes the element at the specified index, returning that element,\nor nil if the index is out of range. See also\nArray#slice!\na = %w( ant bat cat dog )\n a._______(2) #=> \"cat\"\n a #=> [\"ant\", \"bat\", \"dog\"]\n a._______(99) #=> nil',\n'_____','Deletes every element of self for which block evaluates\nto true.\nThe array is changed instantly every time the block is called and\nnot after the iteration is over.\nSee also Array#reject!\n\nIf no block is given, an enumerator is returned instead.\n\n a = [ \"a\", \"b\", \"c\" ]\n a._____ {|x| x >= \"b\" } #=> [\"a\"]',\n 'dig','Retrieves the value object corresponding to the each key objects \n repeatedly.\n h = { foo: {bar: {baz: 1}}}\nh.________(:foo, :bar, :baz) #=> 1\nh.________(:foo, :zot) #=> nil',\n 'drop','removes first n elements from ary and returns the rest of\nthe elements in an array.\n a = [1, 2, 3, 4, 5, 0]\n a.______(3) #=> [4, 5, 0]',\n 'drop_while','removes first elements until the statement is false then returns\n an array with the remaining.\n\nIf no block is given, an enumerator is returned instead.\n\n a = [1, 2, 3, 4, 5, 0]\n a.drop_while {|i| i < 3 } #=> [3, 4, 5, 0]',\n 'each','passes block once for each element in self, passing that\nelement as a parameter.\n\nIf no block is given, an enumerator is returned instead.\n\n a = [ \"a\", \"b\", \"c\" ]\n a.______{|x| print x, \" -- \" } #=> a -- b -- c --',\n 'each_index','passes the index of the element\ninstead of the element itself.\n\nIf no block is given, an enumerator is returned instead.\n\n\n a = [ \"a\", \"b\", \"c\" ]\n a.________ {|x| print x, \" -- \" } #=> 0 -- 1 -- 2 --',\n 'empty?','\nReturns true if self contains no elements.\n\n [].empty? #=> true',\n 'fetch','Tries to return the element at position index. If the index\nlies outside the array, the first form throws an\nIndexError exception, the second form returns\ndefault, and the third form returns the value of invoking\nthe block, passing in the index. Negative values of index\ncount from the end of the array.\n\n a = [ 11, 22, 33, 44 ]\n a.______(1) #=> 22\n a.______(-1) #=> 44\n a.______(4, \"cat\") #=> \"cat\"\n a.______(4) { |i| i*i } #=> 16',\n'fill','The first three forms set the selected elements of self (which\nmay be the entire array) to obj. A start of\nnil is equivalent to zero. A length of\nnil is equivalent to self.length. The last three\nforms fill the array with the value of the block. The block is\npassed the absolute index of each element to be filled.\nNegative values of start count from the end of the array.\n\n a = [ \"a\", \"b\", \"c\", \"d\" ]\n a._____(\"x\") #=> [\"x\", \"x\", \"x\", \"x\"]\n a._____(\"z\", 2, 2) #=> [\"x\", \"x\", \"z\", \"z\"]\n a._____(\"y\", 0..1) #=> [\"y\", \"y\", \"z\", \"z\"]\n a._____ {|i| i*i} #=> [0, 1, 4, 9]\n a._____(-2) {|i| i*i*i} #=> [0, 1, 8, 27]',\n ['index','find_index'],'Returns the index of the first object in self such that the object is\n== to obj. If a block is given instead of an\nargument, returns index of first object for which block is true.\nReturns nil if no match is found.\nSee also Array#rindex.\n\nIf neither block nor argument is given, an enumerator is returned instead.\n\n a = [ \"a\", \"b\", \"c\" ]\n a.index(\"b\") #=> 1\n a.index(\"z\") #=> nil\n a.index{|x|x==\"b\"} #=> 1',\n 'flatten','Returns a new array that is a one-dimensional _______ of this\narray (recursively). That is, for every element that is an array,\nextract its elements into the new array. If the optional\nlevel argument determines the level of recursion to _______.\n\n s = [ 1, 2, 3 ] #=> [1, 2, 3]\n t = [ 4, 5, 6, [7, 8] ] #=> [4, 5, 6, [7, 8]]\n a = [ s, t, 9, 10 ] #=> [[1, 2, 3], [4, 5, 6, [7, 8]], 9, 10]\n a._______ #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n a = [ 1, 2, [3, [4, 5] ] ]\n a._______(1) #=> [1, 2, 3, [4, 5]]',\n 'frozen?','Returns the freeze status of obj.\n\n a = [ \"a\", \"b\", \"c\" ]\n a.freeze #=> [\"a\", \"b\", \"c\"]\n a.frozen? #=> true',\n 'include?','Returns true if the given object is present in\nself (that is, if any object == anObject),\nfalse otherwise.\n\n a = [ \"a\", \"b\", \"c\" ]\n a._______(\"b\") #=> true\n a._______(\"z\") #=> false',\n 'insert','adds the given values before the element with the given index\n(which may be negative).\n\n a = %w{ a b c d }\n a._______(2, 99) #=> [\"a\", \"b\", 99, \"c\", \"d\"]\n a._______(-2, 1, 2, 3) #=> [\"a\", \"b\", 99, \"c\", 1, 2, 3, \"d\"] ',\n \"inspect\",\"Creates a string representation of self. like puts but as a method\",\n \"join\",\"Returns a string created by converting each element of the array to\na string, separated by sep.\n\n [ 'a', 'b', 'c' ].______ #=> 'abc'\n [ 'a', 'b', 'c' ].______('-') #=> 'a-b-c' \",\n \"keep_if\",\"Deletes every element of self for which block evaluates\nto false.\nSee also Array#select!\n\nIf no block is given, an enumerator is returned instead.\n\n a = %w{ a b c d e f }\n a._______ {|v| v =~ /[aeiou]/} #=> ['a', 'e']\",\n \"last\",\"Returns the last element(s) of self. If the array is empty,\nthe first form returns nil.\n\n a = [ 'w', 'x', 'y', 'z' ]\n a.______ #=> 'z'\n a.______(2) #=> ['y', 'z']\",\n [\"collect!\",\"map!\"],\" Invokes the block once for each element of self, replacing the\nelement with the value returned by _block_.\n\nIf no block is given, an enumerator is returned instead.\n\n a = [ 'a', 'b', 'c', 'd' ]\n a.______ {|x| x + '!' }\n a #=> [ 'a!', 'b!', 'c!', 'd!' ] \",\n \"permutation\",\"When invoked with a block, yield all permutations of length n\nof the elements of ary, then return the array itself.\nIf n is not specified, yield all permutations of all elements.\nThe implementation makes no guarantees about the order in which\nthe permutations are yielded.\n\nIf no block is given, an enumerator is returned instead.\n\nExamples:\n\n a = [1, 2, 3]\n a._______.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]\n a._______(1).to_a #=> [[1],[2],[3]]\n a._______(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]\n a._______(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]\n a._______(0).to_a #=> [[]] # one _______ of length 0\n a._______(4).to_a #=> [] # no _______s of length 4\",\n \"place\",\" Places values before or after another object (by value) in\nan array. This is used in tandem with the before and after\nmethods of the {Insertion} class.\n\nexample _______ an item before another\n [1, 2, 3].place(4).before(3) # => [1, 2, 4, 3]\nexample _______ an item after another\n [:a, :b, :c].place(:x).after(:a) # => [:a, :x, :b, :c]\nparam [Array] values value to insert\nreturn [Insertion] an insertion object to\",\n \"pop\",\"Removes the last element from self and returns it, or\nnil if the array is empty.\n\nIf a number _n_ is given, returns an array of the last n elements\n(or less) just like array.slice!(-n, n) does.\n\n a = [ 'a', 'b', 'c', 'd' ]\n a.______ #=> 'd'\n a.______(2) #=> ['b', 'c']\n a #=> ['a'] \",\n \"product\",\"Returns an array of all combinations of elements from all arrays.\nThe length of the returned array is the product of the length\nof self and the argument arrays.\nIf given a block, product will yield all combinations\nand return self instead.\n\n\n [1,2,3].______([4,5]) #=> [[1,4],[1,5],[2,4],[2,5],[3,4],[3,5]]\n [1,2].______([1,2]) #=> [[1,1],[1,2],[2,1],[2,2]]\n [1,2].______([3,4],[5,6]) #=> [[1,3,5],[1,3,6],[1,4,5],[1,4,6],\n # [2,3,5],[2,3,6],[2,4,5],[2,4,6]]\n [1,2].______() #=> [[1],[2]]\n [1,2].______([]) #=> [] \",\n \"rassoc\",\" Searches through the array whose elements are also arrays. Compares\n_obj_ with the second element of each contained array using\n==. Returns the first contained array that matches.\n a = [ [ 1, 'one'], [2, 'two'], [3, 'three'], ['ii', 'two'] ]\n a.rassoc('two') #=> [2, 'two']\n a.rassoc('four') #=> nil \",\n [\"reject\",\"delete_if\"], \"Returns a new array containing the items in self\nfor which the block is not true.\nIf no block is given, an enumerator is returned instead.\",\n \"repeated_combination\",\"When invoked with a block, yields all repeated combinations of\nlength n of elements from ary and then returns\nary itself.\nThe implementation makes no guarantees about the order in which\nthe ______________ are yielded.\n\nIf no block is given, an enumerator is returned instead.\n\nExamples:\n\n a = [1, 2, 3]\n a.___________(1).to_a #=> [[1], [2], [3]]\n a.___________(2).to_a #=> [[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]]\n a.___________(3).to_a #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],\n # [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]\n a.___________(4).to_a #=> [[1,1,1,1],[1,1,1,2],[1,1,1,3],[1,1,2,2],[1,1,2,3],\n # [1,1,3,3],[1,2,2,2],[1,2,2,3],[1,2,3,3],[1,3,3,3],\n # [2,2,2,2],[2,2,2,3],[2,2,3,3],[2,3,3,3],[3,3,3,3]]\n a.___________(0).to_a #=> [[]] # one ________ of length 0\",\n \"repeated_permutation\",\"When invoked with a block, yield all repeated permutations of length\nn of the elements of ary, then return the array itself.\nThe implementation makes no guarantees about the order in which\nthe ___________are yielded.\n\nIf no block is given, an enumerator is returned instead.\n\nExamples:\n\n a = [1, 2]\n a._______(1).to_a #=> [[1], [2]]\n a._______(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]\n a._______(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],\n # [2,1,1],[2,1,2],[2,2,1],[2,2,2]]\n a._______(0).to_a #=> [[]] # one ___________of length 0\",\n \"replace\",\" Replaces the contents of self with the contents of\nother_ary, truncating or expanding if necessary.\n\n a = [ 'a', 'b', 'c', 'd', 'e' ]\n a.______([ 'x', 'y', 'z' ]) #=> ['x', 'y', 'z']\n a #=> ['x', 'y', 'z'] #its like reassigning the variable\",\n \"reverse!\",\"\nReverses SELF in place.\n\n a = [ 'a', 'b', 'c' ]\n a._______ #=> ['c', 'b', 'a']\n a #=> ['c', 'b', 'a'] \",\n \"reverse_each\",\"Same as Array#each, but traverses self in reverse\norder.\n\n a = [ 'a', 'b', 'c' ]\n a.______ {|x| print x, ' ' } #=> c b a\",\n \"rindex\",\" Returns the index of the LAST object in self\n== to obj. If a block is given instead of an\nargument, returns index of first object for which block is\ntrue, starting from the last object.\nReturns nil if no match is found.\nSee also Array#index.\n\nIf neither block nor argument is given, an enumerator is returned instead.\n\n a = [ 'a', 'b', 'b', 'b', 'c' ]\n a.______('b') #=> 3\n a.______('z') #=> nil\n a.______ { |x| x == 'b' } #=> 3\",\n \"rotate\",\"Returns new array by rotating self so that the element at\ncnt in self is the first element of the new array. If cnt\nis negative then it rotates in the opposite direction.\n\n a = [ 'a', 'b', 'c', 'd' ]\n a._______ #=> ['b', 'c', 'd', 'a']\n a #=> ['a', 'b', 'c', 'd']\n a._______(2) #=> ['c', 'd', 'a', 'b']\n a._______(-3) #=> ['b', 'c', 'd', 'a'] \",\n \"sample\",\"Choose a random element or n random elements from the array. The elements\nare chosen by using random and unique indices into the array in order to\nensure that an element doesn't repeat itself unless the array already\ncontained duplicate elements. If the array is empty the first form returns\nnil and the second form returns an empty array.\n\nIf rng is given, it will be used as the random number generator.\",\n \"select\",\"Invokes the block passing in successive elements from self,\nreturning an array containing those elements for which the block\nreturns a true value (equivalent to Enumerable#______).\n\nIf no block is given, an enumerator is returned instead.\n\n a = %w{ a b c d e f }\n a.______ {|v| v =~ /[aeiou]/} #=> ['a', 'e'] \",\n \"shift\",\"Returns the first element of self and removes it (shifting all\nother elements down by one). Returns nil if the array\nis empty.\n\nIf a number _n_ is given, returns an array of the first n elements\n(or less) just like array.slice!(0, n) does.\n\n args = [ '-m', '-q', 'filename' ]\n args._______ #=> '-m'\n args #=> ['-q', 'filename']\n\n args = [ '-m', '-q', 'filename' ]\n args._______(2) #=> ['-m', '-q']\n args #=> ['filename'] \",\n \"shuffle\",\"Returns a new array with elements of this array ______.\n\n a = [ 1, 2, 3 ] #=> [1, 2, 3]\n a.______ #=> [2, 3, 1]\n\nIf rng is given, it will be used as the random number generator.\n\n a.______(random: Random.new(1)) #=> [1, 3, 2] \",\n [\"slice\",\"[]\"],\"Element Reference---Returns the element at _index_,\nor returns a subarray starting at _start_ and\ncontinuing for _length_ elements, or returns a subarray\nspecified by _range_.\nNegative indices count backward from the end of the\narray (-1 is the last element). Returns nil if the index\n(or starting index) are out of range.\n\n a = [ 'a', 'b', 'c', 'd', 'e' ]\n a[2] + a[0] + a[1] #=> 'cab'\n a[6] #=> nil\n a[1, 2] #=> [ 'b', 'c' ]\n a[1..3] #=> [ 'b', 'c', 'd' ]\n a[4..7] #=> [ 'e' ]\n a[6..10] #=> nil\n a[-3, 3] #=> [ 'c', 'd', 'e' ]\n # special cases\n a[5] #=> nil\n a[5, 1] #=> []\n a[5..10] #=> []\",\n \"sort\",\"Returns a new array created by organizing self. Comparisons for\nthe _____ will be done using the <=> operator or using\nan optional code block. The block implements a comparison between\na and b, returning -1, 0, or +1. \n\n a = [ 'd', 'a', 'e', 'c', 'b' ]\n a.______ #=> ['a', 'b', 'c', 'd', 'e']\n a.______ {|x,y| y <=> x } #=> ['e', 'd', 'c', 'b', 'a'] \",\n [\"take\",\"first\"] ,\"Returns first n elements from ary.\n\n a = [1, 2, 3, 4, 5, 0]\n a.______(3) #=> [1, 2, 3]\",\n \"take_while\",\"\nPasses elements to the block until the block returns nil or false,\nthen stops iterating and returns an array of all prior elements.\n\nIf no block is given, an enumerator is returned instead.\n\n a = [1, 2, 3, 4, 5, 0]\n a._______{|i| i < 3 } #=> [1, 2] \",\n \"transpose\",\"Assumes that self is an array of arrays and rearranges the\nrows and columns.\n\n a = [[1,2], [3,4], [5,6]]\n a.________ #=> [[1, 3, 5], [2, 4, 6]]\",\n \"uniq\",\"Returns a new array by removing duplicate values in self. If a block\nis given, it will use the return value of the block for comparison.\n\n a = [ 'a', 'a', 'b', 'b', 'c' ]\n a.uniq # => ['a', 'b', 'c']\n\n b = [['student','sam'], ['student','george'], ['teacher','matz']]\n b.uniq { |s| s.first } # => [['student', 'sam'], ['teacher', 'matz']]\",\n \"unshift\",\"Prepends objects to the front of self,\nmoving other elements upwards.\n\n a = [ 'b', 'c', 'd' ]\n a.unshift('a') #=> ['a', 'b', 'c', 'd']\n a.unshift(1, 2) #=> [ 1, 2, 'a', 'b', 'c', 'd']\",\n \"values_at\",\"Returns an array containing the elements in\nself corresponding to the given selector(s). The selectors\nmay be either integer indices or ranges.\nSee also Array#select.\n\n a = %w{ a b c d e f }\n a._______(1, 3, 5)\n a._______(1, 3, 5, 7)\n a._______(-1, -3, -5, -7)\n a._______(1..3, 2...5) \",\n\"zip\",\"Converts any arguments to arrays, then merges elements of\nself with corresponding elements from each argument. This\ngenerates a sequence of self.size n-element\narrays, where n is one more that the count of arguments. If\nthe size of any argument is less than enumObj.size,\nnil values are supplied. If a block is given, it is\ninvoked for each output array, otherwise an array of arrays is\nreturned.\n\n a = [ 4, 5, 6 ]\n b = [ 7, 8, 9 ]\n [1,2,3].zip(a, b) #=> [[1, 4, 7], [2, 5, 8], [3, 6, 9]]\n [1,2].zip(a,b) #=> [[1, 4, 7], [2, 5, 8]]\n a.zip([1,2],[8]) #=> [[4,1,8], [5,2,nil], [6,nil,nil]] \",\n \"|\",\"Set Union---Returns a new array by joining this array with\nother_ary, removing duplicates.\n\n [ 'a', 'b', 'c' ] | [ 'c', 'd', 'a' ]\n #=> [ 'a', 'b', 'c', 'd' ] \",\n]\n\n\n\n\n\n\n\na = 0\n\tuntil a == n\n\tindex = rand(hash.size)\n\tquestion = hash.values[index].split.join(' ')#.gsub(/\\\\n/,' ').gsub(/\\\\\\\\/,' ').gsub(/\\\\/,' ').delete(\"\\n\")\n\t\n\tp \"which Array method is this?\"\n\tp ''\n\tp question.split.join(' ')#.gsub(/\\\\n/, \" \").gsub(/\\\\/,\" \")\n\t\n\tinput = gets.chomp\n\t\tuntil hash.keys[index].include?(input)\n\t\t\tbreak if ['idk', 'i dont know', 'i give up'].include?(input)\n\t\t\tp ''\n\t\t\tp hash.values[index].split.join(' ')#.gsub(/\\\\n/,' ').gsub(/\\\\\\\\/,' ').gsub(/\\\\/,' ').delete(\"\\n\")\n\t\t\tp ''\n\t\t\tp '!!!!!!!!! try again !!!!!!!!!!'\n\t\t\t\n\t\t\tinput = gets.chomp \n\t\tend\n\t\t\n\t\tp \"\"\n\t\tp \"------------- good job it is #{hash.keys[index]}-----------------\"\n\t\t\n\t\thash.delete((hash.keys[index]))\n\t\ta += 1\n\tend\n\np '~~~~~~~~~~ you finished ~~~~~~~~~~~~~~~~~'\n\nend", "def got_three?(array)\n\tanswer = false\n\tcounter = 0\n\n\twhile counter <= array.length - 1 do \t\t\t\t\t\t\t\t\t\t\n\n\t\tarray.each do |element|\n\t\t\t# element 1\n\t\t\t# counter 1 \n\t\t\tif element == array[counter + 1] && element == array[counter+2]\n\t\t\t\treturn true\n\t\t\tend\n\t\tcounter += 1\n\t\tend\t\n\n\n\tend\t\n\tanswer\nend", "def test_4_verify_number_not_added_to_bucket_array_if_already_present\r\n $bucket = [\"b\"]\r\n letter = \"b\"\r\n results = good_letter(letter)\r\n assert_equal([\"b\"], $bucket)\r\n end", "def solution(a)\n present = {}\n a.each do |i|\n present[i] = true\n end\n\n p present.length\n\nend", "def validate_comb(board_view, comb)\n comb.each_with_index do |value, idx|\n return false unless board_view[idx].include?(value)\n end\n true\nend", "def include?(array, search_value)\n array.count(search_value) > 0\nend", "def got_three?(array) # def got_three?(elements)\n array.each_cons 3 do |a, b, c| # elements.each_cons 3 do |a, b, c|\n if a == b && b == c # return true if a == b && b == c\n return true # end\n else # false\n false # end\n end\n end\nend", "def got_three? array\n three = false\n array.each_cons(3) do |a, b, c|\n three = true if (a == b && a == c)\n end\n three\nend", "def exes_and_ohs(input)\n # Your code goes here\n arr = input.downcase.split('')\n\n if arr.uniq.count == 2 && arr.count <= 6\n puts true\n else\n puts false\n end\nend", "def includes?(array, target)\n #empty array does not contain object\n return false if array == []\n\n #start with array[3]\n value = array.shift #pluck off\n if value == target\n true #the recursive call is not made\n else\n includes?(array, target)\n end\n\nend", "def item_include?(array, string)\n match = false\n array.each do |el|\n if el == string\n match = true\n end\n end\n match\nend", "def find_a(any_array)\n any_array.find_all do |str|\n str[0] == \"a\"\n end\n end", "def bank_valid_word_match(yes)\n if yes == true\n array1 << @word\n else nil\n end\n end", "def require_array_match(arr)\n\t\tfilter_two_arrays(self, arr, true)\n\tend" ]
[ "0.6461033", "0.6255703", "0.62261987", "0.61913556", "0.6177656", "0.61187106", "0.60849464", "0.60564137", "0.5954729", "0.5938796", "0.59317416", "0.59267807", "0.59267354", "0.59046876", "0.5892153", "0.5889572", "0.5857643", "0.5854126", "0.5837481", "0.5837244", "0.582389", "0.58233273", "0.58226323", "0.5816281", "0.58154136", "0.58087623", "0.5806605", "0.57881486", "0.57860935", "0.5783998", "0.5768123", "0.5755386", "0.5752912", "0.5734944", "0.57322776", "0.57298094", "0.5724666", "0.5711717", "0.57074505", "0.57072693", "0.56972426", "0.56905675", "0.56886953", "0.5687688", "0.5675351", "0.5664651", "0.5655621", "0.5653483", "0.5644524", "0.5644488", "0.56368554", "0.5636187", "0.5629513", "0.5625385", "0.56112444", "0.5610695", "0.5597326", "0.5595005", "0.5592918", "0.55901355", "0.558229", "0.55816543", "0.55795836", "0.5573793", "0.5573234", "0.55664945", "0.5564039", "0.55584544", "0.55561787", "0.5555527", "0.5555372", "0.5550992", "0.55497646", "0.55439425", "0.5541065", "0.55347234", "0.5532813", "0.5532721", "0.55325204", "0.5525375", "0.5524871", "0.552151", "0.55206347", "0.55193007", "0.55159926", "0.55153745", "0.55040956", "0.5503171", "0.5502921", "0.54881096", "0.5486991", "0.54859203", "0.5475523", "0.5472838", "0.54698855", "0.5469537", "0.54675967", "0.54638255", "0.54622334", "0.5460241" ]
0.58544266
17
This will attach employee to RO after the RO has been created.
def repair_order_employees_create @business_id = current_business_user.id @client_id = current_client.id @vehicle_id = current_vehicle.id @employee_repair_order = current_repair_order.employee_users_repair_orders.new( business_user_id: @business_id, client_id: @client_id, vehicle_id: @vehicle_id, employee_user_id: params[:id]) if @employee_repair_order.save render json: {employee_repair_order: @employee_repair_order.as_json(include: [:repair_order, :vehicle, :client])}, status: :created else render json: { errors: @employee_repair_order.errors.full_messages }, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_HR_record employee\n \n processed_record = \".\" \n \n firstname = employee[0].split(\" \")[0]\n lastname = employee[0].split(\" \")[1]\n fullname = employee[0]\n dept = @managers.has_value?(fullname.to_s) ? @managers.key(fullname.to_s) : get_dept #check if employee fullname already exists in MANAGERS hash if so use dept\n job_title = @managers.has_value?(fullname.to_s) ? \"Manager\" : get_title(dept) #check if employee fullname already exists in MANAGERS hash is so = manager\n employeeid = get_employeeid firstname, lastname\n email = get_email firstname, lastname\n start_date = get_start_date\n end_date = get_end_date #not implemented\n manager = job_title == \"Manager\" ? \"CEO\" : @managers[dept.to_sym]\n mobile = get_phone\n location = get_continent\n\n @completed_users << \"#{employeeid},#{fullname},#{firstname},#{lastname},#{email},#{dept},#{job_title},#{manager},#{start_date},#{mobile},#{location}\"\n \n STDERR.print processed_record\nend", "def create_employee\n user = User.new(first_name: \"Nelson\", last_name: \"Muntz\", username: \"nmuntz\", email: \"chris+nmuntz@cryptographi.com\", 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: 'chris+rwiggum@cryptographi.com')\n user.manager_id = manager.id\n if user.save\n user.add_role :employee\n end\n end", "def add_employee(employee)\n subject = Subject.new(\n administrator_id: id,\n employee_id: employee.id\n )\n subject.save ? true : false\n end", "def invite_employee(employees, event)\n employees.each do |e|\n Attendance.create(user_id: e, event_id: event, rsvp: \"Invited\")\n end\n end", "def add_as_employee\n \tputs \"Called for new employee\"\n end", "def create\n @employee = current_owner.employees.new(params[:employee])\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render json: @employee, 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 end", "def hire_employee(employee)\n @employees << employee\n end", "def allocate_to_employee(employee_id, count)\n records = []\n count.times do\n records << { approval_status: 'approved', inventory_release_id: id, requester_id: employee_id }\n end\n RequestAttendance.create!(records)\n end", "def create\n @company = Company.find(params[:company_id]) \n #@employee = Employee.new(employee_params)\n @employee = @company.employees.create(employee_params)\n \n respond_to do |format|\n if @employee.save\n format.html { redirect_to company_employees_url(@company), notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(employee_params)\n @employee.employer = current_user.id\n \n\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to employees_path, notice: 'New 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 redirect_to :back\n end\n end\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 @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 create_employee_user\n email = self.work_email\n user = User.new(email: self.work_email, password: 'appsimpact@#123', role: 'employee')\n user.save\n self.user_id = user.id\n end", "def create\n @employee = Employee.new(employee_params)\n\n if current_employee\n @employee.organization_id = current_employee.organization_id\n end\n\n respond_to do |format|\n if @employee.save\n if current_employee\n # If employee is logged in, notice should say you added employees to table\n format.html { redirect_to @employee,\n notice: \"#{@employee.first_name.capitalize} #{@employee.last_name.capitalize} was added on #{Time.new.strftime('%m/%d/%Y')}\"\n }\n else\n # If employee is not logged in, notice should say you just signed up\n session[:id] = @employee.id\n format.html { redirect_to organizations_path,\n notice: \"Thank you for signing up #{@employee.first_name.capitalize} #{@employee.last_name.capitalize}\"\n }\n end\n format.json { render :show, status: :created, location: @employee }\n @employee.schedule = Schedule.create(department_id: @employee.department_id)\n # Possibly move to after_save, if email changes, set needs_verification\n @employee.needs_verification!\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_employees\n ceo = Employee.new(name: 'CEO', emp_id: 1, salary: 100000, date_of_joining: Time.now)\n ceo.save(validate: false)\n vp = Employee.new(name: 'VP', emp_id: 1, salary: 10000, date_of_joining: Time.now, ceo_id: ceo.id)\n vp.save(validate: false)\n director = Employee.new(name: 'Director', emp_id: 1, salary: 1000, date_of_joining: Time.now, ceo_id: ceo.id, vp_id: vp.id)\n director.save(validate: false)\n manager = Employee.new(name: 'Manager', emp_id: 1, salary: 100, date_of_joining: Time.now, ceo_id: ceo.id, vp_id: vp.id, director_id: director.id)\n manager.save(validate: false)\n sde = Employee.new(name: 'SDE', emp_id: 1, salary: 100, date_of_joining: Time.now, ceo_id: ceo.id, vp_id: vp.id, director_id: director.id, manager_id: manager.id)\n sde.save(validate: false)\n end", "def employee\n @last_ext += 1\n p = Person.new\n p.office_phonenumber = Phonenumber.new(@phonenumber.prefix, phonenumber.number, @last_ext.to_s)\n p.office_email = Email.new(p)\n p.office_email.user_from_names(p, \".\")\n p.office_email.host = @domain\n p\n end", "def add_default_employees\n if transaction_include_action?(:create)\n self.employees.create!(first_name: \"Employee\", last_name: \"Solo\")\n self.employees.create!(first_name: \"Out of\", last_name: \"Office\")\n end\n end", "def replicate_for_rehire\n return nil unless self.employment_terminated?\n new_employee = self.dup\n new_employee.hired_on = nil\n new_employee.employment_terminated_on = nil\n new_employee.employee_role_id = nil\n new_employee.benefit_group_assignments = []\n new_employee.aasm_state = :eligible\n self.rehire_employee_role\n\n # new_employee.census_dependents = self.census_dependents unless self.census_dependents.blank?\n new_employee\n end", "def create\n if params[:employee_association][:associable_type] == \"Device\"\n @association = Device.find(params[:device_id])\n elsif params[:employee_association][:associable_type] == \"Computer\"\n @association = Computer.find(params[:computer_id])\n elsif params[:employee_association][:associable_type] == \"Item\"\n @association = Item.find(params[:item_id])\n end\n @employee_association = @association.employee_associations.build(params[:employee_association])\n #@employee_association = EmployeeAssociation.new(params[:employee_association])\n\n respond_to do |format|\n if @employee_association.save\n format.html { redirect_to @employee_association, notice: 'Employee association was successfully created.' }\n format.json { render json: @employee_association, status: :created, location: @employee_association }\n else\n format.html { render action: \"new\" }\n format.json { render json: @employee_association.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(employee_params)\n @skills = Skill.where(:id => params[:organizing_team])\n @employee.skills << @skills\n set_avatar\n \n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.js\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(employee_params)\n @employee.editor_id = current_user.id\n @part_time_employee = PartTimeEmployee.new(part_time_employee_params)\n if isAdmin\n @part_time_employee.verified = 1\n end\n respond_to do |format|\n @part_time_employee.valid?\n if @employee.valid? && @part_time_employee.valid?\n if @employee.save\n @part_time_employee.employee = Employee.find(@employee.id)\n format.json { render :show, status: :created, location: @employee }\n if @part_time_employee.save\n @logs = Log.new\n @logs.employeeInfo = @employee.to_json\n @logs.additionalInfo = @part_time_employee.to_json\n @logs.CRUD = \"Create\"\n @logs.table = \"Full Time Employee\"\n @logs.who = current_user.name\n @logs.save\n format.html { redirect_to @part_time_employee, notice: 'Full time employee was successfully created.' }\n format.json { render :show, status: :created, location: @part_time_employee }\n end\n end\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n\n #format.html { render :new }\n format.json { render json: @part_time_employee.errors, status: :unprocessable_entity }\n end\n end\n\n\n end", "def create\n byebug\n @employee = Employee.new(employee_params)\n\n params[:skills][:skill_id].each do |skill|\n byebug\n if !skill.empty?\n @employee.empskill.build(:skill_id => skill)\n end\n end\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, :format => @user }\n format.json { render :show, status: :created, location: @employee, :format => @user }\n else\n flash[:notice] = \"Mandatory fields are empty\"\n format.html { render :employees }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(params[:employee])\n @employee.company_id=current_user.company_id\n respond_to do |format|\n if @employee.save_with_user(params) \n flash[:notice] = \"#{t(:text_new_user)} \" \"#{t(:flash_was_successful)} \" \"#{t(:text_created)}\"\n format.html { redirect_to lawfirm_admins_url}\n format.xml { render :xml => @lawfirm_admin, :status => :created, :location => @lawfirm_admin }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lawfirm_admin.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.find(params[:employee_id])\n\n # For URL like /employees/1/leave_records\n # Populate an leave_records associate with employee 1 with form data\n # employee will be associated with the leave_records\n @leave_record = @employee.leave_records.build(params.require(:leave_record).permit(:description, :date))\n if @leave_record.save\n # Save the leave_record successfully\n redirect_to employee_leave_record_url(@employee, @leave_record)\n else\n render :action => \"new\"\n end\n end", "def \n # Adds the passed employee to the company employee list\n def hire_employee(employee)\n self.employees\n @employees\n end", "def add\n\t\t$employee_info[get_employee_id] = {first_name: get_employee_first_name, last_name: get_employee_last_name, salary: get_employee_salary, tax_rate: get_employee_tax_rate}\n\t\tputs \"\"\n\t\tputs \"\"\n\t\tputs \"Employee successfully added!\"\n\tend", "def create\n @employee = Employee.new(params[:employee])\n\n respond_to do |format|\n if @employee.save\n Cutofftotalsalary.create(cutoff_id: Cutoff.last.id, employee_name: @employee.name, sss: @employee.sss, philhealth: @employee.philhealth, pagibig: @employee.pagibig, withholding_tax: @employee.withholding_tax)\n ThirteenthMonthPay.create(thirteenth_month_id: Date.today.strftime(\"%Y\").to_i, employee_name: @employee.name)\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render json: @employee, 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 end", "def create\n @employee = current_employee\n @event = @employee.events.new(event_params)\n\n respond_to do |format|\n if @event.save\n if @employee.role.name == \"HR\"\n EventMailer.send_event_email_to_all_employees(@event).deliver_later\n elsif @employee.role.name == \"Manager\"\n EventMailer.send_event_email_to_team(@event, @employee).deliver_later\n end\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def fire_employee(employee)\n\n end", "def create_employee_by_email( email )\n user = User.create :email => email, :password => 'willy1234', \n :password_confirmation => 'willy1234'\n\n if not user.valid? \n return nil\n else\n JobAttachment.create(:office_id => self.id, :user_id => user.id)\n return user \n end\n\n\n end", "def create\n @employee = Employee.new(employee_params)\n @employee.user_created_id = current_user.id\n @employee.usuario_externo\n @employee.usuario = params[:employee][:usuario]\n @employee.previous_profile_security = params[:employee][:security_profiles_id]\n respond_to do |format|\n if @employee.save\n format.html { redirect_to employees_path, notice: I18n.t('.employees.controller.create') }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_leave(new_leave, emp)\n emp.each do |e|\n EmployeeLeave.create(employee_id: e.id, employee_leave_type_id: new_leave.id, leave_count: new_leave.max_leave_count)\n end\n end", "def assign_to_issue(issue_name, user_name)\n\tissue = @client.Issue.find(issue_name)\n\tissue.save({\"fields\"=>{\"assignee\"=>{\"name\"=>user_name}}})\n\t# issue.save({\"fields\"=>{\"assignee\"=>{\"emailAddress\"=>user_name}}})\nend", "def create\n @employee = Employee.new(employee_params)\n @employee.id = current_user.id\n # pass the current_user id to the employee to keep the records tight\n edit\n \n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_att(att)\n if att.save\n emp_leave = EmployeeLeave.edit_att(att)\n unless emp_leave.nil?\n if att.is_half_day\n leave_taken = emp_leave.leave_taken.to_f + (0.5)\n emp_leave.update(leave_taken: leave_taken)\n else\n leave_taken = emp_leave.leave_taken.to_f + (1)\n emp_leave.update(leave_taken: leave_taken)\n end\n end\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 authorize! :manage, Employee\n if ['Teacher', 'Manager'].include?(employee_params['responsibility'])\n @employee = (eval \"#{employee_params['responsibility']}.new(employee_attrs)\")\n else\n @employee = Employee.new(employee_attrs)\n end\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to Employee.last, notice: t('action.create.succeed', entity: Employee.model_name.human) }\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 end", "def allocate_to_employee\n @inventory_release = InventoryRelease.find params[:id]\n authorize! :update, @inventory_release\n\n\n if @inventory_release.allocate_to_employee(params[:employee_id], params[:count])\n head :no_content\n else\n head :unprocessable_entity\n end\n\n # head :no_content # everything went well!\n end", "def create\n @employee = Employee.new(employee_params)\n @employee.user = current_user\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee 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 end", "def after_create(&block)\n DSL.new(@employee, :after_create, &block)\n end", "def set_employee_record\n @employee_record = EmployeeRecord.find(params[:id])\n end", "def create_broker_er_in_open_enrollment\n broker_util BROKER_IN_OE do |broker_util|\n EmployeeUtil.roster_example_no = EmployerUtil.details_example_no = 0\n write_json broker_util.create_broker_er_in_open_enrollment, broker_util\n end\n end", "def create\n @user = User.new(employee_params)\n authorize @user\n\n respond_to do |format|\n if @user.save\n @user.employee!\n format.html { redirect_to branch_office_employees_path, 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", "def create_employee(body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v1/me/employees'\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 create\n @employee =\n Employee.new(employee_params.merge({ manager_id: params[:manager_id] }))\n\n if @employee.save\n @employee.active!\n render json: @employee, status: :created\n else\n render json: @employee.errors, status: :unprocessable_entity\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to employee_edit_path(@employee), notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_staff(edit_employee)\n employee = Employee.find(edit_employee.id)\n employee.attributes = edit_employee.attributes\n employee.save!\n end", "def set_organization_id_on_employee(employee = resource)\n employee.organization_id ||= current_organization.id\n end", "def create\n\n @company = Company.find(1)\n @employee = Employee.new(employee_params)\n @categorias =Categorium.all \n @locations =Location.all\n @divisions =Division.all \n @ocupacions = Ocupacion.all \n @ccostos = Ccosto.all\n @employee[:company_id]=1\n @afps = Afp.all\n\n @dptos = Dpto.all \n @provins = Provin.all \n @distritos = Distrito.all \n\n\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n if current_user.role == \"Center\"\n \n @employee.update!(location_id: current_user.location_id)\n end\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = current_user.employees.new(employee_params)\n respond_to do |format|\n if @employee.save\n if params[:show_level].to_i == 0\n @employee.level_id = nil\n @employee.group_ids = nil\n end\n (@employee.group_ids = params[:group][:group_ids] if params[:group]) if params[:show_level].to_i != 0\n Tools.write2log(current_user.id, 'Добавление', 'Сотрудники', 0, employee_params.to_s)\n format.html { redirect_to employees_path, notice: 'Сотрудник успешно добавлен.' }\n format.json { render action: 'show', status: :created, location: @employee }\n else\n Tools.write2log(current_user.id, 'Добавление', 'Сотрудники', 1, employee_params.to_s)\n format.html { render action: 'new' }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(employee_params)\n upload\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n else\n @errors=@employee.errors\n format.html { render action: 'new'}\n end\n end\n end", "def set_employee\n if params[:id] != nil\n @employee = Employee.find(params[:id])\n end\n end", "def create\n @employee = params[:employee]\n @emp_type = \"user\" \n puts \"********** EMPLOYEE: #{@employee} ***********\"\n puts \"********** EMPLOYEE ID: #{@employee[\"empid\"]} ***********\"\n if exists(@employee[\"empid\"])\n conn = OCI8.new('sanjana', 'Srvrtvk83!', 'oracle.cise.ufl.edu/orcl')\n conn.exec(\"update EMPLOYEE set first_name='#{@employee[\"first_name\"]}',\n last_name='#{@employee[\"last_name\"]}', user_name='#{@employee[\"user_name\"]}',\n emp_password='#{@employee[\"emp_password\"]}',contact='#{@employee[\"contact\"]}',\n email='#{@employee[\"email\"]}',emp_type='user' WHERE EMPLOYEE.empid='#{@employee[\"empid\"]}'\")\n conn.commit\n #conn.autocommit = true\n puts \"*********** CONN ***********\"\n puts conn\n puts \"*********** END CONN ***********\"\n conn.logoff\n puts \"*********** logoff CONN ***********\"\n redirect_to fares_path\n else\n render :js => \"alert('Are you sure you are a USER yet?')\"\n redirect_to employees_path\n end\n end", "def create_employee(body, opts = {})\n data, _status_code, _headers = create_employee_with_http_info(body, opts)\n return data\n end", "def create\n # @employee = Employee.find(params[:accident_record][:employee_id])\n @accident_record = AccidentRecord.new(accident_record_params)\n respond_to do |format|\n if @accident_record.save\n # len = params['accident_record'].length - 2\n # for i in 2..len\n # AccidentRecord.create(employee_id: params['accident_record']['employee_id'], avatar: params['accident_record'][i.to_s]['avatar'])\n # end\n # @accident_records = @employee.accident_records\n flash[:notice] = 'Photo Added successfully created'\n # @employee = AccidentRecord.find(id: employee_id)\n # @employee1 = Employee.find_by_employee_id(@employee)\n format.html { redirect_to @accident_record, notice: 'Accident record was successfully created.' }\n format.json { render :show, status: :created, location: @accident_record }\n else\n format.html { render :new }\n format.json { render json: @accident_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(employee_params)\n if @employee.save\n flash[:success] = \"Employee was successfully created.\"\n redirect_to employees_url\n else\n flash[:error] = @employee.errors.full_messages.join(\" and \")\n redirect_to new_employee_url(@employee)\n end\n end", "def set_employee\n @employee = User.find(params[:id])\n end", "def set_employee\n @employee = User.find(params[:id])\n end", "def create\n @employee_event = EmployeeEvent.new(employee_event_params)\n\n respond_to do |format|\n if @employee_event.save\n format.html { redirect_to :back, notice: 'Employee was successfully added.' }\n else\n format.html { render :new }\n format.json { render json: @employee_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee.password = Devise.friendly_token\n @employee.build_option if @employee.option.nil?\n @employee.option.attributes = option_params[:option_attributes]\n\n respond_to do |format|\n if @employee.save\n NewEmployeeJob.new.async.perform(@employee.id)\n format.html { redirect_to employee_path(@employee), notice: 'Employee was successfully created.' }\n else\n flash[:errors] = @employee.errors.full_messages\n format.all { render \"new\" }\n end\n end\n end", "def set_employee\n @employee = current_user.employees.find(params[:id])\n end", "def set_employee\n @employee = current_user.employees.find(params[:id])\n end", "def create\n @employee = Employee.new(employee_params)\n\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_owner_with_service\n\t\tlogger.info(\"creating owner>>>>>>>>>>>>>>>>>>>>>>>\")\n\t\tif(property(:use_mobile_tribe))\n\t\t\tempId = Employee.find_by_company_id(self.id)\n\t\t\tuser = User.find_by_id(empId.user_id)\n\t\t\tmobile_tribe = Services::MobileTribe::Connector.new\n\t\t\tbegin\n\t\t\t\tfields = {\n\t\t\t\t\t\"companyId\" => htmlsafe(empId.company_id.to_s),\n\t\t\t\t \"userId\" => htmlsafe(empId.user_id.to_s),\n\t\t\t\t \"employeeId\" => htmlsafe(empId.id.to_s),\n\t\t\t\t \"firstName\" => htmlsafe(user.firstname.to_s),\n\t\t\t\t \"lastName\" => htmlsafe(user.lastname.to_s),\n\t\t\t\t \"status\" => htmlsafe(\"active\"),\n\t\t\t\t \"phone\" => htmlsafe(user.phone.to_s),\n\t\t\t\t \"officePhone\" => htmlsafe(empId.phone.to_s),\n\t\t\t\t \"jobTitle\" => htmlsafe(empId.job_title.to_s),\n\t\t\t\t \"companyEmail\" => htmlsafe(empId.company_email.to_s)\n\t\t\t\t}\n\t\t\t\tif empId.department_id.blank?\n\t\t\t\t\tfields[\"departmentId\"] = \"\"\n\t\t\t\telse\n\t\t\t\t\tfields[\"departmentId\"] = htmlsafe(\"-\"+empId.department_id.to_s)\n\t\t\t\tend\n\t\t\t\t#\"departmentId\" => htmlsafe(\"-\"+empId.department_id.to_s)}\n\t\t\t\tmobile_tribe.create_employee(fields)\n\t\t\t\tempId.update_attribute(\"is_mobiletribe_connect\", \"1\")\n\t\t\trescue Services::MobileTribe::Errors::MobileTribeError => e\n\t\t\t\tself.errors.add_to_base( \"#{I18n.t('models.company.mobile_tribe_error')} #{e.to_s}\" )\n\t\t\t\t#self.owner_create_fail = true\n\t\t\t\t#Employee.find_by_company_id(self.id).delete\n\t\t\t\tself.delete_company_with_service\n\t\t\t\tCompany.find_by_id(self.id).delete\n\t\t\t\tself.send(rollback_changes)\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\tend", "def create_employee(xero_tenant_id, employee, opts = {})\n data, _status_code, _headers = create_employee_with_http_info(xero_tenant_id, employee, opts)\n data\n end", "def make_company_employees # need your company (example.com) to already exist in Company table\n users = User.all \n companies=Company.all\n users.each do |user|\n domain = user.email.split(\"@\").last\n company_id = companies.find_by(domain: domain).id\n CompanyEmployee.create!(company_id:(companies.find_by(domain: domain).id), user_id: user.id)\n end\nend", "def attach; end", "def create\n @employer = Employer.new(user_params)\n @employer.company = @company\n\n respond_to do |format|\n if @employer.save\n format.html { redirect_to admin_company_employers_url(@company), 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 set_employee_room\n @employee_room = EmployeeRoom.find(params[:id])\n end", "def create\n @employer = Employer.new(employer_params)\n @laws = Law.all\n if @employer.save\n create_files(params[:files])\n employer_section(params[:laws], params[:acts], params[:sections])\n redirect_to edit_raid_path(@employer.raid_id), notice: EMPLOYER_CREATE\n else\n render :new\n end\n end", "def hire_employee(employee_name, employee_salary)\n Employee.new(employee_name, employee_salary, self)\n end", "def create\n @registry_employee = Registry::Employee.new(registry_employee_params)\n \n respond_to do |format|\n if @registry_employee.save\n format.html { redirect_to @registry_employee, notice: 'Empleado fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @registry_employee }\n else\n format.html { render :new }\n format.json { render json: @registry_employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_employee\n @employee = Employee.employee_by_id(params[:id])\n end", "def create\n @employee = User.create(employee_params)\n redirect_to employees_path\n # respond_to do |format|\n # if @employee.save\n\n # format.html { redirect_to @employee, notice: 'User was successfully created.' }\n # format.json { render :show, status: :created, location: @employee }\n # else\n # format.html { render :new }\n # format.json { render json: @employee.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @employees_role = EmployeesRole.create(employees_role_params)\n redirect_to employees_roles_path\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @employee = Employee.new(employee_params)\n\n respond_to do |format|\n if @employee.save\n format.html { redirect_to @employee, notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def assignee\n records do |instance|\n instance['assignee'] = users.where('_id': instance['assignee_id']).last\n end\n end", "def set_employee_event\n @employee_event = EmployeeEvent.find(params[:id])\n end", "def set_employee\n @employee = Employee.find_by_id(params[:id])\n end", "def set_employee\n @employee = Employee.find(params[:id])\n end", "def set_employee\n @employee = Employee.find(params[:id])\n end", "def set_employee\n @employee = Employee.find(params[:id])\n end", "def set_employee\n @employee = Employee.find(params[:id])\n end", "def set_employee\n @employee = Employee.find(params[:id])\n end", "def set_employee\n @employee = Employee.find(params[:id])\n end", "def set_employee\n @employee = Employee.find(params[:id])\n end", "def set_employee\n @employee = Employee.find(params[:id])\n end", "def set_employee\n @employee = Employee.find(params[:id])\n end", "def set_employee\n @employee = Employee.find(params[:id])\n end", "def set_employee\n @employee = Employee.find(params[:id])\n end", "def set_employee\n @employee = Employee.find(params[:id])\n end", "def set_employee\n @employee = Employee.find(params[:id])\n end", "def set_employee\n @employee = Employee.find(params[:id])\n end", "def set_employee\n @employee = Employee.find(params[:id])\n end", "def set_employee\n @employee = Employee.find(params[:id])\n end" ]
[ "0.63885224", "0.6322584", "0.6271402", "0.6156681", "0.61415297", "0.6074461", "0.6053985", "0.6041661", "0.60060596", "0.5958005", "0.59204525", "0.58645093", "0.58641046", "0.58548695", "0.5819343", "0.58140767", "0.57966465", "0.57876986", "0.5750316", "0.570618", "0.5704943", "0.56964236", "0.56772166", "0.56684893", "0.5651527", "0.56387025", "0.56258625", "0.56055564", "0.5556847", "0.55438036", "0.5530849", "0.5526743", "0.5525078", "0.55247897", "0.55134064", "0.5495259", "0.54905593", "0.54903734", "0.5477776", "0.54741", "0.5462526", "0.5455426", "0.54424393", "0.54413867", "0.54359967", "0.5435036", "0.5408129", "0.5377378", "0.5350249", "0.53476524", "0.53455985", "0.53328425", "0.5324016", "0.53189963", "0.5286148", "0.5285701", "0.5281923", "0.52674747", "0.52674747", "0.5259558", "0.5258595", "0.5256122", "0.5253822", "0.52532655", "0.524817", "0.5246807", "0.52460086", "0.52415866", "0.5238809", "0.5238355", "0.52375305", "0.5230503", "0.52301455", "0.5229971", "0.5228284", "0.5223677", "0.52219975", "0.52219975", "0.52219975", "0.52219975", "0.52219975", "0.52219975", "0.521733", "0.52139235", "0.5213433", "0.52124596", "0.52124596", "0.52124596", "0.52124596", "0.52124596", "0.52124596", "0.52124596", "0.52124596", "0.52124596", "0.52124596", "0.52124596", "0.52124596", "0.52124596", "0.52124596", "0.52124596", "0.52124596" ]
0.0
-1
This will remove employee from repair order.
def repair_order_employees_delete @repair_order_employee = current_business_user.employee_users_repair_orders.find(params[:id]) @repair_order_employee.destroy if @repair_order_employee render json: { repair_order_employees: @repair_order_employee.as_json }, status: :ok else render json: { errors: @repair_order_employee.errors.full_messages }, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_staff(employee)\n employee = Employee.find(employee.id)\n employee.delete!\n end", "def fire_employee(employee)\n @employees.reject! {|employ| employ.employee_id == employee.employee_id}\n\n end", "def remove_employee\n @leave_group = LeaveGroup.find(params[:id], :include => :leave_group_employees)\n employee = @leave_group.leave_group_employees.detect{|l| l.employee_id == params[:employee_id].to_i}\n result = (employee.present? ? (employee.destroy ? 1 : 0) : 0)\n render :text => result\n end", "def destroy\n @employee_to_remove = Employee.find(params[:id])\n \n if @employee_to_remove.destroy\n render json: {sucess: 'Deleted successfully'}\n else\n render json: @employee_to_remove.errors, status: :unprocessable_entity\n end\n end", "def clear_employee_requirement_compliance\n Employee.set({},:requirement_compliance=>nil, :_type=>\"Employee\")\n end", "def delete(employee)\n return nil if employee.nil?\n \n self.destroy if self.is_confirmed == false \n end", "def remove!\n if order_item.destroy\n order_maker.handle_coupon!\n order_maker.destroy_empty_order!\n return_with(:success)\n else\n return_with(:error, error: order_maker.order_errors)\n end\n end", "def delete(employee)\n return nil if employee.nil?\n self.destroy if self.is_confirmed == false \n end", "def destroy\n @employee_user.destroy\n end", "def remove\n\t\tputs \"Enter Employee ID to be removed: \"\n\t\temployee_id = get_user_input\n\t\tif employee_id.to_i == 0\n\t\t\tputs \"Please enter an integer for the ID.\"\n\t\t\tremove\n\t\telsif !$employee_info[employee_id.to_i]\n\t\t\tputs \"Employee ID not found.\"\n\t\t\tremove\n\t\telse\n\t\t\t$employee_info.delete(employee_id.to_i)\n\t\t\tputs \"\"\n\t\t\tputs \"Employee successfully removed from the database!\"\n\t\tend \n\tend", "def remove\n @order.ig_remove_order\n redirect_to admin_orders_path\n end", "def destroy\n @employee.occupational_histories.each do |oh|\n oh.destroy\n end\n @employee.absenteeisms.each do |a|\n a.destroy\n end\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 = Employee.scopied.find(params[:id])\n @employee.kill\n\n respond_to do |format|\n format.html { redirect_to :action => 'index' }\n format.xml { head :ok }\n end\n end", "def destroy\n \n a = PayrollDetail.find_by(employee_id: @employee.id)\n if a \n else \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 \n end \n end", "def destroy\n @worker_salary = WorkerSalary.find(params[:id])\n item = @worker_salary.worker_item\n @worker_salary.destroy\n \n respond_to do |format|\n format.html { redirect_to worker_item_path(item, worker: item.worker),\n notice: (crud_notice('destroyed', @worker_salary) + \"#{undo_link(@worker_salary)}\").html_safe }\n format.json { head :no_content }\n end\n end", "def destroy\n @bonus_employer.destroy\n @bonus_employer = BonusEmployer.new\n @bonus_employers = BonusEmployer.all\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 recycle!(affected_task_occurrences='AllOccurrences')\n resp = (Viewpoint::EWS::EWS.instance).ews.delete_item([@item_id], 'MoveToDeletedItems', nil, affected_task_occurrences)\n self.clear_object!\n resp.status == 'Success'\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 unless current_user.has_perm?(\"repairs_repairs_can_destroy\")\n permission_deny\n else\n @repair = Repair.find(params[:id])\n @repair.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_repairs_url) }\n format.xml { head :ok }\n end\n end\n end", "def cancel!(e, quantity)\n [e, e.matchee].each do |ex|\n ex.quantity -= quantity\n quantity.times {ex.registrations.pop}\n ex.save\n end\n end", "def destroy\n @handbook_place_employee = HandbookPlaceEmployee.find(params[:id])\n @handbook_place_employee.destroy\n\n respond_to do |format|\n format.html { redirect_to handbook_place_employees_url }\n format.json { head :no_content }\n end\n end", "def remove_prioritized_issue\n log(:remove_issue) do\n prioritized_issue.destroy\n end\n\n prioritized_issue\n end", "def remove_ticket(ticket)\n @lockers.unassign(ticket) \n @reservations.delete(ticket.confirmation_number)\n end", "def remove\n transaction do\n destroy!\n order.remove_delivery_service_if_invalid\n self\n end\n end", "def remove_from_old_order\n coupon.orders&.first&.update(\n coupon_discount: 0,\n coupon_applied_at: nil,\n coupon_id: nil\n )\n end", "def destroy\n @repair_order.destroy\n respond_to do |format|\n format.html { redirect_to repair_orders_url, notice: 'Repair order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fleet = Fleet.find params[:fleet_id]\n @vehicle = @fleet.vehicles.find params[:vehicle_id]\n @vehicle_repair = @vehicle.vehicle_repairs.find(params[:id])\n @vehicle_repair.destroy\n\n respond_to do |format|\n format.html { redirect_to(fleet_vehicle_vehicle_repairs_path(@fleet, @vehicle), :notice => 'Vehicle repair was successfully created.') }\n format.xml { head :ok }\n end\n end", "def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.repairs.each do |repair|\n repair.invoice_id = nil\n repair.save!\n end\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\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 @employee_remunerative_concept = @employee.employee_remunerative_concept.find(params[:id])\n @employee_remunerative_concept.destroy\n\n respond_to do |format|\n format.html { redirect_to(employee_remunerative_concepts_url) }\n format.xml { head :ok }\n end\n end", "def remove_accommodation\n @booking = current_booking\n @booking.update({:accommodation_id=>nil})\n @booking.update(:price=>total_price)\n end", "def destroy\n tempfio = @employee.fio\n chartsalary = tempfio + \" salary to pay\"\n @employee.destroy\n @chart_to_del = Chart.where(\"content = ?\",chartsalary)\n idstart = @chart_to_del.first.id\n idfinish = idstart + 5\n @charts_to_del = Chart.where(\"id >= ? and id <= ?\",idstart,idfinish)\n @charts_to_del.each do |d|\n d.destroy\n end\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 remove_email (e)\n emails.delete_at e\n end", "def remove (exp)\n\n exp, _fei = fetch(exp) if exp.is_a?(FlowExpressionId)\n\n return unless exp\n\n #ldebug { \"remove() fe #{exp.fei.to_debug_s}\" }\n\n onotify(:remove, exp.fei)\n\n remove_environment(exp.environment_id) if exp.owns_its_environment?\n end", "def destroy\n @employee.destroy\n flash[:success] = 'Eliminado correctamente'\n redirect_to employees_url\n end", "def destroy\n @transferred_event_order.destroy\n end", "def remove_exercise(exercise_name)\n\n index = search(exercise_name)\n\n #In the case of the named exercise not being in the array\n if index == -1\n return -1\n end\n\n @exercises.delete_at(index)\n @repititions.delete_at(index)\n @break_time.delete_at(index)\n\n return 0\n end", "def remove_item(item)\n order_item = self.order_items.where(item: item).order('price asc').first\n if order_item.is_a? OrderItem\n order_item.remove 1\n recalculate!\n end\n end", "def destroy\n @hour_bank_employee = HourBankEmployee.find(params[:id])\n @hour_bank_employee.destroy\n respond_to do |format|\n if @hour_bank_employee.update_attributes(params[:hour_bank_employee])\n format.html { redirect_to employees_path, notice: 'Hour bank employee was successfully updated.' }\n format.json { head :no_content }\n else\n\trender action:\"edit\"\n end\n end\n end", "def remove_from(order)\n Spree::Deprecation.warn(\"#{self.class.name.inspect} does not define #remove_from. The default behavior may be incorrect and will be removed in a future version of Solidus.\", caller)\n [order, *order.line_items, *order.shipments].each do |item|\n item.adjustments.each do |adjustment|\n if adjustment.source == self\n item.adjustments.destroy(adjustment)\n end\n end\n end\n end", "def destroy\n @equipo = set_equipo,\n @equipo.destroy\n end", "def destroy\n @power_order.destroy\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_efforts\n efforts.destroy_all\n rescue ActiveRecord::ActiveRecordError => exception\n errors << Interactors::Errors.active_record_error(exception)\n end", "def unassigne_job(role,project)\n assignements.create(role_id:role,project_id:project).destroy\n end", "def destroy_by_service\n Dcm4chee.application_entity_service.remove_ae(title)\n end", "def destroy\n @employee_events = EmployeeEvent.with_deleted.find(params[:id])\n if params[:type]=='normal'\n @employee_event.delete\n elsif params[:type]=='restore'\n @employee_event.restore\n @employee_event.update(deleted_at: nil)\n end\n\n @employee_event.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Host was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @employee = Employee.find(params[:id])\n @employee.destroy\n respond_with(@employee)\n end", "def destroy\n @employee_productivity.destroy\n respond_to do |format|\n format.html { redirect_to employee_productivities_url, notice: 'Employee productivity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n ignore_columns = [\"id\", \"created_at\", \"updated_at\"]\n # Find all assignments associated with this element\n\t\tlist = Relationship.where({ @type.to_s => @id })\n \n # For each assignment\n\t\tlist.each do |assignment|\n # Remove this element from the assigment\n assignment[@type] = nil\n \n # Count how many elements are left\n count = 0\n Relationship.column_names.each do |column|\n if assignment[column] != nil and not ignore_columns.include?(column)\n count += 1\n end\n end\n \n # If only one element is left, destroy the assignment\n if count <= 1\n assignment.destroy\n # Otherwise, save\n else\n assignment.save\n end\n end\n \n # Destroy the desired element\n @class.destroy(@id)\n end", "def remove_entry(p)\n\t\t@person.delete(p)\n\tend", "def destroy\n # In order to guard Player dependency on Equipo and avoid the system to crash\n # Execute player.seguro for all players associated to this team first\n #\n safeTeam = Equipo.find_by(name: \"99 - NO DETERMINADO\")\n @equipo.players.each do |plyr|\n plyr.seguro safeTeam.id\n end\n\n @equipo.destroy\n flash[:success] = 'Se eliminó correctamente el equipo.'\n redirect_to equipos_url\n end", "def destroy\n @other_salary_component.destroy\n @other_salary_components = OtherSalaryComponent.all\n end", "def destroy\n debug('Removing order directive')\n cmd = [command(:pcs), 'constraint', 'remove', @resource[:name]]\n self.class.run_command_in_cib(cmd, @resource[:cib])\n @property_hash.clear\n end", "def reply_to_engine (workitem)\n\n super(workitem.as_owfe_workitem)\n #\n # replies to the workflow engine\n\n workitem.destroy\n #\n # removes the workitem from the database\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 update_work_order_on_destroy\n _ok = true\n _woi = WorkOrderItem.find_by_delivery_note_item_id(id)\n if !_woi.nil?\n _woi.destroy\n # Update totals\n update_work_order_totals(work_order_id) if !work_order.blank?\n end\n _ok\n end", "def remove_by_id(equipo_id, user_id)\n return self.class.delete(\n #na rota passo o equipo id\n \"/equipos/#{equipo_id}\",\n headers: {\n #passo o user id para o header para ter a altorização para consultar\n \"user_id\": user_id,\n },\n )\n end", "def destroy\n @employee.update_attribute(:removal_date, Date.today)\n respond_to do |format|\n format.html { redirect_to employees_url,\n notice: \"#{@employee.first_name} #{@employee.last_name} was removed.\"\n }\n format.json { head :no_content }\n end\n end", "def destroy\n @employee.destroy\n\n respond_to do |format|\n format.html { redirect_to employees_url }\n end\n end", "def delete\n LineItem.delete_for_order(order_id)\n CreditCardTransaction.remove_references_to_order(order_id)\n super\n end", "def removeline(step, order)\n\t\t#active_steps.find_by(line_id: line.id).destroy\n\t\tactive_steps.find_by(id: step.id).destroy\n\t\t\n\t\t#active_relationships.find_by(followed_id: other_user.id).destroy\n\t\t#steps.find_by(installation_id: self, line_id: line.id).destroy\n\tend", "def remove!(donation_or_purchase)\n log = {}\n donation_or_purchase.line_items.each do |line_item|\n inventory_item = InventoryItem.find_by(storage_location: id, item_id: line_item.item_id)\n if (inventory_item.quantity - line_item.quantity) <= 0\n inventory_item.destroy\n else\n inventory_item.update(quantity: inventory_item.quantity - line_item.quantity)\n end\n log[line_item.item_id] = \"-#{line_item.quantity}\"\n end\n log\n end", "def remove!; end", "def delete_sales_entry_from_sales_order\n @sales_order = SalesOrder.find_by_id params[:sales_order_id]\n @sales_entry = @sales_order.active_sales_entries.where(:id => params[:object_to_destroy_id]).first\n \n @sales_order.delete_sales_entry( @sales_entry ) \n end", "def remove_klarna_fee!\n if remove_klarna?\n adjustments.klarna_invoice_cost.destroy_all\n update!\n end\n end", "def destroy\n address = Address.find(params[:id])\n status = address.delivery_address # stores whether it is delivery address or not\n address.destroy\n current_user_address = @current_user.addresses\n # if the address deleted is the current delivery address and the user should have atleast one address to mark the first address as delivery address.\n if (status && !(current_user_address.empty?))\n addrs = Address.first\n addrs.delivery_address = true\n addrs.save!\n end\n redirect_to cart_items_path\n end", "def destroy\n @routing_sheet = RoutingSheet.find(params[:id])\n \n respond_to do |format|\n ##Solo se pueden eliminar las hojas de rutas cuyo estado en \"En Proceso\" id=1\n if (@routing_sheet.routing_sheet_state_id == 1 )\n begin\n RoutingSheet.transaction do\n ##Primero elimino los detalles de la hoja de ruta actualizada de la base de datos\n @routing_sheets_details=RoutingSheetDetail.where(routing_sheet_id: @routing_sheet.id)\n @routing_sheets_details.each do |detail|\n ##Actaulizo el estado del producto a No enviado porque se elimina el detalle que hace referencia a el\n @product=Product.where(id: detail.product_id).first\n @old_product_state_id = ProductState.no_enviado ## id 2= \"No enviado\" ProductState.where(\"state_name='No enviado'\").first.id\n @product.update_attribute(:product_state_id, @old_product_state_id)\n #Elimino el detalle de la base de datos\n detail.destroy\n end\n #Se elimina la hoja de ruta de la base de datos\n @routing_sheet.destroy\n \n format.html { redirect_to routing_sheets_url, notice: 'La hoja de ruta se ha eliminado' }\n format.json { head :no_content }\n end\n rescue\n CustomLogger.error(\"No se pudo eliminar la hoja de ruta. Puede estar siendo utilizada.: #{@routing_sheet.inspect}, usuario: #{current_user.username}, #{Time.now}\")\n format.html { redirect_to routing_sheets_url, notice: 'Error al intentar eliminar esta hoja de ruta. Puede estar siendo utilizada.' }\n format.json { head :no_content }\n end\n else\n CustomLogger.error(\"No se puede eliminar la hoja de ruta. Esta siendo utilizada.: #{@routing_sheet.inspect}, usuario: #{current_user.username}, #{Time.now}\")\n format.html { redirect_to routing_sheets_url, notice: 'No se puede eliminar porque ya ha sido procesada.' }\n format.json { head :no_content }\n end\n \n end\n end", "def destroy\n @advance = Advance.find(params[:id])\n user = User.find(params[:employee_page]) if params[:employee_page]\n employee = user.employee if user\n @advance.destroy \n\n respond_to do |format|\n format.html { \n unless employee.nil?\n redirect_to employee_path(employee, notice: 'Advance was successfully deleted.')\n else\n redirect_to advances_url, notice: 'Advance was successfully deleted.'\n end\n }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_id = @employee_detail.user_id\n @employee_detail.destroy\n User.destroy(@user_id)\n respond_to do |format|\n format.html { redirect_to employee_details_url, notice: 'Employee detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @work_order = WorkOrder.find(params[:id])\n @work_order.destroy\n \n redirect_to work_orders_url\n end", "def destroy\n @gstr_advance_receipts = GstrAdvanceReceipt.find_by_id_and_company_id(params[:id], @company.id)\n @gstr_advance_receipts.delete_gstr_one_entry \n @gstr_advance_receipts.delete\n respond_to do |format|\n @gstr_advance_receipts.register_delete_action(request.remote_ip, @current_user, 'deleted')\n format.html { redirect_to(gstr_advance_receipts_url, :notice =>\"Gstr Advance Receipt has been succesfully deleted\") }\n format.xml {head :ok}\n \n end\n end", "def delete (fei)\n\n e = find(fei)\n e.destroy if e\n end", "def destroy\n if((@employer.email==\"empl.direwolf.oyer@gmail.com\"))\n @custom_error = \"Action Not Allowed ! This is a SYSTEM DEFINED Employer. Please create sample Employer and perform this action\"\n render \"layouts/error\"\n return\n end\n if((cookies[:adminID]==\"\")||(cookies[:adminID].is_a?NilClass))\n @custom_error = \"Insufficient Rights.Please login as admin!\"\n render \"layouts/error\"\n return\n end\n Job.where(:employer_id => @employer.id).to_a.each do |job|\n Jobapplication.where(:job_id => job.id).to_a.each do |jobapp|\n Jobapplication.delete(jobapp.id)\n end\n Job.delete(job.id)\n end\n @employer.destroy\n respond_to do |format|\n format.html { redirect_to employers_url, notice: 'Employer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @delivery = Delivery.find(params[:id])\n order = Order.find(@delivery.order_id)\n order.order_items.each do |order_item|\n ordered_item = OrderedItem.find_by sale_item_id: order_item.sale_item_id\n a = SaleItem.find(order_item.sale_item_id)\n a.amount += order_item.quantity\n a.save\n User.find(SaleItem.find(order_item.sale_item_id).user_id).ordered_items.find(ordered_item.id).destroy\n ordered_item.destroy\n end\n @delivery.destroy\n respond_to do |format|\n format.html { redirect_to profile_url, notice: 'Order was successfully canceled.' }\n format.json { head :no_content }\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_along_with_units\n self.quantity = 0\n OrderInventoryAssembly.new(self).verify\n self.destroy\n end", "def destroy_along_with_units\n self.quantity = 0\n OrderInventoryAssembly.new(self).verify\n self.destroy\n end", "def destroy\n @purchase_requisition = PurchaseRequisition.find(params[:id])\n id = 0\n if @purchase_requisition.destroyable?\n\n destinatarios = []\n\n destinatarios << @purchase_requisition.creator_id if @purchase_requisition.creator\n destinatarios << @purchase_requisition.buyer_id if @purchase_requisition.buyer\n\n @purchase_requisition.requisition_entries.each do |re|\n destinatarios << re.responsible_id if re.responsible\n end\n\n mail = UserMailer.pr_delete_email( current_user,destinatarios ,@purchase_requisition )\n send_email(mail, destinatarios)\n\n @purchase_requisition.requisition_entries.each do |re|\n re.delete\n end\n id = @purchase_requisition.id\n @purchase_requisition.destroy\n else\n #@purchase_requisition.errors[:base] << \"This person is invalid because ...\"\n redirect_to(purchase_requisitions_url, :alert => 'Imposible eliminar SC debido a los estatus de las partidas.')\n return\n end\n\n respond_to do |format|\n format.html { redirect_to purchase_requisitions_url, :alert => \"SC # \" + id.to_s + \" eliminada.\".html_safe }\n format.json { head :no_content }\n end\n end", "def destroy\n if current_user.is_not_member?\n flash[:error] = \"You do not have permissions to access that feature.\"\n redirect_to root_path and return\n end\n \n @repair_hours_entry = RepairHoursEntry.find(params[:id])\n @repair_hours_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to repair_hours_entries_url }\n format.json { head :ok }\n end\n end", "def destroy\n @shift_schedule.destroy\n #@shift_schedules = ShiftSchedule.all\n joining_detail = JoiningDetail.find_by(employee_id: current_user.employee_id)\n shift_time = ShiftTime.where(cost_center_id: joining_detail.cost_center_id).pluck(:id)\n @shift_schedules = ShiftSchedule.where(shift_time_id: shift_time)\n end", "def remove_item\n\t\tset_sale\n\t\tpopulate_products\n\n\t\tline_item = Item.where(sale_id: params[:sale_id], product_id: params[:product_id]).first\n\t\tline_item.quantity -= 1\n\n\t\tif line_item.quantity == 0\n\t\t\tline_item.destroy\n\t\telse\n\t\t\tline_item.save\n\t\t\tupdate_line_item_totals(line_item)\n\t\tend\n\n\t\t# Llama método que devuelve cantidad al stock\n\t\treturn_item_to_stock(params[:product_id])\n\n\t\tupdate_totals\n\n\t\trespond_to do |format|\n\t\t\tformat.js { ajax_refresh }\n\t\tend\n\tend", "def destroy\n @employee_position_hist = EmployeePositionHist.find(params[:id])\n @employee_position_hist.destroy\n\n respond_to do |format|\n format.html { redirect_to employee_position_hists_url }\n format.xml { head :ok }\n end\n end", "def destroy(reassign_to = nil)\n if reassign_to && reassign_to.is_a?(Category) && reassign_to.project == self.project\n WorkPackage.update_all(\"category_id = #{reassign_to.id}\", \"category_id = #{id}\")\n end\n destroy_without_reassign\n end", "def purge!\n unless self.ordered?\n self.line_items.each do |line_item|\n remove_line_item(line_item) if line_item.invalid?\n end\n end\n end", "def clear_adjustments!\n adjustments.tax.each(&:destroy)\n price_adjustments.each(&:destroy)\n end", "def destroy\n @retailorder = Retailorder.find(params[:id])\n begin\n @retailorder.destroy \n rescue ActiveRecord::DeleteRestrictionError => e\n @retailorder.errors.add(:base, e)\n end \n respond_to do |format|\n\n if e.nil?\n\n format.html { redirect_to(\"/retailorderview\", :notice => 'retail order was successfully deleted.') }\n format.xml { head :ok }\n else \n format.html { render :action => \"edit\" }\n end\n\n\n end\n end", "def process!( deletable_meeting_list, use_disable = false )\n # Bail out in case of invalid parameter:\n return nil unless deletable_meeting_list.respond_to?( :each )\n\n # Delete each row individually, with validations:\n deletable_meeting_list.each do |meeting|\n if use_disable # -- Disable the meeting --\n meeting.is_cancelled = true\n sql_diff_text_log << \"\\r\\n-- Disabling useless Meeting #{ meeting.id }, code '#{ meeting.code }'\\r\\n\"\n if meeting.save\n sql_attributes = { is_cancelled: true }\n sql_diff_text_log << to_sql_update( meeting, false, sql_attributes, \"\\r\\n\" )\n @edited_rows_codes << \"#{meeting.code}/#{meeting.id}\"\n else\n sql_diff_text_log << \"-- UPDATE VALIDATION FAILURE in FinCalendarPhase3Cleaner: #{ ValidationErrorTools.recursive_error_for( meeting ) }\\r\\n\" if meeting.invalid?\n sql_diff_text_log << \"-- UPDATE FAILURE: #{ $! }\\r\\n\" if $!\n @error_rows_codes << \"#{meeting.code}/#{meeting.id}\"\n end\n # -- Destroy the meeting --\n else\n sql_diff_text_log << \"\\r\\n-- Destroying useless Meeting #{ meeting.id }, code '#{ meeting.code }'\\r\\n\"\n result_log = destroy_with_sql_capture( meeting )\n unless result_log.nil?\n sql_diff_text_log << result_log\n @destroyed_rows_codes << \"#{meeting.code}/#{meeting.id}\"\n else\n sql_diff_text_log << \"-- DELETE FAILURE: #{ $! }\\r\\n\" if $!\n @error_rows_codes << \"#{meeting.code}/#{meeting.id}\"\n end\n end\n end\n end", "def remove; end", "def remove; end", "def remove; end", "def remove; end", "def destroy\n @effort_log_line_item = EffortLogLineItem.find(params[:id])\n @effort_log_line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(effort_log_line_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bus= Bus.find(@repair.bus_id)\n @repair.destroy\n bus_update(@bus)\n\n respond_to do |format|\n format.html { redirect_to repairs_url, notice: 'Repair was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete!\n uniq.both_e.uniq.bulk_job { |e| e.delete! }\n uniq.bulk_job { |e| e.delete! }\n end", "def destroy\n @assignment.destroy\n redirect_to assignments_url, notice: \"Successfully removed #{@assignment.employee.proper_name} from #{@assignment.store.name}.\"\n end", "def destroy\n @employer_insurance.destroy\n @employer_insurance = EmployerInsurance.new\n @employer_insurances = EmployerInsurance.all\n\n \n end", "def remove_item(id:)\n order.items.destroy(id)\n end", "def destroy\n @employee_insentive.destroy\n respond_to do |format|\n format.html { redirect_to employee_insentives_url, notice: 'Employee insentive was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.6307913", "0.58369", "0.57848895", "0.5764783", "0.5715977", "0.5702808", "0.5700814", "0.56936324", "0.5478375", "0.54597366", "0.54225135", "0.53794736", "0.53688735", "0.53660476", "0.53537995", "0.53265333", "0.53108823", "0.5268773", "0.526638", "0.52505535", "0.52394", "0.52331555", "0.52282435", "0.5212641", "0.5200681", "0.51963675", "0.5191574", "0.5190787", "0.51824325", "0.5175366", "0.5173429", "0.5168711", "0.5165744", "0.51484", "0.51325864", "0.512218", "0.51218486", "0.51211077", "0.510993", "0.51029277", "0.51008624", "0.5097703", "0.50878", "0.50852674", "0.50749207", "0.50736165", "0.5044656", "0.50241786", "0.50165313", "0.5015737", "0.5014648", "0.5002478", "0.5002052", "0.5001952", "0.5001302", "0.5001042", "0.50002927", "0.49974963", "0.4996481", "0.49923956", "0.49888086", "0.49866992", "0.4985217", "0.4980202", "0.4979869", "0.4977953", "0.49729255", "0.49726307", "0.49661514", "0.4953513", "0.49531868", "0.49465474", "0.4944812", "0.49368244", "0.49336362", "0.49305794", "0.49296045", "0.49226594", "0.49226594", "0.49192294", "0.49178216", "0.491287", "0.49092048", "0.4908176", "0.49063554", "0.49038476", "0.49032626", "0.49027258", "0.4901563", "0.49014595", "0.49014595", "0.49014595", "0.49014595", "0.4899242", "0.4899175", "0.48967364", "0.48964122", "0.48944667", "0.48930785", "0.4890453" ]
0.66330475
0
Confirms if the user is dungeon user.
def is_dungeon_master_user game = Game.find_by id: params[:game_id] if game.nil? or !dungeon_master?(game.dungeon_master) redirect_to(root_url) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_dungeon_master_user\n\t game = Game.find_by id: params[:id]\n\t if game.nil? or !dungeon_master?(game.dungeon_master)\n\t \tredirect_to(root_url) \n\t end\n\t end", "def mine?\n user && user.username == Codeplane.username\n end", "def dorm \n dorm_selection == 'd' || dorm_selection == 's'\n end", "def correct_user\n\t\tunless current_user == @univers.user\n\t\t\tflash[:danger] = \"You have no power there\"\n\t\t\tredirect_to universes_path\n end\n end", "def is_admin?(user_id)\n\t\treturn admin == user_id\n\tend", "def correct_user\n @user ||= (@character ? @character.user : @clutch.user)\n redirect_to user_path(current_user), alert: \"That does not belong to you!\" unless is_current_user?(@user) || is_admin?\n end", "def check_kicked_user_from_guild\n return (@guild[:id] == @user[:guild_id] && @user[:id] != @guild[:owner_id]) ? 1 : nil\n end", "def is_admin?\n @level > LEVEL_PLAYER ? true : false\n end", "def normal_user?\n self.admin ==false\n end", "def is_npc(id)\n\t\t!id.start_with?('user')\n\tend", "def is_doctor?\n \treturn role === 1 \n end", "def doctor_or_admin_view\n if !((current_user.is_a? Doctor) || (current_user.is_a? Admin) || (current_user.is_a? AdminAssistant))\n flash[:error] = \"You are not authorized to view this page.\"\n redirect_to :root\n # Explictly tell the caller that this check failed\n return false\n else\n # Explictly tell the caller that this check was successful\n return true\n end\n end", "def eventunscrape?\n @user.is_admin?\n end", "def game_available_for? (user)\n user_state[user] == :invited\n end", "def mentor?\n !admin?\n end", "def correct_user\n @user = User.find(params[:id])\n\n if current_user?(@user) || current_user.admin?\n return true\n else\n flash[:danger] = \"You do not have permission to do that. wwjd?\"\n redirect_to(root_path)\n end\n end", "def correct_user(user)\n user == current_user\n end", "def is_admin?\n usertype == \"admin\" and id == 0\n end", "def correct_user?\n set_user\n unless current_user?(@user)\n redirect_to user_path(current_user)\n end\n end", "def child_or_classroom_assigned?\n current_user.has_child_or_classroom_assigned?\n end", "def user_is_admin\n unless current_user.admin?\n flash[:notice] = \"You may only view existing scenarios.\"\n redirect_to root_path\n end\n end", "def can_fight?\n @position && !dead?\n end", "def correct_user\n @user = User.find(params[:user_id])\n unless current_user?(@user) || current_user.admin?\n flash[:danger] = \"It is not possible to access other users diaries\"\n redirect_to(root_url) \n end \n \n end", "def set_dungeon\n @dungeon = Dungeon.find(params[:id])\n end", "def is_admin?\n if login == \"ankit\"\n return true\n else\n return false\n end\n end", "def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user) || current_user.admin?\n flash[:danger] = \"It is not possible to access other users diaries\"\n redirect_to(root_url) \n end \n \n end", "def is_admin(user_id)\n result = db_connection().execute('SELECT admin FROM users WHERE id=?', user_id)\n p result\n return (result[0] && result[0][\"admin\"].to_i == 1)\n end", "def admin_user?\n self.admin ==true\n end", "def kick?\n false\n end", "def is_admin\n user = UserAdmin.find_by_user_id(current_user.id)\n if user and user.level > 1\n return true || false\n end\n end", "def correct_user\n @user = User.find(params[:user_id])\n unless current_user?(@user) || current_user.admin?\n flash[:danger] = \"It is not possible to access other users diaries\"\n redirect_to(root_url) \n end \n \n end", "def flee(monster)\n if dice_roll < @agility\n puts \"----- Nice! -----\".top_border\n puts \"You've made a deft escape.\".bottom_border\n return true \n else\n puts \"Oh no! Your escape was blocked.\"\n monster.attack(self)\n return false\n end \n end", "def has_privilege?\n if (!logged_in?)\n redirect_to '/login' and return\n elsif (params[:user_id].to_i != current_user.id)\n redirect_to user_stories_path(current_user) and return\n end\n end", "def users_joined?\n true\n end", "def restricted?\n return ( self.user_type == User::USER_TYPE_NORMAL )\n end", "def admin?\n @user = current_user\n if @user\n # @person = Person.find(@user.person_id)\n if !(@user.person.admin)\n redirect_to root_path\n end\n end\n end", "def admin?\n if user_signed_in? && current_user.user_level == 1\n return true\n end\n return false\n end", "def admin?\n return false\n # return (session[:user_id] && User.find(session[:user_id])[:login] == '') ? true : false\n end", "def is_administrator?(user)\n user.admin == 2\n end", "def admin?\n #warning: ADMIN must have id 0, rake db:seed to get admin and sample user\n logged_in? && current_user.admin\n end", "def discussions?\n !!user && user.admin?\n end", "def owned_by? a_user\n a_user == program.moderator\n end", "def admin?\n if self.login == \"admin\"\n return true\n else\n return false\n end\n end", "def correct_user\n @user = User.find(params[:id])\n # redirect_to root_path, notice: \"You do not have permission.\" unless @user == \"Admin\" || @user == \"Member\"\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless (current_user.admin? == true || current_user?(@user)) \n end", "def user_admin?\n \t@admin_user = Usuario.find(session[:user_id]).admin\n end", "def admin?(user, target_level: 100)\n level = user_powerlevel(user, use_default: false)\n return false unless level\n\n level >= target_level\n end", "def gameOver defender\n if defender.playerCharacter == false\n puts \"Congrats you won!! This concludes our demo\"\n else\n puts \"Shame, you got killed. This condludes our demo\"\n end\nend", "def is_admin?(user)\n user.admin > 0\n end", "def is_admin?(_user_id)\n conversation_members.admin.where(user_id: _user_id).any?\n end", "def correct_user\n unless helpers.current_user?(@user)\n flash[:danger] = \"You don't have permission to do that\"\n redirect_to root_path\n end\n end", "def admin?\n self.user_type == TYPES[:admin]\n end", "def wisdom_challenge?\n if rand(100) > 90 - wisdom\n self[:level] += 1\n save\n true\n else\n false\n end\n end", "def has_privilege?\n if (!logged_in?)\n redirect_to '/login' and return\n elsif (params[:user_id].to_i != current_user.id)\n redirect_to user_events_path(current_user) and return\n end\n end", "def run(user, enemy)\n \n # Higher probability of escape when the enemy has low agility.\n if (user.sample_agilities(enemy))\n user.escaped = true\n type(\"#{user.name} successfully escapes the clutches of the #{enemy.name}!\\n\\n\")\n return\n end\n\n # Should already be false.\n user.escaped = false\n type(\"#{user.name} is cornered!\\n\\n\")\n end", "def ensure_admin_user!\n redirect_to(enemy_templates_path, :alert => \"You may not perform this action on enemies!\") and return unless current_user.admin?\n end", "def admin_user?\n session[:user][:uid] == APP_CONFIG[:admin]\n end", "def is_admin\n \tif current_user.nil? or !current_user.user_attributes[:room_reserve_admin]\n return false\n else\n return true\n end\n end", "def doctor(_kitchen_state)\n false\n end", "def is_admin?\n @user = User.find(params[:id])\n if !current_user.admin?\n flash[:danger] = \"Only admins can do that\"\n redirect_to home_path\n end\n end", "def check_board\n if (!current_user.supervisor_role)\n redirect_to root_path, notice: 'You do not have permissions to do that'\n end\n end", "def prepares_statement?(user)\n if dean_statement\n false\n elsif user.has_role? 'faculty_secretary'\n true\n elsif ((tutor_statement || index.tutor == user.person) &&\n !leader_statement && index.leader == user.person) ||\n (!leader_statement && !tutor_statement && index.tutor ==\n user.person) || (leader_statement && !dean_statement &&\n user.person.is_dean_of?(index))\n true\n end\n end", "def from_expert?\n !anonymous? && user.is_expert?\n end", "def forum_admin?\n privilege?('User Manager')\n end", "def game_over?\n return true if victory? || (@turns == 12)\n false\n end", "def admin?\n !current_user.AdminScreen?\n end", "def check_chair\n if (!current_user.superadmin_role)\n redirect_to root_path, notice: 'You do not have permissions to do that'\n end\n end", "def logado?\n !admin_atual.nil?\n end", "def defeat_monster?\n if dice_roll(2,6) >= 3\n true\n else\n false \n end\nend", "def correct_user\n @user = User.find(session[:user_id])\n redirect_to(root_url) unless current_user == @user || current_user.is_admin?\n end", "def user_admin?\n user_logged_in? && @current_user.type == 'Admin'\n end", "def user_admin?\n unless current_user.present? && current_user.admin?\n redirect_to home_welcome_path and return\n end \n end", "def doctor(_kitchen_state)\n false\n end", "def admin?\n @usuario_actual = Usuario.find_by_id(session[:user_id])\n return true if @usuario_actual.admin?\n \n redirect_to new_session_path and return false\n end", "def admin_authorized?\n\t\tif @user\n\t\t\t@user.level >= ADMIN_USER_LEVEL \n\t\telse\n\t\t\tnil\n\t\tend\n\tend", "def correct_user\n \n redirect_to(login_path) unless current_user?(@user)\n end", "def unscrape?\n @user.is_admin?\n end", "def admin?\n\t\tuser_session.admin?\n\tend", "def admin?\n return ( self.user_type == User::USER_TYPE_ADMIN )\n end", "def check_user_correct\n # Fetch user by id\n @user = User.find(params[:id])\n\n # Redirect to home page if wrong user or not admin\n unless @user == logged_in_user || logged_in_user.admin?\n redirect_to root_url\n end\n end", "def suicide\n @user = User.find(params[:id])\n if @user == current_user && !@user.current_games.find(:all, :conditions => {:id => params[:game]}).empty?\n @user.suicide_in(params[:game])\n flash[:notice] = \"Du bist jetzt tot. Herzlichen Glückwunsch.\"\n redirect_to :back\n end\n end", "def correct_user\n\t\t\tauthenticate_user!\n\t\t\tunless @user == current_user || current_user.admin?\n\t\t\t\tredirect_to (root_path)\n\t\t\t\tflash[:alert]\n\t\t\tend\n\t\tend", "def correct_user\n @userAdmin = UserAdmin.find(params[:id])\n unless current_user?(@userAdmin)\n flash[:danger] = \"You don't have the rights for this page/action.\"\n redirect_to(root_url)\n end\n end", "def is_admin?\n is_admin == 1\n end", "def check_is_admin\n unless is_admin?\n bounce_chumps \"You're not an admin.\"\n end\n end", "def is_admin?\n self.is_admin == \"true\"\n end", "def moleable?\n @moleable\n end", "def is_admin?\n if valid_session?\n current_user.admin == true\n end\n end", "def is_potential_user?\n\t\ttrue\n\tend", "def admin_only_view\n if !current_user.is_a? Admin and current_user.type != \"AdminAssistant\"\n flash[:error] = \"You are not authorized to view this page.\"\n redirect_to :root\n # Explictly tell the caller that this check failed\n return false\n else\n # Explictly tell the caller that this check was successful\n return true\n end\n end", "def user?\n get_mode == :user\n end", "def user_is_admin?\n\tbegin\n\t `gpresult /r /scope user`.split.include? \"Admin\"\n\trescue\n\t false\n\tend\n end", "def has_user(user_id)\n if self.user_id == user_id\n puts 'You are the mod!'\n return false\n end\n last_registered_player_id = self.last_registered_player_id.to_i\n if last_registered_player_id == -1\n puts \"No user are signed up for this game.\"\n return false\n end\n while last_registered_player_id != -1\n curr_player = Player.find(last_registered_player_id)\n if curr_player.user_id == user_id\n return true\n end\n last_registered_player_id = curr_player.prev_player_id\n end\n return false\n end", "def admin?\n if current_user.read_attribute(:permiso) != 1\n redirect_to current_user\n end\n end", "def members?\n user.hoa == hoa\n end", "def programme_administrator_logged_in?\n User.programme_administrator_logged_in?\n end", "def current_user_is_admin\n\t\ttrue if current_user.admin == 't'\n\tend", "def control_combatant\n\t\t\t@playercombatant = @combatants.sample\n\t\t\tputs \"\\nFor this game of Eschaton, you've been designated to be represent #{@playercombatant.nation}. (press Enter)\\n \"\n\t\t\t@playercombatant.nation.prepend '*'\n\t\t\t@playercombatant.is_player = true\n\t\tend", "def win_or_lose\n if game_data.guesses_remaining.zero?\n puts File.read('./views/you_dead')\n puts File.read('./views/dead')\n elsif game_data.letters_left_to_guess == []\n puts File.read('./views/winscreen')\n else\n # allows us to break recursion if we are testing\n @test_cond == false ? Turn.new(game_data) : true\n end\n end", "def show?\n @current_user.permission('Donor', :guest)\n end" ]
[ "0.6704577", "0.597449", "0.5938529", "0.58971345", "0.5706273", "0.5698041", "0.56844586", "0.5679694", "0.5609855", "0.5595255", "0.5530404", "0.55226296", "0.5505578", "0.54713666", "0.5470359", "0.544884", "0.5438849", "0.54307294", "0.5424523", "0.5394532", "0.5391846", "0.5391288", "0.53899723", "0.53890806", "0.5379315", "0.5374266", "0.5372034", "0.53666943", "0.5362522", "0.5354982", "0.5340746", "0.5332292", "0.5327991", "0.53228766", "0.5321305", "0.531857", "0.53168535", "0.5312567", "0.52978414", "0.528605", "0.52740985", "0.5268438", "0.5266929", "0.52661574", "0.526463", "0.5263969", "0.52601326", "0.5256939", "0.52546155", "0.5252248", "0.52519065", "0.52459294", "0.52446175", "0.5235502", "0.52339476", "0.5233239", "0.5231539", "0.52303046", "0.5226127", "0.52180874", "0.5213552", "0.5206961", "0.52039623", "0.5195788", "0.51871324", "0.51837105", "0.5183281", "0.51774174", "0.51772183", "0.5176445", "0.51757497", "0.5173788", "0.5172802", "0.51715344", "0.5170625", "0.5170173", "0.5169272", "0.5165532", "0.5164242", "0.5163517", "0.5162353", "0.51619494", "0.5160195", "0.515889", "0.51541716", "0.5152899", "0.5152194", "0.5152191", "0.51504", "0.5149514", "0.51487446", "0.51480806", "0.5146366", "0.5145504", "0.51393", "0.51374865", "0.51369816", "0.51368314", "0.5134988", "0.5132966" ]
0.6637271
1
GET /ujumbes GET /ujumbes.json
def index @ujumbes = Ujumbe.all.order('id DESC') @ujumbe = current_user.ujumbes.build if current_user @user = current_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def index\n @jugadores = Jugadore.all\n end", "def index\n @jichucanshus = Jichucanshu.all\n end", "def index\n @kifus = Kifu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @kifus }\n end\n end", "def index\n @uens = Uen.all\n end", "def index\n users = User.all\n # cheer_ups = CheerUp.all\n render json: users\n end", "def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end", "def index\n seleccionarMenu(:juzgados)\n @juzgados = Juzgado.order(:ciudad_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @juzgados }\n end\n end", "def index\n @jugadors = Jugador.all\n end", "def index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { render json: @universes }\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 index\n @zf_bjietus = ZfBjietu.all\n end", "def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end", "def index\n @ugroupes = Ugroupe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ugroupes }\n end\n end", "def index\n @jugadores = Jugadore.all.order(\"id ASC\")\n end", "def index\n @briefs = Brief.includes(:user).order(created_at: :desc).all\n render json: @briefs, each_serializer: BriefsSerializer\n end", "def index\n @uchronists = Uchronist.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronists }\n end\n end", "def index\n @kraje = Kraj.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kraje }\n end\n end", "def index\n @lugars = Lugar.all\n\n render json: @lugars\n end", "def index\n @shujukujiaobens = Shujukujiaoben.all\n end", "def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end", "def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end", "def index\n @bakusokukuns = Bakusokukun.all\n end", "def index\n @municipios = Municipio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipios }\n end\n end", "def index\n @ukols = Ukol.all\n end", "def index\n # @wikis = Wiki.all\n @wikis = Wiki.find_all_by_title('Home')\n @allwikis = Wiki.recent.limit(10) \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wikis }\n end\n end", "def index\n @albums = Album.all\n render json: @albums\n end", "def index\n @ucastniks = Ucastnik.all\n end", "def index\n @usuarios = Usuario.por_colegio(colegio.id).order(\"nombre\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def index\n @users = User.where(:alive => true).order(\"nick ASC\")\n @headline = t(:all_users)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users }\n end\n end", "def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end", "def index\n @tenures = Tenure.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @tenures\n end", "def index\n @gakunenns = Gakunenn.all\n end", "def show\n @jugador = Jugador.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jugador }\n end\n end", "def index\n @okugais = Okugai.all\n end", "def index\n @kuaisufenfawenjians = Kuaisufenfawenjian.all\n end", "def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end", "def index\n @ultimo_grado_de_estudios = UltimoGradoDeEstudio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ultimo_grado_de_estudios }\n end\n end", "def index\n @kuaisujiaobenzhixings = Kuaisujiaobenzhixing.all\n end", "def index\n @german_go_leagues = GermanGoLeague.all\n\t\t@title = \"Bundesliga Spiele\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @german_go_leagues }\n end\n end", "def index\n # @faculties = Faculty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Oj.dump(@faculties, mode: :compat) }\n end\n end", "def index\n @universities = University.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @universities }\n end\n end", "def index\n @zabydovnuks = Zabydovnuk.all\n end", "def index\n @nepals = Nepal.all\n\n render json: @nepals\n end", "def new\n @jugadore = Jugadore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jugadore }\n end\n end", "def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end", "def index\n @ulicas = Ulica.all\n end", "def index\n @himalayas ||= Himalaya.limit(10).order('id desc')\n @descuentos ||= Descuento.limit(10).order('id desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end", "def index\n @tacks = Tack.all\n\n render json: @tacks\n end", "def index\n @electors = Elector.all\n\n render json: @electors\n end", "def index\n render json: { \"Exercice Technique\" => \"Transporter Organizations Colisweb backend developer exercise\", \"Poste visé\" => \"Développeur Back Ruby, Alternance\", \"Candidat\" => \"Gressier Jimmy\"}\n end", "def index\n @habrausers = current_user.habrausers\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @habrausers }\n end\n end", "def index\n @faculties = Faculty.all\n json_response(@faculties)\n end", "def show\n render json: @lugar\n end", "def index\n @zaduzenjas = Zaduzenja.all\n end", "def index\n @heroes = Hero.all\n\n render json: @heroes\n end", "def index\n @you_owe_mes = YouOweMe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @you_owe_mes }\n end\n end", "def index\n @municaos = Municao.page(params['page']).per(5);\n end", "def index\n @universitarios = Universitario.all\n end", "def index\n @ordens = Orden.all\n render json: @ordens\n end", "def index\n @kbs = Kb.search(params[:q]).page(params[:page]).order(\"id desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @kbs }\n end\n end", "def index\n @users = User.all\n # render json: @users\n # commented out because a jbuilder template has been added\n end", "def index\n @uranium_js = UraniumJ.all\n end", "def index\n @thumbs = Thumb.all\n\n render json: @thumbs\n end", "def show\n seleccionarMenu(:juzgados)\n @juzgado = Juzgado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @juzgado }\n end\n end", "def index\n @puntajes = Puntaje.order('created_at DESC').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @puntajes }\n end\n end", "def index\n @uzsers = Uzser.all\n end", "def index\n @jushos = Jusho.all\n end", "def index_5\n @joueurs = @parties.map(&:joueurs).as_json\n\n respond_to do |format|\n format.html { render :html => @joueurs.to_s }\n format.json { render :json => @joueurs.to_json }\n format.xml { render :xml => @joueurs.to_xml }\n end\n end", "def index\n @neighborhoods = Neighborhood.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @neighborhoods }\n end\n end", "def index\n @lobs = Lob.all\n\n render json: @lobs\n end", "def index\n @urnas = Urna.all\n end", "def index\n @urnas = Urna.all\n end", "def index\n @zhuanyes = Zhuanye.page(params[:page]).per_page(10)\n end", "def index\n @usuarios = Usuario.all\n\n @users = Usuario.all.order(:id)\n @users.each do |u|\n puts u.id\n end\n #render json: @usuarios\n render 'index.json.jbuilder'\n end", "def index\n @neighborhoods = Neighborhood.alphabetical.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @neighborhoods }\n end\n end", "def destroy\n @ujumbe.destroy\n respond_to do |format|\n format.html { redirect_to ujumbes_url }\n format.json { head :no_content }\n end\n end", "def index\n @uasgs = Uasg.all\n end", "def index\n @unidade_medidas = UnidadeMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @unidade_medidas }\n end\n end", "def index\n @kejuaraans = Kejuaraan.all\n end", "def index\n @municipio_de_la_preparatoria_o_universidad_de_origens = MunicipioDeLaPreparatoriaOUniversidadDeOrigen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipio_de_la_preparatoria_o_universidad_de_origens }\n end\n end", "def index\n @mugshots = Mugshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mugshots }\n end\n end", "def index\n @users = User.all\n @title = \"Пользователи\"\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @albums = Album.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @albums }\n end\n end", "def index\n @user = current_user\n @search = @user.loops.search(params[:q]) \n @loops = @search.result \n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loops }\n end\n end", "def index\n @jsons = Json.all\n end", "def index\n @industries = Industry.order(:short_name_en)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @industries }\n end\n end", "def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end", "def index\n if params[:estado]\n @municipios = Uf.find(params[:estado]).municipios\n else\n @municipios = Uf.first.municipios\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipios }\n end\n end", "def index\n @problems = Problem.all\n\n render json: @problems\n end", "def index\n @branch_rooms = Room.get_all_rooms(params[:branch_id])\n \n render json: @branch_rooms\n end", "def show\n @unp = Unp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unp }\n end\n end", "def index\n @mesasredondas = Mesasredonda.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mesasredondas }\n end\n end", "def index\n @uvas = Uva.all\n end", "def index\n @pictures = @museum.pictures.all #Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end", "def index\n @grupos = Grupo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @grupos }\n end\n end", "def index\n users = User.all\n render json: { users: users }, status: :ok\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 index\n @riyu_okunais = RiyuOkunai.all\n end", "def index\n render json: @fiestas\n end" ]
[ "0.65405816", "0.62505263", "0.62289387", "0.61759555", "0.6143962", "0.61354285", "0.6124547", "0.60534817", "0.60516095", "0.6036577", "0.602003", "0.59967196", "0.59958285", "0.59547514", "0.5933968", "0.59311634", "0.5903261", "0.589951", "0.5893237", "0.5840614", "0.58102375", "0.57800883", "0.5773701", "0.5758552", "0.57274604", "0.5724056", "0.57226956", "0.5712451", "0.5697205", "0.5690948", "0.5688125", "0.5674147", "0.5672101", "0.5666531", "0.56577015", "0.56558484", "0.56539917", "0.5653826", "0.5641032", "0.56378454", "0.5634293", "0.56319064", "0.5629636", "0.5624341", "0.5617543", "0.56138176", "0.5601816", "0.5592132", "0.5590379", "0.5584589", "0.55820143", "0.5568594", "0.5566202", "0.5563047", "0.55605954", "0.55603343", "0.5554445", "0.5554249", "0.55535877", "0.55535394", "0.5549348", "0.5547603", "0.55465657", "0.55451936", "0.5542954", "0.5540762", "0.5540483", "0.5540427", "0.5533809", "0.55332285", "0.5531315", "0.5525533", "0.5525533", "0.55228376", "0.55227196", "0.5522695", "0.55198896", "0.5519378", "0.55189717", "0.5518343", "0.55180824", "0.5514615", "0.55142605", "0.5507088", "0.5506994", "0.55065095", "0.5503936", "0.54945916", "0.54939806", "0.54918987", "0.5489466", "0.54888386", "0.5488568", "0.54879284", "0.5485528", "0.5485488", "0.5483933", "0.5482551", "0.54823697", "0.54804206" ]
0.5764937
23
GET /ujumbes/1 GET /ujumbes/1.json
def show @user = current_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\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 @jugador = Jugador.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jugador }\n end\n end", "def index\n @jugadores = Jugadore.all\n end", "def index\n @kifus = Kifu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @kifus }\n end\n end", "def index\n @jichucanshus = Jichucanshu.all\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 index\n @uchronists = Uchronist.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronists }\n end\n end", "def index\n seleccionarMenu(:juzgados)\n @juzgados = Juzgado.order(:ciudad_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @juzgados }\n end\n end", "def index\n users = User.all\n # cheer_ups = CheerUp.all\n render json: users\n end", "def index\n @uens = Uen.all\n end", "def index\n @jugadores = Jugadore.all.order(\"id ASC\")\n end", "def index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { render json: @universes }\n end\n end", "def show\n @uchronist = Uchronist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronist }\n end\n end", "def show\n @unp = Unp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unp }\n end\n end", "def show\n @lieu = Lieu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lieu }\n end\n end", "def new\n @jugadore = Jugadore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jugadore }\n end\n end", "def index\n @jugadors = Jugador.all\n end", "def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end", "def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end", "def index\n @kraje = Kraj.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kraje }\n end\n end", "def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end", "def index\n @briefs = Brief.includes(:user).order(created_at: :desc).all\n render json: @briefs, each_serializer: BriefsSerializer\n end", "def show\n @u_ser = USer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @u_ser }\n end\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def show\n seleccionarMenu(:juzgados)\n @juzgado = Juzgado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @juzgado }\n end\n end", "def index\n @lugars = Lugar.all\n\n render json: @lugars\n end", "def show\n @buchung = Buchung.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @buchung }\n end\n end", "def index\n @ugroupes = Ugroupe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ugroupes }\n end\n end", "def index\n @usuarios = Usuario.all\n\n @users = Usuario.all.order(:id)\n @users.each do |u|\n puts u.id\n end\n #render json: @usuarios\n render 'index.json.jbuilder'\n end", "def show\n @jornada = Jornada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jornada }\n end\n end", "def index\n @usuarios = Usuario.por_colegio(colegio.id).order(\"nombre\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end", "def show\n @kolegiji = Kolegiji.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kolegiji }\n end\n end", "def index\n @municipios = Municipio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipios }\n end\n end", "def index\n @zf_bjietus = ZfBjietu.all\n end", "def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end", "def index\n # @wikis = Wiki.all\n @wikis = Wiki.find_all_by_title('Home')\n @allwikis = Wiki.recent.limit(10) \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wikis }\n end\n end", "def show\n @ubication = Ubication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ubication }\n end\n end", "def index\n @tenures = Tenure.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @tenures\n end", "def show\n render json: @lugar\n end", "def show\n @uset = Uset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uset }\n end\n end", "def show\n @lich_su_binh_bau = LichSuBinhBau.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lich_su_binh_bau }\n end\n end", "def new\n @u = U.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @u }\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 index\n @ujumbes = Ujumbe.all.order('id DESC')\n @ujumbe = current_user.ujumbes.build if current_user\n @user = current_user\n end", "def show\n @huerto = Huerto.find_by_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @huerto }\n end\n end", "def index\n @universities = University.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @universities }\n end\n end", "def show\n @guille = Guille.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guille }\n end\n end", "def show\n @nugget = Nugget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nugget }\n end\n end", "def index\n @himalayas ||= Himalaya.limit(10).order('id desc')\n @descuentos ||= Descuento.limit(10).order('id desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end", "def show\n @ufile = Ufile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ufile }\n end\n end", "def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end", "def index\n @lobs = Lob.all\n\n render json: @lobs\n end", "def new\n @uchronia = Uchronia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @uchronia }\n end\n end", "def index\n @majors = majors\n respond_to do |format|\n format.json{\n return render json: ret\n }\n end\n end", "def show\n @jamaat = Jamaat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jamaat }\n end\n end", "def index\n @uranium_js = UraniumJ.all\n end", "def index\n render json: { \"Exercice Technique\" => \"Transporter Organizations Colisweb backend developer exercise\", \"Poste visé\" => \"Développeur Back Ruby, Alternance\", \"Candidat\" => \"Gressier Jimmy\"}\n end", "def index\n @users = User.all\n @title = \"Пользователи\"\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def show\n @aboutu = Aboutu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aboutu }\n end\n end", "def show\n @cuentum = Cuentum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cuentum }\n end\n end", "def index\n @ultimo_grado_de_estudios = UltimoGradoDeEstudio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ultimo_grado_de_estudios }\n end\n end", "def index\n # @faculties = Faculty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Oj.dump(@faculties, mode: :compat) }\n end\n end", "def index\n @users = User.where(:alive => true).order(\"nick ASC\")\n @headline = t(:all_users)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users }\n end\n end", "def show\n @eou = Eou.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @eou }\n end\n end", "def show\n @humanidades1 = Humanidades1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades1 }\n end\n end", "def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end", "def index\n @heroes = Hero.all\n\n render json: @heroes\n end", "def index\n @familia = Familium.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @familia }\n end\n end", "def index\n if params[:estado]\n @municipios = Uf.find(params[:estado]).municipios\n else\n @municipios = Uf.first.municipios\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipios }\n end\n end", "def index\n @users = User.all\n # render json: @users\n # commented out because a jbuilder template has been added\n end", "def index\n @jsons = Json.all\n end", "def index\n @problems = Problem.all\n\n render json: @problems\n end", "def index\n @shujukujiaobens = Shujukujiaoben.all\n end", "def index\n @albums = Album.all\n render json: @albums\n end", "def show\n @kolegij = Kolegij.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kolegij }\n end\n end", "def show\n @humanidades3 = Humanidades3.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades3 }\n end\n end", "def show\n @bruger = Bruger.find_by_id(current_user.id)\n @onske = Onske.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @onske }\n end\n end", "def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end", "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "def index\n @puntajes = Puntaje.order('created_at DESC').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @puntajes }\n end\n end", "def index\n @ulicas = Ulica.all\n end", "def show\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leito }\n end\n end", "def index_5\n @joueurs = @parties.map(&:joueurs).as_json\n\n respond_to do |format|\n format.html { render :html => @joueurs.to_s }\n format.json { render :json => @joueurs.to_json }\n format.xml { render :xml => @joueurs.to_xml }\n end\n end", "def index\n @jsons = Json.all\n\n\n end", "def new\n @uf = Uf.first\n @municipios = @uf.municipios\n @cargo_eleicao = Eleicao.find(:first, :conditions => \"status = true\").cargo_eleicaos\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cargo_eleicao }\n end\n end", "def index\n @mugshots = Mugshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mugshots }\n end\n end", "def show\n @core_uf = Core::Uf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_uf }\n end\n end", "def index\n user= User.all\n render json: {users:user}\n end", "def index\n hash = cookies[:city_hash]\n @city = City.find_by(city_hash: hash)\n @units = @city.units\n\n render json: @units, status: :ok\n end", "def index\n @powiadomienia = Powiadomienie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @powiadomienia }\n end\n end", "def show\n @sluzby = Sluzby.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sluzby }\n end\n end", "def show\n @musique = Musique.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @musique }\n end\n end", "def index\n users = User.all\n render json: { users: users }, status: :ok\n end", "def index\n render json: @fiestas\n end", "def index\n @faculties = Faculty.all\n json_response(@faculties)\n end", "def show\n @utente = Utente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @utente }\n end\n end", "def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end", "def index\n @industries = Industry.order(:short_name_en)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @industries }\n end\n end" ]
[ "0.6524254", "0.628556", "0.612124", "0.6115545", "0.61142176", "0.60980225", "0.60759443", "0.6056273", "0.60191447", "0.5977893", "0.5964593", "0.59524524", "0.59423435", "0.59404427", "0.5938506", "0.5928793", "0.5912061", "0.5902653", "0.5888407", "0.58535916", "0.5847182", "0.5833967", "0.58130586", "0.58097357", "0.5800065", "0.5800045", "0.57902145", "0.5779024", "0.5776212", "0.5774797", "0.57578975", "0.5749535", "0.57425535", "0.57398945", "0.5730636", "0.571409", "0.57078093", "0.56904596", "0.56884944", "0.5684492", "0.56716526", "0.5669934", "0.56683815", "0.5665883", "0.5659899", "0.5657222", "0.5655765", "0.56557196", "0.5651815", "0.5650805", "0.56371665", "0.56336015", "0.56322414", "0.5620945", "0.5608506", "0.5605175", "0.5591676", "0.55889326", "0.55879474", "0.55857325", "0.55815923", "0.55804247", "0.5578605", "0.557688", "0.55740607", "0.55705047", "0.55694926", "0.5567396", "0.5567361", "0.55663", "0.55632824", "0.5558622", "0.5557248", "0.55572426", "0.5553982", "0.554953", "0.5549463", "0.55433136", "0.5542802", "0.5542466", "0.55405736", "0.55362624", "0.5534666", "0.55303276", "0.55298245", "0.5528013", "0.55204743", "0.5520251", "0.5519801", "0.55176294", "0.5515379", "0.5511674", "0.550936", "0.5507103", "0.55053854", "0.55004084", "0.5497436", "0.54926455", "0.549241", "0.5491233", "0.5491165" ]
0.0
-1
POST /ujumbes POST /ujumbes.json
def create @ujumbe = current_user.ujumbes.build(ujumbe_params) @user = current_user respond_to do |format| if @ujumbe.save format.html { redirect_to edit_ujumbe_path(@ujumbe), notice: 'Ujumbe was successfully created. You can now complete it' } format.json { render action: 'show', status: :created, location: @ujumbe } else format.html { render action: 'new' } format.json { render json: @ujumbe.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @uen = Uen.new(uen_params)\n\n respond_to do |format|\n if @uen.save\n format.html { redirect_to @uen, notice: 'Uen was successfully created.' }\n format.json { render :show, status: :created, location: @uen }\n else\n format.html { render :new }\n format.json { render json: @uen.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @uang_masuk = UangMasuk.new(uang_masuk_params)\n\n respond_to do |format|\n if @uang_masuk.save\n format.html { redirect_to uang_masuks_path, notice: 'Uang masuk was successfully created.' }\n else\n format.html { render :new }\n format.json { render json: @uang_masuk.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @zf_bjietu = ZfBjietu.new(zf_bjietu_params)\n\n respond_to do |format|\n if @zf_bjietu.save\n format.html { redirect_to @zf_bjietu, notice: 'Zf bjietu was successfully created.' }\n format.json { render :show, status: :created, location: @zf_bjietu }\n else\n format.html { render :new }\n format.json { render json: @zf_bjietu.errors, status: :unprocessable_entity }\n end\n end\n end", "def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\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 @uranium_j = UraniumJ.new(uranium_j_params)\n\n respond_to do |format|\n if @uranium_j.save\n format.html { redirect_to @uranium_j, notice: 'Uranium j was successfully created.' }\n format.json { render action: 'show', status: :created, location: @uranium_j }\n else\n format.html { render action: 'new' }\n format.json { render json: @uranium_j.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bakusokukun = Bakusokukun.new(bakusokukun_params)\n\n respond_to do |format|\n if @bakusokukun.save\n format.html { redirect_to @bakusokukun, notice: 'Bakusokukun was successfully created.' }\n format.json { render :show, status: :created, location: @bakusokukun }\n else\n format.html { render :new }\n format.json { render json: @bakusokukun.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @u = U.new(params[:u])\n\n respond_to do |format|\n if @u.save\n format.html { redirect_to edit_u_path @u, notice: 'U was successfully created.' }\n # format.json { render json: @u, status: :created, location: @u }\n else\n format.html { render action: \"new\" }\n format.json { render json: @u.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jichucanshu = Jichucanshu.new(jichucanshu_params)\n\n respond_to do |format|\n if @jichucanshu.save\n format.html { redirect_to @jichucanshu, notice: 'Jichucanshu was successfully created.' }\n format.json { render :show, status: :created, location: @jichucanshu }\n else\n format.html { render :new }\n format.json { render json: @jichucanshu.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.new(benutzer_params(bNode))\n if @benutzer.save\n if bNode.xpath('objekt_zuordnungs').length > 0\n objekt_ids = bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i}\n @benutzer.setze_objekt_zuordnungen(objekt_ids)\n end\n success(@benutzer.id)\n else\n error(@benutzer.errors)\n end\n end", "def create\n @uzser = Uzser.new(uzser_params)\n\n respond_to do |format|\n if @uzser.save\n format.html { redirect_to @uzser, notice: 'Uzser was successfully created.' }\n format.json { render :show, status: :created, location: @uzser }\n else\n format.html { render :new }\n format.json { render json: @uzser.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n\n respond_to do |format|\n if @huati.save\n format.html { redirect_to @huati, notice: 'Huati was successfully created.' }\n format.json { render json: @huati, status: :created, location: @huati }\n else\n format.html { render action: \"new\" }\n format.json { render json: @huati.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jugadore = Jugadore.new(jugadore_params)\n\n respond_to do |format|\n if @jugadore.save\n format.html { redirect_to @jugadore, notice: 'Jugadore was successfully created.' }\n format.json { render :show, status: :created, location: @jugadore }\n else\n format.html { render :new }\n format.json { render json: @jugadore.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jugadore = Jugadore.new( jugadore_params )\n\n respond_to do |format|\n if @jugadore.save\n format.html { redirect_to @jugadore, notice: 'Jugadore was successfully created.' }\n format.json { render action: 'show', status: :created, location: @jugadore }\n else\n format.html { render action: 'new' }\n format.json { render json: @jugadore.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jornada = Jornada.new(params[:jornada])\n\n respond_to do |format|\n if @jornada.save\n format.html { redirect_to jornadas_path, notice: 'La jornada se ha creado correctamente' }\n format.json { render json: @jornada, status: :created, location: @jornada }\n else\n format.html { render action: \"new\" }\n format.json { render json: @jornada.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jusho = Jusho.new(jusho_params)\n\n respond_to do |format|\n if @jusho.save\n format.html { redirect_to @jusho, notice: 'Jusho was successfully created.' }\n format.json { render :show, status: :created, location: @jusho }\n else\n format.html { render :new }\n format.json { render json: @jusho.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kumo = Kumo.new(kumo_params)\n\n respond_to do |format|\n if @kumo.save\n format.html { redirect_to kumos_path, notice: 'Kumo was successfully created.' }\n format.json { render action: 'show', status: :created, location: @kumo }\n else\n format.html { render action: 'new' }\n format.json { render json: @kumo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n seleccionarMenu(:juzgados)\n @juzgado = Juzgado.new(params[:juzgado])\n\n respond_to do |format|\n if @juzgado.save\n format.html { redirect_to @juzgado, notice: 'Juzgado fue creado satisfactoriamente.' }\n format.json { render json: @juzgado, status: :created, location: @juzgado }\n else\n format.html { render action: \"new\" }\n format.json { render json: @juzgado.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @ujumbe.destroy\n respond_to do |format|\n format.html { redirect_to ujumbes_url }\n format.json { head :no_content }\n end\n end", "def create\n @eou = Eou.new(params[:eou])\n\n respond_to do |format|\n if @eou.save\n format.html { redirect_to @eou, :notice => 'Eou was successfully created.' }\n format.json { render :json => @eou, :status => :created, :location => @eou }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @eou.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @uchronia = Uchronia.new(params[:uchronia])\n\n respond_to do |format|\n if @uchronia.save\n format.html { redirect_to @uchronia, notice: 'Uchronia was successfully created.' }\n format.json { render json: @uchronia, status: :created, location: @uchronia }\n else\n format.html { render action: \"new\" }\n format.json { render json: @uchronia.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nuke = Nuke.new(nuke_params)\n\n respond_to do |format|\n if @nuke.save\n format.html { redirect_to @nuke, notice: 'Nuke was successfully created.' }\n format.json { render :show, status: :created, location: @nuke }\n else\n format.html { render :new }\n format.json { render json: @nuke.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @juntum_usuario = JuntumUsuario.new(juntum_usuario_params)\n\n respond_to do |format|\n if @juntum_usuario.save\n format.html { redirect_to @juntum_usuario, notice: 'Juntum usuario was successfully created.' }\n format.json { render :show, status: :created, location: @juntum_usuario }\n else\n format.html { render :new }\n format.json { render json: @juntum_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def create\n @zabydovnuk = Zabydovnuk.new(zabydovnuk_params)\n\n respond_to do |format|\n if @zabydovnuk.save\n format.html { redirect_to @zabydovnuk, notice: 'Zabydovnuk was successfully created.' }\n format.json { render :show, status: :created, location: @zabydovnuk }\n else\n format.html { render :new }\n format.json { render json: @zabydovnuk.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @uva = Uva.new(uva_params)\n\n respond_to do |format|\n if @uva.save\n format.html { redirect_to @uva, notice: 'Uva was successfully created.' }\n format.json { render :show, status: :created, location: @uva }\n else\n format.html { render :new }\n format.json { render json: @uva.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jugador = Jugador.new(params[:jugador])\n @clubes = Club.all\n @equipos = Equipo.all\n respond_to do |format|\n if @jugador.save\n format.html { redirect_to @jugador, notice: 'Jugador se ha creado correctamente.' }\n format.json { render json: @jugador, status: :created, location: @jugador }\n else\n format.html { render action: \"new\" }\n format.json { render json: @jugador.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kofu = Kofu.new(kofu_params)\n\n respond_to do |format|\n if @kofu.save\n format.html { redirect_to @kofu, notice: 'Kofu was successfully created.' }\n format.json { render :show, status: :created, location: @kofu }\n else\n format.html { render :new }\n format.json { render json: @kofu.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 @jugador = Jugador.new(jugador_params)\n\n respond_to do |format|\n if @jugador.save\n format.html { redirect_to @jugador, notice: 'Jugador was successfully created.' }\n format.json { render :show, status: :created, location: @jugador }\n else\n format.html { render :new }\n format.json { render json: @jugador.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_albums\n url = 'https://stg-resque.hakuapp.com/albums.json'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n albums = JSON.parse(response)\n\n albums.each do |album|\n Album.create!(album.except('id'))\n end\nend", "def create\n @karutum = Karutum.new(karutum_params)\n\n respond_to do |format|\n if @karutum.save\n format.html { redirect_to @karutum, notice: 'Karutum was successfully created.' }\n format.json { render :show, status: :created, location: @karutum }\n else\n format.html { render :new }\n format.json { render json: @karutum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @unp = Unp.new(params[:unp])\n\n respond_to do |format|\n if @unp.save\n format.html { redirect_to @unp, notice: 'Unp was successfully created.' }\n format.json { render json: @unp, status: :created, location: @unp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @unp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ukol = Ukol.new(ukol_params)\n\n respond_to do |format|\n if @ukol.save\n format.html { redirect_to @ukol, notice: 'Ukol was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ukol }\n else\n format.html { render action: 'new' }\n format.json { render json: @ukol.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kontum = Kontum.new(kontum_params)\n\n respond_to do |format|\n if @kontum.save\n format.html { redirect_to @kontum, notice: 'Kontum was successfully created.' }\n format.json { render :show, status: :created, location: @kontum }\n else\n format.html { render :new }\n format.json { render json: @kontum.errors, status: :unprocessable_entity }\n end\n end\n end", "def POST; end", "def create\n @uzivatel = Uzivatel.new(uzivatel_params)\n\n respond_to do |format|\n if @uzivatel.save\n format.html { redirect_to @uzivatel, notice: 'Uzivatel was successfully created.' }\n format.json { render :show, status: :created, location: @uzivatel }\n else\n format.html { render :new }\n format.json { render json: @uzivatel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jednani = Jednani.new(jednani_params)\n\n respond_to do |format|\n if @jednani.save\n format.html { redirect_to @jednani, notice: 'Jednani was successfully created.' }\n format.json { render action: 'show', status: :created, location: @jednani }\n else\n format.html { render action: 'new' }\n format.json { render json: @jednani.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 result[:result]\n result\nend", "def create\n @post = Post.create(post_params)\n puts \"LLLLLOOOOOOOLLLLLL\"\n puts current_usuario.to_json\n @post = current_usuario.posts.create(post_params)\n \n @post.sangre = current_usuario.tipoDeSangre\n\n\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @shujukujiaoben = Shujukujiaoben.new(shujukujiaoben_params)\n\n respond_to do |format|\n if @shujukujiaoben.save\n format.html { redirect_to @shujukujiaoben, notice: 'Shujukujiaoben was successfully created.' }\n format.json { render :show, status: :created, location: @shujukujiaoben }\n else\n format.html { render :new }\n format.json { render json: @shujukujiaoben.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @minnpaku = Minnpaku.new(minnpaku_params)\n\n respond_to do |format|\n if @minnpaku.save\n format.html { redirect_to @minnpaku, notice: 'Minnpaku was successfully created.' }\n format.json { render :show, status: :created, location: @minnpaku }\n else\n format.html { render :new }\n format.json { render json: @minnpaku.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @klienci_jaskula = KlienciJaskula.new(klienci_jaskula_params)\n\n respond_to do |format|\n if @klienci_jaskula.save\n format.html { redirect_to @klienci_jaskula, notice: 'Klienci jaskula was successfully created.' }\n format.json { render :show, status: :created, location: @klienci_jaskula }\n else\n format.html { render :new }\n format.json { render json: @klienci_jaskula.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ugroupe = Ugroupe.new(params[:ugroupe])\n respond_to do |format|\n if @ugroupe.save\n format.html { redirect_to ugroupes_path }\n format.json { render json: @ugroupe, status: :created, location: @ugroupe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ugroupe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sluzby = Sluzby.new(params[:sluzby])\n\n respond_to do |format|\n if @sluzby.save\n format.html { redirect_to @sluzby, notice: 'Sluzby was successfully created.' }\n format.json { render json: @sluzby, status: :created, location: @sluzby }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sluzby.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n render json: Post.create(params[\"post\"])\n end", "def create\n @jiankong = Jiankong.new(jiankong_params)\n\n respond_to do |format|\n if @jiankong.save\n format.html { redirect_to @jiankong, notice: 'Jiankong was successfully created.' }\n format.json { render :show, status: :created, location: @jiankong }\n else\n format.html { render :new }\n format.json { render json: @jiankong.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kifu = Kifu.new(params[:kifu])\n\n respond_to do |format|\n if @kifu.save\n format.html { redirect_to @kifu, :notice => 'Kifu was successfully created.' }\n format.json { render :json => @kifu, :status => :created, :location => @kifu }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @kifu.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @huerto = Huerto.new(params[:huerto])\n\n respond_to do |format|\n if @huerto.save\n format.html { redirect_to @huerto, notice: 'Huerto was successfully created.' }\n format.json { render json: @huerto, status: :created, location: @huerto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @huerto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kakiko = Kakiko.new(kakiko_params)#属性を設定してモデルオブジェクトを生成\n @kakiko.user_id = current_user.id#user_id属性を追加\n @kakiko.tag = params[:kakiko][:tag]\n @kakiko.name = params[:kakiko][:name]\n if @kakiko.save#saveしないといくら追加したところで意味がない\n #renderでlocalhost:3000に返す \n render json: @kakiko, status: :created, location: @kakiko\n else\n render json: @kakiko.errors, status: :unprocessable_entity\n end\n end", "def create\n @moussaillon = Moussaillon.new(moussaillon_params)\n\n respond_to do |format|\n if @moussaillon.save\n format.html { redirect_to @moussaillon, notice: 'Moussaillon was successfully created.' }\n format.json { render :show, status: :created, location: @moussaillon }\n else\n format.html { render :new }\n format.json { render json: @moussaillon.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 @uset = Uset.new(params[:uset])\n\n respond_to do |format|\n if @uset.save\n format.html { redirect_to @uset, notice: 'Uset was successfully created.' }\n format.json { render json: @uset, status: :created, location: @uset }\n else\n format.html { render action: \"new\" }\n format.json { render json: @uset.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cuadro_jugador = CuadroJugador.new(cuadro_jugador_params)\n\n respond_to do |format|\n if @cuadro_jugador.save\n format.html { redirect_to @cuadro_jugador, notice: 'Cuadro jugador was successfully created.' }\n format.json { render :show, status: :created, location: @cuadro_jugador }\n else\n format.html { render :new }\n format.json { render json: @cuadro_jugador.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @utensil = Utensil.new(utensil_params)\n\n respond_to do |format|\n if @utensil.save\n format.html { redirect_to @utensil, notice: 'Utensil was successfully created.' }\n format.json { render :show, status: :created, location: @utensil }\n else\n format.html { render :new }\n format.json { render json: @utensil.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @meuble = Meuble.new(params[:meuble])\n\n respond_to do |format|\n if @meuble.save\n format.html { redirect_to @meuble, notice: 'Meuble was successfully created.' }\n format.json { render json: @meuble, status: :created, location: @meuble }\n else\n format.html { render action: \"new\" }\n format.json { render json: @meuble.errors, status: :unprocessable_entity }\n end\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 @u_ser = USer.new(params[:u_ser])\n\n respond_to do |format|\n if @u_ser.save\n format.html { redirect_to @u_ser, notice: 'U ser was successfully created.' }\n format.json { render json: @u_ser, status: :created, location: @u_ser }\n else\n format.html { render action: \"new\" }\n format.json { render json: @u_ser.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ulica = Ulica.new(ulica_params)\n\n respond_to do |format|\n if @ulica.save\n format.html { redirect_to @ulica, notice: 'Ulica was successfully created.' }\n format.json { render :show, status: :created, location: @ulica }\n else\n format.html { render :new }\n format.json { render json: @ulica.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kennkoukiroku = Kennkoukiroku.new(kennkoukiroku_params)\n\n respond_to do |format|\n if @kennkoukiroku.save\n format.html { redirect_to @kennkoukiroku, notice: \"健康記録を追加しました\" }\n format.json { render :show, status: :created, location: @kennkoukiroku }\n else\n format.html { render :new }\n format.json { render json: @kennkoukiroku.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kolegiji = Kolegiji.new(params[:kolegiji])\n\n respond_to do |format|\n if @kolegiji.save\n format.html { redirect_to @kolegiji, notice: 'Kolegiji was successfully created.' }\n format.json { render json: @kolegiji, status: :created, location: @kolegiji }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kolegiji.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tuoshui = Tuoshui.new(params[:tuoshui])\n\n respond_to do |format|\n if @tuoshui.save\n format.html { redirect_to @tuoshui, notice: 'Tuoshui was successfully created.' }\n format.json { render json: @tuoshui, status: :created, location: @tuoshui }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tuoshui.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tiendas_juego = TiendasJuego.new(tiendas_juego_params)\n\n respond_to do |format|\n if @tiendas_juego.save\n format.html { redirect_to @tiendas_juego, notice: 'Tiendas juego was successfully created.' }\n format.json { render :show, status: :created, location: @tiendas_juego }\n else\n format.html { render :new }\n format.json { render json: @tiendas_juego.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sotrudniki = Sotrudniki.new(params[:sotrudniki])\n\n respond_to do |format|\n if @sotrudniki.save\n format.html { redirect_to @sotrudniki, notice: 'Sotrudniki was successfully created.' }\n format.json { render json: @sotrudniki, status: :created, location: @sotrudniki }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sotrudniki.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kazoku = Kazoku.new(params[:kazoku])\n\n respond_to do |format|\n if @kazoku.save\n format.html { redirect_to @kazoku, :notice => 'Kazoku was successfully created.' }\n format.json { render :json => @kazoku, :status => :created, :location => @kazoku }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @kazoku.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @aboutu = Aboutu.new(params[:aboutu])\n\n respond_to do |format|\n if @aboutu.save\n format.html { redirect_to @aboutu, notice: 'Aboutu was successfully created.' }\n format.json { render json: @aboutu, status: :created, location: @aboutu }\n else\n format.html { render action: \"new\" }\n format.json { render json: @aboutu.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n megam_rest.post_node(to_hash)\n end", "def create\n @nebulosa = Nebulosa.new(nebulosa_params)\n\n respond_to do |format|\n if @nebulosa.save\n format.html { redirect_to @nebulosa, notice: 'Nebulosa was successfully created.' }\n format.json { render :show, status: :created, location: @nebulosa }\n else\n format.html { render :new }\n format.json { render json: @nebulosa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @zaduzenja = Zaduzenja.new(zaduzenja_params)\n\n respond_to do |format|\n if @zaduzenja.save\n format.html { redirect_to @zaduzenja, notice: 'Zaduzenja was successfully created.' }\n format.json { render :show, status: :created, location: @zaduzenja }\n else\n format.html { render :new }\n format.json { render json: @zaduzenja.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @jugadore = Jugadore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jugadore }\n end\n end", "def create\n @gonullu = Gonullu.new(gonullu_params)\n\n respond_to do |format|\n if @gonullu.save\n format.html { redirect_to @gonullu, notice: 'Gonullu was successfully created.' }\n format.json { render :show, status: :created, location: @gonullu }\n else\n format.html { render :new }\n format.json { render json: @gonullu.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @utensilname = Utensilname.new(utensilname_params)\n\n respond_to do |format|\n if @utensilname.save\n format.html { redirect_to utensilnames_path }\n format.json { render :show, status: :created, location: @utensilname }\n else\n format.html { render :new }\n format.json { render json: @utensilname.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @klub = Klub.new(klub_params)\n\n respond_to do |format|\n if @klub.save\n format.html { redirect_to @klub, notice: 'Klub was successfully created.' }\n format.json { render :show, status: :created, location: @klub }\n else\n format.html { render :new }\n format.json { render json: @klub.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ulice = Ulice.new(ulice_params)\n\n respond_to do |format|\n if @ulice.save\n format.html { redirect_to @ulice, notice: 'Ulice was successfully created.' }\n format.json { render :show, status: :created, location: @ulice }\n else\n format.html { render :new }\n format.json { render json: @ulice.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jamaat = Jamaat.new(params[:jamaat])\n\n respond_to do |format|\n if @jamaat.save\n format.html { redirect_to @jamaat, notice: 'Jamaat was successfully created.' }\n format.json { render json: @jamaat, status: :created, location: @jamaat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @jamaat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ucastnik = Ucastnik.new(ucastnik_params)\n\n respond_to do |format|\n if @ucastnik.save\n format.html { redirect_to @ucastnik, notice: 'Ucastnik was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ucastnik }\n else\n format.html { render action: 'new' }\n format.json { render json: @ucastnik.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n post_params = {\n name: params[:name].downcase,\n units: params[:units] || 0\n }\n render json: Ingredient.create!(post_params), status: :created\n end", "def create\n @u_ser = USer.new(u_ser_params)\n\n respond_to do |format|\n if @u_ser.save\n format.html { redirect_to @u_ser, notice: 'U ser was successfully created.' }\n format.json { render :show, status: :created, location: @u_ser }\n else\n format.html { render :new }\n format.json { render json: @u_ser.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @unidad = current_user.empresa.unidades.new(unidad_params)\n\n respond_to do |format|\n if @unidad.save\n format.html { redirect_to @unidad, notice: 'Unidad was successfully created.' }\n format.json { render action: 'show', status: :created, location: @unidad }\n else\n format.html { render action: 'new' }\n format.json { render json: @unidad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @grupoassunto = Grupoassunto.new(grupoassunto_params)\n\n if @grupoassunto.save\n render json: @grupoassunto, status: :created, location: @grupoassunto\n else\n render json: @grupoassunto.errors, status: :unprocessable_entity\n end\n end", "def create\n @uasg = Uasg.new(uasg_params)\n\n respond_to do |format|\n if @uasg.save\n format.html { redirect_to @uasg, notice: 'Uasg was successfully created.' }\n format.json { render :show, status: :created, location: @uasg }\n else\n format.html { render :new }\n format.json { render json: @uasg.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cuentum = Cuentum.new(params[:cuentum])\n\n respond_to do |format|\n if @cuentum.save\n format.html { redirect_to @cuentum, :notice => 'Cuentum was successfully created.' }\n format.json { render :json => @cuentum, :status => :created, :location => @cuentum }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cuentum.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @nguoi_dung = NguoiDung.new(params[:nguoi_dung])\n\n respond_to do |format|\n if @nguoi_dung.save\n format.html { redirect_to @nguoi_dung, notice: 'Nguoi dung was successfully created.' }\n format.json { render json: @nguoi_dung, status: :created, location: @nguoi_dung }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nguoi_dung.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @ujumbes = Ujumbe.all.order('id DESC')\n @ujumbe = current_user.ujumbes.build if current_user\n @user = current_user\n end", "def create\n @keiyaku = Keiyaku.new(keiyaku_params)\n\n respond_to do |format|\n if @keiyaku.save\n format.html { redirect_to @keiyaku, notice: 'Keiyaku was successfully created.' }\n format.json { render :show, status: :created, location: @keiyaku }\n else\n format.html { render :new }\n format.json { render json: @keiyaku.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @interno_unidad = InternoUnidad.new(interno_unidad_params)\n\n respond_to do |format|\n if @interno_unidad.save\n format.html { redirect_to @interno_unidad, notice: 'Interno unidad was successfully created.' }\n format.json { render :show, status: :created, location: @interno_unidad }\n else\n format.html { render :new }\n format.json { render json: @interno_unidad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @data_ukt = DataUkt.new(data_ukt_params)\n\n respond_to do |format|\n if @data_ukt.save\n format.html { redirect_to @data_ukt, notice: 'Data ukt was successfully created.' }\n format.json { render :show, status: :created, location: @data_ukt }\n else\n format.html { render :new }\n format.json { render json: @data_ukt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jeon = Jeon.new(jeon_params)\n\n respond_to do |format|\n if @jeon.save\n format.html { redirect_to @jeon, notice: 'Jeon was successfully created.' }\n format.json { render :show, status: :created, location: @jeon }\n else\n format.html { render :new }\n format.json { render json: @jeon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tubuyaki = Tubuyaki.new(tubuyaki_params)\n @tubuyaki.user = current_user\n\n respond_to do |format|\n if @tubuyaki.save\n format.html { redirect_to tubuyakis_url, notice: 'Tweet was successfully created.' }\n format.json { render :show, status: :created, location: @tubuyaki }\n else\n @tubuyakis = Tubuyaki.all\n format.html { render :index }\n format.json { render json: @tubuyaki.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_unidad = TipoUnidad.new(tipo_unidad_params)\n\n respond_to do |format|\n if @tipo_unidad.save\n format.html { redirect_to @tipo_unidad, notice: 'Tipo unidad was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_unidad }\n else\n format.html { render :new }\n format.json { render json: @tipo_unidad.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kolegij = Kolegij.new(params[:kolegij])\n\n respond_to do |format|\n if @kolegij.save\n format.html { redirect_to @kolegij, notice: 'Kolegij was successfully created.' }\n format.json { render json: @kolegij, status: :created, location: @kolegij }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kolegij.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @question = Question.new(question_params)\n @question.zavrseno = \"N\"\n @question.user = @current_user\n @question.uposlenik = User.find(params[:uposlenik_id])\n respond_to do |format|\n if @question.save\n format.json { render json: @question, status: :created, location: api_question_url(@question) }\n else\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @current_bijou = current_rockhound;\n # @bijou = Bijou.new(bijou_params)\n\n @new_bijou = @current_bijou.bijous.build(bijou_params)\n\n respond_to do |format|\n if @new_bijou.save\n format.html { redirect_to @bijou, notice: 'Bijou was successfully created.' }\n format.json { render :show, status: :created, location: @bijou }\n else\n format.html { render :new }\n format.json { render json: @bijou.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @humanidades3 = Humanidades3.new(params[:humanidades3])\n\n respond_to do |format|\n if @humanidades3.save\n format.html { redirect_to @humanidades3, notice: 'Humanidades3 was successfully created.' }\n format.json { render json: @humanidades3, status: :created, location: @humanidades3 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @humanidades3.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @omikuji_result = OmikujiResult.new(omikuji_result_params).do_omikuji()\n\n respond_to do |format|\n if @omikuji_result.present? && @omikuji_result.save\n format.html { redirect_to \"/\" }\n format.json { render :show, status: :created, location: @omikuji_result }\n else\n format.html { redirect_to \"/\", notice: @omikuji_result.errors }\n format.json { render json: @omikuji_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @jornada = Jornada.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jornada }\n end\n end", "def create\n @municao = Municao.new(municao_params)\n\n respond_to do |format|\n if @municao.save\n format.html { redirect_to @municao, notice: 'A Munição foi criada com sucesso!' }\n format.json { render :show, status: :created, location: @municao }\n else\n format.html { render :new }\n format.json { render json: @municao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n p \"## TESTE #\" \n @mural_post = MuralPost.new( user_id: params[:user_id], \n latitude: params[:latitude], \n longitude: params[:longitude], \n message: params[:message],\n anonymous: params[:anonymous]\n )\n \n respond_to do |format|\n if @mural_post.save\n format.html { redirect_to @mural_post, notice: 'Mural post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mural_post }\n else\n p \"## ERRO #\" \n format.html { render action: 'new' }\n format.json { render json: @mural_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def post body=nil, headers={}\n @connection.post \"users.json\", body, headers\n end", "def post_messages!(hash)\n Net::HTTP.post_form(URI.parse(@target), {'data'=>hash.to_json})\n end" ]
[ "0.5899258", "0.5831015", "0.58132327", "0.5761867", "0.57289183", "0.5721775", "0.5714176", "0.5666874", "0.563716", "0.56321365", "0.56295097", "0.5614453", "0.56131285", "0.55882555", "0.55615354", "0.5559517", "0.5544938", "0.55387336", "0.5536661", "0.5529917", "0.55265677", "0.5522014", "0.5491547", "0.5486722", "0.54597855", "0.5454987", "0.5452326", "0.54467195", "0.5437963", "0.54291385", "0.5418162", "0.5415832", "0.5405472", "0.53970367", "0.5396251", "0.5394058", "0.53868604", "0.5386525", "0.53819686", "0.5379503", "0.537004", "0.5370034", "0.53681463", "0.5365578", "0.5357298", "0.53471476", "0.53398734", "0.5330958", "0.5326796", "0.53179777", "0.5315626", "0.5311587", "0.53103495", "0.5302344", "0.5300247", "0.5299947", "0.52983135", "0.52970093", "0.5290504", "0.52897054", "0.52874964", "0.5284785", "0.52755195", "0.52691805", "0.5269056", "0.5268248", "0.52679276", "0.5267303", "0.526725", "0.5265769", "0.5265678", "0.52642584", "0.52597344", "0.5250003", "0.524925", "0.52446514", "0.5243021", "0.5239851", "0.5234497", "0.5234082", "0.5233254", "0.5232184", "0.52314126", "0.5230906", "0.5229971", "0.5222208", "0.52184105", "0.52174354", "0.5216505", "0.5211895", "0.5208407", "0.52045625", "0.52038723", "0.51971185", "0.5196849", "0.5195667", "0.51942307", "0.5189616", "0.51868826", "0.5185151" ]
0.632247
0
PATCH/PUT /ujumbes/1 PATCH/PUT /ujumbes/1.json
def update @user = current_user respond_to do |format| if @ujumbe.update(ujumbe_params) format.html { redirect_to @ujumbe, notice: 'Ujumbe was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @ujumbe.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch!\n request! :patch\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "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 @u = U.find(params[:id])\n\n respond_to do |format|\n if @u.update_attributes(params[:u])\n format.html { render action: \"edit\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @u.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!(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 respond_to do |format|\n if @jugadore.update( jugadore_params )\n format.html { redirect_to @jugadore, notice: 'Jugadore was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @jugadore.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 @kumo.update(kumo_params)\n format.html { redirect_to kumos_path, notice: 'Kumo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kumo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "def restobooking\n @buchung = Buchung.find(params[:id])\n @buchung.status='B' \n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end \n end", "def update\n @jugador = Jugador.find(params[:id])\n @clubes = Club.all\n @equipos = Equipo.all\n respond_to do |format|\n if @jugador.update_attributes(params[:jugador])\n format.html { redirect_to @jugador, notice: 'Jugador fue actualizado adecuadamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jugador.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fucker = Fucker.find(params[:id])\n\n respond_to do |format|\n if @fucker.update_attributes(params[:fucker])\n format.json { head :no_content }\n else\n format.json { render json: @fucker.errors, status: :internal_server_error }\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 update\n respond_to do |format|\n if @zf_bjietu.update(zf_bjietu_params)\n format.html { redirect_to @zf_bjietu, notice: 'Zf bjietu was successfully updated.' }\n format.json { render :show, status: :ok, location: @zf_bjietu }\n else\n format.html { render :edit }\n format.json { render json: @zf_bjietu.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @kolegij = Kolegij.find(params[:id])\n\n respond_to do |format|\n if @kolegij.update_attributes(params[:kolegij])\n format.html { redirect_to @kolegij, notice: 'Kolegij was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kolegij.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @jogo.update(jogo_params)\n format.html { redirect_to @jogo, notice: 'Jogo was successfully updated.' }\n format.json { render :show, status: :ok, location: @jogo }\n else\n format.html { render :edit }\n format.json { render json: @jogo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ukol.update(ukol_params)\n format.html { redirect_to @ukol, notice: 'Ukol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ukol.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end", "def update(data = :object || :json)\n end", "def update\n @kolegiji = Kolegiji.find(params[:id])\n\n respond_to do |format|\n if @kolegiji.update_attributes(params[:kolegiji])\n format.html { redirect_to @kolegiji, notice: 'Kolegiji was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kolegiji.errors, status: :unprocessable_entity }\n end\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\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 update\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n if @uchronia.update_attributes(params[:uchronia])\n format.html { redirect_to @uchronia, notice: 'Uchronia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @uchronia.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.find(params[:id])\n \n #Sicherstellen, dass Benutzer synchronisiert wird auch wenn nur Objekt-Zuordnungen anders sind!\n @benutzer.updated_at = DateTime.now \n\n if bNode.xpath('objekt_zuordnungs').length > 0\n @benutzer.setze_objekt_zuordnungen(bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i})\n end\n if @benutzer.update(benutzer_params(bNode))\n success(nil)\n else\n error(@benutzer.errors)\n end\n end", "def update\n render json: Post.update(params[\"id\"], params[\"post\"])\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 @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 @alumno = Alumno.find(params[:id])\n\n respond_to do |format|\n if @alumno.update_attributes(params[:alumno])\n head :no_content\n else\n render json: @alumno.errors, status: :unprocessable_entity\n end\n end\n end", "def update\n @jamaat = Jamaat.find(params[:id])\n\n respond_to do |format|\n if @jamaat.update_attributes(params[:jamaat])\n format.html { redirect_to @jamaat, notice: 'Jamaat was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jamaat.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n end", "def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def update\n put :update\n end", "def update\n \n\n respond_to do |format|\n if @huati.update_attributes(params[:huati])\n format.html { redirect_to @huati, notice: 'Huati was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @huati.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @jornada = Jornada.find(params[:id])\n\n respond_to do |format|\n if @jornada.update_attributes(params[:jornada])\n format.html { redirect_to jornadas_path, notice: 'La jornada se ha actualizado correctamente' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jornada.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bla = Bla.find(params[:id])\n\n respond_to do |format|\n if @bla.update_attributes(params[:bla])\n format.html { redirect_to @bla, :notice => 'Bla was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bla.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_with []\n end", "def update\n respond_to do |format|\n if @tubuyaki.update(tubuyaki_params)\n format.html { redirect_to @tubuyaki, notice: 'Tubuyaki was successfully updated.' }\n format.json { render :show, status: :ok, location: @tubuyaki }\n else\n format.html { render :edit }\n format.json { render json: @tubuyaki.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 respond_to do |format|\n if @kontum.update(kontum_params)\n format.html { redirect_to @kontum, notice: 'Kontum was successfully updated.' }\n format.json { render :show, status: :ok, location: @kontum }\n else\n format.html { render :edit }\n format.json { render json: @kontum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @jugadore.update(jugadore_params)\n format.html { redirect_to @jugadore, notice: 'Jugadore was successfully updated.' }\n format.json { render :show, status: :ok, location: @jugadore }\n else\n format.html { render :edit }\n format.json { render json: @jugadore.errors, status: :unprocessable_entity }\n end\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 @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.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\n respond_to do |format|\n if @jio.update(jio_params)\n format.html { redirect_to @jio, notice: 'Jio was successfully updated.' }\n format.json { render :show, status: :ok, location: @jio }\n else\n format.html { render :edit }\n format.json { render json: @jio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kela.update(kela_params)\n format.html { redirect_to @kela, notice: 'Kela was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kela.errors, status: :unprocessable_entity }\n end\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_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @giang_vien = GiangVien.find(params[:id])\n\n respond_to do |format|\n if @giang_vien.update_attributes(params[:giang_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @giang_vien.errors, status: :unprocessable_entity }\n end\n end\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 @kraj = Kraj.find(params[:id])\n\n respond_to do |format|\n if @kraj.update_attributes(params[:kraj])\n format.html { redirect_to @kraj, notice: 'Kraj was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kraj.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @jednani.update(jednani_params)\n format.html { redirect_to @jednani, notice: 'Jednani was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @jednani.errors, status: :unprocessable_entity }\n end\n end\n end", "def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\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 update\n respond_to do |format|\n if @umbrella.update(umbrella_params)\n format.html { redirect_to @umbrella, notice: 'Umbrella was successfully updated.' }\n format.json { render :show, status: :ok, location: @umbrella }\n else\n format.html { render :edit }\n format.json { render json: @umbrella.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n head :ok\n end", "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 @lieu = Lieu.find(params[:id])\n\n respond_to do |format|\n if @lieu.update_attributes(params[:lieu])\n format.html { redirect_to @lieu, notice: 'Lieu was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lieu.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @usuario = Usuario.find_by_id(params[:id])\n if @usuario.nil?\n render :json => {:error => \"Usuario no encontrado\"}.to_json, :status => 404\n\n #render :json => {:error => \"id no es modificable\"}.to_json, :status => 400\n else\n if usuario_params.count==1\n respond_to do |format|\n # format.json { render json: usuario_params.count}\n if @usuario.update(usuario_params)\n #format.json { render json: @usuario}\n\n #format.html { redirect_to @usuario, notice: 'Usuario was successfully updated.' }\n #el segundo\n format.json { render :show, status: :ok, location: @usuario }\n end\n end\n elsif usuario_params.count==0\n # JSON.parse(usuario_params)\n respond_to do |format|\n format.json { render :json => {:error => \"id no es modificable\"}.to_json, :status => 400 }\n end\n else\n respond_to do |format|\n format.json { render :json => {:error => \"La modificación ha fallado\"}.to_json, :status => 500 }\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @kemboi.update(kemboi_params)\n format.html { redirect_to @kemboi, notice: 'Kemboi was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kemboi.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end", "def update\n respond_to do |format|\n if @jusho.update(jusho_params)\n format.html { redirect_to @jusho, notice: 'Jusho was successfully updated.' }\n format.json { render :show, status: :ok, location: @jusho }\n else\n format.html { render :edit }\n format.json { render json: @jusho.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bunny.update(bunny_params)\n format.html { redirect_to @bunny, notice: 'Bunny was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bunny.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @uset = Uset.find(params[:id])\n\n respond_to do |format|\n if @uset.update_attributes(params[:uset])\n format.html { redirect_to @uset, notice: 'Uset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @uset.errors, status: :unprocessable_entity }\n end\n end\n end", "def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end", "def update\n name = params[:name]\n description = params[:description]\n label_id = params[:id]\n label = Label.where(id: label_id).first\n\n if label.blank?\n render json: {message: \"label_id không đúng!\"}, status: :unprocessable_entity\n return\n else\n label.name = name unless name.blank?\n label.description = description unless description.blank?\n\n if label.save\n render json: {message: \"success!\"}\n return\n else\n render json: {message: \"Không lưu được data!\"}, status: :unprocessable_entity\n return\n end\n end\n end", "def update\n respond_to do |format|\n if @kofu.update(kofu_params)\n format.html { redirect_to @kofu, notice: 'Kofu was successfully updated.' }\n format.json { render :show, status: :ok, location: @kofu }\n else\n format.html { render :edit }\n format.json { render json: @kofu.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n retorno = {erro: \"322\" ,body: \"\"}\n if @usuario.update(valid_request?)\n retorno = {erro: \"000\", body: {evento_id: @usuario.id, usuario_nome: @usuario.nome}}\n end\n render json: retorno.to_json\n end", "def update\n @koti = Koti.find(params[:id])\n\n respond_to do |format|\n if @koti.update_attributes(params[:koti])\n format.html { redirect_to @koti, notice: 'Koti was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @koti.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @eou = Eou.find(params[:id])\n\n respond_to do |format|\n if @eou.update_attributes(params[:eou])\n format.html { redirect_to @eou, :notice => 'Eou was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @eou.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def update\n @testmonial = Testmonial.find(params[:id])\n\n if @testmonial.update(testmonial_params)\n head :no_content\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @klub.update(klub_params)\n format.html { redirect_to @klub, notice: 'Klub was successfully updated.' }\n format.json { render :show, status: :ok, location: @klub }\n else\n format.html { render :edit }\n format.json { render json: @klub.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n format.json { render json: { status: :not_implemented } }\n end\n end", "def update\n @ufile = Ufile.find(params[:id])\n\n respond_to do |format|\n if @ufile.update_attributes(params[:ufile])\n format.html { redirect_to @ufile, notice: 'Ufile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ufile.errors, status: :unprocessable_entity }\n end\n end\n end", "def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end", "def update\n @kifu = Kifu.find(params[:id])\n\n respond_to do |format|\n if @kifu.update_attributes(params[:kifu])\n format.html { redirect_to @kifu, :notice => 'Kifu was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @kifu.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @urij.update(urij_params)\n format.html { redirect_to @urij, notice: 'Urij was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @urij.errors, status: :unprocessable_entity }\n end\n end\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 authorize! :edit, @questionnaire\n\n @questionnaire.load_JSON(params[:questionnaire], current_user)\n\n respond_to do |format|\n# if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Kysymyslomakkeen muokkaaminen onnistui.' }\n format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n# end\n\n end\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_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend", "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 @lob = Lob.find(params[:id])\n\n if @lob.update(lob_params)\n head :no_content\n else\n render json: @lob.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @bottle.update(bottle_params)\n format.html { redirect_to user_path(current_user.id), notice: 'Bottle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bottle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @klienci_jaskula.update(klienci_jaskula_params)\n format.html { redirect_to @klienci_jaskula, notice: 'Klienci jaskula was successfully updated.' }\n format.json { render :show, status: :ok, location: @klienci_jaskula }\n else\n format.html { render :edit }\n format.json { render json: @klienci_jaskula.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.64748055", "0.6399838", "0.63940495", "0.63187706", "0.6158683", "0.61522", "0.6146853", "0.6127007", "0.6119372", "0.6103074", "0.6072663", "0.6051205", "0.6050366", "0.6031628", "0.6014028", "0.6013454", "0.6002131", "0.5991991", "0.5982133", "0.59658694", "0.5964316", "0.5955747", "0.5955747", "0.59489834", "0.59467363", "0.5936792", "0.5928424", "0.5911053", "0.59089506", "0.58906144", "0.5887005", "0.58839315", "0.5883", "0.58822554", "0.58775926", "0.5875599", "0.58664817", "0.58652663", "0.5859842", "0.5847597", "0.5847212", "0.584441", "0.58426493", "0.5834613", "0.5831381", "0.5831346", "0.5830813", "0.5818369", "0.58178186", "0.5817009", "0.58142656", "0.58139265", "0.58126086", "0.5806646", "0.5806646", "0.57995397", "0.5798194", "0.5789167", "0.57862973", "0.57862973", "0.57859427", "0.57788616", "0.5776813", "0.5774271", "0.5773797", "0.5767517", "0.5764811", "0.57579815", "0.57530135", "0.57525784", "0.5752466", "0.574755", "0.5742543", "0.57399064", "0.57396144", "0.5737888", "0.5737286", "0.5737127", "0.57364005", "0.57347393", "0.5730979", "0.57298064", "0.57251394", "0.572466", "0.572466", "0.57233465", "0.57219213", "0.57203543", "0.5717075", "0.5711677", "0.570922", "0.5708889", "0.5706455", "0.57063824", "0.5703013", "0.5703013", "0.5703013", "0.5699867", "0.5699263", "0.569911" ]
0.5842808
42
DELETE /ujumbes/1 DELETE /ujumbes/1.json
def destroy @ujumbe.destroy respond_to do |format| format.html { redirect_to ujumbes_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @jednani.destroy\n respond_to do |format|\n format.html { redirect_to jednanis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kumo.destroy\n respond_to do |format|\n format.html { redirect_to kumos_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @uginuce.sheep.update status:'na farmi'\n @uginuce.destroy\n respond_to do |format|\n format.html { redirect_to uginuces_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @unidad.destroy\n respond_to do |format|\n format.html { redirect_to unidades_url }\n format.json { head :no_content }\n end\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @jugadore.destroy\n respond_to do |format|\n format.html { redirect_to jugadores_url, notice: 'Jugadore was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @jugadore.destroy\n respond_to do |format|\n format.html { redirect_to jugadores_url }\n format.json { head :no_content }\n format.js\n end\n end", "def destroy\n @jornada = Jornada.find(params[:id])\n @jornada.destroy\n\n respond_to do |format|\n format.html { redirect_to jornadas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @humanidades3 = Humanidades3.find(params[:id])\n @humanidades3.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades3s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @giang_vien = GiangVien.find(params[:id])\n @giang_vien.destroy\n\n respond_to do |format| \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 delete\n request(:delete)\n end", "def destroy\n @bijou.destroy\n respond_to do |format|\n format.html { redirect_to bijous_url, notice: 'Bijou was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def destroy\n @tubuyaki.destroy\n respond_to do |format|\n format.html { redirect_to tubuyakis_url, notice: 'Tubuyaki was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @uranium_j.destroy\n respond_to do |format|\n format.html { redirect_to uranium_js_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @zf_bjietu.destroy\n respond_to do |format|\n format.html { redirect_to zf_bjietus_url, notice: 'Zf bjietu was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lob.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @umbrella.destroy\n respond_to do |format|\n format.html { redirect_to umbrellas_url, notice: 'Umbrella was successfully destroyed.' }\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 @diemtrentuyen = Diemtrentuyen.find(params[:id])\n @diemtrentuyen.destroy\n\n respond_to do |format|\n format.html { redirect_to diemtrentuyens_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @lieu = Lieu.find(params[:id])\n @lieu.destroy\n\n respond_to do |format|\n format.html { redirect_to lieus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @sotrudniki = Sotrudniki.find(params[:id])\n @sotrudniki.destroy\n\n respond_to do |format|\n format.html { redirect_to sotrudnikis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kontum.destroy\n respond_to do |format|\n format.html { redirect_to konta_url, notice: 'Kontum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bakusokukun.destroy\n respond_to do |format|\n format.html { redirect_to bakusokukuns_url, notice: 'Bakusokukun was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @jugadalot.destroy\n respond_to do |format|\n format.html { redirect_to new_jugadalot_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @exura = Exura.find(params[:id])\n @exura.destroy\n\n respond_to do |format|\n format.html { redirect_to exuras_url }\n format.json { head :no_content }\n end\n end", "def delete!\n request! :delete\n end", "def destroy\n @kolegij = Kolegij.find(params[:id])\n @kolegij.destroy\n\n respond_to do |format|\n format.html { redirect_to kolegijs_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n @jamaat = Jamaat.find(params[:id])\n @jamaat.destroy\n\n respond_to do |format|\n format.html { redirect_to jamaats_url }\n format.json { head :ok }\n end\n end", "def destroy\n @kolegiji = Kolegiji.find(params[:id])\n @kolegiji.destroy\n\n respond_to do |format|\n format.html { redirect_to kolegijis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nguoi_dung = NguoiDung.find(params[:id])\n @nguoi_dung.destroy\n\n respond_to do |format|\n format.html { redirect_to nguoi_dungs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @uchronist = Uchronist.find(params[:id])\n @uchronist.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bicicletum.destroy\n respond_to do |format|\n format.html { redirect_to bicicleta_url }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @uset = Uset.find(params[:id])\n @uset.destroy\n\n respond_to do |format|\n format.html { redirect_to usets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nominee.destroy\n respond_to do |format|\n format.html { redirect_to nominees_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_haiku = Api::Haiku.find(params[:id])\n @api_haiku.destroy\n\n respond_to do |format|\n format.html { redirect_to api_haikus_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @zakaz = Zakaz.find(params[:id])\n @zakaz.destroy\n\n respond_to do |format|\n format.html { redirect_to zakazs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end", "def destroy \n @buchung = Buchung.find(params[:id])\n @buchung.destroy\n\n respond_to do |format|\n format.html { redirect_to buchungs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @one = One.find(params[:id])\n @one.destroy\n\n respond_to do |format|\n format.html { redirect_to ones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shujukujiaoben.destroy\n respond_to do |format|\n format.html { redirect_to shujukujiaobens_url, notice: 'Shujukujiaoben was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @unova.destroy\n respond_to do |format|\n format.html { redirect_to unovas_url, notice: 'Unova was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @u = U.find_by_name(params[:id])\n @u.destroy\n\n respond_to do |format|\n format.html { redirect_to us_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @chaine = Chaine.find(params[:id])\n @chaine.destroy\n\n respond_to do |format|\n format.html { redirect_to chaines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @three.destroy\n respond_to do |format|\n format.html { redirect_to threes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @jusho.destroy\n respond_to do |format|\n format.html { redirect_to jushos_url, notice: 'Jusho was successfully destroyed.' }\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 @albumone.destroy\n respond_to do |format|\n format.html { redirect_to albumones_url, notice: 'Albumone was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\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 destroy\n @repuestum = Repuestum.find(params[:id])\n @repuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to repuesta_url }\n format.json { head :no_content }\n end\n end", "def delete\n api(\"Delete\")\n end", "def destroy\n @eou = Eou.find(params[:id])\n @eou.destroy\n\n respond_to do |format|\n format.html { redirect_to eous_url }\n format.json { head :ok }\n end\n end", "def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gran_unidad.destroy\n respond_to do |format|\n format.html { redirect_to gran_unidad_index_url }\n format.json { head :no_content }\n end\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 @kazoku = Kazoku.find(params[:id])\n @kazoku.destroy\n\n respond_to do |format|\n format.html { redirect_to kazokus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ufile = Ufile.find(params[:id])\n @ufile.destroy\n\n respond_to do |format|\n format.html { redirect_to ufiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @status_akun.destroy\n respond_to do |format|\n format.html { redirect_to status_akun_index_url, notice: 'Status akun was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @three60.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_good_url(@good, anchor: \"three60\") }\n format.json { head :no_content }\n end\n end", "def delete(url, headers={})\n RestClient.delete url, headers\n end", "def destroy\n seleccionarMenu(:juzgados)\n @juzgado = Juzgado.find(params[:id])\n @juzgado.destroy\n\n respond_to do |format|\n format.html { redirect_to juzgados_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kansei_buhin = KanseiBuhin.find(params[:id])\n @kansei_buhin.destroy\n\n respond_to do |format|\n format.html { redirect_to kansei_buhins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testis = Teste.find(params[:id])\n @testis.destroy\n\n respond_to do |format|\n format.html { redirect_to testes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kela.destroy\n respond_to do |format|\n format.html { redirect_to kelas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ulica.destroy\n respond_to do |format|\n format.html { redirect_to ulicas_url, notice: 'Ulica was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n \n @huati.destroy\n\n respond_to do |format|\n format.html { redirect_to manage_huatis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @riyu_okunai.destroy\n respond_to do |format|\n format.html { redirect_to riyu_okunais_url, notice: 'Riyu okunai was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @etiquetum.destroy\n respond_to do |format|\n format.html { redirect_to etiqueta_url, notice: 'Etiqueta borrada!' }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n 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 destroy\n @uang_masuk.destroy\n respond_to do |format|\n format.html { redirect_to uang_masuks_url, notice: 'Uang masuk was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @uen.destroy\n respond_to do |format|\n format.html { redirect_to uens_url, notice: 'Uen was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sluzby = Sluzby.find(params[:id])\n @sluzby.destroy\n\n respond_to do |format|\n format.html { redirect_to sluzbies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lich_su_binh_bau = LichSuBinhBau.find(params[:id])\n @lich_su_binh_bau.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_lich_su_binh_baus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @teste_anamnese.destroy\n respond_to do |format|\n format.html { redirect_to teste_anamneses_url }\n format.json { head :no_content }\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def delete\n render json: Users.delete(params[\"id\"])\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def delete_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end" ]
[ "0.7217802", "0.7060332", "0.6929222", "0.68824005", "0.68503314", "0.6815148", "0.68062234", "0.6800676", "0.67934513", "0.67811805", "0.6777375", "0.67736965", "0.67726445", "0.67614836", "0.6754899", "0.6754666", "0.6753272", "0.674698", "0.67368186", "0.67328006", "0.6728602", "0.6724773", "0.6723703", "0.6715232", "0.6714088", "0.67088735", "0.67088735", "0.67088735", "0.67088735", "0.6703959", "0.6702427", "0.66978496", "0.6694148", "0.6692628", "0.6690157", "0.6686301", "0.6686232", "0.6685309", "0.66833675", "0.6679839", "0.6675742", "0.6673624", "0.6672895", "0.6670314", "0.66672605", "0.6665686", "0.6661938", "0.66615486", "0.6661056", "0.66600937", "0.6651649", "0.6649598", "0.66437733", "0.66387683", "0.6637059", "0.6637059", "0.6636626", "0.6635222", "0.6632134", "0.66308373", "0.66295487", "0.6629415", "0.6628386", "0.6625849", "0.66239387", "0.66233295", "0.6623285", "0.6620228", "0.6619461", "0.6619045", "0.6618477", "0.6618372", "0.6616853", "0.6615768", "0.6615768", "0.6615045", "0.66146106", "0.6613901", "0.6606492", "0.6605629", "0.6597184", "0.6595619", "0.6594078", "0.65923697", "0.6591006", "0.65887856", "0.6587208", "0.6585244", "0.65839404", "0.6583516", "0.6582397", "0.6581982", "0.6580101", "0.6578747", "0.65784836", "0.6575179", "0.65744627", "0.6574259", "0.6573505", "0.65725017" ]
0.74149317
0
Use callbacks to share common setup or constraints between actions.
def set_ujumbe @ujumbe = Ujumbe.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 ujumbe_params params.require(:ujumbe).permit(:title, :theme, :date, :description, :link, :type, :private, :what, :why, :how, :budget, :funding, :theme_ressources, :theme_education, :theme_housing, :theme_environnement, :theme_culture, :theme_economy, :theme_social, :theme_security, :theme_scientific, :theme_foreign, :image) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
outputs help for this command argv = commandline arguments
def cmd_help argv help end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_cli_help argv\n setup argv\n msg run_cmd(\"help\")\n end", "def cmd_help(*args)\n\t\tprint(shell.help_to_s)\n\tend", "def help(argm)\n\tif(argm)\n\t\tputs \"Commands:\"\n\t\tprintf \"%-15s %-6s %-10s # Shows the list of commands available\\n\", \n\t\tFile.basename(__FILE__), \"help\", \"\"\n\t\tprintf \"%-15s %-6s %-10s # Load a XML file\\n\", \n\t\tFile.basename(__FILE__), \"-xml\", \"[filename]\"\n\t\tprintf \"%-15s %-6s %-10s # Allows you to search\\n\", \n\t\tFile.basename(__FILE__), \"list\", \"\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for ip\\n\", \n\t\t\"\", \"\", \"--ip\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for name(first and/or last)\\n\", \n\t\t\"\", \"\", \"--name\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for email\\n\", \n\t\t\"\", \"\", \"--email\"\n\t\texit\n\tend\nend", "def help(*args)\n help_on = args.first || :help\n print send(\"#{help_on}_options\")\n end", "def help(argm)\n\tif(argm)\n\t\tputs \"Commands:\"\n\t\tprintf \"%-15s %-6s %-10s # Shows the list of commands available\\n\", \n\t\tFile.basename(__FILE__), \"help\", \"\"\n\t\tprintf \"%-15s %-6s %-10s # Load a XML file\\n\", \n\t\tFile.basename(__FILE__), \"-xml\", \"[filename]\"\n\t\tprintf \"%-15s %-6s %-10s # Allows you to search\\n\", \n\t\tFile.basename(__FILE__), \"list\", \"\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for ip\\n\", \n\t\t\"\", \"\", \"--ip\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for name(first and/or last)\\n\", \n\t\t\"\", \"\", \"--name\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for email\\n\", \n\t\t\"\", \"\", \"--email\"\n\t\tprintf \"%-15s %-6s %-10s # Allows you to search before a date\\n\", \n\t\tFile.basename(__FILE__), \"before\", \"[date]\"\n\t\tprintf \"%-15s %-6s %-10s # Allows you to search after a date\\n\", \n\t\tFile.basename(__FILE__), \"after\", \"[date]\"\n\t\tprintf \"%-15s %-6s %-10s # Allows you to search for emails sent \"+\n\t\t\"on a day of the week\\n\",\n\t\tFile.basename(__FILE__), \"--day\", \"[day]\"\n\t\texit\n\tend\nend", "def help\n parse_command_line(['--help'])\n end", "def help\n parse_command_line(['--help'])\n end", "def help()\n $stderr.puts \"Usage: ruby __.rb -x cross_match_output -r reference.fasta -o prefix_of_output [-m minscore -s max_substitution -g max_gap] [-c]\"\nend", "def help\n command_object.display_usage(cli.command)\n exit\n end", "def help(*args)\n if args.count == 0\n puts <<-HEREDOC\n\nThis script (#{File.basename($0)}) converts back and forth between GNU gettext\nPO files preferred by localizers and Tidy's language header H files which\nensure that Tidy stays small and cross-platform.\n\nAll output files are placed into the current working directory using a file name\nappropriate to the operation being performed.\n\nComplete Help:\n--------------\n HEREDOC\n end\n\n super\n end", "def help(*args)\n runner(['help', *args]).cmd.help\n rescue\n end", "def help\n puts @option_parser\n exit\n end", "def help #:nodoc:\n Writer.help( { :banner => @@banner, :header => @@header,\n :options => @@options, :footer => @@footer },\n output_to, exit_on_help? )\n end", "def help(*args)\n if args.count == 0\n test_runner = TestRunner.new\n set_options(test_runner)\n message_tidy = \"version #{test_runner.tidy.version}\"\n message_cases = File.exists?(test_runner.dir_cases) ? '' : '(directory not found; test will not run)'\n message_results = File.exists?(test_runner.dir_results) ? '(will try to use)' : '(will try to create)'\n puts <<-HEREDOC\n\nThis script (#{File.basename($0)}) is a Tidy regression testing script that can execute\nevery test in the suite, or optionally individual files. It also has the ability\nto generate new benchmark files into the suite.\n\nDefault Locations:\n------------------\n Tidy: #{ test_runner.tidy.path }, #{ message_tidy }\n Cases: #{ test_runner.dir_cases } #{ message_cases }\n Results: #{ test_runner.dir_results } #{ message_results }\n \nYou can also run this help command with the --tidy, --cases, and/or --results\noptions to test them, and check the results in the table above.\n\nComplete Help:\n--------------\n HEREDOC\n end\n\n super\n end", "def help\n\t\tself.usage(false)\n\t\texit EX_OK\n\tend", "def show_help\n puts 'usage: '\n puts 'a, -a :List all interfaces and their Addresses'\n puts 'l, -l :List all interface names'\n puts 'n, -n :List interface netmask settings'\n puts 'b, -b :List interface broadcast info....err'\n puts 'h, -h :Show this message'\n puts 'o, -o :Show operating system'\nend", "def handle_help\n if (ARGV.length >= 1) && is_help_flag?(ARGV[0])\n puts \"Detailed Instructions on application use can be found in the README.md file.\"\n puts \"Look under the Installation heading for more information!\"\n exit\n else\n # Continue as normal\n end\n end", "def help\n\tputs <<-EOH\nUsage: #{$PROGRAM_NAME} <option> [name]\n options:\n\t-s\t--show\tshow instructions to install package specified by name\n\t-l\t--list\tlist available packages\n\t-h\t--help\tshow this help message and exit\n\tEOH\n\t0\nend", "def display_help\n print(\n \"\n\nruby fuzzer.rb [discover | test] url OPTIONS\n\nCOMMANDS:\n discover Output a comprehensive, human-readable list of all discovered inputs to the system. Techniques include both crawling and guessing.\n test Discover all inputs, then attempt a list of exploit vectors on those inputs. Report potential vulnerabilities.\n\nOPTIONS:\n --custom-auth=string Signal that the fuzzer should use hard-coded authentication for a specific application (e.g. dvwa). Optional.\n\n Discover options:\n --common-words=file Newline-delimited file of common words to be used in page guessing and input guessing. Required.\n\n Test options:\n --vectors=file Newline-delimited file of common exploits to vulnerabilities. Required.\n --sensitive=file Newline-delimited file data that should never be leaked. It's assumed that this data is in the application's database (e.g. test data), but is not reported in any response. Required.\n --slow=1 Number of seconds considered when a response is considered \\\"slow\\\". Default is 1 second\n\nExamples:\n # Discover inputs\n fuzz discover http://localhost:8080 --common-words=mywords.txt\n\n # Discover inputs to DVWA using our hard-coded authentication\n fuzz discover http://localhost:8080 --common-words=mywords.txt\n\n \")\n exit\nend", "def help\n puts \"Usage: #{@name} #{@generator_name} [options] [args]\"\n puts ''\n puts @generator_class.desc\n puts ''\n puts @options[:opts]\n puts ''\n exit\n end", "def help args\n if @actions.nil? \n if defined? @commands\n unless @commands.empty?\n @actions = @commands\n end\n end\n end\n if @actions\n puts \"Actions are \"\n @actions.each_pair { |name, val| puts \"#{name}\\t#{val}\" }\n end\n puts \" \"\n if @aliases\n puts \"Aliases are \"\n @aliases.each_pair { |name, val| puts \"#{name}:\\t#{val.join(' ')}\" }\n end\n 0\n end", "def help args\n if @actions.nil? \n if defined? @commands\n unless @commands.empty?\n @actions = @commands\n end\n end\n end\n if @actions\n puts \"Actions are \"\n @actions.each_pair { |name, val| puts \"#{name}\\t#{val}\" }\n end\n puts \" \"\n if @aliases\n puts \"Aliases are \"\n @aliases.each_pair { |name, val| puts \"#{name}:\\t#{val.join(' ')}\" }\n end\n 0\n end", "def help source=nil, argv=nil\n argv = Array(argv || ARGV)\n limit = argv.index('--') || argv.length\n index = [argv.index('-h'), argv.index('--help')].compact.min\n if index and index < limit\n show source, argv[index + 1]\n exit\n end\n end", "def work(argv)\n # all -h equivalent to --help\n argv = argv.map { |a| a == '-h' ? '--help' : a }\n idx = argv.index { |c| !c.start_with?('-') }\n preoption = idx.nil? ? argv.shift(argv.size) : argv.shift(idx)\n\n # handle --version or --help or nothing\n return show(\"SeccompTools Version #{SeccompTools::VERSION}\") if preoption.include?('--version')\n return show(USAGE) if idx.nil?\n\n # let's handle commands\n cmd = argv.shift\n argv = %w[--help] if preoption.include?('--help')\n return show(invalid(cmd)) if COMMANDS[cmd].nil?\n\n COMMANDS[cmd].new(argv).handle\n end", "def short_help\n execute_string(\"-help\")\n end", "def show_help(*args)\n args_def.show_help(*args)\n end", "def help_help\t# :nodoc:\n\t\t\"#{@program_name} -cmd help\\n\\tShow this message\\n\"\n\tend", "def help\n h = []\n h << \"Usage: forge [COMMAND] [OPTIONS ...]\"\n h << \"\"\n h << \"COMMANDS:\"\n h << \" touch login and logout to test connection\"\n h << \" release release package(s)\"\n h << \" announce make an announcement\"\n h << \" publish publish website\"\n h << \"\"\n h << \"Add --help after command to learn more about each.\"\n puts h.join(\"\\n\")\n end", "def display_help\n print(\n \"\n\nruby fuzzer.rb [discover | test] url OPTIONS\n\nCOMMANDS:\n discover Output a comprehensive, human-readable list of all discovered inputs to the system. Techniques include both crawling and guessing.\n test Discover all inputs, then attempt a list of exploit vectors on those inputs. Report potential vulnerabilities.\n\nOPTIONS:\n --custom-auth=string Signal that the fuzzer should use hard-coded authentication for a specific application (e.g. dvwa). Optional.\n\n Discover options:\n --common-words=file Newline-delimited file of common words to be used in page guessing and input guessing. Required.\n\n Test options:\n --vectors=file Newline-delimited file of common exploits to vulnerabilities. Required.\n --sensitive=file Newline-delimited file data that should never be leaked. It's assumed that this data is in the application's database (e.g. test data), but is not reported in any response. Required.\n --random=[true|false] When off, try each input to each page systematically. When on, choose a random page, then a random input field and test all vectors. Default: false.\n --slow=500 Number of milliseconds considered when a response is considered \\\"slow\\\". Default is 500 milliseconds\n\nExamples:\n # Discover inputs\n fuzz discover http://localhost:8080 --common-words=mywords.txt\n\n # Discover inputs to DVWA using our hard-coded authentication\n fuzz discover http://localhost:8080 --common-words=mywords.txt\n\n # Discover and Test DVWA without randomness\n fuzz test http://localhost:8080 --custom-auth=dvwa --common-words=words.txt --vectors=vectors.txt --sensitive=creditcards.txt --random=false\\n\"\n )\n exit\nend", "def help(shell)\n shell.say \"Usage:\"\n shell.say \" #{banner}\\n\"\n shell.say\n class_options_help(shell)\n shell.say desc if desc\n end", "def show_help(opts)\n puts opts\n exit 0\nend", "def show_help(opts)\n puts opts\n exit 0\nend", "def help\n end", "def do_help(commands)\n return commands.usage\n end", "def call(*args)\n puts parser.help\n exit 1\n end", "def output_help\n RDoc::usage()\n end", "def usage\n\t\t$stderr.printf \"usage: %s [ options ]\\n\",$0\n\t\t$stderr.printf \"\\n%s\\n\",$help\n\t\texit 0\n\tend", "def help\n base = [\"Usage: houst [action] [optional parameter]\"]\n\n @commands.each do |command|\n base << \"\\t#{command[:name]}: \\t#{command[:description]}\"\n end\n\n base << \"\\nAdditional help can be obtained by using\\n\\thoust help [command]\\n\"\n\n base.join \"\\n\"\n end", "def print_help\n puts 'Here is a list of available commands:'\n puts '- new - Create a new contact'\n puts '- list - List all contacts'\n puts '- show - Show a contact'\n puts '- find - Find a contact'\n end", "def print_help()\n\tprint \"novnc_tokens.rb [OPTION]\n\n\t\t-h, --help:\n\t\t\tshow help\n\n\t\t-a [abiquo_api_url] -u [username] -p [password] -f [outfile]\n\n\t\t[abiquo_api_url] needs to be the url to the API resoure. ie. \\\"https://my_abiquo/api\\\"\n\"\nend", "def help\n @out.puts <<-MSG\n\n Usage:\n docbones -h/--help\n docbones -v/--version\n docbones command [options] [arguments]\n\n Commands:\n docbones create create a new project from a skeleton\n docbones freeze create a new skeleton in ~/.mrdocbones/\n docbones unfreeze remove a skeleton from ~/.mrdocbones/\n docbones info show information about available skeletons\n\n Further Help:\n Each command has a '--help' option that will provide detailed\n information for that command.\n\n http://www.ossxp.com\n\n MSG\n nil\n end", "def help\n puts \"The Ruby Farm - a simple command line animals app\"\n puts\n puts \"Usage:\"\n puts \" bin/run [command]\"\n puts\n puts \"Available Commands:\"\n puts \" [list | l] <age=> <type=> list all available animals\"\n puts \" [create | c] <name=> <type=> create a animal with name\"\n puts \" [delete | d] <name=> delete a animal\"\n puts \" [search | s] <name=> search a animal\"\n puts \" [food | f] <name=> give food to a animal\"\n puts \" [wash | w] <name=> give a shower to a animal\"\n puts \" [alive | a] <name=> show if a animal is alive\"\n puts \" [help | h] help about commands\"\n puts \"\"\n puts \"Flags:\"\n puts \" -v, --version show the app version\"\n puts \"\"\n puts \"Use bin/run [command] --help for more information about a command.\"\n end", "def user_help\n puts \"\"\n puts \"-l and --list\"\n puts \"Write either 'moodbooster -l' or 'moodbooster --list' in the command line to view your week's moods\"\nend", "def help\n puts \"Usage: ./#{$0} -u username -p password [-sent] [-killall] [username, ...]\"\n puts \" -u username Specify your twitter username\"\n puts \" -p password Specify your twitter password\"\n puts \" -sent Include the sent DMs (optional)\"\n puts \" -killall Deletes ALL DMs (there is no undo!) (optional)\"\n puts \" username Delete all DMs from this username (optional)\"\nend", "def help\n\t\tputs \"The CLI currently accepts the following commands:\"\n\t\tputs \"'help' - Displays the current help screen.\"\n\t\tputs \"'free' - Displays a list of the current free-to-play heroes.\"\n\t\tputs \"'<hero name>' - Will search for a hero of that name. No punctuation should be added and spaces should be represented with '-'\"\n\t\tputs \"'hero search' - Will return the user to the hero search prompt.\"\n\t\tputs \"'exit' - Closes the application.\"\n\tend", "def help\r\n end", "def help\r\n end", "def help(s=nil)\n puts send_cmd \"help #{s}\\n\\n\"\n end", "def help\n puts 'add help'\n end", "def usage\n puts <<EOU\nUSAGE:\n #{__FILE__} [ARGUMENT]\n\nArgument:\n -h, --help Visa denna information\n\n -a, --alias ALIAS Lista alias vars 'alias' matchar ALIAS\n -r, --reciever MOTTAGARE Lista alias vars 'mottagare' matchar MOTTAGARE\n\nTIPS: Använd tillsammans med less om listan är för lång:\n\n #{__FILE__}|less\n\nEOU\n\n # We also exit the script here..\n exit(0)\nend", "def help(arguments, options)\n colors = $stdout.tty?\n\n description = <<-END_OF_DESCRIPTION.gsub(/^ {8}/, '') # |<- 80 cols ends here\n \\e[1mHELP\\e[0m\n\n See `#{$0} commands` for a list of available commands.\n You can also use `#{$0} COMMAND --help` to get information about\n the command COMMAND.\n END_OF_DESCRIPTION\n\n description.gsub!(/\\e.*?m/, '') unless colors\n\n puts description\n end", "def help(some, arg)\n say \"Bootic CLI v#{BooticCli::VERSION}\\n\\n\", :bold\n super\n\n examples if respond_to?(:examples)\n end", "def help(cmd)\n %{\n h[elp]\\t\\tprint this help\n h[elp] command\\tprint help on command\n }\n end", "def show_help\n\tputs \"These are the following commands that this application accepts:\"\n\tputs \"\\t 'add' (child name) (toy name) - gives a child a new toy\"\n\tputs \"\\t 'remove' (toy name) (child name) - takes away the child's toy\"\n\tputs \"\\t 'ls' - lists all children and the toys they are receiving\"\n\tputs \"\\t 'ls' (child name) - lists all the toys that one child is receiving\"\n\tputs \"\\t 'delivered' (child name) - marks that the toys have been delivered to the child\"\n\tputs \"\\t 'help' - shows all of the available commands that this application accepts\"\n\n\nend", "def show_details(args)\n # get a list of unknown commands\n unknown_cmds = args.select do |arg|\n !WeatherSage::CLI::Help::COMMANDS.key?(arg)\n end\n\n if unknown_cmds.size > 0\n # print list of unknown commands and exit\n puts 'Unknown commands: %s' % [unknown_cmds.join(', ')]\n exit -1\n end\n\n # print detailed help for each argument\n puts args.map { |arg| template(:one, commands[arg]) }\n end", "def usage\n basename = File.basename($0)\n necessary_inputs = \"<omsadmin_conf> <cert> <key> <pid> <proxy> <os_info> <install_info>\"\n print(\"\\nTelemetry tool for OMS Agent\\n\"\\\n \"ruby #{basename} #{necessary_inputs}\\n\"\\\n \"\\nOptional: Add -v for verbose output\\n\")\nend", "def help\n\tusage\n\tputs \"This tool is oriented to separate web pages into segments called blocks, based on the structural and visual properties\"\nend", "def help\n puts \"For multi-word arguments, use 'single quotes' only.\"\n puts \"To create an event: \\t\\t\\t\\tCREATE EVENT event_name.\"\n puts \"To add a speaker to the most recent event: \\tCREATE SPEAKER speaker_name.\"\n puts \"To add a speaker to a different event: \\t\\tCREATE SPEAKER event_name speaker_name.\"\n puts \"To add a talk to an event: \\t\\t\\tCREATE TALK event_name talk_name talk_start_time talk_end_time speaker_name.\\n\\n\"\nend", "def print_help\r\n print <<~HEREDOC\r\n Usage: ruby caesar_cipher.rb [options] [message string]\r\n \\t-d, --decode\r\n \\t\\tset the program to decode (default is decode)\r\n \\t-e, --encode\r\n \\t\\tset the program to encode (default is decode)\r\n \\t-f=FILEPATH, --file=FILEPATH\r\n \\t\\tset a file to read from\r\n \\t-h, --help\r\n \\t\\tprint this message\r\n \\t-n, --negative\r\n \\t\\tnegate the offset. Can also pass a negative offset\r\n \\t-o=NUMBER, --offset=NUMBER\r\n \\t\\tset the offset used by the cipher. Default is 2\r\n \\t-p=FILEPATH, --path=FILEPATH\r\n \\t\\tsee -f\r\n HEREDOC\r\n end", "def help(errorText = nil)\n\n puts %Q|\nUsage: #{File.basename(__FILE__)} <Scope> <ExportFormat> <OutputRoot> [ Namespace ]\n\nExports the PII definition into sources\n\nParameters:\n <Scope> - one of: #{DataMetaPii::Scope.constants.map{|c| DataMetaPii::Scope.const_get(c).to_s}.join(', ')}\n\n <ExportFormat> - one of: #{DataMetaPii::ExportFmts.constants.map{|c| DataMetaPii::ExportFmts.const_get(c).to_s}.join(', ')}\n\n <OutputRoot> - must be a valid directory in the local file system.\n\n [ Namespace ] - for Java and Scala - package name, for Python - module name, for JSON - does not matter.\n\n DataMeta PII sources should be piped in.\n\n|\n $stderr.puts(%Q<\\nERROR: #{errorText}>) if errorText\n\n exit errorText ? 2 : 1\nend", "def cli_help\n self.class.help\n end", "def wash_command_help\n puts \"The Ruby Farm - a simple command line animals app\"\n puts\n puts \"Command Usage:\"\n puts \" [wash | w] <name=> gives a shower to a animal by name\"\n puts \"\"\n puts \"Examples:\"\n puts \" bin/run [wash | w] name=my_animal_name\"\n end", "def show_help\n puts HELP_MESSAGE\n end", "def show_help\n puts HELP_MESSAGE\n end", "def print_help(cmd)\n offset = docs.keys.longest_string_length\n write \"#{cmd.ljust(offset)} -- #{docs[cmd]}\" + \n (has_shortcuts?(cmd) ? \" #{display_shortcuts(cmd)}\" : '')\n end", "def print_help\n\t\t\t\t# Print app name\n\t\t\t\tif @app_name then\n\t\t\t\t\tprint \"#{@app_name}\"\n\t\t\t\t\tprint \" #{@app_version}\" if @app_version > 0\n\t\t\t\t\tprint \" - #{@description}\" if @description\n\t\t\t\t\tprint \"\\n\"\n\t\t\t\tend\n\n\t\t\t\t# Print usage\n\t\t\t\tprint \"#{@messages[\"pre_usage\"]}\\n\" if @messages[\"pre_usage\"]\n\t\t\t\tprint \"#{@usage ? @usage : \"Usage: #{ARGV[0]} [OPTIONS]\"}\\n\"\n\n\t\t\t\t# Print pre_options\n\t\t\t\tprint \"#{@messages[\"pre_options\"]}\\n\" if @messages[\"pre_options\"]\n\t\t\t\tprint \"\\nValid options are:\\n\"\n\n\t\t\t\t# Order options for printing\n\t\t\t\t@sorted_opts = @inserted[:name].sort do |first, second|\n\t\t\t\t\t@options[first][:priority] != @options[second][:priority] ? @options[first][:priority] <=> @options[second][:priority] : @inserted[:name].index(first) <=> @inserted[:name].index(second)\n\t\t\t\tend\n\n\t\t\t\t# Add options, saving max length\n\t\t\t\tpopts = {}\n\t\t\t\tmaxlen = -1\n\t\t\t\t@sorted_opts.each do |key|\n\t\t\t\t\topt = @options[key]\n\n\t\t\t\t\tpopt = \"#{[opt[:short], opt[:long]].join(\", \")}\"\n\t\t\t\t\tpopt += (\"=\" + (opt[:meta] ? opt[:meta] : \"ARG\")) if ![:bool, :action].include?(opt[:type])\n\t\t\t\t\tpopts[key] = popt\n\t\t\t\t\tmaxlen = popt.length if popt.length > maxlen\n\t\t\t\tend\n\n\t\t\t\t# Print options\n\t\t\t\t@sorted_opts.each do |key|\n\t\t\t\t\tval = popts[key]\n\t\t\t\t\tprint \"\\t#{val}#{\" \" * (5 + (maxlen - val.length))}#{@options[key][:help]}\\n\"\n\t\t\t\tend\n\n\t\t\t\t# Print post_options\n\t\t\t\tprint \"#{@messages[\"post_options\"]}\\n\" if @messages[\"post_options\"]\n\t\t\tend", "def printUsage\n print \"usage -- Moldyne.rb <numTimesteps> <structureFile> <outFile>\\n\"\n print \" <numTimesteps> - total number of timesteps to run\\n\"\n print \" <structureFile> - the PDB file to read in\\n\"\n print \" <outFilePrefix> - prefix for two output files (.out, .xyz)\\n\"\n end", "def help\n send_command \"--help\"\n end", "def print_help\n puts \"Usage:\n \\t./#{$PROGRAM_NAME} file.gpx [file2.gpx ...] -i|-m|--help\\n\n \\t\\t#{$PROGRAM_NAME}\\t - name of script\n \\t\\tfile.gpx file2.gpx\\t - one or more file names to fix\n \\t\\t-i\\t - fix files 'in place'\n \\t\\t-m\\t - merge to one gpx file, if tracks are continous (see -t switch) (default)\n \\t\\t-t NUM - treshhold for merge tolerance in meters (default 30 meters)\n \\t\\t--help\\t - print usage\"\n exit 1\n end", "def printHelp\n print \"getrbart v#{/(\\d+\\.\\d+)/.match( '$Revision: 1.9 $' )[ 1 ]}\nCopyright (C) 2008,2009 by Dave Pearson <davep@davep.org>\nhttp://www.davep.org/\n\nSupported command line options:\n\n -h --host <host> Specify the host to be contacted\n (default is \\\"www.redbubble.com\\\").\n -p --port <port> Specify the port to be connected\n (default is 80).\n --product <product> Specify the type of product list to\n download. Either 'art' or 'clothing'.\n -t --tagged <tag> Only get works with a specific tag.\n -u --user <user> Specify the RedBubble user.\n -v --verbose Work in verbose mode.\n --help Display this help.\n -L --licence Display the licence for this program.\n\nThe results (which are printed to STDOUT) contain one work per line in the\nformat:\n\n<work id>\\\\t<work title>\\\\t<thumbnail URL>\n\"\nend", "def help\n str = \"====[ #{@name} ]====\\nUsage: #{@name} \"\n @doc_args.each do |key, _value|\n str += \"[#{key.upcase}] \"\n end\n @doc_options.each do |key, _value|\n str += \"(--#{key.name}) \"\n end\n str = \"#{str.rstrip}\\nDescription: #{description}\\n#{help_options_args}\"\n str.rstrip\n end", "def printUsage\n \n print \"usage -- main.rb <structureFile> <outFile>\\n\"\n print \" <numTimesteps> - total number of timesteps to run\\n\"\n print \" <structureFile> - the PDB file to read in\\n\"\n print \" <outFilePrefix> - MD output (.out, .xyz)\\n\"\n \n end", "def help\n puts 'Here is a list of available commands:\n new - Create a new contact\n list - List all contacts\n show - Show a contact\n search - Search contacts'\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def cmd_poortego_run_help(*args)\n print_line \"Usage: run <transform>\"\n print_line\n end", "def help\n help_str = super()\n help_str << \"\\n\\nCommands:\\n\"\n COMMANDS.map do |cmd, cmd_params, desc|\n cmd_template = \" %-49s\" % [base_script_name, cmd, cmd_params].join(\" \")\n cmd_template += \" :: \" + desc if desc\n help_str << cmd_template+\"\\n\"\n end\n help_str\n end", "def dump_help extra_msg=nil\n $stderr.puts help\n $stderr.puts \"\\n\\n\"+extra_msg unless extra_msg.blank?\n $stderr.puts ''\n end", "def command_help\n display_possible_actions\n end", "def help\r\n\tputs \"-to add new student: add student\"\r\n\tputs \"-to display all students: display students\"\r\n\tputs \"-to display all subjects: display subjects\"\r\n\tputs \"-to update a grade: update grade\"\r\n\tputs \"-to display grades of a student: check grade\"\r\n\tputs \"-to quit: done, exit\"\r\nend", "def docopt_usage \n doc = [\"\\nUsage:\"];\n @actions.each do |_name, action|\n doc << \" run #{action.usage}\" unless action.usage == false\n end\n basic_flags = @version ? \"(-h|--help|--version)\" : \"(-h|--help)\"\n if @superspace\n doc << \" run #{@superspace} #{basic_flags}\\n\"\n else\n doc << \" run #{basic_flags}\\n\"\n end\n doc\n end", "def usage\n puts <<EOU\nUSAGE:\n #{__FILE__} E-POST [ARGUMENT]\n\nTa bort e-postkontot för E-POST\n\nArgument:\n -h, --help Visa denna information\n -s, --simulate Simulera allt, gör inga ändringar i filsystem eller databas\nEOU\n\n # We also exit the script here..\n exit(0)\nend", "def print_usage(msg = \"\")\n puts msg if msg\n\n puts <<MSG\nAll options are required.\nUsage: $0\n --hadoop-path [Hadoop directory],\n --bwa-path [Directory to compiled bwa - default hdfs://bwa-tools/bwa.tgz]\n --hadoop-bam-path [Directory that contains hadoop-bam jar and associated jars OPTIONAL]\n --reference [HDFS directory that contains the reference genome with index]\n --read-pair-dir [Directory that contains read files]\n --hdfs-path [HDFS directory for outputs]\n\n\n --help [See this message]\nMSG\n exit(-1)\nend", "def help(strm = $stderr)\n strm << \"Usage: #{$0} [-sqlHost sqlHost] [-port localPort] [-test]\\n\" ;\nend", "def alive_command_help\n puts \"The Ruby Farm - a simple command line animals app\"\n puts\n puts \"Command Usage:\"\n puts \" [alive | a] <name=> checks if an animal is alive by name\"\n puts \"\"\n puts \"Examples:\"\n puts \" bin/run [alive | a] name=my_animal_name\"\n end", "def help\n print <<END\n Usage:\n convert.rb [options] <html-directory>\n\n -c, --per-chapter\n file-per-chapter mode -- generates one HTML file chapxxx.htm for each\n chapter sections are level 2 headings and anchors chapxxx.htm#SECTxxx.\n This is intended for local browsing, especially under MS-DOS\n \n -s, --silent silent running. Conversational messages are suppressed.\n\n <html-directory> defaults to the current directory\nEND\nend", "def help\n prettify(description)\n end", "def print_usage \n puts \"Usage: packagize [-h] [-v] [-r] [-s source_dir] [-d dest_dir]\"\n puts \"\\tSource and destination default to the current working directory.\"\n puts \"\\t-r search directory and all subdirectories. Defaults to true.\"\n puts \"\\t-v display verbose output. Defaults to false.\"\n puts \"\\t-h display this text.\"\nend", "def help\n puts \"plan #{Plan::VERSION} - john crepezzi - http://github.com/seejohnrun/plan\"\n COMMAND_GLOSSARY.each do |cmd, description|\n puts \"\\e[0;33m#{cmd}\\e[0m - #{description}\"\n end\n end", "def create_command_help\n puts \"The Ruby Farm - a simple command line animals app\"\n puts\n puts \"Command Usage:\"\n puts \" [create | c] <name=> <type=> creates a animal with name\"\n puts \"\"\n puts \"Examples:\"\n puts \" bin/run [create | c] name=my_animal_name\"\n puts \" bin/run [create | c] name=my_animal_name type=pig\"\n end", "def show_help\n display banner\n display \"\"\n display short_help\n display \"\"\n end", "def usage\n puts <<EOU\nUSAGE:\n #{__FILE__} DOMÄN [ARGUMENT]\n\nTa bort en domän från mailservern\n\nArgument:\n -h, --help Visa denna information\n -s, --simulate Simulera allt, gör inga ändringar i filsystem eller databas\n\nTar bort domänen DOMÄN från mailservern.\nOBSERVERA att skriptet även har möjlighet att ta bort all tillhörande e-postkonton!\nEOU\n\n # We also exit the script here..\n exit(0)\nend", "def food_command_help\n puts \"The Ruby Farm - a simple command line animals app\"\n puts\n puts \"Command Usage:\"\n puts \" [food | f] <name=> gives food to a animal by name\"\n puts \"\"\n puts \"Examples:\"\n puts \" bin/run [food | f] name=my_animal_name\"\n end", "def help\n\t puts \"\"\n\t puts Rainbow(\":doc\").color(\"#D65200\")+\" Open documentation online\"\n\t puts Rainbow(\":open\").color(\"#D65200\")+\" Open file or folder\"\n\t puts Rainbow(\":new\").color(\"#D65200\")+\" Create file or directory\"\n\t puts Rainbow(\":destroy\").color(\"#D65200\")+\" Destroy Params file or current directory\"\n\t puts Rainbow(\":clean\").color(\"#D65200\")+\" Clean the trash\"\n\t puts Rainbow(\":calendar\").color(\"#D65200\")+\" Show current month\"\n\t puts Rainbow(\":today\").color(\"#D65200\")+\" Show date of day\"\n\t puts \"\"\n\t end" ]
[ "0.8152553", "0.7914385", "0.783073", "0.77173984", "0.77124316", "0.7677662", "0.7677662", "0.7625775", "0.76130044", "0.7587042", "0.75445396", "0.74787354", "0.74484926", "0.7411687", "0.73862004", "0.73381305", "0.7279913", "0.7276883", "0.72541434", "0.72463256", "0.7206824", "0.7206824", "0.72016996", "0.7179952", "0.7179369", "0.7149363", "0.71445495", "0.7126218", "0.7124522", "0.7122848", "0.7118835", "0.7118835", "0.7101071", "0.7086492", "0.70855075", "0.70749825", "0.7065018", "0.7064846", "0.70539373", "0.70372623", "0.703679", "0.7034865", "0.70332605", "0.70303446", "0.70274824", "0.7024518", "0.7024518", "0.70233613", "0.7010176", "0.70090485", "0.7006638", "0.698321", "0.69815695", "0.6977516", "0.69760174", "0.69713044", "0.69705546", "0.6967025", "0.6965606", "0.6965358", "0.69646686", "0.6963977", "0.6961583", "0.6961583", "0.6959236", "0.6957132", "0.69138306", "0.69111127", "0.69103616", "0.69058305", "0.69039357", "0.6881935", "0.6872405", "0.6859526", "0.6859526", "0.6859526", "0.6859526", "0.6859526", "0.6859526", "0.6859526", "0.68591845", "0.68515855", "0.68509775", "0.68492347", "0.68254584", "0.6824352", "0.68192524", "0.68158954", "0.6811148", "0.6804488", "0.67985827", "0.67947197", "0.67942685", "0.6794016", "0.6790684", "0.6787857", "0.6775162", "0.6767915", "0.6761854" ]
0.83340836
1
restarts the Mu system services (this does not reboot the appliance) argv = commandline arguments
def cmd_restart argv setup argv response = @api.restart msg response return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restart(*services) = execute(services: services)", "def restart\n invoke :stop, :all => input[:all], :apps => input[:apps]\n\n line unless quiet?\n\n input[:apps].each do |app|\n unless input[:command].nil?\n app.command = input[:command]\n end\n app.update!\n end\n\n invoke :start, :all => input[:all], :apps => input[:apps],\n :debug_mode => input[:debug_mode]\n end", "def restart\n\trequire_relative '../../lib/falcon/command/supervisor'\n\t\n\tFalcon::Command::Supervisor[\"restart\"].call\nend", "def cmd_reboot(*args)\n if args.length > 0\n cmd_reboot_help\n return\n end\n client.reboot\n end", "def restart_environment(argv={})\n @started = false\n start_environment(Merb::Config.to_hash.merge(argv))\n end", "def restart_environment(argv={})\n @started = false\n start_environment(Merb::Config.to_hash.merge(argv))\n end", "def restart\n\tcall 'falcon:supervisor:restart'\nend", "def restart\n\tcall 'falcon:supervisor:restart'\nend", "def restart\n\tcall 'falcon:supervisor:restart'\nend", "def restart_command(cmd); end", "def restart(*args)\n stop\n start\n end", "def restart!\n # Permissions are handled by the script, use: :sudo => false\n run_script! :restart, :sudo => false\n end", "def restart\n # Permissions are handled by the script, use: :sudo => false\n run_script :stop, :sudo => false\n end", "def hot_restart\n system \"kill -s USR2 #{pid} > /dev/null 2>&1\"\n end", "def restart_service\n service 'consul-haproxy' do\n action :restart\n end\nend", "def restart(params)\n services = services_from_params(params)\n if @environment.in_dry_run_mode\n services.each do |agent|\n notify(:msg => \"[#{@name}] Would restart #{agent.host} (#{agent.type})\",\n :tags => [:galaxy, :dryrun])\n end\n services\n else\n command = ::Galaxy::Commands::RestartCommand.new([], @galaxy_options)\n command.report = GalaxyGatheringReport.new(@environment,\n '[' + @name + '] Restarted #{agent.host} (#{agent.type})',\n [:galaxy, :trace])\n execute(command, services)\n command.report.results\n end\n end", "def restart\n request('restart')\n end", "def restart()\n shutdown()\n start()\n end", "def run(args)\n\n dbgr = @proc.dbgr\n argv = dbgr.restart_argv\n if argv and argv.size > 0\n @proc.run_cmd(%w(show args))\n if not confirm('Restart (exec)?', false)\n msg \"Restart not confirmed\"\n else\n if defined?(Trepan::PROG_UNRESOLVED_SCRIPT) &&\n position = argv.index(Trepan::PROG_UNRESOLVED_SCRIPT)\n save_filename = @proc.save_commands(:erase =>true)\n argv.insert(position, '--command', save_filename) if save_filename\n end\n Dir.chdir(RubyVM::OS_STARTUP_DIR)\n msg 'Restarting using...'\n msg \"\\t #{argv.inspect}\"\n @proc.finalize\n exec(*argv)\n end\n else\n errmsg(\"No executable file and command options recorded.\")\n end\n end", "def restart!\n IbmCloudRest.post \"#{@uri}/_restart\"\n end", "def restart\n process = shift_argument\n validate_arguments!\n release = options[:version]\n\n message, options = case process\n when NilClass\n [\"Restarting processes\", { }]\n when /.+\\..+/\n ps = args.first\n [\"Restarting #{ps} process\", { :ps => ps }]\n else\n type = args.first\n [\"Restarting #{type} processes\", { :type => type }]\n end\n\n action(message) do\n api.post_ps_restart(app, options.merge(:release => release))\n end\n end", "def restart_linux_service(service)\n message = \"Information:\\tRestarting Service \"+service\n command = \"service #{service} restart\"\n output = execute_command(message,command)\n return output\nend", "def cmd_reboot(*args)\n force = 0\n\n if args.length == 1 and args[0].strip == \"-h\"\n print(\n \"Usage: reboot [options]\\n\\n\" +\n \"Reboot the remote machine.\\n\" +\n @@reboot_opts.usage)\n return true\n end\n\n @@reboot_opts.parse(args) { |opt, idx, val|\n case opt\n when \"-f\"\n force = val.to_i\n end\n }\n print_line(\"Rebooting...\")\n\n client.sys.power.reboot(force, SHTDN_REASON_DEFAULT)\n end", "def restart\n raise _(\"Server restart is only supported on Linux\") unless MiqEnvironment::Command.is_linux?\n\n _log.info(\"Server restart initiating...\")\n update_attribute(:status, \"restarting\")\n\n shutdown_and_exit(RESTART_EXIT_STATUS)\n end", "def restart_mon_daemon(agent)\n\n agent = get_model(agent, Agent)\n\n command = CommandSpec.new( :repo => \"vendor\", :bundle => \"system/monitoring\",\n :command => \"mon_daemon.rb\", :args => \"restart\" )\n\n return exec(agent, command)\n end", "def restart\n app = extract_app\n\n opts = case args.first\n when NilClass then\n display \"Restarting processes... \", false\n {}\n when /.+\\..+/\n ps = args.first\n display \"Restarting #{ps} process... \", false\n { :ps => ps }\n else\n type = args.first\n display \"Restarting #{type} processes... \", false\n { :type => type }\n end\n heroku.ps_restart(app, opts)\n display \"done\"\n end", "def run(argv)\n Bgo::Application::Service.startup_services(self)\n\n rv = 0\n if @interactive\n run_interactive\n else\n cmd_name = argv.shift\n cmd = get_command cmd_name\n rv = cmd ? run_command( cmd, argv ) : -1\n end\n\n Bgo::Application::Service.shutdown_services(self)\n exit rv\n end", "def restart_atd(vp)\n system \"ssh uw_revtr2@#{vp} 'sudo /etc/init.d/atd restart > /dev/null 2>&1'\"\n end", "def restart\n ensure_session\n ensure_cli\n IRB.irb_at_exit\n str = \"Restarting: `#{ENV['IRT_COMMAND']}`\"\n puts\n puts IRT.dye(\" #{str} \", \"*** #{str} ***\", :error_color, :bold, :reversed)\n puts\n exec ENV[\"IRT_COMMAND\"]\n end", "def restart\n if @restart_command\n run_command(@restart_command)\n else\n stop\n start\n end\n end", "def action_restart\n return if options['never_restart']\n action_stop\n action_start\n end", "def reboot\r\n raise Shells::NotRunning unless running?\r\n raise Shells::PfSenseCommon::RestartNow\r\n end", "def restart_process\n puts 'restarting'\n exec RbConfig.ruby, File.expand_path(__FILE__), *ARGV\nend", "def restart\n if booted then\n kill\n end\n start\n end", "def restart\n\t\t# puts \"Restarting #{@ip} ...\"\n\t\tsystem ipmi_command + \" chassis power cycle\"\n\tend", "def restart\n dyno = shift_argument\n validate_arguments!\n\n message, options = case dyno\n when NilClass\n [\"Restarting dynos\", {}]\n when /.+\\..+/\n ps = args.first\n [\"Restarting #{ps} dyno\", { :ps => ps }]\n else\n type = args.first\n [\"Restarting #{type} dynos\", { :type => type }]\n end\n\n action(message) do\n api.post_ps_restart(app, options)\n end\n end", "def restart\n stop\n start\nend", "def restart(app_name)\n\t\tdelete(\"/apps/#{app_name}/server\")\n\tend", "def restart(pid=nil)\n `cp #{APP_ROOT}/services/drb.log #{APP_ROOT}/services/drb.bak`\n `cp #{APP_ROOT}/services/dico.log #{APP_ROOT}/services/dico.bak`\n if !pid.nil?\n pid.each {|x| `kill -1 #{x}`}\n sleep(1)\n end\n `cd #{APP_ROOT};#{WHICH_RAKE} #{RAKE_FILE}[#{SHARD_ID},#{MAX_SHARD}] >#{APP_ROOT}/services/drb.log 2>&1 &`\n puts \"## Restarted\"\nend", "def ssh_service_restart\n exec(Beaker::Command.new(\"stopsrc -g ssh\"))\n exec(Beaker::Command.new(\"startsrc -g ssh\"))\n end", "def restart(app_name)\n deprecate # 07/31/2012\n delete(\"/apps/#{app_name}/server\").to_s\n end", "def restart(config = nil)\n config ||= agent&.config\n stop if running?\n start(config)\n end", "def restart!\n start!\n end", "def restart_monit\n return if ENV['TEST_KITCHEN'] # Don't like it, but we can't run multiple processes in Docker on travis\n\n pidfile = \"/var/run/lock/#{app['shortname']}/puma.pid\"\n context.execute \"monit restart #{adapter}_#{app['shortname']}\" do\n retries 3\n only_if { ::File.exist?(pidfile) }\n end\n end", "def restart_running_instances_services\n nodes.each do |node|\n node.restart_with_monit\n end\n end", "def restart(cart_name, options={})\n @cartridge_model.start_cartridge('restart', cart_name,\n user_initiated: true,\n out: options[:out],\n err: options[:err])\n end", "def restartEditorCamera _args\n \"restartEditorCamera _args;\" \n end", "def reboot_fusion_vm(options)\n reset_fusion_vm(options)\nend", "def restart; end", "def restart_container\n do_service_action :restart_container\n end", "def run\n `#{@apachectl} restart`\n end", "def restart\n puts \"\\n\\n project:\"\n puts ' command: restart'\n puts \" name: #{File.basename(root_dir)}\"\n puts \"\\n docker-machine:\"\n puts \" name: #{project_config['docker-machine']['name']}\"\n unless vm_running?\n puts ' status: NOT running '\n puts \"\\n\\n docker-machine not even running - thus do regular start\\n\\n\"\n start\n else\n puts ' status: running '\n puts \"\\n docker-compose:\"\n puts \" service: #{project_config['docker-compose']['service']}\"\n unless service_running?\n puts ' status: NOT running '\n puts \"\\n\\n service not even running - thus do regular start\\n\\n\"\n start\n else\n puts \" status: restarting... \\n\\n\"\n exec(\"#{setup_docker_env_vars_str} docker-compose restart\")\n end\n end\nend", "def restart\n stop\n start\n end", "def restart(services)\n generate_config if stale_config\n update_platform_env\n services.each do |service|\n kubectl(\"rollout restart deploy #{clean_kubernetes_name(service)}\")\n end\n # down(services)\n # up(services)\n # status\n end", "def restart\n debug \"Call 'restart' for Pacemaker service '#{name}' on node '#{hostname}'\"\n if pacemaker_options[:restart_only_if_local] and not primitive_is_running? name, hostname\n info \"Pacemaker service '#{name}' is not running on node '#{hostname}'. Skipping restart!\"\n return\n end\n\n begin\n stop\n rescue\n debug 'The service have failed to stop! Trying to start it anyway...'\n ensure\n start\n end\n end", "def restartservices(member_order=\"SEQUENTIALLY\", \n restart_option=\"RESTART_IF_NEEDED\", \n sequential_delay=15, \n service_option=\"DHCP\")\n\n post_body = {\n :member_order => member_order,\n :restart_option => restart_option,\n :sequential_delay => sequential_delay.to_i,\n :service_option => service_option\n }\n JSON.parse(connection.post(resource_uri + \"?_function=restartservices\", post_body).body);\n end", "def restart(pid)\n `kill -s USR2 #{pid}`\n end", "def restart!\n stop!\n start!\n end", "def restart_soon\n @restart = true\n @shutdown = true\n end", "def on_restart(&block); end", "def restart\n self.stop\n self.start\n end", "def reload_systemd()\n bash 'reload systemd daemon' do\n user 'root'\n code 'systemctl daemon-reload'\n end\nend", "def init_command\n restart_winrm_service if config[:restart_winrm]\n end", "def restart\n if config.managed? && started?\n stop\n start\n end\n end", "def reboot(hard = false)\n return if @cloud_id.nil?\n\n if hard\n groupname = nil\n if !@config['basis'].nil?\n resp = MU::Cloud::AWS.autoscale(region: @config['region'], credentials: @config['credentials']).describe_auto_scaling_instances(\n instance_ids: [@cloud_id]\n )\n groupname = resp.auto_scaling_instances.first.auto_scaling_group_name\n MU.log \"Pausing Autoscale processes in #{groupname}\", MU::NOTICE\n MU::Cloud::AWS.autoscale(region: @config['region'], credentials: @config['credentials']).suspend_processes(\n auto_scaling_group_name: groupname\n )\n end\n begin\n MU.log \"Stopping #{@mu_name} (#{@cloud_id})\", MU::NOTICE\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).stop_instances(\n instance_ids: [@cloud_id]\n )\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).wait_until(:instance_stopped, instance_ids: [@cloud_id]) do |waiter|\n waiter.before_attempt do |attempts|\n MU.log \"Waiting for #{@mu_name} to stop for hard reboot\"\n end\n end\n MU.log \"Starting #{@mu_name} (#{@cloud_id})\"\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).start_instances(\n instance_ids: [@cloud_id]\n )\n ensure\n if !groupname.nil?\n MU.log \"Resuming Autoscale processes in #{groupname}\", MU::NOTICE\n MU::Cloud::AWS.autoscale(region: @config['region'], credentials: @config['credentials']).resume_processes(\n auto_scaling_group_name: groupname\n )\n end\n end\n else\n MU.log \"Rebooting #{@mu_name} (#{@cloud_id})\"\n MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).reboot_instances(\n instance_ids: [@cloud_id]\n )\n end\n end", "def action_restart\n proxy_action(:restart)\n end", "def restart\n raw \"RESTART\\r\\n\"\n end", "def restart\n synchronize {\n if @app\n update_click_config\n else\n start\n end\n }\n end", "def reboot!\n self.reboot(\"HARD\")\n end", "def restart; stop; start; end", "def start_apps\n check_apps\n remove_sockets\n _start_apps(ARGV[1])\nend", "def relaunch!\n requires :id\n body = [ \"FORCE\", {}]\n body[1][:sshKeyIds] = key_pairs.map {|kp| kp.id} unless key_pairs.empty?\n type = bare_metal? ? :hardware_server : :virtual_guest\n status = service.request(type, \"#{id}/reloadOperatingSystem\", :body => body, :http_method => :post).status\n wait_for { not ready? } # block until the relaunch has begun\n [200, 201].include?(status)\n end", "def restart\n stop\n sleep 2\n start\n end", "def migrate(session)\n\ttarget = 'cmd.exe'\n\tnewProcPid = launchProc(session,target)\n\toldProc = migrateToProc(session,newProcPid)\n\t#killApp(oldProc)\n \t#Dangerous depending on the service exploited\nend", "def restart # :nodoc:\n put :restart\n end", "def reboot(hard = false)\n return if @cloud_id.nil?\n\n if hard\n groupname = nil\n if !@config['basis'].nil?\n resp = MU::Cloud::AWS.autoscale(region: @region, credentials: @credentials).describe_auto_scaling_instances(\n instance_ids: [@cloud_id]\n )\n groupname = resp.auto_scaling_instances.first.auto_scaling_group_name\n MU.log \"Pausing Autoscale processes in #{groupname}\", MU::NOTICE\n MU::Cloud::AWS.autoscale(region: @region, credentials: @credentials).suspend_processes(\n auto_scaling_group_name: groupname,\n scaling_processes: [\n \"Terminate\",\n ], \n )\n end\n begin\n MU.log \"Stopping #{@mu_name} (#{@cloud_id})\", MU::NOTICE\n MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).stop_instances(\n instance_ids: [@cloud_id]\n )\n MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).wait_until(:instance_stopped, instance_ids: [@cloud_id]) do |waiter|\n waiter.before_attempt do\n MU.log \"Waiting for #{@mu_name} to stop for hard reboot\"\n end\n end\n MU.log \"Starting #{@mu_name} (#{@cloud_id})\"\n MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).start_instances(\n instance_ids: [@cloud_id]\n )\n ensure\n if !groupname.nil?\n MU.log \"Resuming Autoscale processes in #{groupname}\", MU::NOTICE\n MU::Cloud::AWS.autoscale(region: @region, credentials: @credentials).resume_processes(\n auto_scaling_group_name: groupname,\n scaling_processes: [\n \"Terminate\",\n ],\n )\n end\n end\n else\n MU.log \"Rebooting #{@mu_name} (#{@cloud_id})\"\n MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).reboot_instances(\n instance_ids: [@cloud_id]\n )\n end\n end", "def reboot!(vm, options)\n if reboot? vm, options\n vm.action(:reload, options)\n end\n end", "def restart!\n CouchRest.post \"#{@uri}/_restart\"\n end", "def ssh_service_restart\n case self['platform']\n when /debian|ubuntu|cumulus|huaweios/\n exec(Beaker::Command.new(\"service ssh restart\"))\n when /(el|centos|redhat|oracle|scientific)-[7-9]|eos-7|fedora-(1[4-9]|2[0-9]|3[0-9])|archlinux-/\n exec(Beaker::Command.new(\"systemctl restart sshd.service\"))\n when /el-|centos|fedora|redhat|oracle|scientific|eos/\n exec(Beaker::Command.new(\"/sbin/service sshd restart\"))\n when /opensuse|sles/\n exec(Beaker::Command.new(\"/usr/sbin/rcsshd restart\"))\n when /solaris/\n exec(Beaker::Command.new(\"svcadm restart svc:/network/ssh:default\"))\n when /(free|open)bsd/\n exec(Beaker::Command.new(\"sudo /etc/rc.d/sshd restart\"))\n else\n raise ArgumentError, \"Unsupported Platform: '#{self['platform']}'\"\n end\n end", "def run_restart(options={}, &block)\n with_each_host { stop(options); start(options) }\n end", "def restart(vmname, action = 'restart')\n uri = @uri + \"/#{vmname}/#{action}?api-version=#{api_version}\"\n uri\n end", "def restart(filename)\n start (filename) if shutdown(filename) == true\n end", "def restart_hybris(startup_script)\n stop_hybris(startup_script)\n start_hybris(startup_script)\n end", "def update(args)\n if (args[0] == \"dns\")\n system('ansible-playbook /usr/local/gdev-env/ansible/mac.yml -i 127.0.0.1, --ask-become-pass --verbose --tags=dns')\n elsif (args[0].nil?)\n system('cd /usr/local/gdev-env && git reset HEAD --hard && git pull origin HEAD && bin/bootstrap')\n # Rebuild and reload all services\n puts \"Refreshing all gdev services...\"\n service(['build nginx'])\n service(['reload'])\n else\n puts \"Did you mean to run: $ gdev update ?\"\n end\n end", "def restart\n client.restart\n end", "def disable_osx_service(service_name)\n message = \"Information:\\tDisabling service \"+service_name\n command = \"launchctl stop #{service_name}\"\n output = execute_command(options,message,command)\n return output\nend", "def reboot\n node.update!(alive: false)\n run(\"reboot\")\n end", "def stop(force = true)\n return if ! active_instance_dir_exists?\n return if ! running?\n puts \"Stopping #{@resource[:name]}\"\n cmd = [command(:instance_manager)]\n cmd += [\"stop\"]\n cmd += [@resource[:name]]\n cmd += [\"force\"] if force\n run(cmd)\n end", "def cmd_reset(*args)\n if args.length > 0\n cmd_reset_help\n return\n end\n client.reset\n end", "def refresh \n if (@parameters[:ensure].value == :running)\n provider.restart\n else\n debug \"Skipping restart; service is not running\"\n end\n end", "def restart_monit(pidfile = nil)\n return if ENV['TEST_KITCHEN'] # Don't like it, but we can't run multiple processes in Docker on travis\n\n @monit_hook = {\n restart: true,\n pidfile: pidfile,\n apps: [\"#{adapter}_#{app['shortname']}\"]\n }\n end", "def restart_game_cmd\n msg_details = \"#{@ix_current_game}\"\n cmd_to_send = build_cmd(:restart_game, msg_details)\n send_data_to_server(cmd_to_send)\n end", "def enable_osx_service(service_name)\n check_osx_service_is_enabled(service_name)\n message = \"Information:\\tEnabling service \"+service_name\n command = \"launchctl start #{service_name}\"\n output = execute_command(options,message,command)\n return output\nend", "def restart config={}\n stop\n start(config)\n end", "def phased_restart; end", "def Restart\n RunSystemCtl(\"network\", \"stop\")\n EnableDisableNow()\n RunSystemCtl(\"network\", \"start\")\n\n nil\n end", "def restart_apache\n FileUtils.touch \"#{config.get(:current_path)}/tmp/restart.txt\"\n monit_command \"restart apache2\"\n end", "def restart_monit_service(service_name, options = {})\n options = options.clone\n host = options.delete(:host) || 'localhost',\n port = options.delete(:port)\n timeout_sec = options.delete(:timeout_sec) || DEFAULT_MONIT_SERVICE_HOST_PORT_TIMEOUT_SEC\n raise \"Invalid options: #{options}\" unless options.empty?\n\n get_stable_monit_service_status(service_name)\n shell_out!(\"monit restart #{service_name}\")\n\n # Wait for service status to stabilize once again.\n get_stable_monit_service_status(service_name)\n if host && port\n require 'waitutil' # Only require this when necessary, so that the gem is installed.\n Chef::Log.info(\n \"Waiting for service #{service_name} to become available on host #{host}, port #{port}\")\n WaitUtil.wait_for_service(service_name, host, port, delay_sec: 1,\n timeout_sec: timeout_sec)\n end\n end", "def restart()\n stopwatch = Stopwatch.new\n event(\"Pre\")\n if agree(\"Should all the databases be cleared? <%= color('[y/n]', :bold) %>\")\n self.clean_db()\n system( \"vagrant reload --provision\" ) \n else\n system( \"vagrant reload\" )\n end\n event(\"Post\")\n stopwatch.end(\"restarted in:\")\n end", "def test_restart\n\n start_new_engine\n\n pdef = Ruote.process_definition :name => 'test' do\n participant 'alpha', :timeout => '2d'\n end\n\n @dashboard.register_participant 'alpha', Ruote::NullParticipant\n\n wfid = @dashboard.launch(pdef)\n\n wait_for(3)\n\n assert_equal 1, @dashboard.processes.size\n assert_equal 1, @dashboard.storage.get_many('schedules').size\n\n @dashboard.shutdown\n\n # restart...\n\n start_new_engine\n\n @dashboard.register_participant 'alpha', Ruote::NullParticipant\n\n assert_equal 1, @dashboard.processes.size\n assert_equal 1, @dashboard.storage.get_many('schedules').size\n\n @dashboard.cancel_process(wfid)\n\n wait_for(wfid)\n\n assert_equal 0, @dashboard.processes.size\n assert_equal 0, @dashboard.storage.get_many('schedules').size\n end" ]
[ "0.7045368", "0.70075876", "0.6826488", "0.66758096", "0.6567114", "0.6566282", "0.6541809", "0.6541809", "0.6541809", "0.65368176", "0.64778584", "0.64727294", "0.64488095", "0.64143676", "0.63433516", "0.63240683", "0.62660694", "0.62453246", "0.6210048", "0.6174986", "0.61720407", "0.61687577", "0.6142619", "0.6130253", "0.61233854", "0.6103755", "0.6080212", "0.60166454", "0.5974871", "0.5974622", "0.59699786", "0.59609056", "0.59594166", "0.59508544", "0.59355927", "0.5930921", "0.59263116", "0.59080106", "0.58970547", "0.5893301", "0.58910453", "0.5873604", "0.5870949", "0.5869855", "0.5860475", "0.58467215", "0.5838653", "0.5825924", "0.5821399", "0.581688", "0.5814741", "0.5800855", "0.57981914", "0.57914644", "0.57829833", "0.5737221", "0.57235014", "0.57234573", "0.5716954", "0.5695421", "0.56935894", "0.5688726", "0.5685055", "0.56834424", "0.56830865", "0.56816775", "0.56799495", "0.56708807", "0.56674933", "0.56543565", "0.5643933", "0.5637502", "0.56275135", "0.5624534", "0.5621603", "0.5617858", "0.5614813", "0.55987746", "0.5598518", "0.5594913", "0.5569597", "0.556166", "0.5556731", "0.5554781", "0.55445087", "0.5544306", "0.554113", "0.5537048", "0.5526404", "0.55233663", "0.5514378", "0.5508956", "0.5504744", "0.5486245", "0.5476961", "0.5472327", "0.54660165", "0.5453577", "0.5449356", "0.544733" ]
0.7552381
0
gets the complete System status page argv = commandline arguments
def cmd_status argv setup argv response = @api.status msg response return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command_line_info\n puts \"\\nCommand line arguments:\\n\\n\"\n puts \"This program will accept a single command line argument on launch. Arguments can be passed to draughts_app.rb directly or to draughts.sh\\n\"\n puts \"Example: draughts.sh --help\\n\\n\"\n puts \"-h or --help Display all command line arguments\"\n puts \"-i or --info Display instructions on how to play\"\n puts \"-v or --version Display current application and Ruby version\"\n puts \"start Skip menu and immediately start a new game\"\n puts \"wins Print win counts\"\n puts \"\"\nend", "def cmd_status argv\n setup argv\n uuid = @hash['uuid']\n response = @api.status(uuid)\n msg response\n return response\n end", "def help(argm)\n\tif(argm)\n\t\tputs \"Commands:\"\n\t\tprintf \"%-15s %-6s %-10s # Shows the list of commands available\\n\", \n\t\tFile.basename(__FILE__), \"help\", \"\"\n\t\tprintf \"%-15s %-6s %-10s # Load a XML file\\n\", \n\t\tFile.basename(__FILE__), \"-xml\", \"[filename]\"\n\t\tprintf \"%-15s %-6s %-10s # Allows you to search\\n\", \n\t\tFile.basename(__FILE__), \"list\", \"\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for ip\\n\", \n\t\t\"\", \"\", \"--ip\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for name(first and/or last)\\n\", \n\t\t\"\", \"\", \"--name\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for email\\n\", \n\t\t\"\", \"\", \"--email\"\n\t\tprintf \"%-15s %-6s %-10s # Allows you to search before a date\\n\", \n\t\tFile.basename(__FILE__), \"before\", \"[date]\"\n\t\tprintf \"%-15s %-6s %-10s # Allows you to search after a date\\n\", \n\t\tFile.basename(__FILE__), \"after\", \"[date]\"\n\t\tprintf \"%-15s %-6s %-10s # Allows you to search for emails sent \"+\n\t\t\"on a day of the week\\n\",\n\t\tFile.basename(__FILE__), \"--day\", \"[day]\"\n\t\texit\n\tend\nend", "def usage\n $stderr.puts \"usage: #{$PROGRAM_NAME} <repo_name> load_check_head\"\n $stderr.puts \" #{$PROGRAM_NAME} <repo_name> save_check_head <check_head>\"\n $stderr.puts \" #{$PROGRAM_NAME} <repo_name> push_statuses_after_check_head\"\n $stderr.puts \" #{$PROGRAM_NAME} <repo_name> recent_statuses [offset [limit]]\"\n exit 1\nend", "def usage_page\n Format.usage(\"You can run me with the following flags: #{File.basename(__FILE__)} -[d|e|h] -[f] <path/to/file/if/any>\")\n exit\nend", "def help(argm)\n\tif(argm)\n\t\tputs \"Commands:\"\n\t\tprintf \"%-15s %-6s %-10s # Shows the list of commands available\\n\", \n\t\tFile.basename(__FILE__), \"help\", \"\"\n\t\tprintf \"%-15s %-6s %-10s # Load a XML file\\n\", \n\t\tFile.basename(__FILE__), \"-xml\", \"[filename]\"\n\t\tprintf \"%-15s %-6s %-10s # Allows you to search\\n\", \n\t\tFile.basename(__FILE__), \"list\", \"\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for ip\\n\", \n\t\t\"\", \"\", \"--ip\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for name(first and/or last)\\n\", \n\t\t\"\", \"\", \"--name\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for email\\n\", \n\t\t\"\", \"\", \"--email\"\n\t\texit\n\tend\nend", "def cmd_status2 argv\n setup argv\n response = @api.status2\n msg response\n return response\n end", "def cmd_status(*args)\n if args.length > 0\n cmd_status_help\n return true\n end\n status = client.get_status\n stats = client.get_statistics\n if status.has_key? 'operational'\n op = 'Unknown'\n op = 'Yes' if status['operational'] == 1\n op = 'No' if status['operational'] == 2\n print_status(\"Operational: #{op}\")\n end\n print_status(\"Device: #{status['device_name']}\") if status.key? 'device_name'\n print_status(\"FW Version: #{status['fw_version']}\") if status.key? 'fw_version'\n print_status(\"HW Version: #{status['hw_version']}\") if status.key? 'hw_version'\n print_status(\"Uptime: #{stats['uptime']} seconds\") if stats.key? 'uptime'\n print_status(\"Packets Sent: #{stats['packet_stats']}\") if stats.key? 'packet_stats'\n print_status(\"Last packet Sent: #{Time.at(stats['last_request'])}\") if stats.key? 'last_request'\n print_status(\"Voltage: #{stats['voltage']}\") if stats.key? 'voltage' and not stats['voltage'] == 'not supported'\n end", "def get_command_line_argument\n if ARGV.empty?\n puts \"Usage: ruby lookup.rb <domain>\" \n exit\n end ARGV.first # get frst argument in commnad line\nend", "def print_usage(options)\n puts\n puts \"Usage: \"+$0+\" -[\"+options+\"]\"\n puts\n puts \"-V:\\tDisplay version information\"\n puts \"-h:\\tDisplay usage information\"\n puts \"-v:\\tVerbose output\"\n puts \"-d:\\tDownload latest build but don't install\"\n puts \"-i:\\tDownload and install latest build\"\n puts \"-u:\\tUpdate application to latest build\"\n puts \"-l:\\tGet local build date for application\"\n puts \"-r:\\tGet remote build date for application\"\n puts \"-p:\\tGet URL of download for latest package\"\n puts \"-c:\\tCompare local and remote build dates\"\n puts \"-a:\\tShow available packages\"\n puts \"-g:\\tUpdate Gatekeeper and Quarantine information so application can run\"\n puts \"-z:\\tClean up temporary directory (delete files older than \"+$mtime+\" days)\"\n puts \"-Z:\\tRemove existing application\"\n puts \"-C:\\tRemove crash reporter file\"\n puts \"-P:\\tPerform post install\"\n puts \"-q:\\tQuit application\"\n puts \"-s:\\tStart application\"\n puts\nend", "def statuscmd\n end", "def usage\n puts \"$ #{__FILE__} SRC_PATH TARGET_PATH THREAD_COUNT\"\n puts \"$ #{__FILE__} user.url . 8\"\n exit\nend", "def cmd\n c = [\"open #{page_url}\"]\n c << argument_string(unknown_options) unless unknown_options.empty?\n c.join(\"\\n\")\n end", "def usage(stream=$stderr, status=1)\n stream.puts File.readlines(__FILE__).\n grep(/^#\\//).\n map {|line| line.sub(/^#. ?/, '')}.\n join\n exit status\nend", "def usage(stream=$stderr, status=1)\n stream.puts File.readlines(__FILE__).\n grep(/^#\\//).\n map { |line| line.sub(/^#. ?/, '') }.\n join\n exit status\nend", "def check_usage\n unless ARGV.length == 1\n puts \"Forma de uso: restaura.rb paginaweb\"\n exit\n end\nend", "def usage()\n $stderr.puts \"Uasge: ruby nbeparse <args> <nbe output>\"\n $stderr.puts\n $stderr.puts \"Arguments:\"\n $stderr.puts \"-l Display log message results\"\n $stderr.puts \"-h Display security holde results\"\n $stderr.puts \"-n Display security note results\"\n $stderr.puts \"-w Display security warning results\"\n $stderr.puts \"-ni Display results but don't display IP addresses\"\n $stderr.puts \"-i <ip address> Display only results with the given IP address\"\n exit(2)\nend", "def ShowStatus(arg0 = nil)\n ret = _invoke(1610743954, [arg0], [VT_BSTR])\n @lastargs = WIN32OLE::ARGV\n ret\n end", "def do_usage()\n puts \"Usage: gamera_dir [flags] server directory\"\n puts \"Import gamera OCR for book into specified TypeWright server from given directory.\"\n puts \"If book does not already exist, issue error.\"\n puts \" -v Verbose output\"\n puts \" -t Test only -- don't actually upload files\"\nend", "def argv; end", "def get_command_line_argument\n if ARGV.empty?\n puts \"Usage: ruby lookup.rb <Domain>\"\n exit\n end\n ARGV.first\nend", "def command_line\r\n ARGV.each do |arg|\r\n if arg == \"instructions\"\r\n instructions\r\n elsif arg == \"calculator\"\r\n ask_for_digits\r\n else\r\n \r\n end\r\n end\r\n \r\n end", "def usage\n basename = File.basename($0)\n necessary_inputs = \"<omsadmin_conf> <cert> <key> <pid> <proxy> <os_info> <install_info>\"\n print(\"\\nTelemetry tool for OMS Agent\\n\"\\\n \"ruby #{basename} #{necessary_inputs}\\n\"\\\n \"\\nOptional: Add -v for verbose output\\n\")\nend", "def daemon_show_usage\n daemon_show_version\n puts \"\\nUsage:\"\n puts \" -b, --background work in background mode\"\n puts \" -v, --version view version of daemon\"\n puts \" -h, --help view this help\"\nend", "def check_usage\n unless ARGV.length == 2\n puts \"Usage: gen_vimwiki_dict.rb wiki_folder dict_filename\"\n exit\n end\nend", "def usage( extra_usage = '' )\n extra_usage += ' '\n\n print_line <<USAGE\n Usage: #{File.basename( $0 )} #{extra_usage}\\[options\\] url\n\n Supported options:\n\n\n General ----------------------\n\n -h\n --help Output this.\n\n --version Show version information and exit.\n\n -v Be verbose.\n\n --debug Show what is happening internally.\n (You should give it a shot sometime ;) )\n\n --only-positives Echo positive results *only*.\n\n --http-username=<string> Username for HTTP authentication.\n\n --http-password=<string> Password for HTTP authentication.\n\n --http-req-limit=<integer> Concurrent HTTP requests limit.\n (Default: #{@opts.http_req_limit})\n (Be careful not to kill your server.)\n (*NOTE*: If your scan seems unresponsive try lowering the limit.)\n\n --http-queue-size=<integer> Maximum amount of requests to keep in the queue.\n Bigger size means better scheduling and better performance,\n smaller means less RAM consumption.\n (Default: #{@opts.http_queue_size})\n\n --http-timeout=<integer> HTTP request timeout in milliseconds.\n\n --cookie-jar=<filepath> Netscape HTTP cookie file, use curl to create it.\n\n --cookie-string='<name>=<value>; <name2>=<value2>'\n\n Cookies, as a string, to be sent to the web application.\n\n --user-agent=<string> Specify user agent.\n\n --custom-header='<name>=<value>'\n\n Specify custom headers to be included in the HTTP requests.\n (Can be used multiple times.)\n\n --authed-by=<string> E-mail address of the person who authorized the scan.\n (It'll make it easier on the sys-admins during log reviews.)\n (Will be used as a value for the 'From' HTTP header.)\n\n --login-check-url=<url> A URL used to verify that the scanner is still logged in to the web application.\n (Requires 'login-check-pattern'.)\n\n --login-check-pattern=<regexp>\n\n A pattern used against the body of the 'login-check-url' to verify that the scanner is still logged in to the web application.\n (Requires 'login-check-url'.)\n\n Profiles -----------------------\n\n --save-profile=<filepath> Save the current run profile/options to <filepath>.\n\n --load-profile=<filepath> Load a run profile from <filepath>.\n (Can be used multiple times.)\n (You can complement it with more options, except for:\n * --modules\n * --redundant)\n\n --show-profile Will output the running profile as CLI arguments.\n\n\n Crawler -----------------------\n\n -e <regexp>\n --exclude=<regexp> Exclude urls matching <regexp>.\n (Can be used multiple times.)\n\n --exclude-page=<regexp> Exclude pages whose content matches <regexp>.\n (Can be used multiple times.)\n\n -i <regexp>\n --include=<regexp> Include *only* urls matching <regex>.\n (Can be used multiple times.)\n\n --redundant=<regexp>:<limit>\n\n Limit crawl on redundant pages like galleries or catalogs.\n (URLs matching <regexp> will be crawled <limit> amount of times.)\n (Can be used multiple times.)\n\n --auto-redundant=<limit> Only follow <limit> amount of URLs with identical query parameter names.\n (Default: inf)\n (Will default to 10 if no value has been specified.)\n\n -f\n --follow-subdomains Follow links to subdomains.\n (Default: off)\n\n --depth=<integer> Directory depth limit.\n (Default: inf)\n (How deep Arachni should go into the site structure.)\n\n --link-count=<integer> How many links to follow.\n (Default: inf)\n\n --redirect-limit=<integer> How many redirects to follow.\n (Default: #{@opts.redirect_limit})\n\n --extend-paths=<filepath> Add the paths in <file> to the ones discovered by the crawler.\n (Can be used multiple times.)\n\n --restrict-paths=<filepath> Use the paths in <file> instead of crawling.\n (Can be used multiple times.)\n\n --https-only Forces the system to only follow HTTPS URLs.\n\n\n Auditor ------------------------\n\n -g\n --audit-links Audit links.\n\n -p\n --audit-forms Audit forms.\n\n -c\n --audit-cookies Audit cookies.\n\n --exclude-cookie=<name> Cookie to exclude from the audit by name.\n (Can be used multiple times.)\n\n --exclude-vector=<name> Input vector (parameter) not to audit by name.\n (Can be used multiple times.)\n\n --audit-headers Audit HTTP headers.\n (*NOTE*: Header audits use brute force.\n Almost all valid HTTP request headers will be audited\n even if there's no indication that the web app uses them.)\n (*WARNING*: Enabling this option will result in increased requests,\n maybe by an order of magnitude.)\n\n Coverage -----------------------\n\n --audit-cookies-extensively Submit all links and forms of the page along with the cookie permutations.\n (*WARNING*: This will severely increase the scan-time.)\n\n --fuzz-methods Audit links, forms and cookies using both GET and POST requests.\n (*WARNING*: This will severely increase the scan-time.)\n\n --exclude-binaries Exclude non text-based pages from the audit.\n (Binary content can confuse recon modules that perform pattern matching.)\n\n Modules ------------------------\n\n --lsmod=<regexp> List available modules based on the provided regular expression.\n (If no regexp is provided all modules will be listed.)\n (Can be used multiple times.)\n\n\n -m <modname,modname,...>\n --modules=<modname,modname,...>\n\n Comma separated list of modules to load.\n (Modules are referenced by their filename without the '.rb' extension, use '--lsmod' to list all.\n Use '*' as a module name to deploy all modules or as a wildcard, like so:\n xss* to load all xss modules\n sqli* to load all sql injection modules\n etc.\n\n You can exclude modules by prefixing their name with a minus sign:\n --modules=*,-backup_files,-xss\n The above will load all modules except for the 'backup_files' and 'xss' modules.\n\n Or mix and match:\n -xss* to unload all xss modules.)\n\n\n Reports ------------------------\n\n --lsrep=<regexp> List available reports based on the provided regular expression.\n (If no regexp is provided all reports will be listed.)\n (Can be used multiple times.)\n\n --repload=<filepath> Load audit results from an '.afr' report file.\n (Allows you to create new reports from finished scans.)\n\n --report='<report>:<optname>=<val>,<optname2>=<val2>,...'\n\n <report>: the name of the report as displayed by '--lsrep'\n (Reports are referenced by their filename without the '.rb' extension, use '--lsrep' to list all.)\n (Default: stdout)\n (Can be used multiple times.)\n\n\n Plugins ------------------------\n\n --lsplug=<regexp> List available plugins based on the provided regular expression.\n (If no regexp is provided all plugins will be listed.)\n (Can be used multiple times.)\n\n --plugin='<plugin>:<optname>=<val>,<optname2>=<val2>,...'\n\n <plugin>: the name of the plugin as displayed by '--lsplug'\n (Plugins are referenced by their filename without the '.rb' extension, use '--lsplug' to list all.)\n (Can be used multiple times.)\n\n Platforms ----------------------\n\n --lsplat List available platforms.\n\n --no-fingerprinting Disable platform fingerprinting.\n (By default, the system will try to identify the deployed server-side platforms automatically\n in order to avoid sending irrelevant payloads.)\n\n --platforms=<platform,platform,...>\n\n Comma separated list of platforms (by shortname) to audit.\n (The given platforms will be used *in addition* to fingerprinting. In order to restrict the audit to\n these platforms enable the '--no-fingerprinting' option.)\n\n Proxy --------------------------\n\n --proxy=<server:port> Proxy address to use.\n\n --proxy-auth=<user:passwd> Proxy authentication credentials.\n\n --proxy-type=<type> Proxy type; can be http, http_1_0, socks4, socks5, socks4a\n (Default: http)\n\n\nUSAGE\n end", "def print_usage\n puts \"usage: #{$0} URI [URI2 URI3..]\"\n puts \"\"\n puts \"Downloads resource from webdav server. File is \"\n puts \"uploaded back to webdav server when file us updated\"\n puts \"on local disk. \"\n exit\nend", "def help\n\tusage\n\tputs \"This tool is oriented to separate web pages into segments called blocks, based on the structural and visual properties\"\nend", "def print_usage(options,on_boot,terminal)\n puts\n puts \"Usage: \"+$0+\" -[\"+options+\"]\"\n puts\n puts \"-V:\\tDisplay version information\"\n puts \"-h:\\tDisplay usage information\"\n puts \"-i:\\tImport file\"\n puts \"-o:\\tOutput file\"\n puts \"-j:\\tConvert hosts file to a JSON file\"\n puts \"-t:\\tOutput to standard IO\"\n puts \"-T:\\tSet Terminal application (default #{terminal})\"\n puts \"-l:\\tStart Shuttle at login (default #{on_boot})\"\n puts\n return\nend", "def test_usage\n assert_equal 1, go_with_args(%w(-h))\n assert_match(/^Usage: /, @stderr_io.string )\n end", "def gentest argv\n argv = argv.dup\n @both = false\n process_opts(argv) if /^-/ =~ argv.first\n\n @service_controller = deduce_services_controller\n @ui = Hipe::IndentingStream.new($stdout,'')\n file = argv.shift\n mod = deduce_module_from_file file\n mod.spec.invocation_name = File.basename(file)\n get_actuals mod, argv\n @ui.indent!.indent!\n go_app(mod, file)\n go_desc(mod, file) do\n go_exp\n go_act(mod, argv)\n end\n exit(0) # rake is annoying\n end", "def parse_main(argv)\n defaults = {\n report: Inq::DEFAULT_REPORT_FILE,\n }\n\n opts = Okay::SimpleOpts.new(defaults: defaults)\n\n opts.banner = <<~EOF\n Usage: inq --repository REPOSITORY --date REPORT_DATE [--output REPORT_FILE]\n inq --config CONFIG_FILE --date REPORT_DATE\n EOF\n\n opts.separator \"\\nOptions:\"\n\n opts.simple(\"--config CONFIG_FILE\",\n \"YAML config file for automated reports.\",\n :config)\n\n opts.simple(\"--no-user-config\",\n \"Don't load user configuration file.\",\n :no_user_config)\n\n opts.simple(\"--env-config\",\n \"Use environment variables for configuration.\",\n \"Read this first: https://inqrb.com/config\",\n :env_login)\n\n opts.simple(\"--repository USER/REPO\", REPO_REGEXP,\n \"Repository to generate a report for.\",\n :repository)\n\n opts.simple(\"--date YYYY-MM-DD\", DATE_REGEXP, \"Last date of the report.\",\n :date)\n\n opts.simple(\"--start-date YYYY-MM-DD\", DATE_REGEXP, \"Start date of the report.\",\n :start_date)\n\n opts.simple(\"--end-date YYYY-MM-DD\", DATE_REGEXP, \"Last date of the report.\",\n :end_date)\n\n opts.simple(\"--output REPORT_FILE\", format_regexp,\n \"Output file for the report.\",\n \"Supported file formats: #{formats}.\",\n :report)\n\n opts.simple(\"--verbose\", \"Print debug information.\", :verbose)\n opts.simple(\"-v\", \"--version\", \"Prints version information.\", :version)\n opts.simple(\"-h\", \"--help\", \"Print help text.\", :help)\n\n [opts, opts.parse(argv)]\n end", "def alive_command_help\n puts \"The Ruby Farm - a simple command line animals app\"\n puts\n puts \"Command Usage:\"\n puts \" [alive | a] <name=> checks if an animal is alive by name\"\n puts \"\"\n puts \"Examples:\"\n puts \" bin/run [alive | a] name=my_animal_name\"\n end", "def print_missing_sec_arg\n puts ARGV[0] + \" requires second argument\"\n print_usage\nend", "def usage\n messages = [\n \"usage: #{$0} REPOS_PATH rev REV [COMMAND] - inspect revision REV\",\n \" #{$0} REPOS_PATH txn TXN [COMMAND] - inspect transaction TXN\",\n \" #{$0} REPOS_PATH [COMMAND] - inspect the youngest revision\",\n \"\",\n \"REV is a revision number > 0.\",\n \"TXN is a transaction name.\",\n \"\",\n \"If no command is given, the default output (which is the same as\",\n \"running the subcommands `info' then `tree') will be printed.\",\n \"\",\n \"COMMAND can be one of: \",\n \"\",\n \" author: print author.\",\n \" changed: print full change summary: all dirs & files changed.\",\n \" date: print the timestamp (revisions only).\",\n \" diff: print GNU-style diffs of changed files and props.\",\n \" dirs-changed: print changed directories.\",\n \" ids: print the tree, with nodes ids.\",\n \" info: print the author, data, log_size, and log message.\",\n \" log: print log message.\",\n \" tree: print the tree.\",\n \" uuid: print the repository's UUID (REV and TXN ignored).\",\n \" youngest: print the youngest revision number (REV and TXN ignored).\",\n ]\n puts(messages.join(\"\\n\"))\n exit(1)\nend", "def usage()\n STDOUT.puts \"USAGE: ruby find-missing-developers-in-git-commits.rb LOGS_FILE\"\nend", "def printUsage\n puts \"Usage: cities.rb City1 City2 City3 City4 City5\"\t \nend", "def checkstat(arg)\r\n# puts(\"#{CHECKSTAT} #{arg}\")\r\n `#{CHECKSTAT} #{arg}`\r\n end", "def commander _args\n \"commander _args;\" \n end", "def print_usage\n puts \"USAGE: #{PROGNAME} <ip|host> [warning,critical] [snmp_community]\"\n puts \" Default values: warning=80, critical=90, snmp_community=public\"\nend", "def help\n puts \"usage: #{@script} --site [URL]\"\n puts\n puts \" --site the site name to save the site\"\nend", "def printUsage\n \n print \"usage -- main.rb <structureFile> <outFile>\\n\"\n print \" <numTimesteps> - total number of timesteps to run\\n\"\n print \" <structureFile> - the PDB file to read in\\n\"\n print \" <outFilePrefix> - MD output (.out, .xyz)\\n\"\n \n end", "def usage\n puts <<EOU\nUSAGE:\n #{__FILE__} DOMÄN [ARGUMENT]\n\nTa bort en domän från mailservern\n\nArgument:\n -h, --help Visa denna information\n -s, --simulate Simulera allt, gör inga ändringar i filsystem eller databas\n\nTar bort domänen DOMÄN från mailservern.\nOBSERVERA att skriptet även har möjlighet att ta bort all tillhörande e-postkonton!\nEOU\n\n # We also exit the script here..\n exit(0)\nend", "def info(*args)\n self.exec(\"lxc-info\", *args).split(\"\\n\").uniq.flatten\n end", "def help\n puts \"#{$0} - parses EIS binary formatted files\"\nend", "def parse( args )\n opts = OptionParser.new\n opts.banner = 'Usage: stratus [options] target [target args]'\n\n opts.separator ''\n\n desired_opts = %[--describe --prereqs --tasks --trace]\n app.standard_rake_options.each do |options|\n next unless desired_opts.include?(options.first)\n opts.on(*options)\n end\n\n opts.separator ''\n opts.separator 'common options:'\n\n opts.on_tail( '-h', '--help', 'show this message' ) do\n @out.puts opts\n exit\n end\n opts.on_tail( '-q', '--quiet', 'show compact messages' ) do\n ENV['STRATUS_LOGGING'] = 'quiet'\n end\n opts.on_tail( '--version', 'show version' ) do\n @out.puts \"Stratus #{::Stratus::VERSION}\"\n exit\n end\n \n begin\n opts.parse! args\n rescue OptionParser::InvalidOption => ex\n puts \"!! #{ex}\"\n end\n \n \n ARGV.replace Array(args.shift)\n args.delete_if do |arg|\n if %r/^[A-Z_]+=/ =~ arg\n ARGV << arg\n next true\n end\n false\n end\n\n args\n end", "def index\n validate_arguments!\n\n Heroku::Command::Status.new.index\n display(\"\")\n\n styled_header(\"Checking processes\")\n get_processes(app)\n\n check_domains(app)\n display(\"\")\n\n styled_header(\"Recent Releases\")\n get_releases(app)\n display \"\"\n\n styled_header(\"Analyzing recent log entries\")\n get_log_stats(app)\n display \"\"\n\n end", "def new_page_info\n args = Webby.site.args\n\n # TODO: maybe even get rid of this method altogether\n raise \"Usage: webby #{args.rake.first} 'path'\" if args.raw.empty?\n\n [args.page, args.title, args.dir]\n end", "def usage\n puts \"USAGE: ruby site-maker.rb --source-dir=<path-to-source-dir> --dest-dir=<path-to-dest-dir>\"\nend", "def main(*args)\n #puts self.class # TODO: fix help\n raise NoCommandError\n end", "def cli_path=(_arg0); end", "def helpAndVerFirstArg\n raise Trollop::HelpNeeded if ARGV.empty? || ARGV[0] == '--help' || ARGV[0] == '-h' # show help screen\n raise Trollop::VersionNeeded if ARGV[0] == '--version' || ARGV[0].downcase == '-v' # show version screen\nend", "def usage\n puts \"usage: ./forecast <[location name]>\"\nend", "def usage\n $stderr.puts \"Usage: TestDrive -r[review request num] -d[diff version (defaults latest)] -a [to run rake test automatically] -s [to run script/server automatically] -p [p-value for patch (TestDrive attempts to guess)]\"\n exit(1)\nend", "def examples_page\n Format.usage('This is my examples page, I\\'ll show you a few examples of how to get me to do what you want.')\n Format.usage('Running me with a file: whitewidow.rb -f <path/to/file> keep the file inside of one of my directories.')\n Format.usage('Running me default, if you don\\'t want to use a file, because you don\\'t think I can handle it, or for whatever reason, you can run me default by passing the Default flag: whitewidow.rb -d this will allow me to scrape Google for some SQL vuln sites, no guarentees though!')\n Format.usage('Running me with my Help flag will show you all options an explanation of what they do and how to use them')\n Format.usage('Running me without a flag will show you the usage page. Not descriptive at all but gets the point across')\nend", "def show_details(args)\n # get a list of unknown commands\n unknown_cmds = args.select do |arg|\n !WeatherSage::CLI::Help::COMMANDS.key?(arg)\n end\n\n if unknown_cmds.size > 0\n # print list of unknown commands and exit\n puts 'Unknown commands: %s' % [unknown_cmds.join(', ')]\n exit -1\n end\n\n # print detailed help for each argument\n puts args.map { |arg| template(:one, commands[arg]) }\n end", "def parse_command_line args\n args.options do |opt|\n opt.on(\"rutema v#{Version::STRING}\")\n opt.on(\"Options:\")\n opt.on(\"--config FILE\", \"-c FILE\",String,\"Loads the configuration from FILE\") { |config_file| @config_file=config_file}\n opt.on(\"--check\",\"Runs just the suite setup test\"){@check=true}\n #opt.on(\"--step\",\"Runs test cases step by step\"){@step=true}\n opt.on(\"--silent\",\"Suppresses console output (only for the default reporters)\") { @silent=true}\n opt.on(\"--bare\",\"No default reporters whatsoever\") { @bare=true}\n #opt.on(\"--color\",\"Adds color to the Console reporter\") { @color=true}\n opt.on(\"-v\", \"--version\",\"Displays the version\") { $stdout.puts(\"rutema v#{Version::STRING}\");exit 0 }\n opt.on(\"--help\", \"-h\", \"-?\", \"This text\") { $stdout.puts opt; exit 0 }\n opt.on(\"--debug\", \"-d\", \"Turn on debug messages\") { $DEBUG=true }\n opt.on(\"You can provide a specification filename in order to run a single test\")\n opt.parse!\n #and now the rest\n unless @config_file\n puts \"No configuration file defined!\\n\"\n $stdout.puts opt \n exit 1\n end\n if !args.empty?\n @test_identifier=args.shift\n end\n end\n end", "def checkCommandLine\r\n if ARGV.length != 2\r\n puts \"\\nUsage: sum <fileName> <numThreads>\\n\\n\"\r\n exit(1)\r\n end\r\nend", "def read_from_cmdline\n require \"shellwords.rb\"\n words = Shellwords.shellwords(\n if not ARGV.empty?\n ARGV.join(' ')\n else\n STDERR.print \"(offline mode: enter name=value pairs on standard input)\\n\" if STDIN.tty?\n readlines.join(' ').gsub(/\\n/, '')\n end.gsub(/\\\\=/, '%3D').gsub(/\\\\&/, '%26'))\n\n if words.find{|x| x =~ /=/} then words.join('&') else words.join('+') end\n end", "def main_options\n commands = {\"1\" => \"See all buildings\" ,\n \"2\" => \"Set a unit as rented/avalilable\" ,\n \"3\" => \"Create new Building\",\n \"4\" => \"Exit program\"}\n\n commands.each do |option, description |\n puts \"#{option} - #{description} \"\n end\n print \"\\n:>\"\n gets_chomp(commands)\n end", "def print_usage(options)\n puts\n puts \"Usage: \"+$0+\" -[\"+options+\"]\"\n puts\n puts \"-V:\\tDisplay version information\"\n puts \"-h:\\tDisplay usage information\"\n puts \"-a:\\tProcess all PDFs\"\n puts \"-d:\\tSet PDF directory\"\n puts \"-f:\\tProcess a file\"\n puts \"-l:\\tList all pdf files\"\n puts \"-p:\\tSet product\"\n puts \"-r:\\tSet release\"\n puts \"-o:\\tOutput to file\"\n puts \"-t:\\tOutput in TXT mode\"\n puts \"-c:\\tOutput in CSV mode\"\n puts \"-x:\\tOutput in XLS mode\"\n puts \"-v:\\tVerbose mode\"\n puts\n return\nend", "def commandGetOut _args\n \"commandGetOut _args;\" \n end", "def process_arguments\n @args << \"-h\" if(@args.length < 1)\n \n opts_parse = OptionParser.new do |opts|\n opts.on('-f','--file FILE','use the following local file') {|file| @options.file = File.expand_path(file)}\n opts.on('-p','--parse PARSE',\"sets which set of sider files to download #{@@sections.join(\"|\")}\") {|parse| @options.parse = parse}\n opts.on('-d','--download','download the file to be parsed') {@options.download = true}\n opts.on('-o','--output DIR','set the output directory') {|directory| @options.output = File.expand_path(directory)}\n opts.on('-h','--help',\"prints the help\"){puts opts; exit!}\n end\n \n opts_parse.parse!(@args) rescue raise \"There was an error processing command line arguments use -h to see help\"\n end", "def usage\n puts \"usage: isf2asc.rb isf_filename\"\nend", "def print_usage \n puts \"Usage: packagize [-h] [-v] [-r] [-s source_dir] [-d dest_dir]\"\n puts \"\\tSource and destination default to the current working directory.\"\n puts \"\\t-r search directory and all subdirectories. Defaults to true.\"\n puts \"\\t-v display verbose output. Defaults to false.\"\n puts \"\\t-h display this text.\"\nend", "def status( *args, **options )\n\t\tresponse = self.server.run_with_json_template( :status, *args, **options )\n\n\t\treturn response.map {|entry| Hglib::Repo::StatusEntry.new(entry) }\n\tend", "def handle_options\n parse_options(argv)\n if config[:version]\n show_version\n else\n show_help\n end\n exit 0\n end", "def parse_command_line\n OptionParser.new do |opts|\n opts.banner = \"Usage: ruby #{$0} [options]\"\n\n opts.on_head(\"-h\", \"--help\", \"Show this help message\") do\n puts opts\n exit\n end\n\n opts.on(\"-v\", \"--verbose\", \"Show all progress messages (INFO, DEBUG, WARNING, ERROR)\") do\n Logger.verbose = true\n end\n\n opts.on(\"-q\", \"--quiet\", \"Only show WARNING and ERROR messages\") do\n Logger.quiet = true\n end\n\n opts.on(\"--console\", \"Open up a console to query the source via rbgccxml\") do\n @requesting_console = true\n end\n\n opts.on(\"--clean\", \"Force a complete clean and rebuild of this extension\") do\n @force_rebuild = true\n end\n\n end.parse!\n end", "def get_parallels_vm_status(options)\n message = \"Information:\\tDetermining status of Parallels VM \"+options['name']\n command = \"prlctl list \\\"#{options['name']}\\\" --info |grep '^Status' |grep ^State |cut -f2 -d:\"\n status = execute_command(options,message,command)\n status = status.chomp.gsub(/\\s+/,\"\")\n return status\nend", "def usage\n puts <<EOU\nUSAGE:\n #{__FILE__} [ARGUMENT]\n\nArgument:\n -h, --help Visa denna information\n\n -a, --alias ALIAS Lista alias vars 'alias' matchar ALIAS\n -r, --reciever MOTTAGARE Lista alias vars 'mottagare' matchar MOTTAGARE\n\nTIPS: Använd tillsammans med less om listan är för lång:\n\n #{__FILE__}|less\n\nEOU\n\n # We also exit the script here..\n exit(0)\nend", "def usage(errmsg = nil)\n\tprogname = File.basename($0)\n\tSTDERR.print \"ERROR: #{errmsg}\\n\\n\" if errmsg\n\tSTDERR.print \"\\\nUsage:\n\t#{progname} -h\n\t#{progname} [-c] [-d] [-f] [-w] [-r] -a\n\t#{progname} [-c] [-d] [-f] [-w] [-r] <switch IP address 1> ...\nDescription:\n\tdeploy files to Alaxala switches, such as certificate files (i.e.,\n\tcertificate itself, private key, intermediate CA certificate), HTML\n\tfiles for Web authentication.\n\tIf an option, ``-a,'' is given, deploy to all switches using LLDP or\n\tCDP. All files should be placed into the FTP server,\n\t\t#{FTP_SERVER}:#{PATH} (for certificate files),\n\t\t#{FTP_SERVER}:#{HTML} (for HTML files),\n\tin advance.\nArguments:\n\tswitch IP address: an IP address of a switch.\nOptions:\n\t-h:\toutput this help message.\n\t-c:\tdeploy certificate files.\n\t-d:\tdry run (do not actually reboot).\n\t-f:\tforce to consider all switches as requiring reboots.\n\t-w:\tdeploy HTML files.\n\t-r:\treload a switch if necessary (only for certificate files).\n\t-a:\tdeploy to all switches.\nExample:\n\toutput information:\n\t\t#{progname} 192.168.0.1\n\t\t#{progname} -a\n\tinstalling certificate files:\n\t\t#{progname} -c 192.168.0.1\n\t\t#{progname} -c -a\n\tinstalling certificate and HTML files:\n\t\t#{progname} -c -w 192.168.0.1\n\t\t#{progname} -c -w -a\n\treload switches if and only if necessary (only for certificate files):\n\t\t#{progname} -r 192.168.0.1\n\t\t#{progname} -r -a\n\"\n exit 1\nend", "def cmd_get argv\n setup argv\n e = @hash['element']\n response = @api.get(e)\n msg JSON.pretty_generate(response)\n return response\n end", "def text_from_args\n\t\t\treturn ARGV.join(' ').gsub(\"\\t\",'')\n\t\tend", "def usage(message = nil)\n returnCode = 0\n if (message != nil && message.length > 0)\n puts 'Error: '+message\n puts\n returnCode = 1\n end\n \n puts <<-END\nUsage:\n#{$0} -d dir -s url [ -w delay ] [ -m id ]\n\nOptions:\n-?: Display this usage information.\n-h: Display this usage information.\n-d: A directory containing raw images and tile sets.\n-m: An optional map ID to process (instead of all maps).\n-s: A server URL from which map metadata can be queried.\n-w: An optional delay (in seconds) to wait in between runs.\n-p: A server URL where maps are going to be available.\nEND\n returnCode\n end", "def parse_cli\n require 'getoptlong'\n require 'rdoc/usage'\n \n opts = GetoptLong.new(\n [ '--help', '-h', GetoptLong::NO_ARGUMENT ],\n [ \"--quote-terms\", '-q', GetoptLong::NO_ARGUMENT ]\n )\n \nend", "def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n # populate arguments\n possible_sections.each do |method_name|\n # get display name\n arg = OpenStudio::Measure::OSArgument.makeBoolArgument(method_name, true)\n display_name = eval(\"OsLib_Reporting.#{method_name}(nil,nil,nil,true)[:title]\")\n arg.setDisplayName(display_name)\n arg.setDefaultValue(true)\n args << arg\n end\n\n args\n end", "def usage\n\t#puts \"\\nUsage: #{$0} operation [vapp-name] [snap-name]\\n\"\n\t#puts \"\\n\\toperation: list|get|poweron|poweroff|shutdown|reset|suspend|createsnapshot|removesnapshot\"\n\tputs \"\\te.g. vcaexplorer token\".green\n\tputs \"\\te.g. vcaexplorer plans\".green\n\tputs \"\\te.g. vcaexplorer instances\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta \n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" computetoken\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" catalogs\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" catalog\".green + \" <catalog id>\".magenta\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" vms\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" vapps\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" vdcs\".green\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" vdc\".green + \" <vdc id>\".magenta\n\tputs \"\\te.g. vcaexplorer instance\".green + \" <instance id>\".magenta + \" vdc\".green + \" <vdc id>\".magenta + \" networks\".green\n\tputs \"\\te.g. vcaexplorer users\".green\n\tputs \"\\te.g. vcaexplorer servicegroups\".green\n\tputs \"\\te.g. vcaexplorer billedcosts\".green\n\tputs \"\\te.g. vcaexplorer billablecosts\".green\n\tputs \"\\te.g. vcaexplorer customquery\".green + \" <REST GET query>\".magenta + \" <ContentType>\".magenta\n\tputs \"\\n\"\n\nend", "def check_usage\n if ARGV[0].nil? \n puts \"Usage: differences.rb old-inventory new-inventory\"\n exit\n end\nend", "def test_status\n \tassert_equal(UI.parseCommand('status', StatusCmd1*\" \"),UI.main(StatusCmd1))\n \tassert_equal(UI.parseCommand('status', StatusCmdInv*\" \"),UI.main(StatusCmdInv))\n end", "def read_from_cmdline\n require \"shellwords\"\n\n string = unless ARGV.empty?\n ARGV.join(' ')\n else\n if STDIN.tty?\n STDERR.print(\n %|(offline mode: enter name=value pairs on standard input)\\n|\n )\n end\n array = readlines rescue nil\n if not array.nil?\n array.join(' ').gsub(/\\n/n, '')\n else\n \"\"\n end\n end.gsub(/\\\\=/n, '%3D').gsub(/\\\\&/n, '%26')\n\n words = Shellwords.shellwords(string)\n\n if words.find{|x| /=/n.match(x) }\n words.join('&')\n else\n words.join('+')\n end\n end", "def run_latest(argv = ARGV)\n pp get_latest_incidents\n end", "def buildCaptureStatsCmd()\n cmd = \"ruby \" + File.dirname(__FILE__) + \"/CaptureStats.rb \" + @markedBam + \n \" \" + @chipDesign\n puts \"Command to calculate capture stats \" + cmd\n return cmd\n end", "def print_usage_exit(code)\n STDERR.puts(File.open(\"#{File.expand_path(File.dirname(__FILE__))}/usage.txt\").read)\n exit code\nend", "def print_usage_exit(code)\n STDERR.puts(File.open(\"#{File.expand_path(File.dirname(__FILE__))}/usage.txt\").read)\n exit code\nend", "def printUsageMessage()\n\n print \"Check the last NAMD log file in a directory to make sure the run either completed\\n\"\n print \"successfully or died after all necessary restart files were written. Then restart\\n\"\n print \"the run or print an error message.\\n\"\n print \" autoNamdRun.rb <configFile>\\n\"\n print \" <configFile> - file listing all NAMD jobs to check\\n\"\n\n return\nend", "def init( args )\n # Make sure we're in a folder with a Sitefile\n options = app.standard_rake_options\n [['--rakefile', 'StratusSite'],\n ['--no-search', nil],\n ['--silent', nil]].each {|opt, value| options.assoc(opt).last.call(value)}\n\n unless app.have_rakefile\n @mode = :app\n end\n\n import_default_tasks\n import_website_tasks\n require_lib_files\n capture_command_line_args(args)\n \n # if args.length == 0 && @mode == :app\n # puts \"Try using:\\n stratus -T\"\n # end\n \n args\n end", "def show(*args)\n page, output, status = self.page, self.output, self.status\n case args.length\n when 3\n page, output, status = args\n when 2\n page, last = args\n case last\n when Fixnum\n status = last\n else\n output = last\n end\n when 1\n case (arg = args.first)\n when Fixnum\n status = arg\n else\n page = arg\n end\n end\n page(page)\n status(status)\n output(output)\n end", "def run(args)\n if args.size > 0\n # show details of given commands\n show_details(args)\n else\n # print full list of commands\n list_commands\n end\n end", "def run_argv\n first, *other = ARGV\n ARGV.clear\n case first\n when 'favs', \"f\"\n display_favorites\n when '-new', \"-n\"\n \n add_to_favorites(other.join(' '))\n puts \"#{other.join(' ')} has been added to the list\"\n process_favorites\n when '-today', '-t'\n raise StandardError, \"Currently offline, connect the internet to see todays activities - check if online '-online' '-o'\" if @alive == false\n display_today_activity_name\n when '-weekend', '-w'\n raise StandardError, \"Currently offline, connect the internet to see the weekends activities - check if online '-online' '-o'\" if @alive == false\n display_weekend_activity_name\n when '-all', '-a'\n raise StandardError, \"Currently offline, connect the internet to see the list of activities - check if online '-online' '-o'\" if @alive == false\n display_today_activity_name\n display_today_activity_name\n when '-online', '-o'\n puts @alive\n when '-help', '-h'\n puts \"-today, -t Displays todays activities\"\n puts \"-weekend, -w Displays weekend activities\"\n puts \"-all, -a Displays all activities\"\n puts \"-new, -n Add your own favourite\"\n puts \"-online, -o Checks internet connection\"\n else\n puts 'Not a valid argument!'\n end\n File.write(@file_path, @processed_favs.uniq.to_json) \n end", "def usage\n puts <<EOU\nUSAGE:\n #{__FILE__} E-POST [ARGUMENT]\n\nTa bort e-postkontot för E-POST\n\nArgument:\n -h, --help Visa denna information\n -s, --simulate Simulera allt, gör inga ändringar i filsystem eller databas\nEOU\n\n # We also exit the script here..\n exit(0)\nend", "def print_usage\n puts \"Usage: \" + File.basename($0)\n puts \" \" + File.basename($0) + \" -n N (N number of random people)\"\n puts \" \" + File.basename($0) + \" -g N (Groups of N random people)\"\n puts \" \" + File.basename($0) + \" -G N (N Groups of random people)\"\nend", "def cmd_list_by_status argv\n setup argv\n status = @hash['status']\n response = @api.list_by_status(status)\n if response.is_a?(Array)\n response.each do | r |\n msg r\n end\n else\n msg response\n end\n end", "def start_point\n help = [\n '',\n \"Use: #{me} start-point [COMMAND]\",\n '',\n 'Manage cyber-dojo start-points',\n '',\n 'Commands:',\n minitab + 'create Creates a new start-point',\n minitab + 'rm Removes a start-point',\n minitab + 'latest Updates docker images named inside a start-point',\n minitab + 'ls Lists the names of all start-points',\n minitab + 'inspect Displays details of a start-point',\n minitab + 'pull Pulls all the docker images named inside a start-point',\n '',\n \"Run '#{me} start-point COMMAND --help' for more information on a command\",\n ]\n\n if [nil,'--help'].include? ARGV[1]\n show help\n exit succeeded\n end\n\n case ARGV[1]\n when 'create' then start_point_create\n when 'rm' then start_point_rm\n when 'latest' then start_point_latest\n when 'ls' then start_point_ls\n when 'inspect' then start_point_inspect\n when 'pull' then start_point_pull\n else begin\n STDERR.puts \"FAILED: unknown argument [#{ARGV[1]}]\"\n exit(failed)\n end\n end\nend", "def usage()\n puts \"\\nUsage: #{File.basename($0)}\"\n puts \"\\t-d --device\\t\\t\\tList of devices to configure (file).\"\n puts \"\\t-c --config\\t\\t\\tConfiguration file to commit.\"\n puts \"\\t-u --username\\t\\t\\tSSH username.\"\n puts \"\\t-p --password\\t\\t\\t(Optional) SSH password.\"\n puts \"\\t-h --help\\t\\t\\tDisplay the usage.\\n\\n\"\n puts \"* If you have spaces in the path to your file(s), please enclose them in quotes \\\"\\\".\\n\\n\"\n exit\nend", "def printUsage\n print \"usage -- Moldyne.rb <numTimesteps> <structureFile> <outFile>\\n\"\n print \" <numTimesteps> - total number of timesteps to run\\n\"\n print \" <structureFile> - the PDB file to read in\\n\"\n print \" <outFilePrefix> - prefix for two output files (.out, .xyz)\\n\"\n end", "def getPage\n # get specific page from last argument\n page = @arguments[@arguments.length - 1] \n # get url for specific page\n url = \"http://oldschoolrunescape.wikia.com/wiki/#{page}\"\n\n # prints url for debugging\n# puts(url)\n\n # request page\n @page = HTTParty.get(url)\n\n # check to see if this was a valid request\n if @page.include? \"This page does not exist. Mayhaps it should?\"\n # if not valid request, abort \n abort(\"Incorrect input. Make sure you spelling is correct. The syntax is:\\n\\n\\tOSQuery -m This_monster\\n\\nThe first letter of the item must be capitalized with the rest of the letters lowercase, and there must be an underscore between each word with no spaces.\")\n end # -- end check for valid request\n end", "def get_cli_start_point\n if ENV.include?(\"from\") && ENV['from'] && ENV['from'].to_i > 0\n return ENV['from'].to_i\n else\n return 1\n end\n end", "def notifycmdline\r\n\t\t\t`#{BITS::BITSADMIN} /getnotifycmdline {#{@id}}`\r\n\t\tend", "def cmd_help argv\n help\n end", "def cmd_help argv\n help\n end" ]
[ "0.6488304", "0.6299749", "0.61792845", "0.6164793", "0.61597157", "0.61445755", "0.61108774", "0.6023222", "0.6021952", "0.5862398", "0.5859729", "0.5814775", "0.5780555", "0.57691836", "0.5760154", "0.5750055", "0.569719", "0.567924", "0.5660239", "0.5642321", "0.56366444", "0.56235284", "0.55808926", "0.55686396", "0.55521643", "0.5550114", "0.5544485", "0.5525872", "0.551968", "0.55175644", "0.5510926", "0.5500662", "0.54839087", "0.547464", "0.54711056", "0.54404074", "0.5438529", "0.5434032", "0.54334116", "0.5429317", "0.54261404", "0.5424269", "0.54229844", "0.5421954", "0.54213774", "0.5420292", "0.5405742", "0.5400335", "0.5400138", "0.53974086", "0.53970665", "0.53893405", "0.53881884", "0.53831875", "0.5383006", "0.5375449", "0.5367145", "0.5364415", "0.53500664", "0.53467035", "0.53463215", "0.5345441", "0.5337256", "0.53360766", "0.5333612", "0.5329699", "0.53242123", "0.5323842", "0.53238285", "0.53203964", "0.53186625", "0.5318586", "0.5317529", "0.5314096", "0.53109694", "0.5308036", "0.5305102", "0.5296646", "0.52953345", "0.5293818", "0.52936476", "0.52909863", "0.52820987", "0.52820987", "0.52804714", "0.52767646", "0.52737063", "0.52644277", "0.52566814", "0.5250988", "0.5248799", "0.5245676", "0.52369744", "0.5235422", "0.523175", "0.5228404", "0.52246857", "0.52242976", "0.5215397", "0.5215397" ]
0.6677714
0
gets additional system status information, imncluding hard drive, model and serial data argv = commandline arguments
def cmd_status2 argv setup argv response = @api.status2 msg response return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n print_status(\"Gathering System info ....\")\n vm = nil\n dmi_info = nil\n ls_pci_data = nil\n\n if is_root?\n dmi_info = cmd_exec(\"/usr/sbin/dmidecode\")\n end\n\n # Check DMi Info\n if dmi_info\n case dmi_info\n when /microsoft corporation/i\n vm = \"MS Hyper-V\"\n when /vmware/i\n vm = \"VMware\"\n when /virtualbox/i\n vm = \"VirtualBox\"\n when /qemu/i\n vm = \"Qemu/KVM\"\n when /domu/i\n vm = \"Xen\"\n end\n end\n\n # Check Modules\n if not vm\n loaded_modules = cmd_exec(\"/sbin/lsmod\")\n case loaded_modules.to_s.gsub(\"\\n\", \" \")\n when /vboxsf|vboxguest/i\n vm = \"VirtualBox\"\n when /vmw_ballon|vmxnet|vmw/i\n vm = \"VMware\"\n when /xen-vbd|xen-vnif/\n vm = \"Xen\"\n when /virtio_pci|virtio_net/\n vm = \"Qemu/KVM\"\n when /hv_vmbus|hv_blkvsc|hv_netvsc|hv_utils|hv_storvsc/\n vm = \"MS Hyper-V\"\n end\n end\n\n # Check SCSI Driver\n if not vm\n proc_scsi = read_file(\"/proc/scsi/scsi\") rescue \"\"\n case proc_scsi.gsub(\"\\n\", \" \")\n when /vmware/i\n vm = \"VMware\"\n when /vbox/i\n vm = \"VirtualBox\"\n end\n end\n\n # Check IDE Devices\n if not vm\n case cmd_exec(\"cat /proc/ide/hd*/model\")\n when /vbox/i\n vm = \"VirtualBox\"\n when /vmware/i\n vm = \"VMware\"\n when /qemu/i\n vm = \"Qemu/KVM\"\n when /virtual [vc]d/i\n vm = \"Hyper-V/Virtual PC\"\n end\n end\n\n # Check using lspci\n if not vm\n case get_sysinfo[:distro]\n when /oracle|centos|suse|redhat|mandrake|slackware|fedora/i\n lspci_data = cmd_exec(\"/sbin/lspci\")\n when /debian|ubuntu/\n lspci_data = cmd_exec(\"/usr/bin/lspci\")\n else\n lspci_data = cmd_exec(\"lspci\")\n end\n\n case lspci_data.to_s.gsub(\"\\n\", \" \")\n when /vmware/i\n vm = \"VMware\"\n when /virtualbox/i\n vm = \"VirtualBox\"\n end\n end\n\n # Xen bus check\n if not vm\n if cmd_exec(\"ls -1 /sys/bus\").to_s.split(\"\\n\").include?(\"xen\")\n vm = \"Xen\"\n end\n end\n\n # Check using lscpu\n if not vm\n case cmd_exec(\"lscpu\")\n when /Xen/i\n vm = \"Xen\"\n when /KVM/i\n vm = \"KVM\"\n when /Microsoft/i\n vm = \"MS Hyper-V\"\n end\n end\n\n # Check dmesg Output\n if not vm\n dmesg = cmd_exec(\"dmesg\")\n case dmesg\n when /vboxbios|vboxcput|vboxfacp|vboxxsdt|vbox cd-rom|vbox harddisk/i\n vm = \"VirtualBox\"\n when /vmware virtual ide|vmware pvscsi|vmware virtual platform/i\n vm = \"VMware\"\n when /xen_mem|xen-vbd/i\n vm = \"Xen\"\n when /qemu virtual cpu version/i\n vm = \"Qemu/KVM\"\n when /\\/dev\\/vmnet/\n vm = \"VMware\"\n end\n end\n\n if vm\n print_good(\"This appears to be a '#{vm}' virtual machine\")\n report_virtualization(vm)\n else\n print_status(\"This does not appear to be a virtual machine\")\n end\n\n end", "def cmd_status(*args)\n if args.length > 0\n cmd_status_help\n return true\n end\n status = client.get_status\n stats = client.get_statistics\n if status.has_key? 'operational'\n op = 'Unknown'\n op = 'Yes' if status['operational'] == 1\n op = 'No' if status['operational'] == 2\n print_status(\"Operational: #{op}\")\n end\n print_status(\"Device: #{status['device_name']}\") if status.key? 'device_name'\n print_status(\"FW Version: #{status['fw_version']}\") if status.key? 'fw_version'\n print_status(\"HW Version: #{status['hw_version']}\") if status.key? 'hw_version'\n print_status(\"Uptime: #{stats['uptime']} seconds\") if stats.key? 'uptime'\n print_status(\"Packets Sent: #{stats['packet_stats']}\") if stats.key? 'packet_stats'\n print_status(\"Last packet Sent: #{Time.at(stats['last_request'])}\") if stats.key? 'last_request'\n print_status(\"Voltage: #{stats['voltage']}\") if stats.key? 'voltage' and not stats['voltage'] == 'not supported'\n end", "def get_machine_system_info(machine, output_format = 'LIST')\n handle_action_exceptions(__method__) do\n info = machine_run(machine, \"systeminfo /FO #{output_format.upcase}\")\n @json ? { 'result' => 'Success', 'content' => info } : info\n end\n end", "def get_device_info()\n @errors = []\n info = {}\n return info unless @programmer_path\n\n response = IO.popen(\"#{@programmer_path} I\").readlines\n puts response if $debug\n response.each do |line|\n if line =~ /Error/i\n errors << line\n else\n parts = line.split(/:|\\.\\.\\./)\n info[parts[0].strip.split.join.to_sym] = parts[1].strip if parts.size == 2\n end\n end # each\n info\n end", "def current_status\n if OperatingSystem.mac?\n return { os: {mac: 'mac' }}\n end\n\n if OperatingSystem.linux?\n top = %x(top -b -n 1)\n load_averages = top.split(\"\\n\")[0].partition(\"load average:\")[2].strip.split(\", \")\n puts \"Load last 1 minute: #{load_averages[0]}\"\n puts \"Load last 5 minutes: #{load_averages[1]}\"\n puts \"Load last 15 minutes: #{load_averages[2]}\"\n uptime = top.split(\"\\n\")[0].split(\", \")[0].partition(\"up\")[2].strip+','+top.split(\"\\n\")[0].split(\", \")[1]\n puts \"Uptime: #{uptime}\"\n user_sessions = top.split(\"\\n\")[0].split(\", \")[2].strip.to_i\n cpu = 100.0 - top.split(\"\\n\")[2].split(', ')[3].to_f\n puts \"Current User sessions: #{user_sessions}\"\n puts \"#{top.split(\"\\n\")[1]}\"\n puts \"% CPU (user processes): #{top.split(\"\\n\")[2].split(', ')[0].partition(\":\")[2]}\"\n puts \"% CPU (system processes): #{top.split(\"\\n\")[2].split(', ')[1]}\"\n puts \"% CPU (priority nice): #{top.split(\"\\n\")[2].split(', ')[2]}\"\n puts \"% CPU (idle): #{top.split(\"\\n\")[2].split(', ')[3]}\"\n puts \"% CPU (waiting for I/O): #{top.split(\"\\n\")[2].split(', ')[4]}\"\n puts \"% CPU (hardware interpts):#{top.split(\"\\n\")[2].split(', ')[5]}\"\n puts \"% CPU (software interpts):#{top.split(\"\\n\")[2].split(', ')[6]}\"\n puts \"RAM: #{top.split(\"\\n\")[3]}\"\n puts \"SWAP:#{top.split(\"\\n\")[4]}\"\n total_memory = top.split(\"\\n\")[3].split(' ')[2].to_f\n free_memory = top.split(\"\\n\")[3].split(' ')[6].to_f\n free_memory_perc = (free_memory / total_memory * 100).round\n swap_used = top.split(\"\\n\")[4].split(', ')[3].to_f\n\n disk_space = %x(df /tmp --total -k -h)\n puts \"Disk Space (Total): #{disk_space.split(\"\\n\")[-1].partition(\"total\")[2].split[0]}\"\n puts \"Disk Space (Used): #{disk_space.split(\"\\n\")[-1].partition(\"total\")[2].split[1]}\"\n puts \"Disk Space (Avail): #{disk_space.split(\"\\n\")[-1].partition(\"total\")[2].split[2]}\"\n puts \"Disk Space (%Used): #{disk_space.split(\"\\n\")[-1].partition(\"total\")[2].split[3]}\"\n disk_space_used = disk_space.split(\"\\n\")[-1].partition(\"total\")[2].split[3].to_i\n puts \"---\"\n\n {\n os: {\n up_time: uptime,\n load: load_averages[0],\n cpu: cpu,\n free_memory: free_memory_perc,\n disk_space: disk_space_used,\n swap_used: swap_used,\n }\n }\n end\n end", "def statuscmd\n end", "def initialize(opts)\n resume = opts[:resume]\n source_host_def = define_source(opts[:config])\n source_host_ssh = CLI.spinner(\"Logging in to #{source_host_def[:host]}\") do\n host_login(source_host_def)\n end\n\n profile = CLI.spinner(\"Checking source host\") do\n profile = Profile.new(source_host_ssh)\n profile.build\n profile\n end\n platform = Platform::V2.new(profile[:cpe])\n\n memory = profile[:memory]\n memory_percent = memory[:mem_used].to_f / memory[:total] * 100\n swapping = memory[:swapping?]\n ftag = \"#{CLI.bold}%15s#{CLI.reset}:\"\n hist_mem = profile[:memory_hist][:mem_used]\n\n puts\n puts \"#{CLI.bold}System Information#{CLI.reset}\"\n puts \"#{ftag} #{platform} (#{profile[:cpe]})\" % \"OS\"\n puts \"#{ftag} #{profile[:arch]}\" % \"Arch\"\n puts \"#{ftag} #{profile[:hostname]}\" % \"Hostname\"\n puts\n\n puts \"#{CLI.bold}CPU Statistics#{CLI.reset}\"\n puts \"#{ftag} %d\" % [\"CPU Count\", profile[:cpu][:count]]\n puts \"#{ftag} %d MHz\" % [\"CPU Speed\", profile[:cpu][:speed]]\n puts \n\n puts \"#{CLI.bold}Memory Statistics#{CLI.reset}\"\n puts \"#{ftag} %d MiB\" % [\"Total RAM\", memory[:total]]\n puts \"#{ftag} %d MiB (%2.1f%%)\" % [\"RAM Used\", memory[:mem_used],\n memory_percent]\n puts \"#{ftag} %d MiB\" % [\"Swap Used\", memory[:swap_used]] if swapping\n puts \"#{ftag} %d%%\" % [\"Hist. RAM Used\", hist_mem] unless hist_mem.nil?\n puts \n\n puts \"#{CLI.bold}Hard Disk Statistics#{CLI.reset}\"\n puts \"#{ftag} %2.1f GB\" % [\"Disk Used\", profile[:disk]]\n puts\n\n puts \"#{CLI.bold}System Statistics#{CLI.reset}\"\n puts \"#{ftag} #{profile[:io][:uptime]}\" % \"Uptime\"\n puts \"#{ftag} #{profile[:io][:wait]}\" % \"I/O Wait\"\n puts\n\n puts \"#{CLI.bold}IP Information#{CLI.reset}\"\n puts \"#{ftag} #{profile[:ip][:public].join(', ')}\" % \"Public\"\n puts \"#{ftag} #{profile[:ip][:private].join(', ')}\" % \"Private\"\n puts\n\n puts \"#{CLI.bold}MySQL Databases#{CLI.reset}\"\n puts \"#{ftag} #{profile[:db][:count]}\" % \"Number\"\n puts \"#{ftag} #{profile[:db][:size]}\" % \"Total Size\"\n puts\n\n puts \"#{CLI.bold}Libraries#{CLI.reset}\"\n puts \"#{ftag} #{profile[:lib][:libc]}\" % \"LIBC\"\n puts \"#{ftag} #{profile[:lib][:perl]}\" % \"Perl\"\n puts \"#{ftag} #{profile[:lib][:python]}\" % \"Python\"\n puts \"#{ftag} #{profile[:lib][:ruby]}\" % \"Ruby\"\n puts \"#{ftag} #{profile[:lib][:php]}\" % \"PHP\"\n unless profile.warnings.empty?\n puts\n print CLI.red + CLI.bold\n profile.warnings.each { |warning| puts warning }\n print CLI.reset\n end\n\n source_host_ssh.logout!\n end", "def cmd_status argv\n setup argv\n response = @api.status\n msg response\n return response\n end", "def status x\n system(\"clear\")\n puts x.center @lw\n puts\n puts ('USS ' + @shipname.capitalize + ' Command Interface').center(35)\n puts\n if @phasers\n puts 'Phasers: Armed'\n else\n puts 'Phasers: Disarmed'\n end\n\n if @photons\n puts 'Photon Torpedoes: Armed'\n else\n puts 'Photon Torpedoes: Disarmed'\n end\n\n if @shields\n puts 'Shields: Raised'\n else\n puts 'Shields: Lowered'\n end\n\n puts 'Alert: ' + @alert\n puts 'Engines: ' + @engines\n\n if @sensors == []\n puts 'Sensors: None Selected'\n else\n puts 'Sensors: ' + @sensors.join(', ')\n end\n\n select\n end", "def get_device_info\n IO.popen('adb shell getprop ro.product.brand') { |f| $device = f.gets.chomp.upcase}\n $device += ' '\n IO.popen('adb shell getprop ro.product.model') { |f| $device += f.gets.chomp.upcase}\n IO.popen('adb shell getprop ro.build.version.release') { |f| $os_version = f.gets.chomp.upcase}\n return $device, $os_version\nend", "def systemctl_status( *units )\n opts = units.last.is_a?( Hash ) && units.pop || {}\n sudo( <<-SH, opts )\n systemctl status #{units.join ' '} | sed -E -e 's/\\\\s+$//'\n SH\n end", "def sysinfo\n\t\trequest = Packet.create_request('stdapi_sys_config_sysinfo')\n\t\tresponse = client.send_request(request)\n\n\t\t{\n\t\t\t'Computer' => response.get_tlv_value(TLV_TYPE_COMPUTER_NAME),\n\t\t\t'OS' => response.get_tlv_value(TLV_TYPE_OS_NAME),\n\t\t}\n\tend", "def get_parallels_vm_status(options)\n message = \"Information:\\tDetermining status of Parallels VM \"+options['name']\n command = \"prlctl list \\\"#{options['name']}\\\" --info |grep '^Status' |grep ^State |cut -f2 -d:\"\n status = execute_command(options,message,command)\n status = status.chomp.gsub(/\\s+/,\"\")\n return status\nend", "def cmd_status argv\n setup argv\n uuid = @hash['uuid']\n response = @api.status(uuid)\n msg response\n return response\n end", "def get_sysinfo\n\t\tsystem_data = {}\n\t\tkernel_version = cmd_exec(\"uname -a\")\n\t\tversion = read_file(\"/etc/release\").split(\"\\n\")[0].strip\n\t\tsystem_data[:version] = version\n\t\tsystem_data[:kernel] = kernel_version\n\t\tsystem_data[:hostname] = kernel_version.split(\" \")[1]\n\t\treturn system_data\n\tend", "def basic_info\n\t\t#Grab some basic info using OID values which should be fairly generic in nature\n\t\ttarget = \"#{@manager.config[:host]}:#{@manager.config[:port]}\"\n\t\tcstring = @manager.config[:community]\n\t\t@snmp_version = @manager.config[:version] #We need this one later for some decisions so setting to class var\n\t\tsys_name = @manager.get_value(\"sysName.0\")\n\t\tsys_descr = @manager.get_value(\"sysDescr.0\")\n\n\t\t#Print out our basic info for user\n\t\tputs \"[*] \".light_green + \"Target\".light_yellow + \": #{target}\".white\n\t\tputs \"[*] \".light_green + \"Community String\".light_yellow + \": #{cstring}\".white\n\t\tif @snmp_version\n\t\t\tputs \"[*] \".light_green + \"SNMP Version\".light_yellow + \": #{@snmp_version}\".white\n\t\telse\n\t\t\tprint_caution(\"Unable to determine SNMP Version in use?\")\n\t\tend\n\t\tif sys_name\n\t\t\tputs \"[*] \".light_green + \"System Name\".light_yellow + \": #{sys_name}\".white\n\t\telse\n\t\t\tprint_error(\"Unable to determine system name!\")\n\t\tend\n\t\tif sys_descr\n\t\t\tputs \"[*] \".light_green + \"System Description\".light_yellow + \": \\n#{sys_descr}\".white\n\t\telse\n\t\t\tprint_error(\"Unable to find system description!\")\n\t\tend\n\t\tif @sys_time\n\t\t\tputs \"[*] \".light_green + \"System Uptime\".light_yellow + \": #{@sys_time}\".white\n\t\telse\n\t\t\tprint_error(\"Unable to find system description!\")\n\t\tend\n\tend", "def info\n return 'STATE=d' if @state == 'd'\n\n if @vm.vm_info\n guest_ip = @vm.vm_info['guest.ipAddress']\n else\n guest_ip = @vm['guest.ipAddress']\n end\n\n used_cpu = @monitor[:used_cpu]\n used_memory = @monitor[:used_memory]\n netrx = @monitor[:netrx]\n nettx = @monitor[:nettx]\n diskrdbytes = @monitor[:diskrdbytes]\n diskwrbytes = @monitor[:diskwrbytes]\n diskrdiops = @monitor[:diskrdiops]\n diskwriops = @monitor[:diskwriops]\n\n if @vm.vm_info\n esx_host = @vm.vm_info[:esx_host_name].to_s\n else\n esx_host = @vm['runtime.host.name'].to_s\n end\n\n if @vm.vm_info\n guest_state = @vm.vm_info['guest.guestState'].to_s\n else\n guest_state = @vm['guest.guestState'].to_s\n end\n\n if @vm.vm_info\n vmware_tools = @vm.vm_info['guest.toolsRunningStatus'].to_s\n else\n vmware_tools = @vm['guest.toolsRunningStatus'].to_s\n end\n\n if @vm.vm_info\n vm_name = @vm.vm_info['name'].to_s\n else\n vm_name = @vm['name'].to_s\n end\n\n if @vm.vm_info\n vmtools_ver = @vm.vm_info['guest.toolsVersion'].to_s\n else\n vmtools_ver = @vm['guest.toolsVersion'].to_s\n end\n\n if @vm.vm_info\n vmtools_verst = @vm.vm_info['guest.toolsVersionStatus2'].to_s\n else\n vmtools_verst = @vm['guest.toolsVersionStatus2'].to_s\n end\n\n if @vm.vm_info\n rp_name = @vm.vm_info[:rp_list]\n .select do |item|\n item[:ref] == @vm.vm_info['resourcePool']._ref\n end\n .first[:name] rescue ''\n\n rp_name = 'Resources' if rp_name.empty?\n else\n rp_name = @vm['resourcePool'].name\n end\n\n str_info = ''\n\n str_info = 'GUEST_IP=' << guest_ip.to_s << ' ' if guest_ip\n\n if @guest_ip_addresses && !@guest_ip_addresses.empty?\n str_info << 'GUEST_IP_ADDRESSES=\"' << @guest_ip_addresses.to_s \\\n << '\" '\n end\n\n str_info << \"#{POLL_ATTRIBUTE[:state]}=\" << @state << ' '\n str_info << \"#{POLL_ATTRIBUTE[:cpu]}=\" << used_cpu.to_s << ' '\n str_info << \"#{POLL_ATTRIBUTE[:memory]}=\" << used_memory.to_s << ' '\n str_info << \"#{POLL_ATTRIBUTE[:netrx]}=\" << netrx.to_s << ' '\n str_info << \"#{POLL_ATTRIBUTE[:nettx]}=\" << nettx.to_s << ' '\n\n str_info << 'DISKRDBYTES=' << diskrdbytes.to_s << ' '\n str_info << 'DISKWRBYTES=' << diskwrbytes.to_s << ' '\n str_info << 'DISKRDIOPS=' << diskrdiops.to_s << ' '\n str_info << 'DISKWRIOPS=' << diskwriops.to_s << ' '\n\n str_info << 'VCENTER_ESX_HOST=\"' << esx_host << '\" '\n str_info << 'VCENTER_GUEST_STATE=' << guest_state << ' '\n str_info << 'VCENTER_VM_NAME=\"' << vm_name << '\" '\n str_info << 'VCENTER_VMWARETOOLS_RUNNING_STATUS=' << vmware_tools << ' '\n str_info << 'VCENTER_VMWARETOOLS_VERSION=' << vmtools_ver << ' '\n str_info << 'VCENTER_VMWARETOOLS_VERSION_STATUS=' \\\n << vmtools_verst << ' '\n str_info << 'VCENTER_RP_NAME=\"' << rp_name << '\" '\n\n # @vm.info_disks.each do |disk|\n # str_info << \"DISK_#{disk[0]}_ACTUAL_PATH=\\\"[\" <<\n # disk[1].ds.name << '] ' << disk[1].path << '\" '\n # end\n\n str_info\n end", "def get_sysinfo\n\t\tsystem_data = {}\n\t\tetc_files = cmd_exec(\"ls /etc\").split()\n\n\t\tkernel_version = cmd_exec(\"uname -a\")\n\t\tsystem_data[:kernel] = kernel_version\n\n\t\t# Debian\n\t\tif etc_files.include?(\"debian_version\")\n\t\t\tif kernel_version =~ /Ubuntu/\n\t\t\t\tversion = read_file(\"/etc/issue\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\t\tsystem_data[:distro] = \"ubuntu\"\n\t\t\t\tsystem_data[:version] = version\n\t\t\telse\n\t\t\t\tversion = read_file(\"/etc/issue\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\t\tsystem_data[:distro] = \"debian\"\n\t\t\t\tsystem_data[:version] = version\n\t\t\tend\n\n\t\t# Amazon\n\t\telsif etc_files.include?(\"system-release\")\n\t\t\tversion = read_file(\"/etc/system-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"amazon\"\n\t\t\tsystem_data[:version] = version\n\n\t\t# Fedora\n\t\telsif etc_files.include?(\"fedora-release\")\n\t\t\tversion = read_file(\"/etc/fedora-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"fedora\"\n\t\t\tsystem_data[:version] = version\n\n\t\t# Oracle Linux\n\t\telsif etc_files.include?(\"enterprise-release\")\n\t\t\tversion = read_file(\"/etc/enterprise-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"oracle\"\n\t\t\tsystem_data[:version] = version\n\n\t\t# RedHat\n\t\telsif etc_files.include?(\"redhat-release\")\n\t\t\tversion = read_file(\"/etc/redhat-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"redhat\"\n\t\t\tsystem_data[:version] = version\n\n\t\t# Arch\n\t\telsif etc_files.include?(\"arch-release\")\n\t\t\tversion = read_file(\"/etc/arch-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"arch\"\n\t\t\tsystem_data[:version] = version\n\n\t\t# Slackware\n\t\telsif etc_files.include?(\"slackware-version\")\n\t\t\tversion = read_file(\"/etc/slackware-version\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"slackware\"\n\t\t\tsystem_data[:version] = version\n\n\t\t# Mandrake\n\t\telsif etc_files.include?(\"mandrake-release\")\n\t\t\tversion = read_file(\"/etc/mandrake-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"mandrake\"\n\t\t\tsystem_data[:version] = version\n\n\t\t#SuSE\n\t\telsif etc_files.include?(\"SuSE-release\")\n\t\t\tversion = read_file(\"/etc/SuSE-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"suse\"\n\t\t\tsystem_data[:version] = version\n\n\t\t# Gentoo\n\t\telsif etc_files.include?(\"gentoo-release\")\n\t\t\tversion = read_file(\"/etc/gentoo-release\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"gentoo\"\n\t\t\tsystem_data[:version] = version\n\t\telse\n\n\t\t\t# Others\n\t\t\tversion = read_file(\"/etc/issue\").gsub(/\\n|\\\\n|\\\\l/,'')\n\t\t\tsystem_data[:distro] = \"linux\"\n\t\t\tsystem_data[:version] = version\n\t\tend\n\t\treturn system_data\n\tend", "def get_unix_info()\n v = $VERBOSE\n $VERBOSE = nil\n sysname = `uname -s`\n $VERBOSE = v\n sysname = sysname.chomp\n\n if(sysname.include?(\"Linux\")) # for linux (rhel, suse, oel)\n # check if it is SUSE\n filepath = Pathname.new(\"/etc/SuSE-release\")\n if(filepath.exist?())\n release_file = '/etc/SuSE-release'\n else # for RHEL, OEL, etc.\n release_file = '/etc/issue'\n end\n\n $VERBOSE = nil\n flavor = `head -n 1 #{release_file}`\n $VERBOSE = v\n sysname = flavor.sub(/\\(\\w+\\)/, '').chomp\n sysname = sysname.sub(/\\s+\\Z/, \"\")\n\n else # for other unix platforms (solaris, aix, hpux)\n $VERBOSE = nil\n if(sysname.eql?(\"AIX\"))\n version = `oslevel`\n else\n version = `uname -r`\n end\n $VERBOSE = v\n sysname = sysname + \" \" + version.chomp\n end\n\n $VERBOSE = nil\n if(sysname.eql?(\"HP-UX\"))\n processor = `uname -m`\n else\n processor = `uname -p`\n end\n\n if(sysname.include?(\"SunOS\"))\n isainfo = `isainfo -b`\n isainfo = isainfo.chomp\n bitinfo = \" \" + isainfo + \"-bit\"\n else\n bitinfo = \"\"\n end\n $VERBOSE = v\n\n os_info = sysname + \" \" + processor.chomp + bitinfo\n os_info\nend", "def info(vm)\n used_cpu = @monitor[:used_cpu]\n used_memory = @monitor[:used_memory]\n netrx = @monitor[:netrx]\n nettx = @monitor[:nettx]\n diskrdbytes = @monitor[:diskrdbytes]\n diskwrbytes = @monitor[:diskwrbytes]\n diskrdiops = @monitor[:diskrdiops]\n diskwriops = @monitor[:diskwriops]\n\n if vm[:mob]\n guest_ip = vm[:mob].guest.ipAddress\n esx_host = vm[:mob].runtime.host.name.to_s\n guest_state = vm[:mob].guest.guestState.to_s\n vmware_tools = vm[:mob].guest.toolsRunningStatus.to_s\n vm_name = vm[:mob].name.to_s\n vmtools_ver = vm[:mob].guest.toolsVersion.to_s\n vmtools_verst = vm[:mob].guest.toolsVersionStatus2.to_s\n end\n\n # if vm[:mob]\n # rp_name = vm[:mob][:rp_list]\n # .select do |item|\n # item[:ref] == vm[:mob]['resourcePool']._ref\n # end\n # .first[:name] rescue ''\n\n # rp_name = 'Resources' if rp_name.empty?\n # else\n # rp_name = @vm['resourcePool'].name\n # end\n\n str_info = ''\n\n str_info << 'GUEST_IP=' << guest_ip.to_s << \"\\n\" if guest_ip\n\n if @guest_ip_addresses && !@guest_ip_addresses.empty?\n str_info << 'GUEST_IP_ADDRESSES=\"' << @guest_ip_addresses.to_s \\\n << '\" '\n end\n\n str_info << \"#{POLL_ATTRIBUTE[:cpu]}=\" << used_cpu.to_s << \"\\n\"\n str_info << \"#{POLL_ATTRIBUTE[:memory]}=\" << used_memory.to_s << \"\\n\"\n str_info << \"#{POLL_ATTRIBUTE[:netrx]}=\" << netrx.to_s << \"\\n\"\n str_info << \"#{POLL_ATTRIBUTE[:nettx]}=\" << nettx.to_s << \"\\n\"\n\n str_info << 'DISKRDBYTES=' << diskrdbytes.to_s << \"\\n\"\n str_info << 'DISKWRBYTES=' << diskwrbytes.to_s << \"\\n\"\n str_info << 'DISKRDIOPS=' << diskrdiops.to_s << \"\\n\"\n str_info << 'DISKWRIOPS=' << diskwriops.to_s << \"\\n\"\n\n str_info << 'VCENTER_ESX_HOST=\"' << esx_host << '\" ' << \"\\n\"\n str_info << 'VCENTER_GUEST_STATE=' << guest_state << \"\\n\"\n str_info << 'VCENTER_VM_NAME=\"' << vm_name << '\" ' << \"\\n\"\n str_info << 'VCENTER_VMWARETOOLS_RUNNING_STATUS=' << vmware_tools << \"\\n\"\n str_info << 'VCENTER_VMWARETOOLS_VERSION=' << vmtools_ver << \"\\n\"\n str_info << 'VCENTER_VMWARETOOLS_VERSION_STATUS=' \\\n << vmtools_verst << \"\\n\"\n # str_info << 'VCENTER_RP_NAME=\"' << rp_name << '\" '\n\n # I need modify this Carlos improvement.\n # @vm.info_disks.each do |disk|\n # str_info << \"DISK_#{disk[0]}_ACTUAL_PATH=\\\"[\" <<\n # disk[1].ds.name << '] ' << disk[1].path << '\" '\n # end\n\n str_info\n end", "def get_status\n\t\tEventMachine::get_subprocess_status @signature\n\tend", "def cmd_info\n cmd_author\n cmd_date\n cmd_log(true)\n end", "def cobbler_info(system_name,options)\n connection = XMLRPC::Client.new2(\"#{options[:cobbler_api]}\")\n system_data = connection.call(\"get_system_as_rendered\",\"#{system_name}\")\n return(system_data)\nend", "def show_usage\n puts\n puts \"Available Commands & General Usage:\".white.underline\n puts \" config\".light_yellow + \" => \".white + \"Configure Connection Credentials\".light_yellow\n puts \" os_scan\".light_yellow + \" => \".white + \"SMB OS Discovery Scan\".light_yellow\n puts \" cat [FILE]\".light_yellow + \" => \".white + \"Display Content of Local File\".light_yellow\n puts \" local\".light_yellow + \" => \".white + \"Drop to Local OS Shell to Execute Commands\".light_yellow\n puts \" rb [CODE]\".light_yellow + \" => \".white + \"Eval Ruby Code\".light_yellow\n if @working\n puts\n # Credentialed Options\n puts \"Authenticated Options:\".white.underline\n puts \" smbclient\".light_yellow + \" => \".white + \"Drop to Interactive SMBClient Shell Session\".light_yellow\n puts \" list\".light_yellow + \" => \".white + \"List Available Shares\".light_yellow\n puts \" use [SHARE]\".light_yellow + \" => \".white + \"Use Specified Share Name\".light_yellow\n puts \" ls [DIR]\".light_yellow + \" => \".white + \"List Directory Contents\".light_yellow\n puts \" dl [FILE]\".light_yellow + \" => \".white + \"Download Remote File\".light_yellow\n puts \" up [FILE] [DIR]\".light_yellow + \" => \".white + \"Upload File to Remote Directory\".light_yellow\n puts \" rm [FILE] [DIR]\".light_yellow + \" => \".white + \"Delete File in Remote Directory\".light_yellow\n puts \" mkdir [NAME] [DIR]\".light_yellow + \" => \".white + \"Make New Directory in Remote Directory\".light_yellow\n puts \" rmdir [NAME] [DIR]\".light_yellow + \" => \".white + \"Delete Remote Directory\".light_yellow\n puts\n puts \"PSEXEC Options:\".white.underline\n puts \" os_shell\".light_yellow + \" => \".white + \"OS Pseudo Shell - Execute Multiple Commands\".light_yellow\n puts \" os_exec\".light_yellow + \" => \".white + \"Execute Single OS Command on target\".light_yellow\n puts \" os_pshexec\".light_yellow + \" => \".white + \"Execute PowerShell Payload\".light_yellow\n puts \" up_exec\".light_yellow + \" => \".white + \"Upload & Execute EXE Payload\".light_yellow\n puts \" get_hives\".light_yellow + \" => \".white + \"Download Windows Registry Hives\".light_yellow\n puts \" get_ntds\".light_yellow + \" => \".white + \"Download Active Directory NTDS.dit File from DC\".light_yellow\n puts\n puts \"MOF Options:\".white.underline\n puts \" mof_exec\".light_yellow + \" => \".white + \"Execute Single OS Command on target\".light_yellow\n puts \" mof_up\".light_yellow + \" => \".white + \"Upload & Execute EXE Payload\".light_yellow\n puts\n puts \"Fun & Enumeration:\".white.underline\n puts \" swaparoo\".light_yellow + \" => \".white + \"Windows Swaparoo Setup & Repair\".light_yellow\n puts \" uac_check\".light_yellow + \" => \".white + \"Check if UAC is Enabled\".light_yellow\n puts \" disable_uac\".light_yellow + \" => \".white + \"Disable UAC via Registry Edits\".light_yellow\n puts \" enable_uac\".light_yellow + \" => \".white + \"Re-Enable UAC via Registry Edits\".light_yellow\n puts \" domain_admin\".light_yellow + \" => \".white + \"Get List of Domain Admin Users\".light_yellow\n puts \" active_users\".light_yellow + \" => \".white + \"Get List of Logged in Users\".light_yellow\n puts\n end\n puts\n if not @working\n puts \"Use 'config' option to set & validate credentials to make more options available\".light_yellow + \"!\".white\n puts\n end\nend", "def system_info\n si = SysInfo.new\n si.to_hash\n rescue \n {}\n end", "def show_vm_status(vmname)\r\n current = {:errormsg => \"\", :status => \"\", :time => \"\", :vmstatus => \"\"}\r\n\r\n conn_opts=get_cli_connection\r\n Chef::Log.debug(\"#{conn_opts[:host]}...show vm name=#{vmname}\")\r\n Net::SSH.start( conn_opts[:host], conn_opts[:user], :password => conn_opts[:password], :port => conn_opts[:port] ) do|ssh|\r\n output = ssh.exec!(\"show vm name=#{vmname}\")\r\n output.each_line do |line|\r\n if line.match(/Status:/)\r\n current[:status]=line.split[1].strip\r\n elsif line.match(/Time:/)\r\n line[\"Time: \"]=\"\"\r\n current[:time]=line.strip\r\n elsif line.match(/ Status = /)\r\n current[:vmstatus]=line.split('=')[1].strip\r\n elsif line.match(/Error Msg:/)\r\n line[\"Error Msg: \"]=\"\"\r\n current[:errormsg]=line.strip\r\n end\r\n end\r\n end\r\n return current\r\n end", "def read_device_version()\n start_command('F83', false, @status_debug_msg)\n end", "def get_status\n r = {}\n if have_lock?\n @handle.rewind\n r[:message] = (@handle.eof? ? 'The current process is busy.' : @handle.readline.strip)\n r[:percent] = (@handle.eof? ? '' : @handle.readline.strip)\n r[:locked] = true\n elsif is_locked?\n if File.exist?(status_file_path)\n begin\n File.open(status_file_path, 'r') do |f|\n r[:message] = (f.eof? ? 'The system is busy.' : f.readline.strip)\n r[:percent] = (f.eof? ? '' : f.readline.strip)\n end\n rescue\n r[:message] = 'The system appears busy.'\n r[:percent] = ''\n end\n else\n r[:message] = 'No status file.'\n r[:percent] = ''\n end\n r[:locked] = true\n else\n r[:message] = 'The system is no longer busy.'\n r[:percent] = '-'\n r[:locked] = false\n end\n r\n end", "def info\n [[\"about\", Mysh::DESCRIPTION],\n [\"version\", Mysh::VERSION],\n [\"installed\", Gem::Specification.find_all_by_name(\"mysh\")\n .map{|s| s.version.to_s}\n .join(\", \")],\n [\"latest\", insouciant {latest_version_for(\"mysh\").to_s}],\n [\"init file\", $mysh_init_file.to_host_spec],\n [\"user\", ENV['USER']],\n [\"home\", (ENV['HOME'] || \"\").to_host_spec],\n [\"name\", (t = MNV[:name]).empty? ? $PROGRAM_NAME.to_host_spec : t],\n [\"os shell\", (ENV['SHELL'] || ENV['ComSpec'] || \"\").to_host_spec],\n [\"host\", ENV['HOSTNAME'] || ENV['COMPUTERNAME']],\n [\"os\", ENV['OS']],\n [\"platform\", MiniTerm::TERM_PLATFORM],\n [\"java?\", MiniTerm.java? ? true : false],\n [\"PID\", $PROCESS_ID]\n ]\n end", "def main()\n date = getDate() # getting of date\n volume = getVol() # getting of volume\n batt = getBatt() # getting of battery\n cpu = getCPU( \"only\" )\n mem = getMem()\n # wifi = getWifi()\n wifi = getIsWifi()\n\n output = sprintf( \"%s %s %s %s %s %s\", cpu, mem, batt, volume, wifi, date )\n # output = sprintf( \"%s %s %s %s %s\", mem, batt, volume, wifi, date )\n\n puts( output )\n # system( \"xsetroot -name \" + '\"' + output + '\"' )\nend", "def get_status\n\n #Create status file if needed...\n begin\n status_hash = YAML::load_file(status_file)\n rescue\n save_status\n status_hash = YAML::load_file(status_file)\n end\n\n @job_uuid = status_hash[\"job_uuid\"]\n\n @files_total = status_hash[\"files_total\"]\n @files_local = status_hash[\"files_local\"]\n @file_size_mb = status_hash[\"files_size_mb\"]\n\n #Conversion stats.\n @activities_total = status_hash[\"activities_total\"]\n @activities_converted = status_hash[\"activities_converted\"]\n\n #Consolidation stats.\n @files_consolidated = status_hash[\"files_consolidated\"]\n\n @file_current = status_hash[\"file_current\"]\n @status = status_hash[\"status\"]\n @error = status_hash[\"error\"]\n\n #Process modes.\n @enabled = status_hash[\"enabled\"]\n @download = status_hash[\"download\"]\n @convert = status_hash[\"convert\"]\n @consolidate = status_hash[\"consolidate\"]\n end", "def get_battery_status_osx\n line = Cocaine::CommandLine.new('pmset', '-g batt')\n output = line.run\n end", "def status\n Command::Installer::Status.new(\n *command_params\n ).execute\n rescue => e\n catch_errors(e)\n end", "def status\n output = StringIO.new\n output << @game.player.to_s\n output << \"\\n\"\n\n output << \"#{@game.current_room_model.description}\\n\"\n\n treasure = @game.current_room_model.treasure\n output << \"\\nThere is treasure here worth $#{treasure}.\\n\" if treasure && treasure > 0\n\n monster = @game.current_room_model.monster\n if monster\n output << \"\\nDANGER... THERE IS A MONSTER HERE....\\n\\n\"\n output << \"#{@game.current_room_model.monster}\\n\\n\"\n end\n\n if @game.current_room_model.name != \"Exit\"\n output << \"\\nWhat do you want to do? \"\n end\n \n output.string\n end", "def command_line_info\n puts \"\\nCommand line arguments:\\n\\n\"\n puts \"This program will accept a single command line argument on launch. Arguments can be passed to draughts_app.rb directly or to draughts.sh\\n\"\n puts \"Example: draughts.sh --help\\n\\n\"\n puts \"-h or --help Display all command line arguments\"\n puts \"-i or --info Display instructions on how to play\"\n puts \"-v or --version Display current application and Ruby version\"\n puts \"start Skip menu and immediately start a new game\"\n puts \"wins Print win counts\"\n puts \"\"\nend", "def info\n info = Hash.new\n output = @filer.invoke(\"system-get-info\")\n if(output.results_errno() != 0)\n r = output.results_reason()\n raise \"Failed : \\n\" + r\n else \n output.children_get[0].children_get.each do |naelem|\n info[naelem.name] = naelem.content\n end\n end\n info\n end", "def help\n puts \" The average system capacity in the U.S is 4kW or 4000W\"\n puts \"\"\n puts \" Azimuth values in degrees, i.e 180 being south\"\n puts \"\"\n puts \" Tilt is the angle from the horizontal of your array. This programs default is 30.26. If mounted on your roof, its the roof pitch\"\n puts \"\"\n puts \" Array Type values here are as follows\"\n puts \"\"\n puts \" 0. Fixed open rack\"\n puts \" 1. Fixed roof mount\"\n puts \" 2. 1-axis\"\n puts \" 3. 1-axis backtracking\"\n puts \" 4. 2-axis\"\n puts \"\"\n puts \" Module Type assigns values as follows\"\n puts \"\"\n puts \" 0.\tStandard ~15% efficiency\"\n puts \" 1.\tPremium ~19% efficiency\"\n puts \" 2.\tThin film ~10% efficiency\"\n puts \"\"\n puts \" Losses can be difficult assess. On average most systems can be said to have around 14% loss\"\n puts \"\"\n puts \"\"\n puts \"For further reading\"\n puts \"NREL National Renewable Energy Laboratory\"\n puts \"September 2004 PVWatts Version 5 Manual\"\n puts \" Aron P. Dobos\"\n puts \"www.nrel.gov/publications.\"\n puts \"\"\n puts \"\"\n end", "def read_device_version()\n execute_command('F83', false, @status_debug_msg)\n end", "def do_usage()\n puts \"Usage: gamera_dir [flags] server directory\"\n puts \"Import gamera OCR for book into specified TypeWright server from given directory.\"\n puts \"If book does not already exist, issue error.\"\n puts \" -v Verbose output\"\n puts \" -t Test only -- don't actually upload files\"\nend", "def fetch_basic_info\n {\n server: Socket.gethostname,\n rails_root: defined?(Rails) ? Rails.root : nil,\n process: $PROCESS_ID,\n uname: Sys::Uname.uname,\n timestamp: @timestamp,\n pwd: File.expand_path($PROGRAM_NAME)\n }\n end", "def status\n $stdout.puts \"The current status of the pow server is:\\n\\n\"\n result = %x{curl localhost/status.json --silent --header host:pow}\n json = JSON.parse(result)\n json.each_pair { |k,v| $stdout.puts \" #{k}: #{v}\" }\n $stdout.puts \"\\n\"\n end", "def determine_io\n io = @info[:io] = {}\n\n iostat = @shell.query('IOSTAT', \"iostat -c|sed -n 4p|awk '#{print $4}'\")\n io[:wait] = iostat.to_f\n\n up = @shell.query('UPTIME', \"uptime|sed -e 's/.*up\\\\([^,]*\\\\),.*/\\\\1/'\")\n io[:uptime] = up.chomp\n end", "def test_cmd_system_status\n api = Mu::Command::Cmd_system.new\n result = api.cmd_status []\n doc = Nokogiri::XML(result)\n ports = doc.xpath(\"//ports\")\n assert(ports.length >= 5, \"expected to find at least 5 ports, but got #{ports.length}\")\n end", "def print_usage(options)\n puts\n puts \"Usage: \"+$0+\" -[\"+options+\"]\"\n puts\n puts \"-V:\\tDisplay version information\"\n puts \"-h:\\tDisplay usage information\"\n puts \"-v:\\tVerbose output\"\n puts \"-d:\\tDownload latest build but don't install\"\n puts \"-i:\\tDownload and install latest build\"\n puts \"-u:\\tUpdate application to latest build\"\n puts \"-l:\\tGet local build date for application\"\n puts \"-r:\\tGet remote build date for application\"\n puts \"-p:\\tGet URL of download for latest package\"\n puts \"-c:\\tCompare local and remote build dates\"\n puts \"-a:\\tShow available packages\"\n puts \"-g:\\tUpdate Gatekeeper and Quarantine information so application can run\"\n puts \"-z:\\tClean up temporary directory (delete files older than \"+$mtime+\" days)\"\n puts \"-Z:\\tRemove existing application\"\n puts \"-C:\\tRemove crash reporter file\"\n puts \"-P:\\tPerform post install\"\n puts \"-q:\\tQuit application\"\n puts \"-s:\\tStart application\"\n puts\nend", "def status(service)\n systemctl \"status\", \"-l\", service\n end", "def cmd_sysinfo(*args)\n info = client.sys.config.sysinfo(refresh: true)\n width = \"Meterpreter\".length\n info.keys.each { |k| width = k.length if k.length > width and info[k] }\n\n info.each_pair do |key, value|\n print_line(\"#{key.ljust(width+1)}: #{value}\") if value\n end\n print_line(\"#{\"Meterpreter\".ljust(width+1)}: #{client.session_type}\")\n\n return true\n end", "def disk_statistics(flags=\"\")\n disk_stats = Vmstator::DiskStatistics.new\n output = `vmstat #{flags}`.split(\"\\n\")\n # remove first line of the output\n output.shift\n output.shift\n output.each do |line|\n name, total, merged, sectors, ms, total, merged, sectors, ms, cur, sec = line.split\n data = {:name => name, :totoal => total, :merged => merged, :sectors => sectors,\n :ms => ms, :cur => cur, :sec => sec }\n disk_stats.update(data)\n end\n disk_stats\n end", "def system(cmd, *rest) end", "def read_device_version()\n @ramps_arduino.execute_command('F83', false, @status_debug_msg)\n end", "def get_status\n send_command(0x79)\n end", "def system_describe\n return @sd_cache if @sd_cache\n sd = {:sdversion => @sd[:sdversion], :name => @sd[:name], :id => @sd[:id]}\n sd[:version] = @sd[:version] if @sd[:version]\n sd[:summary] = @sd[:summary] if @sd[:summary]\n sd[:help] = @sd[:help] if @sd[:help]\n sd[:address] = @sd[:address] if @sd[:address]\n sd[:procs] = []\n @procs.each do |name, prop|\n next if name == 'system.describe'\n pd = {:name => name}\n pd[:summary] = prop[:summary] if prop[:summary]\n pd[:help] = prop[:help] if prop[:help]\n pd[:idempotent] = prop[:idempotent] if prop[:idempotent]\n pd[:params] = prop[:params] if prop[:params]\n pd[:return] = prop[:return] if prop[:return]\n sd[:procs] << pd\n end\n @sd_cache = sd\n end", "def set_system_information(opts)\n opts = check_params(opts,[:system_info])\n super(opts)\n end", "def test_status\n \tassert_equal(UI.parseCommand('status', StatusCmd1*\" \"),UI.main(StatusCmd1))\n \tassert_equal(UI.parseCommand('status', StatusCmdInv*\" \"),UI.main(StatusCmdInv))\n end", "def system(cmd,*params)\n\t\tself.log \"VantagePoint::system: running \\\"#{cmd} #{params.join(\" \")}\\\"\"\n\t\treturn Kernel::system(cmd,*params)\n\tend", "def status\n \n # Check the daemon\n %x(cd #{params[:dir]}; #{params[:daemon]} -conf=coin.conf getinfo 2>&1)\n render :json => {:result => :failure} if not $?.success?\n \n # Grep for stratum\n if `ps aux | grep twist[d]` == \"\"\n render :json => {:result => :failure}\n end\n\n # Everything must be working\n render :json => {:result => :success}\n end", "def show_current_status\n if system \"sudo launchctl list | grep com.apple.screensharing > /dev/null\" and\n system \"sudo defaults read /var/db/launchd.db/com.apple.launchd/overrides.plist com.apple.screensharing -dict Disabled | grep 'Disabled = 0' > /dev/null\"\n puts \"VNC: enabled\"\n else\n puts \"VNC: disabled\"\n end\nend", "def print_usage(options,on_boot,terminal)\n puts\n puts \"Usage: \"+$0+\" -[\"+options+\"]\"\n puts\n puts \"-V:\\tDisplay version information\"\n puts \"-h:\\tDisplay usage information\"\n puts \"-i:\\tImport file\"\n puts \"-o:\\tOutput file\"\n puts \"-j:\\tConvert hosts file to a JSON file\"\n puts \"-t:\\tOutput to standard IO\"\n puts \"-T:\\tSet Terminal application (default #{terminal})\"\n puts \"-l:\\tStart Shuttle at login (default #{on_boot})\"\n puts\n return\nend", "def cmd_syst(param)\n send_unauthorised and return unless logged_in?\n send_response \"215 UNIX Type: L8\"\n end", "def read_host_info\n json { execute_prlctl('server', 'info', '--json') }\n end", "def info(*args)\n self.exec(\"lxc-info\", *args).split(\"\\n\").uniq.flatten\n end", "def handleIOStatus(n,v,m)\n printf(\"%d IO %04x/%04x\\n\", timestamp, v, m)\n end", "def status_info\n { \n :time => Time.now, :pid => Process.pid, :started => @started,\n :max_conns => @maxconns, :conns => @threads.length, :systimes => Process.times,\n :shutdown => @shutdown, :dead => @dead, :total_conns => @total_conns\n }.inspect\n end", "def status\n begin\n output = adm \"-z\", @resource[:name], :list, \"-p\"\n rescue Puppet::ExecutionFailure\n return nil\n end\n\n main = self.class.line2hash(output.chomp)\n\n # Now add in the configuration information\n config_status.each do |name, value|\n main[name] = value\n end\n\n main\n end", "def software_status(opts)\n opts = check_params(opts,[:installation_ids])\n super(opts)\n end", "def get_multipass_vm_info(options)\n exists = check_multipass_vm_exists(options)\n vm_name = options['name'].to_s\n if exists == true && !options['action'].to_s.match(/list/)\n handle_output(options,\"Warning:\\tMultipass VM #{vm_name} already exists\")\n else\n message = \"Information:\\Getting information for Multipass VM #{vm_name}\"\n command = \"multipass info #{vm_name}\"\n output = execute_command(options,message,command)\n lines = output.split(\"\\n\")\n lines.each do |line|\n if options['search'] != options['empty']\n if line.downcase.match(/#{options['search'].to_s.downcase}/)\n handle_output(options,line)\n end\n else\n handle_output(options,line)\n end\n end\n end\n return\nend", "def power(status)\n #This is so that tdtool is not polled too much. Now only once per minute\n `tdtool -l > /tmp/tdtoollist.txt`\n #Lets go through all the SUTs\n $sut.each do |ip, sut|\n #Initialize HASH and save label of the device in it\n status[ip] = {}\n status[ip]['label'] = sut[:label]\n #Check the power status on the socket. Assuming that TDTOOLs data is updated.\n tdtool = `cat /tmp/tdtoollist.txt |grep -P '#{sut[:switch]}\\t'`\n tdtool = tdtool.split(\"\\t\")[2].to_s\n tdtool.gsub!(/\\s+/, '')\n #Lets give nice colours depending what the data is\n if tdtool == \"ON\"\n status[ip]['powercolor'] = \"color:green;\"\n elsif tdtool == \"OFF\"\n status[ip]['powercolor'] = \"color:orange;\"\n else\n #This is mainly for devices that do not have power socket installed yet, currently only ATP12\n tdtool = '???'\n status[ip]['powercolor'] = \"color:white;\"\n end\n status[ip]['power'] = tdtool\n #Lets pass the ip we got has to the ping function to determine whether the device is online or offline\n if up?(ip)\n #Save the gathered data, in this case ONLINE, to status HASH. Also give nice colours to the data.\n status[ip]['ping'] = \"ONLINE\"\n status[ip]['pingcolor'] = \"color:green;\"\n next\n else\n #Save the gathered data, in this case OFFLINE, to status HASH. Also give nice colours to the data.\n status[ip]['ping'] = \"OFFLINE\"\n status[ip]['pingcolor'] = \"color:white;\"\n next\n end\n end\nend", "def raw_system_properties(addr, user, password)\n http_get(\n addr,\n '/system/console/status-System%20Properties.txt',\n user,\n password\n ).body\n end", "def status\n begin\n output = adm '-z', @resource[:name], :list, '-p'\n rescue Puppet::ExecutionFailure\n return nil\n end\n\n main = self.class.line2hash(output.chomp)\n\n # Now add in the configuration information\n config_status.each do |name, value|\n main[name] = value\n end\n\n main\n end", "def status\n vm_running = vm_running?\n puts \"\\n\\n project:\"\n puts ' command: status'\n puts \" name: #{File.basename(root_dir)}\"\n puts ' env: .project.sh'\n puts ' config: .project.yml'\n puts \"\\n docker-machine:\"\n puts \" name: #{project_config['docker-machine']['name']}\"\n puts \" status: #{vm_running ? 'running' : 'stopped'}\"\n puts \"\\n docker-compose:\"\n puts \" service: #{project_config['docker-compose']['service']}\"\n if vm_running\n response = `#{setup_docker_env_vars_str} docker-compose ps #{project_config['docker-compose']['service']}`\n if response =~ /No such service/i\n puts \" status: stopped\"\n else\n service_name, service_command, service_state = response.split(\"\\n\")[2].split(/\\s{2,}/)\n puts \" status: #{service_state =~ /up/i ? 'running' : 'stopped'}\"\n puts \" container: #{container_name(project_config['docker-compose']['service'])}\"\n puts \" command: #{service_command}\"\n end\n else\n puts \" status: stopped\"\n end\n puts \"\\n watchman:\"\n puts \" trigger: #{watchman_trigger_installed? ? 'installed' : 'not installed'}\"\n puts \" log: #{project_config['watchman']['log_path']}\"\n puts \"\\n\\n\"\nend", "def daemon_show_usage\n daemon_show_version\n puts \"\\nUsage:\"\n puts \" -b, --background work in background mode\"\n puts \" -v, --version view version of daemon\"\n puts \" -h, --help view this help\"\nend", "def vms_info(vm_type)\n cmd = \"#{File.dirname(__FILE__)}/vcenter_monitor_vms.rb #{@host.id} #{vm_type} \\\"#{connection[:ccr]}\\\"\"\n str_info, _stderr, _status = Open3.capture3(cmd)\n str_info\n end", "def update_status\n # Get save data status\n if save_data?\n @info_window.lines[2].replace(_INTL('Found '), 2)\n elsif save_backup?\n @info_window.lines[2].replace(_INTL('Can restore '), 2)\n else\n @info_window.lines[2].replace(_INTL('Not found '), 2)\n end\n # Get backup status\n if save_backup?\n @info_window.lines[4].replace(_INTL('Found '), 2)\n else\n @info_window.lines[4].replace(_INTL('Not found '), 2)\n end\n # Check whether the game should be restarted\n if @restart\n @info_window.lines[5].replace(_INTL(' Type \\'exit\\' to restart'))\n end\n end", "def syst(msg)\n \"215 UNIX #{PROGRAM} v#{VERSION} \"\n end", "def print_usage\n puts \"USAGE: #{PROGNAME} <ip|host> [warning,critical] [snmp_community]\"\n puts \" Default values: warning=80, critical=90, snmp_community=public\"\nend", "def io_stats\n @vm[:netrx] = 0\n @vm[:nettx] = 0\n @vm[:diskrdbytes] = 0\n @vm[:diskwrbytes] = 0\n @vm[:diskrdiops] = 0\n @vm[:diskwriops] = 0\n\n return if @vm[:state] != 'RUNNING' ||\n REASONS_SKIP_IO.include?(@vm[:reason])\n\n vm_stats, _e, s = KVM.virsh(:domstats, @name)\n\n return if s.exitstatus != 0\n\n vm_stats.each_line do |line|\n columns = line.split(/=(\\d+)/)\n\n case columns[0]\n when /rx.bytes/\n @vm[:netrx] += columns[1].to_i\n when /tx.bytes/\n @vm[:nettx] += columns[1].to_i\n when /rd.bytes/\n @vm[:diskrdbytes] += columns[1].to_i\n when /wr.bytes/\n @vm[:diskwrbytes] += columns[1].to_i\n when /rd.reqs/\n @vm[:diskrdiops] += columns[1].to_i\n when /wr.reqs/\n @vm[:diskwriops] += columns[1].to_i\n end\n end\n end", "def print_status\n puts \"Stats:\"\n puts \"* HP: #{@stats[:hp]}/#{@stats[:max_hp]}\"\n puts \"* Attack: #{@stats[:attack]}\"\n puts \"* Defense: #{@stats[:defense]}\"\n puts \"* Agility: #{@stats[:agility]}\"\n print \"\\n\"\n\n puts \"Equipment:\"\n print \"* Weapon: \"\n puts @outfit[:weapon] ? \"#{@outfit[:weapon].name}\" : \"none\"\n\n print \"* Shield: \"\n puts @outfit[:shield] ? \"#{@outfit[:shield].name}\" : \"none\"\n\n print \"* Helmet: \"\n puts @outfit[:helmet] ? \"#{@outfit[:helmet].name}\" : \"none\"\n\n print \"* Torso: \"\n puts @outfit[:torso] ? \"#{@outfit[:torso].name}\" : \"none\"\n\n print \"* Legs: \"\n puts @outfit[:legs] ? \"#{@outfit[:legs].name}\" : \"none\"\n\n print \"\\n\"\n end", "def info\n str_info = \"\"\n\n # CPU\n str_info << \"MODELNAME=\\\"\" << @cpuModel.to_s << \"\\\"\\n\"\n str_info << \"CPUSPEED=\" << @cpuMhz.to_s << \"\\n\"\n str_info << \"TOTALCPU=\" << @total_cpu.to_s << \"\\n\"\n str_info << \"USEDCPU=\" << @used_cpu.to_s << \"\\n\"\n str_info << \"FREECPU=\" << (@total_cpu - @used_cpu).to_s << \"\\n\"\n\n # Memory\n str_info << \"TOTALMEMORY=\" << @total_memory.to_s << \"\\n\"\n str_info << \"USEDMEMORY=\" << @used_memory.to_s << \"\\n\"\n str_info << \"FREEMEMORY=\" << (@total_memory - @used_memory).to_s << \"\\n\"\n\n # Networking\n str_info << \"NETRX=\" << @net_rx.to_s << \"\\n\"\n str_info << \"NETTX=\" << @net_tx.to_s << \"\\n\"\n\n # Datastores\n @free_ds_info.each{|k,v|\n used_space = v[:capacity].to_i - v[:free_space].to_i\n str_info << \"DS=[ID=\\\"#{k}\\\",USED_MB=#{used_space},\"\n str_info << \"TOTAL_MB=#{v[:capacity]},\"\n str_info << \"FREE_MB=#{v[:free_space]}]\\n\"\n }\n\n str_info.strip\n end", "def command_get_device_info(command)\n\t\tcommand_get_device(command)\n\t\tif @device\n\t\t\tmessage(\" #{@device.description}\")\n\t\t\t@windows.each {|name,window| message(\" #{name}: #{window.info}\")}\n\t\tend\n\tend", "def get_parallels_os(options,vm_name)\n\tmessage = \"Information:\\tDetermining OS for \"+vm_name\n\tcommand = \"prlctl list --info \\\"#{vm_name}\\\" |grep '^OS' |cut -f2 -d:\"\n\tos_info = execute_command(options,message,command)\n\tcase os_info\n\twhen /rhel/\n\t\tos_info = \"RedHat Enterprise Linux\"\n\tend\n\treturn os_info\nend", "def read_snmp_service_status_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.read_snmp_service_status ...\"\n end\n # resource path\n local_var_path = \"/node/services/snmp/status\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NodeServiceStatusProperties')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#read_snmp_service_status\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_info\n puts \"#{@title} by #{@author} is #{@status}.\"\n if @description\n puts \"#{@title} description: #{@description}.\"\n end\n end", "def statistic_run\n\n puts 'You want statistics about CS Air'\n\n # print out what to type in for each command\n @num_to_detail.each { |num, string| puts \"Type #{num} for #{string}\" }\n \n command = gets.chomp.to_i\n\n # wait till you receive correct input\n while not @num_to_detail.has_key?(command)\n puts 'Please try again'\n command = gets.chomp.to_i\n end\n \n case\n when command == 1\n puts \"#{@ui_lib.longest_single_flight}\"\n when command == 2\n puts \"#{@ui_lib.shortest_single_flight}\"\n when command == 3\n puts \"#{@ui_lib.average_flight_length}\"\n when command == 4\n puts \"#{@ui_lib.biggest_population_city}\"\n when command == 5\n puts \"#{@ui_lib.smallest_population_city}\"\n when command == 6\n puts \"#{@ui_lib.average_population}\"\n when command == 7\n @ui_lib.list_of_continents.each {|continent, list| puts \"#{continent},#{list}\"}\n when command == 8\n puts \"#{@ui_lib.list_of_hubs}\"\n end\n\n end", "def slab_info(flags=\"\")\n # TODO : may go back, make this an option to use sudo or not.\n # You need sudo permission to run this flag.\n slab_info = Vstator::SlabInfo.new \n `sudo vmstat #{flags}`.split(\"\\n\").each do |info|\n next if info == \"Cache Num Total Size Pages\"\n name, num, total, size, pages = info.split\n data = { :name => name, :num => num, :total => total,\n :size => size, :pages => pages }\n slab_info.update(data)\n end\n slab_info\n end", "def usage\n basename = File.basename($0)\n necessary_inputs = \"<omsadmin_conf> <cert> <key> <pid> <proxy> <os_info> <install_info>\"\n print(\"\\nTelemetry tool for OMS Agent\\n\"\\\n \"ruby #{basename} #{necessary_inputs}\\n\"\\\n \"\\nOptional: Add -v for verbose output\\n\")\nend", "def usage\n $stderr.puts \"Usage: TestDrive -r[review request num] -d[diff version (defaults latest)] -a [to run rake test automatically] -s [to run script/server automatically] -p [p-value for patch (TestDrive attempts to guess)]\"\n exit(1)\nend", "def info(text)\n\t# is command run from a console?\n\t# to determine this, thanks goes to hrgy84 and this site:\n\t# http://rubyonwindows.blogspot.com/2008/06/running-in-console-window.html\n\tif STDIN.isatty\n\t\t# if so, then print message to console\n\t\tputs text\n\telse\n\t\t# otherwise print it to GUI\n\t\ttitle = File.basename($PROGRAM_NAME)\n\t\tc = \"#{ZENITY} --info --title \\\"#{title}\\\" --text \\\"#{text}\\\"\"\n\t\tsystem(c)\n\tend\nend", "def get_windows_info()\n sysname = \"\"\n processor = \"\"\n os_info = \"\"\n\n require 'win32/registry'\n\n Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion') do |reg|\n type, sysname = reg.read('ProductName')\n end\n\n Win32::Registry::HKEY_LOCAL_MACHINE.open('SYSTEM\\ControlSet001\\Control\\Session Manager\\Environment') do |reg|\n type, processor = reg.read('PROCESSOR_ARCHITECTURE')\n end\n\n os_info = sysname + \" \" + processor\n os_info\nend", "def dev_stat\n begin\n @dev_stat ||= Sys::Filesystem.stat dev_path\n rescue SystemCallError\n @dev_stat = nil\n end\n end", "def usage\n $stderr.puts \"usage: #{$PROGRAM_NAME} <repo_name> load_check_head\"\n $stderr.puts \" #{$PROGRAM_NAME} <repo_name> save_check_head <check_head>\"\n $stderr.puts \" #{$PROGRAM_NAME} <repo_name> push_statuses_after_check_head\"\n $stderr.puts \" #{$PROGRAM_NAME} <repo_name> recent_statuses [offset [limit]]\"\n exit 1\nend", "def read_state\n read_vm_option('status').strip.to_sym\n end", "def get_system(code)\n return code[2][1][0][1][1][1]\n end", "def status\n\t\t# puts \"Status #{@ip} ...\"\n\t\toutput = `#{ipmi_command} chassis power status`\n\t\t# p output\n\t\tif output =~ /on/\n\t\t\t@status = true\n\t\telsif output =~ /off/\n\t\t\t@status = false\n\t\tend\n\tend", "def read_appliance_management_service_status_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.read_appliance_management_service_status ...\"\n end\n # resource path\n local_var_path = \"/node/services/node-mgmt/status\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'NodeServiceStatusProperties')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#read_appliance_management_service_status\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_Status()\n \t return @outputs[\"Status\"]\n \tend", "def nagios_check\n create_and_parse_cli_options\n return 1 unless check_options\n\n exit_code = Nagios::UNKNOWN\n\n begin\n # Instantiate the proper device\n device = create_device(options[:vendor], options[:model])\n # check if snmp community is correct or not for authentication\n if device.is_snmp_community_correct?(options[:community], options[:host])\n status = device.query_snmp(options)\n else\n status = Status.new(Nagios::WARNING, \"Invalid SNMP community string specified\")\n end\n exit_code = status.code\n message = status.message\n rescue StandardError => e\n message = \"%s\" % e\n exit_code = Nagios::UNKNOWN\n ensure\n puts message\n end\n exit_code\n end", "def snmp_basic(manager)\n # Grab some basic info using OID values which should be fairly generic in nature\n target = \"#{manager.config[:host]}:#{manager.config[:port]}\"\n cstring = manager.config[:community]\n snmp_version = manager.config[:version]\n sys_name = manager.get_value(\"sysName.0\")\n sys_descr = manager.get_value(\"sysDescr.0\")\n sys_time = manager.get_value(\"sysUpTime.0\")\n\n print_good(\"Target: #{target}\")\n print_good(\"Community String: #{cstring}\")\n print_good(\"Read Access: Enabled\")\n print_good(\"Write Access: Enabled\") if @wite_access\n print_good(\"Write Access: Disabled\") unless @wite_access\n if snmp_version\n print_good(\"SNMP Version: #{snmp_version}\")\n else\n print_error(\"Unable to determine SNMP Version in use?\")\n end\n if sys_name\n print_good(\"System Name: #{sys_name}\")\n else\n print_error(\"Unable to determine system name!\")\n end\n if sys_descr\n print_good(\"System Description: \\n#{sys_descr}\")\n else\n print_error(\"Unable to find system description!\")\n end\n if sys_time\n print_good(\"System Uptime: #{sys_time}\")\n else\n print_error(\"Unable to find system uptime!\")\n end\n end", "def system_bins\n %w[\n cal col colcrt colrm\n getopt\n hexdump\n logger look\n mesg more\n nologin\n renice rev\n ul\n whereis\n ]\n end", "def get_own_system(opts = {})\n data, _status_code, _headers = get_own_system_with_http_info(opts)\n data\n end", "def status\n job_id = shift_argument\n unless job_id\n error(\"Usage: mortar jobs:status JOB_ID\\nMust specify JOB_ID.\")\n end\n \n # Inner function to display the hash table when the job is complte\n def display_job_status(job_status)\n job_display_entries = {\n \"status\" => job_status[\"status_description\"],\n \"progress\" => \"#{job_status[\"progress\"]}%\",\n \"cluster_id\" => job_status[\"cluster_id\"],\n \"job submitted at\" => job_status[\"start_timestamp\"],\n \"job began running at\" => job_status[\"running_timestamp\"],\n \"job finished at\" => job_status[\"stop_timestamp\"],\n \"job running for\" => job_status[\"duration\"],\n \"job run with parameters\" => job_status[\"parameters\"],\n }\n\n \n unless job_status[\"error\"].nil? || job_status[\"error\"][\"message\"].nil?\n error_context = get_error_message_context(job_status[\"error\"][\"message\"])\n unless error_context == \"\"\n job_status[\"error\"][\"help\"] = error_context\n end\n job_status[\"error\"].each_pair do |key, value|\n job_display_entries[\"error - #{key}\"] = value\n end\n end\n \n if job_status[\"num_hadoop_jobs\"] && job_status[\"num_hadoop_jobs_succeeded\"]\n job_display_entries[\"hadoop jobs complete\"] = \n '%0.2f / %0.2f' % [job_status[\"num_hadoop_jobs_succeeded\"], job_status[\"num_hadoop_jobs\"]]\n end\n \n if job_status[\"outputs\"] && job_status[\"outputs\"].length > 0\n job_display_entries[\"outputs\"] = Hash[job_status[\"outputs\"].select{|o| o[\"alias\"]}.collect do |output|\n output_hash = {}\n output_hash[\"location\"] = output[\"location\"] if output[\"location\"]\n output_hash[\"records\"] = output[\"records\"] if output[\"records\"]\n [output['alias'], output_hash]\n end]\n end\n \n styled_header(\"#{job_status[\"project_name\"]}: #{job_status[\"pigscript_name\"]} (job_id: #{job_status[\"job_id\"]})\")\n styled_hash(job_display_entries)\n end\n \n # If polling the status\n if options[:poll]\n ticking(polling_interval) do |ticks|\n job_status = api.get_job(job_id).body\n # If the job is complete exit and display the table normally \n if Mortar::API::Jobs::STATUSES_COMPLETE.include?(job_status[\"status_code\"] )\n redisplay(\"\")\n display_job_status(job_status)\n break\n end\n\n # If the job is running show the progress bar\n if job_status[\"status_code\"] == Mortar::API::Jobs::STATUS_RUNNING\n progressbar = \"=\" + (\"=\" * (job_status[\"progress\"].to_i / 5)) + \">\"\n\n if job_status[\"num_hadoop_jobs\"] && job_status[\"num_hadoop_jobs_succeeded\"]\n hadoop_jobs_ratio_complete = \n '%0.2f / %0.2f' % [job_status[\"num_hadoop_jobs_succeeded\"], job_status[\"num_hadoop_jobs\"]]\n end\n\n printf(\"\\r[#{spinner(ticks)}] Status: [%-22s] %s%% Complete (%s MapReduce jobs finished)\", progressbar, job_status[\"progress\"], hadoop_jobs_ratio_complete)\n\n # If the job is not complete, but not in the running state, just display its status\n else\n redisplay(\"[#{spinner(ticks)}] Status: #{job_status['status_description']}\")\n end\n end\n # If not polling, get the job status and display the results\n else\n job_status = api.get_job(job_id).body\n display_job_status(job_status)\n end\n end", "def run_with_status(*args)\n _print_command(*args)\n args.last.delete :errexit if args.last.is_a? Hash\n args.last.delete :xtrace if args.last.is_a? Hash\n pid = Process.spawn(*args)\n return Process.wait2(pid).last\nend" ]
[ "0.67949957", "0.64729077", "0.60836583", "0.60778207", "0.60776764", "0.60496736", "0.59289396", "0.5904126", "0.5867659", "0.5824744", "0.5810097", "0.5796615", "0.5733989", "0.5717231", "0.57094574", "0.57057375", "0.5635945", "0.56178516", "0.56009525", "0.5591205", "0.55763614", "0.55469453", "0.5541981", "0.5535204", "0.55311495", "0.5499993", "0.54415137", "0.5438187", "0.54083866", "0.5406429", "0.540284", "0.5397994", "0.53898466", "0.53619283", "0.535145", "0.5340017", "0.53346884", "0.53294414", "0.53225666", "0.53191984", "0.53145784", "0.5301384", "0.5281428", "0.52801776", "0.5274163", "0.5273988", "0.52628684", "0.5256925", "0.5251215", "0.5247285", "0.52465475", "0.5238868", "0.52331614", "0.52226305", "0.52199036", "0.52129275", "0.5201463", "0.51982087", "0.51916015", "0.51882774", "0.5180814", "0.5178278", "0.51768905", "0.51709265", "0.51667565", "0.5164814", "0.516174", "0.51559013", "0.51471263", "0.5133868", "0.5117792", "0.5117559", "0.5117219", "0.51160526", "0.5110051", "0.51085615", "0.5104284", "0.51032627", "0.50987613", "0.5095065", "0.5083866", "0.50817543", "0.5081734", "0.5077848", "0.5073699", "0.50686556", "0.5058877", "0.50575775", "0.50523305", "0.5049774", "0.50428885", "0.5040014", "0.5029881", "0.5027716", "0.5026198", "0.50220484", "0.5018597", "0.50139296", "0.5009385", "0.5006423" ]
0.53667146
33
validate and save captured data for a given page PUT /answer_sheets/1/pages/1
def update @page = Page.find(params[:id]) questions = @presenter.all_questions_for_page(params[:id]) questions.post(params[:answers], @answer_sheet) questions.save @elements = questions.elements # Save references if params[:reference].present? params[:reference].each do |id, values| ref = @answer_sheet.reference_sheets.find(id) # if the email address has changed, we have to trash the old reference answers ref.attributes = values ref.save(:validate => false) end end @presenter.active_page = nil @answer_sheet.touch respond_to do |format| format.js #format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pages=(v) Axlsx.validate_int v; @pages = v; end", "def copy_to_page(page)\n #start matrix hash\n mq_qc_attribs = self.question_content.attributes\n .except(\"id\", \"created_at\", \"updated_at\", \"questionable_id\")\n\n cloneable_attributes = self.attributes\n .except(\"id\", \"created_at\", \"updated_at\", \"statement\")\n mq_attribs = cloneable_attributes\n .except(\"id\", \"created_at\", \"updated_at\")\n .merge(\n :clone_of_id => nil,\n :question_content_attributes => mq_qc_attribs.merge(\"statement\" => \"#{self.question_content.statement} (copy)\")\n )\n\n\n #build se hash\n se_attribs = self.survey_element.attributes\n .except(\"id\", \"created_at\", \"updated_at\", \"questionable_id\")\n .merge(\"page_id\" => page.id)\n\n #build content question hash\n choice_questions = self.choice_questions.map do |choice_question|\n qc_attribs = choice_question.question_content.attributes\n .except(\"id\", \"created_at\", \"updated_at\", \"questionable_id\")\n .merge(\n \"matrix_statement\" => \"#{self.question_content.statement} (copy)\",\n \"statement\" => \"#{choice_question.question_content.statement} (copy)\"\n )\n\n cq_attribs = choice_question.attributes\n .except(\"id\", \"created_at\", \"updated_at\")\n ca_attribs = choice_question.choice_answers.map do |choice_answer|\n answer_hash = choice_answer.attributes\n .except(\"id\", \"updated_at\", \"created_at\")\n .merge(\"clone_of_id\" => nil)\n\n #update the next page pointer\n if answer_hash[\"next_page_id\"]\n answer_hash[\"next_page_id\"] = nil\n end\n answer_hash\n end\n cq_attribs.merge(\n :question_content_attributes => qc_attribs,\n :choice_answers_attributes => ca_attribs,\n :clone_of_id => (choice_question.id)\n )\n end\n\n mq_attribs = mq_attribs.merge(:choice_questions_attributes => choice_questions, :survey_element_attributes => se_attribs)\n MatrixQuestion.create!(mq_attribs)\n end", "def update\n respond_to do |format|\n if @scraping_page.update(scraping_page_params)\n format.html { redirect_to @scraping_page, notice: 'Scraping page was successfully updated.' }\n format.json { render :show, status: :ok, location: @scraping_page }\n else\n format.html { render :edit }\n format.json { render json: @scraping_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @page.update_attributes(params[:page])\n respond_with(@page)\n else\n respond_with(@page)\n end\n end", "def create\n @question_sheet = Fe::QuestionSheet.new_with_page\n\n respond_to do |format|\n if @question_sheet.save\n format.html { redirect_to fe_admin_question_sheet_path(@question_sheet) }\n format.xml { head :created, :location => admin_question_sheet_path(@question_sheet) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @question_sheet.errors.to_xml }\n end\n end\n end", "def single_scrape\n next_page()\n save_page()\nend", "def update_page_data(page_id, id, data)\n put \"pages/#{page_id}/data/#{id}\", {value: data}\n end", "def update\n if @page.update_attributes(params[:page])\n respond_to do |format|\n format.json { render :json => @page }\n format.xml { render :xml => @page }\n end\n else\n respond_to do |format|\n format.json { raise Palani::Api::InvalidUpdateOfRecordJSONException }\n format.xml { raise Palani::Api::InvalidUpdateOfRecordXMLException }\n end\n end\n end", "def update\n respond_to do |wants|\n if @page.update_attributes(params[:page])\n \n flash[:notice] = 'Страница сохранена.'\n wants.html { redirect_to(admin_pages_url) }\n wants.xml { head :ok }\n else\n wants.html { render :action => \"edit\" }\n wants.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end", "def validate_page_existence\n if page.blank?\n errors.add(:page_id, :invalid)\n return false\n end\n self.name = page['name']\n true\n end", "def page_info_save\n if (@page_info = @sssn.page_infos.find_by_id(params[:id]))\n @page_info.update_attributes(page_info_params)\n @page_info.update_attribute(:page, 1)\n end\n prepare_list\n end", "def create\n @page = Page.new(params[:page])\n if @page.save\n respond_with(@page, location: api_pages_url)\n else\n respond_with(@page)\n end\n end", "def associate_page(page); end", "def save\n update_type = (@sheet.new_record? ? \"public_sheet_create\" : \"public_sheet_update\")\n if SheetTransaction.save_sheet!(@sheet, {}, variables_params, nil, request.remote_ip, update_type)\n proceed_to_next_design\n else\n render :design\n end\n end", "def update\n @page = @offering.pages.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n flash[:notice] = 'OfferingPage was successfully updated.'\n format.html { redirect_to offering_page_url(@offering, @page) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, @page\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @page\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to edit_page_path(@page), notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def page!\n save_and_open_page\n end", "def page!\n save_and_open_page\n end", "def update\n @book_page = @book.book_pages.find(params[:id])\n\n respond_to do |format|\n if @book_page.update_attributes(params[:book_page])\n format.html { redirect_to book_series_collection_book_book_page_url(@book_series, @collection, @book, @book_page), notice: 'Book page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def pages=(v)\n Axlsx.validate_int v\n @pages = v\n end", "def save\n\n quiz = frm.div(:class=>\"portletBody\").div(:index=>0).text\n pool = frm.div(:class=>\"portletBody\").div(:index=>1).text\n\n frm.button(:value=>\"Save\").click\n\n if quiz =~ /^Assessments/\n EditAssessment.new(@browser)\n elsif pool =~ /^Question Pools/\n EditQuestionPool.new(@browser)\n else\n puts \"Unexpected text: \"\n p pool\n p quiz\n end\n\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to page_path(@page), notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n flash[:notice] = @page.errors.full_messages.to_sentence\n format.html { render action: 'edit' }\n format.json { render json: [@page.errors.full_messages.to_sentence], status: :unprocessable_entity }\n end\n end\n end", "def save_webpage\n @webpage = Webpage.find_or_initialize_by(url: webpage_url)\n @webpage.update(\n body: response_body,\n content_type: content_type,\n primary_ip: primary_ip\n )\n end", "def page_params\n params.require(:page).permit(:month, :day, :thought, :book_id)\n end", "def update\n @page = Page.find(params[:id])\n @testimonials = Testimonial.all\n \n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def page_params\n params.require(:page).permit(:name, :links, :description, :contacts, :sector,\n :kind, :fbpage, :twitterpage, :location,\n :lookingfor, :no_employees, :website)\n end", "def update\n respond_to do |format|\n if @page_section.update(page_section_params)\n format.html { redirect_to @page_section,\n notice: t('shared.msgs.success_updated',\n obj: t('activerecord.models.page_section', count: 1)) }\n format.json { render :show, status: :ok, location: @page_section }\n else\n format.html { render :edit }\n format.json { render json: @page_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n if @page.update_attributes(params[:page])\n respond_to do |format|\n format.json {render json: @page, status: :created }\n format.xml {render xml: @page, status: :created}\n end\n \n else\n respond_to do |format|\n format.json {render json: @page.errors, status: :unprocessable_entity}\n format.xml {render xml: @page.errors, status: :unprocessable_entity}\n end\n end\n end", "def post_process(pages)\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_copy\n #add page at end of survey\n new_page_num = self.survey_version.pages.size + 1\n page_attribs = self.attributes.merge(:page_number => new_page_num)\n page_attribs.delete(\"id\")\n page_attribs.delete(\"next_page_id\")\n new_page = Page.create!(page_attribs)\n\n #Copy current page assetables\n self.survey_elements.each do |se|\n se.copy_to_page(new_page)\n end\n\n new_page\n end", "def page_params\n params.require(:page).permit(:url, :status)\n end", "def update\n @page = Page.find(params[:id])\n if @page.update_attributes(allowed_params)\n redirect_to @page, notice: 'Page was successfully updated.' \n else\n render action: \"edit\" \n end\n end", "def create\n @question = @page.questions.new(params[:question])\n\n respond_to do |format|\n if @question.save\n flash[:notice] = 'Your question was successfully created. Now you can fill in additional details.'\n format.html { redirect_to edit_offering_page_question_url(@offering, @page, @question, :anchor => 'validation') }\n format.xml { render :xml => @question, :status => :created, :location => @question }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n #find the page with given id\n @page = Page.find(params[:id])\n\n #use updated_at manually, it will update the page table if user hits update button.\n # This may not be trivial, so it may change.\n @page.updated_at = Time.now\n\n #retrieving layout id from params and assigning to a variable\n @layout = @page[:layout_id]\n\n # calling method to find all pages and page parts\n find_pages_and_parts(@layout)\n\n #sends in data in different format\n respond_to do |format|\n\n if @page.update_attributes(params[:page]) #page updated successfully\n\n format.html { redirect_to admin_pages_path, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n\n else #page saving failed, re-renders edit template\n\n format.html { render action: \"edit\", :template => 'mcms_pages/admin/pages/edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n\n end # end if\n\n end # end respond_to block\n\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to [:admin, @page], notice: 'Страница успешно создана.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n # Clear the page cache for this page... ?\n @page = ComatosePage.find params[:id]\n @root_pages = [fetch_root_page].flatten\n if request.post?\n @page.update_attributes(params[:page])\n @page.updated_on = Time.now\n @page.author = fetch_author_name\n if @page.save\n expire_cms_page @page\n expire_cms_fragment @page\n flash[:notice] = \"Saved changes to '#{@page.title}'\"\n redirect_to :controller=>self.controller_name, :action=>'index'\n end\n end\n end", "def update\n @section = Section.find(params[:id])\n @page = @section.page\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to @page, :notice => 'Section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to admin_subject_pages_path, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to pages_path, sucess: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @page_content.page, :update?\n\n respond_to do |format|\n if @page_content.update(page_content_params)\n format.json { render :show, status: :ok, location: @page_content }\n else\n format.json { render json: @page_content.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @presenter = AnswerPagesPresenter.new(self, @answer_sheet, params[:a])\n unless @presenter.active_answer_sheet.pages.present?\n flash[:error] = \"Sorry, there are no questions for this form yet.\"\n if request.env[\"HTTP_REFERER\"]\n redirect_to :back\n else\n render :text => \"\", :layout => true\n end\n else\n @elements = @presenter.questions_for_page(:first).elements\n @page = @presenter.pages.first\n end\n end", "def update\n @enq_page = EnqPage.find(params[:id])\n\n respond_to do |format|\n if @enq_page.update_attributes(params[:enq_page])\n format.html { redirect_to @enq_page, notice: 'Enq page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enq_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if page_params[:body]\n @page.versions << Version.new(body: page_params[:body], title: page_params[:title]).save\n page_params.delete :body\n end\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to controller: \"pages\", action: \"show\", slug: @page[:page_slug], notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = current_site.pages.find(params[:id])\n @site = @page.site\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to(@page, :notice => 'Page was successfully updated.') }\n format.json { respond_with_bip(@page) }\n else\n format.html { render :action => \"edit\" }\n format.json { respond_with_bip(@page) }\n end\n end\n end", "def update_page_params\n params.require(:page).permit(:content, :url, :file)\n end", "def update\n @isfit_page = IsfitPage.find(params[:id])\n\n respond_to do |format|\n if @isfit_page.update_attributes(params[:isfit_page])\n format.html { redirect_to @isfit_page, notice: 'Isfit page was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :edit }\n format.json { render json: @isfit_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n # Clear the page cache for this page... ?\n @page = Comatose::Page.find_is_snippet params[:id]\n if request.post?\n @page.update_attributes(params[:page])\n @page.updated_on = Time.now\n @page.author = current_user\n if @page.valid? && @page.save\n expire_cms_page @page\n expire_cms_fragment @page\n flash[:notice] = \"Saved changes to '#{@page.title}'\"\n redirect_to :controller=>self.controller_name, :action=>'index'\n end\n \n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.json { render json: @page.errors, status: :unprocessable_entity }\n format.xml { render xml: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.by_slug(params[:id]) || raise(NotFound)\n if @page.update_attributes(params[:page])\n redirect url(:page, @page)\n else\n flash[:notice] = 'Your changes have been rejected.'\n render :edit\n end\n end", "def assign_pages!; end", "def create\n @page = current_site.pages.new(params[:page])\n @site = @page.site\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def share_page(id)\n unless @page = @scope.pages.first({ id: id })\n halt 404, \"This link seems to point to a non-existent page.\"\n end\n\n unless pp = @scope.public_pages.first({ page: @page })\n pp = @scope.public_pages.create({ page: @page, user: current_user })\n end\n\n redirect pp.url\nend", "def save_page(p)\n if p.record.page_entries != p.values.length\n raise RuntimeError, \"page_entries mismatch for node #{p.uid}\"\n end\n begin\n @f.seek(p.uid * @page_size * 8)\n @f.write(p.values.pack('Q*'))\n rescue IOError => e\n PEROBS.log.fatal \"Cannot write cache file #{@file_name}: #{e.message}\"\n end\n end", "def create\n begin\n ActiveRecord::Base.transaction do\n @page = Page.new(\n page_slug: params[\"page\"][\"page_slug\"],\n title: params[\"page\"][\"title\"],\n tag_list: params[\"page\"][\"tags\"]\n )\n @page.save!\n @version = Version.new(body: params[\"page\"][\"body\"], page: @page)\n @version.save!\n end\n respond_to do |format|\n format.html { redirect_to action: \"show\", slug: page_params[:page_slug] , notice: 'Page was successfully created.' }\n format.json { render :show, status: :created, location: @page }\n end\n rescue => @err\n respond_to do |format|\n @page.body = params[\"page\"][\"body\"]\n format.html { render :new }\n format.json { render json: @err, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = Page.new(params[:page])\n \n if @page.save\n respond_to do |format|\n format.json { render :json => @page, :status => :created }\n format.xml { render :xml => @page, :status => :created }\n end\n else\n respond_to do |format|\n format.json { raise Palani::Api::InvalidRecordJSONException }\n format.xml { raise Palani::Api::InvalidRecordXMLException }\n end\n end\n end", "def create\n @page = Page.new(page_params)\n @page.profile_pic = params[:page][:profile_pic]\n @page.timeline_pic = params[:page][:timeline_pic]\n @page.like = 0\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @page }\n else\n format.html { render action: 'new' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to([:admin, @page], notice: 'Page was successfully updated.') }\n format.xml { head :ok }\n website.add_log(user: current_user, action: \"Updated page: #{@page.title}\")\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @page, notice: \"Page was successfully updated. #{undo_link}\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @page_page.update(page_page_params)\n format.html { redirect_to @page_page, notice: 'Page page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page_page }\n else\n format.html { render :edit }\n format.json { render json: @page_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n # retrieve page part attributes from params and assign it to a variable\n page_parts = params[:page][:page_parts_attributes]\n\n # sort the page_parts and reassign it to the params\n params[:page][:page_parts_attributes] = Hash[page_parts.sort]\n\n #creating the page object with its own and child attributes\n @page = Page.new(params[:page])\n\n #retrieving layout id from params and assigning to a variable\n @layout = params[:page][:layout_id]\n\n # calling method to find all pages and page parts\n find_pages_and_parts(@layout)\n\n # sends the data in different formats\n respond_to do |format|\n\n if @page.save #page saved successfully\n\n format.html { redirect_to admin_pages_path, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n\n else #page saving failed, re-render the form\n\n format.html { render action: \"new\", :template => 'mcms_pages/admin/pages/new' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n\n end # end if\n\n end # end respond_to block\n\n end", "def create\n @enq_page = EnqPage.new(params[:enq_page])\n\n respond_to do |format|\n if @enq_page.save\n format.html { redirect_to @enq_page, notice: 'Enq page was successfully created.' }\n format.json { render json: @enq_page, status: :created, location: @enq_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enq_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pages_feature = Page.where(site_id: @site.id, published: true, feature_on_homepage: true).all\n @page_root = Page.where(site_id: @site.id).roots.all\n @title = @page.title\n respond_to do |format|\n session[:return_to] ||= request.referer\n if @page.update(page_params)\n format.html { redirect_to session.delete(:return_to), notice: 'Saved' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = @offering.pages.new(params[:page])\n\n respond_to do |format|\n if @page.save\n flash[:notice] = 'OfferingPage was successfully created.'\n format.html { redirect_to offering_page_url(@offering, @page) }\n format.xml { render :xml => @page, :status => :created, :location => @page }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @page.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def record_page(page)\n\t\t\t\turl = page.uri.to_s\n\t\t\t\trecord(url, content: page.content)\n\t\t\tend", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n # format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.html { redirect_to action: \"edit\", id: params[:id], notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @descriptive_page.update(descriptive_page_params)\n format.html { redirect_to @descriptive_page, notice: 'Descriptive page was successfully updated.' }\n format.json { render :show, status: :ok, location: @descriptive_page }\n else\n format.html { render :edit }\n format.json { render json: @descriptive_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @page\n\n @blocks = {}\n\n # TODO: Clean this controller up and move methods to model\n # TODO: Handle block type deletion\n\n blocks_updated = false\n\n params[:page][:page_slots_attributes] && params[:page][:page_slots_attributes].each_pair do |index, blockable_params|\n block_type = blockable_params['blockable_type']\n block_constant = block_type.constantize\n block_fields = blockable_params['block_fields']\n position = blockable_params['position']\n blockable_id = params[:page][:page_slots_attributes][index][:blockable_id]\n\n next if block_fields.nil?\n\n if blockable_id.present?\n block = block_constant.find blockable_id\n existing_attributes = HashWithIndifferentAccess.new\n block.permitted_params.each { |a| existing_attributes[a] = block[a] }\n else\n block = block_type.constantize.new\n end\n\n block_attributes = block_fields.permit block.permitted_params\n\n # TODO: not sure if a more precise diff between hashes is necessary\n if block.new_record? || (existing_attributes.to_a - block_attributes.as_json.to_a).present?\n block.assign_attributes block_fields.permit(block.permitted_params)\n @blocks[position] = block\n blocks_updated = true\n end\n\n params[:page][:page_slots_attributes][index].delete :block_fields\n end\n\n # TODO: There's a bug where you can update a page a second time even if you didn't change any attributes\n if blocks_updated\n @page.updated_at = Time.now\n end\n\n respond_to do |format|\n if @page.update(page_params)\n save_blocks\n format.html { redirect_to edit_page_path(@page), notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def creates\n @page = Page.new(pages_params)\n\n if @page.sav\n redirect_to pages_path\n else\n render :new\n end\n end", "def save_page page\n return unless page.text?\n\n path = page_file page.full_name\n\n FileUtils.mkdir_p File.dirname(path) unless @dry_run\n\n cache[:pages] ||= []\n cache[:pages] << page.full_name\n\n return if @dry_run\n\n File.open path, 'wb' do |io|\n Marshal.dump page, io\n end\n end", "def update\n respond_to do |format|\n if @page.update(page_params)\n format.html { redirect_to @pages_tree[(@page.id).to_s], notice: 'Page was successfully updated.' }\n format.json { render :show, status: :ok, location: @page }\n else\n format.html { render :edit }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def next_page!\n if self.page < 5\n self.page += 1\n if self.page == 3 && self.group == 1\n # Control group skips questions about first survey\n self.page += 1\n elsif self.page == 5\n self.completed = true\n end\n self.save\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to page_path(@page), notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book_page = @book.book_pages.build(params[:book_page])\n\n respond_to do |format|\n if @book_page.save\n format.html { redirect_to book_series_collection_book_book_pages_url(@book_series, @collection, @book), \n notice: 'Book page was successfully created.' }\n format.json { render json: @book_page, status: :created, location: @book_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def page=(page)\n @issues = []\n @page = page\n @state = PDF::Reader::PageState.new(page)\n @objects = page.objects\n\n attrs = @page.attributes\n box = attrs[:TrimBox] || attrs[:ArtBox] || attrs[:MediaBox]\n @warning_min_x = box[0] + to_points(@range, @units)\n @warning_min_y = box[1] + to_points(@range, @units)\n @warning_max_x = box[2] - to_points(@range, @units)\n @warning_max_y = box[3] - to_points(@range, @units)\n @error_min_x = box[0] - to_points(@bleed, @units)\n @error_min_y = box[1] - to_points(@bleed, @units)\n @error_max_x = box[2] + to_points(@bleed, @units)\n @error_max_y = box[3] + to_points(@bleed, @units)\n end", "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n # format.html { redirect_to @page, notice: 'Page was successfully created.' }\n # format.json { render json: @page, status: :created, location: @page }\n\n format.html { redirect_to action: \"edit\", id: @page.id, notice: 'Page was successfully created.' }\n format.json { head :no_content }\n\n\n else\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_new_page(page_params, version_params)\n the_page = Page.new :slug => page_params[:slug], \n :title => page_params[:title], \n :breadcrumb => page_params[:slug],\n :class_name => 'Page',\n :parent_id => 1,\n :layout_id => nil,\n :virtual => false\n \n the_version = PageVersion.new :page_id => -1, \n :content_status_id => ContentStatus[:draft].id, \n :body_content => version_params[:body_content],\n :page_title => version_params[:page_title],\n :meta_keywords => version_params[:meta_keywords],\n :meta_description => version_params[:meta_description] \n \n # calling these separate so they both run and we can combine the errors\n page_valid = the_page.valid?\n version_valid = the_version.valid?\n \n if page_valid and version_valid\n if the_page.save\n # add some default content parts to that page\n the_page.update_part_content('body', version_params[:body_content])\n \n the_page.update_part_content('title_tag', '')\n the_page.update_part_content('header_content', '<img class=\"hero\" src=\"/_images/hero_about_us.jpg\" alt=\"Get back to life with Texas Back Institutes back, neck and spine care. Make an appointment now. \" width=\"956\" height=\"119\">')\n the_page.update_part_content('body_class', '')\n the_page.update_part_content('secondary', '') \n \n the_version.page_id = the_page.id\n \n if the_version.save\n self.page_id = the_page.id\n self.name = the_page.title\n \n @page_object = the_page\n @version_object = the_version\n \n return self.save\n end\n end\n end\n \n merge_errors(the_page, the_version)\n \n @page_object = the_page\n @version_object = the_version\n \n return false\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to @page, notice: 'Page was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def store_page\n @stored_page = @crwlr.pages.create(:address => @url, :title => @page_title[0..200], :number_of_links => @links.size)\n if @parent_page\n @parent_page.pages << @stored_page\n end\n end", "def update\n if @page.update(page_params)\n redirect_to notebook_page_path(@notebook, @page), notice: 'Page was successfully updated.' \n else\n render :edit\n end\n end", "def create\n @page = Page.new(params[:page])\n\n if @page.save\n respond_to do |format|\n format.json {render json: @page, status: :created }\n format.xml {render xml: @page, status: :created}\n end\n \n else\n respond_to do |format|\n format.json {render json: @page.errors, status: :unprocessable_entity}\n format.xml {render xml: @page.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n @page = find_or_create_page\n\n unless @page.update_attributes(params[:page])\n @presenter = Presenters::PagePresenter.new(@page, self.class.helpers)\n end\n\n respond_with(@page)\n end", "def page_params\n params.require(:page).permit(:name, :content, :content2, :file, :path)\n end", "def create\n @section = Section.new(params[:section])\n @section.page = @page\n\n respond_to do |format|\n if @section.save\n format.html { redirect_to @page, :notice => 'Section was successfully created.' }\n format.json { render :json => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @section.errors, :status => :unprocessable_entity }\n end\n end\n end", "def page_params\n params.require(:page).permit(:name, :page_chunk_id)\n end", "def create\n params[:page].except!(:map_info) unless params[:page][:map_info].present?\n @page = current_user.pages.new(params[:page])\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n @business = Business.select('id, title')\n format.html { render action: \"new\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.html { redirect_to pages_path, notice: 'Page was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @subject = Subject.find(params[:subject_id])\n # @page = Page.new(page_params)\n @page = @subject.pages.new(page_params)\n @pageable = @page.pageable\n if @page.save\n # @page.pageable_type == \"Question\"\n # redirect_to '/admin/subjects/\"#{subject}/pages/\"#{page}\"/questions/new'\n @page.pageable = @pageable\n # @page = Page.find(page_params)\n\n redirect_to new_admin_subject_page_question_path\n # elsif @page.pageable_type == \"Instruction\"\n # redirect_to new_admin_subject_instruction_path \n # end\n \n else\n render action: 'new' \n \n \n end\n end", "def update\n @page = Page.find(params[:id])\n @page.update_attributes(params[:page])\n respond_with(@page, :status => :updated)\n end", "def update\n @page = Page.find(params[:id])\n if @page.update(page_params)\n # Success\n redirect_to page_path(@page)\n else\n # Fail\n render :edit\n end\n end" ]
[ "0.59559906", "0.58840895", "0.56942695", "0.56148875", "0.5570189", "0.5558975", "0.54998183", "0.5483603", "0.5472866", "0.54584724", "0.5449766", "0.5444113", "0.54349697", "0.54214185", "0.5415297", "0.5396647", "0.5355351", "0.5349202", "0.5349202", "0.53480774", "0.53458714", "0.53436255", "0.5341016", "0.5335528", "0.53354025", "0.53294826", "0.5324213", "0.5321746", "0.5321036", "0.5321036", "0.5321036", "0.5321036", "0.5320114", "0.5314642", "0.5300467", "0.5300467", "0.5291763", "0.5287981", "0.5281467", "0.52665067", "0.5265582", "0.5261672", "0.5257362", "0.52525884", "0.5252532", "0.525161", "0.52459866", "0.5242563", "0.5236805", "0.522938", "0.5226063", "0.52220833", "0.52130854", "0.52121377", "0.5209007", "0.52053684", "0.51966923", "0.51949644", "0.51909834", "0.5188213", "0.5185277", "0.5179862", "0.5179172", "0.51699346", "0.5168908", "0.51594704", "0.51571894", "0.5155655", "0.514842", "0.51476526", "0.5145461", "0.51438653", "0.51430345", "0.51429963", "0.51408935", "0.5138762", "0.51347095", "0.51328075", "0.51277363", "0.51271534", "0.5124099", "0.5124099", "0.51205426", "0.5115741", "0.51155144", "0.5114915", "0.5114872", "0.5114872", "0.5107523", "0.51065606", "0.51047826", "0.50916165", "0.5091286", "0.5088847", "0.50859946", "0.5082398", "0.508131", "0.5081016", "0.50715643", "0.50682753" ]
0.634422
0
GET /organizations/1/sites GET /organizations/1/sites.json
def index @sites = @organization.sites.order(id: :desc).all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @sites = current_user.sites.page(params[\"page\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n set_user\n @sites = Site.all\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @sites.to_json }\n end\n end", "def index\n respond_to do |format|\n format.html do \n @sites = Site.all\n end\n format.json do\n render json: Site.all\n end\n end\n end", "def index\n @sites = fetch_sites\n\n @formattedSites = @sites.map do |site|\n {\n 'title' => {'value' => site.name, 'link' => { 'url' => site.routes.first.host_with_scheme, 'external' => true}, 'searchable' => true, 'sortable' => true},\n 'template' => {'value' => site.site_template&.name, 'searchable' => true, 'sortable' => true},\n 'preview' => {'value' => site.routes.first.host_with_scheme, 'link' => { 'url' => site.routes.first.host_with_scheme, 'external' => true}, 'searchable' => true, 'sortable' => true},\n 'edit' => {'value' => edit_admin_site_site_step_path(site_slug: site.slug, id: :name), 'method' => 'get'},\n 'delete' => {'value' => admin_site_path(slug: site.slug), 'method' => 'delete'}\n }\n end\n\n gon.sites = @formattedSites\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @sites }\n end\n end", "def get_sites\n\t\ts = get_admin_section \"system.applicationHost/sites\"\n\t IisObjectCollection.new s.Collection, :site, Site, lambda { |site| site.id = s.Collection.Count + 1 }\n end", "def index\n @parsed_sites = ParsedSite.all\n\n render json: @parsed_sites\n end", "def index\n @user = self.current_user\n @sites = @user.find_sites(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @sites.to_xml }\n end\n end", "def index\n @sites = current_user.sites\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "def index\n @sites = current_user.sites\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "def get_sites_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.get_sites ...\"\n end\n # resource path\n local_var_path = \"/api/3/sites\"\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].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;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 => 'PageOfSite')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_sites\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_sites_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.get_sites ...'\n end\n # resource path\n local_var_path = '/api/3/sites'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].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;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 => 'PageOfSite')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_sites\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n add_breadcrumb \"all\", nil, \"glyphicon-list\"\n\n @sites = current_user.account.sites || []\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @sites = User.find(current_user.id).sites #Site.find(\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "def sites\n request('/web_properties.json').map do |site_data|\n Site.new self, site_data['uid'], site_data['name']\n end\n end", "def index\n @sites = Cms::Site.all\n end", "def show\n respond_to do |format|\n format.html do \n set_site\n @site\n end\n format.json do\n render json: @site\n end\n end\n end", "def index\n @sites = Site.all\n end", "def index\n @sites = Site.all\n end", "def index\n @sites = Site.all\n end", "def index\n @sites = Site.all\n end", "def index\n @sites = Site.all\n end", "def index\n @sites = Site.all\n end", "def show\n render json: @parsed_site\n end", "def show\n @site = Site.find(params[:id])\n\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n \n end\n end", "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "def test_get_site_list\r\n endpoint = \"/sites\"\r\n uri = URI(\"#{@host}#{endpoint}\")\r\n request = Net::HTTP::Get.new(uri)\r\n request['Accept'] = 'application/json'\r\n \r\n test_start = Time.now\r\n response = Net::HTTP.start(uri.hostname, uri.port) do |http|\r\n http.request(request)\r\n end\r\n test_end = Time.now\r\n\r\n @results << {\r\n :api => 'GET /sites',\r\n :endpoint => endpoint,\r\n :start_time => test_start,\r\n :runtime => (test_end.to_f - test_start.to_f) * 1000.0,\r\n :status => response.code,\r\n :content_type => response['content-type']\r\n }\r\n end", "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @site }\n end\n end", "def index\n\n sites = Site.all\n @sites = current_user.sites\n @needs_attention_reports = Report.needs_attention\n\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @sites }\n # end\n\n respond_with(sites) do |format|\n format.html # { redirect_to site_user_sites_path }\n format.json { render :json => @sites.as_json }\n end\n end", "def show\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @site }\n end\n end", "def index\n @sites = Site.paginate(:page=>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @supplysites = Supplysite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplysites }\n end\n end", "def get_sites(opts = {})\n data, _status_code, _headers = get_sites_with_http_info(opts)\n data\n end", "def index\n @site_setups = SiteSetup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_setups }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html { render :template => \"admin_sites/index\" }\n format.xml { render :xml => @sites }\n end\n end", "def get_sites(opts = {})\n data, _status_code, _headers = get_sites_with_http_info(opts)\n return data\n end", "def show\n @subsite = Subsite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subsite }\n end\n end", "def index\n @servers = @site.servers\n end", "def index\n @site = Site.find(params[:site_id])\n @visits = @site.visits\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @visits }\n end\n end", "def index\n if current_user.super_admin?\n @organisations = Organisation.all.order(:id)\n render json: @organisations.to_json\n else\n head :no_content\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "def index\r\n @orgs = Org.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @orgs }\r\n end\r\n end", "def index\n @site_editorials = SiteEditorial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_editorials }\n end\n end", "def index\n @organizations = Organization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organizations }\n end\n end", "def index\n @sites = Site.joins(:users)\n .where(users: {id: current_user.id})\n .order(params[:order] || 'created_at ASC')\n\n respond_to do |format|\n format.html { redirect_to management_path }\n format.json { render json: @sites }\n end\n end", "def index\n p = Profile.where(:username=>session[:username]).first\n if(!p.nil?)\n @sites = Profile.mysite(p.id)\n if(p.id==1)\n @sites = Site.find(:all, :order => \"created_at DESC\")\n end\n else\n redirect_to '/' and return\n end\n @site = Site.new\n @profile_id = Profile.where(:username=>session[:username]).first.id\n @categories = p.categories.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @places = @site.places.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @places }\n end\n end", "def all_site_details\r\n @nsc.sites\r\n end", "def site_list\n @sites = Haiwet::Site.list\n @sites.each.with_index(1) do |site, i|\n puts \"\\n #{i}- #{site.name}\"\n end\n end", "def index\n serialized = []\n Site.all.each do |site|\n attribute = format_site(site)\n serialized.push(attribute)\n end\n render(json:serialized)\n end", "def yields_from_sites\n @sites = Yield.all.collect {|x| x.site}.compact.uniq\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def index\n @ooh_sites = OohSite.all\n end", "def sites\n @sites ||= []\n end", "def sites()\n return MicrosoftGraph::Sites::SitesRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def show\n @sitecity = Sitecity.find_by_url(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitecity }\n end\n end", "def show\n organization = current_user.organizations.find(params[:id])\n if organization\n render json: organization, status: 200\n else\n head 404\n end\n end", "def index\n @organizations = Organization.where(:id => current_user.organization_id)\n \n respond_with(@organizations)\n end", "def show\n @site_config = SiteConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_config }\n end\n end", "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @site }\n format.xml { render :xml => @site }\n end\n end", "def show\n respond_with(@site = Site.find(params[:id]))\n end", "def index\n @watch_sites = WatchSite.includes(:team, :venue).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @watch_sites }\n end\n end", "def get_sites(site_type=nil)\r\n logger.debug \"Inside Get Sites of AMF controller\"\r\n if site_type.nil?\r\n if params.key?(0) \r\n site_type=params[0]\r\n else\r\n raise \"No site passed because #{params.length} and #{params[0].key?(\"site_type\")} to get_sites #{params.inspect()}\"\r\n end\r\n end\r\n\t\tsite_list=Site.data_sites(site_type)\r\n respond_to do |format|\r\n format.html\r\n format.xml { render :xml => site_list.to_x }\r\n format.amf { \r\n logger.debug \"Returning site_list\"\r\n logger.debug \"Returning #{site_list}\"\r\n render :amf => site_list \r\n }\r\n end\r\n end", "def index\n do_authorize_class\n get_project_if_exists\n do_authorize_instance(:show, @project) unless @project.nil?\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json do\n @sites, opts = Settings.api_response.response_advanced(\n api_filter_params,\n list_permissions,\n Site,\n Site.filter_settings\n )\n respond_index(opts)\n end\n end\n end", "def index\n @anatomic_sites = AnatomicSite.all\n end", "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html { render layout: false }\n format.json\n format.geojson\n end\n end", "def index\n @organizations = Spree::Organization.all\n end", "def index\n @pages = current_site.pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def index\n @organizations = Organization.all\n respond_with @organizations\n end", "def sites; end", "def sites; end", "def sites; end", "def sites; end", "def sites; end", "def find_all_organizations\n get_url(\"https://api.github.com/users/#{current_user.username}/orgs\")\n end", "def index\n @organizations = Organization.all\n respond_with(@organizations)\n end", "def index\n @optimized_sites = OptimizedSite.all\n end", "def regional_sitelist\n query('txt/wxfcs/regionalforecast/json/sitelist')\n end", "def index\n render json: current_org.users\n end", "def index\n @study_sites = StudySite.all\n end", "def create\n respond_to do |format|\n if @site = Site.find(entity_id_from_params(:site))\n current_user.account.sites << @site\n format.html { redirect_to root_path, notice: \"The site #{@site.name} @ #{@site.companies.last.name} was successfully added.\" }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @sites = Site.all.order(:created_at)\n\n # @debug = scrape_all\n # @debug = scrape 'http://workingnews.blog117.fc2.com/?xml'\n \n # @spreadsheet = GoogleSpreadsheets::Enhanced::Spreadsheet.find('0ArhV7gTgs6Z8dHlSRUF2SzFXWjlkU1V2d29KR2pkdXc')\n # @worksheet = @spreadsheet.worksheets.find_by(title: 'site_rows')\n # @rows = @worksheet.rows\n # @site_rows = Site.site_rows\n \n # 同期実行\n # Site.sync_with_site_rows\n\n # スクレイピング\n # ApplicationController.helpers.scrape_update\n # ApplicationController.helpers.scrape \"http://alfalfalfa.com/index.rdf\"\n\n respond_to do |format|\n if Rails.env.development?\n format.html { render :html => @sites }\n end\n format.json { render :json => @sites.as_json }\n end\n end", "def show\n @website = Website.find(params[:id])\n\n render json: @website\n end", "def all_viewable_sites\n Site\n .current\n .with_project_or_as_site_user(all_viewable_projects.select(:id), id)\n end", "def show\n @site_setup = SiteSetup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_setup }\n end\n end", "def index\n @clients_organizations = ClientsOrganization.all\n end", "def orgs\n client.organizations\n end", "def index\n @sourcing_orgs = SourcingOrg.all\n end", "def get_site_organization_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.get_site_organization ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.get_site_organization\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/organization\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;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 => 'SiteOrganization')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_site_organization\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @host_orgs = HostOrg.all\n end", "def index\n # @events = Event.order('created_at desc').limit(15)\n @events = Event.by_site( current_user.sites )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def get_site_organization_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.get_site_organization ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.get_site_organization\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/organization'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;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 => 'SiteOrganization')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_site_organization\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @site = Site.find_by_site(params[:id])\n @organisation = @site.organisation\n @total_data = WeeklyTotalData.new(@site.weekly_totals, Date.new(2012,10,17)..Date.today, true)\n @most_recent_hit_data = AggregratedMostRecentHitData.new(@site.aggregated_hits, @site.hits.most_recent_hit_on_date)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "def show\n @system_site_map = SystemSiteMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @system_site_map }\n end\n end" ]
[ "0.7147471", "0.7147471", "0.71254146", "0.69968307", "0.6986142", "0.68470156", "0.68342304", "0.6768329", "0.6639676", "0.6638731", "0.6638731", "0.6623737", "0.6592505", "0.6574429", "0.6573962", "0.6565332", "0.6518944", "0.6480263", "0.64783025", "0.64783025", "0.64783025", "0.64783025", "0.64783025", "0.64783025", "0.6391235", "0.63846886", "0.6368635", "0.6368635", "0.6368635", "0.63425016", "0.6336143", "0.6322041", "0.62855643", "0.6272886", "0.62485904", "0.62137175", "0.61607623", "0.61523616", "0.6144483", "0.6135373", "0.61316794", "0.6125135", "0.6117585", "0.6089629", "0.6089629", "0.6089629", "0.6089629", "0.6089629", "0.6076978", "0.607269", "0.6067522", "0.60598314", "0.60293686", "0.6017631", "0.60115355", "0.6011435", "0.5960609", "0.59503716", "0.5948464", "0.5938973", "0.5922055", "0.59164894", "0.59022254", "0.58997965", "0.5887217", "0.5886232", "0.5878831", "0.5871643", "0.58607394", "0.5854933", "0.5854906", "0.5853131", "0.5850555", "0.5848108", "0.5844525", "0.5838622", "0.5838622", "0.5838622", "0.5838622", "0.5838622", "0.5829805", "0.5819384", "0.580952", "0.580369", "0.5800338", "0.5796781", "0.57961017", "0.5790669", "0.57889134", "0.5784458", "0.5784174", "0.57827085", "0.57821536", "0.5778967", "0.57727593", "0.5770026", "0.57594335", "0.5759058", "0.5758414", "0.5757512" ]
0.7183256
0
GET /organizations/1/sites/1 GET /organizations/1/sites/1.json
def show redirect_to site_comments_path(@site.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @sites = current_user.sites.page(params[\"page\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @sites = @organization.sites.order(id: :desc).all\n end", "def index\n set_user\n @sites = Site.all\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @sites.to_json }\n end\n end", "def index\n respond_to do |format|\n format.html do \n @sites = Site.all\n end\n format.json do\n render json: Site.all\n end\n end\n end", "def index\n @sites = fetch_sites\n\n @formattedSites = @sites.map do |site|\n {\n 'title' => {'value' => site.name, 'link' => { 'url' => site.routes.first.host_with_scheme, 'external' => true}, 'searchable' => true, 'sortable' => true},\n 'template' => {'value' => site.site_template&.name, 'searchable' => true, 'sortable' => true},\n 'preview' => {'value' => site.routes.first.host_with_scheme, 'link' => { 'url' => site.routes.first.host_with_scheme, 'external' => true}, 'searchable' => true, 'sortable' => true},\n 'edit' => {'value' => edit_admin_site_site_step_path(site_slug: site.slug, id: :name), 'method' => 'get'},\n 'delete' => {'value' => admin_site_path(slug: site.slug), 'method' => 'delete'}\n }\n end\n\n gon.sites = @formattedSites\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @sites }\n end\n end", "def show\n @site = Site.find(params[:id])\n\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n \n end\n end", "def index\n @parsed_sites = ParsedSite.all\n\n render json: @parsed_sites\n end", "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "def show\n respond_to do |format|\n format.html do \n set_site\n @site\n end\n format.json do\n render json: @site\n end\n end\n end", "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @site }\n end\n end", "def get_sites\n\t\ts = get_admin_section \"system.applicationHost/sites\"\n\t IisObjectCollection.new s.Collection, :site, Site, lambda { |site| site.id = s.Collection.Count + 1 }\n end", "def show\n render json: @parsed_site\n end", "def index\n add_breadcrumb \"all\", nil, \"glyphicon-list\"\n\n @sites = current_user.account.sites || []\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @sites = User.find(current_user.id).sites #Site.find(\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "def show\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @site }\n end\n end", "def index\n @user = self.current_user\n @sites = @user.find_sites(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @sites.to_xml }\n end\n end", "def index\n @sites = current_user.sites\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "def index\n @sites = current_user.sites\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "def get_sites_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.get_sites ...\"\n end\n # resource path\n local_var_path = \"/api/3/sites\"\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].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;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 => 'PageOfSite')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_sites\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_sites_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.get_sites ...'\n end\n # resource path\n local_var_path = '/api/3/sites'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].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;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 => 'PageOfSite')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_sites\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @subsite = Subsite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subsite }\n end\n end", "def test_get_site_list\r\n endpoint = \"/sites\"\r\n uri = URI(\"#{@host}#{endpoint}\")\r\n request = Net::HTTP::Get.new(uri)\r\n request['Accept'] = 'application/json'\r\n \r\n test_start = Time.now\r\n response = Net::HTTP.start(uri.hostname, uri.port) do |http|\r\n http.request(request)\r\n end\r\n test_end = Time.now\r\n\r\n @results << {\r\n :api => 'GET /sites',\r\n :endpoint => endpoint,\r\n :start_time => test_start,\r\n :runtime => (test_end.to_f - test_start.to_f) * 1000.0,\r\n :status => response.code,\r\n :content_type => response['content-type']\r\n }\r\n end", "def sites\n request('/web_properties.json').map do |site_data|\n Site.new self, site_data['uid'], site_data['name']\n end\n end", "def index\n\n sites = Site.all\n @sites = current_user.sites\n @needs_attention_reports = Report.needs_attention\n\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @sites }\n # end\n\n respond_with(sites) do |format|\n format.html # { redirect_to site_user_sites_path }\n format.json { render :json => @sites.as_json }\n end\n end", "def index\n @site = Site.find(params[:site_id])\n @visits = @site.visits\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @visits }\n end\n end", "def index\n @sites = Site.paginate(:page=>params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @supplysites = Supplysite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplysites }\n end\n end", "def index\n @sites = Site.all\n end", "def index\n @sites = Site.all\n end", "def index\n @sites = Site.all\n end", "def index\n @sites = Site.all\n end", "def index\n @sites = Site.all\n end", "def index\n @sites = Site.all\n end", "def index\n p = Profile.where(:username=>session[:username]).first\n if(!p.nil?)\n @sites = Profile.mysite(p.id)\n if(p.id==1)\n @sites = Site.find(:all, :order => \"created_at DESC\")\n end\n else\n redirect_to '/' and return\n end\n @site = Site.new\n @profile_id = Profile.where(:username=>session[:username]).first.id\n @categories = p.categories.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html { render layout: false }\n format.json\n format.geojson\n end\n end", "def show\n @sitecity = Sitecity.find_by_url(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitecity }\n end\n end", "def index\n @sites = Cms::Site.all\n end", "def index\n @site_setups = SiteSetup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_setups }\n end\n end", "def index\n @sites = Site.joins(:users)\n .where(users: {id: current_user.id})\n .order(params[:order] || 'created_at ASC')\n\n respond_to do |format|\n format.html { redirect_to management_path }\n format.json { render json: @sites }\n end\n end", "def show\n respond_with(@site = Site.find(params[:id]))\n end", "def show\n @website = Website.find(params[:id])\n\n render json: @website\n end", "def show\n organization = current_user.organizations.find(params[:id])\n if organization\n render json: organization, status: 200\n else\n head 404\n end\n end", "def show\n @site_config = SiteConfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_config }\n end\n end", "def show\n @installation_site = InstallationSite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @installation_site }\n end\n end", "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @site }\n format.xml { render :xml => @site }\n end\n end", "def index\n @places = @site.places.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @places }\n end\n end", "def index\n @site_editorials = SiteEditorial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_editorials }\n end\n end", "def show\n @site_setup = SiteSetup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_setup }\n end\n end", "def show\n @site = Site.find_by_site(params[:id])\n @organisation = @site.organisation\n @total_data = WeeklyTotalData.new(@site.weekly_totals, Date.new(2012,10,17)..Date.today, true)\n @most_recent_hit_data = AggregratedMostRecentHitData.new(@site.aggregated_hits, @site.hits.most_recent_hit_on_date)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "def index\n if current_user.super_admin?\n @organisations = Organisation.all.order(:id)\n render json: @organisations.to_json\n else\n head :no_content\n end\n end", "def index\n @servers = @site.servers\n end", "def yields_from_sites\n @sites = Yield.all.collect {|x| x.site}.compact.uniq\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def index\n serialized = []\n Site.all.each do |site|\n attribute = format_site(site)\n serialized.push(attribute)\n end\n render(json:serialized)\n end", "def show\n @supplysite = Supplysite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplysite }\n end\n end", "def create\n respond_to do |format|\n if @site = Site.find(entity_id_from_params(:site))\n current_user.account.sites << @site\n format.html { redirect_to root_path, notice: \"The site #{@site.name} @ #{@site.companies.last.name} was successfully added.\" }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @watch_sites = WatchSite.includes(:team, :venue).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @watch_sites }\n end\n end", "def index\n @organizations = Organization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organizations }\n end\n end", "def show\n @site = Site.find(params[:id])\n @noaa_table = @site.noaa_table\n @completed_reports = @site.reports.completed\n @needs_attention_reports = @site.reports.needs_attention\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "def show\n @system_site_map = SystemSiteMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @system_site_map }\n end\n end", "def show\n do_load_resource\n get_project_if_exists\n do_authorize_instance\n\n respond_to do |format|\n format.html { @site }\n format.json { respond_show }\n end\n end", "def show\n @site_type = SiteType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_type }\n end\n end", "def index\n do_authorize_class\n get_project_if_exists\n do_authorize_instance(:show, @project) unless @project.nil?\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json do\n @sites, opts = Settings.api_response.response_advanced(\n api_filter_params,\n list_permissions,\n Site,\n Site.filter_settings\n )\n respond_index(opts)\n end\n end\n end", "def index\n render json: current_org.users\n end", "def index\r\n @orgs = Org.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @orgs }\r\n end\r\n end", "def new\n @orbituarysite = current_user.orbituarysites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @orbituarysite }\n end\n end", "def show\n @site = Site.find(params[:id])\n @same_creators = @site.same_creators.all - [@site]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "def show\n @environment = current_user.organization.environments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @environment }\n end\n end", "def new\n @site = Site.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def index\n # @events = Event.order('created_at desc').limit(15)\n @events = Event.by_site( current_user.sites )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "def show\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio }\n end\n end", "def show\n add_breadcrumb \"all\", nil, \"glyphicon-screenshot\"\n\n @site = Site.find(id_from_params)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @site = Site.new\n @site.url = 'http://'\n @site.creator = current_user.name if user_signed_in?\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html { render :template => \"admin_sites/index\" }\n format.xml { render :xml => @sites }\n end\n end", "def index\n if params[:site_id].nil? or params[:site_id].empty?\n @comentarios = Comentario.all # path: /types\n else\n @comentarios = Site.find(params[:site_id]).comentarios # path: /sites/id/comentarios\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comentarios }\n end\n end", "def index\n @organizations = Organization.where(:id => current_user.organization_id)\n \n respond_with(@organizations)\n end", "def show\n @sites = current_user.sites\n @post = current_user.posts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "def index\n @sites = Site.all.order(:created_at)\n\n # @debug = scrape_all\n # @debug = scrape 'http://workingnews.blog117.fc2.com/?xml'\n \n # @spreadsheet = GoogleSpreadsheets::Enhanced::Spreadsheet.find('0ArhV7gTgs6Z8dHlSRUF2SzFXWjlkU1V2d29KR2pkdXc')\n # @worksheet = @spreadsheet.worksheets.find_by(title: 'site_rows')\n # @rows = @worksheet.rows\n # @site_rows = Site.site_rows\n \n # 同期実行\n # Site.sync_with_site_rows\n\n # スクレイピング\n # ApplicationController.helpers.scrape_update\n # ApplicationController.helpers.scrape \"http://alfalfalfa.com/index.rdf\"\n\n respond_to do |format|\n if Rails.env.development?\n format.html { render :html => @sites }\n end\n format.json { render :json => @sites.as_json }\n end\n end", "def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def index\n @services = SystemSiteMap.where(:system_site_map_id => 2)\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def new\n\n @project = Project.find(params[:project_id])\n @site = @project.sites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def index\n @pages = current_site.pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "def show\n @site = Site.find(params[:id])\n @user = @site.user\n @project = @site.project\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @site }\n end\n end", "def get_site_organization_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.get_site_organization ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.get_site_organization\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/organization\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;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 => 'SiteOrganization')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_site_organization\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def all_site_details\r\n @nsc.sites\r\n end", "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_records }\n end\n end", "def get_site_organization_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.get_site_organization ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.get_site_organization\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/organization'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;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 => 'SiteOrganization')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#get_site_organization\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @urls = @site.urls.paginate(:page => params[:page])\n render json: @urls\n end", "def site_list\n @sites = Haiwet::Site.list\n @sites.each.with_index(1) do |site, i|\n puts \"\\n #{i}- #{site.name}\"\n end\n end" ]
[ "0.70622486", "0.70091885", "0.70091885", "0.6897232", "0.6870294", "0.6828743", "0.67364556", "0.661683", "0.65788525", "0.6577596", "0.6577596", "0.6577596", "0.6571647", "0.65419966", "0.64948934", "0.6477464", "0.64376307", "0.64315", "0.641028", "0.64070195", "0.63716733", "0.63716733", "0.63441956", "0.6329431", "0.6315567", "0.6312288", "0.62974805", "0.6286416", "0.6270015", "0.6255579", "0.62371004", "0.619982", "0.619982", "0.619982", "0.619982", "0.619982", "0.619982", "0.61959326", "0.6169823", "0.61669755", "0.6142148", "0.61382985", "0.61245143", "0.61208296", "0.6113257", "0.6063736", "0.6059526", "0.6053474", "0.6048183", "0.6038311", "0.602645", "0.60181713", "0.601449", "0.59845525", "0.5962113", "0.5960498", "0.5954854", "0.59261525", "0.5919012", "0.59132683", "0.59089327", "0.5906008", "0.5904686", "0.5894814", "0.5890629", "0.5888453", "0.5883888", "0.5882759", "0.5867802", "0.58644646", "0.5863044", "0.5860281", "0.58567595", "0.5853943", "0.5853943", "0.5853943", "0.5853943", "0.5853943", "0.58536285", "0.58512944", "0.5843809", "0.58375764", "0.58375764", "0.58375764", "0.58375764", "0.58316946", "0.5821597", "0.57949084", "0.5792069", "0.5789963", "0.5787217", "0.57774997", "0.5761642", "0.5759609", "0.5739654", "0.57371736", "0.57370913", "0.57295984", "0.5723702", "0.57151335", "0.57034945" ]
0.0
-1
POST /organizations/1/sites POST /organizations/1/sites.json
def create @site = @organization.sites.new(site_params) respond_to do |format| if @site.save format.html { redirect_to after_create_path, notice: 'Site was successfully created.' } format.json { render :show, status: :created, location: @site } else format.html { render :new } format.json { render json: @site.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n respond_to do |format|\n if @site = Site.find(entity_id_from_params(:site))\n current_user.account.sites << @site\n format.html { redirect_to root_path, notice: \"The site #{@site.name} @ #{@site.companies.last.name} was successfully added.\" }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site = current_user.sites.build(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to root_url(subdomain: @site.subdomain), notice: 'Site was successfully created.' }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site = current_user.sites.create(params[:site])\n respond_to do |format|\n if @site.save\n format.html { flash_and_redirect(\"successfully saved!\", sites_url) }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site = current_user.sites.build(site_params)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render :show, status: :created, location: @site }\n else\n format.html { render :new }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @institution = @navigation_context.institution\n return unless authorize_resource(@institution, CREATE_INSTITUTION_SITE)\n @site = @institution.sites.new(site_params(true))\n @sites = check_access(@institution.sites, READ_SITE)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to sites_path, notice: I18n.t('sites.create.success') }\n format.json { render action: 'show', status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @institution = Institution.find params[:site][:institution_id]\n return unless authorize_resource(@institution, CREATE_INSTITUTION_SITE)\n\n @site = @institution.sites.new(site_params)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to sites_path, notice: 'Site was successfully created.' }\n format.json { render action: 'show', status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site = Site.create site_params\n respond_to do |format|\n if @site.errors.empty?\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site = Site.new(site_params)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to edit_site_path(@site), notice: 'Site was successfully created.' }\n format.json { render :show, status: :created, location: @site }\n else\n format.html { render :new }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site = Site.new(site_params)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render :show, status: :created, location: @site }\n else\n format.html { render :new }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site = Site.new(site_params)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render action: 'show', status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @subsite = Subsite.new(params[:subsite])\n\n respond_to do |format|\n if @subsite.save\n format.html { redirect_to @subsite, notice: 'Subsite was successfully created.' }\n format.json { render json: @subsite, status: :created, location: @subsite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subsite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site = Site.new(params[:site])\n @site.created_by = current_user\n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, :notice => 'Site was successfully created.' }\n format.json { render :json => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\", :layout=>\"site\" }\n format.json { render :json => @site.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n params[:site][:virtualhost] = nil if params[:site][:virtualhost] =~ /^\\s*$/\n @site = current_user.sites.build(params[:site])\n\n respond_to do |format|\n if @site.save\n flash[:notice] = 'Site was successfully created.'\n format.html { redirect_to(@site) }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n owner = Owner.first\n @ooh_site = owner.ooh_sites.build(ooh_site_params)\n\n respond_to do |format|\n if @ooh_site.save\n format.html { redirect_to @ooh_site.becomes(OohSite), notice: 'Ooh site was successfully created.' }\n format.json { render :show, status: :created, location: @ooh_site }\n else\n format.html { render :new }\n format.json { render json: @ooh_site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @optimized_site = OptimizedSite.new(optimized_site_params)\n\n respond_to do |format|\n if @optimized_site.save\n format.html { redirect_to @optimized_site, notice: 'Optimized site was successfully created.' }\n format.json { render :show, status: :created, location: @optimized_site }\n else\n format.html { render :new }\n format.json { render json: @optimized_site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_site_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.create_site ...\"\n end\n # resource path\n local_var_path = \"/api/3/sites\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'site'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ReferenceWithSiteIDLink')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#create_site\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @site = Site.new(site_params)\n @site.agent = current_agent\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to site_path(@site), notice: t('.flash_created') }\n format.json { render action: 'show', status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_site(params = {})\n site_name.set params['site_name']\n client_division_site_number.set params['client_division_site_number']\n site_number.set params['site_number']\n address_1.set params['address_1']\n address_2.set params['address_2'] if params['address_2']\n zip_code.set params['zip_code']\n city.set params['city']\n country.select(params['country'], match: :first)\n sleep 2 # Wait for the state to be active #TODO: find a way to remove this sleep ~MD\n state.select(params['state']) unless state.disabled?\n study_env.select(params['study_env'])\n pi_email.set params['pi_email']\n pi_first_name.set(params['pi_first_name'])\n pi_last_name.set(params['pi_last_name'])\n pi_role.select(params['pi_role'])\n add_site_submit.click\n sleep 10 # Wait to create a site\n end", "def create\n @site = Site.new(site_params)\n @site.user_id = current_user.id\n\n if params[:site][:size_ids].present?\n sizesgroup = Size.find params[:site][:size_ids]\n @site.sizes = sizesgroup\n end\n\n respond_to do |format|\n if @site.save\n format.json { render :index, status: :created, location: @site }\n\t\t#format.json { head :no_content }\n\t\tformat.js\n else\n format.json { render json: @site.errors, status: :unprocessable_entity }\n\t\tformat.js { render 'shared/errors' }\n end\n end\n end", "def create_site_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.create_site ...'\n end\n # resource path\n local_var_path = '/api/3/sites'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'site'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ReferenceWithSiteIDLink')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#create_site\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @site = Site.new(site_params)\n @site.user_id = current_user.id\n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render :show, status: :created, location: @site }\n else\n format.html { render :new }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n do_new_resource\n do_set_attributes(site_params)\n get_project_if_exists\n do_authorize_instance\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to [@project, @site], notice: 'Site was successfully created.' }\n format.json {\n if @project.nil?\n respond_create_success(shallow_site_path(@site))\n else\n respond_create_success(project_site_path(@project, @site))\n end\n }\n else\n format.html { render action: 'new' }\n format.json { respond_change_fail }\n end\n end\n end", "def create\n @site = Site.new(site_params)\n\n respond_to do |format|\n if @site.save\n flash[\"notice\"] = 'Site was successfully created.'\n format.html { redirect_to @site }\n format.json { render action: 'show', status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to(@site, :notice => 'Site was successfully created.') }\n format.json { render :json => @site, :status => :created, :location => @site }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @site.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n # @site = Site.new(params[:site])\n\n @site = current_user.sites.build(params[:site])\n # @site.lat = @lat\n # @site.long = @long\n # @site.save\n\n Rails.logger.debug 'User email is ' + @site.user.email.to_s\n Rails.logger.debug 'Site lat is ' + @site.lat.to_s\n Rails.logger.debug 'Site long is ' + @site.long.to_s\n\n # @project = Project.find(params[:project_id])\n # @site = @project.sites.build(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n # format.html { redirect_to project_site_path(@site.project_id, @site),\n # notice: 'Site was successfully created.' }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { flash.now[:error] = \"Error: See details below.\"\n render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @sites = fetch_sites\n\n @formattedSites = @sites.map do |site|\n {\n 'title' => {'value' => site.name, 'link' => { 'url' => site.routes.first.host_with_scheme, 'external' => true}, 'searchable' => true, 'sortable' => true},\n 'template' => {'value' => site.site_template&.name, 'searchable' => true, 'sortable' => true},\n 'preview' => {'value' => site.routes.first.host_with_scheme, 'link' => { 'url' => site.routes.first.host_with_scheme, 'external' => true}, 'searchable' => true, 'sortable' => true},\n 'edit' => {'value' => edit_admin_site_site_step_path(site_slug: site.slug, id: :name), 'method' => 'get'},\n 'delete' => {'value' => admin_site_path(slug: site.slug), 'method' => 'delete'}\n }\n end\n\n gon.sites = @formattedSites\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @sites }\n end\n end", "def create\n\n Campsite.create(\n name: params[:name],\n location: params[:location],\n campsite_type: params[:campsite_type],\n max_people: params[:max_people],\n per_night: params[:per_night]\n )\n\n # CREATE has no template of its own:\n # redirect to index page\n redirect_to( campsites_path )\n\n end", "def create\n @site = Site.new(site_params)\n respond_to do |format|\n if @site.save\n format.html { redirect_to user_path(@user), notice: 'サイトを作成しました' }\n format.json { render user_path(@user), status: :created, location: @site }\n else\n format.html { render :new }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_site(n, site_name)\n site = Site.new(name: site_name, org_type: 'city', status: 'active')\n lat, lng = Geocoder.coordinates(@zip_xpath[n].text)\n site.contacts.build(city: @city_xpath[n].text, state: @state_xpath[n].text,\n zip: @zip_xpath[n].text, country: @country_xpath[n].text, lat: lat, lng: lng)\n site.save ? site.id : nil\n end", "def create\n @study_site = StudySite.new(study_site_params)\n\n respond_to do |format|\n if @study_site.save\n format.html { redirect_to @study_site, notice: 'Study site was successfully created.' }\n format.json { render action: 'show', status: :created, location: @study_site }\n else\n format.html { render action: 'new' }\n format.json { render json: @study_site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @anatomic_site = AnatomicSite.new(anatomic_site_params)\n\n respond_to do |format|\n if @anatomic_site.save\n format.html { redirect_to @anatomic_site, notice: 'Anatomic site was successfully created.' }\n format.json { render :show, status: :created, location: @anatomic_site }\n else\n format.html { render :new }\n format.json { render json: @anatomic_site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @orbituarysite = Orbituarysite.new(params[:orbituarysite])\n\n respond_to do |format|\n if @orbituarysite.save\n format.html { redirect_to @orbituarysite, notice: 'Orbituarysite was successfully created.' }\n format.json { render json: @orbituarysite, status: :created, location: @orbituarysite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orbituarysite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to sites_url, flash[:info]=\"Site was successfully created.\" }\n format.js { flash[:info]=\"Site was successfully created.\" }\n format.json { render json: @site, status: :created, location: @site }\n end\n end\n end", "def create\n @body_site = BodySite.new(body_site_params)\n\n respond_to do |format|\n if @body_site.save\n format.html { redirect_to @body_site, notice: 'Body site was successfully created.' }\n format.json { render :show, status: :created, location: @body_site }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @body_site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site = Site.new(params[:site])\n flash[:notice] = \"Site was successfully created.\" if @site.save\n respond_with(@site)\n end", "def create\n @parsed_site = ParsedSite.new(parsed_site_params)\n\n if @parsed_site.save\n render json: @parsed_site, status: :created, location: @parsed_site\n else\n render json: @parsed_site.errors, status: :unprocessable_entity\n end\n end", "def create\n @student_site = StudentSite.new(student_site_params)\n\n respond_to do |format|\n if @student_site.save\n format.html { redirect_to @student_site, notice: 'Student site was successfully created.' }\n format.json { render action: 'show', status: :created, location: @student_site }\n else\n format.html { render action: 'new' }\n format.json { render json: @student_site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site = Cms::Site.new(cms_site_params)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to cms.sites_url, notice: '站点已创建.' }\n format.json { render action: 'show', status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @search_site = SearchSite.new(search_site_params)\n\n respond_to do |format|\n if @search_site.save\n format.html { redirect_to search_sites_url, notice: 'Search site was successfully created.' }\n format.json { render :show, status: :created, location: @search_site }\n else\n format.html { render :new }\n format.json { render json: @search_site.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @my_sites = current_user.sites.clone\n @site = current_user.sites.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new_site_create(params={})\n study_study_sites.set params[:site_name]\n site_number.set params[:site_number]\n study_site_number.set params[:study_site_number]\n end", "def create\n @site_setup = SiteSetup.new(params[:site_setup])\n\n respond_to do |format|\n if @site_setup.save\n format.html { redirect_to @site_setup, notice: 'Site setup was successfully created.' }\n format.json { render json: @site_setup, status: :created, location: @site_setup }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site_setup.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def create\n update_and_decorate \n respond_to do |format|\n if !@site.errors.any?\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jobsite = Jobsite.new(jobsite_params)\n\n respond_to do |format|\n if @jobsite.save\n format.html { redirect_to @jobsite, notice: 'Jobsite was successfully created.' }\n format.json { render :show, status: :created, location: @jobsite }\n else\n format.html { render :new }\n format.json { render json: @jobsite.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n set_user\n @sites = Site.all\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @sites.to_json }\n end\n end", "def create\n @department = Department.new(department_params)\n\n respond_to do |format|\n if @department.save\n @departmentSite = Cms::Site.new\n #Removes all url-unfriendly characters from the name to create an identifier Comfy can use.\n @ident = @department.name.gsub(/[^a-zA-Z 0-9]/, \"\")\n @ident = @ident.gsub(/\\s/,'_')\n @departmentSite.update_attributes(\n #binds Department sites to easy-to-remember mnemonics.\n identifier: \"#{@ident.downcase}\",\n\n #pulls the hostname for the parent site\n hostname: '0.0.0.0:3000',\n\n #sets the root path for the new site to /Departments. There is no actual /Departments route handled by Comfy, but it provides an easy mnemonic\n #GET \"/departments\" should be mapped to a static page that links to all sites created in this manner.\n path: \"departments/#{@ident.downcase}\"\n )\n @departmentSite.save!\n @department.update_attributes(cms_site_id: @departmentSite.id)\n format.html { redirect_to \"/departments\", notice: 'Department was successfully created.' }\n format.json { render json: @department, status: :created, location: @department }\n else\n format.html { render action: \"new\" }\n format.json { render json: @department.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #render text: site_params.merge(user_id: current_user.id) and return\n\n @site = Site.new(site_params)\n\n respond_to do |format|\n if @site.save\n #build site_page via template_page\n Template::Page.where(template_id: @site.template_id).order(\"sort_id ASC\").each do |temp_page|\n @site.site_pages.create(user_id: current_user.id, \n site_id: @site.id, \n template_page_id: temp_page.id,\n short_title: get_short_title(@site),\n title: temp_page.title)\n end\n format.html { redirect_to edit_site_page_url(@site.site_pages.first), notice: 'Site was successfully created.' }\n format.json { render action: 'show', status: :created, location: @site }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site = Xmt::Press::Site.new(site_params)\n respond_to do |format|\n if @site.save\n format.html { redirect_to xmt_press_sites_url, notice: '站点创建成功.' }\n format.json { render :show, status: :created, location: @site }\n else\n format.html { render :new }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @site = Site.new \n puts \"Got here\"\n #2.times { @site.connections.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def create\n @site = Site.new(params[:site])\n \n # Domain Name\n re='((?:[a-z][a-z\\\\.\\\\d\\\\-]+)\\\\.(?:[a-z][a-z\\\\-]+))(?![\\\\w\\\\.])'\t\n @m=Regexp.new(re,Regexp::IGNORECASE)\n @host = @m.match(@site.linkws)[1] \n @site.host = @host\n \n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jobsite = Jobsite.new(jobsite_params)\n\n respond_to do |format|\n if @jobsite.save\n format.html { redirect_to @jobsite, notice: 'Jobsite was successfully created.' }\n format.json { render action: 'show', status: :created, location: @jobsite }\n else\n format.html { render action: 'new' }\n format.json { render json: @jobsite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site = Site.new(params[:site])\n @site.user_id = current_user.id if user_signed_in?\n respond_to do |format|\n if @site.save\n url = (user_signed_in?)? current_user_path : @site\n format.html { redirect_to url, notice: 'Site was successfully created.' }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_site_structure = Admin::SiteStructure.new(admin_site_structure_params)\n\n respond_to do |format|\n if @admin_site_structure.save\n format.html { redirect_to @admin_site_structure, notice: 'Site structure was successfully created.' }\n format.json { render :show, status: :created, location: @admin_site_structure }\n else\n format.html { render :new }\n format.json { render json: @admin_site_structure.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @site = Site.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def index\n @sites = @organization.sites.order(id: :desc).all\n end", "def index\n respond_to do |format|\n format.html do \n @sites = Site.all\n end\n format.json do\n render json: Site.all\n end\n end\n end", "def create\n @trial_site = TrialSite.new(trial_site_params)\n\n respond_to do |format|\n if @trial_site.save\n format.html { redirect_to @trial_site, notice: 'Trial site was successfully created.' }\n format.json { render :show, status: :created, location: @trial_site }\n else\n format.html { render :new }\n format.json { render json: @trial_site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to(@site) }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @site_admin = SiteAdmin.new(site_admin_params)\n\n respond_to do |format|\n if @site_admin.save\n format.html { redirect_to @site_admin, notice: 'Site admin was successfully created.' }\n format.json { render :show, status: :created, location: @site_admin }\n else\n format.html { render :new }\n format.json { render json: @site_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site = Site.new\n @site.mode = :off\n @site.status = :off\n respond_to do |format|\n if @site.update(params)\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render json: @site }\n else\n format.html { render :new }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_site(params={name:random_string})\n\t\tnew_site = site[:new]\n\t\tparams[:site] = params[:name]\n\t\tnew_site[:params].merge!(params)\n\t\tnew_site[:params][:address] = append_ftp_value(new_site[:params][:address],new_site[:params][:ftp_type])\n\t\tpost(new_site)\n\tend", "def sites\n request('/web_properties.json').map do |site_data|\n Site.new self, site_data['uid'], site_data['name']\n end\n end", "def create_site\n \n district_id = District.find_by_name(params[:district]).district_id rescue nil\n\n site = Site.find_by_name(params[:sitename], :conditions => [\"district_id = ?\", district_id]) rescue nil\n\n type = SiteType.find_by_name(params[:sitetype]).id rescue nil\n \n longitude = params[:longitude] rescue nil\n \n latitude = params[:latitude] rescue nil\n \n if site.nil?\n\n @site = Site.new(:name => params[:sitename], :district_id => district_id, \n :longitude => longitude, :latitude => latitude, :site_type => type)\n \n @site.save\n\n flash[:notice] = \"Site #{params[:sitename]} created\"\n\n else\n flash[:error] = \"Site #{params[:sitename]} in #{params[:district]} already exists! Choose a different site name.\"\n end\n\n redirect_to \"/images/malawi/districts?district=#{params[:district]}\",\n :layout => \"application\" and return\n \n end", "def build_site_for_user\n #ditinguer nom et url\n create_site(params[:site][:url],params[:user][:site], current_user)\n end", "def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to(root_url, :notice => 'Site was successfully created.') }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @installation_site = InstallationSite.new(params[:installation_site])\n\n respond_to do |format|\n if @installation_site.save\n format.html { redirect_to @installation_site, notice: 'Installation site was successfully created.' }\n format.json { render json: @installation_site, status: :created, location: @installation_site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @installation_site.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def create\n @server = @site.servers.new(server_params.merge({used_at: (Time.now - 1.day)}))\n\n respond_to do |format|\n if @server.save\n format.html { redirect_to [:admin, @site], notice: 'Server was successfully created.' }\n format.json { render action: 'show', status: :created, location: [:admin, @site] }\n else\n format.html { render action: 'new' }\n format.json { render json: @server.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_sites\n\t\ts = get_admin_section \"system.applicationHost/sites\"\n\t IisObjectCollection.new s.Collection, :site, Site, lambda { |site| site.id = s.Collection.Count + 1 }\n end", "def create\n @site_option = SiteOption.new(site_option_params)\n\n respond_to do |format|\n if @site_option.save\n format.html { redirect_to @site_option, notice: 'Site option was successfully created.' }\n format.json { render :show, status: :created, location: @site_option }\n else\n format.html { render :new }\n format.json { render json: @site_option.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to(@site, :notice => 'Site was successfully created.') }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to(@site, :notice => 'Site was successfully created.') }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @site = Site.new(params[:site])\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to(@site, :notice => 'Site was successfully created.') }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @site_editorial = SiteEditorial.new(site_editorial_params)\n\n respond_to do |format|\n if @site_editorial.save\n format.html { redirect_to @site_editorial, notice: 'Site editorial was successfully created.' }\n format.json { render json: @site_editorial, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @site_editorial.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @place = @site.places.build(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to organisation_site_path(@site.organisation, @site), notice: 'Place was successfully created.' }\n format.json { render json: @place, status: :created, location: @place }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sitecity = Sitecity.new(params[:sitecity])\n\n respond_to do |format|\n if @sitecity.save\n format.html { redirect_to @sitecity, notice: t(:sitecity_create_success) }\n format.json { render json: @sitecity, status: :created, location: @sitecity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sitecity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site = Site.new(site_params)\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to(root_url, :notice => 'Site was successfully created.') }\n format.xml { render :xml => @site, :status => :created, :location => @site }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @website = Website.new(website_params)\n\n if @website.save\n render json: @website, status: :created, location: @website\n else\n render json: @website.errors, status: :unprocessable_entity\n end\n end", "def save_to_sites\n if Site.where(:id => self.site_id).count == 0\n p self\n return\n end\n STDERR.puts \"save_to_sites: Site: #{site}\"\n site_dir = Rails.root.join(\"sites\", site.name)\n unless Dir.exists? site_dir\n Dir.mkdir site_dir\n end\n payload_dir = site_dir.join(self.name)\n unless Dir.exists? payload_dir\n Dir.mkdir payload_dir\n end\n STDERR.puts \"Writing: #{payload_dir}\"\n File.open(payload_dir.join(\"client_script.rb\"), \"wb\") do |f|\n f.write self.client_script\n end \n File.open(payload_dir.join(\"data_generator.rb\"), \"wb\") do |f|\n f.write self.data_generator\n end \n end", "def create_site\n # create it in the default locale\n Mounter.with_locale(self.default_locale) do\n self.output_locale\n\n self.output_resource_op self.site\n\n if (site = self.post(:sites, self.site.to_hash(false), Mounter.locale)).nil?\n raise Mounter::WriterException.new('Sorry, we are unable to create the site.')\n else\n self.site._id = site['id']\n self.output_resource_op_status self.site\n end\n end\n\n # update it in other locales\n self.update_site(true)\n end", "def create\n #1st you retrieve the customer thanks to params[:customer_id]\n customer = Customer.find(params[:customer_id])\n #2nd you create the site with arguments in params[:site]\n @site = customer.sites.create(params[:site_id])\n\n\n respond_to do |format|\n if @site.save\n #1st argument of redirect_to is an array, in order to build the correct route to the nested resource site\n format.html { redirect_to([@site.customer, @site], :notice => 'Please fill in the details below') }\n #the key :location is associated to an array in order to build the correct route to the nested resource site\n format.xml { render :xml => @site, :status => :created, :location => [@site.customer, @site] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n\n @project = Project.find(params[:project_id])\n @site = @project.sites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def create\n @site = Site.new(site_params)\n\n session[:referral] = @site.referral\n\n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render action: 'show', status: :created, location: @site }\n elsif Site.exists?(:domain => @site.domain)\n format.html { redirect_to site_path(Site.find_by(:domain => @site.domain)) }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n else\n format.html { render action: 'new' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @produktion_site = ProduktionSite.new(params[:produktion_site])\n\n respond_to do |format|\n if @produktion_site.save\n format.html { redirect_to @produktion_site, notice: 'Produktion site was successfully created.' }\n format.json { render json: @produktion_site, status: :created, location: @produktion_site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @produktion_site.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site_config = SiteConfig.new(site_config_params)\n\n respond_to do |format|\n if @site_config.save\n format.html { redirect_to @site_config, notice: 'Site config was successfully created.' }\n format.json { render json: @site_config, status: :created, location: @site_config }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site_config.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site_url = SiteUrl.new(site_url_params)\n\n respond_to do |format|\n if @site_url.save\n format.html { redirect_to @site_url, notice: \"Site url was successfully created.\" }\n format.json { render :show, status: :created, location: @site_url }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @site_url.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page = current_site.pages.new(params[:page])\n @site = @page.site\n\n respond_to do |format|\n if @page.save\n format.html { redirect_to @page, notice: 'Page was successfully created.' }\n format.json { render json: @page, status: :created, location: @page }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_site(sitecontainer, title = \"Test Site\", sitepath = \"\", sitetemplate=nil )\n\t path = @sling.url_for(sitecontainer)\n res = @sling.execute_post(path+\".createsite.json\", \"sakai:title\" => title, \":sitepath\" => sitepath, \"sakai:site-template\" => sitetemplate )\n if (res.code != \"200\" && res.code != \"201\")\n puts \"Unable to create site: #{res.code} #{res.body}\"\n return nil\n end\n return Site.new(@sling, sitecontainer+sitepath)\n end", "def index\n @sites = current_user.sites.page(params[\"page\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "def create\n @website = websites.new(website_params)\n\n respond_to do |format|\n if @website.save\n flash[:notice] = :success\n format.html { redirect_to @website, notice: 'Website was successfully created.' }\n format.json { render :show, status: :created, location: @website }\n else\n format.html { render :new }\n format.json { render json: @website.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_site(opts = {})\n data, _status_code, _headers = create_site_with_http_info(opts)\n data\n end", "def create\n @watch_site = WatchSite.new(params[:watch_site])\n\n respond_to do |format|\n if @watch_site.save\n format.html { redirect_to @watch_site, notice: 'Watch site was successfully created.' }\n format.json { render json: @watch_site, status: :created, location: @watch_site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @watch_site.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7058945", "0.6943568", "0.6846377", "0.6666819", "0.6637744", "0.6290428", "0.6283639", "0.6283639", "0.6283639", "0.6260006", "0.622562", "0.6222387", "0.6181914", "0.61598366", "0.6146918", "0.6116231", "0.6090384", "0.6071778", "0.60521716", "0.60495603", "0.604685", "0.6035082", "0.60340536", "0.6000097", "0.5986358", "0.5977975", "0.5956776", "0.5944868", "0.59317136", "0.5902308", "0.58847153", "0.5878469", "0.58742154", "0.5862463", "0.58532965", "0.5843113", "0.5835125", "0.58072674", "0.58066523", "0.57910085", "0.57869923", "0.5783696", "0.57832474", "0.5781689", "0.57745594", "0.57630277", "0.57630277", "0.5754788", "0.5724253", "0.57020056", "0.5689859", "0.5686598", "0.5679405", "0.5672602", "0.5666871", "0.5666143", "0.5664931", "0.56590915", "0.56482744", "0.564243", "0.5635902", "0.5618298", "0.56154585", "0.5613486", "0.5598528", "0.5577883", "0.5573888", "0.5571673", "0.5552601", "0.55521154", "0.5543661", "0.55404586", "0.55404586", "0.55404586", "0.55404586", "0.5536965", "0.5528079", "0.5525624", "0.5524482", "0.5524482", "0.5524482", "0.55236226", "0.55165505", "0.5516351", "0.55147934", "0.5509205", "0.5502021", "0.54977804", "0.5494402", "0.5452687", "0.5449078", "0.54471964", "0.5445943", "0.54429275", "0.5442367", "0.5428489", "0.5423347", "0.5419488", "0.54127973", "0.5410855" ]
0.7116671
0
PATCH/PUT /organizations/1/sites/1 PATCH/PUT /organizations/1/sites/1.json
def update respond_to do |format| if @site.update(site_params) format.html { redirect_to after_update_path, notice: 'Site was successfully updated.' } format.json { render :show, status: :ok, location: @site } else format.html { render :edit } format.json { render json: @site.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @site = current_user.sites.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { flash_and_redirect(\"successfully updated!\", sites_url) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @site = current_user.sites.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize!(@site)\n\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to site_site_steps_path(@site), notice: t('notice.site.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n if params[:site][:manager_ids]\n format.html { redirect_to sites_url(subdomain: \"www\"), notice: 'Site was successfully updated.' }\n else\n format.html { redirect_to edit_site_url(subdomain: @site.subdomain), notice: 'Site was successfully updated.' }\n end\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def put_update(options = {})\n options[:id] ||= @website.id\n options[:website] ||= @attributes\n\n put :update,options\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n @site = Site.find params[:id]\n return unless authorize_resource(@site, UPDATE_SITE)\n\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to sites_path, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @site = Site.find_by_site(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @site = Site.find(params[:id])\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to @site, :notice => 'Site was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\", :layout=>\"site\"}\n format.json { render :json => @site.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to sites_path, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @site = Site.find(id_from_params)\n\n respond_to do |format|\n current_user.account.sites.delete(@site)\n current_user.account.sites << @site\n if current_user.account.sites.exists? @site\n format.html { redirect_to root_path, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n do_load_resource\n get_project_if_exists\n do_authorize_instance\n\n @original_site_name = @site.name\n\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to [@project, @site], notice: 'Site was successfully updated.' }\n format.json { respond_show }\n else\n format.html do\n render action: 'edit'\n end\n format.json { respond_change_fail }\n end\n end\n end", "def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n redirect_to \"/sites\" and return\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to sites_url, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to site_path(@site), notice: 'Site was successfully updated.' }\n # format.html { redirect_to project_site_path(@site.project, @site), notice: 'Site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { flash.now[:error] = \"Error: See details below.\"\n render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @orbituarysite = Orbituarysite.find(params[:id])\n\n respond_to do |format|\n if @orbituarysite.update_attributes(params[:orbituarysite])\n format.html { redirect_to @orbituarysite, notice: 'Orbituarysite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @orbituarysite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html {redirect_to sites_url, flash[:info]='Site was successfully updated.' }\n format.js { flash[:info]='Site was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n respond_to do |format|\n if @site.update(params)\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { render json: { result: :ok, notice: 'changes saved succesfully', site: @site } }\n else\n format.html { render :edit }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subsite = Subsite.find(params[:id])\n\n respond_to do |format|\n if @subsite.update_attributes(params[:subsite])\n format.html { redirect_to @subsite, notice: 'Subsite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subsite.errors, status: :unprocessable_entity }\n end\n end\n end", "def gu_update_site_from_app\n @app = App.find(params[:app]) rescue nil\n @site = !@app.nil? ? @app.site : nil\n\n respond_to do |format|\n format.html # gu_update_site_from_app.html.erb does not exist! JSON only\n format.json { render json: @site }\n end\n end", "def update\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to edit_site_path(@site), notice: 'Site was successfully updated.' }\n format.json { render :show, status: :ok, location: @site }\n else\n format.html { render :edit }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @jobsite.update(jobsite_params)\n format.html { redirect_to @jobsite, notice: 'Jobsite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @jobsite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to(@site, :notice => 'Site was successfully updated.') }\n format.json { head :ok }\n format.xml { head :ok }\n else\n format.html { render :action => '#edit' }\n format.json { render :json => @site.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @site_editorial.update(site_editorial_params)\n format.html { redirect_to @site_editorial, notice: 'Site editorial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @site_editorial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @serviceorg = Serviceorg.find(params[:id])\n\n respond_to do |format|\n if @serviceorg.update_attributes(params[:serviceorg])\n format.html { redirect_to @serviceorg, notice: 'Serviceorg was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serviceorg.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n if @sitio.update_attributes(params[:sitio])\n format.html { redirect_to @sitio, notice: 'Sitio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sitio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end", "def update_site_organization_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.update_site_organization ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.update_site_organization\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}/organization'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'site_organization'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#update_site_organization\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end", "def update_site_organization_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.update_site_organization ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.update_site_organization\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}/organization\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'site_organization'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#update_site_organization\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n respond_to do |format|\n if @anatomic_site.update(anatomic_site_params)\n format.html { redirect_to @anatomic_site, notice: 'Anatomic site was successfully updated.' }\n format.json { render :show, status: :ok, location: @anatomic_site }\n else\n format.html { render :edit }\n format.json { render json: @anatomic_site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(name: nil)\n data = name.nil? ? {} : {name: name}\n cf_patch(path: \"/organizations/#{org_id}\", data: data)\n end", "def update\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { render :show, status: :ok, location: @site }\n else\n format.html { render :edit }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { render :show, status: :ok, location: @site }\n else\n format.html { render :edit }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if update_and_decorate\n respond_to do |format|\n format.html { redirect_to @site, notice: 'Site #{@site.name} was successfully updated.' }\n format.json {\n flash[:popup] = \"#{@site.name} updated\"\n render :update\n }\n end\n else\n if @site\n post_resource_errors @site\n else\n flash[:alert] = \"Couldn't fetch site\"\n end\n render :edit, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @study_site.update(study_site_params)\n format.html { redirect_to @study_site, notice: 'Study site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @study_site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if !current_user.admin?\n head :forbidden\n else\n if @organisation.update(organisation_params)\n render json: @organisation.to_json, status: :ok\n else\n render json: @organisation.errors, status: :unprocessable_entity\n end\n end\n end", "def UpdateOrganization params = {}\n \n APICall(path: 'organizations.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n @site_setup = SiteSetup.find(params[:id])\n\n respond_to do |format|\n if @site_setup.update_attributes(params[:site_setup])\n format.html { redirect_to @site_setup, notice: 'Site setup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site_setup.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n format.html { redirect_to controller: \"sites\", action: \"checklists_manager\" }\n format.json { head :no_content }\n end\n end", "def update\n @organization = Organization.find(params[:id])\n @organization.update_attributes(organization_params)\n \n respond_with(@organization, :location => admin_organizations_path)\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n respond_to do |format|\n if @student_site.update(student_site_params)\n format.html { redirect_to @student_site, notice: 'Student site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @student_site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # TODO: see if mass-assigning gleaning_attributes works in Rails 5\n gleanings = params[:site].delete :gleaning_attributes\n if update_and_decorate\n if @site.errors.empty?\n @site.gleaning_attributes = gleanings\n respond_to do |format|\n format.html { redirect_to @site, notice: \"Site #{@site.name} was successfully updated.\" }\n format.json {\n flash[:popup] = \"#{@site.name} updated\"\n render :update\n }\n end\n return\n end\n end\n if @site\n resource_errors_to_flash @site\n else\n flash[:alert] = 'Couldn\\'t fetch site'\n end\n smartrender :action => :edit\n end", "def update\n @organization_person = OrganizationPerson.find(params[:id])\n\n if @organization_person.update(organization_person_params)\n render json: @organization_person\n else\n render json: @organization_person.errors, status: :unprocessable_entity\n end\n end", "def update\n #retrieve the site thanks to params[:id]\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update(site_params)\n #1st argument of redirect_to is an array, in order to build the correct route to the nested resource site\n format.html { redirect_to([@site.customer, @site], :notice => 'Site was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @jobsite.update(jobsite_params)\n format.html { redirect_to @jobsite, notice: 'Jobsite was successfully updated.' }\n format.json { render :show, status: :ok, location: @jobsite }\n else\n format.html { render :edit }\n format.json { render json: @jobsite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @environment = @project.environments.find_by_slug!(params[:id])\n\n respond_to do |format|\n if @environment.update_attributes(params[:environment])\n format.html { redirect_to @environment, notice: 'Environment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @environment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @site_config = SiteConfig.find(params[:id])\n\n respond_to do |format|\n if @site_config.update_attributes(site_config_params)\n format.html { redirect_to @site_config, notice: 'Site config was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site_config.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @site_type = SiteType.find(params[:id])\n\n respond_to do |format|\n section_type_ids = params[:site_type].delete(\"section_type_ids\")\n if @site_type.update_attributes(params[:site_type]) && @site_type.section_type_ids = section_type_ids\n format.html { redirect_to @site_type, notice: 'Site type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @site_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @environment = current_user.organization.environments.find(params[:id])\n\n respond_to do |format|\n if @environment.update_attributes(params[:environment])\n format.html { redirect_to @environment, notice: 'Instance record was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @environment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end", "def update\n respond_to do |format|\n if @host_org.update(host_org_params)\n format.html { redirect_to @host_org, notice: 'Host org was successfully updated.' }\n format.json { render :show, status: :ok, location: @host_org }\n else\n format.html { render :edit }\n format.json { render json: @host_org.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n logger.debug \"debug_update:params=#{params.inspect}\"\n @m_site = MSite.where(id: params[:id].to_i).first\n @m_site.name = params['app_job_offer_name']\n @m_site.password = params['app_password'].nil? ? '' : params['app_password']\n @m_site.no_scraping_flg = params['app_no_scraping_flg']\n #@m_site.recruitment_site_id = params['app_site_id'].nil? ? '' : params['app_site_id']\n @m_site.user_id = params['app_user_id'].nil? ? '' : params['app_user_id']\n @m_site.extra1 = params['extra1'].nil? ? '' : params['extra1']\n @m_site.extra2 = params['extra2'].nil? ? '' : params['extra2']\n @m_site.extra3 = params['extra3'].nil? ? '' : params['extra3'].to_i\n @m_site.enterprise_cnt = params['enterprise_cnt'].nil? ? 0 : params['enterprise_cnt']\n\n respond_to do |format|\n if @m_site.valid? && @error_msg.blank?\n @m_site.save\n format.html { redirect_to '/m_sites', notice: 'Site was successfully updated.' }\n format.json { render :show, status: :ok, location: @m_site }\n else\n format.html { render :edit }\n format.json { render json: @m_site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @site.user_id = current_user.id\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to @site, notice: 'Site was successfully updated.' }\n format.json { render :show, status: :ok, location: @site }\n else\n format.html { render :edit }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @organization = Organization.find(params[:id])\n\n respond_to do |format|\n if @organization.update_attributes(params[:organization])\n flash[:notice] = 'Organization was successfully updated.'\n #format.html { redirect_to(@organization) }\n format.html { redirect_to :controller => 'organizations', :action => 'show' , :organization=> @organization.site_name }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @organization.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to @site, notice: t('.flash_updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin_authoring_site = Admin::AuthoringSite.find(params[:id])\n authorize @admin_authoring_site\n\n respond_to do |format|\n if @admin_authoring_site.update(admin_authoring_site_strong_params(params[:admin_authoring_site]))\n format.html { redirect_to @admin_authoring_site, notice: 'Authoring site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_authoring_site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ooh_site.update(ooh_site_params)\n format.html { redirect_to @ooh_site.becomes(OohSite), notice: 'Ooh site was successfully updated.' }\n format.json { render :show, status: :ok, location: @ooh_site }\n else\n format.html { render :edit }\n format.json { render json: @ooh_site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @site_option.update(site_option_params)\n format.html { redirect_to @site_option, notice: 'Site option was successfully updated.' }\n format.json { render :show, status: :ok, location: @site_option }\n else\n format.html { render :edit }\n format.json { render json: @site_option.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @installation_site = InstallationSite.find(params[:id])\n\n respond_to do |format|\n if @installation_site.update_attributes(params[:installation_site])\n format.html { redirect_to @installation_site, notice: 'Installation site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @installation_site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @site = Site.first\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n format.html { redirect_to(root_url, :notice => 'Site was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @site.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_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\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 @stuff = Stuff.find(params[:id])\n\n respond_to do |format|\n if @stuff.update_attributes(params[:stuff])\n format.html { redirect_to @stuff, :notice => 'Stuff was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @stuff.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n respond_to do |format|\n if @clients_organization.update(clients_organization_params)\n format.json { render :show, status: :ok, location: @clients_organization }\n else\n format.json { render json: @clients_organization.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n authorize! :update, Organization\n respond_to do |format|\n if @organization.update(organization_params)\n format.js\n else\n format.js { render :edit }\n end\n end\n end", "def update!(**args)\n @site = args[:site] if args.key?(:site)\n @versioned_data = args[:versioned_data] if args.key?(:versioned_data)\n end", "def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @campsite.update(campsite_params)\n format.html { redirect_to @campsite, notice: \"Campsite was successfully updated.\" }\n format.json { render :show, status: :ok, location: @campsite }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @campsite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @organization = Organization.find(params[:id])\n\n respond_to do |format|\n if @organization.update_attributes(params[:organization])\n format.html { redirect_to admin_organizations_path, notice: \"Organization #{@organization.name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to xmt_press_sites_url, notice: '站点更新成功.' }\n format.json { render :show, status: :ok, location: @site }\n else\n format.html { render :edit }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if update_organisation\n format.html { redirect_to @organisation, notice: 'Organisation was successfully updated.' }\n format.json { render :show, status: :ok, location: @organisation }\n else\n format.html { render :edit }\n format.json { render json: @organisation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @person_info = PersonInfo.find(params[:id])\n\n if @person_info.update(person_info_params(params[:person_info]))\n head :no_content\n else\n render json: @person_info.errors, status: :unprocessable_entity\n end\n end", "def update\r\n respond_to do |format|\r\n if @site_config.update(site_config_params)\r\n format.html { redirect_to action: :index, notice: t('Site config 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: @site_config.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @watch_site = WatchSite.find(params[:id])\n\n respond_to do |format|\n if @watch_site.update_attributes(params[:watch_site])\n format.html { redirect_to @watch_site, notice: 'Watch site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @watch_site.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 @job_site_application.update(job_site_application_params)\n format.html { redirect_to @job_site_application, notice: 'Job site application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job_site_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @people_organization.update(people_organization_params)\n format.html { redirect_to @people_organization, notice: 'People organization was successfully updated.' }\n format.json { render :show, status: :ok, location: @people_organization }\n else\n format.html { render :edit }\n format.json { render json: @people_organization.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize!(@site_page.site)\n\n respond_to do |format|\n if @site_page.update(site_page_params)\n format.html { redirect_to @site_page, notice: 'Site page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @site_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_site_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SiteApi.update_site ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.update_site\"\n end\n # resource path\n local_var_path = \"/api/3/sites/{id}\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'site'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#update_site\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_site_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SiteApi.update_site ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SiteApi.update_site\"\n end\n # resource path\n local_var_path = '/api/3/sites/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'site'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Links')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SiteApi#update_site\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @early_vote_site = EarlyVoteSite.find(params[:id])\n\n respond_to do |format|\n if @early_vote_site.update_attributes(params[:early_vote_site])\n format.html { redirect_to @early_vote_site, notice: 'EarlyVoteSite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @early_vote_site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n if @sitio.update_attributes(params[:sitio])\n format.html { redirect_to(@sitio, :notice => 'Sitio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sitio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @site.update(site_params)\n format.html { redirect_to user_path(@user), notice: \"サイト[#{@site.name}]を編集しました\" }\n format.json { render :show, status: :ok, location: @site }\n else\n format.html { render :edit }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @site = Site.find(params[:id])\n\n respond_to do |format|\n if @site.update_attributes(params[:site])\n flash[:notice] = 'Site was successfully updated.'\n format.html { redirect_to(@site) }\n format.xml { head :ok }\n format.js\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @site.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end", "def update(options = {})\n @client.put(self.link(:edit), self.to_json, options)\n end", "def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @site.update(cms_site_params)\n\n format.html { redirect_to cms.sites_url, notice: '站点已修改.' }\n format.json { head :no_content }\n else\n @cms_theme = Cms::Theme.all\n format.html { render action: 'edit' }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.65415806", "0.6486838", "0.62991977", "0.6289661", "0.6283", "0.61884683", "0.61720824", "0.6142745", "0.612507", "0.6113049", "0.6109419", "0.61069435", "0.61048996", "0.6100842", "0.6095115", "0.6069081", "0.6058771", "0.6022002", "0.6022002", "0.60165375", "0.5978886", "0.5952055", "0.5951463", "0.5943973", "0.5901561", "0.5900871", "0.5893183", "0.5892278", "0.5892079", "0.58871955", "0.5884934", "0.58788663", "0.5868622", "0.58595484", "0.5858494", "0.5853587", "0.5848391", "0.58452654", "0.5844189", "0.5844189", "0.58407843", "0.5834127", "0.5823965", "0.5821076", "0.58165854", "0.5813141", "0.5810801", "0.5809762", "0.5795163", "0.57910234", "0.57886", "0.57825154", "0.5773304", "0.5756704", "0.57376695", "0.5735138", "0.57346725", "0.57333446", "0.57311904", "0.5727858", "0.5727438", "0.57272047", "0.5710205", "0.5708531", "0.57071733", "0.57053494", "0.57049614", "0.56951314", "0.56918406", "0.5689261", "0.5684101", "0.56800175", "0.5679357", "0.5673925", "0.56608593", "0.5653733", "0.5641377", "0.56381416", "0.5636385", "0.5634948", "0.563238", "0.56268024", "0.56262904", "0.56256485", "0.5624434", "0.5617576", "0.5615211", "0.5614116", "0.5600565", "0.5598343", "0.5593375", "0.55920714", "0.55892044", "0.5585973", "0.55815536", "0.5579424", "0.5570099", "0.5568207", "0.5565955", "0.55652267" ]
0.56243247
85
DELETE /organizations/1/sites/1 DELETE /organizations/1/sites/1.json
def destroy @site.destroy respond_to do |format| format.html { redirect_to after_destroy_path, notice: 'Site was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @orbituarysite = Orbituarysite.find(params[:id])\n @orbituarysite.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @site = Site.find(id_from_params)\n\n respond_to do |format|\n if current_user.account.sites.delete(@site)\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @site = current_user.sites.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url, :notice => t('sites.destroy.completed') }\n format.json { head :no_content }\n end\n end", "def destroy\n @site = current_user.sites.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { flash_and_redirect(\"successfully deleted\", sites_url) }\n format.json { head :ok }\n end\n end", "def destroy\n @study_site.destroy\n respond_to do |format|\n format.html { redirect_to study_sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @anatomic_site.destroy\n respond_to do |format|\n format.html { redirect_to anatomic_sites_url, notice: 'Anatomic site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :ok }\n end\n end", "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :ok }\n end\n end", "def destroy\n authorize!(@site)\n\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @site = Site.find_by_site(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end", "def destroy\n @subsite = Subsite.find(params[:id])\n @subsite.destroy\n\n respond_to do |format|\n format.html { redirect_to subsites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n return unless authorize_resource(@site, DELETE_SITE)\n\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_path, notice: I18n.t('sites.destroy.success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @jobsite.destroy\n respond_to do |format|\n format.html { redirect_to jobsites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ooh_site.destroy\n respond_to do |format|\n format.html { redirect_to ooh_sites_url, notice: 'Ooh site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_sites_url, notice: 'Site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @student_site.destroy\n respond_to do |format|\n format.html { redirect_to student_sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_path, notice: 'Site was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url, notice: 'Site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url, notice: 'Site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url, notice: 'Site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url, notice: 'Site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url, notice: 'Site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url, notice: 'Site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url, notice: 'Site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sitecity = Sitecity.find_by_url(params[:id])\n @sitecity.destroy\n\n respond_to do |format|\n format.html { redirect_to sitecities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @site_url.destroy\n respond_to do |format|\n format.html { redirect_to site_urls_url, notice: \"Site url was successfully destroyed.\" }\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 @optimized_site.destroy\n respond_to do |format|\n format.html { redirect_to optimized_sites_url, notice: 'Optimized site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @campsite.destroy\n respond_to do |format|\n format.html { redirect_to campsites_url, notice: \"Campsite was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @site = Site.find params[:id]\n return unless authorize_resource(@site, DELETE_SITE)\n\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to sites_path, notice: 'Site was successfully deleted.' }\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 remove\n @site = Site.find(params[:id])\n @study.sites.delete(@site)\n\n respond_to do |format|\n format.xml { head :ok }\n format.js\n end\n end", "def destroy\n @site_setup = SiteSetup.find(params[:id])\n @site_setup.destroy\n\n respond_to do |format|\n format.html { redirect_to site_setups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @server.destroy\n respond_to do |format|\n format.html { redirect_to [:admin, @site] }\n format.json { head :no_content }\n end\n end", "def destroy\n @supplysite = Supplysite.find(params[:id])\n @supplysite.destroy\n\n respond_to do |format|\n format.html { redirect_to supplysites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @site_config = SiteConfig.find(params[:id])\n @site_config.destroy\n\n respond_to do |format|\n format.html { redirect_to site_configs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end", "def destroy\n @installation_site = InstallationSite.find(params[:id])\n @installation_site.destroy\n\n respond_to do |format|\n format.html { redirect_to installation_sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n do_load_resource\n get_project_if_exists\n do_authorize_instance\n\n @site.destroy\n add_archived_at_header(@site)\n\n respond_to do |format|\n format.html { redirect_to project_sites_url(@project) }\n format.json { respond_destroy }\n end\n end", "def destroy\n @sitio = Sitio.find(params[:id])\n @sitio.destroy\n\n respond_to do |format|\n format.html { redirect_to sitios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @serviceorg = Serviceorg.find(params[:id])\n @serviceorg.destroy\n\n respond_to do |format|\n format.html { redirect_to serviceorgs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #m_@site.destroy\n m_site = MSite.find(params[:id].to_i)\n m_site.del_flg = 1\n m_site.save\n\n respond_to do |format|\n format.html { redirect_to '/m_sites', notice: 'Site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n delete_from_server single_url\n end", "def destroy\n @site_editorial.destroy\n respond_to do |format|\n format.html { redirect_to site_editorials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # return if need_login true, true\n @site = Site.find params[:id]\n @site.destroy\n respond_to do |format|\n format.html { redirect_to sites_url }\n format.json { head :ok }\n end\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def destroy\n @watch_site = WatchSite.find(params[:id])\n @watch_site.destroy\n\n respond_to do |format|\n format.html { redirect_to watch_sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trial_site.destroy\n respond_to do |format|\n format.html { redirect_to trial_sites_url, notice: 'Trial site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def deleteEntityWebsite( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/website\",params)\n end", "def destroy\n @jobsite.destroy\n respond_to do |format|\n format.html { redirect_to jobsites_url, notice: 'Jobsite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n end\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @microsite.destroy\n respond_to do |format|\n format.html { redirect_to microsites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @early_vote_site = EarlyVoteSite.find(params[:id])\n @early_vote_site.destroy\n\n respond_to do |format|\n format.html { redirect_to early_vote_sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @site_appraisal.destroy\n respond_to do |format|\n format.html { redirect_to site_appraisals_url, notice: \"Site appraisal was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @body_site.destroy\n respond_to do |format|\n format.html { redirect_to body_sites_url, notice: 'Body site was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_site_structure.destroy\n respond_to do |format|\n format.html { redirect_to admin_site_structures_url, notice: 'Site structure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @membership.destroy\n\n respond_to do |format|\n format.html { redirect_to edit_site_url(@membership.site) }\n format.json { head :no_content }\n end\n end", "def destroy\n @mysite.destroy\n respond_to do |format|\n format.html { redirect_to mysites_url, notice: 'Mysite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n site = @billing_site.site_id\r\n @billing_site.destroy\r\n respond_to do |format|\r\n # format.html { redirect_to billing_sites_url, notice: 'Billing site was successfully destroyed.' }\r\n format.html { redirect_to site_path(site), notice: 'Billing site was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n \n @sites = Site.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html { redirect_to sites_url, flash[:info]='Site was successfully deleted.' }\n format.js { flash[:info]='Site was successfully deleted.' }\n format.json { head :ok }\n end\n end", "def destroy\n @site = Site.find(params[:site_id])\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.html { redirect_to site_visits_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @site.destroy\n respond_to do |format|\n format.html { redirect_to user_path(@user), notice: \"サイト[#{@site.name}]を削除しました\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @campingsite.destroy\n respond_to do |format|\n format.html { redirect_to campingsites_url, notice: 'Campingsite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end", "def destroy\n @site_type = SiteType.find(params[:id])\n @site_type.destroy\n\n respond_to do |format|\n format.html { redirect_to site_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @host_org.destroy\n respond_to do |format|\n format.html { redirect_to host_orgs_url, notice: 'Host org was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @site_admin.destroy\n respond_to do |format|\n format.html { redirect_to site_admins_url, notice: 'Site admin was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @environment = current_user.organization.environments.find(params[:id])\n @environment.destroy\n\n respond_to do |format|\n format.html { redirect_to environments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_authoring_site = Admin::AuthoringSite.find(params[:id])\n authorize @admin_authoring_site\n @admin_authoring_site.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_authoring_sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize!(@site_page.site)\n \n @site_page.destroy\n respond_to do |format|\n format.html { redirect_to site_pages_url }\n format.json { head :no_content }\n end\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to(sites_url) }\n format.xml { head :ok }\n format.js\n end\n end", "def DeleteOrganization id\n \n APICall(path: \"organizations/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n # retrieve the site thanks to params[:id]\n @site = Site.find(params[:id])\n @site.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end", "def delete\n api_client.delete(url)\n end" ]
[ "0.7169485", "0.7139715", "0.70999706", "0.70718527", "0.70718527", "0.70718527", "0.70718527", "0.70718527", "0.70562106", "0.7041012", "0.6977108", "0.6976829", "0.6965317", "0.6965317", "0.6965317", "0.6965317", "0.6965317", "0.69564766", "0.6931506", "0.6928645", "0.6928417", "0.6921443", "0.691885", "0.6883503", "0.68673706", "0.68566465", "0.68501854", "0.68123233", "0.68004024", "0.67835957", "0.6783503", "0.67604107", "0.67604107", "0.67604107", "0.67604107", "0.67604107", "0.67604107", "0.67604107", "0.6749395", "0.6735272", "0.67338735", "0.6714619", "0.67112267", "0.66959286", "0.6688917", "0.6684978", "0.66795266", "0.66777676", "0.6669285", "0.6661498", "0.66541964", "0.665094", "0.6640975", "0.6632207", "0.66200715", "0.6615189", "0.6610285", "0.66051215", "0.6602351", "0.65883535", "0.6585971", "0.6572382", "0.65722", "0.6564842", "0.65633684", "0.65577185", "0.65577185", "0.65577185", "0.65577185", "0.65577185", "0.65577185", "0.65577185", "0.65577185", "0.65497077", "0.6543577", "0.6543529", "0.6530726", "0.65285", "0.65263224", "0.65250856", "0.65236974", "0.65172416", "0.6513835", "0.65118855", "0.6511134", "0.6507609", "0.6506524", "0.6500935", "0.6493351", "0.648221", "0.64766544", "0.64720076", "0.6463657", "0.6449574", "0.6442744", "0.6441065", "0.6440947", "0.64346194", "0.6431051", "0.642935" ]
0.64404225
97
Only allow a list of trusted parameters through.
def site_params params.require(:site).permit(:domain, :name, :organization_id, setting_attributes: [ :id, :comment_display_created_at, :comment_repeatable ]) 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 list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\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.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 params(list)\n @declared_params = list\n end", "def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\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 safelist; end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n 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.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.6326454", "0.63140553", "0.6299814", "0.62642586", "0.626006", "0.62578833", "0.6236823", "0.6227561", "0.6221758", "0.62200165", "0.620879", "0.61983657", "0.6195055", "0.6172993", "0.6156856", "0.61558664", "0.61521494", "0.6135789", "0.6121145", "0.61118174", "0.60736513", "0.6071645", "0.60632104", "0.60549796", "0.6043906", "0.6034662", "0.60207325", "0.6018568", "0.6016575", "0.60103434", "0.60084206", "0.600763", "0.6007443", "0.6003619", "0.6003619", "0.5995791", "0.5993301", "0.5993231", "0.5984926", "0.597122", "0.5968121", "0.5965808", "0.59640145", "0.59632224", "0.59602356", "0.59332967", "0.5927556", "0.5922805", "0.5909745", "0.5905083", "0.5904304", "0.5893434", "0.58888215", "0.58823985", "0.58823985", "0.58823985", "0.5873434", "0.58619875", "0.58533794", "0.5845531", "0.58426666", "0.58360124", "0.583218", "0.5828041", "0.5827927", "0.5816121", "0.5814705", "0.5812719", "0.581121", "0.5803423", "0.5803423", "0.57995003", "0.5794207", "0.5784923", "0.5781365", "0.5776385", "0.5774859", "0.57671493", "0.5766998", "0.57618684", "0.5758038" ]
0.0
-1
Retrieves an instance variable from the controller from a request.
def assigns(key) $mack_app.instance_variable_get("@app").instance_variable_get("@response").instance_variable_get("@controller").instance_variable_get("@#{key}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instance\n @controller.instance_variable_get(:\"@#{instance_name}\")\n end", "def request\n @controller.request\n end", "def request\n @controller.request\n end", "def request\n @controller.request\n end", "def get_resource_ivar\n instance_variable_get(\"@#{self.controller_name.singularize}\")\n end", "def get!(resource)\n resource.instance_variable_get(instance_variable_name)\n end", "def get!(resource)\n resource.instance_variable_get(instance_variable_name)\n end", "def get_from_param\n instance_variable_set(\"@#{self.controller_name.singularize}\", self.controller_name.classify.constantize.from_param(params[:id]))\n end", "def current_request\n controller.request if has_request?\n end", "def assigns(key)\n controller.instance_variable_get(\"@#{key}\")\n end", "def assigns(key)\n controller.instance_variable_get(\"@#{key}\")\n end", "def get!(instance)\n instance.instance_variable_get(@instance_variable_name)\n end", "def show\n @request = Request.new\n end", "def get!(instance)\n instance.instance_variable_get(instance_variable_name)\n end", "def get_param(key)\n raise TypeError.new('invali rack request instance.') unless @request.is_a?(::Rack::Request)\n return @request.params[key.to_s]\n end", "def request_object\n $REQUEST\n end", "def instance_variable(key)\n instance_variable_get(\"@#{key}\")\n end", "def get_resource_ivar #:nodoc:\n instance_variable_get(\"@#{resource_instance_name}\")\n end", "def show\n @request = Request.find(params[:id])\n end", "def request\n SharedStorage.get(:request)\n end", "def request\n @_context[:request]\n end", "def request\n view_context.request\n end", "def request\n @request ||= Request.find request_id\n end", "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "def get_controller\n @controller_name = params[:controller]\n end", "def get_resource_ivar #:nodoc:\n if instance_variable_defined?(:\"@#{resource_instance_name}\")\n instance_variable_get(\"@#{resource_instance_name}\")\n else\n nil\n end\n end", "def controller\n @controller\n end", "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "def controller_to_get(attribute_name, class_attribute_name = nil)\n class_attribute_name ||= attribute_name\n return ModuleUtils.try_to self.class, class_attribute_name if is_a? ::ActionController::Base # controller?\n\n ModuleUtils.try_to controller, attribute_name # view?\n end", "def request\n @@request\n end", "def request\n @@request\n end", "def lookup_request_parameter(request, key) # :nodoc:\n \n # Depending on the user's version of Rails, this may fail due to a bug in Rails parsing of\n # nil keys: http://dev.rubyonrails.org/ticket/5137, so we have a backup plan\n begin\n \n # this should work on most Rails installations\n return request[key]\n \n rescue\n \n # this saves most other Rails installations\n begin\n \n retval = nil\n \n # try accessing raw_post (doesn't work in some mongrel installations)\n if request.respond_to?(:raw_post)\n return CGI::parse(request.send(:raw_post)).fetch(key){[]}.first\n end\n \n # try accessing the raw environment table\n if !retval\n envTable = nil\n \n envTable = request.send(:env_table) if request.respond_to?(:env_table)\n if !envTable\n envTable = request.send(:env) if request.respond_to?(:env)\n end\n \n if envTable\n # credit: Blake Carlson and David Troy\n [\"RAW_POST_DATA\", \"QUERY_STRING\"].each do |tableSource|\n if envTable[tableSource]\n retval = CGI::parse(envTable[tableSource]).fetch(key){[]}.first\n end\n break if retval\n end\n end\n end\n \n # hopefully we got a parameter\n return retval\n \n rescue\n \n # for some reason, we just can't get the parameters\n RAILS_DEFAULT_LOGGER.info \"** RFACEBOOK WARNING: failed to access request.parameters\"\n return nil\n\n end\n end\n end", "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "def instance_var\n @instance_var\n end", "def instance_var\n @instance_var\n end", "def instance_var\n @instance_var\n end", "def set_request\n @request = Request.find params[:id]\n end", "def ivar_get(name)\n instance_variable_get(\"@#{name}\")\n end", "def controller\n return @controller\n end", "def instance_var\n @instance_var\n end", "def controller\n @controller ||= MainController.new\n end", "def get_resource_ivar # rubocop:disable Naming/AccessorMethodName\n instance_variable_get resource_ivar\n end", "def get_resource\n\t\t\t\tinstance_variable_get(\"@#{resource_name}\")\n\t\t\tend", "def current_member() instance_variable_get(\"@#{resource_singular}\") end", "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "def get_resource\n instance_variable_get(\"@#{resource_name}\")\n end", "def params\n @_params ||= ActionController::ManagebleParameters.new(request.parameters)\n end", "def fetch(name)\n return @model.get_variable_value(name)\n end", "def entry\n @controller.send(:entry)\n end", "def controller_name\n self.request.route_obj.instance_variable_get('@controller')\n end", "def show #Variable @model_instance is already being set inside the setter method: set_model_instance\n authorize! :show, params[:controller]\n end", "def params\n controller.params\n end", "def current\n Thread.current[:CURRENT_CONTROLLER]\n end", "def params\n @controller.params\n end", "def params\n @controller.params\n end", "def request\n @request\n end", "def set_request\n @request = Request.accessible_by(current_ability).find(params[:id])\n end", "def request\n @_request\n end", "def value_get name\n instance_variable_get(:\"@#{name}\")\n end", "def show\n logger.debug \"#{params[:action].to_s} called in #{self.class}: model=#{@model_class}, request.format=#{request.format}, request.content_type=#{request.content_type}, params=#{params.inspect}\" if self.debug\n # to_s as safety measure for vulnerabilities similar to CVE-2013-1854\n @value = @model_class.where(id: params[:id].to_s).first # don't raise exception if not found\n authorize! :read,@value\n\n instance_variable_set(@model_at_singular_name_sym, @value)\n render_or_respond(true, @value.nil? ? :not_found : :ok)\n rescue self.rescue_class => e\n handle_or_raise(e)\n end", "def request; return @request end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n @user = @request.gettarget\n end", "def run(req, res)\n @params = req.params\n controller_class.send(action_name)\n end", "def variable_get(name)\n assert_type name, :String, :name\n environment.caller.var(name.value)\n end", "def default_object\n @_scope.respond_to?(:controller) ?\n instance_variable_get(\"@#{@_scope.controller.controller_name}\") :\n nil\n end", "def instance\n @instance ||= Fleet::Controller.new\n end", "def show\n @id = params[:id]\n end", "def show\n @id = params[:id]\n end", "def result\n Namespace.root.context.instance_variable_get(variable_name)\n end", "def controller\n @params['controller'] || @params[:controller]\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def show\n @variable = Variable.find_by(field_name: params[:id])\n end", "def controller client\n client.env[CONTROLLER_NAME]\n end", "def set_request\n $request = request\n end", "def index\n @request_properties = current_user.request_property\n end", "def get_user\n instance_variable_get(\"@#{user_type}\")\n end", "def instance_variable_ged name\n var = get_instance_variable name.to_s[1 .. -1].to_sym\n #puts \"getting #{name} #{var}\"\n var\n end", "def show\n username = params['id']\n puts username\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end", "def set_request\n @request = Request.find(params[:id])\n end" ]
[ "0.7073084", "0.6518171", "0.6518171", "0.6518171", "0.63648355", "0.6050599", "0.60416365", "0.6039451", "0.5967834", "0.5940491", "0.5940491", "0.5935501", "0.59234214", "0.59191304", "0.5841595", "0.5780147", "0.5709313", "0.56840026", "0.5649363", "0.5647205", "0.56299907", "0.55939865", "0.55580914", "0.55497694", "0.55497694", "0.55497694", "0.55497694", "0.55427957", "0.55405766", "0.55404", "0.5535265", "0.5532911", "0.55087084", "0.54968536", "0.5481467", "0.54473877", "0.54473877", "0.5428705", "0.5428705", "0.5428705", "0.53991514", "0.53837454", "0.5380717", "0.5367287", "0.5364431", "0.5363074", "0.5359988", "0.53349376", "0.5329112", "0.5329112", "0.5329112", "0.53261036", "0.5314739", "0.5305375", "0.52891606", "0.52887076", "0.52886003", "0.5285082", "0.5283641", "0.5283641", "0.5283193", "0.52816486", "0.5271836", "0.5264989", "0.52595645", "0.52520317", "0.5232635", "0.5232635", "0.5232635", "0.5232635", "0.5232635", "0.5232635", "0.5232635", "0.5232635", "0.5232635", "0.52161986", "0.52107936", "0.5197183", "0.51958996", "0.51944953", "0.5189389", "0.5189389", "0.5184995", "0.5181438", "0.5177287", "0.51734036", "0.5129071", "0.51288885", "0.5111849", "0.51086974", "0.5105623", "0.5104824", "0.5098114", "0.5098114", "0.5098114", "0.5098114", "0.5098114", "0.5098114", "0.5098114", "0.5098114" ]
0.5450504
35
create a wrapper object for file upload testing.
def file_for_upload(path) return Mack::Testing::FileWrapper.new(path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_file_upload(filename)\n ActionDispatch::Http::UploadedFile.new({\n filename: filename,\n content_type: 'application/octet-stream',\n tempfile: File.new(\"#{Rails.root}/test/fixtures/#{filename}\")\n })\n end", "def mock_archive_upload(archive_path, type)\n return ActionDispatch::Http::UploadedFile.new(:tempfile => File.new(Rails.root + archive_path , :type => type, :filename => File.basename(File.new(Rails.root + archive_path))))\n end", "def upload(filename)\n Mosquito::MockUpload.new(filename)\n end", "def file_upload(path)\n content_type = MIME::Types.type_for(path).first.to_s\n Rack::Test::UploadedFile.new(path, content_type)\n end", "def upload_fixture_file filename, content_type\n ActionDispatch::Http::UploadedFile.new({\n :filename => filename,\n :content_type => content_type,\n :tempfile => File.new(\"#{Rails.root}/test/fixtures/files/\" + filename)\n })\n end", "def wrapper!( file:, relation: )\n JobIoWrapper.create_with_varied_file_handling!( user: user,\n file: file,\n relation: relation,\n file_set: file_set )\n end", "def file_upload(criteria = T.unsafe(nil)); end", "def create_file_to_upload\n file_path = $redis.get(\"tempfile_path_#{self.id}\")\n tempfile = File.open(file_path,'r')\n\n file = ActionDispatch::Http::UploadedFile.new({\n :tempfile => File.new(tempfile)\n })\n file.original_filename = File.basename(file_path).split(\"_\", 2).last\n file.content_type = \"application/#{File.basename(file_path).split('.').last}\" \n file\n end", "def upload_file\n #TODO\n end", "def upload_simple\r\n \r\n end", "def file\n FileFactory.new(self)\n end", "def initialize(client, file_path, mime_type)\n @client = client\n @file_path = file_path\n @mime_type = mime_type\n\n uploaded_file = client.execute(\n api_method: client.drive.files.insert,\n body_object: touch_file,\n media: upload_io,\n parameters: DEFAULT_PARAMS\n )\n\n @file = FileConvert::File.new(uploaded_file)\n end", "def file_uploads; end", "def newobj(type, name, hash)\n transport = Puppet::TransObject.new(name, \"file\")\n transport[:path] = path\n transport[:ensure] = \"file\"\n assert_nothing_raised {\n file = transport.to_ral\n }\n end", "def wrapper!(file:, relation:)\n JobIoWrapper.create_with_varied_file_handling!(user: user, file: file, relation: relation, file_set: file_set)\n end", "def upload\n do_upload(self.class.upload_class)\n end", "def wrapper!(file:, relation:, preferred:)\n JobIoWrapper.create_with_varied_file_handling!(user: user, file: file, relation: relation, file_set: file_set, preferred: preferred)\n end", "def initialize(filename_or_io, content_type, upload_as_filename = nil)\n @file_part = Faraday::FilePart.new(filename_or_io, content_type, upload_as_filename)\n end", "def multipart_upload\n end", "def create_file(file)\n @generic_file = GenericFile.new\n @generic_file.batch_id = object.batch.pid\n @generic_file.add_file(file.read, 'content', file.name)\n @generic_file.apply_depositor_metadata(object.edit_users.first)\n @generic_file.date_uploaded = Time.now.ctime\n @generic_file.date_modified = Time.now.ctime\n @generic_file.save\n end", "def initialize_file(safebox_guid, file_params)\n handle_error { sendsecure_connection.post(\"/api/v2/safeboxes/#{safebox_guid}/uploads\", file_params) }\n end", "def simple_file_upload simple_file_upload_file\n absolut_path_file = Dir.pwd.gsub(/\\.tests/, 'tests/files') + '/' + simple_file_upload_file\n\n self.simple_file = absolut_path_file\n end", "def upload_file(filename,mime)\n file = ActionDispatch::Http::UploadedFile.new(filename: 'test.pdf', type: 'application/pdf', tempfile: File.new(\"#{Rails.root}/spec/fixtures/test.pdf\"))\n file\n end", "def create_upload_request\n call(:post, upload_path)\n end", "def upload(file_name)\n File.new(\"#{Rails.root}/spec/factories/files/#{file_name}\")\n end", "def initialize(id, expected)\r\n @error = nil\r\n\r\n @expected = expected.to_i\r\n @received = 0\r\n\r\n @chunklimit = 5*1024*1024 # split files bigger than 5MB into a multipart upload\r\n\r\n @multipart = @expected > @chunklimit\r\n\r\n clear_buffer\r\n @upload = Upload.find id\r\n @uploader = @multipart ? MultipartUpload.new(@upload) : SmallUpload.new(@upload)\r\n end", "def build_file\n IoDecorator.new(file_stream, original_filename, file_content_type.to_s, use)\n end", "def upload(file, someone)\n end", "def uploaded_file(filename, content_type = \"image/png\")\n t = Tempfile.new(filename)\n t.binmode\n path = File.join(RAILS_ROOT, \"spec\", \"images\", filename)\n FileUtils.copy_file(path, t.path)\n (class << t; self; end).class_eval do\n alias local_path path\n define_method(:original_filename) {filename}\n define_method(:content_type) {content_type}\n end\n return t\n end", "def multipart_file(file)\n filename = File.basename(file)\n mime_type = MimeMagic.by_path(filename).type\n return UploadIO.new(file, mime_type, filename)\n end", "def uploader() @uploader ||= Flickr::Uploader.new(self) end", "def test_file1\n File.new(\"#{TEST_DIR}/fixtures/uploads/test_file1.txt\")\n end", "def create(work)\n super\n file_upload_initial\n update_work(aasm.current_state)\n @uploaded_file = service.upload_file_content\n @handled_uploaded_files = handle_uploaded_file(@uploaded_file)\n @handled_uploaded_files ? file_upload_succeeded : file_upload_failed\n rescue StandardError => e\n file_upload_failed\n log(\"failed during file upload: #{e.message} : #{e.backtrace}\")\n end", "def create_upload_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UploadsApi.create_upload ...\"\n end\n if @api_client.config.client_side_validation && opts[:'data_type'] && !['fit', 'fit.gz', 'tcx', 'tcx.gz', 'gpx', 'gpx.gz'].include?(opts[:'data_type'])\n fail ArgumentError, 'invalid value for \"data_type\", must be one of fit, fit.gz, tcx, tcx.gz, gpx, gpx.gz'\n end\n # resource path\n local_var_path = \"/uploads\"\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(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n form_params[\"file\"] = opts[:'file'] if !opts[:'file'].nil?\n form_params[\"name\"] = opts[:'name'] if !opts[:'name'].nil?\n form_params[\"description\"] = opts[:'description'] if !opts[:'description'].nil?\n form_params[\"trainer\"] = opts[:'trainer'] if !opts[:'trainer'].nil?\n form_params[\"commute\"] = opts[:'commute'] if !opts[:'commute'].nil?\n form_params[\"data_type\"] = opts[:'data_type'] if !opts[:'data_type'].nil?\n form_params[\"external_id\"] = opts[:'external_id'] if !opts[:'external_id'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['strava_oauth']\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 => 'Upload')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UploadsApi#create_upload\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def upload_file(f, body, options={})\n file = init_fog_file(f, body, options)\n if self.config.enabled?\n return directory(options).files.create( file )\n else\n return local_file(f, body, options)\n end\n end", "def make_upload_call(endpoint, file)\n raise PutioError::FileNotExist unless File.exists?(file)\n\n # Let's compile the API URL we're calling.\n url = PUTIO_BASE_URL + endpoint\n url += url.include?(\"?\") ? \"&\" : \"?\"\n url += \"oauth_token=%s\" % [@access_token]\n\n # And call it.\n response = Curl::Easy.new(url)\n response.multipart_form_post = true\n response.headers['Accept'] = 'application/json'\n response.http_post(Curl::PostField.file('file', file))\n\n # Natively parse the JSON\n response = JSON::parse(response.body_str)\n \n # And use Hashie to present it.\n response = Hashie::Mash.new(response)\n end", "def do_upload(&blk)\n uploader = FileUploader.new\n blk.call(uploader)\n uploader.close\n end", "def initialize(params = {})\n file = params.delete(:file)\n super\n if file\n self.filename = sanitize_filename(file.original_filename)\n self.content_type = file.content_type\n self.file_contents = file.read\n self.file_size = file.size\n end\n end", "def create_multipart_upload\n self.s3_object||= Upload.get_s3_object(self.object_key)\n self.multipart_upload = s3_object.multipart_upload(\n content_type: params[:type],\n server_side_encryption: S3BrowserMultipart::Engine.\n config.s3_config[:server_side_encryption]\n )\n self.upload_id = self.multipart_upload.upload_id\n Rails.logger.warn \"Created multipart_upload_id: #{self.upload_id} object_key: #{self.object_key}\"\n end", "def initialize(filename, options = {})\n type_options = options.extract!(:type)\n options.merge!(:authenticate? => true)\n \n @type = type_options[:type] || :create\n \n @parameters = ParameterList.new(options)\n @parameters << FileParameter.new('photo', filename)\n end", "def create\n # get attribute values from param, manually\n filename = params[:upload][:uploaded_file].original_filename\n filetype = params[:upload][:uploaded_file].content_type\n file = params[:upload][:uploaded_file].tempfile\n \n @upload = Upload.new(:filename => filename, :filetype => filetype)\n\n data = {'filename' => @upload.filename}\n\n # save file (+Benchmark)\n @loading_time = Benchmark.realtime do\n @upload.write_uploaded_file(file, data)\n end\n\n @loading_time.set_file_loading_time\n\n print \"Loading Time: #{@loading_time}\"\n\n respond_to do |format|\n if @upload.save\n format.html { redirect_to @upload, notice: 'Upload was successfully created.' }\n format.json { render json: @upload, status: :created, location: @upload }\n else\n format.html { render action: \"new\" }\n format.json { render json: @upload.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_input_set()\n return UploadFileInputSet.new()\n end", "def create\n puts \"#{params[:attachment]}\"\n raise \"#{params[:attachment]}\"\n @temp_upload = Prototype.new(params[:attachment])\n\n @upload = Prototype.where(:upload_file_name => @temp_upload.upload_file_name).first\n\n if @upload.nil?\n @upload = Prototype.create(params[:attachment])\n else\n if @upload.upload_file_size.nil?\n @upload.upload_file_size = @temp_upload.upload_file_size\n else\n @upload.upload_file_size += @temp_upload.upload_file_size\n end\n end\n\n p = params[:attachment]\n name = p[:attachment].original_filename\n directory = \"uploads\"\n\n path = File.join(directory, name.gsub(\" \",\"_\"))\n puts(path)\n File.open(path, \"ab\") { |f| f.write(p[:attachment].read) }\n\n respond_to do |format|\n if @upload.save\n format.html {\n render :json => [@upload.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json { render json: {files: [@upload.to_jq_upload]}, status: :created, location: @upload }\n else\n format.html { render action: \"new\" }\n format.json { render json: @upload.errors, status: :unprocessable_entity }\n end\n end\n end", "def file\n @file ||= Operations::FileFactory.new(self)\n end", "def create\n if params['file'] == nil\n return redirect_to :action => :new\n end\n\n temp_file_path = params['file'].tempfile.path\n inferred_type = infer_type(temp_file_path)\n random_name = SecureRandom.uuid\n\n upload_file(random_name, temp_file_path)\n\n @upload = Upload.new(upload_params)\n @upload['uploadDate'] = Time.now\n @upload['file_extension'] = inferred_type\n @upload['s3_name'] = random_name\n @upload['full_text'] = extract_text(temp_file_path, inferred_type)\n\n if @upload.save\n redirect_to :action => :index, notice: 'Upload was successfully created.'\n else\n render :new\n end\n end", "def upload\n end", "def upload\n end", "def new_input_set()\n return UploadFileInputSet.new()\n end", "def create_uploaded_file\n Hyrax::UploadedFile.create(user: @user, file: local_file)\n end", "def perform_multipart_upload\n s3o = S3Object.find_by(uri: @params[:s3_object_uri]) || S3Object.new\n s3o.uri = @params[:s3_object_uri]\n s3o.file = @params[:file]\n s3o.bucket = handle_bucket\n s3o.key = @params[:key]\n s3o.content_type = @params[:file].content_type\n s3o.size = File.size(s3o.file.path)\n s3o.md5 = Digest::MD5.file(s3o.file.path).hexdigest\n s3o.save!\n\n [:created, :xml, XmlAdapter.uploaded_object(\"#{@request.host}:#{@request.port}\", s3o)]\n end", "def assert_uploaded_file(file_name, content_type = nil)\n begin\n # Given\n file = File.new(\"test/resources/#{file_name}\");\n uploaded_file = ActionDispatch::Http::UploadedFile.new(\n :tempfile => file,\n :filename => File.basename(file),\n :type => content_type\n )\n\n # When/then\n yield(uploaded_file)\n ensure\n file.close()\n end\n end", "def build_stream\n\t\t\t\t# Form input field name for the file path must be set to file.\n\t\t\t\t# Any other field name will not be picked up by the upload server.\n\t\t\t\tname = 'file'\n\t\t\t\tcontent_length = File.size(@data_path)\n\t\t\t\tcontent_type = mime_type_for(@data_path)\n\n\t\t\t\t@stream = Tempfile.new(\"BitsOnTheRun.Upload.\")\n\t\t\t\t@stream.binmode\n\t\t\t\t\n\t\t\t\twrite_stream_head(name, content_type, content_length)\n\t\t\t\twrite_stream_body\n\t\t\t\twrite_stream_tail\n\n\t\t\t\t@stream.seek(0)\n\t\t\tend", "def create\n files = params[:files]\n\n files.each do |file|\n\n filename = file.original_filename\n\n # Rack uploads have `#tempfiles` and test uploads are Tempfile objects. More\n # investigation required.\n file = file.tempfile if file.respond_to?(:tempfile)\n\n UploadStore.create(\n :key => filename,\n :body => file,\n :public => true\n )\n end\n\n render json: {status: 'success'}\n end", "def upload(file)\n Item.create(:upload, :file => file)\n end", "def initialize(params = {})\n @file = params.delete(:file)\n super\n if @file\n self.filename = sanitize_filename(@file.original_filename)\n self.content_type = @file.content_type\n self.file_contents = @file.read\n end\n end", "def uploaded_file=(field)\n if field != \"\"\n mt = field.content_type || \"application/binary\"\n self.filename = base_part_of(field.original_filename) \n self.mime_type = mt\n path = get_path\n data = field.read\n self.size = data.length\n if ! File::exist? path\n Dir::mkdir(path)\n else \n # delete old images\n Dir::new(path).each do |oldfile|\n if oldfile[0].chr != '.'\n File::unlink(path+\"/\"+oldfile)\n end\n end\n end\n f = File.new(path + \"/\" + self.filename,\"w\")\n f << data\n f.close\n end\n end", "def get_upload\n file_field = params[\"file\"]\n \n if file_field\n log.debug \"file_field = #{file_field.inspect}\"\n\n begin\n f = file_field[:tempfile]\n log.debug \"upload tempfile = #{f.inspect}\"\n yield f\n ensure\n f.close\n f.unlink\n end\n\n else ## temporarily allow this legacy case for old NE\n log.warn \"missing 'file' param; assuming data is in body\"\n yield request.body.read\n end\n end", "def uploaded_file(path, content_type=nil)\n io = temporary_file(path)\n io.extend(ActionController::UploadedFile)\n io.original_path = File.basename(path)\n io.content_type = content_type || guess_content_type(path)\n io\n end", "def upload(file, options = {})\n dir = options[:directory] || ''\n staging_uri = options[:staging_url].to_s\n url = dir.empty? ? staging_uri : URI.join(staging_uri, \"#{dir}/\").to_s\n\n # Make a directory, if needed\n unless dir.empty?\n method = :get\n GoodData.logger.debug \"#{method}: #{url}\"\n begin\n # first check if it does exits\n raw = {\n :method => method,\n :url => url,\n # :timeout => @options[:timeout],\n :headers => @headers\n }.merge(cookies)\n RestClient::Request.execute(raw)\n rescue RestClient::Exception => e\n if e.http_code == 404\n method = :mkcol\n GoodData.logger.debug \"#{method}: #{url}\"\n raw = {\n :method => method,\n :url => url,\n # :timeout => @options[:timeout],\n :headers => @headers\n }.merge(cookies)\n RestClient::Request.execute(raw)\n end\n end\n end\n\n payload = options[:stream] ? 'file' : File.read(file)\n filename = options[:filename] || options[:stream] ? 'randome-filename.txt' : File.basename(file)\n\n # Upload the file\n # puts \"uploading the file #{URI.join(url, filename).to_s}\"\n raw = {\n :method => :put,\n :url => URI.join(url, filename).to_s,\n # :timeout => @options[:timeout],\n :headers => {\n :user_agent => GoodData.gem_version_string\n },\n :payload => payload,\n :raw_response => true,\n # :user => @username,\n # :password => @password\n }.merge(cookies)\n RestClient::Request.execute(raw)\n true\n end", "def upload\r\n \r\n end", "def initialize(*args)\n @options = {\n :access_level => 'public-read',\n :file_mapping => nil,\n :object => nil\n }\n @options.update(args.extract_options!)\n @options.stringify_keys!\n\n @raw_file = args.first\n @config = configuration\n @connection = Uv::Storage::Connection.new(self.config)\n @object = @options['object']\n\n debug \"Initializing new Uv::Storage::File\"\n debug \"Args First is a: #{args.first.class.to_s}\"\n debug \"Config loaded: #{config.present?}\"\n debug \"Connection loaded: #{connection.present?}\"\n debug \"Object given: #{object.present?}\"\n debug \"Raw File given: #{@raw_file.present?}\"\n debug \"Options given: #{options.present?}\"\n debug \"Identifier given: #{options['identifier'].present?}\"\n\n validate_object(@object) if @object.present?\n end", "def initialize(attr = nil, &block)\n __debug_items(binding)\n attr = attr.fields if attr.is_a?(Upload)\n attr = attr.merge(initializing: true).except!(:reset) if attr.is_a?(Hash)\n super(attr, &block)\n __debug_items(leader: 'new UPLOAD') { self }\n end", "def upload_entry\n e = Entry.new\n e.image = uploaded_file(\"skanthak.png\", \"image/png\")\n return e\n end", "def upload_entry\n e = Entry.new\n e.image = uploaded_file(\"skanthak.png\", \"image/png\")\n return e\n end", "def file\n @file ||= (file_from_path || file_from_uploaded_file!)\n end", "def map_type_import_body(uploaded_file)\n { 'fileUpload' => UploadIO.new(uploaded_file, uploaded_file.content_type, uploaded_file.original_filename) }\n end", "def uploaded_file(path, content_type=\"application/octet-stream\", filename=nil)\n filename ||= File.basename(path)\n t = Tempfile.new(filename)\n FileUtils.copy_file(path, t.path)\n (class << t; self; end;).class_eval do\n alias local_path path\n define_method(:original_filename) { filename }\n define_method(:content_type) { content_type }\n end\n return t\n end", "def uploaded_file(path, content_type=\"application/octet-stream\", filename=nil)\n filename ||= File.basename(path)\n t = Tempfile.new(filename)\n FileUtils.copy_file(path, t.path)\n (class << t; self; end;).class_eval do\n alias local_path path\n define_method(:original_filename) { filename }\n define_method(:content_type) { content_type }\n end\n return t\n end", "def with_input_file(key, tmp_dir: nil)\n raise \"subclass responsibility\"\n end", "def create_file(uid, info = {})\n tus_info = Tus::Info.new(info)\n\n options = upload_options.dup\n options[:content_type] = tus_info.metadata[\"content_type\"]\n\n if filename = tus_info.metadata[\"filename\"]\n # Aws-sdk-s3 doesn't sign non-ASCII characters correctly, and browsers\n # will automatically URI-decode filenames.\n filename = CGI.escape(filename).gsub(\"+\", \" \")\n\n options[:content_disposition] ||= \"inline\"\n options[:content_disposition] += \"; filename=\\\"#{filename}\\\"\"\n end\n\n multipart_upload = object(uid).initiate_multipart_upload(options)\n\n info[\"multipart_id\"] = multipart_upload.id\n info[\"multipart_parts\"] = []\n\n multipart_upload\n end", "def upload_to_provider( file_info = {} )\n\t\traise NotImplementedError.new\n\tend", "def initialize(params = {})\n @file = params.delete(:filecontents)\n super\n if @file\n self.filename = sanitize_filename(@file.original_filename)\n self.filetype = @file.content_type\n self.filecontents = @file.read\n end\n end", "def basic_file_object(path)\n bf = BasicFile.new\n file = File.open(path)\n raise 'file cannot be nil!' if file.nil?\n bf.add_file(file, true)\n bf.save\n bf\n end", "def new\n unauthorized() and return if !user_is_admin?(current_user)\n @upload = Upload.new()\n end", "def initialize(file_name)\n create(file_name)\n end", "def rest_post_upload(uri,filepath)\n response = RestClient::Request.execute(method: :post, \n url: uri,\n user: @rest_user, \n password: @rest_passwd,\n payload: {:multipart => true, :file => File.new(filepath)}, \n headers: {content_type: @rest_cont_type, accept: @rest_accept_type}\n )\n @resp_headers=response.headers\n @resp_code=response.code\n @resp_body=response.body \n return response\n end", "def file_field(object_name, method, options = T.unsafe(nil)); end", "def upload\n create_document\n \n render_upload\n end", "def initialize\n @contents = StringIO.new('', 'r+b')\n @filemgr = Server.file_manager\n end", "def file\n\t\tbrand(Rex::Post::Meterpreter::Extensions::Stdapi::Fs::File)\n\tend", "def uploaded_file(object, &block)\n if (hash = object).is_a?(Hash) && !hash.key?(\"storage\")\n hash.inject({}) do |result, (name, data)|\n result.update(name.to_sym => uploaded_file(data, &block))\n end\n else\n super\n end\n end", "def initialize(filename_or_io, content_type, filename = nil, opts = {})\n io = filename_or_io\n local_path = \"\"\n if io.respond_to? :read\n # in Ruby 1.9.2, StringIOs no longer respond to path\n # (since they respond to :length, so we don't need their local path, see parts.rb:41)\n local_path = filename_or_io.respond_to?(:path) ? filename_or_io.path : \"local.path\"\n else\n io = File.open(filename_or_io)\n local_path = filename_or_io\n end\n filename ||= local_path\n\n @content_type = content_type\n @original_filename = File.basename(filename)\n @local_path = local_path\n @io = io\n @opts = opts\n end", "def uploader\n @uploader ||= shrine_class.new(storage_key)\n end", "def uploaded_file(path, content_type=\"application/octet-stream\", filename=nil)\n filename ||= File.basename(path)\n t = Tempfile.new(filename)\n FileUtils.copy_file(path, t.path)\n (class << t; self; end;).class_eval do\n alias local_path path\n define_method(:original_filename) { filename }\n define_method(:content_type) { content_type }\n end\n t\n end", "def mock_file\n file = 'a_file.png'\n file.stubs(:size).returns(32)\n file.stubs(:original_filename).returns('a_file.png')\n file.stubs(:content_type).returns('image/png')\n file.stubs(:read).returns(false)\n file\nend", "def initialize(access_key, secret_key, settings = {})\n @logger = settings[:logger] || Logger.new(STDOUT)\n @s3 = RightAws::S3Interface.new(access_key, secret_key, logger: @logger)\n @size_for_multipart = (settings[:size_for_multipart] || 100) * 1024 * 1024 # megabytes\n @part_size = (settings[:part_size] || 50) * 1024 * 1024 # megabytes\n end", "def file_field(method, options = T.unsafe(nil)); end", "def convert_files_for_upload(value)\n if value.kind_of?(ActionDispatch::Http::UploadedFile)\n upload_io = UploadIO.new(value.tempfile.path, value.content_type, value.original_filename)\n return upload_io\n else\n false\n end\n end", "def initialize(path, file, storage_name = nil)\n self.path = path\n self.file = file\n self.storage_name = storage_name\n end", "def initialize(filename, type, tempfile, options)\n @filename = File.basename(filename)\n @type = type\n @tempfile = tempfile\n @realfile = nil\n\n trait :options => options\n end", "def new(options)\n if options.has_key? :directory\n dir = self[options.delete(:directory)]\n FileUtils.mkdir_p dir.path\n else\n file = self[options.delete(:file)]\n if (binary_content = options.delete(:with_binary_content) || options.delete(:with_binary_contents))\n file.binary_content = binary_content\n else\n file.content = (options.delete(:with_content) || options.delete(:with_contents) || '')\n end\n end\n\n raise \"unexpected keys '#{options.keys.join(', ')}'\" unless options.empty?\n\n dir || file\n end", "def multipart; end", "def call\n @upload.image_file_name = direct_upload_url_data[:filename]\n @upload.image_file_size = direct_upload_attributes.content_length\n @upload.image_content_type = direct_upload_attributes.content_type\n @upload.image_updated_at = direct_upload_attributes.last_modified\n end", "def upload_file(file_upload, owner)\n image = MiniMagick::Image.open(file_upload.tempfile.path)\n image.resize \"500x500>\"\n image.format \"jpeg\"\n\n tempfile = Tempfile.new \"item_picture\"\n image.write(tempfile)\n\n owner = \"#{current_user.id}/#{owner}\"\n\n upload = Upload.find_by(owner: owner) || Upload.new(owner: owner)\n\n upload.mime_type = \"image/jpeg\"\n upload.extension = \".jpeg\"\n upload.body = tempfile.read\n\n if upload.save\n StoreUploadToCloudJob.perform_later upload\n\n upload\n end\n end", "def client_side_multipart_upload\n end", "def get_file\n file = require_param!(\"file\")\n error! 400, \"The \\\"file\\\" query parameter is not a file.\" if !(file.is_a?(Hash) && file.key?(:tempfile))\n check_filesize!(file[:tempfile]) if max_size\n\n RackFile::UploadedFile.new(file)\n end", "def initialize(file)\n ext = File.extname(file.original_filename).downcase\n @path = \"#{Rails.public_path}/temp_files/#{Time.now.to_f}#{ext}\"\n File.open(@path, \"wb\") { |f| f.write(file.read) }\n end", "def set_file_upload\n @file_upload = FileUpload.find(params[:id])\n end", "def set_file_upload\n @file_upload = FileUpload.find(params[:id])\n end", "def initialize authenticate, filename\n @authenticate = authenticate\n @filename = filename\n end" ]
[ "0.68456006", "0.6708279", "0.6616751", "0.6452521", "0.6378263", "0.63666016", "0.628917", "0.6283744", "0.62710756", "0.6263768", "0.6251646", "0.6228888", "0.6228575", "0.6222221", "0.6219284", "0.62192285", "0.62175095", "0.6174826", "0.6174584", "0.61704797", "0.61675054", "0.6162531", "0.61524206", "0.61515546", "0.614488", "0.6143607", "0.6093107", "0.6085283", "0.60484254", "0.5966836", "0.5964351", "0.59403217", "0.59034777", "0.5891342", "0.588264", "0.5873973", "0.5861194", "0.5859531", "0.5838677", "0.5834732", "0.58228326", "0.57893115", "0.5787376", "0.5784917", "0.57650334", "0.5759769", "0.5759769", "0.575516", "0.574676", "0.5745562", "0.57421917", "0.5732957", "0.5732781", "0.5724697", "0.57234794", "0.57232213", "0.5709516", "0.5708517", "0.5703504", "0.569116", "0.5683432", "0.56757915", "0.5673945", "0.5673945", "0.56676805", "0.56630576", "0.5661724", "0.5661724", "0.5655976", "0.56507045", "0.5640022", "0.56399536", "0.5634261", "0.56238693", "0.56232584", "0.56217", "0.56197214", "0.5612809", "0.5607489", "0.5594866", "0.5592723", "0.55923754", "0.5590216", "0.5588889", "0.5580645", "0.55763835", "0.55708736", "0.556762", "0.55519724", "0.55449164", "0.5544282", "0.5540772", "0.5539312", "0.5531344", "0.5526016", "0.5521811", "0.55204403", "0.5520327", "0.5520327", "0.55193245" ]
0.77494377
0
Performs a 'get' request for the specified uri.
def get(uri, options = {}) build_response(request.get(uri, build_request_options({:input => options.to_params}))) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(uri, params = {})\n send_request(uri, :get, params)\n end", "def get(uri)\r\n request(Net::HTTP::Get.new(uri)) \r\n end", "def send_get(uri)\n _send_request('GET', uri, nil)\n end", "def get(uri, request_headers)\n request('get', uri, request_headers)\n end", "def get(uri, query = {}, &block) \n request(:get, uri, query, &block)\n end", "def get(uri)\n req = requestor(Net::HTTP::Get.new(build_uri(uri)))\n parse req.body\n end", "def http_get uri\n http_req = Net::HTTP::Get.new uri\n http_resp = http_req_with_digest_auth http_req\n case http_resp\n when Net::HTTPSuccess\n return http_resp\n else\n handle_error http_resp\n end\n end", "def get(uri, request_headers)\n raise NotImplementedError\n end", "def get\n execute_request('GET') do |uri, headers|\n HTTP.http_client.get(\n uri,\n follow_redirect: true,\n header: headers\n )\n end\n end", "def get(uri)\n response = Unirest.get uri\n response.body\n end", "def get(uri, request_headers)\n request('get', uri, request_headers) do |response_status_code, response_headers, response_body|\n yield response_status_code, response_headers, response_body\n end\n end", "def get(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('get')\n end\n end", "def do_get(uri = \"\", query = {})\n url_query = query.size > 0 ? \"?\" + query.map {|k, v| \"#{k}=#{v}\"}.join(\"&\") : \"\"\n @connection.get(uri + url_query)\n rescue Faraday::Error::ConnectionFailed => e\n $lxca_log.error \"XClarityClient::XclarityBase connection\", \"Error trying to send a GET to #{uri + url_query}\"\n Faraday::Response.new\n end", "def get\n\t\t\tself.make_request!({uri: self.to_uri, method: :get})\n\t\tend", "def get(uri)\n raise \"Must be overridden\"\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 get(uri = \"\", options = {})\n options.merge!(auth)\n @client.get(child_uri(uri), options)\n end", "def http_get(request_uri)\n response = http.request(Net::HTTP::Get.new(request_uri))\n yield response.body if response.code == \"200\"\n end", "def get(uri, options = T.unsafe(nil)); end", "def get(uri, options = T.unsafe(nil)); end", "def GET(uri, type, range, credentials, &block)\n get = Net::HTTP::Get.new(uri.path)\n get[\"Accept\"] = type\n get[\"Range\"] = \"bytes=#{range.min}-#{range.max}\" unless range.nil?\n\n response = submit(get, uri, credentials, &block)\n\n case response\n when Net::HTTPOK, Net::HTTPPartialContent\n return response.body\n when Net::HTTPNoContent\n return nil\n when Net::HTTPMovedTemporarily\n new_conn = redirect(response[\"location\"])\n raise ConnectionRedirectError.new(new_conn)\n else\n report_error(\"GET\", uri.path, response, credentials)\n end\n end", "def get(name, &block)\n request(uri(name), &block)\n end", "def send_http_get_request(uri, ssl = false)\n attempts = 1\n u = URI.parse(uri)\n res = nil\n ssl = u.scheme == 'https' ? true : false\n\n begin\n Net::HTTP.start(u.host, u.port, use_ssl: ssl) do |cli|\n req = Net::HTTP::Get.new(normalize_uri(u.request_uri))\n req['Host'] = u.host\n req['Content-Type'] = 'application/x-www-form-urlencoded'\n res = cli.request(req)\n end\n rescue Net::ReadTimeout, IOError, EOFError, Errno::ECONNRESET,\n Errno::ECONNABORTED, Errno::EPIPE, Net::OpenTimeout,\n Errno::ETIMEDOUT => e\n if attempts < 3\n sleep(5)\n attempts += 1\n retry\n else\n raise e\n end\n end\n\n res\n end", "def get(path)\n request 'GET', path\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def build_request(uri)\n Net::HTTP::Get.new(uri)\n end", "def request(uri, env = {}, &block)\n uri = parse_uri(uri, env)\n env = env_for(uri, env)\n process_request(uri, env, &block)\n end", "def get endpoint\n do_request :get, endpoint\n end", "def get(request_uri)\n url = base_uri + request_uri\n logger.debug(\"GET #{url}\")\n\n uri = URI.parse(url)\n\n response = http_request(:get, uri)\n\n parse_body(response)\n end", "def do_get url\n\t\turi = URI.parse(url)\n\t\tNet::HTTP.get_response(uri)\n\tend", "def get(uri, parameters = T.unsafe(nil), referer = T.unsafe(nil), headers = T.unsafe(nil)); end", "def get(url, headers = {})\n request(:get, url, headers)\n end", "def get(url, headers = {})\n request(:get, url, headers)\n end", "def get(options={}, &block)\n response = http.get_uri(options, &block)\n handle_response(response)\n end", "def get\n start { |connection| connection.request http :Get }\n end", "def get(url, args = {})\r\n make_request(:get, url, args)\r\n end", "def get(url, headers={})\n do_request(\"get\", url, nil, headers)\n end", "def get(url, headers = {})\n do_request Net::HTTP::Get, url, headers\n end", "def get(uri, opts = {}, &block)\n initialize_socket(uri, opts)\n HttpStream::get(uri, opts, &block)\n rescue IOError => e\n raise e unless @intentional_termination\n end", "def http_get(uri:, additional_headers: {}, debug: false)\n return nil if uri.blank?\n\n HTTParty.get(uri, options(additional_headers: additional_headers,\n debug: debug))\n rescue URI::InvalidURIError => e\n handle_uri_failure(method: \"BaseService.http_get #{e.message}\",\n uri: uri)\n nil\n rescue HTTParty::Error => e\n handle_http_failure(method: \"BaseService.http_get #{e.message}\",\n http_response: nil)\n nil\n end", "def do_get(uri = \"\", query: {}, headers: {}, n_http: false)\n url_query = query.size > 0 ? \"?\" + query.map {|k, v| \"#{k}=#{v}\"}.join(\"&\") : \"\"\n Timeout.timeout(@timeout) do\n con = n_http ? @connection_net_http : @connection\n con.get do |req|\n req.url(uri + url_query)\n headers.map { |key, value| req.headers[key] = value }\n end\n end\n rescue Faraday::Error::ConnectionFailed, Timeout::Error => e\n msg = \"Error trying to send a GET to #{uri + url_query} \"\\\n \"the reason: #{e.message}\"\n $lxca_log.error(HEADER_MESSAGE + ' do_get', msg)\n Faraday::Response.new\n end", "def get(url='/', vars={})\n send_request url, vars, 'GET'\n end", "def get(url)\n request(:get, url, {}, nil)\n end", "def get_response(uri)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = (uri.scheme == 'https')\n http.start do |http|\n resp, body = http.get([uri.path, uri.query].join('?'))\n end\n end", "def get(path)\n request(:get, path, {})\n end", "def make_request(uri)\n request = Net::HTTP::Get.new uri\n\n request[\"Authorization\"] = \"Basic #{credentials}\"\n request[\"Content-Type\"] = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n\n Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|\n http.request request\n end\n end", "def get(uri, *args)\n response = Faraday.new(request_options(args)) do |faraday|\n faraday.headers['Content-Type'] = 'application/json-patch+json'\n faraday.adapter Faraday.default_adapter\n faraday.response :logger, ::Logger.new(STDOUT), bodies: true if debug_mode?\n end.get(uri)\n\n raise Error, response.body unless response.status == 200\n\n parse_api_response(response.body).merge('headers' => response.headers)\n end", "def http_get(base, uri)\n faraday_with_default_adapter(base) { | connection |\n connection.use FaradayMiddleware::FollowRedirects, limit: 1\n }.get(uri)\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get_page(uri)\n agent.get(URI(uri))\n end", "def request(verb, uri, query={})\n verb == :get ? query_get = query : query_post = query\n uri = connection.build_url(uri, query_get)\n\n response = connection.run_request(verb, uri, query_post, headers) do |request|\n yield request if block_given?\n end\n response = Response.new(response)\n \n case response.status\n when 301, 302, 303, 307\n request(verb, response.headers['location'], query)\n when 200..299, 300..399\n response\n end\n end", "def get(uri, params={})\n\t\turi = URI(uri)\n\t\turi.query = URI.encode_www_form(params)\n\t\tp uri\n\t\tres = Net::HTTP.get_response(uri)\n\t\tif res.is_a?(Net::HTTPSuccess)\n\t\t\tresponse = res.body\n\t\t\tp response\n\t\t\tJSON.parse(response)\n\t\telse \n\t\t\traise TwitterRestClientException.new(res.code), \"#{res.code}: #{res.message}\"\n\t\tend\n\tend", "def get\n subclass(:Response).new connection.get do |req|\n req.url uri\n end\n end", "def get(request_opts = {})\n store_result(http(request_opts).get(resolved_path))\n end", "def make_get_request(uri)\n response = Net::HTTP.get_response(uri)\n response.is_a?(Net::HTTPSuccess) ? response.body : nil\nend", "def get path = \"\", payload = {}\n make_request(path, \"get\", payload)\n end", "def get(uri)\n begin\n @connection.get(uri)\n rescue *CONNECTION_ERRORS => e\n warn \"#{uri}: #{e}\"\n Faraday::Response.new\n end\n end", "def fetch(uri)\n unless uri.is_a?(URI)\n uri = uri.to_s\n\n unless uri.include?(\"rubyurl.com\")\n uri = MainURI.to_s + uri\n end\n\n unless uri.include?(\"http\")\n uri = \"http://\" + uri\n end\n end\n\n uri = URI(uri)\n\n unless uri.host == \"rubyurl.com\"\n raise(ArgumentError, \"Invalid host %p\" % uri.host)\n end\n\n unless uri.path.include?(\"/go/index/\")\n uri.path = \"/go/index\" + uri.path\n end\n\n unless uri.path[%r{^/go/index/[^/.]+$}]\n raise(ArgumentError, \"Invalid path %p\" % uri.path)\n end\n\n Net::HTTP.start(uri.host) do |http|\n response = http.get(uri.path)\n response[\"location\"]\n end\n end", "def get(url, headers={})\n RestClient.get url, headers\n end", "def get path, header={}, body_string_or_hash=\"\"\n env.http 'GET', path, header, body_string_or_hash\n end", "def get(*args)\n prepare_request(:get, args)\n @@client.add(:get, @path, *args)\n end", "def get(path, params = {})\n\t\trequest(path, :get, params)\n\tend", "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 get(url, params={})\n @agent.get(url,params)\n end", "def get(url); end", "def do_get\n Net::HTTP.get(URI.parse(api_url))\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params={})\n request(:get, path, params)\n end", "def process_request(uri)\n request = Net::HTTP::Get.new(uri)\n connection = Net::HTTP.start(uri.hostname, uri.port, use_ssl: https?(uri))\n\n connection\n .request(request)\n .tap(&method(:validate_response!))\n end", "def request(verb, uri, body = \"\", query = nil)\n send(verb, HTTParty.normalize_base_uri(Solve360::Config.config.url) + uri,\n :headers => {\"Content-Type\" => \"application/xml\", \"Accepts\" => \"application/json\"},\n :body => body,\n :query => query,\n :basic_auth => auth_credentials)\n end", "def http( *args )\n p http_get( *args )\n end", "def get_response(uri, req)\n Net::HTTP.start(uri.hostname, uri.port){|http| http.request(req) }\nend", "def get(path, params={})\n request(:get, path, params)\n end", "def get(path, params = {})\n request(:get, path, params)\n end", "def get(path, params = {})\n request(:get, path, params)\n end", "def get(url)\n call(url: url)\n end", "def http_get(uri)\n req = Net::HTTP::Get.new uri\n @additional_headers.keys.each do |k|\n req[k] = @additional_headers[k]\n end\n #STDERR.puts \"Trace: #{caller[0]} req: #{req.inspect}\"\n temp_uri = URI.parse(self.polldaddy)\n body=''\n Net::HTTP.start(temp_uri.hostname, temp_uri.port, proxyhost, proxyport) do |http|\n http.request(req) do |res|\n res.read_body do |segment|\n body << segment # this will retrieve the parts if the response is chunked\n end\n end\n end\n body#.tap{|t| STDERR.puts \"Trace: #{caller[1]}: returning #{t}\"}\n end", "def fetch\n endpoint = URI(uri)\n Net::HTTP.get(endpoint)\n rescue *@errors => e\n pp e\n nil\n end", "def get\n RestClient.get(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def get(options = {}, all = true)\n uri = URI.parse(request_path(options, all))\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n puts \"Request URL (GET) is #{uri.request_uri}\" \n\n response = http.request(Net::HTTP::Get.new(uri.request_uri))\n response.body\n end", "def request(verb, uri, body = \"\", query = nil)\n send(verb, HTTParty.normalize_base_uri(Solve360::Config.config.url) + uri,\n :headers => {\"Content-Type\" => \"application/xml\", \"Accepts\" => \"application/json\"},\n :body => body,\n :query => query,\n :basic_auth => {:username => Solve360::Config.config.username, :password => Solve360::Config.config.token})\n end", "def get(url)\n uri = URI(url)\n Net::HTTP.get(uri)\nend", "def get(path, params = {})\n request(:get, path, params)\n end", "def get(path, params = {})\n request(:get, path, params)\n end", "def get(path, opts = {}, &block)\n request(:get, path, opts, &block)\n end", "def get(path, opts = {}, &block)\n request(:get, path, opts, &block)\n end", "def get_response_from(uri)\n http = Net::HTTP.new(uri.host, uri.port)\n http.read_timeout = http.open_timeout = SimpliTest.config[:settings][\"HTTP_TIMEOUT\"] || 3\n request = Net::HTTP::Get.new(uri.request_uri)\n if uri.scheme == 'https'\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n http.request(request)\n end", "def get(path, payload = nil)\n req = Net::HTTP::Get.new(path)\n action(req, payload)\n end", "def get(path, params = {}, request_options = {})\n request(:get, path, params)\n end", "def get(path, **args); end" ]
[ "0.8387637", "0.837671", "0.8338571", "0.81162375", "0.8056223", "0.7621307", "0.747055", "0.74039745", "0.7383909", "0.73422194", "0.7302457", "0.72681206", "0.7199989", "0.71622753", "0.7090779", "0.7061202", "0.70087266", "0.69957787", "0.69744843", "0.69744843", "0.6933232", "0.6913348", "0.6895373", "0.68906015", "0.6826677", "0.6826677", "0.6822356", "0.68170244", "0.679119", "0.6786657", "0.67847127", "0.6783402", "0.67788", "0.67788", "0.6778312", "0.6773205", "0.6769947", "0.6767462", "0.67624617", "0.6737627", "0.67362946", "0.6728613", "0.67239356", "0.6722097", "0.6693837", "0.665666", "0.6654779", "0.6638241", "0.6629013", "0.6623281", "0.6623281", "0.6621252", "0.6614775", "0.6606704", "0.65917265", "0.65884763", "0.6579222", "0.6578476", "0.6574174", "0.6568397", "0.6556571", "0.65479285", "0.6545016", "0.6539448", "0.6528544", "0.65226275", "0.65212244", "0.6518514", "0.65123", "0.65123", "0.65123", "0.65123", "0.65123", "0.65123", "0.65123", "0.65123", "0.65123", "0.65123", "0.65021247", "0.6498848", "0.6477738", "0.6477367", "0.6472348", "0.64684916", "0.64684916", "0.6454122", "0.6452286", "0.64407414", "0.6439328", "0.64338565", "0.6433146", "0.6429457", "0.6425794", "0.6425794", "0.64197946", "0.64197946", "0.64073735", "0.64042366", "0.6395002", "0.63883024" ]
0.7504226
6
Performs a 'post' request for the specified uri.
def post(uri, options = {}) if options[:multipart] form_input = build_multipart_data(options) build_response(request.post(uri, build_request_options({"CONTENT_TYPE" => "multipart/form-data, boundary=Mack-boundary", "CONTENT_LENGTH" => form_input.size, :input => form_input}))) else build_response(request.post(uri, build_request_options({:input => options.to_params}))) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(uri, params = {})\n send_request(uri, :post, params)\n end", "def post(uri, request_headers, body)\n request('post', uri, request_headers, body)\n end", "def post(uri, query = {}, &block)\n request(:post, uri, query, &block)\n end", "def send_post(uri, data)\n _send_request('POST', uri, data)\n end", "def do_post(uri = '', body = '', multipart = false)\n build_request(:post, uri, body, multipart)\n end", "def http_post(uri, data)\n RestClient.post uri, data\n end", "def post(uri, data)\n uri = URI.parse(uri)\n http = Net::HTTP.new(uri.host, uri.port)\n return http.post(uri.path, data, @headers)\n end", "def post(uri, request_headers, body)\n request('post', uri, request_headers, body) do |response_status_code, response_headers, response_body|\n yield response_status_code, response_headers, response_body\n end\n end", "def post(uri, query = T.unsafe(nil), headers = T.unsafe(nil)); end", "def post(uri, parameters = nil)\n response = Unirest.post uri, parameters: parameters\n response.body\n end", "def post(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('post')\n end\n end", "def post(uri, doc = nil, options = {})\n execute(uri, :post, options, doc)\n end", "def do_post(uri = \"\", body = \"\")\n @connection.post do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n req.body = body\n end\n rescue Faraday::Error::ConnectionFailed => e\n $lxca_log.error \"XClarityClient::XclarityBase do_post\", \"Error trying to send a POST to #{uri}\"\n $lxca_log.error \"XClarityClient::XclarityBase do_post\", \"Request sent: #{body}\"\n Faraday::Response.new\n end", "def post(url, headers, body)\n request(:post, url, headers, body)\n end", "def post(uri, body)\n RestClient.post(uri, body, :content_type => 'text/xml;charset=\"utf-8\"', :accept => 'text/xml') do |_response, _request, result|\n auth_string = result.header['www-authenticate']\n auth_data = Hash[*auth_string.scan(/(?<k>[a-z]+)=\"(?<v>[^\"]*)\"/).flatten]\n\n request_authorization = gen_auth_digest('POST', uri, body, auth_data)\n\n RestClient.post(uri, body, :'Authorization' => request_authorization, :content_type => 'text/xml;charset=\"utf-8\"', :accept => 'text/xml') do |response, _request, _result|\n return response\n end\n end\n end", "def post(uri, request_headers, body)\n raise NotImplementedError\n end", "def post url, body, headers = {}\n http_request(url, Net::HTTP::Post, body, headers)\n end", "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def make_post_request url, body, headers = []\n make_request url, method: ::Rack::POST, body: body, headers: headers\n end", "def post(uri, options = T.unsafe(nil)); end", "def post(url, args = {})\r\n make_request(:post, url, args)\r\n end", "def post(payload)\n post_like payload, Net::HTTP::Post.new(@uri.path)\n end", "def post_request(uri, body, token = nil, manage_errors = true)\n request = Net::HTTP::Post.new(uri.request_uri, initheader = build_headers(token))\n request.body = body.to_json\n return do_request(uri, request, manage_errors) \n end", "def post(*args)\n request :post, *args\n end", "def post(*args)\n request(:post, *args)\n end", "def post(body = nil, headers = {}, path = '')\n uri = URI.parse(\"#{@url}#{path}\")\n request = Net::HTTP::Post.new(uri.request_uri)\n request.body = body\n send_request(uri, request, headers)\n end", "def post(uri)\n query = URI.build_query(\n \"rubyurl[website_url]\" => uri\n )\n data = open([PostURI, query].join(\"?\")) { |res| res.read }\n uri_re = %r{<a href=\"([^\"]+)\">\\1</a>}\n URI(data[uri_re, 1])\n end", "def post(url, body, headers = {})\n do_request Net::HTTP::Post, url, headers, body\n end", "def post_request(uri, body, token)\n http = build_http(uri)\n request = Net::HTTP::Post.new(uri.request_uri, initheader = build_headers(token))\n request.body = body\n return http.request(request)\t\t\n end", "def post_request(uri, params)\n begin\n \n # Request the data and return it\n doc = Nokogiri::HTML(open(uri, params.merge(:allow_redirections => :safe)))\n return doc.text\n #\n # Rescue in the case of a 404 or a redirect\n # \n # TODO - this should really log into the task?\n rescue OpenURI::HTTPError => e \n TapirLogger.instance.log \"Error, couldn't open #{uri} with error #{e}\"\n rescue Timeout::Error => e\n TapirLogger.instance.log \"Timeout! #{e}\"\n rescue OpenSSL::SSL::SSLError => e\n TapirLogger.instance.log \"Unable to connect: #{e}\"\n rescue Net::HTTPBadResponse => e\n TapirLogger.instance.log \"Unable to connect: #{e}\"\n rescue EOFError => e\n TapirLogger.instance.log \"Unable to connect: #{e}\"\n rescue SocketError => e\n TapirLogger.instance.log \"Unable to connect: #{e}\"\n rescue SystemCallError => e\n TapirLogger.instance.log \"Unable to connect: #{e}\"\n rescue ArgumentError => e\n TapirLogger.instance.log \"Argument Error #{e}\"\n rescue Encoding::InvalidByteSequenceError => e\n TapirLogger.instance.log \"Encoding error: #{e}\"\n rescue Encoding::UndefinedConversionError => e\n TapirLogger.instance.log \"Encoding error: #{e}\"\n #rescue RuntimeError => e\n # TapirLogger.instance.log \"Unknown Error: #{e}\"\n end\n # Default to sending nothing \n false\n end", "def post(path, **args); end", "def post(path, params = {})\n\t\trequest(path, :post, params)\n\tend", "def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end", "def post(url, post_vars={})\n send_request url, post_vars, 'POST'\n end", "def post(path, params={})\n request(:post, path, params)\n end", "def post(path, params={})\n request(:post, path, params)\n end", "def post(path, params={})\n request(:post, path, params)\n end", "def post(url, body = {})\n call(url: url, action: :post, body: body)\n end", "def post url, object = nil\n request url, HTTP::Post, object\n end", "def post\n uri = URI.parse(self.url)\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.open_timeout = 10\n http.read_timeout = 10\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n data = self.params.collect { |k, v| \"#{k}=#{CGI.escape(v.to_s)}\" }.join(\"&\")\n Freemium.log_test_msg(\"POST\\n url: #{self.url}\\n query: #{data}\")\n http.post(uri.request_uri, data).body\n end", "def post(path, query_params={}, opts={})\n request(:post, path, query_params, opts)\n end", "def post\n RestClient.post(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def post endpoint, data\n do_request :post, endpoint, data\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post\n resource.post(request, response)\n end", "def post(path, params = {})\n request(:post, path, params)\n end", "def post(url, data, headers = {})\n request(:post, url, headers, :data => data)\n end", "def post(path, params={})\n RestClient.post request_base+path, params\n end", "def post(path, payload)\n req = Net::HTTP::Post.new(path)\n action(req, payload)\n end", "def post payload, path = \"\" \n make_request(path, \"post\", payload)\n end", "def post(path:, params: {})\n request(method: :post, path: path, params: params)\n end", "def post(path, opts = {}, &block)\n request(:post, path, opts, &block)\n end", "def post(path, opts = {}, &block)\n request(:post, path, opts, &block)\n end", "def post(path, body = '', headers = {})\n with_auth { request(:post, path, body.to_s, build_request_headers(headers, :post, build_uri(path))) }\n end", "def post(uri, options={})\n uri = expand(uri)\n klass = options.delete(:class)\n parent = options.delete(:parent)\n body = options.delete(:body) || Yajl::Encoder.encode(options)\n\n before_request(uri, :post, body)\n raise_if_html(\n remotely_connection.post do |req|\n req.url uri\n req.params = Remotely.default_params\n req.body = body\n end\n )\n end", "def post(path, params)\n request(:post, path, params)\n end", "def send!\n request = Net::HTTP::Post.new(uri.path, headers)\n request.body = @body\n request.content_type = @@content_type\n response = Net::HTTP.start(uri.host, uri.port) do |http|\n http.request(request)\n end\n ok?(response)\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 post(path, options={}, raw=false)\n request(:post, path, options, raw)\n end", "def post(path, headers, body, &callback)\n request('POST', path, headers, body, &callback)\n end", "def post(url, payload, headers: {}, options: {})\n request_with_payload(:post, url, payload, headers, options)\n end", "def post(uri, body, opts = {}, &block)\n initialize_socket(uri, opts)\n HttpStream::post(uri, body, opts, &block)\n rescue IOError => e\n raise e unless @intentional_termination\n end", "def post query=nil, content_type='application/x-www-form-urlencoded'\n\t\treq = Net::HTTP::Post.new(@uri.path)\n\n\t\treq.body= make_query query if query\n\t\treq.content_type=content_type if query\n\t\treq.content_length=query ? req.body.length : 0\n\n\t\tdo_http req\n\tend", "def http_post(uri:, additional_headers: {}, data: {}, basic_auth: nil, debug: false)\n return nil if uri.blank?\n\n opts = options(additional_headers: additional_headers, debug: debug)\n opts[:body] = data\n opts[:basic_auth] = basic_auth if basic_auth.present?\n HTTParty.post(uri, opts)\n rescue URI::InvalidURIError => e\n handle_uri_failure(method: \"BaseService.http_post #{e.message}\", uri: uri)\n nil\n rescue HTTParty::Error => e\n handle_http_failure(method: \"BaseService.http_post #{e.message}\", http_response: nil)\n nil\n end", "def post(url, options = {}, &block)\n request HttpPost, url, options, &block\n end", "def post(uri, query = {}, headers = {})\n return request_with_entity(:post, uri, query, headers) if String === query\n\n node = {}\n # Create a fake form\n class << node\n def search(*args); []; end\n end\n node['method'] = 'POST'\n node['enctype'] = 'application/x-www-form-urlencoded'\n\n form = Form.new(node)\n\n Mechanize::Util.each_parameter(query) { |k, v|\n if v.is_a?(IO)\n form.enctype = 'multipart/form-data'\n ul = Form::FileUpload.new({'name' => k.to_s},::File.basename(v.path))\n ul.file_data = v.read\n form.file_uploads << ul\n elsif v.is_a?(Form::FileUpload)\n form.enctype = 'multipart/form-data'\n form.file_uploads << v\n else\n form.fields << Form::Field.new({'name' => k.to_s},v)\n end\n }\n post_form(uri, form, headers)\n end", "def POST(uri, data, type, credentials)\n post = Net::HTTP::Post.new(uri.path)\n post.content_type = type\n\n set_upload_body(post, data)\n\n response = submit(post, uri, credentials)\n\n case response\n when Net::HTTPCreated\n # return the URI of the newly created item\n URI.parse(response['location'])\n when Net::HTTPServiceUnavailable\n raise ServerAtCapacityError.new\n else\n report_error(\"POST\", uri.path, response, credentials)\n end\n end", "def post_request(path, params={}, options={})\n request(:post, path, params, options)\n end", "def post(path, options = {}, raw = false)\n request(:post, path, options, raw)\n end", "def post_http(args)\n\t\t return(Net::HTTP.post_form @uri, args)\t\t\t\n \tend", "def post(path, options = {}, raw = false)\n request(:post, path, options, raw)\n end", "def post(path, &block)\n route 'POST', path, &block\n end", "def post(path, options={})\n request :post, path, options\n end", "def post(url, body, headers)\n conn = create_connection_object(url)\n\n http = conn.post(:body => body,\n :head => add_authorization_to_header(headers, @auth))\n\n action = proc do\n response = Response.new(http.response.parsed, http)#.response.raw)\n yield response if block_given?\n end\n\n http.callback &action\n http.errback &action \n end", "def post(*args)\n Request.post(*args)\n end", "def post(url, req_hash={})\n res = nil\n res = perform_op(:post, req_hash) do\n res = @wrapper.post(url, req_hash)\n end\n return res\n end", "def nessus_http_request(uri, post_data)\n\t\t\turl = URI.parse(@nurl + uri)\n\t\t\trequest = Net::HTTP::Post.new( url.path )\n\t\t\trequest.set_form_data( post_data )\n\t\t\tif not defined? @https\n\t\t\t\t@https = Net::HTTP.new( url.host, url.port )\n\t\t\t\t@https.use_ssl = true\n\t\t\t\t@https.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\t\t\tend\n\t\t\t# puts request\n\t\t\tbegin\n\t\t\t\tresponse = @https.request( request )\n\t\t\trescue\n\t\t\t\tputs(\"error connecting to server: #{@nurl} with URI: #{uri}\")\n\t\t\t\texit\n\t\t\tend\n\t\t\t# puts response.body\n\t\t\treturn response.body\n\t\tend", "def post(params = nil)\n request.method = :post\n execute(params)\n end", "def post(url, post_data, custom_headers = {})\n headers = @default_headers.merge(custom_headers)\n # slow down the request rate! otherwise you will get blocked\n sleep 1\n return @agent.post(url, post_data, headers)\n end", "def post(path, payload={})\n request(:post, path, payload)\n end", "def post url, payload\n RestClient::Request.execute(:method => :post, :url => url, :payload => payload, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end", "def post(path, options={})\n send_request 'post', path, options\n end", "def post(path, params = {})\n resource(path).post(params)\n end", "def post(path, **options)\n execute :post, path, options\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 post(path, body = nil, options = {})\n request = Net::HTTP::Post.new(request_uri(path))\n request.body = body\n make_request(request, options)\n end", "def post(path, parameters = {})\n request(:post, path, parameters)\n end", "def post(path, data={})\n request(:post, path, data)\n end", "def perform_awsdirect_request(uri, body)\n res = nil\n req = get_abs_post_request(uri)\n\n if req\n req.body = body\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.read_timeout = 120\n\n puts \"sending request body:\"\n puts body\n puts \"to uri: #{uri}\"\n puts\n\n res = http.request(req)\n puts \"response code: #{res.code}\" unless res.nil?\n puts \"response body: #{res.body}\" unless res.nil?\n puts\n else\n puts \"Unable to complete the specified ABS request\"\n end\n\n res\n end", "def make_post_request(route:, headers: nil, body: nil)\n post route, params: body, headers: headers\nend", "def post(path, headers = {})\n process :post, path, headers\n end", "def post(path, data=nil)\n request(:post, path, data)\n end", "def post(path, options = {})\n request(:post, path, options)\n end", "def post(path, options = {})\n request(:post, path, options)\n end", "def post(path, options = {})\n request(:post, path, options)\n end", "def post(path, options = {})\n request(:post, path, options)\n end", "def post(path, options = {})\n request(:post, path, options)\n end" ]
[ "0.8651799", "0.8294707", "0.8137126", "0.7920389", "0.7801342", "0.7714366", "0.76958954", "0.74513364", "0.73730826", "0.7363282", "0.7362048", "0.73539317", "0.7251813", "0.7232679", "0.7229354", "0.72117776", "0.7152942", "0.7096238", "0.7056676", "0.7022974", "0.6937728", "0.69086957", "0.6868373", "0.6852386", "0.68310314", "0.68268305", "0.6815566", "0.68020874", "0.68011487", "0.67984897", "0.6787379", "0.6773246", "0.67384446", "0.6708686", "0.6700702", "0.6700702", "0.6700702", "0.66746217", "0.6653109", "0.6633703", "0.6622508", "0.66175306", "0.6612737", "0.6598719", "0.6598719", "0.6598719", "0.6598719", "0.6598719", "0.65946436", "0.6594497", "0.658609", "0.6557545", "0.65443057", "0.6544098", "0.65424085", "0.6542264", "0.6542264", "0.65397716", "0.65385497", "0.6537201", "0.6535955", "0.6533467", "0.65318185", "0.65292686", "0.65283203", "0.65261453", "0.6502615", "0.64947844", "0.6487515", "0.64823896", "0.6481591", "0.6478936", "0.6461992", "0.64603484", "0.6460067", "0.64558035", "0.6437485", "0.6416743", "0.64060897", "0.6397326", "0.6390731", "0.6371076", "0.63650775", "0.63620234", "0.63428617", "0.6338236", "0.63351864", "0.6329459", "0.6325527", "0.63204026", "0.63051957", "0.6302564", "0.6299695", "0.62834656", "0.6283014", "0.62775743", "0.6264646", "0.6264646", "0.6264646", "0.6258858", "0.6258858" ]
0.0
-1
Performs a 'put' request for the specified uri.
def put(uri, options = {}) if options[:multipart] form_input = build_multipart_data(options) build_response(request.put(uri, build_request_options({"CONTENT_TYPE" => "multipart/form-data, boundary=Mack-boundary", "CONTENT_LENGTH" => form_input.size, :input => form_input}))) else build_response(request.put(uri, build_request_options({:input => options.to_params}))) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(uri, params = {})\n send_request(uri, :put, params)\n end", "def put(uri, request_headers, body)\n request('put', uri, request_headers, body)\n end", "def do_put(uri = '', body = '')\n build_request(:put, uri, body)\n end", "def put(uri, request_headers, body)\n request('put', uri, request_headers, body) do |response_status_code, response_headers, response_body|\n yield response_status_code, response_headers, response_body\n end\n end", "def update(uri, payload)\n url = \"#{@config[:base_url]}#{@config[:rest_path]}/#{extract_pid(uri)}\"\n request = Request.new(\n \"Put\", url, payload.to_s, {\n \"Accept\" => \"application/json\",\n \"Content-Type\" => \"application/json\",\n \"Content-Length\" => \"nnnn\",\n @auth_header => @token\n }\n )\n response = request.perform\n response\n end", "def put(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('put')\n end\n end", "def put(uri, parameters)\n response = Unirest.put uri, parameters: parameters\n response.body\n end", "def put(uri, request_headers, body)\n raise NotImplementedError\n end", "def put(uri, doc = nil, options = {})\n execute(uri, :put, options, doc)\n end", "def put(request_uri, data = nil)\n url = base_uri + request_uri\n logger.debug(\"PUT #{url}\")\n\n uri = URI.parse(url)\n\n response = http_request(:put, uri, data)\n\n parse_body(response)\n end", "def do_put(uri = \"\", body = \"\")\n @connection.put do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n req.body = body\n end\n rescue Faraday::Error::ConnectionFailed => e\n $lxca_log.error \"XClarityClient::XclarityBase do_put\", \"Error trying to send a PUT to #{uri}\"\n $lxca_log.error \"XClarityClient::XclarityBase do_put\", \"Request sent: #{body}\"\n Faraday::Response.new\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def put url, body, headers = {}\n http_request(url, Net::HTTP::Put, body, headers)\n end", "def put(url, body = {})\n call(url: url, action: :put, body: body)\n end", "def put(*args)\n request :put, *args\n end", "def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end", "def put(*args)\n request(:put, *args)\n end", "def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend", "def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend", "def put\n RestClient.put(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def put(uri, options = T.unsafe(nil)); end", "def http_put(uri:, additional_headers: {}, data: {}, basic_auth: nil, debug: false)\n return nil if uri.blank?\n\n opts = options(additional_headers: additional_headers, debug: debug)\n opts[:body] = data\n opts[:basic_auth] = basic_auth if basic_auth.present?\n HTTParty.put(uri, opts)\n rescue URI::InvalidURIError => e\n handle_uri_failure(method: \"BaseService.http_put #{e.message}\", uri: uri)\n nil\n rescue HTTParty::Error => e\n handle_http_failure(method: \"BaseService.http_put #{e.message}\", http_response: nil)\n nil\n end", "def put_request(uri, body, token)\n http = build_http(uri)\n request = Net::HTTP::Put.new(uri.request_uri, initheader = build_headers(token))\n request.body = body\n return http.request(request)\t\t\n end", "def put(url, payload, headers={})\n RestClient.put url, payload, headers\n end", "def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :put, nil, body.to_json)\n end", "def put(body = nil, headers = {}, path = '')\n uri = URI.parse(\"#{@url}#{path}\")\n request = Net::HTTP::Put.new(uri.request_uri)\n request.body = body\n send_request(uri, request, headers)\n end", "def put url, object = nil\n request url, HTTP::Put, object\n end", "def put_request(uri, body, token = nil, manage_errors = true)\n request = Net::HTTP::Put.new(uri.request_uri, initheader = build_headers(token))\n request.body = body.to_json\n return do_request(uri, request, manage_errors) \n end", "def put(path, body = '', headers = {})\n with_auth { request(:put, path, body.to_s, build_request_headers(headers, :put, build_uri(path))) }\n end", "def put(url, vars={})\n send_request url, vars, 'PUT'\n end", "def put(url, payload, headers: {}, options: {})\n request_with_payload(:put, url, payload, headers, options)\n end", "def put(path, params={})\n RestClient.put request_base+path, params\n end", "def put payload, path = \"\"\n make_request(path, \"put\", payload)\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 put(path, params={})\n request(:put, path, params)\n end", "def put(path, options={}, raw=false)\n request(:put, path, options, raw)\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(url, payload = {}, headers = {})\n http :put, \"#{url}.json\", payload.to_json, headers\n end", "def put(path, payload)\n req = Net::HTTP::Put.new(path)\n action(req, payload)\n end", "def put_request(path, params={}, options={})\n request(:put, path, params, options)\n end", "def put(path, options={})\n request :put, path, options\n end", "def put!\n request! :put\n end", "def put(path, opts = {}, &block)\n request(:put, path, opts, &block)\n end", "def put(path, opts = {}, &block)\n request(:put, path, opts, &block)\n end", "def put(object, url, headers={})\n do_request(\"put\", url, object, headers)\n end", "def put(path, &block)\n route 'PUT', path, &block\n end", "def put(path, options = {}, raw = false)\n request(:put, path, options, raw)\n end", "def put(src, uri)\n raise NotImplementedError\n end", "def PUT(uri, data, type, credentials)\n put = Net::HTTP::Put.new(uri.path)\n put.content_type = type\n\n set_upload_body(put, data)\n\n response = submit(put, uri, credentials)\n\n case response\n when Net::HTTPOK, Net::HTTPAccepted\n # We've either set a parameter or started a run so we get 200 or 202\n # back from the server, respectively. Return true to indicate success.\n true\n when Net::HTTPCreated\n # We've uploaded data so we get 201 back from the server. Return the\n # uri of the created resource.\n URI.parse(response['location'])\n when Net::HTTPNoContent\n # We've modified data so we get 204 back from the server. Return the\n # uri of the modified resource.\n uri\n when Net::HTTPServiceUnavailable\n raise ServerAtCapacityError.new\n else\n report_error(\"PUT\", uri.path, response, credentials)\n end\n end", "def put url, payload\n RestClient::Request.execute(:method => :put, :url => url, :payload => payload, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end", "def put(resource_path, body:, headers: {}, prefix: API_PREFIX)\n request(method: :put, resource_path: resource_path, headers: headers, body: body, prefix: prefix)\n end", "def on_put(resource_uri, opts)\n #resource = _get_resource(resource_uri, true, opts)\n \n #puts \"ON_PUT_OPTS: #{opts.inspect}\"\n body, format = parse_body(opts)\n case format\n # when :empty\n # # do nothing\n when :xml\n modifier_el = body.root\n resource = put_resource_xml(modifier_el, resource_uri, opts)\n else\n raise UnsupportedBodyFormatException.new(format)\n end\n show_resource(resource, opts)\n end", "def put(url, data, headers = {})\n request(:put, url, headers, :data => data)\n end", "def put(url, data, headers = {})\n request(:put, url, headers, :data => data)\n end", "def put(path, opts = {})\n request(:put, path, opts).body\n end", "def put(uri, body, opts = {}, &block)\n initialize_socket(uri, opts)\n HttpStream::put(uri, body, opts, &block)\n rescue IOError => e\n raise e unless @intentional_termination\n end", "def put(path, params)\n request(:put, path, params)\n end", "def put(resource, body = \"\", headers = {})\n prepare_request(:put, resource, body, headers)\n end", "def http_put(url, params, &request_modifier)\n uri = URI.parse url\n req = Net::HTTP::Put.new uri.path\n req.set_form_data(params)\n request_modifier && (request_modifier.call req)\n\n session = (Net::HTTP.new uri.host, uri.port)\n case res = session.start { |http| http.request req }\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n else\n res.error!\n end\n end", "def update\n\n respond_to do |format|\n if @uri.update(uri_params)\n format.json { render json: @uri, status: 200 }\n else\n format.json { render json: @uri.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(path, headers = {})\n process :put, path, headers\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def on_put(resource_uri, opts)\n debug \"on_put: #{resource_uri}\"\n resource = update_resource(resource_uri, true, opts)\n show_resource(resource, opts)\n end", "def put(url, options = {}, &block)\n run! Request.new(url, :put, options.slice(:headers, :params, :payload), &block)\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: nil, payload:, headers: {}, query: {}, auth_method: nil)\n execute(\n method: :put,\n path: path,\n headers: headers,\n query: query,\n payload: payload,\n auth_method: auth_method\n )\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 endpoint, data\n do_request :put, endpoint, data\n end", "def perform_put(path, options = {})\n perform_request(:put, path, options)\n end", "def put(path, options={})\n send_request 'put', path, options\n end", "def put(endpoint)\n respond_with(\n connection(endpoint).put(prepare(endpoint.uri), custom_dump(endpoint.req_params)),\n endpoint\n )\n end", "def put(path, options={}, format=format)\n request(:put, path, options, format)\n end", "def put(splat)\n bad_request if splat.empty?\n _put resolve_uri(splat[0]), request.body.read\n end", "def put(url, payload, headers={})\n payload = MultiJson.encode(payload)\n headers = headers.merge({:content_type => 'application/json'})\n request(:put, url, payload, headers)\n end", "def put(path, parameters = {})\n request(:put, path, parameters)\n end", "def put(path, params={}, options={})\n request(:put, api_path(path), params, options)\n end", "def put(request_opts = {})\n store_result(http(request_opts).put(resolved_path, @attrs, @etag))\n end", "def put(path, options = {})\n request(:put, parse_query_and_convenience_headers(path, options))\n end", "def put(payload = {})\n request! do\n api[url.path].put(to_payload(payload), API_HEADERS)\n end\n end", "def put(url, options = {}, &block)\n request HttpPut, url, options, &block\n end", "def put(path, options = {}, signature = false, raw = false, unformatted = false, no_response_wrapper = self.no_response_wrapper, signed = sign_requests)\n request(:put, path, options, signature, raw, unformatted, no_response_wrapper, signed)\n end", "def put(path, data=nil)\n request(:put, path, data)\n end", "def put(path, data={})\n request(:put, path, data)\n end", "def put(path, body: {}, headers: nil)\n response = conn.put do |req|\n build_request(req, path: path, body: body, headers: headers)\n end\n puts response.body\n response.body unless response.blank?\n end", "def 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(url, payload, options={}, &block)\n http_options = options.merge(@basic_options)\n if block_given?\n RestClient.put(url, payload, http_options, &block)\n else\n RestClient.put(url, payload, http_options)\n end\n\n end", "def put(path, params)\n parse_response @client[path].put(params)\n end" ]
[ "0.8823323", "0.8358175", "0.829952", "0.7703336", "0.768153", "0.7620739", "0.7602549", "0.7583991", "0.7518064", "0.7510288", "0.74999356", "0.7343167", "0.72835237", "0.7190687", "0.7126894", "0.7060001", "0.7051917", "0.7048128", "0.70473593", "0.7000429", "0.6991651", "0.6986683", "0.69866556", "0.6968767", "0.6955271", "0.6954339", "0.6951538", "0.6950706", "0.6947969", "0.6937827", "0.6931617", "0.6906117", "0.690237", "0.6869983", "0.6869983", "0.6869983", "0.6869983", "0.6869983", "0.6869983", "0.6869983", "0.6869983", "0.68677706", "0.6861086", "0.68555766", "0.68555766", "0.68555766", "0.683779", "0.683779", "0.6837043", "0.68300474", "0.6824851", "0.68215895", "0.6820286", "0.68120337", "0.68120337", "0.68041915", "0.67985773", "0.67851603", "0.6778061", "0.67756015", "0.67669773", "0.6757744", "0.6750814", "0.6743718", "0.6743718", "0.67264396", "0.67131674", "0.6680925", "0.66514784", "0.6650341", "0.66496855", "0.664743", "0.6645653", "0.6643413", "0.6643055", "0.6642029", "0.6642029", "0.6641831", "0.66343176", "0.66343176", "0.6626315", "0.6601426", "0.6600767", "0.6598424", "0.65968543", "0.6591762", "0.6590869", "0.65832067", "0.65638655", "0.65578866", "0.6552746", "0.6544849", "0.6524905", "0.6521781", "0.65105087", "0.64951986", "0.64797604", "0.6466095", "0.6455159", "0.64381856" ]
0.6615497
81
Performs a 'delete' request for the specified uri.
def delete(uri, options = {}) build_response(request.delete(uri, build_request_options({:input => options.to_params}))) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(uri, params = {})\n send_request(uri, :delete, params)\n end", "def do_delete(uri = '')\n build_request(:delete, uri)\n end", "def delete(uri = nil)\n requestor(Net::HTTP::Delete.new(build_uri(uri)))\n end", "def delete(uri)\r\n request(Net::HTTP::Delete.new(uri)) \r\n end", "def delete(uri, request_headers)\n request('delete', uri, request_headers)\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 delete(uri, options = {})\n execute(uri, :delete, options)\n end", "def delete_request(uri)\n http = build_http(uri)\n request = Net::HTTP::Delete.new(uri.request_uri, initheader = build_headers())\n return http.request(request)\n end", "def delete(uri, request_headers)\n request('delete', uri, request_headers) do |response_status_code, response_headers, response_body|\n yield response_status_code, response_headers, response_body\n end\n end", "def delete(uri, parameters)\n response = Unirest.delete uri, parameters: parameters\n response.body\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def delete(uri, request_headers)\n raise NotImplementedError\n end", "def delete(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('delete')\n end\n end", "def DELETE(uri, credentials)\n delete = Net::HTTP::Delete.new(uri.path)\n\n response = submit(delete, uri, credentials)\n\n case response\n when Net::HTTPNoContent\n # Success, carry on...\n true\n else\n report_error(\"DELETE\", uri.path, response, credentials)\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete(uri)\n store\n\n @store.delete(uri)\n end", "def delete(name)\n request(uri = uri(name), Net::HTTP::Delete.new(uri.request_uri))\n end", "def delete_request(uri, token = nil, manage_errors = true)\n request = Net::HTTP::Delete.new(uri.request_uri, initheader = build_headers(token))\n return do_request(uri, request, manage_errors)\n end", "def delete\n ensure_client && ensure_uri\n response = @client.rest_delete(@data['uri'], { 'Accept-Language' => 'en_US' }, @api_version)\n @client.response_handler(response)\n true\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 delete(payload)\n post_like payload, Net::HTTP::Delete.new(@uri.path)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete!\n Recliner.delete(uri)\n end", "def delete(url)\n do_request(\"delete\", url)\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def delete\n request(:delete)\n end", "def delete(url, headers = {})\n request(:delete, url, headers)\n end", "def delete(url, headers = {})\n request(:delete, url, headers)\n end", "def delete(*args)\n request(:delete, *args)\n end", "def delete(uri, opts = {}, &block)\n initialize_socket(uri, opts)\n HttpStream::delete(uri, opts, &block)\n rescue IOError => e\n raise e unless @intentional_termination\n end", "def delete(url, headers={})\n RestClient.delete url, headers\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def on_delete(resource_uri, opts)\n debug \"on_delete: #{resource_uri}\"\n delete_resource(resource_uri, opts)\n show_resource(nil, opts) # epistrefei ena sketo \"OK\"\n end", "def delete(path, payload = nil)\n req = Net::HTTP::Delete.new(path)\n action(req, payload)\n end", "def delete(path)\n request 'DELETE', path\n end", "def delete(path)\n\t\trequest(path, :delete)\n\tend", "def delete!\n request! :delete\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete(url, vars={})\n send_request url, vars, 'DELETE'\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def delete(path)\n request(:delete, path)\n end", "def delete(url)\n call(url: url, action: :delete)\n end", "def delete(path)\n uri = build_uri(path)\n\n request = Net::HTTP::Delete.new(uri.request_uri)\n set_authorisation_header(request)\n\n response = https_client(uri).request(request)\n end", "def delete(url, options = {}, &block)\n options = treat_params_as_query(options)\n request HttpDeleteWithEntity, url, options, &block\n end", "def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(splat)\n bad_request if splat.empty?\n _delete resolve_uri(splat[0])\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(params = {})\n Client.current.delete(resource_url, params)\n end", "def delete(path, params = {}, request_options = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(path, params = {})\n request(:delete, path, params)\n end", "def delete(url, options = {}, &block)\n run! Request.new(url, :delete, options.slice(:headers, :params, :payload), &block)\n end", "def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end", "def delete(request)\n do_request(request) { |client| client.http_delete }\n end", "def delete(path)\n request(:delete, path)\n end", "def delete(url)\n raise Error, \"Missing URL\" unless url\n get('posts/delete?uri=' << u(url))\n nil\n end", "def delete(path, opts = {}, &block)\n request(:delete, path, opts, &block)\n end", "def delete(url, headers: {}, options: {})\n request_without_payload(:delete, url, headers, options)\n end", "def delete uri\n @change_semaphore.synchronize do\n filename = uri_to_file(uri)\n library.delete filename\n # Remove diagnostics for deleted files\n send_notification \"textDocument/publishDiagnostics\", {\n uri: uri,\n diagnostics: []\n }\n end\n end", "def delete(path, params = {})\n post(path, params.merge(\"_method\" => \"delete\"))\n end", "def delete_resource(resource_uri, opts)\n body, format = parse_body(opts)\n resource_type, resource_params = parse_uri(resource_uri, opts)\n authenticator = opts[:req].session[:authorizer]\n release_resource(body, resource_type, authenticator)\n end", "def delete\n client.delete(url)\n @deleted = true\n end", "def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def delete(request)\n request.method = :delete\n request.call\n end", "def delete(path, options={}, raw=false)\n request(:delete, path, options, raw)\n end", "def delete(*uris); end", "def delete(url, options={}, &block)\n http_options = options.merge(@basic_options)\n if block_given?\n RestClient.delete(url, http_options, &block)\n else\n RestClient.delete(url, http_options)\n end\n end", "def delete(payload = {})\n request! do\n options = {payload: to_payload(payload)}\n api(options)[url.path].delete(API_HEADERS)\n end\n end", "def delete(path, params)\n request(:delete, path, {})\n end", "def remove\n\t\t\tself.make_request!({uri: self.to_uri, method: :delete})\n\t\tend", "def make_delete_request\n options = {\n use_ssl: true,\n cert: OpenSSL::X509::Certificate.new(@certificate),\n key: OpenSSL::PKey::RSA.new(@key),\n ca_file: @uw_ca_file,\n verify_mode: OpenSSL::SSL::VERIFY_PEER\n }\n Net::HTTP.start(@uri.host, @uri.port, options) do |http|\n request = Net::HTTP::Delete.new(@uri.request_uri)\n @response = http.request(request)\n end\n @response.body\n end", "def delete(*args)\n url, subdomain, path, = parse_args(*args)\n rewrap_errors do\n RestClient.delete(build_url(url || subdomain, path), headers)\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete(url, headers={})\n begin\n request(:delete, url, nil, headers)\n rescue VeritableError => e\n if not e.respond_to? :http_code or not e.http_code == \"404 Resource Not Found\"\n raise e\n end\n end\n end", "def delete(endpoint, params = {})\n\n path = build_connect_url(endpoint)\n headers = build_headers(endpoint, 'DELETE', params)\n\n log \"DELETE \" + path + \" \" + params.to_s\n log headers.to_s\n\n begin\n response = RestClient::Request.execute(method: :delete, url: path, payload: params.to_json, headers: headers, timeout: 15)\n rescue RestClient::ExceptionWithResponse => e\n log e.http_code.to_s + \" \" + e.response.to_s\n return e.response\n end\n\n log response.code.to_s + \" \" + response.to_s\n\n response\n\n end", "def delete(url, headers: {}, params: {}, options: {})\n url = encode_query(url, params)\n\n request = Net::HTTP::Delete.new(url, @default_headers.merge(headers))\n\n execute_streaming(request, options: options)\n end", "def delete(request_opts = {})\n store_result(http(request_opts).delete(resolved_path))\n end", "def delete *args, &block\n res = @conn.delete *args, &block\n handle res, parse: false\n end", "def delete(path, options = {}, raw = false)\n request(:delete, path, options, raw)\n end", "def delete(path, headers = {})\n request(:delete, path, nil, merge_default_headers(headers))\n end", "def delete(resource, **params)\n\n execute(Net::HTTP::Delete, 'DELETE', resource, **params)\n\n end", "def delete(*args)\n Request.delete(*args)\n end" ]
[ "0.88915133", "0.8791166", "0.8751137", "0.8732784", "0.84622073", "0.84440076", "0.82914513", "0.8085918", "0.78359455", "0.78152543", "0.78101385", "0.77709424", "0.77589166", "0.75738025", "0.74408925", "0.7413214", "0.73828167", "0.73614913", "0.7320503", "0.72638446", "0.72638446", "0.725172", "0.7172197", "0.7172197", "0.71529335", "0.7145541", "0.70977944", "0.70734465", "0.7069692", "0.7069692", "0.7048842", "0.7025285", "0.7019626", "0.70112264", "0.69393754", "0.6924057", "0.68415135", "0.6816866", "0.6805266", "0.67960876", "0.67864984", "0.6786422", "0.67782634", "0.6763705", "0.67559123", "0.67481464", "0.6735828", "0.67201436", "0.6711843", "0.66986316", "0.6696802", "0.66896784", "0.66896784", "0.66896784", "0.66896784", "0.66896784", "0.66896784", "0.66896784", "0.66856724", "0.66856724", "0.66856724", "0.66831475", "0.6672533", "0.6672298", "0.6672298", "0.66701233", "0.6665786", "0.66636777", "0.6653528", "0.6631841", "0.66312146", "0.6618743", "0.66115546", "0.6606234", "0.66031635", "0.65973216", "0.6576433", "0.6574613", "0.6572517", "0.6561565", "0.65419126", "0.65399563", "0.653599", "0.6535803", "0.6535293", "0.65344054", "0.6532658", "0.65294427", "0.65294427", "0.65294427", "0.65294427", "0.6521139", "0.6507035", "0.6500544", "0.6499637", "0.6498625", "0.6493526", "0.64893585", "0.64857394", "0.64849585" ]
0.81417173
7
Returns a Rack::MockRequest. If there isn't one, a new one is created.
def request @request ||= Rack::MockRequest.new(mack_app) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_req\n Waxx::Req.new(ENV, {}, 'GET', \"/test/test/1\", {}, {}, {}, Time.new).freeze\n end", "def request\n @request ||= Rack::Request.new(@env)\n end", "def request\n @request ||= Rack::Request.new(@env)\n end", "def request(action = :echo)\n @request = Rack::MockRequest.new(RocketPants::CacheMiddleware.new(controller_class.action(action)))\n end", "def request\n @request ||= Rack::Request.new(env)\n end", "def setup\n @requester = Rack::MockRequest.new(SampleApp)\n end", "def request\n @request ||= ActionDispatch::TestRequest.create.tap do |request|\n request.request_id = SecureRandom.uuid\n end\n end", "def mock_request( params, response_body )\n mock_post = {}\n mock_post.expects(:set_form_data).with(params)\n #mock.expects(:[]=).with('user-agent', anything)\n\n url = Smsinabox.uri\n Net::HTTP::Post.expects(:new).with( url.path ).returns(mock_post)\n\n response = Net::HTTPSuccess.new('1.1', 200, 'OK')\n response.instance_variable_set :@body, response_body\n response.instance_variable_set :@read, true\n\n mock_http = Object.new\n mock_http.expects(:start).returns(response)\n\n Net::HTTP.expects(:new).with( url.host, url.port ).returns(mock_http)\nend", "def fake_request(env = {}, opt = {})\n if opt[:post_body]\n req = opt[:post_body]\n env[:content_type] ||= \"application/x-www-form-urlencoded\"\n else\n req = opt[:req]\n end\n FakeRequest.new(env, StringIO.new(req || ''))\n end", "def parse_env_into_request(rack_env)\n Rack::Request.new(rack_env)\n end", "def make_request url, method: ::Rack::GET, body: nil, headers: []\n env = Testing.build_standard_env URI(url), headers\n env[::Rack::REQUEST_METHOD] = method\n env[::Rack::RACK_INPUT] = ::StringIO.new body if body\n ::Rack::Request.new env\n end", "def request\n double(ActionDispatch::Request, { path: \"/\" })\n end", "def request # :doc:\n @request ||= begin\n environment = Rails.application.env_config.merge(env) if defined?(Rails.application) && Rails.application\n ActionDispatch::Request.new(environment || env)\n end\n end", "def make_request(action, params = {})\n path = params[:path] || \"/\"\n method = params[:method] || \"post\"\n env = Rack::MockRequest.env_for(path, params: params.except(:path).except(:method), method: method)\n status, headers, body = described_class.action(action).call(env)\n @response = ActionDispatch::TestResponse.new(status, headers, body)\n @controller = body.instance_variable_get(:@response).request.env['action_controller.instance']\nend", "def request\n @request ||= ::Lotus::Action::Request.new(@_env)\n end", "def test_request\n if defined?(ActionDispatch) # Rails 3.x\n ActionDispatch::TestRequest.new\n else # Rails 2.x\n ActionController::TestRequest.new\n end\n end", "def create_new_http_request\n # Create a new HTTP request instance\n request_spec = @data[:request][:instance]\n http_class = \"Net::HTTP::#{request_spec.verb._camelize}\"\n http_request = http_class._constantize::new(request_spec.path)\n # Set the request body\n if request_spec.is_io?\n http_request.body_stream = request_spec.body\n else\n http_request.body = request_spec.body\n end\n # Copy headers\n request_spec.headers.each { |header, value| http_request[header] = value }\n # Save the new request\n request_spec.raw = http_request\n # Set user-agent\n if @data[:options].has_key?(:connection_user_agent)\n http_request['user-agent'] ||= @data[:options][:connection_user_agent]\n end\n http_request\n end", "def request\n @request ||= Request.new(::Minfraud::HTTPService.configuration)\n end", "def mas_net_http_post(obj_stubs = {})\n request = Spec::Mocks::Mock.new(Net::HTTP::Post)\n Net::HTTP::Post.stub!(:new).and_return(request)\n obj_stubs.each do |method, value|\n request.stub!(method).and_return(value)\n end\n request\nend", "def mock_env_for(url, opts={})\n env = Rack::MockRequest.env_for url, opts\n env.merge! env_extensions\n end", "def setup_request\n return Typhoeus::Request.new(\n endpoint_url,\n method: @method,\n params: @params,\n body: @body,\n headers: @headers)\n end", "def request\n WebRequest.create(build_request_url)\n end", "def mas_net_http_get(obj_stubs = {})\n request = Spec::Mocks::Mock.new(Net::HTTP::Get)\n Net::HTTP::Get.stub!(:new).and_return(request)\n obj_stubs.each do |method, value|\n request.stub!(method).and_return(value)\n end\n request\nend", "def request(req, body = nil, &block)\n response = alias_for_request(req, body)\n path = \"http://#{req.bauth if req.bauth}#{req['host']}#{req.path}\"\n if @@fakes[req.method][path]\n @@fakes[req.method][path] << {:body => response.body.to_s}\n else\n @@fakes[req.method][path] = [:body => response.body.to_s]\n end\n return response\n end", "def initialize_request_and_response(env)\n @request = Rack::Request.new env\n @response = Rack::Response.new\n end", "def mock_request(script = \"test\" , headers = {})\n unless @mock_request\n @mock_request = mock(\"MockAgiRequest[script=#{script}]\")\n @mock_request.stub!(\n :extension => \"test\",\n :priority => \"1\",\n :context => \"default\",\n :uniqueId => \"123456789.7\", \n :language => \"en\",\n :channel => \"SIP/127.0.0.1-00000003\",\n :type => \"SIP\",\n :script => script,\n :requestURL => \"agi://fake_test_host:1234/#{script}\") #[?param1=value1&param2=value2]. \"\n end\n @mock_request\nend", "def mas_net_http(response, obj_stubs = {})\n http = mock(Net::HTTP, obj_stubs)\n Net::HTTP.stub!(:new).and_return(http)\n http.stub!(:request).and_return(response)\n http.stub!(:start).and_yield(http)\n http.stub!(:use_ssl=)\n http.stub!(:verify_mode=)\n http\nend", "def env_with_params(path = '/', params = {}, env = {})\n method = params.delete(:method) || 'GET'\n env = {'HTTP_VERSION' => '1.1', 'REQUEST_METHOD' => \"#{method}\"}.merge(env)\n Rack::MockRequest.env_for(\"#{path}?#{Rack::Utils.build_query(params)}\", env)\nend", "def new_stub_for method_name\n response = Response.new(Http::Request.new, Http::Response.new)\n response.request_type = method_name\n response.request_options = {}\n send(\"simulate_#{method_name}_response\", response)\n response.signal_success\n response\n end", "def new_stub_for method_name\n response = Response.new(Http::Request.new, Http::Response.new)\n response.request_type = method_name\n response.request_options = {}\n send(\"simulate_#{method_name}_response\", response)\n response.signal_success\n response\n end", "def build_rack_test_session(_name) # :nodoc:\n if respond_to?(:build_rack_mock_session, true)\n # Backwards compatibility for capybara\n build_rack_mock_session\n else\n if respond_to?(:default_host)\n Session.new(app, default_host)\n else\n Session.new(app)\n end\n end\n end", "def make_request_object( opts={} )\n\t\tdata = make_request( opts )\n\t\treturn Mongrel2::Request.parse( data )\n\tend", "def test_truth\n r = Request.new()\n end", "def mock_app(options)\n builder = Rack::Builder.new\n builder.use Rack::YandexMetrika, options\n builder.run controller\n @app = builder.to_app\n end", "def initialize(env)\n @env = env\n @request = Rack::Request.new(env)\n end", "def initialize(env)\n @env = env\n @request = Rack::Request.new(env)\n end", "def request method = \"GET\", uri = \"\", opts = { }\n\n env = self.class.env_for(uri, opts.merge(:method => method))\n \n unless @cookies.nil? or @cookies.empty? or @cookies[env['SERVER_NAME']].nil? or @cookies[env['SERVER_NAME']].empty?\n env['HTTP_COOKIE'] = @cookies[env['SERVER_NAME']].map{ |k,v| \"#{ k }=#{ v }\" }.join('; ')\n end\n\n if opts[:lint]\n app = Rack::Lint.new(@app)\n else\n app = @app\n end \n\n errors = env[\"rack.errors\"]\n response = Rack::MockResponse.new(*(app.call(env) + [errors]))\n \n if response.original_headers['Set-Cookie']\n @cookies ||= {}\n @cookies[ env['SERVER_NAME'] ] ||= {}\n response.original_headers['Set-Cookie'].map{ |str| /(.*); path/.match(str)[1] }.each do |cookie|\n name, value = cookie.split('=').first, cookie.split('=')[1]\n @cookies[ env['SERVER_NAME'] ][ name ] = value\n end\n end\n\n response\n end", "def multipart_fake_request(env = {}, params = {})\n if params.empty?\n fake_request(env)\n else\n m = Post.new(params)\n body, head = m.to_multipart\n fake_request(env.merge( :content_type => head, \n :content_length => body.length), :post_body => body)\n end\n end", "def session\n Rack::Test::Session.new(Rack::MockSession.new(FULL_STACK_SYNERGY_APP))\nend", "def mock_app(base=Sinatra::Base, &block)\n @app = Sinatra.new(base, &block)\n end", "def mock_app(base=Sinatra::Base, &block)\n @app = Sinatra.new(base, &block)\n end", "def mock_app(base=Sinatra::Base, &block)\n @app = Sinatra.new(base, &block)\n end", "def new(*)\n # return new mock session\n BunnyMock::Session.new\n end", "def require_requests_and_mock\n requests.each do |request|\n require_item(request, @request_path)\n if service::Mock.method_defined?(request.last)\n mocked_requests << request.last\n else\n service::Mock.module_eval <<-EOS, __FILE__, __LINE__\n def #{request.last}(*args)\n Fog::Mock.not_implemented\n end\n EOS\n end\n end\n end", "def make_request(req)\n if @http && @http.address == req.uri.host && !@http.started?\n @http.start\n else\n @http = Net::HTTP.new(req.uri.host, req.uri.port)\n @http.use_ssl = req.ssl?\n @http.verify_mode = OpenSSL::SSL::VERIFY_NONE if req.ssl?\n @http.set_debug_output($stderr) if req.debug\n @http.start\n end\n @http.request(req.http_request)\n end", "def build_request(method)\n Request.create(method) do |req|\n req.params = self.params.dup\n req.headers = self.headers.dup\n req.options = self.options\n yield(req) if block_given?\n end\n end", "def request\n OpenStruct.new\n end", "def request(options = nil, &block)\n if options.nil? && !block\n Request\n else\n Request.with(options, &block)\n end\n end", "def test_when_not_headers\n @middleware = Rack::Hard::Load.new(MockApp.new, :store => \"/tmp/static_copy_minitest\")\n assert_expected_response @middleware.call(@default_env), nil\n\n assert_expected_response @middleware.call(@default_env.merge({ 'PATH_INFO' => '/foo/bah.txt' })), nil\n end", "def request(req, body = nil, &block)\n response = alias_for_request(req, body)\n\n if NetRecorder.recording?\n scope = NetRecorder.scope || 'global'\n path = \"http://#{req.bauth if req.bauth}#{req['host']}#{req.path}\"\n\n existing_fake = @@fakes.detect{|fake| fake[0] == path && fake[1][scope] && fake[1][scope][:method] == req.method}\n existing_fake[1][scope][:response] << {:response => response} and return response if existing_fake\n\n @@fakes << [path, {scope => {:method => req.method, :response => [{:response => response}]}}]\n end\n\n yield response if block\n response\n end", "def test_handles_failure_to_create_request_object\n if defined?(ActionDispatch::Request)\n ActionDispatch::Request.stubs(:new).raises('bad news')\n\n assert_raises RuntimeError do\n get '/foo/bar?q=12'\n end\n\n assert_equal('unhandled error', last_error.message)\n assert_equal('/foo/bar', last_error.params[:request_uri])\n end\n end", "def make_request(request = nil, meth: nil, manifest: nil, **opt)\n request, meth = [nil, request] if request.is_a?(Symbol)\n request ||= pre_flight(meth, manifest, **opt)\n # noinspection RubyMismatchedArgumentType\n SubmissionService.make_request(request, **opt, service: self)\n end", "def initialize( request )\n @request = request\n @response = Rack::Response.new\n end", "def mock(name, options={})\n Spec::Mocks::Mock.new(name, options)\n end", "def request # :nodoc:\n @request ||= PayPal::ExpressCheckout::Request.new\n end", "def normalize_request(rack_req)\n host = rack_req.host\n\n s_req = Request.new\n s_req.path = path_for_rack_request(rack_req)\n s_req.is_path_style = true\n s_req.rack_request = rack_req\n\n if !@root_hostnames.include?(host)\n s_req.bucket = host.split(\".\")[0]\n s_req.is_path_style = false\n end\n\n s_req.http_verb = rack_req.request_method\n\n case rack_req.request_method\n when 'PUT'\n normalize_put(rack_req,s_req)\n when 'GET','HEAD'\n normalize_get(rack_req,s_req)\n when 'DELETE'\n normalize_delete(rack_req,s_req)\n when 'POST'\n normalize_post(rack_req,s_req)\n when 'OPTIONS'\n nomalize_options(rack_req,s_req)\n else\n return false\n end\n\n if s_req.type.nil?\n return false\n end\n\n return s_req\n end", "def http\n if ActiveResource::HttpMock.enabled?\n ActiveResource::HttpMock.new(@site)\n else\n http_without_mock\n end\n end", "def mock(*args)\n Spec::Mocks::Mock.new(*args)\n end", "def mock_app(base=Sinatra::Base, &block)\n @app = Sinatra.new(base, &block)\n end", "def mock(*args)\n Rspec::Mocks::Mock.new(*args)\n end", "def make_request\n response = @http.request(@request)\n end", "def stub_request(*args)\n WebMock::API.stub_request(*args)\n end", "def stub_request(*args)\n WebMock::API.stub_request(*args)\n end", "def stub_request(*args)\n WebMock::API.stub_request(*args)\n end", "def stub_request(*args)\n WebMock::API.stub_request(*args)\n end", "def stub_request(*args)\n WebMock::API.stub_request(*args)\n end", "def request\n @request ||= HTTPI::Request.new\n @request.url = document\n @request\n end", "def request\n @request ||= Request.find request_id\n end", "def store_request(object)\n return unless ensure_rack_loaded\n SharedStorage.set(:request, Rack::Request.new(object))\n SharedStorage.inc(:stored_requests)\n end", "def setup\n if @request.present?\n @request.env['HTTP_ACCEPT'] = 'application/json'\n @request.headers['x-api-key'] = 'some_api_key'\n end\n ActiveSupport::Cache::FileStore.any_instance.stubs(:read).returns(\"anandsai_auth\")\n end", "def new\n @request = Request.new\n end", "def make_generic_request(request)\n request_path = path(request)\n\n Puppet::Network::HTTP::Request.new(\n headers(request),\n params(request),\n http_method(request),\n request_path, # path\n request_path, # routing_path\n client_cert(request),\n body(request)\n )\n end", "def stubbed_net_http(response, obj_stubs = {}, host = 'twitter.com', port = 80)\n http = Net::HTTP.new(host, port)\n Net::HTTP.stub!(:new).and_return(http)\n http.stub!(:request).and_return(response)\n http\nend", "def build_request\n client.request request_name\n end", "def wrapped_request(rpc_method, request)\n request = request_class(rpc_method).new(request) if request.is_a?(Hash)\n\n ::Protobuf::Socketrpc::Request.new(\n :service_name => subject_service.to_s,\n :method_name => rpc_method.to_s,\n :request_proto => request.encode,\n :caller => 'protobuf-rspec'\n )\n end", "def get_request_obj(request_uri)\n\n req_obj = @request_class.new(request_uri)\n\n # Forward cookies\n req_obj['Cookie'] = @cookies.map { |k, v| \"#{k}=#{CGI.escape v.to_s}\" }.join('; ') if @cookies.present?\n\n # Forward headers\n @headers.each do |h, v|\n req_obj[h] = v\n end if @headers.present?\n\n # Attach basic auth\n if GlobalConstant::CompanyApi.basic_auth_user.present?\n req_obj.basic_auth(GlobalConstant::CompanyApi.basic_auth_user, GlobalConstant::CompanyApi.basic_auth_pass)\n end\n\n req_obj\n\n end", "def build_net_http_request request\n\n # Net::HTTP adds a content-type header automatically unless its set\n # and this messes with request signature signing. Also, it expects\n # all header values to be strings (it call strip on them).\n headers = { 'content-type' => '' }\n request.headers.each_pair do |key,value|\n headers[key] = value.to_s\n end\n\n request_class = case request.http_method\n when 'GET' then Net::HTTP::Get\n when 'PUT' then Net::HTTP::Put\n when 'POST' then Net::HTTP::Post\n when 'HEAD' then Net::HTTP::Head\n when 'DELETE' then Net::HTTP::Delete\n else raise \"unsupported http method: #{request.http_method}\"\n end\n\n net_http_req = request_class.new(request.uri, headers)\n net_http_req.body = request.body\n net_http_req\n\n end", "def mock_app(base=Padrino::Application, &block)\n @app = Sinatra.new(base, &block)\n end", "def mock_app(base=Padrino::Application, &block)\n @app = Sinatra.new(base, &block)\n end", "def mock_app(base=Padrino::Application, &block)\n @app = Sinatra.new(base, &block)\n end", "def mock_app(base=Padrino::Application, &block)\n @app = Sinatra.new(base, &block)\n end", "def create_mock( name )\n return flexmock( name )\n\tend", "def make_request(http, request)\n response = http.request(request)\n Response.new(response)\n end", "def mock_proxy\n @mock_proxy ||= Proxy.new(self, Mock === self ? @name : self.class.name)\n end", "def build_request path, opts = {}\n connection.build_request path, opts\n end", "def set_request\n $request = request\n end", "def request(&_)\n if block_given?\n @request ||= Request.new\n yield @request\n end\n @request\n end", "def http_request\n @http_request ||= begin\n request = request_for_verb\n add_post_data(request)\n add_bearer_token(request)\n add_headers(request)\n request\n end\n end", "def create_request(method, path, body = {})\n KintoRequest.new self, method, path, body\n end", "def build_request\n uri = @config[:endpoint]\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.start\n request = build_request_stream(uri)\n return http, request\n end", "def wrapped_request(method, path, expected_responses, parameters = {})\n _wrapped_request(method, path, expected_responses, parameters)\n end", "def initialize env\n @rack_environment = env\n @rack_version = env['rack.version']\n\n sanity_check!\n @rack_request = Rack::Request.new(rack_environment)\n\n initialize_uris\n end", "def webRequest (url)\n\tif url =~ /(https)/\n\t\treturn httpsRequest(url)\n\telse\n\t\treturn httpRequest(url)\n\tend\nend", "def make_request\n\t\t\tresponse = nil\n\t\t\tif self.respond_to? :headers\n\t\t\t\turi = URI.parse(request_string)\n\n\t\t\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\t\thttp.set_debug_output $stderr if @test_request\n\t\t\t\thttp.use_ssl = true\n\t\t\t\thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n\t\t\t\trequest = Net::HTTP::Get.new(uri.request_uri)\n\t\t\t\theaders.each do |k,v|\n\t\t\t\t\trequest[k] = v\n\t\t\t\tend\n\n\t\t\t\tresponse = http.request(request).body\n\t\t\telse\n\t\t\t\t$stderr.puts(request_string) if @test_request\n\n\t\t\t\tresponse = open(request_string)\n\t\t\tend\n\n\t\t\treturn process_response(response)\n\t\tend", "def http_request\n req = VanillaRequest.new @http_method, @uri.request_uri, @headers\n\n if @oauth\n req['Authorization'] =\n SimpleOAuth::Header.new(@http_method, @uri, {}, self.oauth).to_s\n elsif @auth && @auth[:username]\n req.basic_auth @auth[:username], @auth[:password]\n end\n\n # Stream Multipart\n if Kronk::Multipart === @body\n req.body_stream = @body.to_io\n\n # Stream IO\n elsif @body.respond_to?(:read)\n req.body_stream = @body\n\n else\n req.body = @body\n end\n\n b = req.body || req.body_stream\n\n if b.respond_to?(:bytesize)\n req['Content-Length'] = b.bytesize.to_s\n elsif b.respond_to?(:size) && b.size\n req['Content-Length'] = b.size.to_s\n elsif b.nil?\n req['Content-Length'] = \"0\"\n end\n\n req['Transfer-Encoding'] = 'chunked' if !req['Content-Length']\n\n req\n end", "def construct_request(uri, params, credentials=[])\n Weary::Request.new uri, @method do |r|\n pass_values_onto_requestable(r)\n if !expected_params.empty?\n r.params params.reject {|k,v| !expects? k }\n end\n r.send @authenticates, *credentials if authenticates?\n end\n end", "def request(req)\n self.class.paths << req.path\n self.class.params << req.body\n response = self.class.responses.shift\n if response.respond_to? :call then\n response.call req\n else\n res = Net::HTTPResponse.new '1.0', 200, 'OK'\n res.body = response\n res\n end\n end", "def dup\n self.class.new(build_exclusive_url,\n :headers => headers.dup,\n :params => params.dup,\n :builder => builder.dup,\n :ssl => ssl.dup,\n :request => options.dup)\n end", "def make_json_request_object( opts={} )\n\t\tdata = make_json_request( opts )\n\t\treturn Mongrel2::Request.parse( data )\n\tend", "def get(path)\n RequestStub.build :method => :get, :path => path\n end" ]
[ "0.7302751", "0.6721054", "0.6721054", "0.6708992", "0.6705215", "0.65880847", "0.64892596", "0.6407008", "0.64007825", "0.6233579", "0.6158257", "0.6046235", "0.6020485", "0.6013836", "0.58620274", "0.5838313", "0.57673687", "0.57213414", "0.5719344", "0.5691426", "0.56677467", "0.5622873", "0.5610876", "0.5591685", "0.5573003", "0.55656683", "0.552551", "0.55239314", "0.54600805", "0.54600805", "0.54516125", "0.5449811", "0.5447504", "0.54368913", "0.54194254", "0.54194254", "0.540432", "0.53678346", "0.53642476", "0.53438824", "0.53438824", "0.53438824", "0.5292003", "0.52887344", "0.5288473", "0.5281694", "0.5268784", "0.5260686", "0.5250948", "0.5246366", "0.52420545", "0.523111", "0.52270377", "0.521251", "0.52055854", "0.51842254", "0.51682806", "0.5162155", "0.5154626", "0.5152765", "0.5152384", "0.51117396", "0.51117396", "0.51117396", "0.51117396", "0.5111442", "0.51014596", "0.5098839", "0.50873697", "0.50844216", "0.5059551", "0.505468", "0.50485855", "0.5048273", "0.50444764", "0.5021476", "0.5012536", "0.5006812", "0.5006812", "0.5006812", "0.5006812", "0.50052613", "0.49997634", "0.49964795", "0.4985199", "0.4984012", "0.4982086", "0.49710295", "0.49660707", "0.49613842", "0.49607238", "0.4959957", "0.494648", "0.49454153", "0.4942468", "0.49416268", "0.4935355", "0.49114344", "0.49096927", "0.49090415" ]
0.76678216
0
Returns the last Rack::MockResponse that got generated by a call.
def response @testing_response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_response\n last_request_with_response = requests.reverse.detect do |r|\n r.response\n end\n return nil unless last_request_with_response\n\n last_request_with_response.response\n end", "def last_response\n @response\n end", "def last_response\n @last_response\n end", "def last_response\n @last_response if defined? @last_response\n end", "def last_response\n @last_response if defined? @last_response\n end", "def last_response\n @last_response if defined? @last_response\n end", "def last_response\n @last_response if defined? @last_response\n end", "def last_response\n @last_response if defined? @last_response\n end", "def last_response\n raise Error, 'No response yet. Request a page first.' unless @last_response\n @last_response\n end", "def last_response\n defined?(super) ? super : response\n end", "def last_http_response\n @http_response\n end", "def call\n expect :result\n\n self.last\n end", "def get_response()\n if has_errors?\n return get_error_response()\n end\n @values[\"RESPONSE\"]\n end", "def last_request\n if MockAdapter === @client\n @client.last_request\n else\n raise ArgumentError, \"wrong number of arguments (#{args.length} for 1..2)\";\n end\n end", "def get_response\n debuglog 'get_response'\n response = rack_response\n @e.pre_response response\n response\n end", "def last_response(id)\n @responses[id].last\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 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 body\n last_response.body\nend", "def response\n @response ||= Rack::Response.new\n end", "def response\n @response ||= request!(true)\n end", "def status\n last_response.status\nend", "def response\n @response\n end", "def response\n @response\n end", "def last_xml_response\n @xml_response\n end" ]
[ "0.7475927", "0.727118", "0.70997083", "0.706564", "0.706564", "0.706564", "0.706564", "0.70136094", "0.6718882", "0.671573", "0.6562184", "0.6336279", "0.63322455", "0.622935", "0.6020902", "0.60023254", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.59327525", "0.5932712", "0.59322566", "0.59322566", "0.59322566", "0.59322566", "0.59322566", "0.59322566", "0.59322566", "0.59322566", "0.59322214", "0.59322214", "0.59322214", "0.59322214", "0.59322214", "0.5917459", "0.5917459", "0.5917459", "0.5917459", "0.5917459", "0.5917459", "0.5917459", "0.5917459", "0.5917459", "0.5916869", "0.58993614", "0.5808983", "0.58020765", "0.5782855", "0.5782855", "0.5731578" ]
0.0
-1
Returns all the Rack::MockResponse objects that get generated by a call.
def responses @responses end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stub_responses\n Creditsafe::Api::DummyResponse.new\n end", "def flexmock_calls\n @mock.flexmock_calls\n end", "def responses\n @responses ||= api::BatchResponse.new(responses: responses_by_request.values.uniq)\n end", "def call\n @called = true\n handleResponse @stubs\n end", "def to_response\n []\n end", "def to_response\n return [@status, @headers, @body]\n end", "def list_requests\n # stub\n end", "def response_elements\n RESPONSE_ELEMENTS\n end", "def new_stub_for method_name\n response = Response.new(Http::Request.new, Http::Response.new)\n response.request_type = method_name\n response.request_options = {}\n send(\"simulate_#{method_name}_response\", response)\n response.signal_success\n response\n end", "def new_stub_for method_name\n response = Response.new(Http::Request.new, Http::Response.new)\n response.request_type = method_name\n response.request_options = {}\n send(\"simulate_#{method_name}_response\", response)\n response.signal_success\n response\n end", "def mas_net_http_get(obj_stubs = {})\n request = Spec::Mocks::Mock.new(Net::HTTP::Get)\n Net::HTTP::Get.stub!(:new).and_return(request)\n obj_stubs.each do |method, value|\n request.stub!(method).and_return(value)\n end\n request\nend", "def get_responses(entries)\n responses = entries.map do |entry|\n entry.responses\n end\n responses.flatten.compact\n end", "def mas_net_http_response(status = :success, \n body = '', \n obj_stubs = {})\n response = Spec::Mocks::Mock.new(Net::HTTPResponse)\n response.stub!(:body).and_return(body)\n case status\n when :success || 200\n _create_http_response(response, \"200\", \"OK\")\n when :created || 201\n _create_http_response(response, \"201\", \"Created\")\n when :redirect || 301\n _create_http_response(response, \"301\", \"Redirect\")\n when :not_authorized || 401\n _create_http_response(response, \"401\", \"Not Authorized\")\n when :forbidden || 403\n _create_http_response(response, \"403\", \"Forbidden\")\n when :file_not_found || 404\n _create_http_response(response, \"404\", \"File Not Found\")\n when :server_error || 500\n _create_http_response(response, \"500\", \"Server Error\")\n end\n response\nend", "def dispatch_responders\n self.full_response, self.responder_ids = try_responding_in_full\n end", "def response_set\n if defined?(@response_set)\n return @response_set unless wipe_response_set?\n end\n @wipe_response_set = false\n @response_set = LimeExt::ResponseLoaders.responses_for self\n return @response_set\n end", "def return_values\n Calls.new(select(&:returned?))\n end", "def requests # rubocop:disable Metrics/AbcSize\n request_response_pairs.map do |request, response|\n {\n request_method: request.request_method,\n request_path: request_path(request),\n request_body: request_body(request.body),\n request_headers: request_headers(request.env),\n request_query_parameters: request.params,\n request_content_type: request.content_type,\n response_status: response.status,\n response_status_text: response_status_text(response.status),\n response_body: response_body(response.body, content_type: response.content_type),\n response_headers: response_headers(response.headers),\n response_content_type: response.content_type,\n }\n end\n end", "def mock_methods_for_testing! #:nodoc:\n request.headers['mock_methods'].each do |method_name, return_value|\n (class << self; self; end).instance_eval do\n define_method(method_name) { |*not_used| return_value }\n end\n end\n end", "def flexmock_created_mocks\n @flexmock_created_mocks ||= []\n end", "def batch_responses\n return [@result] unless @batch_response\n # if batch response, generate array based on the response hash.\n @result.map do |r|\n next r unless r.is_a?(Hash)\n hash = r[SUCCESS] || r[ERROR]\n Parse::Response.new hash\n end\n end", "def index\n \t @responses = Response.all\n end", "def response_times\n times = []\n start_time = Time.now\n final_time = Time.now + @max_time\n counter = 1\n while Time.now < final_time do\n times << @request_builder.call(@url, counter)\n sleep(@sleep_time)\n counter += 1\n end\n times\n end", "def stub_pipeline_info_command(heroku_token, github_token)\n stub_pipelines_command(heroku_token)\n\n response_info =\n fixture_data(\"api.heroku.com/pipelines/531a6f90-bd76-4f5c-811f-acc8a9f4c111/pipeline-couplings\")\n stub_request(:get, \"https://api.heroku.com/pipelines/531a6f90-bd76-4f5c-811f-acc8a9f4c111/pipeline-couplings\")\n .with(headers: default_heroku_headers(heroku_token))\n .to_return(status: 200, body: response_info, headers: {})\n\n response_info = fixture_data(\"api.heroku.com/apps/27bde4b5-b431-4117-9302-e533b887faaa\")\n stub_request(:get, \"https://api.heroku.com/apps/27bde4b5-b431-4117-9302-e533b887faaa\")\n .with(headers: default_heroku_headers(heroku_token))\n .to_return(status: 200, body: response_info, headers: {})\n\n response_info = fixture_data(\"kolkrabbi.com/pipelines/531a6f90-bd76-4f5c-811f-acc8a9f4c111/repository\")\n stub_request(:get, \"https://kolkrabbi.com/pipelines/531a6f90-bd76-4f5c-811f-acc8a9f4c111/repository\")\n .to_return(status: 200, body: response_info)\n\n response = fixture_data(\"api.github.com/repos/atmos/hubot/index\")\n stub_request(:get, \"https://api.github.com/repos/atmos/hubot\")\n .with(headers: default_github_headers(github_token))\n .to_return(status: 200, body: response, headers: {})\n\n response_info = fixture_data(\"api.github.com/repos/atmos/hubot/branches/production\")\n stub_request(:get, \"https://api.github.com/repos/atmos/hubot/branches/production\")\n .to_return(status: 200, body: response_info, headers: {})\n end", "def response\n [ @_status || DEFAULT_RESPONSE_CODE, headers, @_body || DEFAULT_RESPONSE_BODY.dup ]\n end", "def response\n [ @_status || DEFAULT_RESPONSE_CODE, headers, @_body || DEFAULT_RESPONSE_BODY.dup ]\n end", "def mocks\n calls = @mocks.flat_map {|m| m.__SPLATS_child_objects }\n\n constructors = []\n\n expects = calls.flat_map do |c|\n recv = c[0]\n constructors << (recv.__SPLATS_print + ' = flexmock(\"' + recv.__SPLATS_print + '\")')\n c[1].map do |call|\n line = recv.__SPLATS_print\n line += \".should_receive(#{call[0].inspect})\"\n (line += \".with\" + self.class.args_to_s(call[2])) unless call[2].empty?\n line += '.and_return(' + self.class.construct_value(call[1]) + ').once'\n end\n end\n\n constructors + expects\n end", "def index\n @responses = Response.all\n end", "def index\n @responses = Response.all\n end", "def index\n @responses = Response.all\n end", "def index\n @responses = Response.all\n end", "def index\n @responses = Response.all\n end", "def stub(stubs)\n if stubs.key? :cookies\n stubs[:cookies].keys.each { |key| stubs[:cookies][key] = Array(stubs[:cookies][key]) }\n end\n stubs[:code] ||= 200\n\n stubs[:headers] ||= {}\n stubs[:headers] = Hash[*stubs[:headers].flat_map { |k, v| [k.downcase, v] }]\n stubs[:headers][\"content-length\"] ||= stubs[:body].length.to_s if stubs.key?(:body)\n\n @stubs = stubs\n\n self\n end", "def results\n return error if error?\n return response if response?\n end", "def stub_flickr_api_list\n resp = { methods: {\n method: [ { _content: 'flickr.photos.search' },\n { _content: 'flickr.photos.getSizes' },\n { _content: 'flickr.photos.getInfo' } ] } }\n\n stub_flickr_method('flickr.reflection.getMethods', resp)\n end", "def mock_request( params, response_body )\n mock_post = {}\n mock_post.expects(:set_form_data).with(params)\n #mock.expects(:[]=).with('user-agent', anything)\n\n url = Smsinabox.uri\n Net::HTTP::Post.expects(:new).with( url.path ).returns(mock_post)\n\n response = Net::HTTPSuccess.new('1.1', 200, 'OK')\n response.instance_variable_set :@body, response_body\n response.instance_variable_set :@read, true\n\n mock_http = Object.new\n mock_http.expects(:start).returns(response)\n\n Net::HTTP.expects(:new).with( url.host, url.port ).returns(mock_http)\nend", "def flexmock_get\n @mock\n end", "def flexmock_get\n @mock\n end", "def responses_from_request(request)\n responses = []\n if request[:params]\n responses += request[:params].split(\"/\")\n end\n\n # url request\n if request[:responses]\n split_responses = request[:responses].split(\"/\")\n responses += split_responses\n end\n\n # get form submission request: one response\n if request[:response]\n responses << request[:response]\n end\n\n #get form submission request: for multiple responses\n response_array = request.query_parameters.select { |key| key.to_s.match(/^response_\\d+/) }\n .map { |response_key| response_key[1] }\n responses += response_array unless response_array.empty?\n responses\n end", "def get_responding_methods\n meth_responses = {}\n @responding_methods.each do |meth|\n begin\n if meth.is_a? Hash\n meth.each_pair { |k,v| meth_responses[k.to_sym] = @responding_object.send(k, *v) }\n else\n meth_responses[meth.to_sym] = @responding_object.send(meth)\n end\n rescue Exception => e\n if meth.is_a? Hash\n meth.each_pair { |k,v| meth_responses[k.to_sym] = \"#{e.class}: #{e.message}\" }\n else\n meth_responses[meth.to_sym] = \"#{e.class}: #{e.message}\"\n end\n end\n end\n self.responding_methods = meth_responses\n end", "def successful_requests\n @successful_requests ||= @responses.select{|r| r[:success] }\n end", "def get(*params); raise('Stub or mock required.') end", "def require_requests_and_mock\n requests.each do |request|\n require_item(request, @request_path)\n if service::Mock.method_defined?(request.last)\n mocked_requests << request.last\n else\n service::Mock.module_eval <<-EOS, __FILE__, __LINE__\n def #{request.last}(*args)\n Fog::Mock.not_implemented\n end\n EOS\n end\n end\n end", "def returns(response = nil)\n http = { :code => 200, :headers => {}, :body => \"\" }\n\n case response\n when Symbol then http[:body] = Fixture[soap_action, response]\n when Hash then http.merge! response\n end\n\n httpi_mock.returns HTTPI::Response.new(http[:code], http[:headers], http[:body])\n self\n end", "def messages\n responses.map(&:messages).flatten\n end", "def stub_call(method:, message: :any, response:)\n savon.expects(method).with(message: message).returns(response)\n end", "def sip_responses\n hashed_sip[appt_id]\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 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" ]
[ "0.67965686", "0.62189996", "0.6166518", "0.6095895", "0.5956443", "0.59077376", "0.5835776", "0.58202946", "0.5793826", "0.5793826", "0.57685274", "0.572455", "0.5695078", "0.56721073", "0.5668164", "0.56027293", "0.56006056", "0.5578861", "0.5571897", "0.55678666", "0.5556721", "0.55558485", "0.5525568", "0.54872334", "0.54872334", "0.54842925", "0.5467677", "0.5467677", "0.5467677", "0.5467677", "0.5467677", "0.54226583", "0.5407988", "0.5406764", "0.5385673", "0.5381082", "0.5381082", "0.5365579", "0.53638524", "0.5346092", "0.53343195", "0.53269494", "0.53207374", "0.53134644", "0.5306175", "0.52966946", "0.52952075", "0.5294834", "0.5294834", "0.5294834", "0.5294834", "0.5294834", "0.5294834", "0.5294834", "0.5294834", "0.5294826", "0.5294826", "0.5294826", "0.5294826", "0.5294826", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546", "0.52943546" ]
0.6235408
1
Returns a Mack::Session from the request.
def session # :nodoc: sess = Mack::SessionStore.get($current_session_id, nil, nil, nil) if sess.nil? id = String.randomize(40).downcase set_cookie(configatron.mack.session_id, id) sess = Mack::Session.new(id) Mack::SessionStore.store.direct_set(id, sess) $current_session_id = id sess end sess end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session\n @session ||= Session.new(@request)\n end", "def session\n @session ||= Session.new(req)\n end", "def session\n @session ||= Session.new(req)\n end", "def session\n @session ||= Session.new(req)\n end", "def session\n @session ||= Session.new(req)\n end", "def session\n @session ||= Session.new(req)\n end", "def session\n @session ||= Session.new(req)\n end", "def session\n @session ||= Session.new(@req)\n end", "def session\n @session ||= Session.new(@req)\n end", "def session\n @session ||= Session.new(@req)\n end", "def session\n @session ||= Session.new(@req)\n end", "def session\n @session ||= Session.new(@req)\n end", "def session\n @session ||= Session.new(@request)\n @session\n end", "def session\n @session ||= Session.new( req )\n end", "def session\n @session ||= Session.new(request)\n end", "def session\n @session ||= Puffs::Session.new(req)\n end", "def get_session\n env = get_session_tagged\n req_headers = env.request_headers\n res_headers = env.response_headers\n @session.class.new(user_id: req_headers['mhvCorrelationId'],\n expires_at: res_headers['expires'],\n token: res_headers['token'])\n end", "def session\n # lazy assign so session persists for entire controller life\n @session ||= Session.new(@req)\n end", "def session\n @request.session\n end", "def session\n\t\tunless @session\n\t\t\t# Load the session from the associated request if there is one.\n\t\t\t# If there isn't an associated request, this will just create a\n\t\t\t# new blank session.\n\t\t\tif self.request.session?\n\t\t\t\tself.log.debug \"Getting the request's session.\"\n\t\t\t\tself.session = request.session\n\t\t\telse\n\t\t\t\tself.log.debug \"No session loaded in the request; creating it in the response.\"\n\t\t\t\tself.session = Strelka::App::Sessions.session_class.new\n\t\t\tend\n\t\tend\n\n\t\treturn @session\n\tend", "def session\n @request.session\n end", "def session\n request.session\n end", "def session\n @req.session\n end", "def session() request.session end", "def session ; request.session ; end", "def session\n @session ||= Session.new(req)\n# Implement a method ControllerBase#session which constructs a\n# session from the request. Lazily assign this in to an ivar,\n# (@session; use ||=) that can be returned on subsequent calls to\n# #session.\n# Make sure that the #redirect_to and #render_content methods call\n# Session#store_session so that the session information is stored in the\n# cookie after the response is built.\n end", "def session\n @request.env[\"rack.session\"]\n end", "def session\n @connection.request('session-get') do |resp|\n if resp == :connection_error\n yield :connection_error\n else\n yield Session.new(resp)\n end\n end\n end", "def get_session\n return Seasar::CGI::Session.get_session(@cgi)\n end", "def get_session\n return Seasar::Rack::Session.get_session(@env)\n end", "def session\n\t\t\t\t@session ||= response.session\n\t\t\tend", "def session(session_store = nil)\n request.session(session_store)\n end", "def session #:nodoc:\n @session ||= Session.new\n end", "def session\n\t\t\trequest.session\n\t\tend", "def session\n Session.instance\n end", "def session; @session; end", "def session; @session; end", "def session; @session; end", "def session\n response = Stanza::Iq.new :set\n response.to = @to\n response << (sess = XMPPNode.new('session', response.document))\n sess.namespace = SESSION_NS\n\n @stream.send response\n end", "def retrieve_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end", "def session\n object.session\n end", "def session_get\n nessus_rest_get(\"session\")\n end", "def session\n last_request.env[\"rack.session\"]\n end", "def session\n @session ||= {}\n end", "def session\n env[\"rack.session\"] || {}\n end", "def get_session\n return @env['java.servlet_request'].session\n end", "def session\n @session ||= options[:session] || {} \n end", "def session\n @session ||= establish_connection\n end", "def get_session_record(request, sid)\n model = @@session_class.find_by_session_id(sid) ||\n @@session_class.new(session_id: sid || generate_sid)\n\n if request.env[SESSION_OPTIONS_KEY][:id].nil?\n request.env[SESSION_RECORD_KEY] = model\n else\n request.env[SESSION_RECORD_KEY] ||= model\n end\n\n model\n end", "def setup(request)\n session = retrieve(request.session_id)\n request.session = session\n # TODO Marshal.dump is slow - needs optimization\n session._fingerprint = Marshal.dump(request.session.to_hash).hash\n session\n end", "def session\r\n @session ||= {}\r\n end", "def session\n self\n end", "def initialize( request )\n @request = request\n @data ||= ( File.exist?( session_path ) ? load_session : {} )\n end", "def session\n @session ||= @app.config[:session_from_rack_env].call(@env)\n end", "def start_session\n self.delete_session\n return @env['java.servlet_request'].session\n end", "def new\n @session = Session.new\n end", "def session_params\r\n params.fetch(:session, {})\r\n end", "def session_params\n params[:session]\n end", "def session_params\n params.fetch(:session, {})\n end", "def get_session\n @session = Session.find(@blocker.session_id)\n end", "def new\n @session = Session.new('')\n end", "def session_params\n params.fetch(:session, {})\n end", "def session_params\n params.fetch(:session, {})\n end", "def session_params\n params.fetch(:session, {})\n end", "def get_session\n @authenticator.get_session\n end", "def setup(request)\n session = self.new(Merb::SessionMixin.rand_uuid,\n request.session_cookie_value, request._session_secret_key)\n session._original_session_data = session.to_cookie\n request.session = session\n end", "def get_session(cgi)\n begin\n return ::CGI::Session.new(cgi, @@options.merge({\"new_session\" => false}))\n rescue ArgumentError => e\n s2logger.info(self){\"session has not been started.\"}\n s2logger.debug(self){\"#{e.message} #{e.backtrace}\"}\n return nil\n end\n end", "def new\n @session = Session.new\n end", "def get(session=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\t# The KS to be parsed, keep it empty to use current session.\n\t\t\tclient.add_param(kparams, 'session', session);\n\t\t\tclient.queue_service_action_call('session', 'get', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend", "def session\n @controller.session\n end", "def session\n @session ||= OpenStruct.new\n end", "def get_session( params )\n LastFM.get( \"auth.getSession\", params, :secure )\n end", "def get_session( env, sid )\n return _get_session( env, sid ) unless env['rack.multithread']\n mutex.synchronize do\n return _get_session( env, sid )\n end \n end", "def session_params\n params.fetch(:session, :email, :password)\n end", "def session\n env['rack.session'] ||= {}\n end", "def get_with_session_login!(path, session)\n get_with_session_login(path, session)\n session.merge!(last_request.session)\n end", "def find_session(request, sid)\n record = get_session_record(request, sid)\n record.session_id = generate_sid if record.new_record?\n [record.session_id, record.data]\n end", "def session\n return nil unless session_id\n QuoVadis::Session.find_by id: session_id\n end", "def new\n @session = User::Session.new\n end", "def get_session(session_id)\n session = Session.find(:first, :conditions => ['session_id=?', session_id])\n return session\n end", "def get(context = Context.current)\n if digest = context.cookies[Session.cookie_name]\n session = @cache[digest]\n end\n\n ensure\n unless session\n digest = generate_digest()\n session = Session.new\n session.instance_variable_set(\"@digest\", digest)\n @cache[digest] = session\n end\n\n return session\n end", "def create_session\n Puppet::HTTP::Session.new(self, build_resolvers)\n end", "def set_session\n @session = BatchConnect::Session.find(params[:id])\n end", "def obtain_session\n session = @session_storage.obtain_session\n if !session\n session = @auth_client.auth(@username,\n @password,\n @client_id,\n @client_secret)\n @session_storage.store_session(session)\n end\n\n session\n end", "def session\n @context.session\n end", "def obtain_session\n session = @session_storage.obtain_session\n if session.nil?\n session = @auth_client.auth(@username,\n @password,\n @client_id,\n @client_secret)\n @session_storage.store_session(session)\n end\n\n session\n end", "def reconstitute_session(env)\n request = Rack::Request.new(env)\n token = request.params[HANDSHAKE_PARAM]\n return unless token\n\n # decrypt the token and get the session cookie value\n handshake = decrypt_handshake_token(token, env)\n return unless handshake\n\n cookie_value = handshake[:session_id]\n\n # fix up Rack env\n # ensure the cookie string is set\n env[HTTP_COOKIE] = [env[HTTP_COOKIE], \"#{@session_id_key}=#{cookie_value}\"].compact.join(';')\n # Rack request object parses cookies on demand and stores data in internal env keys\n # but the current implementation is not good about writing back through to the env\n # Since requests objects are transient wrappers we have to be prepared to encounter an env\n # that may already be initialized with some state\n # if the cookie string has already been read by Rack, update Rack's internal cookie string variable\n if env[RACK_COOKIE_STRING]\n env[RACK_COOKIE_STRING] = [env[RACK_COOKIE_STRING], \"#{@session_id_key}=#{cookie_value}\"].compact.join(';')\n end\n # if the cookie string has already been read by Rack, update Rack's internal cookie hash variable\n request = Rack::Request.new(env)\n request.cookies[@session_id_key] = cookie_value # call cookies() to make Rack::Request do its stuff\n end", "def build_session\n # If it's empty assume user doesn't need session attributes.\n @session_attributes = Hash.new if @session_attributes.nil?\n @session = { :sessionAttributes => @session_attributes }\n @session\n end", "def get_session(env, sid)\n raise '#get_session needs to be implemented.'\n end", "def request\n @request ||= Rack::MockRequest.new(mack_app)\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:session_id])\n end", "def get_session(env, sid)\n raise '#get_session not implemented.'\n end", "def initialize(req)\n @data = JSON.parse(req.cookies['_req_room_session']) rescue {}\n end", "def request\n @request ||= ::Lotus::Action::Request.new(@_env)\n end", "def get_session(options = {})\n resp = @connection.post do |req|\n req.headers = { :Accept => 'application/json'}\n req.url 'v1/sessions'\n req.body = options.to_json\n end\n check_response_for_errors resp.body\n end", "def user_session\n @user_session ||= UserSession.new(session, cookies)\n end" ]
[ "0.76004106", "0.7596809", "0.7581253", "0.7581253", "0.7581253", "0.7581253", "0.7581253", "0.75213915", "0.75213915", "0.75213915", "0.7518643", "0.7518643", "0.75029856", "0.7482528", "0.73555684", "0.72758573", "0.71456385", "0.70637447", "0.70321345", "0.70183116", "0.69713515", "0.6936166", "0.69339836", "0.68475825", "0.67558527", "0.6713838", "0.6583209", "0.6459858", "0.64432377", "0.64335614", "0.6338001", "0.6297863", "0.62868905", "0.6254925", "0.6251489", "0.6236203", "0.6236203", "0.6236203", "0.61894935", "0.6154773", "0.61264604", "0.61166906", "0.60922503", "0.60702527", "0.6044719", "0.60406256", "0.6027623", "0.6025831", "0.60151035", "0.601156", "0.6004527", "0.6001555", "0.600142", "0.59721", "0.59191406", "0.5909329", "0.5877211", "0.58761966", "0.5875053", "0.586819", "0.5865508", "0.5852244", "0.5852244", "0.5852244", "0.5842951", "0.5824075", "0.58106536", "0.5806724", "0.58040625", "0.58017254", "0.5790805", "0.57611126", "0.5754139", "0.5752906", "0.5697057", "0.56740683", "0.5672618", "0.5659244", "0.56387246", "0.56312776", "0.56192464", "0.56132835", "0.5596278", "0.55927217", "0.5592639", "0.55823547", "0.55752164", "0.555609", "0.55451286", "0.5508681", "0.55037826", "0.55037826", "0.55037826", "0.55037826", "0.5492763", "0.5486341", "0.5471075", "0.546854", "0.5467824", "0.54660636" ]
0.61995435
38
Used to create a 'session' around a block of code. This is great of 'integration' tests.
def in_session @_mack_in_session = true clear_session $current_session_id = session.id yield $current_session_id = nil clear_session @_mack_in_session = false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_session\n @current_session = new_session\n @current_session.test_case = self\n yield @current_session if block_given?\n @current_session\n end", "def session(options={}, &block)\n self.class.session self, &block\n end", "def new_session\r\n session = ActionController::Integration::Session.new\r\n yield session if block_given?\r\n session\r\nend", "def with_session(auth = false, &block)\n auth_token = self.class.remembered_auth \n if auth_token.nil?\n auth_token = self.class.remembered_auth = get_auth_token\n end\n \n \n create_url = \"#{configuration.base_url}createsession?profile=#{configuration.profile}&guest=#{auth ? 'n' : 'y'}\" \n response_xml = get_with_auth(create_url) \n \n session_token = nil\n unless response_xml && (session_token = at_xpath_text(response_xml, \"//SessionToken\")) \n e = EdsCommException.new(\"Could not get SessionToken\") \n end\n \n begin \n block.yield(session_token)\n ensure \n if auth_token && session_token \n end_url = \"#{configuration.base_url}endsession?sessiontoken=#{CGI.escape session_token}\"\n response_xml = get_with_auth(end_url) \n end\n end\n \n end", "def new_session\n open_session do |sess|\n sess.extend(SessionMethods)\n yield sess if block_given?\n end\n end", "def session(&block)\n @pool.with_connection &block\n end", "def with_session(&block)\n should_be_instance_of(:block, block, Proc)\n client = Mongoid.client(:default)\n session = client.start_session\n begin\n block.call session, client\n session.end_session\n rescue Mongo::Error => e\n catch_session_error(e, block)\n session.abort_transaction\n end\n end", "def execute_block(&block)\n @currently_executing_block = true\n output \"tell session id #{name}_tty\"\n self.instance_eval(&block)\n output \"end tell\"\n @currently_executing_block = false\n end", "def server_session(&block)\n server.session(&block)\n end", "def new_session\n session = IntegrationSession.new\n session.test_case = self\n return session\n end", "def with_session(name)\n session = _rack_test_current_session\n yield(@_rack_test_current_session = rack_test_session(name))\n ensure\n @_rack_test_current_session = session\n end", "def run_one_test(session)\n \n end", "def visit_with_session\n open_session do |sess|\n sess.host = 'test.host'\n sess.extend Mephisto::Integration::Actor\n yield sess if block_given?\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 open_session\n old_session = @current_session\n @current_session = new_session\n result = yield @current_session\n @current_session = old_session\n return result\n end", "def using_session(name, &block)\n self.last_used_session = name\n super\n ensure\n self.last_used_session = nil\n end", "def session_begin(cred, mode)\n #This is a stub, used for indexing\n end", "def session; end", "def session; end", "def session; end", "def session; end", "def session(&block) # :yields: session\n @socket = TCPSocket.open(@host, @port, @local_host, @local_port)\n \n # print connection settings and get return code\n @socket.print(connection_settings)\n return_code = @socket.recv(1).unpack(\"c\").first\n \n if return_code == RECEIVED_SETTINGS\n login\n block.call(self)\n logout\n else\n if @logger\n error = @socket.read\n @logger.error(\"connection couldn't be established: %s\" % error)\n end\n @socket.close\n end\n end", "def open_session; end", "def setup\n @current_session = new_session\n end", "def session\n Rack::Test::Session.new(Rack::MockSession.new(FULL_STACK_SYNERGY_APP))\nend", "def session=(_arg0); end", "def set_session\n \n end", "def visit\n open_session do |sess|\n sess.host = 'test.host'\n sess.extend Mephisto::Integration::Actor\n yield sess if block_given?\n end\n end", "def new(*)\n # return new mock session\n BunnyMock::Session.new\n end", "def context(&block); end", "def context(&block); end", "def session\n session = Session.new(self)\n yield(session)\n transaction { session.commit! }\n end", "def setup\n open_session\n end", "def with_session(options = {}, &block)\n # TODO: Add this back in RUBY-3174.\n # assert_not_closed\n\n session = get_session(options)\n\n yield session\n ensure\n if session && session.implicit?\n session.end_session\n end\n end", "def session(params={}, &proc)\n raise \"HornetQ::Client::session mandatory block missing\" unless proc\n session = nil\n begin\n session = create_session(params)\n proc.call(session)\n ensure\n session.close if session\n end\n end", "def get_session\n @session = Session.find(@blocker.session_id)\n end", "def new_session\n\n # Register PhantomJS (aka poltergeist) as the driver to use\n Capybara.register_driver :poltergeist do |app|\n Capybara::Poltergeist::Driver.new(app)\n end\n\n # Start up a new thread\n @session = Capybara::Session.new(:poltergeist)\n\n # Report using a particular user agent\n @session.driver.headers = { 'User-Agent' =>\n \"Mozilla/4.0 (compatible; MSIE 6.1; Windows XP)\" }\n\n # Return the driver's session\n @session\n end", "def build(base_url, &block)\n dsl = AFMotion::SessionClientDSL.new(base_url)\n \n if block_given?\n case block.arity\n when 0\n dsl.instance_eval(&block)\n when 1\n block.call(dsl)\n end \n end\n \n dsl.to_session_manager\n end", "def login_and_run(&block)\n login\n yield self\n logout\n end", "def create_session(name)\n Capybara.using_session(name) do\n sign_in(instance_eval name) unless name == 'guest'\n visit question_path(question)\n end\nend", "def new_session\n # Register PhantomJS (aka poltergeist) as the driver to use\n Capybara.register_driver :poltergeist do |app|\n Capybara::Poltergeist::Driver.new(app, timeout: 60, js_errors: false)\n end\n\n # Use CSS as the default selector for the find method\n Capybara.default_selector = :css\n\n # Start up a new thread\n @session = Capybara::Session.new(:poltergeist)\n\n # Report using a particular user agent\n @session.driver.headers = { 'User-Agent' =>\n \"Mozilla/5.0 (Macintosh; Intel Mac OS X)\" }\n\n # Return the driver's session\n @session\n end", "def new_session\n\n # Register PhantomJS (aka poltergeist) as the driver to use\n Capybara.register_driver :poltergeist do |app|\n Capybara::Poltergeist::Driver.new(app, :phantomjs => Phantomjs.path)\n end\n\n # Use XPath as the default selector for the find method\n Capybara.default_selector = :css\n\n # Start up a new thread\n @session = Capybara::Session.new(:poltergeist)\n\n # Report using a particular user agent\n @session.driver.headers = { 'User-Agent' => \"Mozilla/5.0 (Macintosh; Intel Mac OS X)\" }\n\n # Return the driver's session\n @session\n end", "def sessionize_with(&blk)\n @sessionize = blk if blk\n @sessionize || DEFAULT_SESSIONIZE\n end", "def create_write_and_return_new_session!\n require 'timeout'\n\n session = DropboxSession.new(api_key, api_secret)\n\n # grab the request token for session\n session.get_request_token\n\n template = Backup::Template.new(\n {:session => session, :cached_file => cached_file}\n )\n template.render(\"storage/dropbox/authorization_url.erb\")\n\n # wait for user to hit 'return' to continue\n Timeout::timeout(180) { STDIN.gets }\n\n # this will raise an error if the user did not\n # visit the authorization_url and grant access\n #\n # get the access token from the server\n # this will be stored with the session in the cache file\n session.get_access_token\n\n template.render(\"storage/dropbox/authorized.erb\")\n write_cache!(session)\n template.render(\"storage/dropbox/cache_file_written.erb\")\n\n session\n\n rescue => err\n raise Errors::Storage::Dropbox::AuthenticationError.wrap(\n err, 'Could not create or authenticate a new session'\n )\n end", "def session; @session; end", "def session; @session; end", "def session; @session; end", "def start_session(endpoint); end", "def fixture_session( txn )\n\t\tsession = create_mock( \"session\" )\n\t\ttxn.should_receive( :session ).\n\t\t and_return( session ).zero_or_more_times\n\t\tsession.should_receive( :[] ).and_return( nil ).zero_or_more_times\n\t\tsession.should_receive( :[]= ).and_return( nil ).zero_or_more_times\n\t\t\n\t\treturn session\n\tend", "def execute_in_sandbox(code)\n test_name = \"#{File.dirname(__FILE__)}/am-quoting-test.#{$$}.rb\"\n res_name = \"#{File.dirname(__FILE__)}/am-quoting-test.#{$$}.out\"\n\n File.open(test_name, \"w+\") do |file|\n file.write(<<-CODE)\n block = Proc.new do\n #{code}\n end\n puts block.call\n CODE\n end\n\n system(\"ruby #{test_name} > #{res_name}\") or raise \"could not run test in sandbox\"\n File.read(res_name).chomp\n ensure\n File.delete(test_name) rescue nil\n File.delete(res_name) rescue nil\n end", "def session\n end", "def block_spy\n return nil if !@block_spy && !block\n\n @block_spy ||= BlockSpy.new(actual_block: block)\n end", "def with_block(&block)\n end", "def mys_setup current, &block\n user={id:current.id, token:current.auth_token}\n timer=Time.now\n session[:logged]={user: user, master: user.dup, timer: timer}\n block.call\n end", "def session() request.session end", "def remember(&a_block)\r\n @block = a_block\r\nend", "def temp(tenant_session, &block)\n original = self.tenant_session\n begin\n self.tenant_session = tenant_session\n yield\n ensure\n self.tenant_session = original\n end\n end", "def new(options = {})\n session = with(options)\n session.instance_variable_set(:@cluster, cluster.dup)\n\n if block_given?\n yield session\n else\n session\n end\n end", "def create_block_object(&block)\n block\nend", "def with_login(user = User.first, &block)\n session[:user_id] = user.id\n yield(user)\n session[:user_id] = nil\n end", "def setup\n @env = { Rack::Session::Abstract::ENV_SESSION_KEY => '123456', Rack::Session::Abstract::ENV_SESSION_OPTIONS_KEY => Rack::Session::Abstract::ID::DEFAULT_OPTIONS}\n SmartSessionApp.test_proc = nil\n end", "def test(params={}, &block)\n begin\n open(params)\n yield(driver)\n close\n ensure\n abort_if_not_closed\n end\n end", "def test_subclass_authorization\n new_session do |test|\n test.controller 'really_secure' do\n test.cannot_access 'index'\n bill = test.login :bill\n bill.has_role 'site_admin'\n test.can_access 'index'\n end\n end\n end", "def session\n @connection.request('session-get') do |resp|\n if resp == :connection_error\n yield :connection_error\n else\n yield Session.new(resp)\n end\n end\n end", "def initialize(session); end", "def in_session(another_session)\n old_session = @current_session\n @current_session = another_session\n result = yield @current_session\n @current_session = old_session\n return result\n end", "def session(&block)\n raise ArgumentError, \"#{self.class}#shared_connection must be passed a block\" unless block\n\n begin\n t0 = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n @in_session = true\n if NewRelic::Agent.config[:aggressive_keepalive]\n session_with_keepalive(&block)\n else\n session_without_keepalive(&block)\n end\n rescue *CONNECTION_ERRORS => e\n elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - t0\n raise NewRelic::Agent::ServerConnectionException, \"Recoverable error connecting to #{@collector} after #{elapsed} seconds: #{e}\"\n ensure\n @in_session = false\n end\n end", "def login_with(&blk)\n @login_with = blk if blk\n @login_with\n end", "def valid_session\n {:test => true}\n end", "def create_session\n login, password = get_login_and_password\n create_session_with authenticate_user(login, password, :trace => true)\n end", "def blocks() end", "def create_session\n raise NotImplementedError\n end", "def session\n @session = true\n yield self\n ensure\n @session = false\n stop_smtp\n end", "def start_session\n generate_token(:token)\n setup_session\n update_last_session\n end", "def start_session(params={}, &proc)\n raise \"HornetQ::Client::session mandatory block missing\" unless proc\n session = nil\n begin\n session = create_session(params)\n session.start\n proc.call(session)\n ensure\n session.close if session\n end\n end", "def run_block\n yield\nend", "def define &block\n new block\n end", "def sandbox; end", "def sandbox; end", "def run_block_proc\n yield\nend", "def each_session(&block)\n return enum_for(:each_session) unless block_given?\n s = Cproton.pn_session_head(@impl, 0);\n while s\n yield Session.wrap(s)\n s = Cproton.pn_session_next(s, 0)\n end\n self\n end", "def create_session\n Puppet::HTTP::Session.new(self, build_resolvers)\n 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" ]
[ "0.69773215", "0.6806127", "0.68036616", "0.6680183", "0.6658966", "0.6492243", "0.63686645", "0.6367675", "0.63018733", "0.62494874", "0.62382805", "0.62368846", "0.6220191", "0.619445", "0.6171879", "0.6092804", "0.60893023", "0.608359", "0.608359", "0.608359", "0.608359", "0.6039848", "0.60273737", "0.60241467", "0.6021623", "0.6020151", "0.5996", "0.59959215", "0.59929574", "0.5986127", "0.5986127", "0.59738564", "0.59194547", "0.5888124", "0.5877062", "0.57971835", "0.578297", "0.5769052", "0.5757524", "0.57261276", "0.570972", "0.56907684", "0.5683456", "0.568296", "0.5671256", "0.5671256", "0.5671256", "0.5654353", "0.5652894", "0.56479543", "0.56324565", "0.5631299", "0.5570388", "0.55245465", "0.55230457", "0.55221814", "0.5515411", "0.55102164", "0.5495598", "0.5484624", "0.54763174", "0.5463902", "0.54635465", "0.5454664", "0.5451717", "0.5434452", "0.5418387", "0.5397916", "0.53954375", "0.53771394", "0.53767174", "0.5365529", "0.53653413", "0.5362984", "0.5359197", "0.53585494", "0.5355434", "0.5354487", "0.5354487", "0.5346438", "0.5332584", "0.533252", "0.5325397", "0.5325397", "0.5325397", "0.5325397", "0.5325397", "0.5325397", "0.5325397", "0.5325397", "0.5325397", "0.5325397", "0.5325397", "0.5325397", "0.5325397", "0.5325397", "0.5325397", "0.5325397", "0.5325397", "0.5325397", "0.5325397" ]
0.0
-1
Clears all the sessions.
def clear_session Mack::SessionStore.expire_all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_sessions \n sessions.each do |key, session|\n logger.info \"Closing: #{key}\"\n session.close\n end \n sessions.clear \n reset_password\n end", "def clear_sessions\n session.keys.each do |key|\n session.delete(key) if key =~ /ranmemory_/\n end\n end", "def clear_session\n\t\tsession.clear\n\tend", "def clear_session\n session.clear\n end", "def sessions_reset\n self.sessions_flush\n @sessions = {}\n end", "def clear_session\n\t\tsession[:email] = nil \n\t\tsession[:player_id] = nil\n\t\tsession[:admin] = nil\n\t\tsession[:login_time] = nil \n\tend", "def clear_session\n @session = @login_info = nil\n end", "def clear_session\n rails_controller_instance.reset_session\n end", "def clear_session\n session[:timeout] = nil\n session[:uid] = nil\n end", "def clear_session\n session[:timeout] = nil\n session[:uid] = nil\n end", "def clear_session_keys() #:nodoc:\n @@session_keys.clear\n end", "def clear_upstream_sessions\n upstream_sessions.delete_all\n end", "def clear_all_reviewer_sessions!\n reviewer_access_sessions.delete_all\n end", "def destroy\n self.class.delete_all(\"session_id='#{session_id}'\")\n end", "def clear_session_keys\n ActiveRecord::Base.clear_session_keys\n end", "def clear_session\n session[:timeout] = nil\n session[:user_name] = nil\n session[:real_user_name] = nil\n session[:job_id] = nil\n session[:auth_type] = nil\n cookies.delete :auth_token\n reset_session\n end", "def reset_session!\n raw_session.clear\n end", "def clear_any_logged_in_session\n if logged_in?\n session[:user] = nil\n session[:user_id] = nil\n current_agent = nil\n end\n end", "def delete_all_cookies\n @browser.clear_cookies\n end", "def destroy\n @session.clear\n end", "def clear_all\n clear\n clear_stored_requests\n end", "def cleanup_sessions\n @mutex.synchronize { @sessions.garbage_collect }\n end", "def clear_all\n FileUtils.rm_rf(CACHE_DIR)\n end", "def clear_session\n session[:user_id] = nil\n cookies[:user_id] = nil\n cookies[:password_hash] = nil\n end", "def clear_session\n Rails.logger.debug('SSO: ApplicationController#clear_session', sso_logging_info)\n\n @session_object&.destroy\n @current_user&.destroy\n @session_object = nil\n @current_user = nil\n end", "def clear_session\n session[:player_id] = nil\n cookies[:player_id] = nil\n cookies[:password_hash] = nil\n end", "def logout!\n session.clear\n end", "def clean_sessions\n self.log_puts(\"Cleaning sessions on appserver.\") if @debug\n \n #Clean up various inactive sessions.\n session_not_ids = []\n time_check = Time.now.to_i - 300\n @sessions.delete_if do |session_hash, session_data|\n session_data[:dbobj].flush\n \n if session_data[:dbobj].date_lastused.to_i > time_check\n session_not_ids << session_data[:dbobj].id\n false\n else\n true\n end\n end\n \n self.log_puts(\"Delete sessions...\") if @debug\n @ob.list(:Session, {\"id_not\" => session_not_ids, \"date_lastused_below\" => (Time.now - 5356800)}) do |session|\n idhash = session[:idhash]\n self.log_puts(\"Deleting session: '#{session.id}'.\") if @debug\n @ob.delete(session)\n @sessions.delete(idhash)\n end\n \n #Clean database weak references from the tables-module.\n @db.clean\n \n #Clean the object-handler.\n @ob.clean_all\n \n #Call various user-connected methods.\n @events.call(:on_clean) if @events\n end", "def clear_session\n session[:int_key] = nil\n session[:email] = nil\n session[:password] = nil\n session[:account_id] = nil\n redirect_to root_url\n end", "def reset\n @redis_sessions = nil\n end", "def clear!\n visit(url)\n reset_session!\n end", "def reset_session_counts\n self.session_count = 0\n end", "def clear_all!\n @cache = Cache.new\n end", "def cleanup\n @sessions.each_value do |session|\n session.close if session.expired?\n end\n rescue => e\n log.error(\"Expired session cleanup failed: #{e}\")\n end", "def forget_everything\n empty_session!\n PersistentUser.new(@user).delete\n end", "def invalidate_all_sessions!\n update(session_token: SecureRandom.hex)\n end", "def clear()\n @mutex.synchronize {\n each_object &destroy_block\n @idle_list = []\n @active_list = {}\n }\n end", "def delete_all(session=nil)\n start_kvs_session(session) do |kvs|\n kvs.delete_all\n end\n end", "def logout!\n session.clear\n end", "def logout!\n session.clear\n end", "def reset!\n @sess_hash = {}\n end", "def logout_all\r\n\t\tif(!user_signed_in?)\r\n\t\t\tflash.notice = I18n.t('devise.sessions.already_signed_out')\r\n\t\t\tredirect_to root_path and return\r\n\t\tend\r\n\t\t\r\n\t\tsign_out current_user\r\n\t\tflash.notice = I18n.t('devise.sessions.signed_out')\r\n\t\tredirect_to root_path # also find sessions/tokens from all browsers\r\n\tend", "def clear_cookies\n Logbook.step('Deleting all cookies... (^.^)' + \"\\n\")\n @browser.manage.delete_all_cookies\n end", "def clear_all\n clear_temporary\n clear_objects\n Window.clear\n end", "def delete_session\n session[:userid] = nil\n session[:attributes] = nil\n end", "def clear_all\n data.delete_all\n self\n end", "def clear_cache\n @all = nil\n end", "def clear_users_cache\n GridState.all_users = nil\n end", "def clear_all()\n User.destroy_all\n Hashtag.destroy_all\n Mention.destroy_all\n Tweet.destroy_all\n Follow.destroy_all\n # Hashtag_tweets.destroy_all\nend", "def cache_clear\n @client.flushall\n end", "def clear_session\n session.delete(:token)\n redirect to('/')\n end", "def reset\n session.unset(@name)\n end", "def destroy_all\n all.each(&:destroy)\n end", "def kill_session\n @authenticator.kill_session\n @session = ''\n end", "def reset_session\n # Cancels all scans if any\n @dir_scanner.cancel_all_scans\n # Delete all dirlines\n @main_widget.remove_all_dirlines\n end", "def clear_users\n @users = {}\n end", "def remove\n if empty?\n @session.delete(SESSION_KEY)\n @session.delete(KEPT_KEY)\n end\n end", "def reset!\n @session_key = nil\n end", "def clear_users\n @users = {}\n end", "def reset_sessions\n reset_session_expired_at\n @application_session.update_attributes(\n :expired_at=>session_expired_at\n )\n end", "def destroy\r\n session.clear\r\n redirect_to root_path\r\n end", "def sessions\n SockJS.debug \"Refreshing sessions\"\n\n if @sessions\n @sessions.delete_if do |_, session|\n unless session.alive?\n SockJS.debug \"Removing closed session #{_}\"\n end\n\n !session.alive?\n end\n else\n @sessions = {}\n end\n end", "def clear\n ve 'rm(list=ls())'\n end", "def delete_all\n @configuration = nil\n end", "def delete_all\n @configuration = nil\n end", "def destroy_all\n all.each(&:destroy)\n end", "def reset_session\n Rails.logger.info('SSO: ApplicationController#reset_session', sso_logging_info)\n\n cookies.delete(Settings.sso.cookie_name, domain: Settings.sso.cookie_domain)\n @session_object&.destroy\n @current_user&.destroy\n @session_object = nil\n @current_user = nil\n super\n end", "def kill_session\n session[:session] = false\n session[:sessionToken] = \"\"\n session[:sessionMember] = \"\"\n session[:sessionMV] = \"\"\n session[:sessionOffer] = \"\"\n end", "def destroy\n session.clear\n redirect_to root_path\n end", "def destroy\n session.clear\n redirect_to root_path\n end", "def destroy\n session.clear\n redirect_to root_path\n end", "def destroy\n session.clear\n redirect_to root_path\n end", "def clear!\n @handlers = {}\n @environments = {}\n @requests = []\n end", "def ClearAll\n ClearErrors()\n ClearWarnings()\n ClearMessages()\n ClearYesNoMessages()\n\n nil\n end", "def delete_all_cookies\n $LOG.info \"deleting all cookies\"\n begin\n $driver.manage.delete_all_cookies\n rescue Exception => e\n $LOG.error \"error in deleting cookies :: \" +e.message\n raise \"error in deleting cookies :: \" +e.message\n end\n end", "def clear_all_in_database\n Tweet.destroy_all\n User.destroy_all\n Follow.destroy_all\n end", "def clear_all_in_database\n Tweet.destroy_all\n User.destroy_all\n Follow.destroy_all\n end", "def clear_session\n session.delete :comment_request_params\n session.delete :comment_path_params\n session.delete :hash_id\n end", "def delete_all\n records.clear\n end", "def logout_killing_session!\n logout_keeping_session!\n reset_session\n end", "def clear_login_data\r\n session[:edit_mode] = 0\r\n session[:user_id] = nil\r\n session[:user_name] = nil\r\n session[:user_roles] = nil\r\n cookies.delete :remember_me\r\nend", "def logout\n FlexmlsApi.logger.info(\"Logging out.\")\n delete(\"/session/#{@session.auth_token}\") unless @session.nil?\n @session = nil\n end", "def destroy\n warden.logout\n @session.destroy\n head :no_content\n end", "def clear\n hashed.clear\n list.clear\n end", "def delete_sessions(node)\n @sessions.delete_all(node)\n end", "def destroy\n session.clear\n\n redirect_to root_url\n end", "def cleanup\n @session_id = nil\n end", "def destroy_all\n each(&:destroy_all)\n end", "def clear()\n shutdown()\n @tasks = {}\n _clear()\n end", "def flush_session_channels\n\t\tsession_channels.each_pair { |sid, session|\n\t\t\tsession.close\n\t\t}\n\n\t\tsession_channels = Hash.new\n\tend", "def reset_session!\n request.reset_session\n end", "def reset_session!\n request.reset_session\n end", "def clear\n system 'clear'\n \n end", "def destroy\n\t\t# reset_session will kill the existing session\n\t\treset_session\n\t\tredirect_to '/login'\n\tend", "def clear()\n shutdown()\n @flows = {}\n _clear()\n end", "def logout_killing_session!\n logout_keeping_session!\n reset_session\n end", "def logout\n @session.delete unless @session.nil? # Will close the existing session\n @session = nil\n @challenge = '' # no current session, so no challenge string\n clear_cgi_cookies\n end", "def logout\n session[:user] = nil\n end", "def clear_all_connections!\n disconnect_read_pool!\n @original_handler.clear_all_connections!\n end", "def destroy\n session.clear\n redirect_to '/'\n end" ]
[ "0.8452414", "0.79263383", "0.7830362", "0.7818957", "0.7619269", "0.75342524", "0.7523698", "0.74714786", "0.7399382", "0.7399382", "0.7334237", "0.7311104", "0.72493696", "0.7209435", "0.7172796", "0.7132628", "0.71249425", "0.7069022", "0.7029094", "0.6985302", "0.69773436", "0.6950247", "0.6927897", "0.69211084", "0.68784314", "0.68715477", "0.6852626", "0.68025047", "0.6769278", "0.66826534", "0.6621193", "0.65860313", "0.6556974", "0.6553081", "0.6549303", "0.65409374", "0.6531873", "0.6526948", "0.65082204", "0.65082204", "0.64918965", "0.6461043", "0.6453746", "0.6411967", "0.6402555", "0.6401807", "0.63909954", "0.6385463", "0.63789165", "0.6327967", "0.63117844", "0.6299543", "0.6292961", "0.62877935", "0.6282612", "0.62812525", "0.62791497", "0.62720156", "0.62556076", "0.6249279", "0.62474084", "0.6243669", "0.62421757", "0.62384313", "0.62384313", "0.62310946", "0.62213665", "0.6198442", "0.6188232", "0.6188232", "0.6188232", "0.6188232", "0.61770725", "0.6171737", "0.6157689", "0.6154801", "0.6154801", "0.6150734", "0.61261046", "0.6124193", "0.6120249", "0.61178094", "0.61144996", "0.6111984", "0.6110704", "0.6110088", "0.61041343", "0.6084981", "0.6081726", "0.6079677", "0.60746014", "0.60746014", "0.60742086", "0.60685503", "0.6063531", "0.60555726", "0.60497993", "0.60484844", "0.60453993", "0.60411286" ]
0.8288334
1
Returns a Hash of cookies from the response.
def cookies test_cookies end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cookie_hash\n\t\t\t{ 'Cookie' => @cookies.to_s }\n\t\tend", "def cookies\n HTTY::CookiesUtil.cookies_from_string @headers[COOKIES_HEADER_NAME]\n end", "def to_hash\n cookies = {}\n\n @cookies.each do |cookie|\n cookies[cookie.name] = cookie.value\n end\n\n cookies\n end", "def cookies\n @cookies ||= (self.headers[:set_cookie] || \"\").split('; ').inject({}) do |out, raw_c|\n key, val = raw_c.split('=')\n unless %w(expires domain path secure).member?(key)\n out[key] = val\n end\n out\n end\n end", "def collect_cookies_from_response; end", "def server_cookies(response)\n raw_cookies = response.headers['Set-Cookie']\n return if raw_cookies.blank?\n\n raw_cookies.map { |ck| parse_server_cookie(ck) }\n end", "def get_cookies\n {\n method: \"Page.getCookies\"\n }\n end", "def get_useful_cookies res\r\n set_cookie = res.headers['Set-Cookie']\r\n # Parse the Set-Cookie header\r\n parsed_cookies = CGI::Cookie.parse(set_cookie)\r\n\r\n # Clean up the cookies we got by:\r\n # * Dropping Path and Expires from the parsed cookies -- we don't care\r\n # * Dropping empty (reset) cookies\r\n %w(Path Expires).each do |ignore|\r\n parsed_cookies.delete ignore\r\n parsed_cookies.delete ignore.downcase\r\n end\r\n parsed_cookies.keys.each do |name|\r\n parsed_cookies[name].reject! { |value| value == '\"\"' }\r\n end\r\n parsed_cookies.reject! { |name,values| values.empty? }\r\n\r\n # the cookies always seem to start with CFAUTHORIZATION_, but\r\n # give the module the ability to log what it got in the event\r\n # that this stops becoming an OK assumption\r\n unless parsed_cookies.empty?\r\n vprint_status \"Got the following cookies after authenticating: #{parsed_cookies}\"\r\n end\r\n cookie_pattern = /^CF/\r\n useful_cookies = parsed_cookies.select { |name,value| name =~ cookie_pattern }\r\n if useful_cookies.empty?\r\n vprint_status \"No #{cookie_pattern} cookies found\"\r\n else\r\n vprint_status \"The following cookies could be used for future authentication: #{useful_cookies}\"\r\n end\r\n useful_cookies\r\n end", "def cookies\n WEBrick::Cookie.parse_set_cookies(@headers['set-cookie']) rescue []\n end", "def cookies\n WEBrick::Cookie.parse_set_cookies(headers['Set-Cookie']) rescue []\n end", "def request_headers\n return nil unless @response\n Hash[\n 'Cookie' => %Q!mansession_id=\"#{@response.session_id}\"!\n ]\n end", "def cookies\n request.cookies\n end", "def cookies\n request.cookies\n end", "def cookies\n @agent.cookie_jar.to_a\n end", "def extract(env)\n hash = env[Action::COOKIE_HASH_KEY] ||= {}\n string = env[Action::HTTP_COOKIE]\n\n return hash if string == env[Action::COOKIE_STRING_KEY]\n\n # TODO: Next Rack 1.7.x ?? version will have ::Rack::Utils.parse_cookies\n # We can then replace the following lines.\n hash.clear\n\n # According to RFC 2109:\n # If multiple cookies satisfy the criteria above, they are ordered in\n # the Cookie header such that those with more specific Path attributes\n # precede those with less specific. Ordering with respect to other\n # attributes (e.g., Domain) is unspecified.\n cookies = ::Rack::Utils.parse_query(string, COOKIE_SEPARATOR) { |s|\n begin\n ::Rack::Utils.unescape(s)\n rescue StandardError\n s\n end\n }\n cookies.each { |k, v| hash[k] = v.is_a?(Array) ? v.first : v }\n env[Action::COOKIE_STRING_KEY] = string\n hash\n end", "def cookies\n rack_request.cookies\n end", "def cookies\n @request.cookies\n end", "def extract(env)\n hash = env[COOKIE_HASH_KEY] ||= {}\n string = env[HTTP_HEADER]\n\n return hash if string == env[COOKIE_STRING_KEY]\n # TODO Next Rack 1.7.x ?? version will have ::Rack::Utils.parse_cookies\n # We can then replace the following lines.\n hash.clear\n\n # According to RFC 2109:\n # If multiple cookies satisfy the criteria above, they are ordered in\n # the Cookie header such that those with more specific Path attributes\n # precede those with less specific. Ordering with respect to other\n # attributes (e.g., Domain) is unspecified.\n cookies = ::Rack::Utils.parse_query(string, COOKIE_SEPARATOR) { |s| ::Rack::Utils.unescape(s) rescue s }\n cookies.each { |k,v| hash[k] = Array === v ? v.first : v }\n env[COOKIE_STRING_KEY] = string\n hash\n end", "def cookie_content\n @cookie_content ||= parse_cookie\n end", "def cookie_content\n @cookie_content ||= parse_cookie\n end", "def set_cookies(response)\n cookie_str = response.header['set-cookie']\n return if cookie_str.nil?\n\n fields = cookie_str.split(\"; \").inject({}) { |h, field|\n key, value = field.split(\"=\")\n h[key] = value\n\n h\n }\n\n # This is obviously not a generalized cookie implementation. Heh.\n fields.delete('path')\n @cookies = fields\n end", "def list_all_received_cookies\n cookie_count_hash = {}\n self.owned_cookies.each do |owned_cookie|\n cookie_count_hash[owned_cookie.cookie_recipe_id] = owned_cookie.received_count\n end\n cookie_count_hash\n end", "def cookies\n request.cookies\n end", "def add_cookies(response)\n return unless response.key?('set-cookie')\n response.get_fields('set-cookie').each do |cookie|\n (key, val) = cookie.split('; ')[0].split('=', 2)\n cookies[key] = val\n end\n end", "def get_cookie\n self.headers[\"Cookie\"]\n end", "def get_cookie\n txid = get_txid\n response = send('q' => 'cookie', 'txid' => txid)\n raise 'wrong txid in reply' if response['txid'] and response['txid'] != txid\n response['cookie']\n end", "def cookies # :doc:\n request.cookie_jar\n end", "def cookies # :doc:\n request.cookie_jar\n end", "def cookies\n CookieJar.new(self)\n end", "def cookies\n call_once\n @cookies\n end", "def decode cookie\n data = cookie[@name].to_s\n return empty_hash if data.empty?\n\n sig, str = data.split '/', 2\n return empty_hash unless str\n\n h = nil\n digest = nil\n begin\n sig = decode64 sig\n digest = @dss.digest str\n if @dsa.sysverify(digest, sig)\n str = @cipher_key ? decipher(str) : decode64(str)\n h = JSON.parse str, JSON_DECODE_OPTS\n end\n ensure\n return empty_hash unless h\n end\n\n if h.is_a?(Session)\n h.instance_variable_set :@init_digest, digest\n h.instance_variable_set :@init_data, data\n h\n else\n empty_hash\n end\n end", "def cookie_to_mash(headers)\n if headers && headers.is_a?(Faraday::Utils::Headers)\n cookie = headers_to_mash(headers).set_cookie\n if cookie\n sanitized_cookie = cookie.split(/\\;/).map{|x|\n key,value = x.split(\"=\");\n {key.strip.gsub(/\\W/,\"_\").gsub(/^\\_|\\_$/,\"\").to_sym => value.to_s.downcase.strip}\n }\n return sanitized_cookie.reduce Hashie::Mash.new, :merge\n end\n end\n end", "def extract_cookie(response, uri, login=nil)\n # response['set-cookie'] returns multiple cookies comma-separated,\n # which is difficult to parse since Expires field also uses comma in it.\n # Fortunately, response.get_fields('set-cookie') returns an array of cookies.\n cookies = response.get_fields('set-cookie')\n if cookies.nil?\n puts \"extract_cookie finds no cookie in response\" if (@debug)\n return\n end\n cookiefile = get_cookiefile(login)\n cookies.each do |one_cookie|\n # It doesn't look like it matters for our purposes at the moment, but\n # according to rfc2965, 3.2.2 the Set-Cookie header can contain more\n # than one cookie, separated by commas.\n puts \"extract_cookie processing #{one_cookie}\" if (@debug)\n newcookie = parse_cookie('Set-Cookie: ' + one_cookie)\n next if newcookie.nil?\n\n # Some cookie fields are optional, and should default to the\n # values in the request. We need to insert these so that we\n # save them properly.\n # http://cgi.netscape.com/newsref/std/cookie_spec.html\n if !newcookie[:attributes]['domain']\n puts \"Adding domain #{uri.host} to cookie\" if (@debug)\n newcookie = parse_cookie(newcookie[:line] + \"; domain=#{uri.host}\")\n end\n if !newcookie[:attributes]['path']\n puts \"Adding path #{uri.path} to cookie\" if (@debug)\n newcookie = parse_cookie(newcookie[:line] + \"; path=#{uri.path}\")\n end\n cookies = []\n change = false\n existing_cookie = false\n read_cookiefile(cookiefile).each do |cookie|\n # Remove any existing cookies with the same name, domain and path\n puts \"Comparing #{cookie.inspect} to #{newcookie.inspect}\" if (@debug)\n if cookie[:name] == newcookie[:name] &&\n cookie[:attributes]['domain'] == newcookie[:attributes]['domain'] &&\n cookie[:attributes]['path'] == newcookie[:attributes]['path']\n existing_cookie = true\n if cookie == newcookie\n puts \"Existing cookie is identical to new cookie\" if (@debug)\n else\n # Cookie removed by virtue of us not saving it here\n puts \"Replacing existing but not identical cookie #{cookie.inspect}\" if (@debug)\n cookies << newcookie\n change = true\n end\n else\n puts \"Keeping non-matching cookie #{cookie.inspect}\" if (@debug)\n cookies << cookie\n end\n end\n if !existing_cookie\n puts \"No existing cookie matching new cookie, adding new cookie\" if (@debug)\n cookies << newcookie\n change = true\n end\n if change\n puts \"Updating cookiefile #{cookiefile}\" if (@debug)\n File.open(cookiefile, 'w') { |file| file.puts(cookies.collect{|cookie| cookie[:line]}.join(\"\\n\")) }\n else\n puts \"No cookie changes, leaving cookiefile untouched\" if (@debug)\n end\n end\n end", "def extract_cookie(cookie_val)\n cleaned_val = cookie_val.gsub(/(path=[^,;]+[,;])|(expires=.*)/, ' ')\n cleaned_val.gsub!(/\\s+/, ' ')\n\n if @proxied_cookies.empty?\n return ['', cleaned_val]\n else\n @proxied_cookies.each do |key|\n if match = cleaned_val.match(/#{key}=(?<val>(.*));/i)\n return [key, match[:val]]\n end\n end\n end\n\n ['', '']\n end", "def retrieve_cookie(response, cookie_name)\n value = response.headers['set-cookie'].scan(/#{cookie_name}=[a-zA-Z0-9]+/).first\n value = value[cookie_name.length+1..-1] if value\n end", "def cookies # :doc:\n request.cookie_jar\n end", "def get_session_cookie(response)\n response.get_fields('set-cookie').each do |cookie|\n return cookie if cookie =~ /JSESSIONID/\n end\n end", "def cookies() @_cookies ||= ::Merb::Cookies.new(request.cookies, @_headers) end", "def cookie(cookie)\n raise \"No HTTP-session attached to this thread.\" if !_httpsession\n raise \"HTTP-session not active.\" if !_httpsession.resp\n raise \"Not a hash: '#{cookie.class.name}', '#{cookie}'.\" unless cookie.is_a?(Hash)\n _httpsession.resp.cookie(cookie)\n return nil\n end", "def serialize_into_cookie\n [uid, self.remember_token]\n end", "def unmarshal(cookie)\n if cookie.blank?\n {}\n else\n data, digest = Merb::Parse.unescape(cookie).split('--')\n return {} if data.blank? || digest.blank?\n unless digest == generate_digest(data)\n clear\n unless Merb::Config[:ignore_tampered_cookies]\n raise TamperedWithCookie, \"Maybe the site's session_secret_key has changed?\"\n end\n end\n unserialize(data)\n end\n end", "def cookie_info\n authenticated_crowd_call(:get_cookie_info)\n end", "def unmarshal(cookie)\n if cookie\n data, digest = cookie.split('--')\n return {} if data.blank?\n unless digest == generate_digest(data)\n delete\n raise TamperedWithCookie, \"Maybe the site's session_secret_key has changed?\"\n end\n Marshal.load(Base64.decode64(data))\n end\n end", "def hubssolib_get_secure_cookie_data(name)\n return HubSsoLib::Crypto.decode_object(cookies[name], request.remote_ip)\n end", "def hashcookie\n cookies[daw_cookie_name] && Digest::SHA1.hexdigest(cookies[daw_cookie_name])\n end", "def set_cookie(response)\n\t\ttest_cookie = response.get_fields('set-cookie')\n\n\t\tif @cookie_array.include? test_cookie\n\t\t\t@cookies\n\t\telse\n\t\t\t@cookie_array << test_cookie\n \t\t\t@cookies = @cookie_array.join('; ')\n \t\tend\n\t\t#@cookies = response.get_fields('set-cookie')\n\tend", "def http_cookie\n http.cookie\n end", "def set_api_response_cookie(http_response)\n all_set_cookies = http_response.get_fields('set-cookie')\n return if all_set_cookies.blank?\n\n new_api_cookies = {}\n all_set_cookies.each do |api_cookie|\n api_cookie_elements = api_cookie.split(\"; \")\n cookie_name = ''\n api_cookie_elements.each_with_index do |c_element, i|\n Rails.logger.debug(\"new_api_cookies :: #{c_element.inspect}\")\n c_sub_element = c_element.split('=', 2)\n c_sub_element_key = CGI::unescape(c_sub_element[0])\n c_sub_element_value = CGI::unescape(c_sub_element[1]) if c_sub_element[1].present?\n # Zeroth element is cookie name and value\n if i == 0\n cookie_name = c_sub_element_key\n new_api_cookies[cookie_name] = {value: c_sub_element_value, domain: GlobalConstant::CompanyApi.cookie_domain}\n elsif c_sub_element_key == \"expires\"\n new_api_cookies[cookie_name][c_sub_element_key.to_sym] = Time.zone.parse(c_sub_element_value)\n elsif c_sub_element_key == \"domain\"\n new_api_cookies[cookie_name][c_sub_element_key.to_sym] = c_sub_element_value\n elsif c_sub_element_key == \"secure\"\n new_api_cookies[cookie_name][c_sub_element_key.to_sym] = Rails.env.production?\n elsif c_sub_element_key == \"HttpOnly\"\n new_api_cookies[cookie_name][:http_only] = true\n elsif c_sub_element_key == \"SameSite\"\n new_api_cookies[cookie_name][:same_site] = c_sub_element_value\n else\n new_api_cookies[cookie_name][c_sub_element_key.to_sym] = c_sub_element_value\n end\n\n end\n end\n\n Rails.logger.debug(\"new_api_cookies :: #{new_api_cookies.inspect}\")\n @cookies[GlobalConstant::Cookie.new_api_cookie_key.to_sym] = new_api_cookies\n end", "def cookies(cookies); end", "def get_cookie(data)\n if data['set-cookie']\n t = []\n data['Set-Cookie'].split(\", \").map{|c|\n tmp = c.scan(/([a-zA-Z0-9_\\-\\.]*=[^;]*)/).flatten\n tmp.delete_if{|cc| cc.downcase.include?(\"path\")}\n tmp.delete_if{|cc| cc.downcase.include?(\"expires\")}\n tmp.delete_if{|cc| cc.downcase.include?(\"domain\")}\n t << tmp\n }\n if t.length == 1\n @cookie = @cookie + t.join(\"; \")\n else\n @cookie = t.join(\"; \")\n end\n end\n end", "def cookie\n { :value => Crypt.encrypt(cookie_value), :expires => 1.year.from_now }\n end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def inspect\n \"#<CGI::Cookie: #{self.to_s.inspect}>\"\n end", "def raw_cookie\n env_table[\"HTTP_COOKIE\"]\n end", "def cookies\n @cookies_proxy ||= Class.new do\n attr_reader :controller, :response\n\n def initialize controller\n @controller, @response = controller, controller.response\n end\n\n # set cookie header\n #\n # @param [String, Symbol] key\n # @param [String, Hash] val\n # @return [Boolean]\n def []= key, val\n return if readonly?\n response.set_cookie key, val\n end\n\n # get cookie by key\n def [] key\n controller.orig_cookies[key]\n end\n\n # instruct browser to delete a cookie\n #\n # @param [String, Symbol] key\n # @param [Hash] opts\n # @return [Boolean]\n def delete key, opts ={}\n return if readonly?\n response.delete_cookie key, opts\n end\n\n # prohibit further cookies writing\n #\n # @example prohibit writing for all actions\n # before do\n # cookies.readonly!\n # end\n #\n # @example prohibit writing only for :render and :display actions\n # before :render, :display do\n # cookies.readonly!\n # end\n def readonly!\n @readonly = true\n end\n\n def readonly?\n @readonly\n end\n\n def method_missing *args\n controller.orig_cookies.send *args\n end\n end.new @ctrl\n end", "def cookies; @cookies ||= CookieJar.new; end", "def get_cookies(request_uri, opts = {})\n uri = to_uri request_uri\n hosts = Cookie.compute_search_domains uri\n\n return [] if hosts.nil?\n\n path = if uri.path == ''\n '/'\n else\n uri.path\n end\n\n results = []\n hosts.each do |host|\n domain = find_domain host\n domain.each do |apath, cookies|\n next unless path.start_with? apath\n results += cookies.values.select do |cookie|\n cookie.should_send? uri, opts[:script]\n end\n end\n end\n # Sort by path length, longest first\n results.sort do |lhs, rhs|\n rhs.path.length <=> lhs.path.length\n end\n end", "def decrypt_cookie(cookie)\n servicename, serverip, serverport = parse_cookie(cookie)\n realname = decrypt_service_name(servicename)\n realip = decrypt_server_ip(serverip)\n realport = decrypt_server_port(serverport)\n [realname, realip, realport]\nend", "def cookies_for domain\n @cookies ||= {}\n @cookies[ domain ]\n end", "def get_response\n @response = Net::HTTP.get_response @uri\n # Parse the response body\n response_array = @response.body.split\n @result = {}\n response_array.each do |val|\n # Strip newlines\n val.gsub! /\\r\\n$/, ''\n # If val is not a comment (beginning with ';'),\n # split it on the '=' and add it to the @result\n # hash.\n unless val =~ /^;/\n #x = val.split('=')\n @result.store(val.split('=')[0], val.split('=')[1])\n end\n end\n @result\n end", "def unmarshal(cookie)\n if cookie\n data, digest = cookie.split('--')\n return {} unless digest == generate_digest(data)\n Marshal.load(data.unpack('m').first)\n end\n end", "def get_doc_cookies()\n cookies = nil\n Log.Debug(:h3, \"[GET_COOKIES]\") {\n _check_repl_lock\n _compile_get_cookies\n cookies = exec\n }\n Log.Debug \"{get_cookies} :=> \", cookies\n cookies\n end", "def get_cookies\n if cookies.signed[:name].present? && cookies.signed[:email].present?\n render json: { allow: true, name: cookies.signed[:name], email: cookies.signed[:email] }\n else\n render json: { allow: false }\n end\n end", "def build_cookie_header cookies\r\n cookies.to_a.map { |a| a.join '=' }.join '; '\r\n end", "def [](name)\n name = name.to_s\n @cookies.each do |cookie|\n return cookie.value if cookie.name == name\n end\n nil\n end", "def parse_cookie(line)\n cookie = nil\n if line =~ /^Set-Cookie\\d?: .+=.+/\n cookie = {}\n line.chomp!\n cookie[:line] = line\n # Remove the Set-Cookie portion of the line\n setcookie, rest = line.split(' ', 2)\n # Then break off the name and value from the cookie attributes\n namevalue, rawattributes = rest.split('; ', 2)\n name, value = namevalue.split('=', 2)\n cookie[:name] = name\n cookie[:value] = value\n attributes = {}\n rawattributes.split('; ').each do |attribute|\n attrname, attrvalue = attribute.split('=', 2)\n # The Perl cookie jar uses a non-standard syntax, which seems to\n # include wrapping some fields (particularly path) in quotes. The\n # Perl nVentory library uses the Perl cookie jar code so we need to be\n # compatible with it.\n if attrvalue =~ /^\".*\"$/\n attrvalue.sub!(/^\"/, '')\n attrvalue.sub!(/\"$/, '')\n end\n # rfc2965, 3.2.2:\n # If an attribute appears more than once in a cookie, the client\n # SHALL use only the value associated with the first appearance of\n # the attribute; a client MUST ignore values after the first.\n if !attributes[attrname]\n attributes[attrname] = attrvalue\n end\n end\n cookie[:attributes] = attributes\n else\n # Invalid lines in the form of comments and blank lines are to be\n # expected when we're called by read_cookiefile, so don't treat this as\n # a big deal.\n puts \"parse_cookie passed invalid line: #{line}\" if (@debug)\n end\n cookie\n end", "def list_all_giveable_cookies\n cookie_count_hash = {}\n self.owned_cookies.each do |owned_cookie|\n cookie_count_hash[owned_cookie.cookie_recipe_id] = owned_cookie.giveable_count\n end\n cookie_count_hash\n end", "def headers\n @headers ||= HeaderHash.new(@http_response.to_hash)\n end", "def cookie\n @cookie ||= Coca::AuthCookie.new(cookies, scope)\n end", "def extract_headers(controller_defaults = {})\n defaults = @_cookie_defaults.merge(controller_defaults)\n cookies = []\n self.each do |name, value|\n # Only set cookies that marked for inclusion in the response header. \n next unless @_options_lookup[name]\n options = defaults.merge(@_options_lookup[name])\n if (expiry = options[\"expires\"]).respond_to?(:gmtime)\n options[\"expires\"] = expiry.gmtime.strftime(Merb::Const::COOKIE_EXPIRATION_FORMAT)\n end\n secure = options.delete(\"secure\")\n kookie = \"#{name}=#{Merb::Parse.escape(value)}; \"\n # WebKit in particular doens't like empty cookie options - skip them.\n options.each { |k, v| kookie << \"#{k}=#{v}; \" unless v.blank? }\n kookie << 'secure' if secure\n cookies << kookie.rstrip\n end\n cookies.empty? ? {} : { 'Set-Cookie' => cookies }\n end", "def get_cookie\n cookies[GeventAnalysis::Application::CONSTS[:cookie_name]]\n end", "def cookies\n controller.send(:cookies)\n end", "def check_cookie(response)\n\t\t\t if response.get_fields('set-cookie')\n \t\t\tset_cookie(response)\n \t\t\tprint \"new cookie: \"\n \t\t\tputs response.get_fields('set-cookie')\n \t\t\tputs @cookies\n \t\tend\n\t\tend", "def get_cookie\n resp = @cookie\n if @atl_token != \"\"\n resp = resp + \"; atl.xsrf.token=#{@atl_token}\"\n end\n puts \"Using cookie: #{resp}\".yellow\n resp\n end", "def parse_set_cookie(all_cookies_string)\n cookies = Hash.new\n \n # if all_cookies_string.present?\n # single cookies are devided with comma\n all_cookies_string.split(',').each {\n # @type [String] cookie_string\n |single_cookie_string|\n # parts of single cookie are seperated by semicolon; first part is key and value of this cookie\n # @type [String]\n cookie_part_string = single_cookie_string.strip.split(';')[0]\n # remove whitespaces at beginning and end in place and split at '='\n # @type [Array]\n cookie_part = cookie_part_string.strip.split('=')\n # @type [String]\n key = cookie_part[0]\n # @type [String]\n value = cookie_part[1]\n\n # add cookie to Hash\n cookies[key] = value\n }\n \n cookies\n end", "def get_all_cookies\n browser.all_cookies\n end", "def cookies\n controller.respond_to?(:cookies, true) ? controller.send(:cookies) : nil\n end", "def extract_session_id(response)\n # The Set-Cookie header looks like\n # \"set-cookie\"=>[\"JSESSIONID=16; Path=/; HttpOnly\", \"rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Sat, 17-Aug-2013 23:39:37 GMT\"],\n session_cookie = response['set-cookie']\n unless session_cookie.nil?\n session_cookie.split(';').each do |chunk|\n chunk.strip!\n key, value = chunk.split('=')\n return value if key == 'JSESSIONID'\n end\n end\n nil\n end", "def get_cookie_tracking\n dputs __method__.to_s\n track_req = setup_http_request($tracking, @cookie)\n res = @http.request(track_req)\n get_cookie(res)\n end", "def to_hash\n @headers\n end", "def getCookie()\n return @cookie\n\tend", "def cookies(path=\"/\")\n _cookies(path_to_array(path))\n end", "def auth_cookie\n cookies[:auth]\n end", "def encode_to_cookie h, cookie\n cookie[@name] = encode h\n end", "def cookie\n self[HttpClient::SET_COOKIE]\n end", "def sso_cookie_content\n return nil if @current_user.blank?\n\n {\n 'patientIcn' => (@current_user.mhv_icn || @current_user.icn),\n 'mhvCorrelationId' => @current_user.mhv_correlation_id,\n 'signIn' => @current_user.identity.sign_in.deep_transform_keys { |key| key.to_s.camelize(:lower) },\n 'credential_used' => sso_cookie_sign_credential_used,\n 'expirationTime' => @session_object.ttl_in_time.iso8601(0)\n }\n end", "def render_cookies\n @cookies.keys.sort.each do |flavor|\n count = @cookies[flavor]\n\n Cookies::CookieUtils.instance.\n render_cookies(flavor, count)\n end\n end", "def retrieve(uri)\n # find domains that match first\n domains = @cookies.keys.select{|d| domainmatch(d, uri.host)}\n cookies = []\n \n domains.each do |d|\n @cookies[d].each do |n, c|\n if pathmatch(c.path, uri.path)\n if !expired?(c.expires)\n cookies << c\n else\n # delete expired cookie\n @cookies[d].delete(n)\n end\n end\n end\n end\n \n cookies\n end", "def headers_hash\n @headers_hash ||= Hash[@http_headers.split(\"\\x00\").map{|x| x.split(': ',2)}]\n end", "def cookie_value\n @screen_data.to_json\n end", "def passive\n m=[]\n m << {:name=>\"CAKEPHP Cookie\" } if @headers[\"set-cookie\"] =~ /CAKEPHP=.*/\n m\nend", "def getHMACFromDeleteConfirmationPage(id, cookies)\n url = 'https://news.ycombinator.com/delete-confirm?id=' + id.to_s\n ret = RestClient.get url, :user_agent => \"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)\", :cookies => cookies\n splits = ret.split('\"hmac\" value=\"')\n right_side = splits[1]\n hmac = right_side.split('\"').first\n hmac\nend", "def raw_cookie\n @raw_cookie ||= controller.cookies[\"fbs_#{self.facebook_api_key}\"]\n end", "def parse(set_cookie, options = nil, &block)\n if options\n logger = options[:logger]\n origin = options[:origin] and origin = URI(origin)\n end\n\n [].tap { |cookies|\n set_cookie.split(/,(?=[^;,]*=)|,$/).each { |c|\n cookie_elem = c.split(/;+/)\n first_elem = cookie_elem.shift\n first_elem.strip!\n key, value = first_elem.split(/\\=/, 2)\n\n begin\n cookie = new(key, value.dup)\n rescue\n logger.warn(\"Couldn't parse key/value: #{first_elem}\") if logger\n next\n end\n\n cookie_elem.each do |pair|\n pair.strip!\n key, value = pair.split(/=/, 2) #/)\n next unless key\n value = WEBrick::HTTPUtils.dequote(value.strip) if value\n\n case key.downcase\n when 'domain'\n next unless value && !value.empty?\n begin\n cookie.domain = value\n cookie.for_domain = true\n rescue\n logger.warn(\"Couldn't parse domain: #{value}\") if logger\n end\n when 'path'\n next unless value && !value.empty?\n cookie.path = value\n when 'expires'\n next unless value && !value.empty?\n begin\n cookie.expires = Time.parse(value)\n rescue\n logger.warn(\"Couldn't parse expires: #{value}\") if logger\n end\n when 'max-age'\n next unless value && !value.empty?\n begin\n cookie.max_age = Integer(value)\n rescue\n logger.warn(\"Couldn't parse max age '#{value}'\") if logger\n end\n when 'comment'\n next unless value\n cookie.comment = value\n when 'version'\n next unless value\n begin\n cookie.version = Integer(value)\n rescue\n logger.warn(\"Couldn't parse version '#{value}'\") if logger\n cookie.version = nil\n end\n when 'secure'\n cookie.secure = true\n end\n end\n\n cookie.secure ||= false\n\n # RFC 6265 4.1.2.2\n cookie.expires = Time.now + cookie.max_age if cookie.max_age\n cookie.session = !cookie.expires\n\n if origin\n begin\n cookie.origin = origin\n rescue => e\n logger.warn(\"Invalid cookie for the origin: #{origin} (#{e})\") if logger\n next\n end\n end\n\n yield cookie if block_given?\n\n cookies << cookie\n }\n }\n end" ]
[ "0.73291904", "0.7228556", "0.70573926", "0.6994414", "0.6915405", "0.68847084", "0.6674759", "0.6633787", "0.6632892", "0.6623553", "0.6579321", "0.6466347", "0.644647", "0.6438984", "0.643675", "0.63688904", "0.6267642", "0.62617695", "0.6240928", "0.6240928", "0.62336195", "0.6218025", "0.6119165", "0.6107478", "0.6076383", "0.6062819", "0.59997445", "0.599403", "0.59856427", "0.5973396", "0.5972307", "0.5964865", "0.5959404", "0.5957962", "0.5951943", "0.59398645", "0.59136033", "0.59008986", "0.5894743", "0.5872628", "0.5856194", "0.5825386", "0.5705863", "0.569057", "0.56865954", "0.5686025", "0.5684423", "0.56810105", "0.56807536", "0.56354934", "0.5616893", "0.55800956", "0.55800956", "0.55800956", "0.55800956", "0.55800956", "0.55800956", "0.55800956", "0.55702466", "0.55601317", "0.5547411", "0.55419016", "0.55412894", "0.55402625", "0.5534801", "0.5520412", "0.54892063", "0.54762673", "0.5474028", "0.54570353", "0.5454989", "0.5448792", "0.54256546", "0.54133934", "0.53968024", "0.5395595", "0.53920937", "0.53840667", "0.5378625", "0.5377165", "0.5371028", "0.5370793", "0.5366904", "0.5355581", "0.53477347", "0.5335168", "0.5320341", "0.53200114", "0.5319787", "0.5311141", "0.53081584", "0.5296162", "0.5292869", "0.5276223", "0.5258356", "0.5251461", "0.524641", "0.5242239", "0.5240615", "0.5239772" ]
0.5445784
72
Sets a cookie to be used for the next request
def set_cookie(name, value) test_cookies[name] = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_cookie(cookie=nil)\n self.headers[\"Cookie\"] = cookie\n end", "def set_cookie(response)\n response.set_cookie(Webmetrics::Config.cookie_name, {\n :value => self.id,\n :path => \"/\",\n :expires => Time.now+Webmetrics::Config.cookie_expiration\n })\n end", "def cookie\n self[HttpClient::SET_COOKIE]\n end", "def cookie= cookie_str\n @headers['Cookie'] = cookie_str if @use_cookies\n end", "def cookie= cookie_str\n @headers['Cookie'] = cookie_str if @use_cookies\n end", "def set_cookie(response)\n\t\ttest_cookie = response.get_fields('set-cookie')\n\n\t\tif @cookie_array.include? test_cookie\n\t\t\t@cookies\n\t\telse\n\t\t\t@cookie_array << test_cookie\n \t\t\t@cookies = @cookie_array.join('; ')\n \t\tend\n\t\t#@cookies = response.get_fields('set-cookie')\n\tend", "def set_cookie\n self.current_user.remember\n cookies[:auth_token] = { \n :value => self.current_user.remember_token, \n :expires => self.current_user.remember_token_expires_at }\n end", "def set_cookie!\n cookies[:user_session] = {\n :value => token,\n :secure => controller.request.ssl?,\n :httponly => true,\n :expires => self.expires_at\n }\n end", "def set_cookie(cookie, uri = nil)\n cookie_jar.merge(cookie, uri)\n end", "def set_cookie(env, headers, cookie)\n Utils.set_cookie_header!(headers, @key, cookie)\n end", "def set_cookie(env, headers, cookie)\n request = Rack::Request.new(env)\n if request.cookies[@key] != cookie[:value] || cookie[:expires]\n Utils.set_cookie_header!(headers, @key, cookie)\n end\n end", "def set_cookie(name, value)\n @cookies[\"flexi_#{@id}_#{name}\"] = value\n return value\n end", "def set_cookie(key, value)\n ::Rack::Utils.set_cookie_header!(@_headers, key, value)\n end", "def set_cookie(key, value)\n ::Rack::Utils.set_cookie_header!(@_headers, key, value)\n end", "def set_cookie_value\n cookie_value = User.using_client_shard(client: @client).get_cookie_value(@user.id, @user.password, @browser_user_agent)\n success_with_data({cookie_value: cookie_value, user_token_sale_state: @user.get_token_sale_state_page_name})\n end", "def set_cookies(response)\n cookie_str = response.header['set-cookie']\n return if cookie_str.nil?\n\n fields = cookie_str.split(\"; \").inject({}) { |h, field|\n key, value = field.split(\"=\")\n h[key] = value\n\n h\n }\n\n # This is obviously not a generalized cookie implementation. Heh.\n fields.delete('path')\n @cookies = fields\n end", "def set_cookie(options) #:doc:\n options[\"path\"] = \"/\" unless options[\"path\"]\n cookie = CGI::Cookie.new(options)\n @controller.logger.info \"Cookie set: #{cookie}\" unless @controller.logger.nil?\n @controller.response.headers[\"cookie\"] << cookie\n end", "def setCookies(cookies)\n @fields['cookies'] = cookies\n self\n end", "def setCookies(cookies)\n @fields['cookies'] = cookies\n self\n end", "def set(resource)\n @cookies.signed[cookie_name] = {value: [resource.id, Time.now.to_i]}.merge(cookie_options)\n end", "def set_cookies\n session_key = request.session_options[:id]\n\n if(!session_key.nil?)\n # Set the cookie the standard way (Set-Cookie)\n response.set_cookie(MOBILE_KEY, session_key)\n # Set the cookie the way the Android client expects it (set-cookie)\n headers[\"set-cookie\"] = headers[\"Set-Cookie\"]\n end\n end", "def set_cookie\n puts \"hello\"\n # puts @order.as_json\n puts \"-==-=-=-\"\n puts \"-==-=-=-\"\n puts cookies[:name] = current_admin.name\n puts \"-==-=-=-\"\n puts \"-==-=-=-\"\n end", "def set_cookie(name, value, attributes = {})\n cookie = Webmachine::Cookie.new(name, value, attributes).to_s\n case headers['Set-Cookie']\n when nil\n headers['Set-Cookie'] = [cookie]\n when Array\n headers['Set-Cookie'] << cookie\n end\n end", "def []= key, val\n return if confined?\n @response.set_cookie key, val\n end", "def cookies() @_cookies ||= ::Merb::Cookies.new(request.cookies, @_headers) end", "def add_cookie_if_needed(req)\n req.headers = { \"Cookie\" => conn.headers[\"Cookie\"] } unless conn.headers[\"Cookie\"].nil?\n end", "def stash_cookie\n cookies[self.class.els_options['cookie']] = {\n :value => @els_identity.token_id,\n :domain => request.env[\"SERVER_NAME\"],\n :path => '/',\n :expires => Time.now + 24.hours\n }\n end", "def set_WithCookie(value)\n set_input(\"WithCookie\", value)\n end", "def set_cookie name, value=nil, opts={}\n if Hash === value\n opts = value\n else\n opts[:value] = value\n end\n\n @response.set_cookie name, opts\n end", "def cookie\n @cookie ||= Coca::AuthCookie.new(cookies, scope)\n end", "def set_cookie(name, value, expires)\n (headers['Set-Cookie'] ||=[]) << (Merb::Const::SET_COOKIE % [\n name.to_s, \n ::Merb::Request.escape(value.to_s), \n # Cookie expiration time must be GMT. See RFC 2109\n expires.gmtime.strftime(Merb::Const::COOKIE_EXPIRATION_FORMAT)\n ])\n end", "def cookie=(val)\n @xmlrpc.cookie = val\n end", "def manually_set_cookie(value, expire_in)\n expire_date = expire_in.from_now.gmtime.strftime('%a, %d %b %Y %H:%M:%S GMT')\n response['Set-Cookie'] =\n \"cookiePermissions=#{value}; Expires=#{expire_date}; Path=/; SameSite=Lax\"\n end", "def set_cookie options\n options ||= {}\n \n @header[\"Set-Cookie\"] = options.collect{|key,value|\"#{key}=#{value}\"}.join(\"; \")\n end", "def set_cookie(cookie_name, value, expires, encrypt=false)\n cookie_obj = (encrypt == true) ? cookies.encrypted : cookies\n cookie_obj[cookie_name.to_sym] = {\n value: value,\n expires: expires,\n domain: request.host,\n http_only: true,\n secure: !(Rails.env.development? || Rails.env.staging?),\n same_site: :strict\n }\n end", "def add_cookie(cookie, value = nil)\n @response_cookies ||= {}\n\n if value\n @response_cookies[cookie] = Cookie.new(cookie, value)\n else \n @response_cookies[cookie.name] = cookie\n end\n end", "def set_cookies_for_user(resource)\n cookies[:c_user] = {value: resource.email, expires: 2.year.from_now}\n end", "def add_cookies(response)\n return unless response.key?('set-cookie')\n response.get_fields('set-cookie').each do |cookie|\n (key, val) = cookie.split('; ')[0].split('=', 2)\n cookies[key] = val\n end\n end", "def send_cookie(name, value = nil)\n @context.add_cookie(name, value)\n end", "def set_cookie(email=nil, nav=false)\n if nav\n cookies[\"bunch__nav\"] = {\n value: \"open\", \n expires: 365.days.from_now\n }\n end\n end", "def set_cookie(cookie_name, value, expires)\n cookies[cookie_name.to_sym] = {\n value: value,\n expires: expires,\n domain: GlobalConstant::Base.cookie_domain,\n http_only: true,\n secure: Rails.env.production?,\n same_site: :strict\n }\n end", "def cookie(name, value = nil, duration = 15)\n if value\n response.set_cookie name, { \n :value => value,\n :expires => Time.now + (60 * duration),\n :path => \"/\",\n :httponly => true,\n :secure => production?\n }\n else\n request.cookies[name]\n end\n end", "def set_cookie(name, value, path = '/', httponly = true, secure = true)\n \n cookie = WEBrick::Cookie.new(name, value)\n cookie.path = path\n cookie.httponly = httponly\n cookie.secure = secure\n \n # add cookie to response header\n @header['Set-Cookie'] = cookie.to_s\n end", "def add_set_cookie *ck\n\t\t\tif ck.length > 0\n\t\t\t\th = (@headers[\"Set-cookie\"] ||= [])\n\t\t\t\tck.each {|c| h << c}\n\t\t\tend\n\t\tend", "def set_userid(id)\n response.set_cookie('userid', id)\n end", "def set_cookie_watcher\n @cookie_watcher = CookieWatcher.find(params[:id])\n end", "def store_session(res)\n res.set_cookie(cookie_key, { value: @cookie.to_json, path: '/' })\n end", "def set_uuid_cookie\n uuid = cookies[:uuid] || UUIDTools::UUID.random_create.to_s\n cookies[:uuid] = { value: uuid, expires: 5.years.from_now }\n end", "def set_pickup_cookies!\n if @pickup\n cookies[:pickup_id] = @pickup.id\n cookies[:key] = @pickup.key\n elsif params[:pickup_id] && params[:key]\n cookies[:pickup_id] = params[:pickup_id]\n cookies[:key] = params[:key]\n end\n end", "def set_cookie(name, value, options = {})\n @_options_lookup[name] = options\n self[name] = value\n end", "def <<( cookie )\n\t\t@cookie_set.delete( cookie )\n\t\t@cookie_set.add( cookie )\n\n\t\treturn self\n\tend", "def set_cookie(request_uri, set_cookie_value)\n request_uri = URI.parse(request_uri)\n \n CookieStore::Cookie.parse_cookies(request_uri, set_cookie_value) do |cookie|\n # reject as per RFC2965 Section 3.3.2\n return if !cookie.request_match?(request_uri) || !(cookie.domain =~ /.+\\..+/ || cookie.domain == 'localhost')\n \n # reject cookies over the max-bytes\n return if cookie.to_s.size > MAX_COOKIE_LENGTH\n \n add(cookie)\n end\n end", "def add_to_cookie key, value\n cookie_hash = get_accesses_cookie\n cookie_hash[key] = value\n cookies[:accesses] = cookie_hash.to_json\n end", "def cookie_jar=(cookie_jar); end", "def add(cookie)\n # self\n end", "def set_api_cookie!\n return unless @session_object\n\n session.delete :value\n @session_object.to_hash.each { |k, v| session[k] = v }\n end", "def cookie_jar= cookie_jar\n @agent.cookie_jar = cookie_jar\n end", "def remember!(cookies)\n cookies[:remember_me] = {:value => \"1\",\n :expires => COOKIE_EXPIRATION }\n \n self.authorization_token = unique_identifier\n self.save!\n cookies[:authorization_token] = {:value => self.authorization_token,\n :expires => COOKIE_EXPIRATION }\n end", "def emulate_javascript_set_cookie\n @browser.get(HOST + \"Login.asp\")\n @browser.get(HOST + \"Search.asp\")\n end", "def add_cookie(cookie)\n domain_paths = find_or_add_domain_for_cookie cookie\n add_cookie_to_path domain_paths, cookie\n cookie\n end", "def set_data_in_cookie(data)\n cookies[:merged_response] = {\n :value => data,\n :expires => 1.hour.from_now,\n \n }\n end", "def remember_customer\n if cookies[AppConfig['reference_cookie_name']].nil?\n @affiliate = Affiliate.find_by_slug(params[:slug])\n unless @affiliate.nil?\n @reference = Reference.create(:affiliate_id => @affiliate.id)\n cookies[AppConfig['reference_cookie_name']] = {\n :value => @reference.cookie_token,\n :expires => AppConfig['reference_registration_span'].to_i.days.from_now\n }\n end\n end\n\n redirect_to :action => :pricing\n end", "def store_session(res)\n my_cookie = WEBrick::Cookie.new('_rails_lite_app', @cookies.to_json)\n res.cookies << my_cookie\n end", "def add_token_to_cookie(cookies)\n token = SecureRandom.urlsafe_base64()\n @user.update(token: token)\n cookies['token'] = token\n create_return_object()\n end", "def cookie\n # 'frontend=aaa'\n nil\n end", "def set_login_cookie(crawler_name=nil, crawler_password=nil, ip=nil, date=nil)\n crawler_name ||= @crawler_name\n crawler_password ||= @crawler_password\n ip ||= \"127.0.0.1\"\n date ||= 2.days.from_now\n\n cookie_jar = ActionDispatch::Request.new(Rails.application.env_config.deep_dup).cookie_jar\n cookie_jar.signed[AdsenseCrawlerForPrivate.cookie_name] =\n AdsenseCrawlerForPrivate.cookie_str(crawler_name, crawler_password, date, ip)\n\n cookies[AdsenseCrawlerForPrivate.cookie_name] = cookie_jar[AdsenseCrawlerForPrivate.cookie_name]\n end", "def cookie\n { :value => Crypt.encrypt(cookie_value), :expires => 1.year.from_now }\n end", "def store_session(response)\n attributes = { path: \"/\", value: @cookie.to_json }\n response.set_cookie(APP_NAME, attributes)\n end", "def store_session(res)\n cookie = WEBrick::Cookie.new('_rails_lite_app', @cookie.to_json)\n res.cookies << cookie\n end", "def set_cooky\n @cooky = Cookie.find(params[:id])\n end", "def set_cooky\n @cooky = Cookie.find(params[:id])\n end", "def set_cooky\n @cooky = Cookie.find(params[:id])\n end", "def store_session(res)\n res.set_cookie\n end", "def remember!(cookies)\n cookie_expiration = 10.years.from_now\n cookies[:remember_me] = {:value => \"1\",\n :expires => cookie_expiration}\n self.authorization_token = unique_identifier\n self.save!\n cookies[:authorization_token] = {\n :value => self.authorization_token,\n :expires => cookie_expiration }\n end", "def login_from_cookie\n employee = cookies[:auth_token] && Employee.find_by_remember_token(cookies[:auth_token])\n if employee && employee.remember_token?\n cookies[:auth_token] = { :value => employee.remember_token, :expires => employee.remember_token_expires_at }\n self.current_employee = employee\n end\n end", "def add_cookies!(request)\n request['Cookie'] = @cookies.collect{|k, v| \"#{k}=#{v}\"}.join(\", \")\n end", "def store_session(res)\n res.set_cookie(:_rails_lite_app, {path:'/', value: @cookie.to_json})\n end", "def remember!(cookies)\n\t\tcookie_expiration = 10.years.from_now\n\t\tcookies[:remember_me] = { :value => \"1\",\n\t\t\t\t\t\t\t\t :expires => cookie_expiration}\n\t\tself.authorization_token = secure_unique_identifier \n\t\tsave!\n\t\tcookies[:authorization_token] = {:value => authorization_token,\n\t\t\t\t\t\t\t\t\t\t :expires => cookie_expiration }\n\tend", "def set_acting_user(email)\n `$.cookie('acting_user', #{email}, { path: '/' })`\n end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def []=(name, value)\n if value.is_a?(Hash)\n value = value.collect {|key, val| \"#{key}=#{val.gsub('=', '^^')}\" }.join('|')\n end\n options = { :value => value }\n\n options[:path] = \"/\" unless options.has_key?(:path)\n super(name.to_s, options[:value])\n @controller.response.set_cookie(name, options)\n end", "def store_session(res)\n res_cookie = WEBrick::Cookie.new(\n \"_rails_lite_app\",\n @value.to_json\n )\n\n res_cookie.path = \"/\"\n res.cookies << res_cookie\n end", "def set_api_cookie!\n return unless @session_object\n\n @session_object.to_hash.each { |k, v| session[k] = v }\n end", "def remember!(cookies)\n cookie_expiration = 14.days.from_now\n cookies[:remember_me] = {:value => \"1\",\n :expires => cookie_expiration}\n self.authorization_token = unique_identifier\n save!\n cookies[:authorization_token] = {:value => authorization_token,\n :expires => cookie_expiration}\n end", "def test_affiliate_code_cookie\n # Setup - write cookie\n affil = affiliates(:joes_marketing)\n @request.cookies['affiliate'] = affil.code\n # Exercise\n get :index\n assert_response :success\n # Verify\n assert_kind_of Order, assigns(:order)\n assert_equal affil.code, assigns(:order).affiliate_code\n assert_equal affil, assigns(:order).affiliate\n end", "def remember!(cookies)\n cookie_expiration = 10.years.from_now\n cookies[:remember_me] = { :value => \"1\",\n :expires => cookie_expiration }\n self.authorization_token = unique_identifier\n save!\n cookies[:authorization_token] = { :value => authorization_token,\n :expires => cookie_expiration }\n end", "def install_persistent_cookie(name, cookie)\n cookies[name] = {\n :value => cookie,\n :expires => 10.years.from_now\n }\n end", "def cookies\n call_once\n @cookies\n end", "def set_payment_cookie\n cookies[:payment_in_process] = {\n value: {\n billseq: create_payment_params[:billseq],\n session_id: create_payment_params[:session_id],\n group: create_payment_params[:group]\n }.to_json,\n httponly: true,\n expires: 10.minutes\n }\n end", "def finish(req, res, *)\n res.cookies.finish\n super\n end", "def cookies; @cookies ||= CookieJar.new; end", "def add_cookie(key,value)\n $LOG.info \"adding cookie with key => #{key} and value => #{value}\"\n begin\n $driver.manage.add_cookie(:name => \"#{key}\", :value => \"#{value}\")\n rescue Exception => e\n $LOG.error \"Add Cookie can't be completed \"+e.message\n raise \"Add Cookie can't be completed \"+e.message\n end\n end", "def set_csrf_cookie\n csrf_cookie_key = 'XSRF-TOKEN'\n cookies[csrf_cookie_key] = form_authenticity_token if protect_against_forgery? && current_user\n end", "def bake_vote_cookie_for(question)\n cookies[\"voted_for_#{question.id}\"] = {\n :value => '1',\n :expires => 1.year.from_now # Expire not anytime soon.\n }\n end" ]
[ "0.8014738", "0.7657079", "0.7385363", "0.7276116", "0.7276116", "0.71348566", "0.7131406", "0.71025234", "0.70704186", "0.7029986", "0.7007636", "0.7004252", "0.6968154", "0.6968154", "0.6944519", "0.6941815", "0.69153404", "0.6872882", "0.6872882", "0.6851412", "0.68150866", "0.679238", "0.6750521", "0.67280275", "0.6678446", "0.6641996", "0.6641863", "0.66383517", "0.66068953", "0.6580183", "0.65402514", "0.6537756", "0.65358615", "0.6516421", "0.65154594", "0.65127546", "0.65094", "0.6506026", "0.6473863", "0.64689773", "0.6468557", "0.64652187", "0.6457711", "0.6430415", "0.6428849", "0.64286923", "0.64038044", "0.63984346", "0.6393796", "0.63717157", "0.63585967", "0.6337152", "0.63298404", "0.6326209", "0.6325671", "0.6323583", "0.63050246", "0.628093", "0.62638295", "0.6252978", "0.62491083", "0.62418216", "0.6230337", "0.6222046", "0.6221492", "0.6216656", "0.6215282", "0.62053376", "0.6205315", "0.6183024", "0.6183024", "0.6183024", "0.6181816", "0.61693954", "0.6161062", "0.6132774", "0.6131397", "0.6129987", "0.61241496", "0.6119584", "0.6119584", "0.6119584", "0.6119584", "0.6119584", "0.6119584", "0.6119584", "0.61173284", "0.61150074", "0.6110105", "0.6105001", "0.61037016", "0.6098526", "0.6093028", "0.6087129", "0.60865766", "0.6085901", "0.60743415", "0.60700023", "0.606007", "0.6053767" ]
0.69178516
16
GET /events/1 GET /events/1.json
def show @event = Event.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @event = Event.find(params[:id])\n render json: @event\n end", "def get(event_id)\n @client.request \"events/#{event_id}\"\n end", "def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @user.tenant_id)\n if @event.present?\n render :json => @event\n else\n render :json => {messageCode: \"event.notfound\", message: \"Event Not Found\"}, status: 404\n end\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end", "def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end", "def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end", "def index\n @events = Event.all\n render json: @events, status: 200\n end", "def index\n @event = Event.all\n render json: @event\n end", "def index\n @events = Event.find(:all)\n respond_to do |format|\n format.html\n format.json\n end\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json: @events }\n end\n end", "def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end", "def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def details\n get(\"v1/event/#{@id}\")\n end", "def index\n @events = Event.all\n render json: @events\n end", "def show\n\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @myevent = Myevent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @myevent }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n @event_event = Event::Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_event }\n end\n end", "def index\n event = Event.find(params[:event_id])\n render json: event.route, status: :ok\n end", "def index\n @events = Event.all\n\n render json: @events\n end", "def show\n render json: @event, status: :ok\n end", "def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json do\n render :json => {events: @events}\n end\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.json { render json: @events }\n end\n end", "def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event } \n end\n end", "def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event }\n end\n end", "def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event }\n end\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def show\n render json: @event\n end", "def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json \n end\n end", "def show\n render json: EventSerializer.new(@event).as_json, status: 200\n end", "def event(event, options = {})\n get \"events/#{event}\", options\n end", "def index\n response = { events: Event.all }\n respond_to do |format|\n format.json { render json: response.to_json }\n format.html { render :index }\n end\n end", "def index\n render json: Event.all, status: :ok\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def index\n @events = current_user.events\n\n render json: @events\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def event(id, options = {})\n get \"events/#{id}\", options\n end", "def index\n @events = Event.all\n @event = Event.new\n\n respond_to do |format|\n format.html\n format.json { render 'events/index', events: @events }\n end\n end", "def show\n @event = Event.find(params[:id])\n @client = Client.find(@event.client_id)\n @event_type = EventType.find(@event.event_type_id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end", "def get_event ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}\"\n end", "def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend", "def index\n @event = Event.find(params[:event_id])\n\n end", "def index\n @upcoming_events = Event.upcoming\n @past_events = Event.past\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def show\n \trender json: @event\n end", "def index\n @events = current_user.events\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = getUpcomingEvents()\n \n @page_title = \"Events\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n respond_with(@events)\n end", "def show\n render json: format_event(@event)\n end", "def show\n @current_event = CurrentEvent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @current_event }\n end\n end", "def get_events\n if @user.uuid.present?\n @events = @user.events.active_events.page(params[:page])\n paginate json: @events, per_page: params[:per_page]\n elsif @user.uuid == \"guest\"\n @events = Com::Nbos::Events::Event.active_events.where(tenant_id: @user.tenant_id)\n render json: @events\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def show\n begin\n @event = Event.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n logger.error \"Attempt to show invalid event #{params[:id]}\"\n redirect_to events_path, notice: 'Invalid event ID'\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end\n end", "def index\n @events = @category.events\n render json: @events \n end", "def index\n\t\t@events = Event.all.order('created_at desc')\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render :json => @events }\n\t\tend\n\tend", "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @event, methods: [:talks] }\n end\n end", "def get_events\n response = request(:get, \"/devmgr/v2/events\")\n #status(response, 200, 'Failed to get current events from server')\n #JSON.parse(response.body)\n response\n end", "def index\n if params[:user]\n @events = Event.where(user: params[:user]).first\n else\n @events = Event.all.order('created_at asc')\n end\n\n render json: @events, :only => [:id, :date, :user, :event_type, :message, :otheruser]\n end", "def get_event(session, options={})\n json_request \"get\", {:session => session}, options\n end", "def index\n \n @events = current_user.events\n \n \n respond_to do |format|\n format.html {}\n format.json { render json: Event.events_to_json(@events) }\n end\n end", "def show\n @calendar = Calendar.find(params[:id])\n @events = Event.find(@calendar.event_ids)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @calendar }\n end\n end" ]
[ "0.75029767", "0.74019474", "0.7361382", "0.7348975", "0.73475033", "0.7338018", "0.7317425", "0.72875094", "0.72813755", "0.7246173", "0.72317284", "0.7219172", "0.7219172", "0.7218839", "0.7218839", "0.721464", "0.7204848", "0.71989256", "0.7196662", "0.71925515", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7192214", "0.7190171", "0.7189989", "0.71858066", "0.71843475", "0.71817815", "0.7178166", "0.716525", "0.71637964", "0.7158998", "0.71580267", "0.7120116", "0.7120116", "0.7120116", "0.7120116", "0.7120116", "0.7104676", "0.7098543", "0.70866513", "0.7075021", "0.7071629", "0.70692325", "0.70692325", "0.7067004", "0.70606047", "0.70606047", "0.70606047", "0.70606047", "0.70606047", "0.70606047", "0.70606047", "0.70606047", "0.70606047", "0.70606047", "0.7050251", "0.7043129", "0.70385677", "0.70330113", "0.7027942", "0.7025206", "0.70196456", "0.6993209", "0.69843143", "0.69733816", "0.69682246", "0.69497913", "0.6949218", "0.6943893", "0.6929541", "0.69259447", "0.6922537", "0.69194067", "0.6912311", "0.6893206", "0.689077", "0.687633", "0.6853893", "0.6851784" ]
0.0
-1
POST /events POST /events.json
def create @event = Event.new params[:event] authorize! :manage, @event @event.save! render 'show' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_event event, data={}\n data[:event] = event\n post '/event', data\n end", "def create\n event = Event.new(event_params)\n event.save!\n render json: event\n end", "def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end", "def create\n @event = Event.new(params[:event])\n\n if @event.save\n render json: @event, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def create\n megam_rest.post_event(to_hash)\n end", "def create\n @event = Event.new(event_params)\n\n if @event.save\n \tdata = { data: @event, status: :created, message: \"Event was successfully created.\" }\n render :json => data\n else\n \tdata = { data: @event.errors, status: :unprocessable_entity }\n render :json => data\n end\n end", "def create\n @event = Event.new(event_params)\n if @event.save\n head :created\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def create\n puts params[:event]\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, :notice => 'Event was successfully created.' }\n format.json { render :json => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.json { render :show, status: :created, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.json { render :show, status: :created, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.find_by_authentication_token(params[:auth_token])\n @event = Event.new.from_json(params[:event])\n @event.user_id = @user.id\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n @event.organizer = current_user\n\n if @event.save\n render json: @event, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def save\n event = params\n # This assumes that all keys exists. Yay no error handling...\n toSave = Event.new(update_type: event[:event],\n start_time: event[:payload][:event][:start_time_pretty],\n end_time: event[:payload][:event][:end_time_pretty],\n location: event[:payload][:event][:location],\n invitee_name: event[:payload][:invitee][:name],\n duration: event[:payload][:event_type][:duration],\n event_kind: event[:payload][:event_type][:kind])\n toSave.save\n render json: {}, status: 200\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, :notice => 'Event was successfully created.' }\n format.json { render :json => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: t(:event_created) }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params['user_id'] = current_user.id if current_user\n @event = Event.new(event_params)\n\n if @event.save\n render json: { location: format_event(@event) }, status: :created\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to \"/#{@event.url}\" }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def push_events\n saved = []\n jsonHash = request.POST[:_json];\n jsonHash.each do |jsonEvent|\n event = Event.new\n event.race_id = jsonEvent[\"raceId\"]\n event.walker_id = jsonEvent[\"walkerId\"]\n event.eventId = jsonEvent[\"eventId\"]\n event.eventType = jsonEvent[\"type\"]\n event.eventData = jsonEvent[\"data\"]\n event.batteryLevel = jsonEvent[\"batL\"]\n event.batteryState = jsonEvent[\"batS\"]\n event.timestamp = Time.zone.parse(jsonEvent[\"time\"])\n if event.save # if new\n saved << jsonEvent[\"eventId\"]\n if event.race_id != 0 # if not unknown race_id\n after_create(event)\n end\n else # if exists\n saved << jsonEvent[\"eventId\"]\n puts \"Not Saved!\" # debug print\n puts jsonEvent # debug print \n end\n end\n render :json => {:savedEventIds => saved}\n end", "def create\n result = Event::CreateEvent.perform(event_context)\n\n respond_to do |format|\n if result.success?\n @event = result.event\n format.json { render action: 'show', status: :created }\n else\n format.json { render json: { :errors => result.errors.full_messages }, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n if @event.save\n render :show, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def create\n @event = Events::Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: \"Event #{@event} was successfully created.\" }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: events_path(@event) }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, event: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:event] = convert_datetimes( params[:event] )\n @event = @current_account.events.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # render json: params[:event]\n temp_event = Event.create(\n name: params[:event][:name],\n location: params[:event][:location],\n date: params[:event][:date],\n time: params[:event][:time],\n budget: params[:event][:budget],\n user: current_user\n )\n redirect_to \"/items?event=#{temp_event.id}\"\n end", "def create\n \n @event = Event.new(event_params)\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"Event was successfully created.\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event_event = Event::Event.new(params[:event_event])\n\n respond_to do |format|\n if @event_event.save\n format.html { redirect_to @event_event, notice: 'Event was successfully created.' }\n format.json { render json: @event_event, status: :created, location: @event_event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event_event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to dashboard_home_path }\n format.json { render 'event', status: :created, event: @event }\n else\n format.html { render dashboard_home_path }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n logger.debug @event.errors.inspect\n format.html { redirect_to @event, notice: 'データが新規作成されました。' }\n format.json { render :show, status: :created, location: @event }\n else\n logger.debug @event.errors.to_hash(true)\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to new_event_path, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, flash: {success: 'Event was successfully created.'} }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"Event was successfully created.\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: \"Event was successfully created.\" }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, success: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'El evento fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n flash[:success] = \"Event was successfully created.\"\n format.html { redirect_to @event }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @event = Event.new(event_params)\r\n convert_timezone @event\r\n event_type_status @event\r\n if @event.save_without_exception\r\n update_theme @event\r\n add_event_categories @event\r\n add_event_location @event\r\n create_group_guest_list @event\r\n add_photos @event\r\n # Create Groups and contacts through CSV\r\n contacts_imports\r\n render json: SuccessResponse.new(\r\n code: 200, message: 'Event Created.', location: '/events/List?id=' + @event.id.to_s, eventID: @event.id\r\n ), adapter: :json, status: :ok\r\n else\r\n render json: ErrorResponse.new, adapter: :json, status: :unprocessable_entity\r\n end\r\n end", "def create\n @event = current_user.events.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: t(:event_success) }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_events\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Aula cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to action: :index, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to new_user_event_path(current_user), notice: 'event was successfully created.' }\n format.json\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n @event.url = BASE_URL + @event.name.gsub(' ', '_')\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_event(url, event, payload_type, payload)\n body = {\n :event => event,\n :payload_type => payload_type }\n body[:payload] = payload if payload\n\n http_post(url) do |req|\n req.headers['Content-Type'] = 'application/json'\n req.body = body.to_json\n req.params['verification'] = 1 if event == 'verification'\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = @calendar.events.new(event_params)\n respond_to do |format|\n if @event.save\n format.json { render json: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n flash[:success] = \"Wydarzenie zostało utworzone.\"\n format.html {redirect_to @event}\n format.json {render :show, status: :created, location: @event}\n else\n format.html {render :new}\n format.json {render json: @event.errors, status: :unprocessable_entity}\n end\n end\n end", "def create\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to event_registration_path(id: @event.id), notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @event = Event.new(event_params)\n @event.creator = @current_user\n\n if @event.save\n @event.users.each do |user|\n p \"event user = #{user.name}\"\n user.send_event_push(PushTypes::NEW_EVENT, current_user.to_push, @event.title)\n end\n else\n render json: @event.errors, status: :unprocessable_entity\n return\n end\n end", "def create\n @event = Event.new(event_params)\n if @event.save\n render json: @event, status: 201\n @user_event = UserEvent.create(admin: true, event_id: @event.id, user_id: current_user.id)\n else\n render json: { message: \"Please make sure to fill all required fields.\" }, status: 401\n end\n end", "def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n track_activity @event\n format.html { redirect_to :back, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n after_event_created_mail @event\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @myevent = Myevent.new(params[:myevent])\n\n respond_to do |format|\n if @myevent.save\n format.html { redirect_to @myevent, notice: 'Myevent was successfully created.' }\n format.json { render json: @myevent, status: :created, location: @myevent }\n else\n format.html { render action: \"new\" }\n format.json { render json: @myevent.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7714071", "0.7611226", "0.76028967", "0.7541319", "0.7444731", "0.73206913", "0.73138195", "0.728203", "0.7251226", "0.7235907", "0.7235907", "0.7215051", "0.71682763", "0.7150409", "0.7126664", "0.7118896", "0.7117831", "0.71162695", "0.70964044", "0.70907074", "0.7083036", "0.7081109", "0.7080767", "0.7071589", "0.7057984", "0.70422375", "0.7018503", "0.7018503", "0.7018503", "0.7018503", "0.7018503", "0.7018503", "0.7018503", "0.7018503", "0.7018503", "0.7018503", "0.7018503", "0.7018503", "0.7018503", "0.7016941", "0.70167124", "0.70091015", "0.70081246", "0.6989661", "0.6987218", "0.6970633", "0.6970633", "0.6966775", "0.6948742", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6948119", "0.6942416", "0.6936477", "0.69359535", "0.69359535", "0.69318086", "0.69268054", "0.6907236", "0.6905569", "0.69051725", "0.6904514", "0.6902843", "0.69011873", "0.6899826", "0.68961006", "0.68811166", "0.68746495", "0.68642014", "0.68642014", "0.6843213", "0.68419445", "0.6836244", "0.68352246", "0.6820027", "0.68000513", "0.6791519" ]
0.0
-1
3 7 4 2 4 6 8 5 9 3 That is, 3 + 7 + 4 + 9 = 23. Find the maximum total from top to bottom of the triangle below:
def max_sum_triangle number = "75 95 64 17 47 82 18 35 87 10 20 04 82 47 65 19 01 23 75 03 34 88 02 77 73 07 63 67 99 65 04 28 06 16 70 92 41 41 26 56 83 " number += "40 80 70 33 41 48 72 33 47 32 37 16 94 29 53 71 44 65 25 43 91 52 97 51 14 70 11 33 28 77 73 17 78 39 68 17 57 91 71 52 " number += "38 17 14 91 43 58 50 27 29 48 63 66 04 68 89 53 67 30 73 16 69 87 40 31 04 62 98 27 23 09 70 98 73 93 38 53 60 04 23" # Place triangle in an array which is easier to manipulate @triangle = [] counter = 0 number = number.split(" ") while number.length > 0 counter += 1 row = [] counter.times { row << number.shift } @triangle << row end # Recursion method that returns the greater sum of the current cell and # each of the two adjacent cells in the next row def add_num(row, col) # If last row, simply return the cell number return @triangle[row][col].to_i if row == @triangle.length-1 # Find the adjacent two cells in the next row and add current cell's value a = add_num(row+1,col) + @triangle[row][col].to_i b = add_num(row+1,col+1) + @triangle[row][col].to_i # Return the greater of the two sums return [a,b].max end #Start the recursion at cell 0,0 puts add_num(0,0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_sum(triangle)\n # creating array from data input\n arr = triangle.each_line.map { |line| line.split.map(&:to_i) }\n arr.inject([]) { |res, x|\n maxes = [0, *res, 0].each_cons(2).map(&:max)\n x.zip(maxes).map{ |a, b| a + b }\n }.max\nend", "def compute\n # the position of the largest integer in the current row\n index = 0\n\n # the maximum sum\n maximum_sum = 0\n\n @triangle.each_with_index do |line, line_index|\n # the first line is guaranteed to have 1 number, so that is the initial maximum_sum\n if line_index == 0\n maximum_sum = line[index]\n else\n # get the adjacent integers in the next row\n left_integer = line[index]\n right_integer = line[index + 1]\n # get the maximum integer, add it to the sum, and update the index to point to it\n if left_integer >= right_integer\n maximum_sum += left_integer\n # index stays the same\n else\n maximum_sum += right_integer\n index += 1\n end\n end\n end\n \n maximum_sum\n end", "def minimum_total(triangle)\n return triangle[0][0] if triangle.size < 2\n (triangle.size - 2).downto(0).each { |i|\n 0.upto(triangle[i].size - 1).each { |j|\n triangle[i][j] += [triangle[i + 1][j], triangle[i + 1][j + 1]].min\n }\n }\n \n triangle[0][0]\nend", "def minimum_total(triangle)\n return 0 if !triangle || triangle.empty? || triangle[0].empty?\n return triangle[0][0] if triangle.size < 2\n\n i = triangle.size - 2\n while i >= 0 do \n for j in 0...triangle[i].size do \n triangle[i][j] += [triangle[i + 1][j], triangle[i + 1][j + 1]].min\n end\n end\n\n triangle[0][0]\nend", "def compute(triangle)\n line = 0\n while line < triangle.length-1\n triangle[line+1].each_index do |idx|\n triangle[line+1][idx] += [triangle[line][idx], triangle[line][idx+1]].max\n end\n line += 1\n end\n return triangle[line]\nend", "def solution(a)\n numbers = a.sort\n (0..numbers.length-3).each do |index|\n triplet = numbers[index..index + 2]\n max_value = triplet.max\n sum = triplet.min(2).inject(&:+)\n\n return 1 if sum > max_value\n end\n\n 0\nend", "def triangle_number(nums)\n return 0 if !nums || nums.size < 3\n nums = nums.sort\n ans = 0\n for i in 1...nums.size do \n left = 0\n right = i - 1\n while left < right do \n if nums[left] + nums[right] > nums[i]\n ans += (right - left)\n right -= 1\n else\n left += 1\n end\n end\n end\n ans\nend", "def calc_max(arr)\n max_sum = 0\n arr.each do |line|\n (0..(line.size - 4)).each do |start|\n sum = line[start..(start + 3)].inject(:*)\n max_sum = sum if sum > max_sum\n end\n end\n max_sum\nend", "def cur_max_sum(root)\n return 0 unless root\n left_cur_max = cur_max_sum(root.left)\n right_cur_max = cur_max_sum(root.right)\n cur_max = [left_cur_max, right_cur_max, left_cur_max + right_cur_max, 0].max + root.val\n $maximum = cur_max if cur_max > $maximum\n [left_cur_max, right_cur_max, 0].max + root.val\nend", "def minimum_total(triangle, m = 0, n = 0, memo = {})\n return triangle[m][n] if m == triangle.size - 1\n\n memo[[m+1, n]] ||= minimum_total(triangle, m + 1, n)\n memo[[m+1, n+1]] ||= minimum_total(triangle, m + 1, n + 1)\n\n triangle[m][n] + [memo[[m+1, n]], memo[[m+1, n+1]]].min\nend", "def maximum_total(arr, row = 0, index = 0, total = 0)\n number = arr[row][index]\n total += number\n\n return total if (arr.length - 1) == row\n\n row += 1\n index += 1 if arr[row][index] < arr[row][index + 1]\n\n maximum_total(arr, row, index, total)\n end", "def max_totals(top, bottom)\n top.zip(bottom.each_cons(2)).map { |top, bottom| top + bottom.max }\n end", "def lcss_2(arr)\n largest_num = arr.max\n max_sum = 0\n current_sum = 0\n\n arr.each do |num|\n current_sum += num\n\n if current_sum < 0\n current_sum = 0\n elsif max_sum < current_sum\n max_sum = current_sum\n end\n end\n\n return largest_num if max_sum == 0\n max_sum\nend", "def max_area(height)\r\n max_area = 0\r\n height.each_with_index do |start, idx1|\r\n height.each_with_index do |finish, idx2|\r\n if idx2 > idx1\r\n area = [start, finish].min * (idx2 - idx1) \r\n max_area = area if area > max_area\r\n end\r\n end\r\n end\r\n max_area\r\nend", "def max_total(nums, n)\n\tnums.sort!\n\tnums.reverse!\n\tsum = 0;\n\tn -= 1;\n\t(0..n).each{|n| sum += nums[n]}\n\tsum \nend", "def linear_subsum(arr)\n largest = arr[0] # 5\n current = 0 # -4\n\n (0...arr.length).each do |idx| # 1\n current += arr[idx]\n largest = current if current >= largest\n current = 0 if current < 0\n end\n largest\nend", "def solution(a)\n \n max = 0\n # write your code in Ruby 2.2\n max if a.nil? || a.length == 0\n \n if a.length < 4\n max = 1\n a.each do |item|\n max = max * item\n end\n max\n end\n \n # order first => nlogn + left and right edge max three\n a.sort!\n \n # - - -\n # + + +\n if a[0] >= 0 || a[-1] <= 0 || a[1] >= 0\n max = a[-1] * a[-2] * a[-3]\n max\n end\n \n # n = 4\n max = a[0] * a[1] * a[2]\n max = [max,a[0] * a[1] * a[-1]].max\n max = [max,a[0] * a[-2] * a[-1]].max\n max = [max,a[-3] * a[-2] * a[-1]].max\n max\n end", "def maxArea(height)\n max = 0\n i = 0\n j = height.length - 1\n while i < j\n if height[i] < height[j]\n tmp = height[i] * (j - i)\n i += 1\n else\n tmp = height[j] * (j - i)\n j -= 1\n end\n if tmp > max\n max = tmp\n end\n end\n return max\nend", "def largest_contiguous_subsum(list)\r\n max_val = 0 #8\r\n current_sum = 0 #8\r\n list.each do |num|\r\n current_sum = [0, current_sum + num].max\r\n max_val = [max_val, current_sum].max\r\n end\r\n return max_val\r\nend", "def arith_sum_squares(max)\n max * (max+1) * (2*max+1) / 6\nend", "def greatest_product(n)\r\n\r\n num_array = n.gsub(/\\n/,'').split('').map(&:to_i)\r\n max = 0\r\n i = 0\r\n while i < num_array.length - 13\r\n sum = num_array[i..i+12].reduce(:*)\r\n if sum > max\r\n max = sum\r\n end\r\n i += 1\r\n end\r\n max\r\nend", "def largest_contigous_subsum_ii(list)\n current_sum = list.first\n max = list.first\n (1..-1).each do |i|\n current_sum += list[i]\n current_sum = 0 if current_sum < 0\n max = current_sum if max < current_sum\n end\n current_sum\nend", "def largest_sub_sum_linear(arr)\n largest = arr.first\n current = arr.first\n\n return arr.max if arr.all? { |num| num < 0 }\n i = 1\n\n while i < arr.length\n current = 0 if current < 0\n current += arr[i]\n largest = current if current > largest\n i+=1\n end\n\n largest\n end", "def max_path_sumI arr\n for i in (arr.length-2).downto(0)\n for j in 0...arr[i].length\n arr[i][j] += (arr[i+1][j] > arr[i+1][j+1] ? arr[i+1][j]: arr[i+1][j+1])\n end\n end\n arr[0][0]\nend", "def largest_continous_subsum\n largest = 0\n subsets = []\n\n i = 0\n while i < self.length\n j = i\n while j < self.length\n subsets << self[i..j]\n j += 1\n end\n i += 1\n end\n\n subsets.each do |pair|\n if largest < pair.reduce(:+)\n largest = pair.reduce(:+)\n end\n end\n largest\n\n end", "def calc(arr)\n arr.unshift(0)\n arr.push(0)\n areas = []\n stack = []\n (0...(arr.size)).each do |index|\n if stack.empty? || arr[index] > arr[stack.last]\n # increasing\n stack << index\n else\n # decreased\n while !stack.empty? && arr[stack.last] >= arr[index]\n stack_last_index = stack.pop\n height = arr[stack_last_index]\n if stack.empty?\n width = index + 1 - 2\n else\n width = index - stack.last + 1 - 2\n puts \"width: #{width}, #{index}- #{stack.last}\"\n end\n area = width * height\n puts \"#{arr[stack_last_index]}: #{arr[index]}, area: #{area}\"\n areas << area\n end\n stack << index\n end\n end\n areas.max\n end", "def solution(a)\n # write your code in Ruby 2.2\n return 0 if a.length == 3\n range = a[1...-1]\n min = Float::INFINITY\n max_ending = 0\n range.inject(0) do |max, y|\n if max_ending + y > 0\n max_ending += y\n if min == Float::INFINITY\n max = [max, max_ending].max\n min = y\n else\n min = y if y < min\n max = [max, max_ending - min].max\n end\n else\n max_ending = 0\n min = Float::INFINITY\n end\n max\n end\nend", "def solve(array)\n largest_sum = 0\n\n array.each_with_index do |element, index|\n current_largest_sum = 0\n if element > 0\n current_largest_sum += element\n\n array[index..(-1)].each do |el|\n current_largest_sum += el if el > element\n end\n current_largest_sum -= element\n largest_sum = current_largest_sum if current_largest_sum > largest_sum\n end\n end\n largest_sum\nend", "def largest_cont_sum(array)\n return nil if array.empty?\n \n max_sum = 0\n current_max_sum = 0\n\n array.each do |number|\n current_max_sum = [current_max_sum + number, number].max\n max_sum = [current_max_sum, max_sum].max\n end\n\n max_sum\nend", "def problem_66\n max = [0,0]\n (2..1000).each do |d|\n top,bot = d.sqrt_frac {|t,b| (t*t - d*b*b) == 1}\n next unless top\n max = [max,[top,d]].max\n puts \"#{d} #{top} #{bot}\"\n end\n max[1]\nend", "def better_largest_continous_subsum\n largest = first\n current = first\n switch = false\n each_with_index do |num, idx|\n # debugger\n next if idx == 0\n if switch\n current = num\n largest = current if current > largest\n switch = false\n elsif current + num < current\n if num.abs > current\n switch = true\n else\n current += num\n end\n else\n current += num\n end\n largest = current if current > largest\n end\n largest\n end", "def max_sum_path(arr)\n queue = [[0, 0]]\n n = arr.size\n sums = Array.new(n) { |cell| Array.new(n, -100) }\n sums[0][0] = arr[0][0]\n\n while !queue.empty? do\n row, col = queue.shift\n directions = [[0, 1], [1, 0]]\n directions.each do |drow, dcol|\n nrow, ncol = row + drow, col + dcol\n if nrow.between?(0, n - 1) && ncol.between?(0, n - 1)\n sums[nrow][ncol] = [sums[nrow][ncol], sums[row][col] + arr[nrow][ncol]].max\n queue << [nrow, ncol]\n end\n end\n end\n sums[n - 1][n - 1]\nend", "def largest_contiguous_sub_sum3(arr)\n\n largest_sum = arr.first\n current_sum = arr.first\n\n (1...arr.length).each do |index|\n current_num = arr[index]\n prev_num = arr[index-1]\n\n if largest_sum < current_num\n largest_sum = current_num\n end\n\n current_sum = current_sum + current_num\n prev_sum = prev_num + current_num\n\n if prev_sum > current_sum\n current_sum = prev_sum\n end\n\n if largest_sum < current_sum\n largest_sum = current_sum\n end\n end\n largest_sum\nend", "def solve(nums)\n sorted = nums.sort\n largest = 0\n (0...sorted.length - 1).each do |i|\n if (sorted[i+1] - sorted[i]) > largest\n largest = (sorted[i+1] - sorted[i])\n end\n end\n return largest\n\nend", "def maximum_path_sum(array, number_of_rows)\r\n x = array.map{|num| num.to_i }\r\n new_array = []\r\n j = 0 \r\n number_of_rows.times do |i|\r\n new_array << x.slice(j, i + 1)\r\n j += i + 1\r\n end \r\n new_array = new_array.map{|arr| arr.map{|x| x.to_i}}\r\n new_array = new_array.reverse\r\n \r\n a = new_array[0].each_cons(2).to_a\r\n b = new_array[1]\r\n c = b.zip(a)\r\n d = c.map{|arr| arr[0] + arr[1].max}\r\n\r\n (number_of_rows - 3).times do |i|\r\n a = d.each_cons(2).to_a \r\n d.clear \r\n b = new_array[i + 2]\r\n c = b.zip(a)\r\n d = c.map{|arr| arr[0] + arr[1].max}\r\n end \r\n \r\n return d.max + new_array.last.join.to_i\r\nend", "def largest_contiguous_sub_sum1(list)\n max = list[0]\n (0...list.length).each do |i|\n (i...list.length).each do |j| \n sub_sum = list[i..j].sum \n max = sub if sub >= max \n end\n end\n max\nend", "def largest_consecutive_sum(numbers)\n largest_sum = current_sum = 0\n\n numbers.each do |number|\n current_sum += number\n largest_sum = current_sum if current_sum > largest_sum\n current_sum = 0 if current_sum < 0\n end\n\n return largest_sum\nend", "def largest_contig_subsum(nums)\n max = nil\n nums.each_with_index do |num, i|\n j = i\n while j < nums.length\n if !max || nums[i..j].sum > max\n max = nums[i..j].sum\n end\n j += 1\n end\n end\n max\nend", "def decent_num num\n\n arr = []\n\n if num % 5 == 0\n arr << (\"3\"*num).to_i\n end\n\n num.downto(1).each do |fi|\n th = num - fi\n if th % 5 == 0 && fi % 3 == 0\n arr << (\"5\"*fi + \"3\"*th).to_i\n break\n end\n end\n\n\n if arr.empty?\n -1\n else\n arr.max\n end\n\nend", "def top_to_bottom_approach\n largest_prod_of_all_cols = 0\n for each_row in (0..15)\n for each_col in (0..19)\n curr_prod_in_col = $grid_of_numbers[each_row][each_col] * $grid_of_numbers[each_row + 1][each_col] * $grid_of_numbers[each_row + 2][each_col] * $grid_of_numbers[each_row + 3][each_col]\n if curr_prod_in_col > largest_prod_of_all_cols\n largest_prod_of_all_cols = curr_prod_in_col\n end\n end\n end\n \n return largest_prod_of_all_cols\nend", "def opt_max_sum(arr)\n result = -1000\n (0...arr.length).each do |start|\n sum = 0\n (1..arr.length).each do |size|\n if start + size > arr.length\n break\n end\n sum += arr[start + size - 1]\n if sum > result\n result = sum\n end\n end\n end\n return result\nend", "def find_max(array)\n max = 0\n array.each do |subarray|\n subarray.each_cons(4) do |chunk|\n product = quad_product(chunk)\n max = product if product > max\n end\n end\n max\n end", "def find_largest_product(array)\n start = 0\n finish = 3\n greatest = 0\n \n until finish > 19 || finish > array.size do\n sum = array[start..finish].reduce{ |product, n| product * n }\n greatest = sum if sum > greatest\n start += 1\n finish += 1\n end\n greatest\n end", "def triangle(a)\n a.sort!\n \n (a.length - 1).downto(2).each do |i|\n return 1 if a[i-1] + a[i-2] > a[i]\n end\n return 0\nend", "def largest_rectangle_area(heights)\n n, ans = heights.size, -Float::INFINITY\n (0..n-1).each do |i|\n min = heights[i]\n (i..n-1).each do |j|\n min = [min, heights[j]].min\n ans = [ans, min*(j-i+1)].max\n end\n end\n ans\nend", "def largest_contiguous_subsum(arr)\n max = arr[0]\n current = 0\n (0...arr.length).each do |i|\n current += arr[i]\n max = current if current > max\n current = 0 if current < 0\n end\n max\nend", "def checkTriangleNum(limit)\n\tnum = [1]\n\tcount = 1\n\tmultiples = 1\n\n\tuntil multiples > limit\n\t\ttriangle_num = num.inject(:+)\n\t\tmultiples = findMultiples(triangle_num)\n\n\t\tif multiples <= limit\n\t\t\tcount += 1\n\t\t\tnum << count\n\t\tend\n\tend\n\ttriangle_num\nend", "def solution2(a)\n\n total_max, current_max = a[0], 0\n\n a.each do |int|\n current_max = [current_max + int, int].max\n total_max = [total_max, current_max].max\n end\n\n return max\n\nend", "def sub_max(array)\n so_far = array[0]\n max_point = array[0] # [0] -2 and [1] 1 sum -1, number 1\n\n array.each do |number|\n # to find the max between the two values:\n max_point = max((number + max_point), number)\n so_far = max(max_point, so_far)\n end\n\n return so_far\nend", "def max_path_sum(root)\n @max = -999999\n max_path_recursive(root)\n return @max\nend", "def largest_contiguous_subsum(list)\n prev_max = -9999999999999\n new_max = 0\n list.each do |ele|\n new_max += ele\n prev_max = new_max if prev_max <= new_max\n new_max = 0 if new_max < 0 # Reset\n end\n prev_max\nend", "def pyramid_height(cost, total)\n cans = total / cost\n i = 0\n sum = 0\n while sum + (i+1)**2 <= cans\n i += 1\n sum += i**2\n end\n i\nend", "def triangle_num\n\ndivisors = 0\nn = 2\n\nuntil divisors > 500\n\tsum = 0\n\t(1..n).to_a.each do |x| sum += x end\n\t(1..sum - 1).to_a.each do |y|\n\t\tif sum % y == 0\n\t\t\tdivisors += 1\n\t\t\tif divisors > 500 \n\t\t\t\treturn sum\n\t\t\tend\n\t\tend\n\tend\ndivisors = 0\nn += 1\nend\nend", "def pascals_triangle(num)\n triangle = [[1]]\n\n while triangle.length < num\n above = triangle.last\n next_level = [1]\n next_level += adjacent_sums(above)\n next_level << 1\n triangle << next_level\n end\n triangle\nend", "def max_sum_dp(matrix)\n return 0 if matrix.length < 1 || matrix[0].length < 1\n\n rows = matrix.length\n cols = matrix[0].length\n\n # start row,col end row, end col\n dp = Array.new(rows) { Array.new(cols) { Array.new(rows) { Array.new(cols, 0) } } }\n\n max = -Float::MAX\n rows.times do |sr|\n cols.times do |sc|\n sr.upto(rows - 1).each do |er|\n sc.upto(cols -1).each do |ec|\n dp[sr][sc][er][ec] = matrix[er][ec]\n # rect above\n if er > 0\n dp[sr][sc][er][ec] += dp[sr - 1][sc][er - 1][ec]\n end\n # rect left\n if ec > 0\n dp[sr][sc][er][ec] += dp[er][sc][er][ec - 1]\n end\n max = [max, dp[sr][sc][er][ec]].max\n end\n end\n end\n end\n\n max\nend", "def largest_contiguous_subsum(nums)\n running_sum = 0\n max = nums.first || 0\n\n nums.each do |n|\n running_sum += n\n max = running_sum if max < running_sum\n running_sum = 0 if running_sum < 0\n end\n max\nend", "def largest_contiguous_subsum_2(arr)\n sum = 0\n max = 0\n arr.each do |num|\n sum += num\n if sum > 0\n max = sum if sum > max\n else\n sum = 0\n end\n end\n max\nend", "def largest_contiguous_subsum(arr)\n\n largest_sum = 0 # 3\n current_sum = 0 # 1\n arr.each do |el| # 1 ,2,-4, 4,-3,4\n if current_sum + el > largest_sum # \n current_sum += el \n largest_sum = current_sum # \n elsif current_sum + el < 0\n current_sum = 0\n else\n current_sum += el\n end\n end\n largest_sum\n\nend", "def max_sub_array(nums)\n current_sum = nil\n max_sum = nil\n \n nums.each do |n|\n if current_sum.nil?\n current_sum = n\n elsif current_sum + n < n\n current_sum = n\n else\n current_sum = current_sum + n\n end\n max_sum = current_sum if max_sum.nil? || current_sum > max_sum\n end\n max_sum\nend", "def find_max_upper_dia(matrix, x, y, count)\n if count > 4\n return 1\n end\n\n return safe_access(x, y, matrix) * find_max_upper_dia(matrix, x+1, y-1, count+1)\nend", "def pascals_triangle(num)\n triangle = [[1]]\n while triangle.length < num\n level_above = triangle.last\n next_level = [1]\n next_level += adjacent_sums(level_above)\n next_level << 1\n triangle << next_level\n end\n triangle\nend", "def largest_sum_arr_n2(arr)\n list = []\n i = 0\n while i < arr.length\n j = i\n while j < arr.length\n list.push arr[i..j]\n j += 1\n end\n i += 1\n end\n\n result = nil\n max = nil\n list.each do |a|\n current_sum = a.inject(:+)\n if max.nil? || current_sum > max\n result = a\n max = current_sum\n end\n end\n result\nend", "def hourglassSum(a)\n hour_glass_sums = []\n (0..3).each do |i|\n (0..3).each do |j|\n hour_glass_sums << [a[i][j], a[i][j + 1], a[i][j + 2], a[i + 1][j + 1], a[i + 2][j], a[i + 2][j + 1], a[i + 2][j + 2]].reduce(&:+)\n end\n end\n hour_glass_sums.max\nend", "def triangle_sum(n)\n (n * (n + 1))/2\nend", "def better_largest_cont_sum(array)\n largest = 0\n current = 0\n\n array.each do |n|\n current += n\n largest = current if current > largest\n current = 0 if current < 0\n end\n\n largest\nend", "def maxsum(l, u, x)\n if l > u # Zero elements\n return 0\n end\n if l == u # One element\n return [0, x[l]].max\n end\n\n m = (l + u) / 2\n # Find max crossing to left\n lmax = 0\n sum = 0\n m.downto(l) do |i|\n sum += x[i]\n lmax = [lmax, sum].max\n end\n # Find max crossing to the right\n rmax = 0\n sum = 0\n for i in m+1..u\n sum += x[i]\n rmax = [rmax, sum].max\n end\n\n return [lmax+rmax, maxsum(l, m, x), maxsum(m+1, u, x)].max\nend", "def greatHorizon numba\n movenum = 0\n greatproduct = 0\n while movenum < numba.length-3 do\n production = numba[movenum].to_i\n 1.upto(3) do |i|\n production *= numba[movenum+i].to_i\n # puts production\n end\n greatproduct = production if production > greatproduct\n movenum+=1\n end\n return greatproduct\nend", "def largest_contiguous_subsum(array)\r\n max = array.first \r\n current_sum = 0\r\n array.each do |ele|\r\n current_sum += ele\r\n max = current_sum if current_sum > max\r\n current_sum = 0 if current_sum < 0\r\n end\r\n max\r\nend", "def greatest_product(n)\n idx = 0\n largest_product = 0\n\n loop do\n sum = n[idx, 5].chars.map(&:to_i).inject { |mem, num| mem * num }\n largest_product = sum if sum > largest_product\n idx += 1\n break if idx >= n.length - 4\n end\n largest_product\nend", "def largest_continguous_subsum(arr)\n largest_sum = arr.first\n current_sum = arr.first\n \n (1...arr.length).each do |i|\n current_sum += arr[i]\n if current_sum > largest_sum\n largest_sum = current_sum\n elsif current_sum < 0\n current_sum = 0\n end\n end\n largest_sum\nend", "def best_largest_contiguous_subsum(arr)\n return arr.max if arr.max < 0\n largest = 0\n current = 0\n\n\n (0..(arr.length-1)).each do |idx1|\n if current + arr[idx1] < 0\n current = arr[idx1]\n else\n current += arr[idx1]\n end\n\n largest = current if current > largest\n end\n largest\nend", "def max_sum_linear(data)\n if data[0] > data[1]\n biggest = data[0]\n secondBiggest = data[1]\n else\n biggest = data[1]\n secondBiggest = data[0]\n end\n\n (2..data.length-1).each do |i|\n if data[i] > secondBiggest && data[i] < biggest\n secondBiggest = data[i]\n elsif data[i] >= biggest\n secondBiggest = biggest\n biggest = data[i]\n end\n end\n return biggest + secondBiggest\nend", "def miniMaxSum(arr)\n arr.sort!\n sum = 0\n arr.each {|item| sum+=item}\n puts \"#{sum-arr[-1]} #{sum-arr[0]}\"\nend", "def largest_contiguous_subsum(list)\n current_max = list[0]\n current_sum = list[0]\n\n (1...list.size).each do |i|\n current_sum += list[i]\n if current_sum > current_max\n current_max = current_sum\n end\n\n if current_sum < 0 \n current_sum = 0\n end\n \n end\n\n current_max\nend", "def solution(a)\n n = a.size\n starting = Array.new(n, 0)\n ending = Array.new(n, 0)\n\n (1..n - 2).each {|i| starting[i] = [starting[i - 1] + a[i], 0].max}\n (1..n - 2).reverse_each {|i| ending[i] = [ending[i + 1] + a[i], 0].max}\n\n sum = 0\n (1..n - 2).each {|i| sum = [sum, starting[i - 1] + ending[i + 1]].max}\n sum\nend", "def largest_adjacent_sum(string)\n string_arry = string.split(\"\")\n largest_adjacent = 0\n index_start = 0\n final = string.size - 13\n while index_start <= final do\n product = string_arry.slice(index_start,13).inject{|x,y| x.to_i * y.to_i}\n if product > largest_adjacent\n largest_adjacent = product\n end\n index_start += 1\n p index_start\n end \n largest_adjacent\n end", "def vertical_max(grid, rows, cols, length)\n max = 0\n # For each column\n (0...cols).each do |x|\n # Each entry in the column\n ((length-1)...rows).each do |y|\n # Multiply that entry and the length-1 entries before it and compare\n p = ((y-length+1)..y).inject(1) {|product, i| product * grid[i][x]}\n max = p if max < p\n end\n end\n max\n end", "def valid_triangle?(a,b,c)\n if a != 0 && b != 0 && c != 0\n if a >= b\n largest = a \n sum = b \n else largest = b\n sum = a\n end\n \n if c > largest \n sum += largest \n largest = c \n else sum = c\n end\n\n if sum >= largest \n return \"true\"\n else return \"false\"\n end\n\n else\n return false\n end\nend", "def area_of_triangle(base, height)\n (base * height) / 2\nend", "def optimized_largest_subsum(arr)\n max = arr.first\n sum = arr.first \n arr.shift\n arr.each do |el|\n sum += el\n if el > max && el > sum \n max = el \n sum = el \n elsif sum > max\n max = sum\n end \n end \n max\nend", "def largest_contiguous_subsum(arr)\n max = 0\n\n (0...arr.count).each do |i|\n sum = arr[i]\n (i + 1...arr.count).each do |j|\n sum += arr[j]\n max = sum if max < sum \n end \n end \n\n max\nend", "def largest_contiguous_subsum_good(arr) \n last_max = arr.first\n current_max = 0\n arr.each do |num|\n temp_sum = current_max + num\n if temp_sum < 0\n last_max = current_max if temp_sum > last_max\n else\n if temp_sum > last_max\n last_max = temp_sum\n end\n end\n if num > temp_sum\n current_max = num\n else\n current_max = temp_sum\n end\n end\n last_max\nend", "def triangles(a)\n a.sort!\n triangles = 0\n n = a.size\n n.times do |x|\n z = x + 2\n (x + 1..n - 1).each do |y|\n puts \"x: #{x}, y: #{y}\"\n while z < n && a[x] + a[y] > a[z]\n puts \"#{a[x]} + #{a[y]} > #{a[z]}\"\n puts \"z: #{z}\" \n z += 1\n end\n triangles += z - y - 1\n puts \"triangles: #{triangles}\"\n end\n end\n triangles\nend", "def sum_square_difference(max_num: 100)\n diff = 0\n num_set = (1..max_num).to_a.reverse\n set_sum = num_set.inject(:+)\n until num_set.length == 1\n foo = num_set.pop\n set_sum -= foo\n diff += 2 * foo * set_sum\n end\n puts diff\nend", "def maximum_difference(v)\n\n integral_sum = [0]\n max = 0\n for index in (0..v.length-1) do\n integral_sum.push(integral_sum[index] + v[index])\n end\n\n for seq_len in (1..v.length-1) do\n for left_side in (0..(v.length-seq_len-1)) do\n sum_l = integral_sum[seq_len+left_side] - integral_sum[left_side]\n sum_l_abs = sum_l.abs\n for right_side in (left_side+seq_len..(v.length-seq_len)) do\n sum_r = integral_sum[right_side + seq_len] - integral_sum[right_side]\n sum_r_abs = sum_r.abs\n dif = sum_l_abs + sum_r_abs\n if dif > max\n max = dif\n end\n end\n end\n end\n puts \"#{max}\"\nend", "def largest_contiguous_subsum_two(list)\n largest_sum = list[0]\n current_sum = 0\n # list.inject {|acc, ele| acc + ele}\n list.each do |ele|\n current_sum = [ele, current_sum + ele].max\n largest_sum = [largest_sum, current_sum].max\n end\n largest_sum\nend", "def diagonal_max(grid, rows, cols, length)\n max = 0\n # For each column\n ((length-1)...rows).each do |y|\n # Each entry in the column\n ((length-1)...cols).each do |x|\n # Multiply that entry and the length-1 entries before it and compare\n p = (0...length).inject(1) {|product, i| product * grid[y-i][x-i]}\n max = p if max < p\n end\n end\n (0...(rows-length)).each do |y|\n # Each entry in the column\n ((length-1)...cols).each do |x|\n # Multiply that entry and the length-1 entries before it and compare\n p = (0...length).inject(1) {|product, i| product * grid[y+i][x-i]}\n max = p if max < p\n end\n end\n max\n end", "def largest_sum_better(arr)\n largest_sum = arr.first\n current = arr.first\n\n (1...arr.length).each do |idx|\n if current < 0\n current = 0\n end\n\n current += arr[idx]\n \n if current > largest_sum\n largest_sum = current\n end\n end\n\n largest_sum\nend", "def largest_contiguous_subsum2(arr)\n max = arr[0]\n current = arr[0]\n arr.drop(1).each do |num|\n current += num\n max = current if current > max\n current = 0 if current < 0\n end\n max\nend", "def water_area(heights)\n maxes = Array.new(heights.length, 0)\n\n left_max = 0\n (0...heights.length - 1).each do |i|\n height = heights[i]\n maxes[i] = left_max\n left_max = [left_max, height].max\n end\n\n right_max = 0\n (heights.length - 1...0).each do |i|\n height = heights[i]\n min_height = [right_max, maxes[i]].min\n maxes[i] = if height < min_height\n min_height - height\n else\n 0\n end\n right_max = [right_max, height].max\n end\n p maxes\n maxes.sum\nend", "def largest_cont_subsum(list)\n biggest = list[0]\n current = 0\n\n (0...list.length).each do |i|\n current += list[i]\n biggest = current if current > biggest\n end\n biggest\nend", "def largest_contigious_subsum(list)\n debugger\n lcs = list[0] \n current_sum = list[0]\n puts lcs\n list.each_with_index do |num, i|\n current_sum += list[i + 1]\n if current_sum > lcs \n lcs = current_sum\n end\n end\n lcs \nend", "def highest_number_in_box n\n return 1 if n == 1\n highest_number_in_box(n - 1) + (8 * (n-1))\nend", "def max_sub_array(arr)\n current_sum = arr[0]\n max_sum = current_sum\n\n arr[1..-1].each do |num|\n current_sum = [num, current_sum + num].max\n max_sum = [max_sum, current_sum].max\n end\n\n return max_sum\nend", "def largest_continuous_subsum(list)\n curr_sum = 0\n max_sum = list.first\n list.each do |el|\n curr_sum += el\n if curr_sum > max_sum\n max_sum = curr_sum\n end\n\n if curr_sum < 0\n curr_sum = 0\n end\n end\n max_sum\nend", "def solve_c(arr)\n maxsum = 0\n sum = 0\n\n arr.size.times do |i|\n sum += arr[i]\n\n if maxsum < sum\n maxsum = sum\n elsif sum < 0\n sum = 0\n end\n end\n\n maxsum\n end", "def highest_height\n i = acc.reverse.find_index{|i|!i.nil?}\n i ||= 0\n acc.length - i\n end", "def newSolve(total)\n\tmaxNumberUp = Math.log2(total).floor\n\n\tif numberOfOnes(total+1)==1\n\t\tmaxNumberUp+=1\n\tend\n\n\tmaxUp = 2**maxNumberUp\n\n\n\tmaximo = maxNumberUp + numberOfOnes(total-(maxUp-1))\n\treturn maximo\nend", "def maxNonAdjacentSum(nums)\n table = Array.new(nums.length).fill(0)\n table[0] = nums.first\n\n table.each_with_index do |entry, idx|\n next if idx == 0\n skip_left = table[idx - 2] == nil ? 0 : table[idx - 2]\n sum = skip_left + nums[idx]\n prev_sum = table[idx - 1]\n table[idx] = [sum, prev_sum].max\n\n end\n table.last\nend", "def largest_contiguous_subsum(arr)\r\n # sub_arr = []\r\n # (0...arr.length).each do |idx|\r\n # (idx...arr.length).each do |idx_2| \r\n # sub_arr << arr[idx..idx_2]\r\n # end\r\n # end\r\n # p sub_arr.length \r\n # sub_arr.map {|sub| sub.sum }.max\r\n max = arr.first #8\r\n curr = arr.first #8\r\n arr.drop(1).each do |ele| \r\n curr = 0 if curr < 0\r\n curr += ele\r\n max = curr if curr > max\r\n end\r\n max\r\nend" ]
[ "0.78049827", "0.7743565", "0.74132496", "0.7371364", "0.7051928", "0.69517654", "0.6834016", "0.6772471", "0.66732824", "0.6659748", "0.6641187", "0.6624022", "0.66204375", "0.6611804", "0.6606299", "0.65959936", "0.6594553", "0.65886986", "0.6586475", "0.6581508", "0.6577513", "0.65617156", "0.6549082", "0.65411216", "0.6513044", "0.65090555", "0.6502298", "0.6496283", "0.64902806", "0.64800376", "0.6468353", "0.6450845", "0.64429283", "0.6439272", "0.64358985", "0.6433517", "0.64282703", "0.6426756", "0.64230275", "0.6416592", "0.64146185", "0.6414344", "0.64124286", "0.64108044", "0.64105034", "0.6409841", "0.64039725", "0.6402504", "0.6402274", "0.64018106", "0.6400542", "0.63989973", "0.63967395", "0.6391596", "0.6382591", "0.63692147", "0.6369169", "0.6359106", "0.6349968", "0.6343262", "0.6343182", "0.6332221", "0.63273036", "0.6325407", "0.63216263", "0.632059", "0.6318014", "0.63178945", "0.63178575", "0.63132256", "0.6310594", "0.63002527", "0.6299534", "0.62994164", "0.6289991", "0.62878215", "0.6286702", "0.62864834", "0.62854743", "0.6277482", "0.62696284", "0.62686807", "0.6265686", "0.626083", "0.6258708", "0.6251636", "0.6250978", "0.6248335", "0.6238748", "0.62373346", "0.6236176", "0.6233144", "0.62309515", "0.62217844", "0.6220136", "0.6210773", "0.6209321", "0.62064576", "0.62060475", "0.6203787" ]
0.8145354
0
Recursion method that returns the greater sum of the current cell and each of the two adjacent cells in the next row
def add_num(row, col) # If last row, simply return the cell number return @triangle[row][col].to_i if row == @triangle.length-1 # Find the adjacent two cells in the next row and add current cell's value a = add_num(row+1,col) + @triangle[row][col].to_i b = add_num(row+1,col+1) + @triangle[row][col].to_i # Return the greater of the two sums return [a,b].max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_sum_triangle\r\n\r\n\tnumber = \"75 95 64 17 47 82 18 35 87 10 20 04 82 47 65 19 01 23 75 03 34 88 02 77 73 07 63 67 99 65 04 28 06 16 70 92 41 41 26 56 83 \"\r\n\tnumber += \"40 80 70 33 41 48 72 33 47 32 37 16 94 29 53 71 44 65 25 43 91 52 97 51 14 70 11 33 28 77 73 17 78 39 68 17 57 91 71 52 \"\r\n\tnumber += \"38 17 14 91 43 58 50 27 29 48 63 66 04 68 89 53 67 30 73 16 69 87 40 31 04 62 98 27 23 09 70 98 73 93 38 53 60 04 23\"\r\n\r\n\t# Place triangle in an array which is easier to manipulate\r\n\t@triangle = []\r\n\tcounter = 0\r\n\tnumber = number.split(\" \")\r\n\twhile number.length > 0\r\n\t\tcounter += 1\r\n\t\trow = []\r\n\t\tcounter.times { row << number.shift }\r\n\t\t@triangle << row\r\n\tend\r\n\r\n\t# Recursion method that returns the greater sum of the current cell and \r\n\t# each of the two adjacent cells in the next row\r\n\tdef add_num(row, col)\r\n\t\t# If last row, simply return the cell number\r\n\t\treturn @triangle[row][col].to_i if row == @triangle.length-1\r\n\r\n\t\t# Find the adjacent two cells in the next row and add current cell's value\r\n\t\ta = add_num(row+1,col) + @triangle[row][col].to_i\r\n\t\tb = add_num(row+1,col+1) + @triangle[row][col].to_i\r\n\t\t# Return the greater of the two sums\r\n\t\treturn [a,b].max\r\n\r\n\tend\r\n\r\n\t#Start the recursion at cell 0,0\r\n\tputs add_num(0,0)\r\nend", "def compute\n # the position of the largest integer in the current row\n index = 0\n\n # the maximum sum\n maximum_sum = 0\n\n @triangle.each_with_index do |line, line_index|\n # the first line is guaranteed to have 1 number, so that is the initial maximum_sum\n if line_index == 0\n maximum_sum = line[index]\n else\n # get the adjacent integers in the next row\n left_integer = line[index]\n right_integer = line[index + 1]\n # get the maximum integer, add it to the sum, and update the index to point to it\n if left_integer >= right_integer\n maximum_sum += left_integer\n # index stays the same\n else\n maximum_sum += right_integer\n index += 1\n end\n end\n end\n \n maximum_sum\n end", "def mine_total(i, j)\n return is_mined(@data[i-1][j-1]) +\n is_mined(@data[i-1][j]) +\n is_mined(@data[i-1][j+1]) +\n is_mined(@data[i][j-1]) +\n is_mined(@data[i][j+1]) +\n is_mined(@data[i+1][j-1]) +\n is_mined(@data[i+1][j]) +\n is_mined(@data[i+1][j+1]);\n end", "def left_to_right_approach\n largest_prod_of_all_rows = 0\n for each_row in (0..19)\n curr_largest_prod_in_row = left_to_right_helper($grid_of_numbers[each_row])\n if curr_largest_prod_in_row > largest_prod_of_all_rows\n largest_prod_of_all_rows = curr_largest_prod_in_row\n end\n end\n \n return largest_prod_of_all_rows\nend", "def max_sum_path(arr)\n queue = [[0, 0]]\n n = arr.size\n sums = Array.new(n) { |cell| Array.new(n, -100) }\n sums[0][0] = arr[0][0]\n\n while !queue.empty? do\n row, col = queue.shift\n directions = [[0, 1], [1, 0]]\n directions.each do |drow, dcol|\n nrow, ncol = row + drow, col + dcol\n if nrow.between?(0, n - 1) && ncol.between?(0, n - 1)\n sums[nrow][ncol] = [sums[nrow][ncol], sums[row][col] + arr[nrow][ncol]].max\n queue << [nrow, ncol]\n end\n end\n end\n sums[n - 1][n - 1]\nend", "def max_path_sumI arr\n for i in (arr.length-2).downto(0)\n for j in 0...arr[i].length\n arr[i][j] += (arr[i+1][j] > arr[i+1][j+1] ? arr[i+1][j]: arr[i+1][j+1])\n end\n end\n arr[0][0]\nend", "def getSumsByRow(tri, row)\n\t#for every element in current line\n\tfor i in 0..tri[row].length-1\n\t\t#add to the lagest of the child nodes\n\t\ttri[row][i] += [tri[row+1][i], tri[row+1][i+1]].max\n\tend\n\t#if the row only has one element\n\tif tri[row].length == 1\n\t\t#return it\n\t\treturn tri[row][0]\n\telse\n\t\t#or else recurse \n\t\treturn getSumsByRow(tri, row-1)\n\tend\nend", "def balanced_point(array)\n (0...array.length).each do |i|\n left_sum = 0\n right_sum = 0\n (0...i).each do |j|\n left_sum += array[j]\n end\n (i+1...array.length).each do |j|\n right_sum += array[j]\n end\n if left_sum == right_sum\n return i\n end\n end\n return -1\nend", "def minimum_total(triangle)\n return triangle[0][0] if triangle.size < 2\n (triangle.size - 2).downto(0).each { |i|\n 0.upto(triangle[i].size - 1).each { |j|\n triangle[i][j] += [triangle[i + 1][j], triangle[i + 1][j + 1]].min\n }\n }\n \n triangle[0][0]\nend", "def maxNonAdjacentSum(nums)\n table = Array.new(nums.length).fill(0)\n table[0] = nums.first\n\n table.each_with_index do |entry, idx|\n next if idx == 0\n skip_left = table[idx - 2] == nil ? 0 : table[idx - 2]\n sum = skip_left + nums[idx]\n prev_sum = table[idx - 1]\n table[idx] = [sum, prev_sum].max\n\n end\n table.last\nend", "def maximum_path_sum(array, number_of_rows)\r\n x = array.map{|num| num.to_i }\r\n new_array = []\r\n j = 0 \r\n number_of_rows.times do |i|\r\n new_array << x.slice(j, i + 1)\r\n j += i + 1\r\n end \r\n new_array = new_array.map{|arr| arr.map{|x| x.to_i}}\r\n new_array = new_array.reverse\r\n \r\n a = new_array[0].each_cons(2).to_a\r\n b = new_array[1]\r\n c = b.zip(a)\r\n d = c.map{|arr| arr[0] + arr[1].max}\r\n\r\n (number_of_rows - 3).times do |i|\r\n a = d.each_cons(2).to_a \r\n d.clear \r\n b = new_array[i + 2]\r\n c = b.zip(a)\r\n d = c.map{|arr| arr[0] + arr[1].max}\r\n end \r\n \r\n return d.max + new_array.last.join.to_i\r\nend", "def adjacent_mines(row, col)\n @total = 0\n if @mine_field[:bombs][col-1][row] == true\n @total+=1\n end\n if @mine_field[:bombs][col-1][row-1] == true\n @total+=1\n end\n if @mine_field[:bombs][col-1][row+1] == true\n @total+=1\n end\n if @mine_field[:bombs][col+1][row] == true\n @total+=1\n end\n if @mine_field[:bombs][col+1][row-1] == true\n @total+=1\n end\n if @mine_field[:bombs][col+1][row+1] == true\n @total+=1\n end\n if @mine_field[:bombs][col][row-1] == true\n @total+=1\n end\n if @mine_field[:bombs][col][row+1] == true\n @total+=1\n end\n @total\n end", "def dp_min_sum(pyramid)\n last_row = pyramid.pop\n # memoize last row\n results = last_row.map { |el| Node.new(el.to_i, [el]) }\n\n while pyramid.length > 0\n last_row = pyramid.pop\n\n results = last_row.map.with_index do |el, i|\n left_child = results[i]\n right_child = results[i+1]\n min_child = left_child.sum < right_child.sum ? left_child : right_child\n sum = el.to_i + min_child.sum\n path = [el] + min_child.path\n Node.new(sum, path)\n end\n end\n return results.first.sum, results.first.path\nend", "def inner_up\n # looking up at the bottom of the inner grid\n return 0 if inner.nil?\n # sum bottom edge\n (0..@size-1).map { |x| inner.get_loc(x, @size - 1) ? 1 : 0 }.sum\n end", "def largest_contiguous_subsum(arr)\n\n largest_sum = 0 # 3\n current_sum = 0 # 1\n arr.each do |el| # 1 ,2,-4, 4,-3,4\n if current_sum + el > largest_sum # \n current_sum += el \n largest_sum = current_sum # \n elsif current_sum + el < 0\n current_sum = 0\n else\n current_sum += el\n end\n end\n largest_sum\n\nend", "def contig_sum2(array)\n greatest_sum = array[0]\n useful_sum = array[0]\n\n array.each_index do |idx|\n useful_sum = 0 if useful_sum < 0 && idx == 0\n next if idx == 0\n useful_sum += array[idx]\n\n if useful_sum > greatest_sum\n greatest_sum = useful_sum\n elsif useful_sum < 0\n useful_sum = 0\n end\n end\n\n greatest_sum\nend", "def solution(a)\n # [1, -INFINITY, -INFINITY, -INFINITY, -INFINITY, -INFINITY]\n # [1,-1, 1, 10, 0, -1] row = 1. start_val = 1\n # [1,-1, 1, 10, 0, -1] row = 2. start_val = -1\n # [1,-1, 1, 10, 0, -1] row = 3. start_val = 1\n # [1,-1, 1, 10, 9, 8] row = 4. start_val = 10\n # [1,-1, 1, 10, 9, 8] row = 5. start_val = 9\n\n dp = [a[0]] + [MININT] * (a.size - 1)\n (1..a.size - 1).each do |row|\n start_index = row - 1\n start_val = dp[start_index]\n\n # we may only move forward up to 6 spots\n end_col = [a.size - 1, start_index + 6].min\n puts \"start_val: #{start_val}. Inner loop start_col: #{row} / end_col: #{end_col}\"\n\n (row..end_col).each do |col|\n puts \"row: #{row}, col: #{col}\"\n dp[col] = [dp[col], start_val + a[col]].max\n end\n p dp\n puts\n end\n\n \"Answer: #{dp.last}\"\nend", "def largest_contiguous_subsum2(list)\n sum = 0 # keeps track of current sum\n largest_sum = list.first # evaluates to the largest sum\n list.each do |ele|\n sum += ele \n largest_sum = sum if sum > largest_sum\n sum = 0 if sum < 0\n end\n largest_sum\nend", "def find_closest_value(target, item_count, acc_sum, k, multi)\n\tputs \"calling function\"\n\n #puts \"k = \" + k.to_s + \" acc_sum = \" + acc_sum.to_s + \" multi = \" + multi.to_s\n #puts \"k = \" + k.to_s + \" multi = \" + multi.to_s\n #item_count.each { |x| puts x }\n\n\n #checks current accumulated value with current max value to find the best match of given subset\n if acc_sum > $max_val\n $max_val = acc_sum\n #puts \"max value set \" + acc_sum.to_s\n #item_count.each { |x| puts x }\n $max_mul = item_count\n puts \"#{item_count}\"\n return item_count\n end\n\n #item_count contains the list of multipliers. is set here to the multiplier value\n item_count[k] = multi\n #item_count.insert(k, multi)\n puts multi.to_s\n #BASE CASE TO END RECURSION\n if multi == 0\n return 0\n end\n\n #If exact match found to target the max value is set and returns false to destroy whole recursive stack\n if acc_sum + $price[k] * item_count[k] == target\n $max_val = acc_sum + $price[k] * item_count[k]\n #item_count[k] = item_count[k] + 1\n puts \"max value set \" + $max_val.to_s\n $max_mul = item_count\n $max_mul.each { |x| puts x }\n return false\n\n#This step used to go deeper into the recursive stack only if more elements are present in the given set\n#And also checks if current value + old accumulated value doesnt exceed the target sum given\n elsif k + 1 < $n && acc_sum + $price[k] * item_count[k] <= target\n item_count = find_closest_value(target, item_count, acc_sum + $price[k] * item_count[k], k+1, (target-$price[k] * item_count[k])/$price[k+1])\n #used to destroy recursion when perfect match is found\n puts \"Next max value set \" + $max_val.to_s\n if item_count == false\n return false\n end\n end\n\n # if k+1 < $n && acc_sum + $price[k] * (item_count[k-1] - 1) + ((target - acc_sum) / $price[k + 1]) * $price[k + 1] <= target\n # item_count[k] = item_count[k] - 1\n # find_closest_value(target, item_count, acc_sum + $price[k] * item_count[k - 1], k+1, (target - acc_sum)/$price[k+1])\n # end\n\n # elsif\n temp = [0,0,0,0,0,0]\n #puts \"k last = \" + k.to_s\n #item_count.each { |x| puts x }\n #recursive call with multiplier reduced by 1 for the same element in the set\n find_closest_value(target, temp, acc_sum, k, multi - 1)\n # end\nend", "def maximum_total(arr, row = 0, index = 0, total = 0)\n number = arr[row][index]\n total += number\n\n return total if (arr.length - 1) == row\n\n row += 1\n index += 1 if arr[row][index] < arr[row][index + 1]\n\n maximum_total(arr, row, index, total)\n end", "def largest_contiguous_subsum_2(list)\n largest_sum = list.first\n current_sum = 0\n list.each do |ele| \n current_sum += ele\n if current_sum > largest_sum\n largest_sum = current_sum\n end\n current_sum = 0 if current_sum < 0 \n end\n largest_sum\nend", "def largest_contiguous_subsum2(list)\n\n largest = list.first\n current = list.first\n\n list[1..-1].each do |num|\n if current < num && current < 0 #dealing with a condition of negative nums and want to restart\n current = num\n elsif num < 0 && current > largest #about to begin negative nums, compare current and largest\n largest = current\n current += num\n else\n current += num\n end\n end\n\n return current if largest < current\n largest\nend", "def max_sum_non_adjacent(arr)\n return 0 if arr.empty?\n return arr[0] if arr.length == 1\n\n # base case, 1st element will be as it is\n sums = [arr[0]]\n\n # 2nd element will be max of 1st two numbers\n sums[1] = arr[0..1].max\n\n (2...arr.length).each do |i|\n # max of previous element and (current array element + 2nd previous element)\n sums[i] = [sums[i - 1], arr[i] + sums[i - 2]].max\n end\n\n sums[-1]\nend", "def largest_contigious_subsum(list)\n debugger\n lcs = list[0] \n current_sum = list[0]\n puts lcs\n list.each_with_index do |num, i|\n current_sum += list[i + 1]\n if current_sum > lcs \n lcs = current_sum\n end\n end\n lcs \nend", "def better_largest_continous_subsum\n largest = first\n current = first\n switch = false\n each_with_index do |num, idx|\n # debugger\n next if idx == 0\n if switch\n current = num\n largest = current if current > largest\n switch = false\n elsif current + num < current\n if num.abs > current\n switch = true\n else\n current += num\n end\n else\n current += num\n end\n largest = current if current > largest\n end\n largest\n end", "def height_helper(current)\n num, left, right = 0, 0, 0\n return 0 if current.nil?\n left += height_helper(current.left)\n right += height_helper(current.right)\n num += 1 \n\n if left == right \n return num + right \n elsif left > right \n return num + left \n else \n return num + right \n end \n end", "def largest_contiguous_subsum_once(arr)\n largest_subsum = 0\n current = 0\n\n arr.each do |elm|\n current += elm\n if largest_subsum < current\n largest_subsum = current\n elsif current < 0\n current = 0 \n end \n end \n\n # (0...arr.count).each do |i|\n # current_subsum = (largest_subsum + arr[i])\n # if current_subsum > largest_subsum \n # largest_subsum = current_subsum \n # elsif current_subsum < 0 \n # largest_subsum = 0 \n # end\n # end \n\n largest_subsum \nend", "def largest_contiguous_subsum_2(list)\n largest_sum = 0\n current_sum = 0\n\n list.each do |el|\n largest_sum = current_sum \n current_sum += el \n if current_sum < el \n current_sum = el \n end \n largest_sum = current_sum if largest_sum < current_sum\n end\n\n largest_sum\nend", "def linear_subsum(arr)\n largest = arr[0] # 5\n current = 0 # -4\n\n (0...arr.length).each do |idx| # 1\n current += arr[idx]\n largest = current if current >= largest\n current = 0 if current < 0\n end\n largest\nend", "def largest_contig_subsum_lin(nums)\n # debugger\n largest_sum = nums[0]\n current_sum = 0\n i, j, = 0, 0\n while j < nums.length \n current_sum += nums[j] \n \n if nums[j] > current_sum \n i = j \n current_sum = nums[j]\n end \n\n largest_sum = current_sum if current_sum > largest_sum \n\n j += 1\n end\n largest_sum\nend", "def better_subsum(arr)\n largest_sum = arr.first\n current_sum = arr.first\n\n \n # return arr[0] if arr.length == 1\n \n # current_sum = better_subsum(arr[1..-1])+ arr[0]\n\n # if current_sum > largest_sum\n # largest_sum = current_sum\n # end\n\n # largest_sum\n\n # i = 0\n # j = arr.length\n # while i < arr.length\n\n # arr[i..j].sum\n # j-=1\n # i+=1\n # end\n \n (1...arr.length).each do |idx|\n if arr[idx] + current_sum > 0\n current_sum += arr[idx]\n largest_sum = current_sum if current_sum > largest_sum\n else\n current_sum = 0\n end\n end\n\n largest_sum\nend", "def largesum2(arr)\n large = arr.first\n curr = arr.first\n\n (1...arr.length).each do |i|\n curr = 0 if curr < 0\n curr += arr[i]\n large = curr if curr > large\n end\n\n large\n\n\n\n\nend", "def adjacent_mines(row, col)\n count = 0\n if within_field?(row, col)\n if within_field?(row - 1, col) && contains_mine?(row - 1, col)\n count += 1\n end\n if within_field?(row - 1, col - 1) && contains_mine?(row - 1, col - 1)\n count += 1\n end\n if within_field?(row - 1, col + 1) && contains_mine?(row -1, col + 1)\n count += 1\n end\n if within_field?(row, col - 1) && contains_mine?(row, col - 1)\n count += 1\n end\n if within_field?(row, col + 1) && contains_mine?(row, col + 1)\n count += 1\n end\n if within_field?(row + 1, col) && contains_mine?(row + 1, col)\n count += 1\n end\n if within_field?(row + 1, col - 1) && contains_mine?(row + 1, col - 1)\n count += 1\n end\n if within_field?(row + 1, col + 1) && contains_mine?(row + 1, col + 1)\n count += 1\n end\n end\n count\n end", "def largest_contiguous_subsum1(list)\n greatest_sum = -1.0/0.0\n (0...list.length).each do |i|\n (i...list.length).each do |j|\n greatest_sum = list[i..j].sum if greatest_sum < list[i..j].sum\n end\n end\n greatest_sum\nend", "def largest_contiguous_subsum2(list)\n largest_sum = list[0]\n current_sum = 0\n# list = [2, 3, -6, 7, -6, 7]\n list.each do |number|\n current_sum += number\n if current_sum > largest_sum\n largest_sum = current_sum\n elsif current_sum < 0\n current_sum = 0\n end\n end\n largest_sum\nend", "def adjacent_mines(row, col)\n count = 0\n if @field[row + 1].nil? && @field[row][col + 1].nil?\n count = 0\n count += 1 if @field[row - 1][col - 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n elsif @field[row + 1].nil? && @field[row][col - 1].nil?\n count = 0\n count += 1 if @field[row - 1][col + 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n elsif @field[row - 1].nil? && @field[row][col + 1].nil?\n count = 0\n count += 1 if @field[row + 1][col - 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n elsif @field[row - 1].nil? && @field[row][col - 1].nil?\n count = 0\n count += 1 if @field[row + 1][col + 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n elsif @field[row - 1].nil?\n count = 0\n count += 1 if @field[row][col - 1].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n count += 1 if @field[row + 1][col - 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n count += 1 if @field[row + 1][col + 1].contains_mine?\n elsif @field[row + 1].nil?\n count = 0\n count += 1 if @field[row - 1][col - 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row - 1][col + 1].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n elsif @field[row][col + 1].nil?\n count = 0\n count += 1 if @field[row - 1][col - 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col - 1].contains_mine?\n count += 1 if @field[row + 1][col - 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n elsif @field[row][col - 1].nil?\n count = 0\n count += 1 if @field[row - 1][col + 1].contains_mine?\n count += 1 if @field[row - 1][col].contains_mine?\n count += 1 if @field[row][col + 1].contains_mine?\n count += 1 if @field[row + 1][col + 1].contains_mine?\n count += 1 if @field[row + 1][col].contains_mine?\n else\n count = 0\n adjacent_cells(row, col).each do |cell|\n if cell.contains_mine?\n count += 1\n end\n end\n end\n count\n end", "def min_path_sum(grid)\n row = grid.length\n col = grid[0].length\n\n i, j = 0, 0\n\n while i < row && j < col\n if i == 0 && j != 0\n grid[i][j] = grid[i][j] + grid[i][j - 1]\n elsif i != 0 && j == 0\n grid[i][j] = grid[i][j] + grid[i - 1][j]\n elsif i != 0 && j != 0\n grid[i][j] = grid[i][j] + [grid[i][j - 1], grid[i - 1][j]].min\n end\n\n i += 1\n j += 1\n end\n\n grid[-1][-1]\nend", "def balancedSums(arr)\n return 'YES' if arr.size == 1\n\n total = arr.sum\n left_sum = 0\n\n (0..arr.size - 1).each do |i|\n rest_sum = total - left_sum - (arr[i] || 0)\n if left_sum == rest_sum\n return 'YES'\n end\n\n left_sum += arr[i]\n end\n\n 'NO'\nend", "def adjacent_mines(row, col)\n count = 0\n (-1..1).each do |i|\n (-1..1).each do |j|\n unless (i == 0 && j == 0) || (row + i) < 0 || (col + j) < 0\n if contains_mine?(row + i, col + j)\n count += 1\n end\n end\n end\n end\n count\n end", "def largest_contiguous_subsum2(list)\n result = list.first\n sum = list.first\n\n list.each_with_index do |n, i|\n next if i == 0\n\n sum = 0 if sum < 0\n\n sum += n\n\n result = sum if sum > result\n end\n\n result\nend", "def calculateAdjacent\r\n #Loops through every tile in the grid.\r\n (0..@rows-1).each do |row|\r\n (0..@columns-1).each do |col|\r\n count = getTier(col+1, row+1) + getTier(col+1, row) + getTier(col+1, row-1)\r\n count += getTier(col, row+1) + getTier(col, row-1) + getTier(col-1, row+1)\r\n count += getTier(col-1, row) + getTier(col-1, row-1)\r\n @tile[col][row].adjacent = count #Totals the tier number in the adjacent tiles.\r\n end\r\n end\r\nend", "def adjacent_mines(row, col)\n count = 0\n (-1..1).each do |i|\n (-1..1).each do |j|\n unless (i == 0 && j == 0) || (row + i) < 0 || (col + j) < 0\n count += 1 if contains_mine?(row + i, col + j)\n end\n end\n end\n\n count\n end", "def bottoms_up_method\n\t\t# 1. take the nodes that went the farthest (i.e.: max tree level)\n\t\tmax_level = @tree.tree_bottom.collect(&:level).max\n\t\t# 2. Of those, use the one with the minimum sum value\n\t\twinner = @tree.tree_bottom.select{|t|t.level==max_level}.min_by(&:sum)\n\t\t# binding.pry \n\t\tbottoms_up_dir(winner).dir\n\tend", "def largest_contiguous_sub_sum1(list)\n max = list[0]\n (0...list.length).each do |i|\n (i...list.length).each do |j| \n sub_sum = list[i..j].sum \n max = sub if sub >= max \n end\n end\n max\nend", "def max_2_sum arr\n return 0 if arr.empty?\n return arr[0] if arr.length==1\n \n i=1\n \n arr.each do |c| \n if i== 1\n @a=c\n elsif i==2\n if c> @a\n @b=@a\n @a=c \n else\n @b=c\n end\n elsif c>@a and c>@b\n @b=@a\n @a=c \n elsif c>@b\n @b=c\n end\n i+=1\n end\n return @a+@b\nend", "def largest_contiguous_subsum(arr)\n max = 0\n\n (0...arr.count).each do |i|\n sum = arr[i]\n (i + 1...arr.count).each do |j|\n sum += arr[j]\n max = sum if max < sum \n end \n end \n\n max\nend", "def largest_contiguous_subsum_v2(list)\n largest_sum = list.first\n sum = list.first # but the first element can be a negative number\n\n (1...list.length).each do |i|\n # a negative number + a postive number always less than pos number on its own\n sum = 0 if sum < 0 # if we add to a negative sum, then result is less than pos number on its own\n sum += list[i]\n largest_sum = sum if largest_sum < sum\n end\n\n largest_sum\nend", "def largest_sum_better(arr)\n largest_sum = arr.first\n current = arr.first\n\n (1...arr.length).each do |idx|\n if current < 0\n current = 0\n end\n\n current += arr[idx]\n \n if current > largest_sum\n largest_sum = current\n end\n end\n\n largest_sum\nend", "def eleven\n max = 0\n matrix = read_file\n height = matrix.length\n width = matrix[0].length\n\n for i in 0..height\n for j in 0..width\n if (temp = max_fn(find_max_hor(matrix, i, j, 1), find_max_ver(matrix, i, j, 1), find_max_lower_dia(matrix, i, j, 1), find_max_upper_dia(matrix, i, j, 1))) > max\n max = temp\n end \n end\n end\n return max \nend", "def faster_cont_sum(arr)\n # debugger\n sum = arr[0]\n bool = true\n run_tot = arr[0]\n arr[1..-1].each do |e|\n if bool == false && e > sum\n sum = e\n bool = true\n run_tot = e\n elsif bool == true && e + sum > sum\n sum += e\n run_tot += e\n elsif bool == true && e > sum\n sum = e\n else \n bool = false\n run_tot += e\n end \n end \n sum >= run_tot ? sum : run_tot\nend", "def largest_contiguous_sub_sum2(arr)\n #one varable tracks largest sum\n #one variable tracks current sum\n #O(n) + O(1)\n # list = [2, 3, -6, 7, -6, 7]\n\n # largest_sum= arr.first\n\n # i = 0\n # arr_end = true\n\n # while arr_end\n # current_sum = arr[i]\n # if arr[i+1] == nil\n # arr_end = false\n # puts \"This is current sum: #{current_sum}\"\n # else\n # if current_sum > largest_sum\n # current_sum += arr[i+1]\n # largest_sum = current_sum\n # end\n # end\n # if i < arr.length\n # arr_end = true\n # i += 1\n # end\n # end\n # largest_sum\n \n\n\n # arr.each_with_index do |ele, idx|\n # if ele > largest_sum\n # largest_sum = ele\n # end\n\n # i = idx\n # sum = ele\n # while i < arr.length - 1\n # if sum <= sum + arr[i+1]\n # largest_sum = sum + arr[i+1]\n # end\n # sum = sum + arr[i+1]\n # i+=1\n # end\n # end\n # largest_sum\n\nend", "def contiguous_sub_sum2(arr)\n max = arr.first\n curr_sum = 0\n arr.each do |num|\n curr_sum += num\n max = curr_sum if curr_sum > max\n curr_sum = 0 if curr_sum < 0\n end\n max\nend", "def max_sum_linear(data)\n if data[0] > data[1]\n biggest = data[0]\n secondBiggest = data[1]\n else\n biggest = data[1]\n secondBiggest = data[0]\n end\n\n (2..data.length-1).each do |i|\n if data[i] > secondBiggest && data[i] < biggest\n secondBiggest = data[i]\n elsif data[i] >= biggest\n secondBiggest = biggest\n biggest = data[i]\n end\n end\n return biggest + secondBiggest\nend", "def linear_subsum\n max = $list[0]\n sum = $list[0] \n\n (0...$list.length - 1).each do |idx|\n num1 = $list[idx + 1]\n # debugger \n sum += num1 \n sum = 0 if sum < 0\n max = sum if sum > max\n end\n\n max\n\nend", "def largest_con_subsum_2(list)\n largest = list.first\n contiguous_sum = list.first\n\n i = 1\n \n while i < list.length\n current = list[i]\n contiguous_sum += current\n if contiguous_sum > largest\n largest = contiguous_sum \n elsif current > largest\n largest = current\n \n end\n contiguous_sum = 0 if contiguous_sum < 0\n i += 1 \n \n end\n return largest\nend", "def largest_contiguous_subsum2(arr)\n answer = arr[0]\n current_sum = arr[0] \n arr.each_with_index do |ele,idx|\n if idx == 0 \n current_sum = arr[idx]\n answer = current_sum\n elsif current_sum > 0 \n current_sum += arr[idx] \n answer = current_sum unless answer > current_sum \n else\n current_sum = arr[idx]\n end\n end\n answer\nend", "def solution(a)\n left = 0\n right = a.sum\n a.each_with_index do |element, index|\n right -= element\n return index if left == right\n left += element\n end\n -1\nend", "def largest_contig_subsum(nums)\n max = nil\n nums.each_with_index do |num, i|\n j = i\n while j < nums.length\n if !max || nums[i..j].sum > max\n max = nums[i..j].sum\n end\n j += 1\n end\n end\n max\nend", "def largest_contigous_subsum_ii(list)\n current_sum = list.first\n max = list.first\n (1..-1).each do |i|\n current_sum += list[i]\n current_sum = 0 if current_sum < 0\n max = current_sum if max < current_sum\n end\n current_sum\nend", "def max_sum_dp(matrix)\n return 0 if matrix.length < 1 || matrix[0].length < 1\n\n rows = matrix.length\n cols = matrix[0].length\n\n # start row,col end row, end col\n dp = Array.new(rows) { Array.new(cols) { Array.new(rows) { Array.new(cols, 0) } } }\n\n max = -Float::MAX\n rows.times do |sr|\n cols.times do |sc|\n sr.upto(rows - 1).each do |er|\n sc.upto(cols -1).each do |ec|\n dp[sr][sc][er][ec] = matrix[er][ec]\n # rect above\n if er > 0\n dp[sr][sc][er][ec] += dp[sr - 1][sc][er - 1][ec]\n end\n # rect left\n if ec > 0\n dp[sr][sc][er][ec] += dp[er][sc][er][ec - 1]\n end\n max = [max, dp[sr][sc][er][ec]].max\n end\n end\n end\n end\n\n max\nend", "def max_path_sum_util(root, res)\n return 0 if root.nil?\n return root.value if root.left.nil? && root.right.nil?\n\n ls = max_path_sum_util(root.left, res)\n rs = max_path_sum_util(root.right, res)\n puts \"root - #{root.value}, ls- #{ls}, rs- #{rs}, #{res[0]}\"\n\n\n #If both left and right children exist\n if (root.left && root.right)\n #Update result if needed\n res[0] = [res[0], ls + rs + root.value].max\n\n # Return maxium possible value for root being on one side\n return [ls, rs].max + root.value\n end\n\n # If any of the two children is empty, return root sum for root being on one side\n return root.left ? ls + root.value : rs + root.value\nend", "def minimum_total(triangle)\n return 0 if !triangle || triangle.empty? || triangle[0].empty?\n return triangle[0][0] if triangle.size < 2\n\n i = triangle.size - 2\n while i >= 0 do \n for j in 0...triangle[i].size do \n triangle[i][j] += [triangle[i + 1][j], triangle[i + 1][j + 1]].min\n end\n end\n\n triangle[0][0]\nend", "def top_to_bottom_approach\n largest_prod_of_all_cols = 0\n for each_row in (0..15)\n for each_col in (0..19)\n curr_prod_in_col = $grid_of_numbers[each_row][each_col] * $grid_of_numbers[each_row + 1][each_col] * $grid_of_numbers[each_row + 2][each_col] * $grid_of_numbers[each_row + 3][each_col]\n if curr_prod_in_col > largest_prod_of_all_cols\n largest_prod_of_all_cols = curr_prod_in_col\n end\n end\n end\n \n return largest_prod_of_all_cols\nend", "def adjacent_mines(row, col)\n count = 0\n if col < @column_count-1\n count+=1 unless @grid[row][col+1].fill.nil?\n end\n if col > 0\n count +=1 unless @grid[row][col-1].fill.nil?\n end\n if row < @row_count-1\n count+=1 unless @grid[row+1][col].fill.nil?\n end\n if row > 0\n count+=1 unless @grid[row-1][col].fill.nil?\n end\n if row < @row_count-1 && col < @column_count-1\n count+=1 unless @grid[row+1][col+1].fill.nil?\n end\n if row > 0 && col > 0\n count+=1 unless @grid[row-1][col-1].fill.nil?\n end\n if row > 0 && col < @column_count-1\n count +=1 unless @grid[row-1][col+1].fill.nil?\n end\n if row < @row_count-1 && col > 0\n count +=1 unless @grid[row+1][col-1].fill.nil?\n end\n count\n end", "def max_sum_kadane(matrix)\n rows = matrix.length\n return 0 if rows < 1\n cols = matrix[0].length\n return 0 if cols < 1\n\n ans = -Float::MAX\n cols.times do |l|\n dp = Array.new(rows, 0)\n l.upto(cols - 1) do |c|\n tsum = 0\n rows.times do |r|\n tsum = 0 if tsum < 0\n tsum += matrix[r][c]\n tsum += dp[r]\n ans = [ans, tsum].max\n dp[r] += matrix[r][c]\n end\n end\n end\n\n ans\nend", "def miniMaxSum(arr)\n arr = arr.sort\n a = arr[1..-1].reduce(:+)\n b = arr[0..-2].reduce(:+)\n print b\n print \" \"\n print a\nend", "def two_sum_brute nums\n (0...nums.length).each do |i|\n ((i + 1)...nums.length).each do |j|\n if nums[i] + nums[j] == 0\n return i, j\n end\n end\n end\n nil\nend", "def better_largest_contiguous_subsum(list)\n current_largest_sum = 0\n current_sum = 0\n return list.max if list.all? {|ele| ele < 0}\n\n (0...list.length).each do |i |\n # debugger\n #add current element to current sum\n current_sum += list[i]\n\n #if current sum is less than 0 ignore it and reset to move on to next number\n if ( current_sum < 0 ) \n current_sum = 0\n end \n # if current sum is greater than our current largest sum, we want to keep it\n if current_sum > current_largest_sum\n current_largest_sum = current_sum\n end\n end\n current_largest_sum\nend", "def adjacent_mines(row, col)\n 0\n end", "def adjacent_mines(row, col)\n 0\n end", "def adjacent_mines(row, col)\n 0\n end", "def largest_cont_subsum(list)\n biggest = list[0]\n current = 0\n\n (0...list.length).each do |i|\n current += list[i]\n biggest = current if current > biggest\n end\n biggest\nend", "def largest_contiguous_subsum2(array)\n largest_sum = array.first\n current_sum = array.first\n\n (1..array.length-1).each do |i|\n current_sum = 0 if current_sum < 0\n current_sum += array[i]\n largest_sum = current_sum if current_sum > largest_sum\n end\n largest_sum\n \nend", "def visitor(i,j,n,m,grid,visited)\n if (i<0 || i>n-1 || j<0 || j>m-1 || grid[i][j]==0 || visited[i][j])\n return 0\n else visited[i][j] = true\n score = 1\n score += visitor(i-1,j-1,n,m,grid,visited)\n score += visitor(i-1,j,n,m,grid,visited)\n score += visitor(i-1,j+1,n,m,grid,visited)\n score += visitor(i,j-1,n,m,grid,visited)\n score += visitor(i,j+1,n,m,grid,visited)\n score += visitor(i+1,j-1,n,m,grid,visited)\n score += visitor(i+1,j,n,m,grid,visited)\n score += visitor(i+1,j+1,n,m,grid,visited)\n return score\n end\nend", "def rec_sum(num)\n return num if num <= 1\n num + rec_sum(num - 1)\nend", "def efficient_contiguous_subsum(list)\n current_sum = list[0] #0\n largest_sum = list[0] #5\n # debugger\n (1...list.length).each do |i| \n if current_sum + list[i] > 0 \n current_sum += list[i] \n largest_sum = current_sum if current_sum > largest_sum\n else \n current_sum = 0\n end \n end \n largest_sum\nend", "def compute(triangle)\n line = 0\n while line < triangle.length-1\n triangle[line+1].each_index do |idx|\n triangle[line+1][idx] += [triangle[line][idx], triangle[line][idx+1]].max\n end\n line += 1\n end\n return triangle[line]\nend", "def maxSum(matrix)\n\nend", "def triangle_recursive(row)\n if row == 0\n return [1]\n else\n previous_row = triangle_recursive(row-1)\n return compute_row(previous_row)\n end\nend", "def largest_continguous_subsum(arr)\n largest_sum = arr.first\n current_sum = arr.first\n \n (1...arr.length).each do |i|\n current_sum += arr[i]\n if current_sum > largest_sum\n largest_sum = current_sum\n elsif current_sum < 0\n current_sum = 0\n end\n end\n largest_sum\nend", "def max_submatrix(matrix)\n n = matrix.length\n max_value = matrix[0][0]\n # i and j are the initial index, k and l are the lengths of the matrix\n for i in 0..(n - 1)\n for j in 0..(n - 1)\n for k in 0..(n - 1 - i)\n for l in 0..(n - 1 - j)\n sum = sum_submatrix(matrix[i..(i+k)][j..(j+l)])\n max_value = sum if sum > max_value\n end\n end\n end\n end\n\n max_value\nend", "def largest_contiguous_subsum(list)\n current_max = list[0]\n current_sum = list[0]\n\n (1...list.size).each do |i|\n current_sum += list[i]\n if current_sum > current_max\n current_max = current_sum\n end\n\n if current_sum < 0 \n current_sum = 0\n end\n \n end\n\n current_max\nend", "def right_to_diagonal_left_approach\n largest_prod = 0\n\n for each_row in (0..15)\n for col in (0..19)\n each_col = 19 - col\n a = $grid_of_numbers[each_row][each_col]\n b = $grid_of_numbers[each_row+1][each_col-1]\n c = $grid_of_numbers[each_row+2][each_col-2]\n d = $grid_of_numbers[each_row+3][each_col-3]\n #puts \"#{a} #{b} #{c} #{d}\"\n curr_prod = a*b*c*d\n if curr_prod > largest_prod\n largest_prod = curr_prod\n end\n end\n end\n \n return largest_prod\nend", "def cur_max_sum(root)\n return 0 unless root\n left_cur_max = cur_max_sum(root.left)\n right_cur_max = cur_max_sum(root.right)\n cur_max = [left_cur_max, right_cur_max, left_cur_max + right_cur_max, 0].max + root.val\n $maximum = cur_max if cur_max > $maximum\n [left_cur_max, right_cur_max, 0].max + root.val\nend", "def largest_contiguous_subsum2(array)\r\n largest = array[0]\r\n current_sum = array[0]\r\n\r\n (1...array.length).each do |i|\r\n current_sum = 0 if current_sum < 0\r\n num = array[i]\r\n current_sum += num\r\n if current_sum > largest\r\n largest = current_sum\r\n end\r\n end\r\n\r\n largest\r\nend", "def largest_contiguous_subsum_2(list)\n current_sum = 0\n largest_sum = 0\n (0...list.length).each do |idx|\n current_sum += list[idx]\n largest_sum = current_sum if current_sum > largest_sum\n current_sum = 0 if current_sum < 0\n end\n largest_sum\nend", "def sub_array_sum(nums)\n greatest_sum = nums.first\n current_sum = 0\n nums.each do |num|\n current_sum += num\n greatest_sum = current_sum if current_sum > greatest_sum\n current_sum = 0 if current_sum < 0\n end\n greatest_sum\nend", "def largest_contiguous_subsum_2(arr)\n sum = 0\n max = 0\n arr.each do |num|\n sum += num\n if sum > 0\n max = sum if sum > max\n else\n sum = 0\n end\n end\n max\nend", "def Superincreasing(arr)\n arr.each_with_index do |num, idx|\n next if idx == 0\n return 'false' unless arr[0...idx].sum < num\n end\n 'true'\nend", "def largest_contiguous_subsum(list)\n largest_sum = 0\n current_sum = list[0]\n (1...list.length).each do |i|\n current_sum = 0 if current_sum < 0 #we need to reset current sum if we hit a negative number\n current_sum += list[i]\n largest_sum = current_sum if current_sum > largest_sum\n end\n largest_sum\nend", "def largest_continous_subsum\n largest = 0\n subsets = []\n\n i = 0\n while i < self.length\n j = i\n while j < self.length\n subsets << self[i..j]\n j += 1\n end\n i += 1\n end\n\n subsets.each do |pair|\n if largest < pair.reduce(:+)\n largest = pair.reduce(:+)\n end\n end\n largest\n\n end", "def optimized_largest_subsum(arr)\n max = arr.first\n sum = arr.first \n arr.shift\n arr.each do |el|\n sum += el\n if el > max && el > sum \n max = el \n sum = el \n elsif sum > max\n max = sum\n end \n end \n max\nend", "def l_sum2(arr)\n return arr.max if arr.all? { |el| el < 0 }\n\n largest_sum = 0\n current_sum = 0\n i = 0\n\n while i < arr.length\n temp = arr[i] \n if current_sum + temp > 0\n current_sum += temp\n else\n current_sum = 0\n end \n if current_sum > largest_sum \n largest_sum = current_sum\n end \n i += 1\n end\n largest_sum\nend", "def largest_sub_sum1 #0(n^2)\n result = []\n (0...self.length).each do |idx1|\n (idx1...self.length).each do |idx2|\n subarray_result = self[idx1..idx2]\n result << subarray_result\n end\n end\n\n largest_sum = result[0][0]\n result.each do |arr|\n largest_sum = arr.sum if arr.sum > largest_sum\n end\n largest_sum\n end", "def leftmost_nodes_sum(array, i = 0, r = 0)\n idx = (2 * i) + 1\n left_node_idx = idx > array.length - 1 ? nil : idx\n return r + array[0] if left_node_idx.nil?\n \n r += array[idx]\n leftmost_nodes_sum(array, left_node_idx, r) \nend", "def esxlRecurse i, j\n esxlStraightRecurse(i, j) + esxlDiagonalRecurse(i, j)\nend", "def largest_contiguous_subsum1(list)\n sums = []\n\n list.each_with_index do |el1, i1|\n list.each_with_index do |el2, i2|\n if i1 == i2\n sums << el1\n else\n sums << el1 + el2\n end\n end\n end\n\n result = sums.first\n\n sums.each do |sum|\n result = sum if sum > result\n end\n\n result\nend", "def largest_contiguous_subsum(arr)\n \n curr_sum = arr.first\n largest_sum = arr.first\n (1...arr.length).each do |i| \n if curr_sum < 0\n curr_sum = 0 #reset\n end\n\n curr_sum += arr[i] \n \n if curr_sum > largest_sum \n largest_sum = curr_sum\n end\n end\n largest_sum\nend", "def recursive_min_sum(head)\n current = head\n current.sum = current.value.to_i\n current.path = [current.value]\n\n unless current.left && current.right\n current.sum = current.value.to_i\n current.path = [current.value]\n current\n else\n left_child = recursive_min_sum(current.left)\n right_child = recursive_min_sum(current.right)\n min_child = left_child.sum < right_child.sum ? left_child : right_child\n current.sum += min_child.sum\n current.path += min_child.path\n current\n end\nend", "def solution(a)\n first_sum = a[0]\n second_sum = a.inject(&:+) - a.first\n result = (first_sum - second_sum).abs\n\n a[1..-2].each do |elem|\n first_sum = first_sum + elem\n second_sum = second_sum - elem\n tmp_result = (first_sum - second_sum).abs\n result = tmp_result if tmp_result < result\n end\n\n result\nend" ]
[ "0.71505237", "0.6784711", "0.6758994", "0.6402833", "0.6384807", "0.6324163", "0.6287884", "0.6236111", "0.62067807", "0.6199832", "0.6180452", "0.61697894", "0.61540025", "0.60700154", "0.6064571", "0.6056978", "0.6051725", "0.6045972", "0.60384154", "0.60223526", "0.6012517", "0.60057867", "0.5996454", "0.5984721", "0.5977723", "0.5972833", "0.5960872", "0.595666", "0.5953691", "0.5933245", "0.59310585", "0.5915029", "0.58866334", "0.5874499", "0.58573407", "0.5852088", "0.5834906", "0.583185", "0.5830729", "0.58291954", "0.5823067", "0.58224344", "0.58163846", "0.58138734", "0.58108574", "0.5809614", "0.5807019", "0.5803695", "0.58008647", "0.57988286", "0.5798228", "0.57973635", "0.5796179", "0.57903427", "0.5787574", "0.5775329", "0.577452", "0.5774051", "0.57719535", "0.57485414", "0.57469237", "0.5743724", "0.5734526", "0.5733509", "0.5729846", "0.57263035", "0.5720393", "0.5714657", "0.57139343", "0.57139343", "0.57139343", "0.5712994", "0.5705778", "0.5705691", "0.57019025", "0.5694958", "0.56905353", "0.5688509", "0.5686148", "0.56847435", "0.56824815", "0.5679194", "0.5676812", "0.56734204", "0.5668151", "0.566573", "0.5660047", "0.5658288", "0.56539947", "0.56534547", "0.56533223", "0.5653029", "0.5649444", "0.56485176", "0.56425554", "0.56399626", "0.5638591", "0.5636979", "0.56274843", "0.56267935" ]
0.6447779
3
GET /testimonios GET /testimonios.json
def index @testimonios = Testimonio.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t@instruction = Instruction.find( params[ :instruction_id ] )\n @testimonies = @instruction.testimonies.page( params[ :page ] ).per(20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testimonies }\n end\n end", "def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end", "def set_testimonio\n @testimonio = Testimonio.find(params[:id])\n end", "def test\n get(\"/help/test.json\")\n end", "def test\n get(\"/help/test.json\")\n end", "def index\n render status: :ok, json: @tests\n end", "def index\n json = HTTParty.get(\"https://api.typeform.com/v1/form/WaIffL?key=f486f2db8f1249c077a08b582bc3efe0a2617668\").body\n\n @jsontests = JSON.parse(json)\n\n end", "def create\n @testimonio = Testimonio.new(testimonio_params)\n\n respond_to do |format|\n if @testimonio.save\n format.html { redirect_to @testimonio, notice: 'Testimonio was successfully created.' }\n format.json { render :show, status: :created, location: @testimonio }\n else\n format.html { render :new }\n format.json { render json: @testimonio.errors, status: :unprocessable_entity }\n end\n end\n end", "def test\n Srchio::Response.new(self.class.get(\"/test\"))\n end", "def get_all_synthetics_tests\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/synthetics/tests\", nil, nil, false)\n end", "def index\n @tests = Test.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tests }\n end\n end", "def get_api_results(_url)\n JSON.parse File.read('spec/inspector/stubbed_example.json')\n end", "def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend", "def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend", "def index\n @presented_testimonies = PresentedTestimony.all\n end", "def show\n render json: @testmonial\n end", "def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end", "def index\n @uchronists = Uchronist.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronists }\n end\n end", "def get_all_movies_for_actor(actor)\n url = \"http://movies.api.mks.io/movies\"\n response = RestClient.get(url, accept: 'application/json')\n\nend", "def room_descriptions_method\r\n my_port = 8081\r\n htttproomnumber = $roomnumber\r\n roomsNtext = \"/#{htttproomnumber}\"\r\n rooms_message = \"/rooms#{roomsNtext}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{rooms_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n return my_json[\"room\"].to_s\r\nend", "def index\n @timers = Timer.all\n\n render json: @timers\n end", "def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend", "def get_all_actors_for_movie(movie)\n url = \"http://movies.api.mks.io/actors\"\n response = RestClient.get(url, accept: 'application/json')\n\nend", "def index\n @testers = Tester.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testers }\n end\n end", "def index\r\n @clocks = ClockResult.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @clocks }\r\n end\r\n end", "def ruvithrottir\n Apis.client.get('/tv/ruvithrottir')\n end", "def index\n @regimes = Regime.all\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @regimes }\n # end\n end", "def index\n @mini_games = MiniGame.all\n render json: @mini_games, status: :ok\n end", "def index\n @software_tests = SoftwareTest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @software_tests }\n end\n end", "def gettestcoverage\n\tstandName = params[:release]\n\t# получаем список тестов\n\n\ttestlist = ''\n\tTCPSocket.open('172.20.5.130', 2000){ |client|\n\t# say Hello to server\n\tclient.puts \"MasterOnline\"\n\tclient.gets\n\tclient.puts \"master_set get_test_coverage \" + standName\n\t#workerList = JSON.parse(client.gets)\n\ttestlist = client.gets\n\tclient.puts \"master_set close_connection\"\n\t}\n\tputs \"TestcontrolController - gettestcoverage\"\n\ttest = '{\"dataArray\" : [{\"name\" : \"PriorityName\", \"value\" : [\"testName1\", \"testName2\", \"testName3\"]}, {\"name\" : \"PriorityName\", \"value\" : [\"testName1\", \"testName2\", \"testName3\"]}]}'\n\trender :text => testlist\n end", "def show\n @testis = Teste.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @testis }\n end\n end", "def monitors(tag=nil)\n # use api call tests if no tag specified\n # use api call tagtests if a tag is specified\n if tag == nil\n result = get('tests')\n else\n result = get('tagtests', tag: tag)\n end\n result\n end", "def tests\n CircleCi.request(conf, \"#{base_path}/#{build}/tests\").get\n end", "def city_events(city)\n response = RestClient.get('https://app.ticketmaster.com/discovery/v2/events.json?city=' + city + '&apikey=' + $ticket_master_api_key)\n jason_response = JSON.parse(response)\nend", "def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end", "def film_api(url)\n film_response = RestClient.get(url)\n film_hash = JSON.parse(film_response)\nend", "def get_movies_from_api\n all_films = RestClient.get('http://www.swapi.co/api/films/')\n film_hash = JSON.parse(all_films) \nend", "def get\n appid = ENV['TRIMET_APP_ID']\n response = Unirest.get( \"http://developer.trimet.org/ws/v2/vehicles?appid=#{appid}\" )\n response.body\nend", "def test_get_site_list\r\n endpoint = \"/sites\"\r\n uri = URI(\"#{@host}#{endpoint}\")\r\n request = Net::HTTP::Get.new(uri)\r\n request['Accept'] = 'application/json'\r\n \r\n test_start = Time.now\r\n response = Net::HTTP.start(uri.hostname, uri.port) do |http|\r\n http.request(request)\r\n end\r\n test_end = Time.now\r\n\r\n @results << {\r\n :api => 'GET /sites',\r\n :endpoint => endpoint,\r\n :start_time => test_start,\r\n :runtime => (test_end.to_f - test_start.to_f) * 1000.0,\r\n :status => response.code,\r\n :content_type => response['content-type']\r\n }\r\n end", "def test\n render json: { test: 'Tested.' }\n end", "def test\n render json: { test: 'Tested.' }\n end", "def index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @musics }\n end\n end", "def index\n @test_runs = TestRun.accessible_by(current_ability).order(\"updated_at DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @test_runs }\n end\n end", "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "def test_velocity_metric\n get '/velocity/meter/1/meter'\n assert_equal 200, last_response.status\n end", "def listing\n tests = Test.where( user_id: test_params[:user_id] )\n all = TestSerializer.new.all_test(tests)\n return render json: all.as_json\n end", "def index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @musics }\n end\n end", "def show\n render status: :ok, json: @test\n end", "def test_canvas_api_studenta_activity_stream\n refute_nil @w\n request_url = \"/users/activity_stream?as_user_id=sis_login_id:studenta\"\n result_as_json = run_and_get_json_result(request_url)\n assert_operator result_as_json.length, \">=\", 1, \"got some activities back\"\n end", "def index\r\n render json: { status: \"Test API\"}\r\n end", "def index\n @captures = Capture.all\n\n render json: @captures\n end", "def index\n @service_times = ServiceTime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @service_times }\n end\n end", "def index\n json_response(@device.browsers)\n end", "def get_reading\n\t\turi = URI.parse('http://localhost:5000/thermometers.json')\n\t\tthermo_response = Net::HTTP.get_response(uri)\n\t\tcheck = thermo_response.body\n\t\tj = JSON.parse(check)\n\tend", "def index\n @time_frames = TimeFrame.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_frames }\n end\n end", "def index\n @carbon_monoxides = CarbonMonoxide.all\n render json: @carbon_monoxides\n end", "def index\n @timetables = Timetable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timetables }\n end\n end", "def index\n @military_battle_rounds = Military::BattleRound.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @military_battle_rounds }\n end\n end", "def test_read_all_info\n get '/v1/read_all?data=eyJOYW1lIjogIkVkdWFyZG8iLCAiQ291bnRyeSI6ICJCcmF6aWwiIH0%3D'\n assert last_response.ok?\n assert last_response.body.include?('Eduardo')\n assert last_response.body.include?('Brazil')\n end", "def index\n streaks = Streak.active.all\n render_jsonapi(streaks)\n end", "def view_api\n api_string = RestClient.get(\"https://itunes.apple.com/search?term=star+wars&entity=song&attribute=movieTerm\")\n api_hash = JSON.parse(api_string)\n\n end", "def index\n @search = NiconicoMovie.search(params[:q])\n @niconicomovies = @search.result.order(\"id DESC\").page(params[:page]).per(25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @niconicomovies }\n end\n end", "def show\n @uchronist = Uchronist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronist }\n end\n end", "def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "def index\n @gt_metrix_tests = apply_scopes(GtMetrixTest).all\n\n render json: @gt_metrix_tests\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 index\n @time_episodes = TimeEpisode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_episodes }\n end\n end", "def print_movies(films)\n # some iteration magic and puts out the movies in a nice list\n films.each do |film|\n response_string = RestClient.get(film)\n response_hash = JSON.parse(response_string)\n puts response_hash[\"title\"]\n end\nend", "def get_one\n test_data = @test.get_one\n return render json: test_data\n end", "def show\n @test = LoadTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test }\n end\n end", "def test\n render json: { message: 'Hello World' }\n end", "def test_key_containing_status\n server_run app: ->(env) { [200, {'Teapot-Status' => 'Boiling'}, []] }\n data = send_http_and_read \"GET / HTTP/1.0\\r\\n\\r\\n\"\n\n assert_match(/HTTP\\/1.0 200 OK\\r\\nTeapot-Status: Boiling\\r\\nContent-Length: 0\\r\\n\\r\\n/, data)\n end", "def index\n @musictracks = Musictrack.all\n end", "def index\n @servers = getmydata(\"Server\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end", "def index\n @heartbeats = Heartbeat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heartbeats }\n end\n end", "def index\n @vehicle_realtimes = VehicleRealtime.all\n \n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtimes.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end", "def show\n render json: @test\n end", "def show\n @test_run = TestRun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_run }\n end\n end", "def index\n @hour_logs = HourLog.all\n render json: @hour_logs, status: 200\n end", "def update\n respond_to do |format|\n if @testimonio.update(testimonio_params)\n format.html { redirect_to @testimonio, notice: 'Testimonio was successfully updated.' }\n format.json { render :show, status: :ok, location: @testimonio }\n else\n format.html { render :edit }\n format.json { render json: @testimonio.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n weathers = Weather.all\n render json: weathers, status: 200\n end", "def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end", "def show\n render json: @heartbeat\n end", "def index\n @mugshots = Mugshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mugshots }\n end\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 @phones = Phone.all\n json_response(@phones)\n end", "def calc_uptime(api_key)\n urlUptime = \"https://api.uptimerobot.com/getMonitors?apiKey=#{api_key}&format=json&noJsonCallback=1&responseTimes=1&logs=1&customUptimeRatio=1-7-30-365\"\n response = RestClient.get(urlUptime)\n if response.code == 200\n responseUptime = JSON.parse(response.body, :symbolize_names => true)\n uptime = responseUptime[:monitors][:monitor][0][:customuptimeratio]\n return uptime.split('-')\n else\n puts 'Error: ' + response.code + ' ' + response.body\n return ['?','?','?','?']\n end\n \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 test\n get(\"/help/test\")\n end", "def test!\n @@api.post(endpoint: self.endpoint + ['test'])\n end", "def index\n render json: @test_module.test_questions, status: :ok\n end", "def index\n @tracks = Track.all\n render json: {tracks: @tracks}\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pushup_reminders }\n end\n end", "def index\n @heroes = Hero.all\n\n render json: @heroes\n end", "def index\n @tutoring_sessions = TutoringSession.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tutoring_sessions }\n end\n end", "def index\n @online_tests = OnlineTest.all\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 index\n @streams = Stream.all\n json_response(@streams)\n end" ]
[ "0.6846062", "0.6368691", "0.63255244", "0.63231325", "0.63231325", "0.608658", "0.606554", "0.5920407", "0.5920306", "0.58811176", "0.5878454", "0.5876871", "0.58477205", "0.58137375", "0.5809874", "0.5787835", "0.57025766", "0.56837815", "0.56659925", "0.5658202", "0.56211483", "0.5595147", "0.55858344", "0.55800784", "0.5579283", "0.5572634", "0.5560428", "0.55435294", "0.55326337", "0.5525137", "0.5518155", "0.5514983", "0.55064857", "0.5501653", "0.5490848", "0.54722047", "0.5451696", "0.5450589", "0.5443096", "0.5433999", "0.5433999", "0.54315215", "0.54266804", "0.5418489", "0.54074526", "0.54007024", "0.53984004", "0.53931075", "0.5389412", "0.5387452", "0.5386573", "0.5382983", "0.53777695", "0.5370272", "0.53535545", "0.5338688", "0.533809", "0.53350097", "0.53347", "0.53248835", "0.53209084", "0.53165656", "0.53156346", "0.5311355", "0.5311355", "0.53026474", "0.5299474", "0.5293767", "0.52847856", "0.5279816", "0.5276999", "0.52750325", "0.52716273", "0.52701133", "0.52611554", "0.525907", "0.5258238", "0.52555233", "0.5251275", "0.5248732", "0.5247849", "0.5242206", "0.5241676", "0.5238165", "0.5235783", "0.52316517", "0.52316517", "0.5225849", "0.52242744", "0.5222064", "0.5219854", "0.5219528", "0.5219477", "0.52168024", "0.52165645", "0.521353", "0.5209724", "0.5208032", "0.52079564", "0.5206431" ]
0.73134476
0
GET /testimonios/1 GET /testimonios/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @testimonios = Testimonio.all\n end", "def index\n\t@instruction = Instruction.find( params[ :instruction_id ] )\n @testimonies = @instruction.testimonies.page( params[ :page ] ).per(20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testimonies }\n end\n end", "def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end", "def set_testimonio\n @testimonio = Testimonio.find(params[:id])\n end", "def test\n get(\"/help/test.json\")\n end", "def test\n get(\"/help/test.json\")\n end", "def get_one\n test_data = @test.get_one\n return render json: test_data\n end", "def show\n render json: @testmonial\n end", "def index\n render status: :ok, json: @tests\n end", "def index\n json = HTTParty.get(\"https://api.typeform.com/v1/form/WaIffL?key=f486f2db8f1249c077a08b582bc3efe0a2617668\").body\n\n @jsontests = JSON.parse(json)\n\n end", "def room_descriptions_method\r\n my_port = 8081\r\n htttproomnumber = $roomnumber\r\n roomsNtext = \"/#{htttproomnumber}\"\r\n rooms_message = \"/rooms#{roomsNtext}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{rooms_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n return my_json[\"room\"].to_s\r\nend", "def index\n @tests = Test.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tests }\n end\n end", "def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end", "def show\n @testis = Teste.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @testis }\n end\n end", "def show\n @uchronist = Uchronist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronist }\n end\n end", "def get_api_results(_url)\n JSON.parse File.read('spec/inspector/stubbed_example.json')\n end", "def index\n @uchronists = Uchronist.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronists }\n end\n end", "def create\n @testimonio = Testimonio.new(testimonio_params)\n\n respond_to do |format|\n if @testimonio.save\n format.html { redirect_to @testimonio, notice: 'Testimonio was successfully created.' }\n format.json { render :show, status: :created, location: @testimonio }\n else\n format.html { render :new }\n format.json { render json: @testimonio.errors, status: :unprocessable_entity }\n end\n end\n end", "def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend", "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 test\n Srchio::Response.new(self.class.get(\"/test\"))\n end", "def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend", "def show\n @microtask = Microtask.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microtask }\n end\n end", "def fetch_experiment(id)\n url = @base + \"experiments/#{id}.json?token=#{@token}\"\n puts url\n response = JSON.parse(RestClient.get(url))\nend", "def index\n @regimes = Regime.all\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @regimes }\n # end\n end", "def index\r\n render json: { status: \"Test API\"}\r\n end", "def index\n @mini_games = MiniGame.all\n render json: @mini_games, status: :ok\n end", "def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end", "def show\n @test = LoadTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test }\n end\n end", "def index\n @timers = Timer.all\n\n render json: @timers\n end", "def index\n @testers = Tester.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testers }\n end\n end", "def show\n @monit = Monit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monit }\n end\n end", "def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end", "def get_all_movies_for_actor(actor)\n url = \"http://movies.api.mks.io/movies\"\n response = RestClient.get(url, accept: 'application/json')\n\nend", "def show\n @test_run = TestRun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_run }\n end\n end", "def show\n @test10 = Test10.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test10 }\n end\n end", "def show\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio }\n end\n end", "def index\n @captures = Capture.all\n\n render json: @captures\n end", "def show\n @test = Test.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test }\n end\n end", "def index\r\n @clocks = ClockResult.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @clocks }\r\n end\r\n end", "def show\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tester }\n end\n end", "def index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @musics }\n end\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 index\n @software_tests = SoftwareTest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @software_tests }\n end\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 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 events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend", "def index\n @musics = Music.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @musics }\n end\n end", "def show\n @test_suite = TestSuite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_suite }\n end\n end", "def get_all_actors_for_movie(movie)\n url = \"http://movies.api.mks.io/actors\"\n response = RestClient.get(url, accept: 'application/json')\n\nend", "def show\n @simnumlog = Simnumlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @simnumlog }\n end\n end", "def show\n @monnaie = Monnaie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monnaie }\n end\n end", "def index\n @servers = getmydata(\"Server\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end", "def show\n @livestock = Livestock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @livestock }\n end\n end", "def index\n json_response(@device.browsers)\n end", "def index\n @phones = Phone.all\n json_response(@phones)\n end", "def show\n render status: :ok, json: @test\n end", "def index\n @presented_testimonies = PresentedTestimony.all\n end", "def show\n @tktest = Tktest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tktest }\n end\n end", "def index\n @test_runs = TestRun.accessible_by(current_ability).order(\"updated_at DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @test_runs }\n end\n end", "def film_api(url)\n film_response = RestClient.get(url)\n film_hash = JSON.parse(film_response)\nend", "def show\n @test_summary = TestSummary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_summary }\n end\n end", "def show\n @metric = Metric.find(params[:id])\n\n render json: @metric\n end", "def index\n @mugshots = Mugshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mugshots }\n end\n end", "def show\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @testcase }\n end\n end", "def gettestcoverage\n\tstandName = params[:release]\n\t# получаем список тестов\n\n\ttestlist = ''\n\tTCPSocket.open('172.20.5.130', 2000){ |client|\n\t# say Hello to server\n\tclient.puts \"MasterOnline\"\n\tclient.gets\n\tclient.puts \"master_set get_test_coverage \" + standName\n\t#workerList = JSON.parse(client.gets)\n\ttestlist = client.gets\n\tclient.puts \"master_set close_connection\"\n\t}\n\tputs \"TestcontrolController - gettestcoverage\"\n\ttest = '{\"dataArray\" : [{\"name\" : \"PriorityName\", \"value\" : [\"testName1\", \"testName2\", \"testName3\"]}, {\"name\" : \"PriorityName\", \"value\" : [\"testName1\", \"testName2\", \"testName3\"]}]}'\n\trender :text => testlist\n end", "def show\n @timer = Timer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timer }\n end\n end", "def ruvithrottir\n Apis.client.get('/tv/ruvithrottir')\n end", "def show\n render json: @test\n end", "def show\n id = params.keys[1] # Query variable is the ID of the TV show that the user clicks on.\n\n #template = Addressable::Template.new('https://api.themoviedb.org/3/tv/{?query*}?api_key=fb6a1d3f38c3d97f67df6d141f936f29&language=en-US')\n #url = template.expand({\"query\" => id})\n #response = HTTParty.get(url)\n\n url = Addressable::URI.parse(\"https://api.themoviedb.org/3/tv/#{id}?api_key=fb6a1d3f38c3d97f67df6d141f936f29&language=en-US\")\n response = HTTParty.get(url)\n\n @show = JSON.parse(response.body, symbolize_names: true) \n end", "def index\n @instituicoes = Instituicao.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instituicoes }\n end\n end", "def index\n @time_frames = TimeFrame.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_frames }\n end\n end", "def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend", "def show\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @specie }\n end\n end", "def show\n render json: @heartbeat\n end", "def get_movies_from_api\n all_films = RestClient.get('http://www.swapi.co/api/films/')\n film_hash = JSON.parse(all_films) \nend", "def get_reading\n\t\turi = URI.parse('http://localhost:5000/thermometers.json')\n\t\tthermo_response = Net::HTTP.get_response(uri)\n\t\tcheck = thermo_response.body\n\t\tj = JSON.parse(check)\n\tend", "def index\n @service_times = ServiceTime.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @service_times }\n end\n end", "def show\n @heartbeat = Heartbeat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heartbeat }\n end\n end", "def get(path, params={})\n params = merge_set_up_params(params)\n JSON.parse(Typhoeus::Request.get(API_URL + path, :params => params).body)[\"response\"]\n end", "def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end", "def test\n render json: { test: 'Tested.' }\n end", "def test\n render json: { test: 'Tested.' }\n end", "def show\n render json: @test_ride\n end", "def show\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ginasio }\n end\n end", "def index\n @api_v1_todos = Todo.all\n render json: @api_v1_todos\n end", "def getstubjson(title_number)\n uri = URI.parse($STUBJSON)\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new('/' + title_number)\n request.basic_auth $http_auth_name, $http_auth_password\n response = http.request(request)\n if (response.code != '200') then\n raise \"Error in getting JSON for: \" + title_number\n end\n return response.body\nend", "def index\n @machines = Machine.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @machines }\n end\n end", "def show\n @test_page = TestPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_page }\n end\n end", "def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end", "def show\n @test_board = TestBoard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_board }\n end\n end", "def index\n @heroes = Hero.all\n\n render json: @heroes\n end", "def view_api\n api_string = RestClient.get(\"https://itunes.apple.com/search?term=star+wars&entity=song&attribute=movieTerm\")\n api_hash = JSON.parse(api_string)\n\n end", "def print_movies(films)\n # some iteration magic and puts out the movies in a nice list\n films.each do |film|\n response_string = RestClient.get(film)\n response_hash = JSON.parse(response_string)\n puts response_hash[\"title\"]\n end\nend", "def index\n weathers = Weather.all\n render json: weathers, status: 200\n end", "def index\r\n @imobiliarias = Imobiliaria.all\r\n\r\n respond_to do |format|\r\n # format.html # index.html.erb\r\n format.json { render json: @imobiliarias }\r\n end\r\n end", "def show\n @test_result = TestResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_result }\n end\n end", "def index\n @timetables = Timetable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @timetables }\n end\n end", "def show\n @core_termo_vistorium = Core::TermoVistorium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_termo_vistorium }\n end\n end", "def show\n @software_test = SoftwareTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @software_test }\n end\n end" ]
[ "0.7100124", "0.6881578", "0.6466508", "0.6392654", "0.6091789", "0.6091789", "0.6069096", "0.5996124", "0.5942491", "0.5941217", "0.59117836", "0.58963174", "0.58531046", "0.5843974", "0.5809596", "0.5794616", "0.57789165", "0.5764538", "0.5760786", "0.57169074", "0.57052535", "0.569971", "0.5684726", "0.56831187", "0.5672423", "0.5653329", "0.56460047", "0.56417316", "0.56366885", "0.5620014", "0.56191784", "0.5617062", "0.56158113", "0.5615051", "0.5606593", "0.56052524", "0.5604204", "0.56028026", "0.55895096", "0.556897", "0.5557033", "0.5556928", "0.55513006", "0.5548419", "0.554821", "0.554821", "0.553608", "0.55290383", "0.5528083", "0.5519075", "0.5509944", "0.5507916", "0.55077523", "0.5499208", "0.5496843", "0.5494965", "0.5491977", "0.54763186", "0.54736704", "0.5463603", "0.54564285", "0.5451277", "0.54510033", "0.5447125", "0.544697", "0.5443332", "0.5440664", "0.54405576", "0.54395574", "0.5438858", "0.5438568", "0.54325795", "0.54325557", "0.5430836", "0.5420613", "0.541029", "0.54089034", "0.5405296", "0.540381", "0.54006195", "0.5400416", "0.53986293", "0.53954077", "0.53954077", "0.5394993", "0.5391332", "0.5390308", "0.53863776", "0.538442", "0.53787047", "0.5378414", "0.536938", "0.5368813", "0.53660995", "0.5365566", "0.5364723", "0.5362768", "0.5356031", "0.53526944", "0.53521574", "0.53452504" ]
0.0
-1
POST /testimonios POST /testimonios.json
def create @testimonio = Testimonio.new(testimonio_params) respond_to do |format| if @testimonio.save format.html { redirect_to @testimonio, notice: 'Testimonio was successfully created.' } format.json { render :show, status: :created, location: @testimonio } else format.html { render :new } format.json { render json: @testimonio.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end", "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 set_testimonio\n @testimonio = Testimonio.find(params[:id])\n end", "def index\n @testimonios = Testimonio.all\n end", "def test!\n @@api.post(endpoint: self.endpoint + ['test'])\n end", "def testimonio_params\n params.require(:testimonio).permit(:nombre, :descripcion, :link, :activo)\n end", "def test_should_create_invite_via_API_JSON\r\n get \"/logout\"\r\n post \"/invites.json\", :api_key => 'testapikey',\r\n :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response :created\r\n invite = JSON.parse(response.body)\r\n check_new_invite(invite) \r\n end", "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def test_create_iphone_report\n post(:create, \"reporter\"=>{\"uniqueid\"=>\"13506d733bc5372a3b818fdf29ef8fb7386b3dc3\", \"zipcode\"=>\"21012\", \"firstname\"=>\"David\", \"lastname\"=>\"Troy\", \"email\"=>\"dave@popvox.com\"},\n \"format\"=>\"iphone\",\n \"report\"=>{\"latlon\"=>\"39.025,-76.511:114\", \"title\"=>\"This is a test\", \"body\" => \"Body text\" } )\n assert_response :success\n assert_equal \"OK\", @response.body\n reporter = IphoneReporter.find_by_uniqueid(\"13506d733bc5372a3b818fdf29ef8fb7386b3dc3\")\n assert_equal \"David Troy\", reporter.name\n end", "def create\n @test = Test.create!(test_params)\n\n render json: @test\n end", "def index\n json = HTTParty.get(\"https://api.typeform.com/v1/form/WaIffL?key=f486f2db8f1249c077a08b582bc3efe0a2617668\").body\n\n @jsontests = JSON.parse(json)\n\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 index\n\t@instruction = Instruction.find( params[ :instruction_id ] )\n @testimonies = @instruction.testimonies.page( params[ :page ] ).per(20)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testimonies }\n end\n end", "def test_post_then_get\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n id = last_response.body\n\n get \"/traces/#{id}\"\n check_valid_trace last_response.body\n end", "def update\n respond_to do |format|\n if @testimonio.update(testimonio_params)\n format.html { redirect_to @testimonio, notice: 'Testimonio was successfully updated.' }\n format.json { render :show, status: :ok, location: @testimonio }\n else\n format.html { render :edit }\n format.json { render json: @testimonio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @presented_testimony = PresentedTestimony.new(presented_testimony_params)\n\n respond_to do |format|\n if @presented_testimony.save\n format.html { redirect_to @presented_testimony, notice: 'Presented testimony was successfully created.' }\n format.json { render :show, status: :created, location: @presented_testimony }\n else\n format.html { render :new }\n format.json { render json: @presented_testimony.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testis = Teste.new(params[:testis])\n\n respond_to do |format|\n if @testis.save\n format.html { redirect_to @testis, notice: 'Teste was successfully created.' }\n format.json { render json: @testis, status: :created, location: @testis }\n else\n format.html { render action: \"new\" }\n format.json { render json: @testis.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 test_should_create_project_via_API_JSON\r\n get \"/logout\"\r\n post \"/projects.json\", :api_key => 'testapikey',\r\n :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response :created\r\n project = JSON.parse(response.body)\r\n check_new_project(project) \r\n end", "def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end", "def create_post(params)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.post(new_post_endpoint, { 'router.params' => params, format: :json })\n end", "def create\n @performance_test = PerformanceTest.new(params[:performance_test])\n\n respond_to do |format|\n if @performance_test.save\n format.html { redirect_to @performance_test, :notice => 'Performance test was successfully created.' }\n format.json { render :json => @performance_test, :status => :created, :location => @performance_test }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @performance_test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_client_post\n client = CoAP::Client.new\n answer = client.post('coap.me', 5683, '/test', 'TD_COAP_CORE_04')\n assert_equal(2, answer.mcode[0])\n assert_equal(1, answer.mcode[1])\n assert_equal('POST OK', answer.payload)\n end", "def create\n value = if params['value']\n if params['value'] =~ /\\A[0-9]+\\z/\n params['value'].to_i\n else\n params['value'].to_f\n end\n else\n params['value']\n end\n\n cmd = \"/usr/bin/env ruby #{Rails.root}/lib/simsim/cmd #{params['event_socket']} #{params['kind']} #{params['name']} #{value}\"\n\t\t`#{cmd}`\n respond_to do |format|\n format.json{ render :json => {} }\n end\n end", "def create\n @phonetic_test = PhoneticTest.new(phonetic_test_params)\n\n respond_to do |format|\n if @phonetic_test.save\n format.html { redirect_to @phonetic_test, notice: 'Phonetic test was successfully created.' }\n format.json { render :show, status: :created, location: @phonetic_test }\n else\n format.html { render :new }\n format.json { render json: @phonetic_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def startTest(client, dtype, dname, logid, passw, ttype, tcsno, wifis, build)\n\n\t\t#$dname = client.waitForDevice(\"\\\"@name='#{dname}' AND @remote='true'\\\"\", 300000)\n\t\t@dtype = dtype\n\t\t@dname = dname\n\t\t@logid = logid\n\t\t@passw = passw\n\t\t@ttype = ttype\n\t\t@tcsno = tcsno\n\t\t@wifis = wifis\n\t\t@build = build\n\n\t\tif @ttype == \"select\"\n\t\t\tx = @tcsno.split \",\"\n\t\t\tputs \"::MSG::TCs to be EXECUTED : #{x}\"\n\t\t\t$total_tc = x.length\n\t\telse\n\t\t\t$total_tc = 37\n\t\tend\n\n\t\tif @dtype == \"ios\"\n\t\t\t#temp: code for reserving a remote iOS device\n\t\t\turi = URI('http://10.4.136.3:8081/api/v1/devices')\n\t\t\treq = Net::HTTP::Get.new(uri)\n\t\t\treq.basic_auth 'admin', 'Unext1101'\n\t\t\t#req.basic_auth 'unext-qa', 'Unextqa1'\n\t\t\tres = Net::HTTP.start(uri.hostname, uri.port) {|http|\n\t\t\t http.request(req)\n\t\t\t}\n\t\t\t#Get the device id for the desired device\n\t\t\tapi_result = JSON.parse(res.body)\n\t\t\tdevices_array = api_result[\"data\"]\n\t\t\trequested_device_id = \"\"\n\t\t\t\n\t\t\tdevices_array.each do |device|\n\t\t\t \tif device[\"deviceName\"] == @dname\n\t\t\t\t\trequested_device_id = device[\"id\"]\t\t\t\t\t\n\t\t\t\tend\n\t\t\tend\n\t\t\t#And now reserve the device\n\t\t\turi = URI('http://10.4.136.3:8081/api/v1/devices/' + requested_device_id + '/reservations/new')\n\t\t\treq = Net::HTTP::Post.new(uri)\n\t\t\treq.basic_auth 'admin', 'Unext1101'\n\t\t\t#req.basic_auth 'unext-qa', 'Unextqa1'\n\t\t\treq.set_form_data('start' => Time.new.strftime(\"%Y-%m-%d-%H-%M-%S\"), 'end' => '2016-12-30-23-00-00', 'clientCurrentTimestamp' => Time.new.strftime(\"%Y-%m-%d-%H-%M-%S\"))\n\t\t\tres = Net::HTTP.start(uri.hostname, uri.port) {|http|\n\t\t\t http.request(req)\n\t\t\t}\n\t\t\tclient.addDevice(\"c24994f50118a6ae9db6a911da628b477a0ba401\", \"ipadair\")\n\t\t\tclient.setDevice(\"#{\"ios_app:\" + @dname}\")\n\t\t\t#client.setDevice(\"#{@dname}\")\n\t\t\t#temp\n\t\t\tclient.openDevice()\n\t\t\tclient.sleep(2000)\n\t\t\t$obj_utili.andConnectingWifi(client, @dtype, @dname, @wifis)\n\t\t\tclient.sleep(2000)\n\t\t\tif @build == nil\n\t\t\t\tputs \"::MSG:: Apps will be using currently installed build\"\n\t\t\telse\n\t\t\t\tputs ($obj_instl.ios_testInstallApps(client, @build))\n\t\t\tend\n\t\t\tclient.launch(\"jp.unext.mediaplayer\", true, false)\n\t\t\tclient.sleep(5000)\n\t\t\t$obj_slctv.iosSelectiveTests(client, @logid, @passw, @ttype, @tcsno)\n\t\telsif @dtype == \"android\"\t\t\t\t\t\t\n\t\t\t#client.setDevice(\"#{$dname}\")\n\t\t\t#client.waitForDevice(\"\\\"@name='#{$dname}' AND @remote='true'\\\"\", 300000)\n\t\t\t#temp: code for reserving a remote iOS device\n\t\t\turi = URI('http://10.4.136.3:8081/api/v1/devices')\n\t\t\treq = Net::HTTP::Get.new(uri)\n\t\t\treq.basic_auth 'admin', 'Unext1101'\n\t\t\t#req.basic_auth 'unext-qa', 'Unextqa1'\n\t\t\tres = Net::HTTP.start(uri.hostname, uri.port) {|http|\n\t\t\t http.request(req)\n\t\t\t}\n\t\t\t#Get the device id for the desired device\n\t\t\tapi_result = JSON.parse(res.body)\n\t\t\tdevices_array = api_result[\"data\"]\n\t\t\trequested_device_id = \"\"\n\t\t\t\n\t\t\tdevices_array.each do |device|\n\t\t\t \tif device[\"deviceName\"] == @dname\n\t\t\t\t\trequested_device_id = device[\"id\"]\t\t\t\t\t\n\t\t\t\tend\n\t\t\tend\n\t\t\t#And now reserve the device\n\t\t\turi = URI('http://10.4.136.3:8081/api/v1/devices/' + requested_device_id + '/reservations/new')\n\t\t\treq = Net::HTTP::Post.new(uri)\n\t\t\treq.basic_auth 'admin', 'Unext1101'\n\t\t\t#req.basic_auth 'unext-qa', 'Unextqa1'\n\t\t\treq.set_form_data('start' => Time.new.strftime(\"%Y-%m-%d-%H-%M-%S\"), 'end' => '2016-12-30-23-00-00', 'clientCurrentTimestamp' => Time.new.strftime(\"%Y-%m-%d-%H-%M-%S\"))\n\t\t\tres = Net::HTTP.start(uri.hostname, uri.port) {|http|\n\t\t\t http.request(req)\n\t\t\t}\n\t\t\tclient.addDevice(\"CB5A233UKX\", \"401SO\")\n\t\t\tclient.setDevice(\"#{@dname}\")\n\t\t\t#temp\n\n\t\t\tclient.openDevice()\n\t\t\tclient.sleep(2000)\n\t\t\t$obj_utili.andConnectingWifi(client, @dtype, @dname, @wifis)\n\t\t\t#CURRENTLY AUTO BUILD FOR ANDROID IS NOT PREPARED, WHEN JENKINS AUTO BUILD WILL BE DELIVERED, TEST CAN BE RESUMED\n\t\t\t#if @build == nil\n\t\t\t#\tputs \"::MSG:: Apps will be using currently installed build\"\n\t\t\t#else\n\t\t\t#\tputs ($obj_instl.testInstallApps(client, @build))\n\t\t\t#end\n\t\t\tclient.launch(\"jp.unext.mediaplayer/jp.co.unext.unextmobile.MainActivity\", true, false)\n\t\t\tclient.sleep(5000)\t\t\t\n\t\t\t$obj_slctv.andSelectiveTests(client, @logid, @passw, @ttype, @tcsno)\t\t\n\t\telse\n\t\t\tputs \"::MSG:: 該当デバイスが見つかりません「Confirm target test devcie」\"\n\t\tend\t\t\n\tend", "def v2_tests_post(test_detail, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: TestsApi#v2_tests_post ...\"\n end\n \n # verify the required parameter 'test_detail' is set\n fail \"Missing the required parameter 'test_detail' when calling v2_tests_post\" if test_detail.nil?\n \n # resource path\n path = \"/v2/tests\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'text/json', 'application/xml', 'text/xml']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(test_detail)\n \n\n auth_names = []\n result = @api_client.call_api(:POST, 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 => 'TestSummary')\n if Configuration.debugging\n Configuration.logger.debug \"API called: TestsApi#v2_tests_post. Result: #{result.inspect}\"\n end\n return result\n end", "def create\n @musictrack = Musictrack.new(musictrack_params)\n\n respond_to do |format|\n if @musictrack.save\n format.html { redirect_to @musictrack, notice: 'Musictrack was successfully created.' }\n format.json { render :show, status: :created, location: @musictrack }\n else\n format.html { render :new }\n format.json { render json: @musictrack.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jsontest = Jsontest.new(jsontest_params)\n\n respond_to do |format|\n if @jsontest.save\n format.html { redirect_to @jsontest, notice: 'Jsontest was successfully created.' }\n format.json { render :show, status: :created, location: @jsontest }\n else\n format.html { render :new }\n format.json { render json: @jsontest.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_params\n params.require(:test).permit(:indentifier, :description, :time)\n end", "def create\n @test_metum = TestMetum.new(test_metum_params)\n\n respond_to do |format|\n if @test_metum.save\n format.html { redirect_to @test_metum, notice: 'Test metum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @test_metum }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testtest = Testtest.new(testtest_params)\n\n respond_to do |format|\n if @testtest.save\n format.html { redirect_to @testtest, notice: 'Testtest was successfully created.' }\n format.json { render :show, status: :created, location: @testtest }\n else\n format.html { render :new }\n format.json { render json: @testtest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @weather_test = WeatherTest.new(weather_test_params)\n\n respond_to do |format|\n if @weather_test.save\n format.html { redirect_to @weather_test, notice: 'Weather test was successfully created.' }\n format.json { render :show, status: :created, location: @weather_test }\n else\n format.html { render :new }\n format.json { render json: @weather_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def _test_launch_process_with_json_launchitem\n\n li = LI_WITH_DEFINITION.to_h.dup\n\n #puts \"===\"\n #p li.to_json\n #puts \"===\"\n\n li['attributes']['food'] = 'tamales'\n\n post(\n '/processes.json',\n li.to_json,\n { 'CONTENT_TYPE' => 'application/json' })\n\n sleep 0.350\n\n puts @response.body\n\n assert_equal 'application/json', @response.headers['Content-type']\n\n fei = json_parse(@response.body)\n assert_equal 'ruote_rest', fei['engine_id']\n\n assert_equal 1, OpenWFE::Extras::ArWorkitem.find(:all).size\n wi = OpenWFE::Extras::ArWorkitem.find(:first)\n\n assert_equal 'tamales', wi.as_owfe_workitem.fields['food']\n end", "def test_json_over_https\n dir = File.dirname(__FILE__)\n d = create_driver(CONFIG + %[\n use_ssl\n ssl_keys [\"#{File.join(dir, 'server.key')}\", \"#{File.join(dir, 'server.cert')}\"]\n ])\n\n time = Time.parse(\"2011-01-02 13:14:15 UTC\").to_i\n\n d.expect_emit \"tag1\", time, {\"a\" => 1}\n d.expect_emit \"tag2\", time, {\"a\" => 2}\n\n d.run do\n d.expected_emits.each { |tag,time,record|\n res = post(\"/#{tag}\", {\"json\" => record.to_json, \"time\" => time.to_s}, {}, true)\n assert_equal \"200\", res.code\n }\n end\n end", "def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend", "def create\n @nginxtest = Nginxtest.new(nginxtest_params)\n\n respond_to do |format|\n if @nginxtest.save\n format.html { redirect_to @nginxtest, notice: \"Nginxtest was successfully created.\" }\n format.json { render :show, status: :created, location: @nginxtest }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @nginxtest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @medical_test = MedicalTest.new(medical_test_params)\n\n respond_to do |format|\n if @medical_test.save\n format.html { redirect_to @medical_test, notice: 'Medical test was successfully created.' }\n format.json { render :show, status: :created, location: @medical_test }\n else\n format.html { render :new }\n format.json { render json: @medical_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def run_tests\n test_suite = self.task.tests.order(:order)\n testsStrings = test_suite.map do |test|\n test_string = task.fxn_name + \"(\"\n test_string + \"...\"+test.parsed_inputs.to_s + \")\"\n end\n formated_user_code = self.solution.gsub(\"\\n\", \" \")\n data = JSON.dump({user_code: formated_user_code, tests: testsStrings})\n uri = URI.parse(\"https://wci7v1nq8j.execute-api.us-west-2.amazonaws.com/v1\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(uri.request_uri)\n request.body = data\n response = http.request(request)\n response = JSON.parse(response.body)\n if response[\"errorMessage\"]\n message = response[\"errorMessage\"]\n if message.include?(\"timed out\")\n message = \"Task timed out after 4.00 seconds\"\n end\n return {error: true, error_message: message }\n end\n user_results = response[\"results\"]\n test_results = {log: response[\"log\"].gsub(\"\\n\", \"<br/>\"), results: {} }\n test_suite.each_with_index do |test, idx|\n result = user_results[idx]\n passed = result == test.output\n test_result = {\n passed: passed,\n expected: test.output.to_s,\n received: result.to_s\n }\n test_results[:results][test.order] = test_result\n end\n handle_completion(test_results[:results])\n test_results\n end", "def create\n @tktest = Tktest.new(params[:tktest])\n\n respond_to do |format|\n if @tktest.save\n format.html { redirect_to @tktest, notice: 'Tktest was successfully created.' }\n format.json { render json: @tktest, status: :created, location: @tktest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tktest.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_post_success_with_param\n post \"/\", {:data => @test_obj} do |response|\n assert response.ok?, \"Create test object failed\"\n assert_equal response.body, @test_obj.to_json, \"Did not get @test_obj back\"\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 suscriber_wm\n\t\turi = URI(\"http://staging.benchprep.com/api/v1/test/fixtures.json\")\t\n\n\t\tres = Net::HTTP.post_form(uri, 'email' => 'integration-tester+1@benchprep.com&enrollments_persona=subscriber&devices_persona=web_and_mobile')\n\t\t# write this output to a file\n\t\toutput = File.open( \"spec/fixtures/sp_wm_persona.json\",'w' ){|f| \n\t\t\tf.flock(File::LOCK_EX)\n\t\t\tf.write(res.body)\n\t\t}\n\n\t\t# Now parse this string as json\n\t\tjson = File.read('spec/fixtures/sp_wm_persona.json')\n\t\templs = JSON.parse(json)\n\n\t\treturn empls #pretty printed output\n\tend", "def create\n @noticium = Noticium.new(noticium_params)\n\n respond_to do |format|\n if @noticium.save\n format.html { redirect_to @noticium, notice: 'Noticium was successfully created.' }\n format.json { render :show, status: :created, location: @noticium }\n else\n format.html { render :new }\n format.json { render json: @noticium.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_retry_test method_name, instructions\n retry_test_uri = HOST + \"retry_test\"\n uri = URI.parse retry_test_uri\n headers = {\"Content-Type\" => \"application/json\"}\n data = {\"instructions\" => {method_name => instructions.to_a}}.to_json\n http = Net::HTTP.new uri.host, uri.port\n request = Net::HTTP::Post.new uri.request_uri, headers\n request.body = data\n http.request request\n end", "def create\n @testcase = Testcase.new(params[:testcase])\n\n respond_to do |format|\n if @testcase.save\n format.html { redirect_to @testcase, :notice => 'Test was successfully created.' }\n format.json { render :json => @testcase, :status => :created, :location => @test }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @test_detail = TestDetail.new(test_detail_params)\n\n respond_to do |format|\n if @test_detail.save\n format.html { redirect_to @test_detail, notice: 'Test detail was successfully created.' }\n format.json { render :show, status: :created, location: @test_detail }\n else\n format.html { render :new }\n format.json { render json: @test_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_new_microtask\r\n #@assignment = assignments(:Assignment_Microtask1)\r\n questionnaire_id = questionnaires(:questionnaire1).id\r\n instructorid = users(:instructor1).id\r\n courseid = courses(:course_object_oriented).id,\r\n number_of_topics = SignUpTopic.count\r\n # create a new assignment\r\n post :new, :assignment => { :name => \"Assignment_Microtask1\",\r\n :directory_path => \"CSC517_instructor1/Assignment_Microtask1\",\r\n :submitter_count => 0,\r\n :course_id => courseid,\r\n :instructor_id => instructorid,\r\n :num_reviews => 1,\r\n :num_review_of_reviews => 0,\r\n :num_review_of_reviewers => 0,\r\n :review_questionnaire_id => questionnaire_id,\r\n :reviews_visible_to_all => 0,\r\n :require_signup => 0,\r\n :num_reviewers => 3,\r\n :team_assignment => 0,\r\n :team_count => 1,\r\n :microtask => true }\r\n\r\n assert_response 200\r\n assert Assignment.find(:all, :conditions => \"name = 'Assignment_Microtask1'\")\r\n\r\n end", "def create\n @smoke_test = SmokeTest.new(params[:smoke_test])\n\n respond_to do |format|\n if @smoke_test.save\n format.html { redirect_to(@smoke_test, :notice => 'Smoke test was successfully created.') }\n format.json { render :json => @smoke_test, :status => :created, :location => @smoke_test }\n format.xml { render :xml => @smoke_test, :status => :created, :location => @smoke_test }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @smoke_test.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @smoke_test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_params\n params.require(:test).permit(:name, :test_type_id, :schedule, :duration, :is_online, :no_of_items, :subject_class_id)\n end", "def post_as_json(data)\n uri = URI.parse(LISTENER)\n http = Net::HTTP.new(uri.host, uri.port)\n http.read_timeout = 0.5\n begin\n request = Net::HTTP::Post.new(uri.request_uri, {'Content-Type' => 'application/json'})\n request.body = data.to_json\n http.request(request){|res| puts \"Post status: #{res.body}\" }\n rescue StandardError => e\n puts \"Failed sending data: #{e.message}\"\n end\nend", "def create\n @test = Test.new(params[:test])\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Test was successfully created.' }\n format.json { render json: @test, status: :created, location: @test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @assessment_insti_test = AssessmentInstiTest.new(params[:assessment_insti_test])\n respond_to do |format|\n if@assessment_insti_test.save\n #if@assessment_insti_test.rb.status == 1\n Content.send_message_to_est(false,current_user,@assessment_insti_test)\n #end\n format.html { redirect_to@assessment_insti_test, notice: 'AssessmentInstiTest was successfully created.' }\n format.json { render json:@assessment_insti_test, status: :created, location:@assessment_insti_test }\n else\n format.html { render action: \"new\" }\n format.json { render json:@assessment_insti_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end", "def create\n @testowa = Testowa.new(testowa_params)\n\n respond_to do |format|\n if @testowa.save\n format.html { redirect_to @testowa, notice: 'Testowa was successfully created.' }\n format.json { render :show, status: :created, location: @testowa }\n else\n format.html { render :new }\n format.json { render json: @testowa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_suite = TestSuite.new(params[:test_suite])\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully created.' }\n format.json { render json: @test_suite, status: :created, location: @test_suite }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test = Test.new(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: 'Prueba creada exitosamente.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @channel = \"/free_pbx/test_calls/test\"\n @data = {extension: params[:test_call][:extension], data: params[:test_call][:data]}\n Rails.logger.debug \"Publishing to #{@channel}\"\n end", "def create_synthetics_test(type, config, options = {})\n body = {\n 'type' => type,\n 'config' => config\n }.merge(options)\n\n request(Net::HTTP::Post, \"/api/#{API_VERSION}/synthetics/tests\", nil, body, true)\n end", "def create\n megam_rest.post_event(to_hash)\n end", "def create\n @testing = Testing.new(testing_params)\n\n respond_to do |format|\n if @testing.save\n format.html { redirect_to @testing, notice: 'Testing was successfully created.' }\n format.json { render :show, status: :created, location: @testing }\n else\n format.html { render :new }\n format.json { render json: @testing.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mock_server = MockServer.new(mock_server_params)\n\n respond_to do |format|\n if @mock_server.save\n format.json { render :show, status: :created, location: @mock_server }\n else\n format.json { render json: @mock_server.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @testimonio.destroy\n respond_to do |format|\n format.html { redirect_to testimonios_url, notice: 'Testimonio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end", "def create\n @runtest = Runtest.new(runtest_params)\n\n respond_to do |format|\n if @runtest.save\n format.html { redirect_to @runtest, notice: 'Runtest was successfully created.' }\n format.json { render :show, status: :created, location: @runtest }\n else\n format.html { render :new }\n format.json { render json: @runtest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fixit_test = FixitTest.new(fixit_test_params)\n\n respond_to do |format|\n if @fixit_test.save\n format.html { redirect_to @fixit_test, notice: 'Fixit test was successfully created.' }\n format.json { render action: 'show', status: :created, location: @fixit_test }\n else\n format.html { render action: 'new' }\n format.json { render json: @fixit_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n render status: :ok, json: @tests\n end", "def create\n @httparty_test = HttpartyTest.new(httparty_test_params)\n\n respond_to do |format|\n if @httparty_test.save\n format.html { redirect_to @httparty_test, notice: 'Httparty test was successfully created.' }\n format.json { render :show, status: :created, location: @httparty_test }\n else\n format.html { render :new }\n format.json { render json: @httparty_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @m_test_type = MTestType.new(m_test_type_params)\n\n respond_to do |format|\n if @m_test_type.save\n format.html { redirect_to @m_test_type, notice: 'M test type was successfully created.' }\n format.json { render :show, status: :created, location: @m_test_type }\n else\n format.html { render :new }\n format.json { render json: @m_test_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testing_ = Testing.new(testing__params)\n\n respond_to do |format|\n if @testing_.save\n format.html { redirect_to @testing_, notice: 'Testing was successfully created.' }\n format.json { render action: 'show', status: :created, location: @testing_ }\n else\n format.html { render action: 'new' }\n format.json { render json: @testing_.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @type_test = TypeTest.new(type_test_params)\n\n respond_to do |format|\n if @type_test.save\n format.html { redirect_to @type_test, notice: 'Type test was successfully created.' }\n format.json { render :show, status: :created, location: @type_test }\n else\n format.html { render :new }\n format.json { render json: @type_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_suite = TestSuite.new(test_suite_params)\n\n respond_to do |format|\n if @test_suite.save\n format.html { redirect_to @test_suite, notice: 'Test suite was successfully created.' }\n format.json { render :show, status: :created, location: @test_suite }\n else\n format.html { render :new }\n format.json { render json: @test_suite.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_haiku(line_1,line_2,line_3)\n url = ENV[\"SLACK_URL\"]\n payload = {username: \"haiku-bot\", icon_url: \"christmas-haiku.jpg\", text: line_1+\"\\n\"+line_2+\"\\n\"+line_3, channel: \"#random\"}\n RestClient.post(url, payload.to_json, accept: :json)\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", "def create\n @test = current_user.tests.build(test_params)\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to thank_you_path, notice: 'Test was successfully created.' }\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_datum = TestDatum.new(test_datum_params)\n\n respond_to do |format|\n if @test_datum.save\n format.html { redirect_to @test_datum, notice: 'Test datum was successfully created.' }\n format.json { render :show, status: :created, location: @test_datum }\n else\n format.html { render :new }\n format.json { render json: @test_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_run = TestRun.new(params[:test_run])\n\n respond_to do |format|\n if @test_run.save\n format.html { redirect_to @test_run, notice: 'Test run was successfully created.' }\n format.json { render json: @test_run, status: :created, location: @test_run }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_run.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test10 = Test10.new(params[:test10])\n\n respond_to do |format|\n if @test10.save\n format.html { redirect_to @test10, notice: 'Test10 was successfully created.' }\n format.json { render json: @test10, status: :created, location: @test10 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test10.errors, status: :unprocessable_entity }\n end\n end\n end", "def generatesingletestplan\n\trelease = params[:release]\n\tpriority = params[:priority]\n\texectype = params[:exectype]\n\ttimelimit = params[:timelimit]\n\t# получаем с сервера нужные данные\n\tmds = Hash.new()\n\tTCPSocket.open('172.20.5.130', 2000){ |client|\n\t\t# say Hello to server\n\t\tclient.puts \"MasterOnline\"\n\t\tclient.gets\n\t\tclient.puts \"master_set get_singletestplan #{release} #{priority} #{exectype} #{timelimit}\"\n\t\tmds = JSON.parse(client.gets)\n\t\tclient.puts \"master_set close_connection\"\n\t}\n\t# подготавливаем данные для отправки на веб страницу\n\tnewTree = mds\n\t#newTree = newTree[\"TestItem\"][0]\n\t# новое дерево\n\t# вводим фиктивную вершину\n\tvalue = Hash.new()\n\tvalue[:data] = \"Тестирование \" + release\n\t\tfalseAttr = Hash.new()\n\t\tfalseAttr[:class] = \"jstree-checked\"\n\t\tfalseAttr[:id] = \"0001\"\n\t\tfalseAttr[:MethodName] = \"\"\n\t\tfalseAttr[:UnitName] = \"\"\n\tvalue[:attr] = falseAttr\n\t# получаем дерево\n\tchildrens = Array.new()\n\tnewTree[\"TestItem\"].each do |x|\n\t\ttree = createTreeForView(x)\n\t\tchildrens.push(tree)\n\tend\n\tvalue[:children] = childrens\n\trawarray = { :data => value}\n\tmds_for_send = rawarray.to_json\n\trender :text => mds_for_send\n end", "def posttestrail(runId, caseId, statusId, versionId, elapsedseconds)\r\n\r\n uri = \"http://testrailgw.jupiter.bbc.co.uk/?action=add_result_for_case&run_id=#{runId}&case_id=#{caseId}&status_id=#{statusId}&version=#{versionId}&elapsed_seconds=#{elapsedseconds}&sharedSecret=thI5iSourSHAREDsecret\"\r\n #uri = \"http://testrailgw.jupiter.bbc.co.uk/?action=add_result_for_case&run_id=110324&case_id=665022&status_id=1&version=Test&elapsed_seconds=12&sharedSecret=thI5iSourSHAREDsecret\"\r\n\r\n uri = uri.gsub(\" \", \"%20\")\r\n xml_data = open(uri).read\r\n if(xml_data.include? '\"test_id\":')\r\n recorded = xml_data.split('\"test_id\":')[1]\r\n testID = recorded.split(',\"status_id\"')[0]\r\n puts \"TestID:\"+testID\r\n else\r\n puts xml_data\r\n fail \"Cannot Post result to Testrail, check Webservice\"\r\n end\r\n\r\n timeStamp = Time.now.strftime (\"posted at %H:%M %d/%m/%Y\")\r\n files = \"//zgbwcfs3005.jupiter.bbc.co.uk/QA/Jenkins/Jupiter/ICETEAresultupdatelog.txt\"\r\n f = File.open(files,'a')\r\n f.write \"#{testID} #{timeStamp}\"\r\n f.close\r\nend", "def submit_report(json, cookbookname)\n data = File.read(json)\n uri = URI.parse($SPEC_ENDPOINT)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == \"https\"\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(\"/api/reports\")\n request.add_field('Content-Type', 'application/json')\n request.body = {\n :spec_result => data,\n :hostname => `hostname`.chomp,\n :cookbook_name => cookbookname\n }.to_json\n response = http.request(request)\n end", "def create\n @iot = Iot.new(iot_params)\n\n respond_to do |format|\n if @iot.save\n format.html { redirect_to @iot, notice: 'Iot was successfully created.' }\n format.json { render :show, status: :created, location: @iot }\n else\n format.html { render :new }\n format.json { render json: @iot.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testtype = Testtype.new(testtype_params)\n\n respond_to do |format|\n if @testtype.save\n format.html { redirect_to @testtype, notice: 'Testtype was successfully created.' }\n format.json { render action: 'show', status: :created, location: @testtype }\n else\n format.html { render action: 'new' }\n format.json { render json: @testtype.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_meta_datum = TestMetaDatum.new(test_meta_datum_params)\n\n respond_to do |format|\n if @test_meta_datum.save\n format.html { redirect_to @test_meta_datum, notice: 'Test meta datum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @test_meta_datum }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_meta_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_send_unix_date_time_array()\n # Parameters for the API call\n datetimes = APIHelper.json_deserialize(\n '[1484719381,1484719381]'\n ).map { |element| DateTimeHelper.from_unix(element) }\n\n # Perform the API call through the SDK function\n result = @controller.send_unix_date_time_array(datetimes)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "def test_send_unix_date_time_array()\n # Parameters for the API call\n datetimes = APIHelper.json_deserialize(\n '[1484719381,1484719381]'\n ).map { |element| DateTimeHelper.from_unix(element) }\n\n # Perform the API call through the SDK function\n result = @controller.send_unix_date_time_array(datetimes)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "def test_http_listener\n\n fei = RuoteRest.engine.launch %{\n class TestHttpListener < OpenWFE::ProcessDefinition\n sequence do\n alpha\n bravo\n end\n end\n }\n\n sleep 0.450\n\n get \"/workitems/#{fei.wfid}/0_0_0\"\n\n workitem = OpenWFE::Xml.workitem_from_xml(@response.body)\n\n post(\n '/workitems',\n workitem.to_h().to_json,\n { 'CONTENT_TYPE' => 'application/json' })\n\n sleep 0.450\n\n get \"/workitems/#{fei.wfid}/0_0_1\"\n\n workitem = OpenWFE::Xml.workitem_from_xml(@response.body)\n\n assert_equal 'bravo', workitem.participant_name\n end", "def test_checking_saving_values\n post '/save-values', :value1 => '1', :value2 => '2'\n token_json = JSON.parse(last_response.body)\n assert_not_equal \" \", token_json['id']\n end", "def create\n result = Test.new.create_test(test_params)\n if result\n return render json: {message: 'Test was created succesfully', error: false }\n else\n return render json: {message: 'Error: Test was not created succesfully', error: true }\n end\n end", "def post(json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name].compact.join('/')\n url += \"/\"\n return HTTParty.post(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def test_notify\n gcm_response = send_notification(params[:test_payload_to_send], params[:test_gcm_ids])\n\n render json: get_v1_formatted_response({}, true, [gcm_response[:response]]).to_json\n end", "def create\n @tuoshui = Tuoshui.new(params[:tuoshui])\n\n respond_to do |format|\n if @tuoshui.save\n format.html { redirect_to @tuoshui, notice: 'Tuoshui was successfully created.' }\n format.json { render json: @tuoshui, status: :created, location: @tuoshui }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tuoshui.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @microtask = Microtask.new(params[:microtask])\n\n respond_to do |format|\n if @microtask.save\n format.html { redirect_to @microtask, notice: 'Microtask was successfully created.' }\n format.json { render json: @microtask, status: :created, location: @microtask }\n else\n format.html { render action: \"new\" }\n format.json { render json: @microtask.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_create_palindrome_message\n body = {\n \tdata: {\n \t\ttype: 'messages',\n \t\tattributes: {\n \t\t\tcontent: 'racecar'\n \t\t}\n \t}\n }\n\n post '/messages', body.to_json, 'CONTENT_TYPE' => AppConstants::CONTENT_TYPE\n assert last_response.created?\n assert_equal 'application/vnd.api+json', last_response.headers['Content-Type']\n\n response_body = JSON.parse last_response.body\n data = response_body['data']\n\n assert_equal 'messages', data['type']\n assert_equal body[:data][:attributes][:content], data['attributes']['content']\n assert data['attributes']['is_palindrome']\n assert_equal \"localhost:4567/messages/#{data['id']}\", last_response.headers['Location']\n end" ]
[ "0.6212472", "0.6196917", "0.6123075", "0.6037751", "0.59311587", "0.5880182", "0.58394265", "0.5687795", "0.5608448", "0.55609363", "0.5557644", "0.5522704", "0.547439", "0.54323614", "0.54271746", "0.54259235", "0.5421392", "0.53978586", "0.538322", "0.5375342", "0.53318685", "0.5319773", "0.5309421", "0.5293669", "0.52854896", "0.52837235", "0.52740043", "0.52436006", "0.52330285", "0.5214487", "0.5204926", "0.52013063", "0.5191048", "0.5182657", "0.51794", "0.517782", "0.5150475", "0.51504475", "0.5150361", "0.514815", "0.5142606", "0.5137496", "0.5133306", "0.5131749", "0.5112224", "0.5102363", "0.51022685", "0.5102145", "0.5102145", "0.5102145", "0.5102145", "0.5102145", "0.5102145", "0.5101807", "0.50992393", "0.50907564", "0.5089745", "0.5082174", "0.508067", "0.507253", "0.506709", "0.5066794", "0.5066009", "0.5064996", "0.5058661", "0.505685", "0.5048009", "0.5036025", "0.50350773", "0.5031265", "0.50312555", "0.502612", "0.50261104", "0.50233567", "0.5021424", "0.50180334", "0.5017813", "0.5017594", "0.50074893", "0.5006405", "0.50041014", "0.5003281", "0.49966305", "0.49893114", "0.49839643", "0.4980644", "0.4970047", "0.49664626", "0.4965664", "0.49596113", "0.49563026", "0.49563026", "0.49472237", "0.49395823", "0.49359864", "0.49341494", "0.49233806", "0.49223542", "0.49162045", "0.4914305" ]
0.7398844
0
PATCH/PUT /testimonios/1 PATCH/PUT /testimonios/1.json
def update respond_to do |format| if @testimonio.update(testimonio_params) format.html { redirect_to @testimonio, notice: 'Testimonio was successfully updated.' } format.json { render :show, status: :ok, location: @testimonio } else format.html { render :edit } format.json { render json: @testimonio.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @testmonial = Testmonial.find(params[:id])\n\n if @testmonial.update(testmonial_params)\n head :no_content\n else\n render json: @testmonial.errors, status: :unprocessable_entity\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 update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def patch!\n request! :patch\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 test_update_successful\n data = {\n firstname: \"Anh\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"anh@gmallds.sl\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 200\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def test_update_unsuccessful\n data = {\n firstname: \"\",\n lastname: \"Hoang\",\n avatar: \"avatar.png\",\n address: \"111D Ly Chinh Thang\",\n city: \"Ho Chi Minh\",\n email: \"anh@gmallds.sl\",\n mobile: \"0309433343545\",\n gender: 1,\n birthday: \"1991/10/10\"\n }\n\n user_id = 28\n expected = 1002\n uri = URI.parse('http://localhost:3000/v1/users/'+user_id.to_s)\n\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\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", "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 @test = Test.find(params[:id])\n\n respond_to do |format|\n if @test.update_attributes(params[:test])\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test.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 patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n @test10 = Test10.find(params[:id])\n\n respond_to do |format|\n if @test10.update_attributes(params[:test10])\n format.html { redirect_to @test10, notice: 'Test10 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test10.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end", "def update\n respond_to do |format|\n if @testfile.update(testfile_params)\n format.html { redirect_to @testfile, notice: 'Testfile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @testfile.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n @chronicle = Chronicle.find(params[:id])\n\n respond_to do |format|\n if @chronicle.update_attributes(params[:chronicle])\n format.html { redirect_to @chronicle, notice: 'Chronicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chronicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_change_status\n expected = 200\n post_id = 1\n data = {\n status: 1\n }\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s+'/status')\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def update\n respond_to do |format|\n if @fixit_test.update(fixit_test_params)\n format.html { redirect_to @fixit_test, notice: 'Fixit test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fixit_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def update\n @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 update # PATCH\n raise NotImplementedError\n end", "def update\n respond_to do |format|\n if @chronicle.update(chronicle_params)\n format.html { redirect_to @chronicle, notice: t('flash_message.notice.successfully_updated', model: Chronicle.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chronicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @testing_.update(testing__params)\n format.html { redirect_to @testing_, notice: 'Testing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @testing_.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\n end", "def update\n respond_to do |format|\n if @test1.update(test1_params)\n format.html { redirect_to @test1, notice: \"Test1 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @test1 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @test1.errors, status: :unprocessable_entity }\n end\n end\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 test_update_post\n data = {\n title: \"Roll lemon\",\n content: \"Gingerbread bear claw muffin danish danish marzipan. Toffee lollipop wafer carrot cake dessert.\",\n description: \"Chocolate tootsie roll lemon drops. Chupa chups chocolate bar apple pie\",\n image: \"chocolate.png\",\n status: 1\n }\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def update\n respond_to do |format|\n if @presented_testimony.update(presented_testimony_params)\n format.html { redirect_to @presented_testimony, notice: 'Presented testimony was successfully updated.' }\n format.json { render :show, status: :ok, location: @presented_testimony }\n else\n format.html { render :edit }\n format.json { render json: @presented_testimony.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to root_path, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_file = TestFile.find(params[:id])\n\n respond_to do |format|\n if @test_file.update_attributes(params[:test_file])\n format.html { redirect_to @test_file, notice: 'Test file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @microtask = Microtask.find(params[:id])\n\n respond_to do |format|\n if @microtask.update_attributes(params[:microtask])\n format.html { redirect_to @microtask, notice: 'Microtask was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @microtask.errors, status: :unprocessable_entity }\n end\n end\n end", "def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n respond_to do |format|\n if @jsontest.update(jsontest_params)\n format.html { redirect_to @jsontest, notice: 'Jsontest was successfully updated.' }\n format.json { render :show, status: :ok, location: @jsontest }\n else\n format.html { render :edit }\n format.json { render json: @jsontest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_stuff.update(test_stuff_params)\n format.html { redirect_to @test_stuff, notice: 'Test stuff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_stuff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n streak, success = jsonapi_update.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @iot.update(iot_params)\n format.html { redirect_to @iot, notice: 'Iot was successfully updated.' }\n format.json { render :show, status: :ok, location: @iot }\n else\n format.html { render :edit }\n format.json { render json: @iot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n if @tester.update_attributes(params[:tester])\n format.html { redirect_to @tester, notice: 'Tester was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tester.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n if @tester.update_attributes(params[:tester])\n format.html { redirect_to @tester, notice: 'Tester was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tester.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_update_object_by_id\r\n\t VCR.use_cassette('edit_object') do\r\n\t\t cred=JSON.parse(YAML::load_file('test/fixtures/credential.yml').to_json)\r\n\t\t json = JSON.parse(File.read(\"test/fixtures/edit_specimen.json\"))\r\n\t\t id = json[\"id\"]\r\n\t\t json[\"id\"] = \"\" #id cannot be updated\r\n\t\t result=CordraRestClient::DigitalObject.update(API_URL, id, json, cred[\"uc_1\"])\r\n\r\n\t\t #check that the result is saved\r\n\t\t assert_equal 200, result[:code]\r\n\t\t assert_equal \"OK\", result[\"message\"]\r\n\t\tend\r\n\t 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 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 patch\n end", "def update\n if @test.update(test_params)\n render status: :ok, json: @test\n else\n self.send(:edit)\n end\n end", "def update\n respond_to do |format|\n if @testtest.update(testtest_params)\n format.html { redirect_to @testtest, notice: 'Testtest was successfully updated.' }\n format.json { render :show, status: :ok, location: @testtest }\n else\n format.html { render :edit }\n format.json { render json: @testtest.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def patch(path, params = {})\n request(:patch, path, params)\n end", "def update_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\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end", "def update\n respond_to do |format|\n if @test_detail.update(test_detail_params)\n format.html { redirect_to @test_detail, notice: 'Test detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_detail }\n else\n format.html { render :edit }\n format.json { render json: @test_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_metum.update(test_metum_params)\n format.html { redirect_to @test_metum, notice: 'Test metum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tktest = Tktest.find(params[:id])\n\n respond_to do |format|\n if @tktest.update_attributes(params[:tktest])\n format.html { redirect_to @tktest, notice: 'Tktest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tktest.errors, status: :unprocessable_entity }\n end\n end\n end", "def activo_update\n respond_to do |format|\n activo = params[:presentacion][:activo]\n id = params[:id]\n Presentacion.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n respond_to do |format|\n if @jquery_test.update(jquery_test_params)\n format.html { redirect_to @jquery_test, notice: 'Jquery test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @jquery_test.errors, status: :unprocessable_entity }\n end\n end\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_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend", "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 respond_to do |format|\n if @nginxtest.update(nginxtest_params)\n format.html { redirect_to @nginxtest, notice: \"Nginxtest was successfully updated.\" }\n format.json { render :show, status: :ok, location: @nginxtest }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @nginxtest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @what_test.update(what_test_params)\n format.html { redirect_to @what_test, notice: 'What test was successfully updated.' }\n format.json { render :show, status: :ok, location: @what_test }\n else\n format.html { render :edit }\n format.json { render json: @what_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test.update(test_params)\n format.html { redirect_to patient_path(@test.patient), notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @performance_test = PerformanceTest.find(params[:id])\n\n respond_to do |format|\n if @performance_test.update_attributes(params[:performance_test])\n format.html { redirect_to @performance_test, :notice => 'Performance test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @performance_test.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 @team_test = TeamTest.find(params[:id])\n\n respond_to do |format|\n if @team_test.update_attributes(params[:team_test])\n format.html { redirect_to @team_test, notice: 'Team test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_call.update(test_call_params)\n format.html { redirect_to @test_call, notice: 'Test call was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_call.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n put :update\n end", "def update\n @testcase = Testcase.find(params[:id])\n\n respond_to do |format|\n if @testcase.update_attributes(params[:testcase])\n format.html { redirect_to @testcase, :notice => 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @testcase.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def update\n @test_appointment = TestAppointment.find(params[:id])\n\n respond_to do |format|\n if @test_appointment.update_attributes(params[:test_appointment])\n format.html { redirect_to @test_appointment, notice: 'Test appointment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_appointment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @phonetic_test.update(phonetic_test_params)\n format.html { redirect_to @phonetic_test, notice: 'Phonetic test was successfully updated.' }\n format.json { render :show, status: :ok, location: @phonetic_test }\n else\n format.html { render :edit }\n format.json { render json: @phonetic_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "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 @testtype.update(testtype_params)\n format.html { redirect_to @testtype, notice: 'Testtype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @testtype.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_instance.update(test_instance_params)\n # jankety solution to set version properly\n @test_instance.update_version(true)\n\n format.html do\n redirect_to test_case_test_instances_url(@test_case),\n notice: 'Test instance was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @test_instance }\n else\n format.html { render :edit }\n format.json do\n render json: @test_instance.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def update\n @test = LoadTest.find(params[:id])\n\n respond_to do |format|\n if @test.update_attributes(params[:load_test])\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test.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 UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n respond_to do |format|\n if @rest_api.update(rest_api_params)\n format.html { redirect_to @rest_api, notice: 'Rest api was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rest_api.errors, status: :unprocessable_entity }\n end\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 test_put_success\n put \"/blah\", @test_obj do |response|\n assert response.ok?, \"Update test object failed\"\n end\n end", "def update\n @test_run = TestRun.find(params[:id])\n\n respond_to do |format|\n if @test_run.update_attributes(params[:test_run])\n format.html { redirect_to @test_run, notice: 'Test run was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_run.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_case.update(test_case_params)\n TestMailer.admin_test_updated_email(@test_case).deliver\n \n format.html { redirect_to @test_case, notice: 'Your test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, **args); end", "def update\n @usertest = Usertest.find(params[:id])\n\n respond_to do |format|\n if @usertest.update_attributes(params[:usertest])\n format.html { redirect_to @usertest, notice: 'Usertest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @usertest.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 respond_to do |format|\n if @mock_server.update(mock_server_params)\n format.html { redirect_to @mock_server, notice: 'Mock server was successfully updated.' }\n format.json { render :show, status: :ok, location: @mock_server }\n else\n format.html { render :edit }\n format.json { render json: @mock_server.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @smoke_test = SmokeTest.find(params[:id])\n\n if not params[:smoke_test][:test_suite_ids] and not params[:smoke_test][:config_templates]\n @smoke_test.config_templates.clear\n @smoke_test.test_suites.clear\n end\n respond_to do |format|\n if @smoke_test.update_attributes(params[:smoke_test])\n\n @smoke_test.test_suites.clear if @smoke_test.test_suites.size == 0\n format.html { redirect_to(@smoke_test, :notice => 'Smoke test was successfully updated.') }\n format.json { render :json => @smoke_test, :status => :ok }\n format.xml { render :xml => @smoke_test, :status => :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @smoke_test.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @smoke_test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\n end" ]
[ "0.6371609", "0.6225694", "0.62197536", "0.61011976", "0.60881066", "0.60381603", "0.5989692", "0.59261614", "0.59036803", "0.58820486", "0.58652455", "0.58554685", "0.58460706", "0.5844932", "0.5835631", "0.5827716", "0.58217865", "0.57958645", "0.57856554", "0.5783353", "0.57672167", "0.57623583", "0.57414335", "0.57401043", "0.57398826", "0.5732259", "0.570748", "0.5701676", "0.5699228", "0.56977934", "0.56916714", "0.5690623", "0.5688688", "0.56884426", "0.56844544", "0.5660823", "0.5654981", "0.5654821", "0.56487125", "0.5640172", "0.56324184", "0.56324184", "0.56324184", "0.56324184", "0.56324184", "0.56324184", "0.56324184", "0.5622822", "0.56222475", "0.56222475", "0.5621985", "0.56188256", "0.5610762", "0.5610168", "0.5605138", "0.5603772", "0.56020373", "0.56020373", "0.55997217", "0.55972844", "0.55827945", "0.55815625", "0.55790955", "0.5566382", "0.55650383", "0.55643827", "0.55643827", "0.55643827", "0.5555648", "0.55523527", "0.55489403", "0.55482703", "0.55441326", "0.5533814", "0.553037", "0.55268276", "0.55179125", "0.55160636", "0.55160636", "0.5507353", "0.55037886", "0.5500989", "0.5498944", "0.5496582", "0.54960465", "0.5490846", "0.5490463", "0.54900235", "0.5489148", "0.5484265", "0.54783785", "0.5471356", "0.54681486", "0.5458225", "0.5452501", "0.5451529", "0.54479194", "0.54353255", "0.5433143", "0.54319745" ]
0.6779583
0
DELETE /testimonios/1 DELETE /testimonios/1.json
def destroy @testimonio.destroy respond_to do |format| format.html { redirect_to testimonios_url, notice: 'Testimonio was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\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 delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete(path)\n RestClient.delete request_base+path\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 delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n\t\t\t\n\t\t\t\tTestimony.find(params[:id]).destroy\n\n\t\t\t\trender json: nil,status: 200\n\t\t\t\n\t\t\tend", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def destroy\n @testmonial.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 delete path\n make_request(path, \"delete\", {})\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 delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "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 delete\n api_client.delete(url)\n end", "def delete\n request(:delete)\n end", "def delete\n start { |connection| connection.request http :Delete }\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 delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def destroy\n @test_file = TestFile.find(params[:id])\n @test_file.destroy\n\n respond_to do |format|\n format.html { redirect_to test_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end", "def delete\n api(\"Delete\")\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 @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @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 @chronicle.destroy\n respond_to do |format|\n format.html { redirect_to chronicles_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n request(:delete, path)\n end", "def destroy\n @testdb = Testdb.find(params[:id])\n @testdb.destroy\n\n respond_to do |format|\n format.html { redirect_to testdbs_url }\n format.json { head :no_content }\n end\n end", "def delete\n delete_from_server single_url\n end", "def delete(path)\n request 'DELETE', path\n end", "def destroy\n @test = LoadTest.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to load_tests_url }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def delete(url, headers={})\n RestClient.delete url, headers\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def delete(url)\n do_request(\"delete\", url)\n end", "def destroy\n @test_metum.destroy\n respond_to do |format|\n format.html { redirect_to test_meta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testing_.destroy\n respond_to do |format|\n format.html { redirect_to testing_s_url }\n format.json { head :no_content }\n end\n end", "def delete(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\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 @nginxtest.destroy\n respond_to do |format|\n format.html { redirect_to nginxtests_url, notice: \"Nginxtest was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Prueba eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\n end", "def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end", "def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end", "def destroy\n @test_detail.destroy\n respond_to do |format|\n format.html { redirect_to test_details_url, notice: 'Test detail was successfully destroyed.' }\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 url = prefix + \"delete\" + id_param\n return response(url)\n end", "def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end", "def deleteExecution(execution_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/12/execution/' + execution_id)\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {'Content-Type'=> 'application/jsonr','X-RunDeck-Auth-Token'=> API_KEY }\n r = http.delete(uri.path, headers) \n return r\nend", "def test_delete_task\n result = @nirvana.delete @task['id']\n result = JSON.parse(result)\n\n assert result.keys.include?('results')\n assert result['results'][0]\n assert result['results'][0].keys.include?('task')\n assert \"0\" != result['results'][0]['task']['deleted'] \n end", "def destroy\n @jsontest.destroy\n respond_to do |format|\n format.html { redirect_to jsontests_url, notice: 'Jsontest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test10 = Test10.find(params[:id])\n @test10.destroy\n\n respond_to do |format|\n format.html { redirect_to test10s_url }\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 destroy\n @test_meta_datum.destroy\n respond_to do |format|\n format.html { redirect_to test_meta_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sitio = Sitio.find(params[:id])\n @sitio.destroy\n\n respond_to do |format|\n format.html { redirect_to sitios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @phonetic_test.destroy\n respond_to do |format|\n format.html { redirect_to phonetic_tests_url, notice: 'Phonetic test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @testtest.destroy\n respond_to do |format|\n format.html { redirect_to testtests_url, notice: 'Testtest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }\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 @presented_testimony.destroy\n respond_to do |format|\n format.html { redirect_to presented_testimonies_url, notice: 'Presented testimony was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @uchronist = Uchronist.find(params[:id])\n @uchronist.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronists_url }\n format.json { head :no_content }\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 destroy\n @testurl.destroy\n respond_to do |format|\n format.html { redirect_to testurls_url, notice: 'Testurl was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def destroy\n @heartbeat = Heartbeat.find(params[:id])\n @heartbeat.destroy\n\n respond_to do |format|\n format.html { redirect_to heartbeats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testfile.destroy\n respond_to do |format|\n format.html { redirect_to materials_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_run.destroy\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end", "def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def destroy\n @tktest = Tktest.find(params[:id])\n @tktest.destroy\n\n respond_to do |format|\n format.html { redirect_to tktests_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 => @fiestas.delete_at(params[:id].to_i)\n end", "def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test = Mg::Test.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to(mg_tests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @server = Server.find(params[:id])\n checkaccountobject(\"servers\",@server)\n @server.send_delete\n respond_to do |format|\n format.html { redirect_to servers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @smoke_test = SmokeTest.find(params[:id])\n @smoke_test.destroy\n\n respond_to do |format|\n format.html { redirect_to(smoke_tests_url) }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end", "def destroy\n @iot.destroy\n respond_to do |format|\n format.html { redirect_to iots_url, notice: 'Iot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_item.destroy\n respond_to do |format|\n format.html { redirect_to test_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_datum.destroy\n respond_to do |format|\n format.html { redirect_to test_data_url, notice: 'Test datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @musictrack.destroy\n respond_to do |format|\n format.html { redirect_to musictracks_url, notice: 'Musictrack was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @chronicle = Chronicle.find(params[:chronicle_id])\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to @chronicle, notice: 'Event was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_run = TestRun.find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @usertest = Usertest.find(params[:id])\n @usertest.destroy\n\n respond_to do |format|\n format.html { redirect_to usertests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @chronicle = Chronicle.find(params[:id])\n @chronicle.destroy\n\n respond_to do |format|\n format.html { redirect_to library_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @testcase = Testcase.find(params[:id])\n @testcase.destroy\n\n respond_to do |format|\n format.html { redirect_to testcases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dovetest.destroy\n respond_to do |format|\n format.html { redirect_to dovetests_url, notice: 'Dovetest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7171525", "0.7043059", "0.67855144", "0.67855144", "0.67855144", "0.67855144", "0.67782396", "0.67540795", "0.67471486", "0.6695716", "0.66632545", "0.6656628", "0.66558033", "0.66544634", "0.6642121", "0.66078633", "0.6572492", "0.65703607", "0.65622187", "0.65308535", "0.65275705", "0.65153813", "0.6506762", "0.65029687", "0.64942664", "0.6487637", "0.6487072", "0.6487072", "0.6480459", "0.6476674", "0.64709073", "0.6468401", "0.645712", "0.6454608", "0.6448717", "0.6442146", "0.6442146", "0.6439386", "0.643416", "0.6418778", "0.64147514", "0.64107114", "0.6405872", "0.6398839", "0.6396733", "0.6396453", "0.6394168", "0.6393957", "0.6383214", "0.6381712", "0.63770115", "0.6373564", "0.63693917", "0.6365663", "0.6364216", "0.6360172", "0.6354357", "0.6348052", "0.6346655", "0.6340359", "0.63395596", "0.63386744", "0.6336153", "0.632941", "0.632941", "0.632941", "0.632941", "0.632941", "0.632941", "0.632941", "0.63285637", "0.6322127", "0.6317503", "0.6317346", "0.63096124", "0.63094026", "0.63086253", "0.6308174", "0.6305987", "0.63030523", "0.6301558", "0.6301133", "0.6297998", "0.6293587", "0.62892866", "0.6288864", "0.6285909", "0.62857324", "0.6284775", "0.62817764", "0.62816197", "0.628159", "0.62815535", "0.62815243", "0.6274034", "0.62736976", "0.6270401", "0.6269297", "0.6265353", "0.6255971" ]
0.7340553
0
Use callbacks to share common setup or constraints between actions.
def set_testimonio @testimonio = Testimonio.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 testimonio_params params.require(:testimonio).permit(:nombre, :descripcion, :link, :activo) 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
Configuration pointing to the SPEC tests and PIN tool to be used.
def load_configuration # Default configuration. config = File.open('pin_spec.yml', 'r') { |f| YAML.load f } if ARGV[0] # If the first argument is a Yaml configuration file, use that to override # the default configuration. if ARGV[0][-4, 4] == '.yml' config.merge! File.open(ARGV[0], 'r') { |f| YAML.load f } else # Argument 1: the output directory. config[:output_dir] = ARGV[0] end end # Supply a default output directory if no directory is given. config[:output_dir] ||= 'results_' + Time.now.strftime("%Y%m%d%H%M%S") config[:output_dir] = File.expand_path config[:output_dir], File.dirname(__FILE__) # Argument 2: pintool binary config[:tool_binary] = ARGV[1] if ARGV[1] config[:tool_binary] = File.expand_path ARGV[1] || config[:tool_binary], File.dirname(__FILE__) # Arguments 3..n: pintool arguments if ARGV[2] config[:tool_args] = ARGV[2..-1] end if config[:tool_args].respond_to? :to_str config[:tool_args] = config[:tool_args].split end # Suite location. suite_file = config[:suite_path] || './spec_suite.yml' config[:suite] = File.open(suite_file, 'r') { |f| YAML.load f } # Filter out tests in the suite. config[:suite].delete_if do |test_name, test_config| config[:skip_tests].include? test_name end config end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_config(tool, options={}, &block)\n tool = tool.to_s\n\n @setup ||= {}\n\n if block\n @setup[tool] = Setup.new(tool, options, &block)\n\n # REMOVED: Doing this automatically made it impossible for tools to set the profile.\n #if tool == current_tool\n # configure_tool(tool) unless autoconfig?\n #end\n end \n\n @setup[tool]\n end", "def setup_config\n # To be Extended\n end", "def default_testing_config\n CLAide::Plugins::Configuration.new('CLAideTesting',\n 'claidetest',\n 'https://github.com/cocoapods/claide-plugins/something.json',\n 'https://github.com/danger/danger-plugin-template')\nend", "def initialize_configuration\n\n #Pulse the Program pin via JTAG.\n self.instruction = :jprogram\n\n #Put the device into configuration mode, and give it 14,000 cycles to start up.\n self.instruction = :cfg_in\n run_test(ConfigurationStartup)\n\n end", "def configure_and_run(params = [])\n config_file = Configuration::DEFAULT_CONFIG_FILE_NAME\n tmp_config = Configuration.new\n action_wizard = false\n\n parser = OptionParser.new do |opts|\n opts.banner = if ENV['OCRA_EXECUTABLE']\n \"Usage: #{ENV['OCRA_EXECUTABLE'].gsub(\"#{Dir.pwd}/\".gsub('/', '\\\\'), '')} [options]\"\n else\n \"Usage: #{Gem.ruby} #{$PROGRAM_NAME} [options]\"\n end\n\n opts.on('-c', '--config CONFIG_FILE_NAME', 'Specify custom configuration file,'\\\n \" instead of #{Configuration::DEFAULT_CONFIG_FILE_NAME}.\") do |file_name|\n config_file = file_name\n end\n\n opts.on('-r', '--register FILE', 'Register a custom plugin, e.g. your own Datasource implementation') do |plugin|\n require plugin\n end\n\n opts.on('-d', '--debug LEVEL', 'Specify detail level: FATAL, ERROR, WARN, INFO, DEBUG.') do |level|\n tmp_config.set_param('grafana-reporter:debug-level', level)\n end\n\n opts.on('-o', '--output FILE', 'Output filename if only a single file is rendered') do |file|\n tmp_config.set_param('to_file', file)\n end\n\n opts.on('-s', '--set VARIABLE,VALUE', Array, 'Set a variable value, which will be passed to the '\\\n 'rendering') do |list|\n raise ParameterValueError, list.length unless list.length == 2\n\n tmp_config.set_param(\"default-document-attributes:#{list[0]}\", list[1])\n end\n\n opts.on('--ssl-cert FILE', 'Manually specify a SSL cert file for HTTPS connection to grafana. Only '\\\n 'needed if not working properly otherwise.') do |file|\n if File.file?(file)\n tmp_config.set_param('grafana-reporter:ssl-cert', file)\n else\n config.logger.warn(\"SSL certificate file #{file} does not exist. Setting will be ignored.\")\n end\n end\n\n opts.on('--test GRAFANA_INSTANCE', 'test current configuration against given GRAFANA_INSTANCE') do |instance|\n tmp_config.set_param('grafana-reporter:run-mode', 'test')\n tmp_config.set_param('grafana-reporter:test-instance', instance)\n end\n\n opts.on('-t', '--template TEMPLATE', 'Render a single ASCIIDOC template to PDF and exit') do |template|\n tmp_config.set_param('grafana-reporter:run-mode', 'single-render')\n tmp_config.set_param('default-document-attributes:var-template', template)\n end\n\n opts.on('-w', '--wizard', 'Configuration wizard to prepare environment for the reporter.') do\n action_wizard = true\n end\n\n opts.on('-v', '--version', 'Version information') do\n puts GRAFANA_REPORTER_VERSION.join('.')\n return -1\n end\n\n opts.on('-h', '--help', 'Show this message') do\n puts opts\n return -1\n end\n end\n\n begin\n parser.parse!(params)\n return ConsoleConfigurationWizard.new.start_wizard(config_file, tmp_config) if action_wizard\n rescue ApplicationError => e\n puts e.message\n return -1\n end\n\n # abort if config file does not exist\n unless File.file?(config_file)\n puts \"Config file '#{config_file}' does not exist. Consider calling the configuration wizard\"\\\n ' with option \\'-w\\' or use \\'-h\\' to see help message. Aborting.'\n return -1\n end\n\n # merge command line configuration with read config file\n @config.load_config_from_file(config_file)\n @config.merge!(tmp_config)\n\n run\n end", "def config \n @config ||= Gem.configuration[\"test_options\"] || { }\n end", "def tool_config\n IMS::LTI::ToolConfig.create_from_xml(self.xml)\n end", "def run_suite(config)\n # Build the sandbox.\n FileUtils.rm_rf config[:output_dir] if File.exist? config[:output_dir]\n FileUtils.mkdir_p config[:output_dir]\n File.chmod 0777, config[:output_dir]\n temp_dir = File.join config[:output_dir], '__temp_' +\n \"#{Time.now.strftime(\"%Y%m%d%H%M%S\")}_#{$PID}_#{rand(1 << 20)}\"\n FileUtils.mkdir_p temp_dir\n File.chmod 0777, config[:output_dir]\n \n # Figure out PIN's configuration.\n pin_config = { :temp_dir => temp_dir, :tool_binary => config[:tool_binary],\n :tool_args => config[:tool_args] || [] }\n if /^vlsifarm/ =~ Socket.gethostname # On vlsifarm.\n pin_config[:binary] = '/mit/6.823/Fall09/bin/pin'\n else # On linerva.\n pin_config[:tool_binary] += '.so'\n pin_config[:binary] = '/mit/6.823/Fall09/Pin2009/pin'\n end\n \n \n # Run the tests.\n test_number = 0\n config[:suite].keys.sort.each do |test_name|\n test_data = config[:suite][test_name]\n \n next if config[:skip_tests].include? test_name\n test_number += 1\n puts \"Test #{test_name} -- #{test_number} of #{config[:suite].length}\"\n \n out_file = File.basename(test_data['binary']) + '.out'\n pin_output = File.join config[:output_dir], out_file\n run_test test_data, pin_config, pin_output\n end\n \n # Tear down the sandbox.\n FileUtils.rm_rf temp_dir \nend", "def tools_setup(config)\n config[:tools].each_key do |name|\n tool = config[:tools][name]\n\n # populate name if not given\n tool[:name] = name.to_s if (tool[:name].nil?)\n\n # handle inline ruby string substitution in executable\n if (tool[:executable] =~ RUBY_STRING_REPLACEMENT_PATTERN)\n tool[:executable].replace(@system_wrapper.module_eval(tool[:executable]))\n end\n\n # populate stderr redirect option\n tool[:stderr_redirect] = StdErrRedirect::NONE if (tool[:stderr_redirect].nil?)\n\n # populate background execution option\n tool[:background_exec] = BackgroundExec::NONE if (tool[:background_exec].nil?)\n\n # populate optional option to control verification of executable in search paths\n tool[:optional] = false if (tool[:optional].nil?)\n end\n end", "def suite_config\n {\n 'name' => 'default',\n 'run_list' => (File.exist?(File.join(base, 'test', 'cookbook')) || File.exist?(File.join(base, 'test', 'cookbooks'))) ? [\"#{cookbook_name}_test\"] : [cookbook_name],\n }\n end", "def provisioner_config\n {\n 'log_level' => (ENV['DEBUG'] ? 'debug' : (ENV['CHEF_LOG_LEVEL'] || 'auto')),\n # Use the poise_solo provisioner, also part of kitchen-docker.\n 'name' => 'poise_solo',\n 'attributes' => {\n # Pass through $CI to know if we are on Travis.\n 'CI' => ENV['CI'],\n # Pass through debug/poise_debug settings to the test instance.\n 'POISE_DEBUG' => !!((ENV['POISE_DEBUG'] && ENV['POISE_DEBUG'] != 'false') ||\n (ENV['poise_debug'] && ENV['poise_debug'] != 'false') ||\n (ENV['DEBUG'] && ENV['DEBUG'] != 'false')\n ),\n }\n }\n end", "def _init_configuration\n\t\t# Set defaults\n\t\t@setup = { \"create\" => false, \"environment\" => false, \"test\" => true, \"destroy\" => false }\n\t\t@config = false\n\tend", "def use_spec_configuration\n MiteCmd.stub(:configuration_file_path).and_return(\n File.join(File.dirname(__FILE__), 'fixtures', 'mite.yml')\n )\nend", "def test_config\n PuppetServerExtensions.config\n end", "def setup_spec(t)\n t.spec_opts = ['--options', \"\\\"#{RIGHT_BOT_ROOT}/spec/spec.opts\\\"\"]\n t.spec_files = FileList[\"#{RIGHT_BOT_ROOT}/**/spec/**/*_spec.rb\"]\n t\nend", "def testRunActionToolConfigParam\n executeSlave(\n [\n '--user', 'DummyUser',\n '--tool', 'DummyTool',\n '--action', 'DummyAction'\n ],\n :AddRegressionActions => true,\n :Repository => 'Dummy/SlaveActionActive'\n ) do |iError|\n assert_equal(\n {\n :PersonalizedToolAttr => 'PersonalizedToolValue'\n },\n $Variables[:DummyAction_ToolConfig]\n )\n end\n end", "def config_via_runner(env: 'development', envvars: '')\n code = %q(puts Marshal.dump(\n OpenStruct.new(\n dataroot: Configuration.dataroot,\n production_database_path: Configuration.production_database_path,\n load_external_config: Configuration.load_external_config?,\n show_job_options_account_field: Configuration.show_job_options_account_field?\n )\n )\n )\n Marshal.load(runner(code, env: env, envvars: envvars))\n end", "def pacbio_run_sample_sheet_config\n Pipelines.pacbio.sample_sheet.by_version(smrt_link_version.name)\n end", "def configuration\n verifier.configuration\n end", "def kitchen_config\n @kitchen_config ||= {\n defaults: {\n driver: Driver::DEFAULT_PLUGIN,\n provisioner: Provisioner::DEFAULT_PLUGIN,\n verifier: Verifier::DEFAULT_PLUGIN,\n transport: lambda do |_suite, platform|\n platform =~ /^win/i ? \"winrm\" : Transport::DEFAULT_PLUGIN\n end,\n },\n kitchen_root: kitchen_root,\n test_base_path: test_base_path,\n log_level: log_level,\n log_overwrite: log_overwrite,\n debug: debug,\n }\n end", "def config\n config = PcaprLocal::Config.config\n config['couch']['database'] = \"#{config['couch']['database']}_test\"\n config['install_dir'] = \"/tmp/pcapr_local_test\"\n config['pcap_dir'] = \"/tmp/pcapr_local_test/pcaps\"\n config['index_dir'] = \"/tmp/pcapr_local_test/indexes\"\n config['app']['port'] = config['app']['port'].to_i + 1\n config\n end", "def config\n config = PcaprLocal::Config.config\n config['couch']['database'] = \"#{config['couch']['database']}_test\"\n config['install_dir'] = \"/tmp/pcapr_local_test\"\n config['pcap_dir'] = \"/tmp/pcapr_local_test/pcaps\"\n config['index_dir'] = \"/tmp/pcapr_local_test/indexes\"\n config['app']['port'] = config['app']['port'].to_i + 1\n config\n end", "def configure\n send_command \"--configure\"\n end", "def kak_spec_program\n $kak_spec_program ||= ENV[\"KAK_SPEC_PROGRAM\"]\nend", "def plugin_conf\n inspec_config.fetch_plugin_config(\"inspec-chef\")\n end", "def configure_saucelabs\n end", "def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end", "def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end", "def spec_commands\n [File.join(Config::CONFIG['bindir'], 'spec'), 'spec']\n end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config\n mode == \"autoinst_config\"\n end", "def kitchen_config\n {\n 'driver' => driver_config,\n 'transport' => transport_config,\n 'provisioner' => provisioner_config,\n 'platforms' => expand_platforms.map {|name| platform_config(name) },\n 'suites' => [suite_config],\n }\n end", "def simplecov_configuration\n proc do\n gemfile = Eaco::Rake::Utils.gemfile\n coverage_dir \"coverage/#{gemfile}\"\n add_filter ['/features', '/spec']\n end\n end", "def config\n @config ||= Smartgen::Configuration.new\n end", "def start_configuration\n post \"/setup/api/configure\", password_hash\n end", "def configure\n if @opts[:docker]\n Souschef::Print.info 'Creating Docker configuration .kitchen.local.yml'\n write(:docker, Souschef::Testkitchen::Docker.new(@cookbook).yaml)\n end\n if @opts[:solusvm]\n Souschef::Print.info 'Creating SolusVM configuraton .kitchen.local.yml'\n write(:solusvm, Souschef::Testkitchen::Solusvm.new(@cookbook).yaml)\n end\n\n Souschef::Print.info 'Creating Vagrant configuration in .kitchen.yml'\n write(:virtualbox, Souschef::Testkitchen::Virtualbox.new(@cookbook).yaml)\n end", "def configure_tpm2_0_tools(hosts)\n start_tpm2sim_on(hosts)\n config_abrmd_for_tpm2sim_on(hosts)\nend", "def configurations; end", "def configure; end", "def setup\n @configure = Hatemile::Util::Configure.new\n end", "def configuration\n @config ||= setup\n end", "def config\n\n end", "def gem_config(*names)\n options = names.extract_options!\n options[:type] ||= :memory\n config = {}\n names << :simple if names.empty?\n names.each{|n| config.merge!(send(\"#{n}_config\")) }\n config.merge!(send(\"#{options[:type]}_config\"))\n Storehouse.set_spec(config)\n end", "def config\n boot.config\n end", "def configure\n load_configuration\n verify_configuration\n end", "def load_configuration\n @opts[:souschef] = Souschef::Config.read[@opts[:profile]]\n end", "def config(tool, profile, &block)\n tool = tool.to_sym\n if @too_configs.key?(tool)\n config = @tool_configs[tool]\n else\n config = ToolConfigs.new(tool)\n @tool_configs[tool] = config\n end\n config.add(profile, &block)\n end", "def configuration; end", "def configuration; end", "def configuration; end", "def configuration; end", "def configuration; end", "def presets\n h = Beaker::Options::OptionsHash.new\n h.merge({\n :project => 'Beaker',\n :department => 'unknown',\n :created_by => ENV['USER'] || ENV['USERNAME'] || 'unknown',\n :host_tags => {},\n :openstack_api_key => ENV.fetch('OS_PASSWORD', nil),\n :openstack_username => ENV.fetch('OS_USERNAME', nil),\n :openstack_auth_url => \"#{ENV.fetch('OS_AUTH_URL', nil)}/tokens\",\n :openstack_tenant => ENV.fetch('OS_TENANT_NAME', nil),\n :openstack_keyname => ENV.fetch('OS_KEYNAME', nil),\n :openstack_network => ENV.fetch('OS_NETWORK', nil),\n :openstack_region => ENV.fetch('OS_REGION', nil),\n :openstack_volume_support => ENV['OS_VOLUME_SUPPORT'] || true,\n :jenkins_build_url => nil,\n :validate => true,\n :configure => true,\n :log_level => 'info',\n :trace_limit => 10,\n :\"master-start-curl-retries\" => 120,\n :masterless => false,\n :options_file => nil,\n :type => 'pe',\n :provision => true,\n :preserve_hosts => 'never',\n :root_keys => false,\n :quiet => false,\n :project_root => File.expand_path(File.join(__dir__, \"../\")),\n :xml_dir => 'junit',\n :xml_file => 'beaker_junit.xml',\n :xml_time => 'beaker_times.xml',\n :xml_time_enabled => false,\n :xml_stylesheet => 'junit.xsl',\n :default_log_prefix => 'beaker_logs',\n :log_dir => 'log',\n :log_sut_event => 'sut.log',\n :color => true,\n :dry_run => false,\n :test_tag_and => '',\n :test_tag_or => '',\n :test_tag_exclude => '',\n :timeout => 900, # 15 minutes\n :fail_mode => 'slow',\n :test_results_file => '',\n :accept_all_exit_codes => false,\n :timesync => false,\n :set_env => true,\n :disable_updates => true,\n :repo_proxy => false,\n :package_proxy => false,\n :add_el_extras => false,\n :consoleport => 443,\n :pe_dir => '/opt/enterprise/dists',\n :pe_version_file => 'LATEST',\n :pe_version_file_win => 'LATEST-win',\n :host_env => {},\n :host_name_prefix => nil,\n :ssh_env_file => '~/.ssh/environment',\n :profile_d_env_file => '/etc/profile.d/beaker_env.sh',\n :dot_fog => File.join(ENV.fetch('HOME', nil), '.fog'),\n :ec2_yaml => 'config/image_templates/ec2.yaml',\n :help => false,\n :collect_perf_data => 'none',\n :puppetdb_port_ssl => 8081,\n :puppetdb_port_nonssl => 8080,\n :puppetserver_port => 8140,\n :nodeclassifier_port => 4433,\n :cache_files_locally => false,\n :aws_keyname_modifier => rand(10**10).to_s.rjust(10, '0'), # 10 digit random number string\n :run_in_parallel => [],\n :use_fog_credentials => true,\n :ssh => {\n :config => false,\n :verify_host_key => false,\n :auth_methods => [\"publickey\"],\n :port => 22,\n :forward_agent => true,\n :keys => [\"#{ENV.fetch('HOME', nil)}/.ssh/id_rsa\"],\n :user_known_hosts_file => \"#{ENV.fetch('HOME', nil)}/.ssh/known_hosts\",\n :keepalive => true,\n },\n })\n end", "def configure!\n ENV[\"KNAPSACK_TEST_FILE_PATTERN\"] ||= \"qa/specs/features/**/*_spec.rb\"\n ENV[\"KNAPSACK_REPORT_PATH\"] = report_path\n\n Knapsack.logger = QA::Runtime::Logger.logger\n\n download_report\n end", "def config(tool, loader)\n data = {tool: tool, loader: loader}\n tool.flags.each do |flag|\n config_desc(flag, generate_flag_desc(flag, data), generate_flag_long_desc(flag, data))\n end\n tool.positional_args.each do |arg|\n config_desc(arg, generate_arg_desc(arg, data), generate_arg_long_desc(arg, data))\n end\n tool.flag_groups.each do |flag_group|\n config_desc(flag_group, generate_flag_group_desc(flag_group, data),\n generate_flag_group_long_desc(flag_group, data))\n end\n config_desc(tool, generate_tool_desc(tool, data), generate_tool_long_desc(tool, data))\n yield\n end", "def spec_commands\n [\n File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'bin', 'spec')),\n File.join(Config::CONFIG['bindir'], 'spec')\n ]\n end", "def config(tool, loader)\n tool_class = tool.tool_class\n DSL::Internal.prepare(tool_class, tool.full_name, tool.priority, nil, @source_info,\n loader) do\n tool_class.class_eval(&@block)\n end\n yield\n end", "def config_tool_needed?\n false\n end", "def sub_config\n puts config_script\n shell(config_script, source_dir(true))\n end", "def create_config()\n # Materialize an array of desired trial configurations\n tests = []\n if $options[:experiments].include? :scalability\n $options[:scale_factors].each do |sf|\n get_node_counts(sf).each do |nodes|\n $options[:queries].each do |q|\n get_trials(sf).each do |trial|\n tests << $headers[0..-1].zip([:scalability, sf, nodes, get_switches(nodes), 2, q, trial]).to_h\n end end end end end\n # Latency experiments\n sample_delays = {0.1=>100, 1=>1000, 10=>10000, 100=>100000}\n if $options[:experiments].include? :latency\n [0.1, 1, 10, 100].each do |sf|\n get_node_counts(sf).reject {|nd| nd > 16}.each do |nodes|\n switch_counts = $options[:switch_counts].select {|s| s <= nodes}\n switch_counts.each do |switches|\n ['4', '3'].each do |q|\n get_trials(sf).each do |trial|\n t = $headers[0..-1].zip([:latency, sf, nodes, switches, 2, q, trial]).to_h\n t[:sample_delay] = sample_delays[sf]\n tests << t\n end end end end end end\n # Memory tests\n if $options[:experiments].include? :memory\n [1, 10].each do |sf|\n [1, 4, 8].each do |nodes|\n ['3'].each do |q|\n $options[:gc_epochs].each do |gc_epoch|\n $options[:delays].each do |delay|\n get_trials(sf).each do |trial|\n t = $headers[0..-1].zip([:memory, sf, nodes, get_switches(nodes), 2, q, trial]).to_h\n t[:gc_epoch] = gc_epoch\n t[:delay] = delay\n tests << t\n end end end end end end end\n #puts tests\n config = {\n :options => $options,\n :tests => tests\n }\n config\nend", "def config\n<<-EOL\nManage the environment's config. Can use this to download the environment's config to jack/cfg folder or upload and apply config in jack/cfg folder to the environment.\n\nExample:\n\n$ jack config get hi-web-stag-1\n\nFor more info:\n\n$ jack help config\n\n$ jack config help upload\n\n$ jack config help download\nEOL\n end", "def finish_windows_configuration\n\n configure do\n\n user = add_parameter 'username', {type: 'string'}\n pwd = add_parameter 'password', {type: 'securestring'}\n\n end\n\n end", "def setup(&block)\n Config.setup(&block)\n end", "def runner_options(test_file)\n {\n work_dir: AYTests.work_dir,\n test_file: Pathname.new(test_file),\n default_iso_path: AYTests.obs_iso_path,\n skip_build: options[\"skip-build\"] || false,\n provider: options[\"provider\"] || ENV[\"AYTESTS_PROVIDER\"] || :libvirt,\n headless: options[:headless] || ENV[\"AYTESTS_HEADLESS\"] == \"true\"\n }\n end", "def initialize(sut, profile)\n @inspec_version = ENV['BEAKER_inspec_version'] || 'latest'\n\n @sut = sut\n\n @sut.install_package('git')\n\n if @inspec_version == 'latest'\n @sut.install_package('inspec')\n else\n @sut.install_package(\"inspec-#{@inspec_version}\")\n end\n\n os = fact_on(@sut, 'operatingsystem')\n os_rel = fact_on(@sut, 'operatingsystemmajrelease')\n\n @profile = \"#{os}-#{os_rel}-#{profile}\"\n @profile_dir = '/tmp/inspec/inspec_profiles'\n @deps_root = '/tmp/inspec'\n\n @test_dir = @profile_dir + \"/#{@profile}\"\n\n sut.mkdir_p(@profile_dir)\n\n output_dir = File.absolute_path('sec_results/inspec')\n\n unless File.directory?(output_dir)\n FileUtils.mkdir_p(output_dir)\n end\n\n local_profile = File.join(fixtures_path, 'inspec_profiles', %(#{os}-#{os_rel}-#{profile}))\n local_deps = File.join(fixtures_path, 'inspec_deps')\n\n @result_file = File.join(output_dir, \"#{@sut.hostname}-inspec-#{Time.now.to_i}\")\n\n copy_to(@sut, local_profile, @profile_dir)\n\n if File.exist?(local_deps)\n copy_to(@sut, local_deps, @deps_root)\n end\n\n # The results of the inspec scan in Hash form\n @results = {}\n end", "def setup(&blk)\n @config.read(&blk)\n @config\n end", "def configure_tests_build_configuration_settings(project, name, platforms)\n\n platforms.each do |platform|\n\n target = project.targets.find { |y| y.name == \"#{name} #{platform} Tests\" }\n\n settings = { \n 'INFOPLIST_FILE' => \"#{name}Tests/Info.plist\",\n 'COMBINE_HIDPI_IMAGES' => 'YES'\n }\n\n settings.each do |key, val|\n target.build_configuration_list.set_setting(key, val)\n end\n end\nend", "def initialize\n self.sdk = \"iphonesimulator\" unless sdk\n self.test_output = :junit\n super\n end", "def setup\n FileUtils.cp(VALID_CONFIG_JSON_ORIG, CONFIG_JSON)\n @config = Thermoserver::Configuration.new\n @api_key = @config.api_key\n end", "def sh_test_options\n {\n :cmd_pattern => '% ',\n :cmd => '2>&1 ',\n :indents => true,\n :env => {\n 'TAPFILE' => nil,\n 'TAP_GEMS' => nil, \n 'TAP_PATH' => nil,\n 'TAPENV' => nil,\n 'TAPRC' => nil,\n 'TAP_DEBUG' => nil\n },\n :replace_env => false\n }\n end", "def setup()\n # simulate a \"startup\" function (not available in my Test Unit version)\n if @@cmptr.nil?\n @@cmptr = 0 # Set to 0 at first run to make confiuration only once\n print \"Please provide the email to use for firefox sync: \"\n @@email = STDIN.gets.chomp()\n print \"Please provide the password to use for firefox sync: \"\n @@pwd = STDIN.gets.chomp()\n print \"Please provide the passphrase (aka recovery key) to use for firefox sync: \"\n @@passphrase = STDIN.gets.chomp()\n end\n end", "def load_config()\n self.config = Kitchenplan::Config.new().config\n end", "def setup\n# @api = DDOS_API.new(1000, 'localhost', @@port)\n @api = DDOS_API.new(:failover_timeout=>1000, :local_ip=>'localhost', :local_port=>@@port)\n @@port += 1\n # @api.config_api('testingConfig.txt')\n end", "def configuration\n Stupidedi::Config.new.customize do |c|\n c.interchange.customize do |x|\n x.register(\"00401\") { Stupidedi::Versions::Interchanges::FourOhOne::InterchangeDef }\n end\n\n c.functional_group.customize do |x|\n x.register(\"004010\") { Stupidedi::Versions::FunctionalGroups::FortyTen::FunctionalGroupDef }\n end\n\n c.transaction_set.customize do |x|\n # Not using the barebone transaction set definition, as it doesn't have enough constraints to parse\n # the document with multiple levels of HL (not deterministic)\n # x.register(\"004010\", \"SH\", \"856\") { Stupidedi::Contrib::FortyTen::TransactionSetDefs::SH856 }\n \n # Modified the guide to include REF element for the Line Item HL\n x.register(\"004010\", \"SH\", \"856\") { Stupidedi::Contrib::FortyTen::Guides::SH856 }\n end\n end\n end", "def setup_initial_config!\n application.config do\n attribute :praxis do\n attribute :validate_responses, Attributor::Boolean, default: false\n attribute :validate_response_bodies, Attributor::Boolean, default: false\n\n attribute :show_exceptions, Attributor::Boolean, default: false\n attribute :x_cascade, Attributor::Boolean, default: true\n end\n end\n end", "def config\n machined.config\n end", "def env_config; end", "def env_config; end", "def env_config; end", "def env_config; end", "def setup(&block)\n block.call config if block_given?\n end", "def test_it_should_know_its_gem_path_with_a_default_location\n ENV.delete \"INSPEC_CONFIG_DIR\"\n ENV[\"HOME\"] = File.join(@config_dir_path, \"fakehome\")\n expected = File.join(ENV[\"HOME\"], \".inspec\", \"gems\", @ruby_abi_version)\n assert_equal expected, @installer.gem_path\n end", "def finish_linux_configuration\n\n configure do\n\n user = add_parameter 'username', {type: 'string'}\n pwd = add_parameter 'ssh_key', {type: 'string'}\n\n end\n\n end" ]
[ "0.6666171", "0.63427824", "0.63379824", "0.6295932", "0.6278882", "0.6180843", "0.61198395", "0.60151243", "0.5979334", "0.5968036", "0.59003645", "0.58436185", "0.5811028", "0.57996154", "0.579483", "0.57865864", "0.57649136", "0.576078", "0.57389414", "0.57224333", "0.57101136", "0.57101136", "0.5699367", "0.56971544", "0.5649359", "0.56463146", "0.5646201", "0.5646201", "0.5646201", "0.5628437", "0.5628437", "0.5628437", "0.5628437", "0.5628437", "0.5628437", "0.5628437", "0.5628437", "0.5628437", "0.5628437", "0.5628437", "0.5628437", "0.5628437", "0.5628437", "0.5628437", "0.5628437", "0.5628437", "0.5628437", "0.56135416", "0.5611143", "0.56023973", "0.55937713", "0.55925924", "0.559078", "0.55871063", "0.55561364", "0.5521503", "0.5521405", "0.55211264", "0.5511303", "0.5504243", "0.5487438", "0.54824424", "0.5463423", "0.5461585", "0.5456491", "0.5456491", "0.5456491", "0.5456491", "0.5456491", "0.545561", "0.5454533", "0.5444949", "0.5444701", "0.5442874", "0.54404503", "0.54392904", "0.54376966", "0.5437354", "0.5432343", "0.54313695", "0.5428993", "0.54262364", "0.5423811", "0.5372077", "0.536056", "0.5350266", "0.5348063", "0.5342168", "0.5326482", "0.532036", "0.5310028", "0.5308314", "0.5300385", "0.5297808", "0.5297808", "0.5297808", "0.5297808", "0.52975464", "0.5295647", "0.5287769" ]
0.7144003
0
Runs the SPEC test suite. Args:: config:: the configuration read by load_configuration
def run_suite(config) # Build the sandbox. FileUtils.rm_rf config[:output_dir] if File.exist? config[:output_dir] FileUtils.mkdir_p config[:output_dir] File.chmod 0777, config[:output_dir] temp_dir = File.join config[:output_dir], '__temp_' + "#{Time.now.strftime("%Y%m%d%H%M%S")}_#{$PID}_#{rand(1 << 20)}" FileUtils.mkdir_p temp_dir File.chmod 0777, config[:output_dir] # Figure out PIN's configuration. pin_config = { :temp_dir => temp_dir, :tool_binary => config[:tool_binary], :tool_args => config[:tool_args] || [] } if /^vlsifarm/ =~ Socket.gethostname # On vlsifarm. pin_config[:binary] = '/mit/6.823/Fall09/bin/pin' else # On linerva. pin_config[:tool_binary] += '.so' pin_config[:binary] = '/mit/6.823/Fall09/Pin2009/pin' end # Run the tests. test_number = 0 config[:suite].keys.sort.each do |test_name| test_data = config[:suite][test_name] next if config[:skip_tests].include? test_name test_number += 1 puts "Test #{test_name} -- #{test_number} of #{config[:suite].length}" out_file = File.basename(test_data['binary']) + '.out' pin_output = File.join config[:output_dir], out_file run_test test_data, pin_config, pin_output end # Tear down the sandbox. FileUtils.rm_rf temp_dir end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_setup(config)\n config_dir = File.join(Dir.pwd, 'test', 'specs', 'config')\n path = Dir.glob(File.join(config_dir, \"#{config}*\")).first\n\n msg = \"No file matching #{config} found in #{config_dir}\"\n raise msg unless path\n\n Thread.abort_on_exception = true\n runner = Thread.new do\n Jackal::Utils::Spec.system_runner.run!(:config => path)\n end\n source_wait(:setup)\n runner\nend", "def test_script\n spec_directory = @config_manager['test_pack.spec_directory']\n spec_file = File.join(spec_directory, \"#{@name}_spec.rb\")\n @logger.info(\"Starting spec '#{spec_file}'...\")\n RSpec::Core::Runner.run([spec_file])\n end", "def run\n @rspec_test_name = PATH_TO_RSPEC_SPEC_FOLDER + @rspec_test_name\n unless File.exists?(\"#{@rspec_test_name}\")\n @@failed_tests.push(\"Test not exists: #{@rspec_test_name}\")\n @@failed_tests_counter +=1\n return 1\n end\n @cmd = `rspec #{@rspec_test_name}`\n describe_test(@rspec_test_name, @cmd, $?.exitstatus)\n generate_and_expand_output\n end", "def run\n test_files.each do |file|\n eval File.read(file)\n end\n\n results = []\n @tests.each_pair do |name, test|\n results << test.call(@config)\n end\n results.reject!(&:nil?)\n results.reject!(&:empty?)\n results.flatten!\n results\n end", "def exec_test\n $stderr.puts 'Running tests...' if verbose?\n\n runner = config.testrunner\n\n case runner\n when 'auto'\n unless File.directory?('test')\n $stderr.puts 'no test in this package' if verbose?\n return\n end\n begin\n require 'test/unit'\n rescue LoadError\n setup_rb_error 'test/unit cannot loaded. You need Ruby 1.8 or later to invoke this task.'\n end\n autorunner = Test::Unit::AutoRunner.new(true)\n autorunner.to_run << 'test'\n autorunner.run\n else # use testrb\n opt = []\n opt << \" -v\" if verbose?\n opt << \" --runner #{runner}\"\n if File.file?('test/suite.rb')\n notests = false\n opt << \"test/suite.rb\"\n else\n notests = Dir[\"test/**/*.rb\"].empty?\n lib = [\"lib\"] + config.extensions.collect{ |d| File.dirname(d) }\n opt << \"-I\" + lib.join(':')\n opt << Dir[\"test/**/{test,tc}*.rb\"]\n end\n opt = opt.flatten.join(' ').strip\n # run tests\n if notests\n $stderr.puts 'no test in this package' if verbose?\n else\n cmd = \"testrb #{opt}\"\n $stderr.puts cmd if verbose?\n system cmd #config.ruby \"-S tesrb\", opt\n end\n end\n end", "def initialize(config, game)\n @config = config\n @game = game\n # Parse tests suites\n @tests_suites = Dir.glob(\"#{__dir__}/tests_suites/*.rb\").map do |tests_suite_file|\n tests_suite = File.basename(tests_suite_file, '.rb').to_sym\n require \"#{__dir__}/tests_suites/#{tests_suite}.rb\"\n [\n tests_suite,\n TestsSuites.const_get(tests_suite.to_s.split('_').collect(&:capitalize).join.to_sym).new(tests_suite, @game)\n ]\n end.to_h\n @tests_info_file = \"#{@game.path}/Data/Modsvaskr/Tests/TestsInfo.json\"\n end", "def run_exp(config)\n str_of_exp = {:scalability => 's', :latency => 'l', :memory => 'm'}\n config = create_config unless config\n\n # remove unwanted tests\n if $options[:remove_exp] || $options[:remove_q] || $options[:remove_sf] || $options[:remove_nd]\n config[:tests].reject! do |t|\n # one of these must be specified, causing a possible false here\n ($options[:remove_exp] ? str_of_exp[t[:exp]] == $options[:remove_exp] : true) &&\n ($options[:remove_q] ? t[:q] == $options[:remove_q] : true) &&\n ($options[:remove_sf] ? t[:sf] == $options[:remove_sf] : true) &&\n ($options[:remove_nd] ? t[:nd] == $options[:remove_nd] : true)\n end\n save_config(config, backup:true)\n end\n\n # Otherwise, setup and run\n config2 = config.dup\n config[:tests].each_with_index do |test, i|\n unless test[:jobid] || test[:skip] || (test[:fail] && $options[:skipfails]) # check for empty or skip\n if $options[:skipone] # oneshot\n test[:skip] = true\n $options[:skipone] = false\n else\n test = run_trial(test)\n end\n config2[:tests][i] = test\n save_config config2 # update file\n end\n end\nend", "def run(with = nil)\n with ||= RSpec::Core::Runner.new(nil)\n @rspec_exit_code = with.run_specs(tests)\n @formatter.results\n end", "def run_tests_under(config, options, root)\n summary = {}\n test_list(File.join($work_dir,root)).each do |path|\n name = path.sub(\"#{$work_dir}/\", '')\n puts \"\", \"\", \"#{name} executing...\"\n result = TestWrapper.new(config,options,path).run_test\n puts \"#{name} returned: #{result.fail_flag}\"\n summary[name] = result.fail_flag\n end\n return summary\nend", "def setup_test_suite\n return unless config.dig(\"test_suite\") == \"rspec\"\n\n generate \"rspec:install\"\n run \"rm -r test\"\n end", "def run_tests(sideload_config:)\n telnet_config ={\n 'Host' => @roku_ip_address,\n 'Port' => 8085\n }\n\n @device_config[:init_params] = {\n root_dir: @root_dir\n }\n loader = Loader.new(**@device_config)\n connection = Net::Telnet.new(telnet_config)\n code, _build_version = loader.sideload(**sideload_config)\n if code == SUCCESS\n @device_config[:init_params] = nil\n linker = Linker.new(**@device_config)\n linker.launch(options: \"RunTests:true\")\n\n connection.waitfor(@end_reg) do |txt|\n handle_text(txt: txt)\n end\n print_logs\n connection.puts(\"cont\\n\")\n end\n end", "def run_suite(tests)\n @app.run_suite(tests)\n end", "def runsuite\n # get the name of the suite file chosen by the user\n @suite = params['suite']\n start_time = Time.now.strftime('%Y-%m-%d_-_%H-%M-%S')\n # Create filename for console output log\n session[:console_filename] = \"log/runner/console-#{start_time}.log\"\n # Create batch file that will be used to execute the test\n batch_filename = \"run-#{start_time}.bat\"\n wd = session[:working_dir]\n batch_path = File.join(wd + '/../runner_batch_files/' + batch_filename)\n batch_handle = File.new(batch_path, 'w+')\n # Build the command line string to execute the requested script.\n #\n # \"-Cdirectory\" is used to make the cmd shell cd into suite_dir before\n # executing the script, in case the suite script tries to 'require' any\n # other files. Without this, ruby might have trouble resolving the path\n # to files the suite tries to load.\n cmd = \"ruby -C#{session[:suite_dir] } #{@suite} --\" +\n\t \" -v verbose > #{session[:console_filename]}\"\n batch_handle.puts cmd # write cmd to batch file\n batch_handle.close\n # Run the batch file (which launches the test suite).\n system(batch_path)\n end", "def run\n sut_inspec_results = '/tmp/inspec_results.json'\n\n inspec_cmd = \"inspec exec '#{@test_dir}' --reporter json > #{sut_inspec_results}\"\n result = on(@sut, inspec_cmd, :accept_all_exit_codes => true)\n\n tmpdir = Dir.mktmpdir\n begin\n Dir.chdir(tmpdir) do\n if @sut[:hypervisor] == 'docker'\n %x(docker cp \"#{@sut.host_hash[:docker_container].id}:#{sut_inspec_results}\" .)\n else\n scp_from(@sut, sut_inspec_results, '.')\n end\n\n local_inspec_results = File.basename(sut_inspec_results)\n\n if File.exist?(local_inspec_results)\n begin\n # The output is occasionally broken from past experience. Need to\n # fetch the line that actually looks like JSON\n inspec_json = File.read(local_inspec_results).lines.find do |line|\n line.strip!\n\n line.start_with?('{') && line.end_with?('}')\n end\n\n @results = JSON.load(inspec_json) if inspec_json\n rescue JSON::ParserError, JSON::GeneratorError\n @results = nil\n end\n end\n end\n ensure\n FileUtils.remove_entry_secure tmpdir\n end\n\n unless @results\n File.open(@result_file + '.err', 'w') do |fh|\n fh.puts(result.stderr.strip)\n end\n\n err_msg = [\"Error running inspec command #{inspec_cmd}\"]\n err_msg << \"Error captured in #{@result_file}\" + '.err'\n\n fail(err_msg.join(\"\\n\"))\n end\n end", "def run_test(component)\n test_path = File.expand_path __dir__\n IO.popen(\"ruby #{test_path}/#{component}_spec.rb\") do |data|\n while line = data.gets\n puts line\n end\n end\n $?.exitstatus\nend", "def run_command\n # run the test suite and check the result\n res, time = time_command @config.command\n if res then\n puts statusbar \"✓ All tests passed\", time, &:white_on_green\n else\n puts statusbar \"✗ Tests failed\", time, &:white_on_red\n end\n res\n end", "def test(*args)\n gemfile = File.join(Dir.pwd, \"/Gemfile\")\n rspec_options = args.join(\" \")\n\n exec \"BUNDLE_GEMFILE=#{gemfile} bundle exec rspec #{rspec_options}\"\n end", "def define\n lib_path = @libs.join(File::PATH_SEPARATOR)\n desc \"Run specs\" + (@name==:spec ? \"\" : \" for #{@name}\")\n task @name do\n specs = file_list\n raise \"No spec files found.\" if specs.empty?\n \n spec = File.expand_path(File.dirname(__FILE__) + '/../../../bin/spec')\n file_prefix = @rcov ? \" -- \" : \"\"\n interpreter = @rcov ? \"rcov\" : \"ruby\"\n redirect = @out.nil? ? \"\" : \" > #{@out}\"\n\n @ruby_opts.unshift( \"-I#{lib_path}\" )\n @ruby_opts.unshift( \"-w\" ) if @warning\n @ruby_opts.unshift( '--exclude \"lib\\/spec\\/.*\"' ) if @rcov\n begin\n run interpreter, @ruby_opts.join(\" \") +\n \" \\\"#{spec}\\\" \" +\n \" #{@spec_opts.join(' ')} \" +\n file_prefix +\n specs.collect { |fn| \"\\\"#{fn}\\\"\" }.join(' ') +\n redirect\n rescue => e\n raise e if @fail_on_error\n end\n end\n self\n end", "def run_tests\n puts \"Running exactly #{@spec.size} tests.\"\n @spec.each do |test_case|\n sleep test_case.wait_before_request\n response = send_request_for(test_case)\n Checker.available_plugins.each do |plugin|\n result = @expectation.check(plugin, response, test_case)\n if not result.success?\n putc \"F\"\n @results << result\n break\n else\n if plugin == Checker.available_plugins.last\n @results << result\n putc \".\"\n end\n end\n end\n end\n end", "def run\n sut_inspec_results = '/tmp/inspec_results.json'\n\n inspec_version = Gem::Version.new(on(@sut, 'inspec --version').output.lines.first.strip)\n\n # See: https://github.com/inspec/inspec/pull/3935\n if inspec_version <= Gem::Version.new('3.9.0')\n inspec_cmd = \"inspec exec '#{@test_dir}' --reporter json > #{sut_inspec_results}\"\n else\n inspec_cmd = \"inspec exec '#{@test_dir}' --chef-license accept --reporter json > #{sut_inspec_results}\"\n end\n\n result = on(@sut, inspec_cmd, :accept_all_exit_codes => true)\n\n tmpdir = Dir.mktmpdir\n begin\n Dir.chdir(tmpdir) do\n scp_from(@sut, sut_inspec_results, '.')\n\n local_inspec_results = File.basename(sut_inspec_results)\n\n if File.exist?(local_inspec_results)\n begin\n # The output is occasionally broken from past experience. Need to\n # fetch the line that actually looks like JSON\n inspec_json = File.read(local_inspec_results).lines.find do |line|\n line.strip!\n\n line.start_with?('{') && line.end_with?('}')\n end\n\n @results = JSON.load(inspec_json) if inspec_json\n rescue JSON::ParserError, JSON::GeneratorError\n @results = nil\n end\n end\n end\n ensure\n FileUtils.remove_entry_secure tmpdir\n end\n\n if @results.nil? || @results.empty?\n File.open(@result_file + '.err', 'w') do |fh|\n fh.puts(result.stderr.strip)\n end\n\n err_msg = [\"Error running inspec command #{inspec_cmd}\"]\n err_msg << \"Error captured in #{@result_file}\" + '.err'\n\n fail(err_msg.join(\"\\n\"))\n end\n end", "def load_configuration\n # Default configuration.\n config = File.open('pin_spec.yml', 'r') { |f| YAML.load f }\n \n if ARGV[0]\n # If the first argument is a Yaml configuration file, use that to override\n # the default configuration.\n if ARGV[0][-4, 4] == '.yml'\n config.merge! File.open(ARGV[0], 'r') { |f| YAML.load f }\n else\n # Argument 1: the output directory.\n config[:output_dir] = ARGV[0]\n end\n end\n \n # Supply a default output directory if no directory is given.\n config[:output_dir] ||= 'results_' + Time.now.strftime(\"%Y%m%d%H%M%S\")\n config[:output_dir] = File.expand_path config[:output_dir],\n File.dirname(__FILE__)\n\n # Argument 2: pintool binary\n config[:tool_binary] = ARGV[1] if ARGV[1]\n config[:tool_binary] = File.expand_path ARGV[1] || config[:tool_binary],\n File.dirname(__FILE__)\n\n # Arguments 3..n: pintool arguments\n if ARGV[2]\n config[:tool_args] = ARGV[2..-1]\n end\n if config[:tool_args].respond_to? :to_str\n config[:tool_args] = config[:tool_args].split\n end\n\n # Suite location.\n suite_file = config[:suite_path] || './spec_suite.yml'\n config[:suite] = File.open(suite_file, 'r') { |f| YAML.load f }\n\n # Filter out tests in the suite.\n config[:suite].delete_if do |test_name, test_config|\n config[:skip_tests].include? test_name\n end \n\n config\nend", "def run test_identifier=nil\n @dispatcher.run!\n # start\n message(\"start\")\n suite_setup,suite_teardown,setup,teardown,tests=*parse(test_identifier)\n if tests.empty? \n @dispatcher.exit\n raise RutemaError,\"No tests to run!\"\n else\n # running - at this point all checks are done and the tests are active\n message(\"running\")\n run_scenarios(tests,suite_setup,suite_teardown,setup,teardown)\n end\n message(\"end\")\n @dispatcher.exit\n @dispatcher.report(tests)\n end", "def clipp(config)\n config = config.dup\n\n if ! config[:input] && ! config[:input_hashes] && ! block_given?\n CLIPPTest::fatal \"Must have :input, :input_hashes, or a block.\"\n end\n\n config[:id] ||= generate_id\n\n if block_given?\n config[:input_hashes] ||= []\n ClippScript::eval(Proc.new) do |input|\n config[:input_hashes] << input\n nil\n end\n end\n\n if config[:input_hashes]\n input_content = \"\"\n config[:input_hashes].each do |h|\n input_content +=\n IronBee::CLIPP::HashToPB::hash_to_pb(h)\n end\n input_path = write_temp_file(\"clipp_test_#{config[:id]}.pb\", input_content)\n config[:input] ||= \"pb:INPUT_PATH @parse\"\n config[:input].gsub!(\"INPUT_PATH\", input_path)\n end\n\n if config[:lua_include]\n config[:lua_include_filename] =\n write_temp_file(\"clipp_test_#{config[:id]}_config.lua\", config[:lua_include])\n end\n\n if config[:lua_module]\n config[:lua_module_filename] =\n write_temp_file(\"clipp_test_#{config[:id]}_module.lua\", config[:lua_module])\n end\n\n config_path = write_temp_file(\n \"clipp_test_#{config[:id]}.config\",\n generate_ironbee_configuration(binding, config[:template])\n )\n\n consumer_chain = (config[:consumer] || DEFAULT_CONSUMER).gsub(\n 'IRONBEE_CONFIG', config_path\n )\n\n clipp_config = write_temp_file(\n \"clipp_test_#{config[:id]}.clipp\",\n \"#{config[:input]} #{consumer_chain}\\n\"\n )\n\n @exit_status, @log = run_clipp(clipp_config)\n @clipp_log = @log\n\n assert_not_nil(@log, \"No output.\")\n end", "def run_tests\n system(\"bundle exec rspec #{rspec_arguments.join(' ')}\")\n end", "def run_test(test)\n @app.run_test(test)\n end", "def initialize(config, game)\n @config = config\n @game = game\n auto_test_esp = \"#{@game.path}/Data/AutoTest.esp\"\n # Ordered list of available in-game test suites\n # Array<Symbol>\n @available_tests_suites =\n if File.exist?(auto_test_esp)\n Base64.decode64(\n ElderScrollsPlugin.new(auto_test_esp).\n to_json[:sub_chunks].\n find { |chunk| chunk[:decoded_header][:label] == 'QUST' }[:sub_chunks].\n find do |chunk|\n chunk[:sub_chunks].any? { |sub_chunk| sub_chunk[:name] == 'EDID' && sub_chunk[:data] =~ /AutoTest_ScriptsQuest/ }\n end[:sub_chunks].\n find { |chunk| chunk[:name] == 'VMAD' }[:data]\n ).scan(/AutoTest_Suite_(\\w+)/).flatten.map { |tests_suite| tests_suite.downcase.to_sym }\n else\n log \"[ In-game testing #{@game.name} ] - Missing file #{auto_test_esp}. In-game tests will be disabled. Please install the AutoTest mod.\"\n []\n end\n log \"[ In-game testing #{@game.name} ] - #{@available_tests_suites.size} available in-game tests suites: #{@available_tests_suites.join(', ')}\"\n end", "def start_testacular(config, misc_options)\n sh \"testacular start \" +\n \"#{config} \" +\n \"#{(misc_options || '').gsub('+', ',')}\"\nend", "def run_test\n if validate(@test)\n generate(@test)\n else\n $stderr.puts \"There were some errors, fix them and rerun the program.\"\n end\nend", "def test(argv = ARGV)\n if spec_file?(argv) && defined?(RSpec)\n # disable autorun in case the user left it in spec_helper.rb\n RSpec::Core::Runner.disable_autorun!\n exit RSpec::Core::Runner.run(argv)\n else\n Zeus::M.run(argv)\n end\n end", "def tests\n config.tests(subject)\n end", "def run_tests(sideload_config:)\n telnet_config ={\n 'Host' => @roku_ip_address,\n 'Port' => 8085\n }\n\n loader = Loader.new(**@device_config)\n connection = Net::Telnet.new(telnet_config)\n code, _build_version = loader.sideload(**sideload_config)\n\n if code == SUCCESS\n in_tests = false\n connection.waitfor(@end_reg) do |txt|\n in_tests = handle_text(txt: txt, in_tests: in_tests)\n end\n connection.puts(\"cont\\n\")\n end\n end", "def run_serverspec(target_specdir)\n $log.debug 'Running serverspec'\n cmd = \"cd #{target_specdir} && sudo rake spec\"\n $log.debug \"cmd=#{cmd}\"\n result = `#{cmd}`\n puts result\n end", "def sub_test\n shell(test_script, source_dir)\n end", "def run_process(config)\n puts \"Processing data\"\n if config.nil?\n puts \"Must have existing config file\"\n exit(1)\n end\n # find any tests we don't have processing data for\n config[:tests].each do |t|\n next if t[:skip] || t[:fail] || t[:exp] != :latency\n\n # Construct a call to run.rb\n tpch = \"tpch#{t[:q]}\"\n query_workdir = File.join($workdir, tpch)\n output_path = File.join(query_workdir, 'process.txt')\n job_dir = File.join(query_workdir, \"job_#{t[:jobid]}\")\n latency_path = File.join(job_dir, 'latencies.txt')\n next if File.exist? latency_path # only do this if no latency file\n\n puts \"---- Processing job #{t[:jobid]}. #{t[:exp]}: sf#{t[:sf]} q#{t[:q]} n#{t[:nd]} s#{t[:sw]} per#{t[:perhost]} trial #{t[:trial]}----\"\n\n infix = ''\n infix << \" --process-latency\" if t[:exp] == :latency\n infix << \" --no-persist\" # make sure not to overwrite last jobid\n infix << \" --switch-latency\" # calculate from switch. doesn't make a big difference\n infix << \" --jobid #{t[:jobid]}\"\n\n cmd = \"#{File.join($script_path, \"run.rb\")} -w #{query_workdir}/ #{infix} 2>&1 | tee #{output_path}\"\n puts cmd\n\n # Run and extract time upon success.\n system(cmd)\n if t[:exp] == :latency\n if !File.exist? latency_path\n puts \"FAILED to process: no latency file found\"\n exit(1)\n else\n puts \"SUCCESS!\"\n end\n end\n end\nend", "def run\n # Here we're using Phantom to load the page and run the specs\n command = \"#{Phantomjs.path} 'phantom_jasmine_run.js' #{@jasmine_server_url} #{@result_batch_size}\"\n IO.popen(command) do |output|\n # The `phantom_jasmine_run.js` script writes out batches of results as JSON\n output.each do |line|\n raw_results = JSON.parse(line, :max_nesting => false)\n # Formatters expect to get `Jasmine::Result` objects.\n # It is the runner's job to convert the result objects from the page, and pass them to the `format` method of their formatter.\n results = raw_results.map { |r| Result.new(r) }\n @formatter.format(results)\n end\n end\n # When the tests have finished, call `done` on the formatter to run any necessary completion logic.\n @formatter.done\n end", "def run_test\n # Add your code here...\n end", "def run_test\n # Add your code here...\n end", "def tests(context = {})\n run_context(context)\n end", "def run\n\n @startDate = Time.now.to_i * 1000\n @status = 'Started'\n start_test_run(create_test_objects(@tests, @runOptions, @id), @cmd)\n @status = 'Completed'\n @endDate = Time.now.to_i * 1000\n set_status\n @event_emitter.emit_event(test_run_completed: self)\n check_status_and_exit\n #add login for sending an exit code based on whether or not there were any failures.\n end", "def run_tests\n\n ::RSpec::Core::Runner.run([])\n\n print ::IRB.CurrentContext.io.prompt\n\n end", "def run_spec(chapter,problem)\n ch = \"#{File.dirname(__FILE__)}/ch#{chapter}\"\n if ENV['solved']\n problem_dir = \"#{ch}/solved/#{problem}.rb\"\n else\n problem_dir = Dir[\"#{ch}/challenge/#{problem}_*\"].first\n end \n sh \"ruby -c #{problem_dir}\" # check syntax\n sh \"rspec -cr #{problem_dir} -r enumerator #{ch}/spec/#{problem}.rb\" # run spec (c for colour, r to require the files, enumerator required for 1.8.6 compatibility)\nend", "def run!\n test_result = Tester::Runner.run(file)\n if test_result.stdout.to_s.strip.empty?\n new_reason = reason\n else\n new_reason = test_result.stdout \n end\n # Capture the exit status, and map to a result object\n result = case test_result.exitstatus\n when 0; Result::Pass\n when 1; Result::Fail\n when 2; Result::Skip\n when nil; Result::NoResult\n else\n new_reason = (test_result.stderr.strip + \"\\n\" + test_result.stdout.strip).strip\n Result::Error\n end\n Tester::Test.new(file, base, result, new_reason, stack)\n end", "def spec_tests(&block)\n require 'onceover/testconfig'\n\n # Load up all of the tests and deduplicate them\n testconfig = Onceover::TestConfig.new(@onceover_yaml, @opts)\n testconfig.spec_tests.each { |tst| testconfig.verify_spec_test(self, tst) }\n tests = testconfig.run_filters(Onceover::Test.deduplicate(testconfig.spec_tests))\n\n # Loop over each test, executing the user's block on each\n tests.each do |tst|\n block.call(tst.classes[0].name, tst.nodes[0].name, tst.nodes[0].fact_set, tst.nodes[0].trusted_set, tst.nodes[0].trusted_external_set, testconfig.pre_condition)\n end\n end", "def run(config_file)\n load_options_from_file(config_file)\n check_options\n output = %x[ #{@binary} #{config_file} ]\n output\n end", "def run\n exe_file, result = compile\n\n if result.failed?\n puts result.error\n return\n end\n\n if cases.empty?\n puts 'No test case found!'\n return\n end\n\n cmd = TTY::Command.new(printer: :progress)\n exe_output = File.join(@temp_dir, 'output')\n\n cases.each do |input, output|\n cmd.run!(exe_file, in: input, out: exe_output)\n identical = FileUtils.compare_file(output, exe_output)\n identical ? puts('Passed') : puts('Failed')\n end\n end", "def run(config_path = nil)\n hooks[:before_run].each { |hook| hook.call(config_path: config_path) }\n ConfigurationBuilder.load_user_config(config_path)\n ConfigurationBuilder.freeze_config(config)\n ConfigurationValidator.new(self).call\n hooks[:config_finalized].each { |hook| hook.call(config_path: config_path) }\n self.locale = config.robot.locale\n Robot.new.run\n end", "def run_tests t, libr = :cascade, test_files=\"test_*.rb\"\n require 'test/unit/testsuite'\n require 'test/unit/ui/console/testrunner'\n require 'tests/testem'\n \n base_dir = File.expand_path(File.dirname(__FILE__) + '/../') + '/'\n \n runner = Test::Unit::UI::Console::TestRunner\n \n $eventmachine_library = libr\n EmTestRunner.run(test_files)\n \n suite = Test::Unit::TestSuite.new($name)\n\n ObjectSpace.each_object(Class) do |testcase|\n suite << testcase.suite if testcase < Test::Unit::TestCase\n end\n\n runner.run(suite)\nend", "def run\n print_banner\n @test_plan.each do |plan|\n found_nodes = nodes(plan)\n if found_nodes\n found_nodes.each { |node| execute_plan_tests(node, plan) }\n end\n end\n exit @ret_code\n end", "def run(context, config)\n notifier = Notifier::Synchronized.new(config.fetch(:notifier))\n notifier.run_start(config)\n\n queue = Queue.new\n tracer = Object.new\n\n threads = @threads.times.map do |n|\n Thread.new do\n Thread.current[:xspec_thread] = n\n loop do\n x = queue.pop\n break if x == tracer\n evaluate_with_duration x, notifier\n end\n end\n end\n\n context.nested_units_of_work.each do |uow|\n queue << uow\n end\n\n # A tracer object is flushed through the system to allow for graceful\n # shutdown without having to explicitly kill threads (which would be\n # messy).\n @threads.times do |uow|\n queue << tracer\n end\n\n threads.each(&:value)\n\n notifier.run_finish\n end", "def test!\n in_test_dir do\n notify.start(\"Running tests on: #{proj_branch}\")\n test.run!\n notify.done(\"Test finished: #{test.status}\", test.passed?)\n end\n end", "def run_all\n passed = Runner.run(['spec'], cli)\n if passed\n Formatter.notify \"How cool, all works!\", :image => :success\n else\n Formatter.notify \"Failing... not there yet.\", :image => :failed\n end\n end", "def run_specs(globs, spec_cmd='spec', run_opts = \"-c -f s\")\n require \"optparse\"\n require \"spec\"\n globs = globs.is_a?(Array) ? globs : [globs]\n examples, failures, errors, pending = 0, 0, 0, 0\n\n time = Benchmark.measure do\n globs.each do |glob|\n Dir[glob].each do |spec|\n response = Open3.popen3(\"#{spec_cmd} #{File.expand_path(spec)} #{run_opts}\") do |i,o,e|\n while out = o.gets\n STDOUT.puts out\n STDOUT.flush\n if out =~ /\\d+ example/\n e, f, p = out.match(/(\\d+) examples?, (\\d+) failures?(?:, (\\d+) pending?)?/)[1..-1]\n examples += e.to_i; failures += f.to_i; pending += p.to_i\n end\n end\n errors += 1 if e.is_a?(IO)\n STDOUT.puts e.read if e.is_a?(IO)\n end\n end\n end\n end\n\n puts\n puts \"*** TOTALS ***\"\n if failures == 0\n print \"\\e[32m\"\n else\n print \"\\e[31m\"\n end\n puts \"#{examples} examples, #{failures} failures, #{errors} errors, #{pending} pending, #{sprintf(\"suite run in %3.3f seconds\", time.real)}\"\n # TODO: we need to report pending examples all together\n print \"\\e[0m\"\nend", "def parse_command_line(args)\n test_configuration = {}\n\n option_parser = OptionParser.new do |opts|\n opts.banner = 'Usage: run-tests.rb [options]'\n opts.separator 'Specific options:'\n\n opts.on('--unit', 'Execute frontend unit-tests') do |opt|\n test_configuration[:unit] = opt\n end\n\n opts.on('--e2e', 'Execute frontend end-to-end tests') do |opt|\n test_configuration = create_default_test_configuration\n test_configuration[:e2e] = opt\n end\n\n opts.on('--blc', 'Execute broken link checks') do |opt|\n test_configuration[:blc] = opt\n end\n\n #\n # e2e and broken link testing commandline options\n #\n opts.on('--base-url RHD_BASE_URL', String, 'Run the tests against the specified host e.g http://developers.stage.redhat.com') do |host|\n test_configuration[:base_url] = host\n end\n\n opts.on('--verbose', 'Verbose output for debugging') do |opt|\n bind_environment_variable('RHD_VERBOSE_OUTPUT', 'true')\n test_configuration[:verbose] = opt\n end\n\n #\n # e2e commandline options\n #\n opts.on('--browser BROWSER', String, 'The driver to use when running the tests. [default=chrome]') do |browser|\n check_supported_browser(browser)\n test_configuration[:browser] = browser\n end\n\n opts.on('--use-browserstack', 'Run the specified test type using Docker') do\n test_configuration[:browserstack] = true\n end\n\n opts.on('--browser-count BROWSER_COUNT', String, 'The number of browsers to launch when running the tests with Docker [default=2]') do |browser_count|\n test_configuration[:browser_count] = browser_count.to_i\n end\n\n opts.on('--reporters REPORT', String, 'Type of report you wish to generate. Will mostly be used for Jenkins config, i.e. junit report') do |report|\n test_configuration[:report] = report\n end\n\n opts.on('--cucumber-tags CUCUMBER_TAGS', String, 'The cucumber tags to use') do |cucumber_tags|\n test_configuration[:cucumber_tags] = cucumber_tags\n end\n\n opts.on('--kc', 'Run the KeyCloak e2e tests') do\n test_configuration[:keycloak] = true\n end\n\n #\n # Broken link checking commandline options\n #\n opts.on('-c CONFIG_FILE', 'specify the config.yaml file for broken link checks') do |opt|\n test_configuration[:config] = opt\n end\n\n opts.on('-s SINGLE_URL', 'test a single URL, outputting the response to the console') do |opt|\n test_configuration[:single_url] = opt\n test_configuration[:base_url] = opt\n end\n\n opts.on('--ignore-internal', \"Ignore internal URL's\") do |opt|\n test_configuration[:ignore_internal] = opt\n end\n\n opts.on('--ignore-external', \"Ignore external URL's\") do |opt|\n test_configuration[:ignore_external] = opt\n end\n\n opts.on('--ignore-ssl', 'Disable SSL certificate checking for staging environments') do |opt|\n test_configuration[:ignore_ssl] = opt\n end\n\n #\n # Options supporting the execution of the tests within Docker\n #\n opts.on('--use-docker', 'Run the specified test type using Docker') do\n test_configuration[:docker] = true\n end\n\n opts.on('--update-github-status SHA1', String, 'The SHA to report test results for on GitHub') do |sha1|\n test_configuration[:github_sha1] = sha1\n end\n\n opts.on('--profile PROFILE', String, 'Used to determine the git status context for e2e tests') do |profile|\n test_configuration[:profile] = profile\n end\n\n opts.on_tail('-h', '--help', 'Show this message') do\n puts opts\n Kernel.exit(1)\n end\n end\n\n begin\n option_parser.parse!(args)\n rescue OptionParser::InvalidOption => e\n puts e\n option_parser.parse(%w(-h))\n end\n bind_test_type_environment_variable(test_configuration)\n bind_github_status_environment_variables(test_configuration[:github_sha1], ENV['rhd_test'].to_s, test_configuration[:profile])\n bind_browser_environment_variables(test_configuration[:docker], test_configuration[:browser], test_configuration) if test_configuration[:e2e]\n build_test_execution_command(test_configuration)\n test_configuration\n end", "def run_app_tests\n end", "def run(suite, type, options={})\n @conf = Conf.instance\n reporter = Reporter.new(type)\n\n reporter.header\n\n suite.each do |test|\n case type\n when :test\n run_test(test) if expected_exists?(test)\n\n when :generate\n if expected_exists?(test)\n run_test(test, true) if options[:overwrite]\n else\n run_test(test, true)\n end\n end\n\n reporter.report(test)\n end\n\n reporter.summary\n end", "def spec(rb, context, parser=Pione::Lang::DocumentParser)\n basename = File.basename(rb, \".rb\")\n path = File.join(File.dirname(rb), \"data\", basename[5..-1] + \".yml\")\n YAML.load(File.read(path)).each do |name, testcase|\n context.describe name do\n if strings = testcase[\"valid\"]\n strings.each do |string|\n it \"should parse as %s:%s%s\" % [name, string.include?(\"\\n\") ? \"\\n\" : \" \", string.chomp] do\n should.not.raise(Parslet::ParseFailed) do\n parser.new.send(name).parse(string)\n end\n end\n end\n end\n\n if strings = testcase[\"invalid\"]\n strings.each do |string|\n it \"should fail when parsing as %s:%s%s\" % [name, string.include?(\"\\n\") ? \"\\n\" : \" \", string.chomp] do\n should.raise(Parslet::ParseFailed) do\n parser.new.send(name).parse(string)\n end\n end\n end\n end\n end\n end\n end", "def test\n if phase.has_key?('test')\n execute(\"test\", phase['test'])\n end\n end", "def call(opts, profiles)\n Chef::Log.info \"Using InSpec #{::Inspec::VERSION}\"\n Chef::Log.debug \"Options are set to: #{opts}\"\n runner = ::Inspec::Runner.new(opts)\n\n # parse profile hashes for runner, see libraries/helper.rb\n tests = tests_for_runner(profiles)\n if !tests.empty?\n tests.each { |target| runner.add_target(target, opts) }\n\n Chef::Log.info \"Running tests from: #{tests.inspect}\"\n runner.run\n r = runner.report\n\n # output summary of InSpec Report in Chef Logs\n if !r.nil? && 'json-min' == opts['format']\n time = 0\n time = r[:statistics][:duration] unless r[:statistics].nil?\n passed_controls = r[:controls].select { |c| c[:status] == 'passed' }.size\n failed_controls = r[:controls].select { |c| c[:status] == 'failed' }.size\n skipped_controls = r[:controls].select { |c| c[:status] == 'skipped' }.size\n Chef::Log.info \"Summary: #{passed_controls} successful, #{failed_controls} failures, #{skipped_controls} skipped in #{time} s\"\n end\n\n Chef::Log.debug \"Audit Report #{r}\"\n r\n else\n Chef::Log.warn 'No audit tests are defined.'\n {}\n end\n rescue Inspec::FetcherFailure => e\n Chef::Log.error e.message\n Chef::Log.error \"We cannot fetch all profiles: #{tests}. Please make sure you're authenticated and the server is reachable.\"\n {}\n end", "def initialize(name='test', desc='run tests', &block)\n @name = name || 'test'\n @desc = desc\n\n @config = Test::Config.new\n\n @config.files << default_tests if @config.files.empty?\n @config.loadpath << 'lib' if @config.loadpath.empty?\n\n block.call(@config)\n\n define_task\n end", "def run_one_test(session)\n \n end", "def run_module_spec(module_name)\n\n puts '-' * 80\n puts \"Running rspec tests for module #{module_name}\"\n puts '-' * 80\n\n Dir.chdir(\"modules/#{module_name}\") do\n # The following is a customized replacement for 'spec_prep'.\n # We do not want to use upstream modules which are usually installed\n # using `rake spec_prep`, instead we symlink to our own modules.\n directory_name = \"spec/fixtures\"\n Dir.mkdir(directory_name) unless File.exists?(directory_name)\n link_name = \"spec/fixtures/modules\"\n system(\"ln -s ../../../../modules #{link_name}\") unless File.exists?(link_name)\n\n # We also need to create an empty site.pp file in the manifests dir.\n directory_name = \"spec/fixtures/manifests\"\n Dir.mkdir(directory_name) unless File.exists?(directory_name)\n site_file_name = \"spec/fixtures/manifests/site.pp\"\n system(\"touch #{site_file_name}\") unless File.exists?(site_file_name)\n\n puts \"Invoking tests on module #{module_name}\"\n system('rake spec_standalone')\n end\nend", "def run(report)\n @report = report\n pending if test.nil?\n\n begin\n setup\n instance_eval(&test)\n ensure\n teardown\n @report = nil\n end\n end", "def run_tests(spec, rake_path)\n pwd = FileUtils.pwd\n\n FileUtils.chdir(spec.full_gem_path)\n\n output = \"\"\n exit_status = nil\n\n if spec.files.include?(\".gemtest\")\n Open3.popen3(rake_path, \"test\", '--trace') do |stdin, stdout, stderr, thr|\n loop do\n if stdout.eof? and stderr.eof?\n break\n end\n\n buf = \"\"\n\n handles, _, _ = IO.select([stdout, stderr].reject { |x| x.closed? || x.eof? }, nil, nil, 0.1)\n\n begin\n handles.each { |io| io.readpartial(16384, buf) } if handles\n rescue EOFError, IOError\n next\n end\n\n output += buf\n\n print buf\n end\n\n exit_status = thr.value\n end\n\n if config[\"upload_results\"] or\n (!config.has_key?(\"upload_results\") and ask_yes_no \"Upload these results to rubygems.org?\")\n\n upload_results(gather_results(spec, output, exit_status.exitstatus == 0))\n end\n\n if exit_status.exitstatus != 0\n alert_error \"Tests did not pass. Examine the output and report it to the author!\"\n\n FileUtils.chdir(pwd)\n\n raise Gem::TestError\n end\n else\n puts\n puts \"This gem has no tests! Please contact the author to gain testing and reporting!\"\n puts\n end\n\n FileUtils.chdir(pwd)\n end", "def go_run_tests\n @status = :running\n Thread.new do\n begin\n test_cases = @test_suite.sources\n\n @mutex.synchronize do\n @test_cases = test_cases\n @test_results = {}\n end\n\n @test_suite.run_tests do |result|\n @mutex.synchronize do\n @test_results[result[:source]] = result[:result]\n end\n end\n\n rescue => e\n puts e\n print e.bracktrace.join(\"\\n\")\n ensure\n @status = :ran\n end\n\n end\n end", "def go_run_one(test_case)\n @status = :running\n Thread.new do\n begin\n @test_suite.run_test(test_case) do |result|\n @test_results[result[:source]] = result[:result]\n end\n rescue => e\n puts e\n print e.bracktrace.join(\"\\n\")\n ensure\n @status = :ran\n end\n end\n end", "def run(reporter=nil)\n run_tests(tests, true, reporter)\n end", "def run(config, content = nil)\n # init content as default table if available\n if content != nil\n settable_cmd(\"default\", content)\n end\n\n return if config == \"---\\n\"\n\n # process each command in order\n read_config(config) do | cmd, args |\n if cmd == \"read\" or cmd == \"create\"\n self.send(\"#{cmd}_cmd\", *args)\n else\n # dynamically call method based on command name\n args = set_table_refs(cmd, args)\n if args.class == DataFile # only one arg\n args.send(\"#{cmd}_cmd\", *args[1..-1])\n elsif args[0].class == DataFile # single datafile\n args[0].send(\"#{cmd}_cmd\", *args[1..-1])\n else # mult datafiles\n args[0][0].send(\"#{cmd}_cmd\", *args)\n end\n end\n end\n end", "def run\n test_using_random_sample\n test_using_first_of\n end", "def run\n @testcases.each do |test|\n print \"[ RUN... ] \".green + \" #{name} #{test.name}\\r\"\n\n if test.run\n puts \"[ OK ] \".green + \" #{name} #{test.name}\"\n else\n puts \"[ FAIL ] \".red + \" #{name} #{test.name}\"\n puts\n puts \"Command that failed:\"\n test.explain\n return false\n end\n end\n\n true\n end", "def setup_spec(t)\n t.spec_opts = ['--options', \"\\\"#{RIGHT_BOT_ROOT}/spec/spec.opts\\\"\"]\n t.spec_files = FileList[\"#{RIGHT_BOT_ROOT}/**/spec/**/*_spec.rb\"]\n t\nend", "def shell_run\n success = ruby('rubytest', *config.to_shellwords)\n exit -1 unless success\n end", "def run_all\n run_suite(@suite)\n end", "def setup_test_suite\n announce \"Installing Test Suite\"\n system \"bundle exec rails g rspec:install\"\n copy_spec_folder\n copy_guardfile\n git add: '.'\n git commit: %Q{ -m \"Setup core TDD and debugging suite using RSpec, Capybara, Guard, and FactoryBot\" }\nend", "def spec\n File.join root, 'spec'\n end", "def spec(argv=ARGV)\n # disable autorun in case the user left it in spec_helper.rb\n RSpec::Core::Runner.disable_autorun!\n exit RSpec::Core::Runner.run(argv)\n end", "def test(command)\n run(command, :test => true)\n end", "def run_tests\n `make > dev/null`\n @test_harness.run_test(\"./triangle 0 0 0 0 0 0\", :nat_simple)\n @test_harness.run_test(\"./triangle 1 1 2 2 3 3\", :nat_hard)\n @test_harness.run_test(\"./triangle 1 1 3 2 1 3\", :iso_acute)\n @test_harness.run_test(\"./triangle 1 1 3 2 5 1\", :iso_obtuse)\n @test_harness.run_test(\"./triangle 1 1 0 2 0 1\", :iso_right)\n @test_harness.run_test(\"./triangle 1 1 5 1 5 4\", :sca_right)\n @test_harness.run_test(\"./triangle 1 1 4 2 6 1\", :sca_obtuse)\n @test_harness.run_test(\"./triangle 1 1 2 2 4 1\", :sca_obtuse)\n @test_harness.run_test(\"./triangle 0 0 1 3 4 0\", :sca_acute)\n `make clean`\n end", "def run_on_project\n @target_dir = @params[:target_dir]\n zones = @project.get_element('zones')\n\n # iterates all zones, descend into zone\n run_on_project_zones(zones)\n\n # use the specwrite class to write a complete\n # serverspec example in a subdirectory(serverspec)\n target_specdir = File.join(@target_dir, 'serverspec')\n\n begin\n spec_writer = SpecWriter.new(target_specdir, @spec_code)\n spec_writer.write\n\n outputs 'SPEC', \"Serverspecs written to #{target_specdir}. Run:\"\n outputs 'SPEC', \"( cd #{target_specdir}; sudo rake spec )\"\n outputs 'SPEC', 'To run automatically, use --run'\n rescue => exception\n $log.error \"Error writing serverspec files, #{exception}\"\n STDERR.puts exception.inspect\n end\n\n run_serverspec(target_specdir) if @params[:auto_run]\n end", "def run\n evaluate_checks if @config.key?('checks')\n evaluate_custom if @config.key?('custom')\n evaluate_and_dispatch_events\n end", "def test\n cmd = \"rackup #{@test_config}\" \n puts \"=> #{cmd} -p 5000 -E test -o 127.0.0.1\"\n system(cmd)\nend", "def run_suite(suite)\n suite.benches.each do |test|\n run_bench(test)\n end\n suite.suites.each do |(description, suite)|\n run_suite(suite)\n end\n @count[:suite] += 1\n end", "def testcase3(prog)\n rc = prog.run(\"blah\")\n assert_equal(0, rc, \"program should exit normally\")\n end", "def run(config_path = nil)\n hooks[:before_run].each { |hook| hook.call(config_path: config_path) }\n Configuration.load_user_config(config_path)\n Configuration.freeze_config(config)\n self.locale = config.robot.locale\n Robot.new.run\n end", "def start\n ENV['RAILS_ENV'] ||= 'test'\n Formatter.info \"Starting RSpectacle #{ ENV['RAILS_ENV'] } environment\"\n\n require './spec/spec_helper'\n\n Formatter.info 'RSpectacle is ready!'\n end", "def test desc, &block\n self.setup {}\n desc = Testing::Functions.make_constantizeable(desc)\n if block_given?\n test = \"test_#{desc.gsub(/\\W+/, '_').downcase}\"\n define_method(test, &lambda {$current_spec = self; instance_eval(&block)})\n (@@_tests ||= []) << test.to_sym\n (@own_tests ||= []) << test.to_sym\n end\n self.teardown {}\n end", "def run\n BrowserShooter::Logger.verbose = opts[:verbose]\n BrowserShooter::Logger.log( \"Starting script running with version #{BrowserShooter::VERSION}...\" )\n\n config = BrowserShooter::Configurator.new( opts )\n suites = config.suites\n\n suites.each do |suite|\n suite.tests.each do |test|\n suite.browsers.each do |browser|\n BrowserShooter::Base.run_test(\n suite,\n test,\n browser,\n config\n )\n end\n end\n end\n\n BrowserShooter::Logger.log( \"... script running ended.\" )\n BrowserShooter::Logger.log( \"Logs and Shots are in: #{config[\"output_path\"]}\", true )\n BrowserShooter::Logger.log( \"BYE!\" )\n end", "def run_specs(example_groups)\n @configuration.reporter.report(@world.example_count(example_groups)) do |reporter|\n @configuration.with_suite_hooks do\n with_context_hooks, without_context_hooks = example_groups.partition(&:any_context_hooks?)\n success = run_in_parallel(without_context_hooks, reporter)\n success &&= with_context_hooks.map { |g| g.run(reporter) }.all?\n success ? 0 : @configuration.failure_exit_code\n end\n end\n end", "def test_pour nom, description\n desc description\n task nom do\n sh %{rake tous_les_tests TEST=spec/#{nom.to_s}_spec.rb}\n end\nend", "def test() \n @runner.prepareForFile(@filename)\n testIfAvailable(codeFilename())\n end", "def call\n scenario.run(self)\n end", "def prepare_test_stand\n unless CONFIG_DIR.exist?\n puts \"Unable to rum specs - .ini not found. Put all your .ini files into #{CONFIG_DIR}!\"\n RSpec.wants_to_quit=true\n end\n\n FileUtils.rm_rf TMP_DIR\n FileUtils.cp_r SOURCE_DIR, TEST_DIR #TMP_DIR\nend", "def run(test)\n url = \"/test/javascript/#{test}_test.html\"\n unless File.exists?(RAILS_ROOT+url)\n raise \"Missing test file #{url} for #{test}\"\n end\n @tests << url\n end", "def run(test)\n output = StringIO.new\n failed = false\n start = Time.now\n reporter = new_reporter(output)\n reporter.report(1) do\n example_group_index.fetch(test.expression.syntax).each do |example_group|\n next if example_group.run(reporter)\n failed = true\n break\n end\n end\n output.rewind\n Result::Test.new(\n test: nil,\n mutation: nil,\n output: output.read,\n runtime: Time.now - start,\n passed: !failed\n )\n end", "def rspec\n\tsystem('rspec --init')\nend", "def run\n if enabled?\n reset\n puts \"Running test: #{path}\"\n puts \"Follow Here: #{File.join(job_folder, 'all.log')}\"\n runner.run(command, job_folder)\n puts Formatter.status_line(self)\n status\n else\n puts \"Test disabled, skipping.\"\n end\n end", "def run\n runner = self\n @test_cases.each do |path|\n next if ENV['TEST_CASE'] && !File.basename(path).match(ENV['TEST_CASE'])\n\n Aws::ModelValidators.load_json(path).tap do |test_case|\n\n models = test_case.inject({}) { |h,(k,v)| h[k.to_sym] = v; h }\n errors = models.delete(:errors)\n\n @group.it(File.basename(path[0..-6])) do\n pending unless errors\n results = described_class.new.validate(models, apply_schema: false)\n unless runner.results_match?(results, errors)\n expect(results).to eq(errors)\n end\n end\n\n end\n end\n end", "def run\n each_test do |liquid, layout, assigns, page_template, template_name|\n compile_and_render(liquid, layout, assigns, page_template, template_name)\n end\n end", "def application_flow\n if @check\n # run just the suite setup test if requested\n if @configuration.suite_setup\n exit @engine.run(@configuration.suite_setup)\n else\n raise Rutema::RutemaError,\"There is no suite setup test defined in the configuration.\"\n end\n else\n # run everything\n exit @engine.run(@test_identifier)\n end\n end", "def spec\n File.join root, 'spec'\n end", "def spec\n File.join root, 'spec'\n end" ]
[ "0.671999", "0.6521156", "0.6399976", "0.62786806", "0.60279274", "0.59057564", "0.5890867", "0.58558154", "0.5836383", "0.5824763", "0.5735378", "0.5709023", "0.56896734", "0.5681503", "0.56168157", "0.5600708", "0.55904984", "0.5569201", "0.55658704", "0.5545642", "0.5542673", "0.5535667", "0.55322546", "0.5493039", "0.54890853", "0.5478352", "0.5476692", "0.54686123", "0.5453352", "0.54522914", "0.54484624", "0.5409216", "0.54003453", "0.53831065", "0.53778774", "0.537369", "0.537369", "0.5366324", "0.5359441", "0.5358867", "0.53537184", "0.5329511", "0.5318683", "0.5309771", "0.52990025", "0.52958816", "0.5290058", "0.5286097", "0.5284005", "0.5269636", "0.52679247", "0.52624416", "0.5253191", "0.5248737", "0.5243903", "0.5196412", "0.5189482", "0.518144", "0.51778215", "0.5177679", "0.51745874", "0.5170717", "0.51697946", "0.5164873", "0.51576835", "0.5156404", "0.5151463", "0.51459223", "0.5139205", "0.51194465", "0.51172876", "0.51076365", "0.5082899", "0.50823295", "0.50780123", "0.5063526", "0.50617266", "0.5056946", "0.5052569", "0.5050873", "0.5045169", "0.5034826", "0.5034429", "0.5029853", "0.5025726", "0.5023887", "0.5023357", "0.50230527", "0.50179225", "0.50152856", "0.49934316", "0.499297", "0.4990189", "0.49856386", "0.4985585", "0.498398", "0.49831226", "0.4980779", "0.49761462", "0.49761462" ]
0.6525058
1
Runs a test in the SPEC suite.
def run_test(test_data, pin_config, pin_output) command = %Q|"#{pin_config[:binary]}" -t "#{pin_config[:tool_binary]}"| + %Q| -o "#{pin_output}" | + pin_config[:tool_args].map { |arg| %Q|"#{arg}"| }.join(' ') + ' -- ' + %Q|"#{test_data['binary']}" | + test_data['args'].map { |arg| %Q|"#{arg}"| }.join(' ') command += %Q| < "#{test_data['stdin']}"| if test_data['stdin'] Dir.chdir(test_data['directory'] || pin_config[:temp_dir]) do puts command + "\n" Kernel.system command end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n @rspec_test_name = PATH_TO_RSPEC_SPEC_FOLDER + @rspec_test_name\n unless File.exists?(\"#{@rspec_test_name}\")\n @@failed_tests.push(\"Test not exists: #{@rspec_test_name}\")\n @@failed_tests_counter +=1\n return 1\n end\n @cmd = `rspec #{@rspec_test_name}`\n describe_test(@rspec_test_name, @cmd, $?.exitstatus)\n generate_and_expand_output\n end", "def test_script\n spec_directory = @config_manager['test_pack.spec_directory']\n spec_file = File.join(spec_directory, \"#{@name}_spec.rb\")\n @logger.info(\"Starting spec '#{spec_file}'...\")\n RSpec::Core::Runner.run([spec_file])\n end", "def exec_test\n $stderr.puts 'Running tests...' if verbose?\n\n runner = config.testrunner\n\n case runner\n when 'auto'\n unless File.directory?('test')\n $stderr.puts 'no test in this package' if verbose?\n return\n end\n begin\n require 'test/unit'\n rescue LoadError\n setup_rb_error 'test/unit cannot loaded. You need Ruby 1.8 or later to invoke this task.'\n end\n autorunner = Test::Unit::AutoRunner.new(true)\n autorunner.to_run << 'test'\n autorunner.run\n else # use testrb\n opt = []\n opt << \" -v\" if verbose?\n opt << \" --runner #{runner}\"\n if File.file?('test/suite.rb')\n notests = false\n opt << \"test/suite.rb\"\n else\n notests = Dir[\"test/**/*.rb\"].empty?\n lib = [\"lib\"] + config.extensions.collect{ |d| File.dirname(d) }\n opt << \"-I\" + lib.join(':')\n opt << Dir[\"test/**/{test,tc}*.rb\"]\n end\n opt = opt.flatten.join(' ').strip\n # run tests\n if notests\n $stderr.puts 'no test in this package' if verbose?\n else\n cmd = \"testrb #{opt}\"\n $stderr.puts cmd if verbose?\n system cmd #config.ruby \"-S tesrb\", opt\n end\n end\n end", "def run_suite(tests)\n @app.run_suite(tests)\n end", "def run(test)\n output = StringIO.new\n failed = false\n start = Time.now\n reporter = new_reporter(output)\n reporter.report(1) do\n example_group_index.fetch(test.expression.syntax).each do |example_group|\n next if example_group.run(reporter)\n failed = true\n break\n end\n end\n output.rewind\n Result::Test.new(\n test: nil,\n mutation: nil,\n output: output.read,\n runtime: Time.now - start,\n passed: !failed\n )\n end", "def test\n if phase.has_key?('test')\n execute(\"test\", phase['test'])\n end\n end", "def run(test)\r\n @tests << test\r\n end", "def run_test(test)\n @app.run_test(test)\n end", "def run test_identifier=nil\n @dispatcher.run!\n # start\n message(\"start\")\n suite_setup,suite_teardown,setup,teardown,tests=*parse(test_identifier)\n if tests.empty? \n @dispatcher.exit\n raise RutemaError,\"No tests to run!\"\n else\n # running - at this point all checks are done and the tests are active\n message(\"running\")\n run_scenarios(tests,suite_setup,suite_teardown,setup,teardown)\n end\n message(\"end\")\n @dispatcher.exit\n @dispatcher.report(tests)\n end", "def run_test\n # Add your code here...\n end", "def run_test\n # Add your code here...\n end", "def run\n @testcases.each do |test|\n print \"[ RUN... ] \".green + \" #{name} #{test.name}\\r\"\n\n if test.run\n puts \"[ OK ] \".green + \" #{name} #{test.name}\"\n else\n puts \"[ FAIL ] \".red + \" #{name} #{test.name}\"\n puts\n puts \"Command that failed:\"\n test.explain\n return false\n end\n end\n\n true\n end", "def run(with = nil)\n with ||= RSpec::Core::Runner.new(nil)\n @rspec_exit_code = with.run_specs(tests)\n @formatter.results\n end", "def test desc, &block\n self.setup {}\n desc = Testing::Functions.make_constantizeable(desc)\n if block_given?\n test = \"test_#{desc.gsub(/\\W+/, '_').downcase}\"\n define_method(test, &lambda {$current_spec = self; instance_eval(&block)})\n (@@_tests ||= []) << test.to_sym\n (@own_tests ||= []) << test.to_sym\n end\n self.teardown {}\n end", "def run(test)\n @tests << test\n end", "def run_test(component)\n test_path = File.expand_path __dir__\n IO.popen(\"ruby #{test_path}/#{component}_spec.rb\") do |data|\n while line = data.gets\n puts line\n end\n end\n $?.exitstatus\nend", "def run_test\n if validate(@test)\n generate(@test)\n else\n $stderr.puts \"There were some errors, fix them and rerun the program.\"\n end\nend", "def run(reporter=nil)\n run_tests(tests, true, reporter)\n end", "def test(argv = ARGV)\n if spec_file?(argv) && defined?(RSpec)\n # disable autorun in case the user left it in spec_helper.rb\n RSpec::Core::Runner.disable_autorun!\n exit RSpec::Core::Runner.run(argv)\n else\n Zeus::M.run(argv)\n end\n end", "def testcase3(prog)\n rc = prog.run(\"blah\")\n assert_equal(0, rc, \"program should exit normally\")\n end", "def run\n test_using_random_sample\n test_using_first_of\n end", "def test(command)\n run(command, :test => true)\n end", "def run!\n test_result = Tester::Runner.run(file)\n if test_result.stdout.to_s.strip.empty?\n new_reason = reason\n else\n new_reason = test_result.stdout \n end\n # Capture the exit status, and map to a result object\n result = case test_result.exitstatus\n when 0; Result::Pass\n when 1; Result::Fail\n when 2; Result::Skip\n when nil; Result::NoResult\n else\n new_reason = (test_result.stderr.strip + \"\\n\" + test_result.stdout.strip).strip\n Result::Error\n end\n Tester::Test.new(file, base, result, new_reason, stack)\n end", "def runsuite\n # get the name of the suite file chosen by the user\n @suite = params['suite']\n start_time = Time.now.strftime('%Y-%m-%d_-_%H-%M-%S')\n # Create filename for console output log\n session[:console_filename] = \"log/runner/console-#{start_time}.log\"\n # Create batch file that will be used to execute the test\n batch_filename = \"run-#{start_time}.bat\"\n wd = session[:working_dir]\n batch_path = File.join(wd + '/../runner_batch_files/' + batch_filename)\n batch_handle = File.new(batch_path, 'w+')\n # Build the command line string to execute the requested script.\n #\n # \"-Cdirectory\" is used to make the cmd shell cd into suite_dir before\n # executing the script, in case the suite script tries to 'require' any\n # other files. Without this, ruby might have trouble resolving the path\n # to files the suite tries to load.\n cmd = \"ruby -C#{session[:suite_dir] } #{@suite} --\" +\n\t \" -v verbose > #{session[:console_filename]}\"\n batch_handle.puts cmd # write cmd to batch file\n batch_handle.close\n # Run the batch file (which launches the test suite).\n system(batch_path)\n end", "def run_tests\n\n ::RSpec::Core::Runner.run([])\n\n print ::IRB.CurrentContext.io.prompt\n\n end", "def _it( test )\n puts \"--- On saute les tests pour \\\"#{test}\\\" ---\"\n end", "def test_run\n assert_respond_to(@ts, :run)\n end", "def call(*params)\n self.send :test, *params\n end", "def go_run_one(test_case)\n @status = :running\n Thread.new do\n begin\n @test_suite.run_test(test_case) do |result|\n @test_results[result[:source]] = result[:result]\n end\n rescue => e\n puts e\n print e.bracktrace.join(\"\\n\")\n ensure\n @status = :ran\n end\n end\n end", "def run\n\t\t @stats.tests += 1\n\t\t\tputs \"Testi: #{@name}\"\n\t\t\tctx = Context.new\n\t\t\tbegin\n\t\t\t\tctx.instance_eval(&@block)\n\t\t\trescue TestAbort # we don't really care if it aborts.\n\t\t\trescue Exception => ex\n\t\t\t\tctx.fail\n\t\t\t\t@stats.failed += 1\n\t\t\t\tputs ex.inspect\n\t\t\t\tputs ex.backtrace.join(\"\\n\")\n\t\t\tend\n\t\t\tif ctx.failed?\n\t\t\t\tputs \" # FAIL!!! ############\"\n\t\t\t\t@stats.failed += 1\n\t\t\telsif ctx.skipped?\n\t\t\t\tputs \" = skipped ============\"\n\t\t\t\t@stats.skipped += 1\n\t\t\telse\n\t\t\t\tputs \" - ok.\"\n\t\t\t\t@stats.passed += 1\n\t\t\tend\n\t\t\tputs\n\t\tend", "def sub_test\n shell(test_script, source_dir)\n end", "def test!\n in_test_dir do\n notify.start(\"Running tests on: #{proj_branch}\")\n test.run!\n notify.done(\"Test finished: #{test.status}\", test.passed?)\n end\n end", "def run_tests\n system(\"bundle exec rspec #{rspec_arguments.join(' ')}\")\n end", "def run_tests\n puts \"Running exactly #{@spec.size} tests.\"\n @spec.each do |test_case|\n sleep test_case.wait_before_request\n response = send_request_for(test_case)\n Checker.available_plugins.each do |plugin|\n result = @expectation.check(plugin, response, test_case)\n if not result.success?\n putc \"F\"\n @results << result\n break\n else\n if plugin == Checker.available_plugins.last\n @results << result\n putc \".\"\n end\n end\n end\n end\n end", "def run\n print_banner\n @test_plan.each do |plan|\n found_nodes = nodes(plan)\n if found_nodes\n found_nodes.each { |node| execute_plan_tests(node, plan) }\n end\n end\n exit @ret_code\n end", "def test_run\n\t\tmocked_prog = MiniTest::Mock.new(\"mocked program\")\n\t\tmocked_prog.expect(:run, 1)\n\t\tassert mocked_prog\n\tend", "def test(*args)\n gemfile = File.join(Dir.pwd, \"/Gemfile\")\n rspec_options = args.join(\" \")\n\n exec \"BUNDLE_GEMFILE=#{gemfile} bundle exec rspec #{rspec_options}\"\n end", "def run_tests t, libr = :cascade, test_files=\"test_*.rb\"\n require 'test/unit/testsuite'\n require 'test/unit/ui/console/testrunner'\n require 'tests/testem'\n \n base_dir = File.expand_path(File.dirname(__FILE__) + '/../') + '/'\n \n runner = Test::Unit::UI::Console::TestRunner\n \n $eventmachine_library = libr\n EmTestRunner.run(test_files)\n \n suite = Test::Unit::TestSuite.new($name)\n\n ObjectSpace.each_object(Class) do |testcase|\n suite << testcase.suite if testcase < Test::Unit::TestCase\n end\n\n runner.run(suite)\nend", "def run\n test_files.each do |file|\n eval File.read(file)\n end\n\n results = []\n @tests.each_pair do |name, test|\n results << test.call(@config)\n end\n results.reject!(&:nil?)\n results.reject!(&:empty?)\n results.flatten!\n results\n end", "def run_test(assertion, setup)\n rv = assertion.execute(setup, assertion.suite.ancestry_teardown)\n @count[:test] += 1\n @count[rv.status] += 1\n\n rv\n end", "def run_test \n \n test_table = make_test_table(\"ml-100k/u1.test\")\n @testdata = MovieTest.new(test_table)\n end", "def run(test, &block)\n #hooks[:before].each do |match, block|\n # next if Symbol == match\n # if test.match?(match)\n # scope.instance_exec(test, &block) #block.call(unit)\n # end\n #end\n\n block.call\n\n #hooks[:after].each do |match, block|\n # next if Symbol == match\n # if test.match?(match)\n # scope.instance_exec(test, &block) #block.call(unit)\n # end\n #end\n end", "def test\n jsfl.test\n execute\n end", "def run_command\n # run the test suite and check the result\n res, time = time_command @config.command\n if res then\n puts statusbar \"✓ All tests passed\", time, &:white_on_green\n else\n puts statusbar \"✗ Tests failed\", time, &:white_on_red\n end\n res\n end", "def test() \n @runner.prepareForFile(@filename)\n testIfAvailable(codeFilename())\n end", "def tests; end", "def tests; end", "def run_all\n passed = Runner.run(['spec'], cli)\n if passed\n Formatter.notify \"How cool, all works!\", :image => :success\n else\n Formatter.notify \"Failing... not there yet.\", :image => :failed\n end\n end", "def go_run_tests\n @status = :running\n Thread.new do\n begin\n test_cases = @test_suite.sources\n\n @mutex.synchronize do\n @test_cases = test_cases\n @test_results = {}\n end\n\n @test_suite.run_tests do |result|\n @mutex.synchronize do\n @test_results[result[:source]] = result[:result]\n end\n end\n\n rescue => e\n puts e\n print e.bracktrace.join(\"\\n\")\n ensure\n @status = :ran\n end\n\n end\n end", "def run_one_test(session)\n \n end", "def run_suite(suite)\n suite.benches.each do |test|\n run_bench(test)\n end\n suite.suites.each do |(description, suite)|\n run_suite(suite)\n end\n @count[:suite] += 1\n end", "def test_pour nom, description\n desc description\n task nom do\n sh %{rake tous_les_tests TEST=spec/#{nom.to_s}_spec.rb}\n end\nend", "def run_spec(chapter,problem)\n ch = \"#{File.dirname(__FILE__)}/ch#{chapter}\"\n if ENV['solved']\n problem_dir = \"#{ch}/solved/#{problem}.rb\"\n else\n problem_dir = Dir[\"#{ch}/challenge/#{problem}_*\"].first\n end \n sh \"ruby -c #{problem_dir}\" # check syntax\n sh \"rspec -cr #{problem_dir} -r enumerator #{ch}/spec/#{problem}.rb\" # run spec (c for colour, r to require the files, enumerator required for 1.8.6 compatibility)\nend", "def call(tests)\n Result::Test.new(\n output: '',\n passed: true,\n runtime: 0.0,\n tests: tests\n )\n end", "def run\n exe_file, result = compile\n\n if result.failed?\n puts result.error\n return\n end\n\n if cases.empty?\n puts 'No test case found!'\n return\n end\n\n cmd = TTY::Command.new(printer: :progress)\n exe_output = File.join(@temp_dir, 'output')\n\n cases.each do |input, output|\n cmd.run!(exe_file, in: input, out: exe_output)\n identical = FileUtils.compare_file(output, exe_output)\n identical ? puts('Passed') : puts('Failed')\n end\n end", "def run_all\n run_suite(@suite)\n end", "def run(test)\n url = \"/test/javascript/#{test}_test.html\"\n unless File.exists?(RAILS_ROOT+url)\n raise \"Missing test file #{url} for #{test}\"\n end\n @tests << url\n end", "def run(report)\n @report = report\n pending if test.nil?\n\n begin\n setup\n instance_eval(&test)\n ensure\n teardown\n @report = nil\n end\n end", "def test\n require File.expand_path(File.join(File.dirname(__FILE__), \"tests/tests\"))\n Test.run\nend", "def run_suite\n Unit.run = true\n\n result = create_result\n finished_listener = result.add_listener(TestResult::FINISHED) do |*args|\n notify_listeners(TestResult::FINISHED, *args)\n end\n changed_listener = result.add_listener(TestResult::CHANGED) do |*args|\n notify_listeners(TestResult::CHANGED, *args)\n end\n pass_assertion_listener = result.add_listener(TestResult::PASS_ASSERTION) do |*args|\n notify_listeners(TestResult::PASS_ASSERTION, *args)\n end\n fault_listener = result.add_listener(TestResult::FAULT) do |*args|\n notify_listeners(TestResult::FAULT, *args)\n end\n\n start_time = Time.now\n begin\n notify_listeners(RESET, @suite.size)\n notify_listeners(STARTED, result)\n\n @suite.run(result) do |channel, value|\n notify_listeners(channel, value)\n end\n ensure\n elapsed_time = Time.now - start_time\n result.remove_listener(TestResult::FAULT, fault_listener)\n result.remove_listener(TestResult::CHANGED, changed_listener)\n result.remove_listener(TestResult::FINISHED, finished_listener)\n result.remove_listener(TestResult::PASS_ASSERTION,\n pass_assertion_listener)\n notify_listeners(FINISHED, elapsed_time)\n end\n\n result\n end", "def run(test, &block)\n advice[:before].each do |matches, block|\n if matches.all?{ |match| test.match?(match) }\n scope.instance_exec(test, &block) #block.call(unit)\n end\n end\n\n block.call\n\n advice[:after].each do |matches, block|\n if matches.all?{ |match| test.match?(match) }\n scope.instance_exec(test, &block) #block.call(unit)\n end\n end\n end", "def run\n\n @startDate = Time.now.to_i * 1000\n @status = 'Started'\n start_test_run(create_test_objects(@tests, @runOptions, @id), @cmd)\n @status = 'Completed'\n @endDate = Time.now.to_i * 1000\n set_status\n @event_emitter.emit_event(test_run_completed: self)\n check_status_and_exit\n #add login for sending an exit code based on whether or not there were any failures.\n end", "def _run_suite suite, type\n # suites are cases in minitest\n @turn_case = @turn_suite.new_case(suite.name)\n\n filter = normalize_filter(@options[:filter]) || @turn_config.pattern || /./\n\n suite.send(\"#{type}_methods\").grep(/#{filter}/).each do |test|\n @turn_case.new_test(test)\n end\n\n turn_reporter.start_case(@turn_case)\n\n header = \"#{type}_suite_header\"\n puts send(header, suite) if respond_to? header\n\n assertions = @turn_case.tests.map do |test|\n @turn_test = test\n turn_reporter.start_test(@turn_test)\n\n inst = suite.new(test.name) #method\n inst._assertions = 0\n\n result = inst.run self\n\n if result == \".\"\n turn_reporter.pass\n end\n\n turn_reporter.finish_test(@turn_test)\n\n inst._assertions\n end\n\n @turn_case.count_assertions = assertions.inject(0) { |sum, n| sum + n }\n\n turn_reporter.finish_case(@turn_case)\n\n return assertions.size, assertions.inject(0) { |sum, n| sum + n }\n end", "def test\n end", "def test\n end", "def test\n end", "def runTest(browser)\n puts \"Step 2: At step description here\"\n #Do shit here\n #....\n puts \"Step 3: ....\"\n #Do more shit here\n #....\n\n puts \"Expected Result:\"\n puts \"Result that we expect to happen.\"\n\n if true #Test passed condition here\n self.passed = true\n puts \"TEST PASSED. Add some description/details here\"\n else #Test failed condition here\n self.passed = false\n puts \"TEST FAILED. Show what we have screwed up\"\n end\n end", "def testing\n # ...\n end", "def run(suite, type, options={})\n @conf = Conf.instance\n reporter = Reporter.new(type)\n\n reporter.header\n\n suite.each do |test|\n case type\n when :test\n run_test(test) if expected_exists?(test)\n\n when :generate\n if expected_exists?(test)\n run_test(test, true) if options[:overwrite]\n else\n run_test(test, true)\n end\n end\n\n reporter.report(test)\n end\n\n reporter.summary\n end", "def test_running\n assert_equal(\"Huff puff huff puff\", Human.new(\"Zelda\").run)\n assert_equal(\"Huff puff huff puff\", Human.new(\"Mary\").run)\n end", "def run_fe_tests\n end", "def test(label=nil, &block)\n test_method = \"test #{label}\"\n count = _get_test_count(test_method)\n test_method += \" (#{count})\" if count > 0\n define_method(test_method, &block)\n _set_test(test_method, block)\n test_method\n end", "def test\n puts \"this is a test\"\n end", "def test \n end", "def run_test(file_name)\n puts \"Running tests for #{file_name}\"\n Watir::Browser.default = 'firefox'\n browser = Watir::Browser.new\n browser.goto file_name\n results_paragraph = browser.p :id, 'qunit-testresult'\n if results_paragraph.exists?\n puts results_paragraph.text\n else\n puts 'Test failed to run'\n end\n # parse the output from the test and print error messages for failing tests\n browser.elements_by_xpath(\"//ol[@id='qunit-tests']/li\").each_with_index do |li, index|\n if li.class_name == 'fail'\n puts \" #{index} - #{li.text}\"\n end\n end\n #TODO: find the failing tests and list them\n browser.close\nend", "def test\n\n end", "def test_0\n\n #log_level_to_debug\n\n li = OpenWFE::LaunchItem.new\n li.wfdurl = 'file:test/_testdef.rb'\n\n dotest(li, %w(a b c).join(\"\\n\"))\n end", "def run_app_tests\n end", "def run_test(tests, ints_to_test, current_test_name)\n require \"./primality_tests/\" + current_test_name + \".rb\"\n tests[current_test_name.to_sym][:result] = []\n ints_to_test.each {|int|\n tests[current_test_name.to_sym][:result] << send(current_test_name, int)\n }\nend", "def run_tests_for(test_pattern)\n reload!\n \n test_pattern.chomp!\n case test_pattern\n when 'all'\n title = 'All Tests'\n pattern = '{unit,functional,integration}/**/*'\n when 'units'\n title = 'Unit Tests'\n pattern = 'unit/**/*'\n when 'functionals'\n title = 'Functional Tests'\n pattern = 'functional/**/*'\n when 'integration'\n title = 'Integration Tests'\n pattern = 'integration/**/*'\n else\n # A title of \"nil\" will be filled in after the tests are loaded\n title = nil\n pattern = test_pattern.gsub(':', '/')\n end\n \n files = Dir.glob(\"#{pattern}.rb\")\n files.each do |file|\n load file\n print '.'\n end\n \n # No title yet? Pull the \"best\" title out of the list of contexts\n if !title\n if Test::Spec::CONTEXTS.any?\n title = Test::Spec::CONTEXTS.keys.sort.first\n else\n title = 'unknown'\n end\n end\n \n title += \" (#{files.length} files)\"\n \n suite = Test::Unit::TestSuite.new(title)\n Test::Spec::CONTEXTS.each do |title, container|\n suite << container.testcase.suite\n end\n \n # Run the test suite and return true/false\n Test::Unit::UI::Console::TestRunner.run(suite).passed?\n end", "def run_tests()\n @loaded_modules.each do |module_name|\n module_class = Object.const_get(module_name.to_s).const_get(module_name.to_s).new\n if module_class.respond_to?( 'run' )\n module_class.run()\n else\n puts \"\\e[31mWARNING\\e[0m: Module #{(module_name)} not implemented\"\n end\n end\n end", "def run\n # Here we're using Phantom to load the page and run the specs\n command = \"#{Phantomjs.path} 'phantom_jasmine_run.js' #{@jasmine_server_url} #{@result_batch_size}\"\n IO.popen(command) do |output|\n # The `phantom_jasmine_run.js` script writes out batches of results as JSON\n output.each do |line|\n raw_results = JSON.parse(line, :max_nesting => false)\n # Formatters expect to get `Jasmine::Result` objects.\n # It is the runner's job to convert the result objects from the page, and pass them to the `format` method of their formatter.\n results = raw_results.map { |r| Result.new(r) }\n @formatter.format(results)\n end\n end\n # When the tests have finished, call `done` on the formatter to run any necessary completion logic.\n @formatter.done\n end", "def test(label=nil, *tags, &block)\n return if @_omit\n\n test = TestProc.new(\n :context => @_testcase,\n :setup => @_setup,\n :skip => @_skip,\n :label => label,\n :tags => tags,\n &block\n )\n\n @_testcase.tests << test\n\n test\n end", "def run_test(test_name, format: nil, only: nil, wait: nil, **opt, &block)\n error = nil\n prime_tests\n if format && !html?(format)\n opt[:part] = [\"[#{format.to_s.upcase}]\", opt[:part]].compact.join(' - ')\n end\n show_test_start(test_name, **opt)\n if allowed_format(format, only: only)\n if wait\n using_wait_time(wait, &block)\n else\n block.call\n end\n end\n rescue Exception => error\n show \"[#{error.class}: #{error}]\"\n ensure\n show_test_end(test_name, **opt)\n # noinspection RubyMismatchedArgumentType\n raise error if error\n end", "def spec_tests(&block)\n require 'onceover/testconfig'\n\n # Load up all of the tests and deduplicate them\n testconfig = Onceover::TestConfig.new(@onceover_yaml, @opts)\n testconfig.spec_tests.each { |tst| testconfig.verify_spec_test(self, tst) }\n tests = testconfig.run_filters(Onceover::Test.deduplicate(testconfig.spec_tests))\n\n # Loop over each test, executing the user's block on each\n tests.each do |tst|\n block.call(tst.classes[0].name, tst.nodes[0].name, tst.nodes[0].fact_set, tst.nodes[0].trusted_set, tst.nodes[0].trusted_external_set, testconfig.pre_condition)\n end\n end", "def run\n testable = Parser.new(@argv).parse\n Executor.new(testable).execute\n end", "def my_tests\n end", "def run_tests(state, target)\n if (target.nil?)\n # This only works if you have busser installed and the appropriate\n # plugins, otherwise this won't do anything. For the record, I\n # still haven't gotten busser working locally\n path = \"#{config[:test_base_path]}/#{instance.suite.name}\"\n Dir.chdir(path) do\n system(\"busser test\")\n end\n else\n # We do have a node (i.e., a target) so we run on that host, so let's go\n # get our machine/transport to our machine\n machines = state[:machines]\n raise ClientError, \"No machine with name #{target} exists, cannot run test \" +\n \"suite as specified by .kitchen.yml\" if !machines.include?(target)\n node = get_node(state, target)\n provisioner = ChefMetal.provisioner_for_node(node)\n machine = provisioner.connect_to_machine(node)\n transport = machine.transport\n\n # Get the instance busser/setup and run our tests on our machine\n busser = instance.busser\n old_path = busser[:test_base_path]\n busser[:test_base_path] = \"#{busser[:test_base_path]}/#{target}\"\n execute(transport, busser.sync_cmd)\n execute(transport, busser.run_cmd)\n # We have to reset this after we modify it for the node; otherwise this is\n # a persistent change\n busser[:test_base_path] = old_path\n end\n end", "def run_tests(spec, rake_path)\n pwd = FileUtils.pwd\n\n FileUtils.chdir(spec.full_gem_path)\n\n output = \"\"\n exit_status = nil\n\n if spec.files.include?(\".gemtest\")\n Open3.popen3(rake_path, \"test\", '--trace') do |stdin, stdout, stderr, thr|\n loop do\n if stdout.eof? and stderr.eof?\n break\n end\n\n buf = \"\"\n\n handles, _, _ = IO.select([stdout, stderr].reject { |x| x.closed? || x.eof? }, nil, nil, 0.1)\n\n begin\n handles.each { |io| io.readpartial(16384, buf) } if handles\n rescue EOFError, IOError\n next\n end\n\n output += buf\n\n print buf\n end\n\n exit_status = thr.value\n end\n\n if config[\"upload_results\"] or\n (!config.has_key?(\"upload_results\") and ask_yes_no \"Upload these results to rubygems.org?\")\n\n upload_results(gather_results(spec, output, exit_status.exitstatus == 0))\n end\n\n if exit_status.exitstatus != 0\n alert_error \"Tests did not pass. Examine the output and report it to the author!\"\n\n FileUtils.chdir(pwd)\n\n raise Gem::TestError\n end\n else\n puts\n puts \"This gem has no tests! Please contact the author to gain testing and reporting!\"\n puts\n end\n\n FileUtils.chdir(pwd)\n end", "def _test_text ; process_test_case(\"text\") ; end", "def test_run\n prospector = Rubyist.new(1)\n turns = 1\n random_generator = Minitest::Mock.new('rndm')\n def random_generator.rand(*_num)\n 0\n end\n simulator = Sim.new(prospector, turns, random_generator)\n assert_equal simulator.run, 'Going home empty-handed.'\n end", "def test\n data = Fyb.private.test.perform.parse\n data['msg'] == 'success'\n end", "def testloop\n \n end", "def define\n lib_path = @libs.join(File::PATH_SEPARATOR)\n desc \"Run specs\" + (@name==:spec ? \"\" : \" for #{@name}\")\n task @name do\n specs = file_list\n raise \"No spec files found.\" if specs.empty?\n \n spec = File.expand_path(File.dirname(__FILE__) + '/../../../bin/spec')\n file_prefix = @rcov ? \" -- \" : \"\"\n interpreter = @rcov ? \"rcov\" : \"ruby\"\n redirect = @out.nil? ? \"\" : \" > #{@out}\"\n\n @ruby_opts.unshift( \"-I#{lib_path}\" )\n @ruby_opts.unshift( \"-w\" ) if @warning\n @ruby_opts.unshift( '--exclude \"lib\\/spec\\/.*\"' ) if @rcov\n begin\n run interpreter, @ruby_opts.join(\" \") +\n \" \\\"#{spec}\\\" \" +\n \" #{@spec_opts.join(' ')} \" +\n file_prefix +\n specs.collect { |fn| \"\\\"#{fn}\\\"\" }.join(' ') +\n redirect\n rescue => e\n raise e if @fail_on_error\n end\n end\n self\n end", "def test_suite_verify(test_suite_name)\n return if @test_flag\n\n @test_flag = true\n # Split the path name\n test_name = test_suite_name.split('/')\n # Remove the extension\n base_name = test_name[test_name.size - 1].split('.')\n @test_suite = 'test.' + base_name[0]\n printf \"New Test: %s\\n\", @test_suite\n end", "def run_tests(test_set, run_subcontexts, reporter)\n @ran_tests = []\n reporter.context_started(self) if reporter\n on_start_blocks.each { |b| instance_eval(&b) }\n test_set.each { |t| instance = t.new; instance.run(reporter); ran_tests << instance }\n subcontexts.each { |s| s.run(reporter) } if run_subcontexts\n on_finish_blocks.each { |b| instance_eval(&b) }\n reporter.context_finished(self) if reporter\n passed?\n end", "def start_test(test)\n puts \"\\e[36mRunning test:\\e[0m \\e[37m#{test.name} Line: #{test.lineNumber}\\e[0m\"\n end", "def run\n runner = self\n @test_cases.each do |path|\n next if ENV['TEST_CASE'] && !File.basename(path).match(ENV['TEST_CASE'])\n\n Aws::ModelValidators.load_json(path).tap do |test_case|\n\n models = test_case.inject({}) { |h,(k,v)| h[k.to_sym] = v; h }\n errors = models.delete(:errors)\n\n @group.it(File.basename(path[0..-6])) do\n pending unless errors\n results = described_class.new.validate(models, apply_schema: false)\n unless runner.results_match?(results, errors)\n expect(results).to eq(errors)\n end\n end\n\n end\n end\n end", "def run\n each_test do |liquid, layout, assigns, page_template, template_name|\n compile_and_render(liquid, layout, assigns, page_template, template_name)\n end\n end", "def run(reporter)\n @reporter = reporter\n\n reporter.start(:suite, @suite)\n suite.concerns.each do |concern|\n run_concern(concern)\n end\n reporter.finish(:suite, @suite)\n end", "def run_test\n rdfa_string = input\n \n # Run\n @rdfa_parser = RdfaParser::RdfaParser.new\n yield(rdfa_string, rdfa_parser)\n\n query_string = results\n\n triples = self.triples rescue nil\n \n if (query_string.match(/UNION|OPTIONAL/) || title.match(/XML/)) && triples\n # Check triples, as Rasql doesn't implement UNION\n parser = NTriplesParser.new(triples, tcpath)\n @rdfa_parser.graph.should be_equivalent_graph(parser.graph, self)\n else\n # Run SPARQL query\n @rdfa_parser.graph.should pass_query(query_string, self)\n end\n\n @rdfa_parser.graph.to_rdfxml.should be_valid_xml\n end" ]
[ "0.6916185", "0.67599094", "0.6694415", "0.65807116", "0.65560234", "0.6497686", "0.64784235", "0.64758766", "0.64707375", "0.6436684", "0.6436684", "0.6429899", "0.64073473", "0.6405856", "0.6394599", "0.63932884", "0.63476515", "0.6307504", "0.62740535", "0.62712705", "0.62699157", "0.62525976", "0.62463313", "0.62343013", "0.62274987", "0.6224585", "0.6208731", "0.6206955", "0.61992586", "0.61556035", "0.6126591", "0.61252177", "0.6106941", "0.6096779", "0.60828674", "0.6082097", "0.606398", "0.6059457", "0.60409534", "0.6023085", "0.60137814", "0.60112274", "0.5982389", "0.5956629", "0.59419876", "0.5933829", "0.5933829", "0.5933031", "0.59189034", "0.59095514", "0.58914435", "0.5886553", "0.58785623", "0.5873318", "0.5864025", "0.5858633", "0.5847142", "0.58448195", "0.58399814", "0.58177674", "0.5812283", "0.58107287", "0.5798689", "0.5787845", "0.5787845", "0.5787845", "0.57732236", "0.5772068", "0.5755653", "0.57500917", "0.57498604", "0.5740259", "0.57383347", "0.5731415", "0.5728681", "0.5722466", "0.5721916", "0.57201177", "0.57062", "0.56995535", "0.5696317", "0.5692765", "0.56867784", "0.56843674", "0.5683644", "0.56755954", "0.56747556", "0.5668088", "0.56496763", "0.5644813", "0.5642215", "0.5625898", "0.56202", "0.5620199", "0.56198573", "0.5619602", "0.5619484", "0.5617091", "0.5612239", "0.5610922", "0.5610809" ]
0.0
-1
Writes a marker file indicating the tests have completed running.
def write_success_marker(config) success_file = File.join config[:output_dir], 'success.yml' File.open(success_file, 'w') { |f| YAML.dump config, f } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def communicate_complete\n File.open(\"#{@options[:output_directory]}/finished.job\", 'w') do |f|\n f << \"Finished Workflow #{::Time.now}\"\n # make sure data is written to the disk one way or the other\n begin\n f.fsync\n rescue StandardError\n f.flush\n end\n end\n end", "def communicate_complete\r\n File.open(\"#{@options[:output_directory]}/finished.job\", 'w') { |f| f << \"Finished Workflow #{::Time.now}\" }\r\n end", "def finish\n\t\t\twrite_log_to_file(@logfile)\n\t\t\twrite_xmlfile(@xmlfile)\n\t\t\tif @errcount > 0 or @warncount > 0 then\n\t\t\t\twrite_log_to_stdout\n\t\t\tend\n\t\t\tputs \"Test run finished (#{@errcount} errors, #{@warncount} warnings).\"\n\t\tend", "def write_to_file(filename) # Take name and status of file, output and save it to a new file\n completed = @all_tasks.map(&:to_machine).join(\"\\n\")\n IO.write(filename, completed)\n end", "def test_run_completed(test_run)\n report_results test_run\n end", "def done\n puts 'Done running tests'\n end", "def file_finished(file_result)\n if file_result.error_count > 0 \n out.print 'x'\n elsif file_result.warning_count > 0\n out.print '*'\n else\n out.print '.'\n end\n end", "def mark_as_done # a writer, i overwrote the one by default\n @done = true\n end", "def task_out\n if running_task?\n puts \"Stop task: \" + get_last_task_name + \", #{(Time.now.to_i - get_last_task_stime.to_i).duration}\"\n open(TRACK_FILE, \"a\"){|f|\n f.print \"\\t#{Time.now.to_i}\\n\"\n }\n return true\n else\n puts \"There is no task running\"\n return false\n end\n end", "def tests_generated(directory)\n puts green(\"Test reports saved to: #{directory}\")\n end", "def communicate_complete\n File.open(\"#{@options[:output_directory]}/finished.job\", 'w') { |f| f << \"Finished Workflow #{::Time.now} #{@options}\" }\n raise 'Missing required options' unless @options[:url] && @options[:datapoint_id] && @options[:project_id]\n send_status('Complete')\n send_file(\"#{@options[:output_directory]}/run.log\")\n Dir.glob(\"#{@options[:output_directory]}/../reports/*\").each do |f|\n next if File.basename(f) == 'view_model_report.json'\n\n send_file(f)\n end\n end", "def create_mark_output_file(mark_output_file_path)\n # Write test output contents to file.\n File.open(mark_output_file_path, \"w+\") do |file|\n # file.write(collect_mark_file_content)\n\n file.puts(collect_mark_file_content)\n end\n end", "def report_complete\n report \"\\nFinished in %.3f seconds.\" % [Time.now - @time]\n end", "def wrote_fasta_files(current)\n if current % increment == 0\n info.attributes = {\n percent_complete: percent(current)/2,\n message: \"Wrote fasta files for #{current}/#{species_count} species\"\n }\n info.save(path)\n end\n end", "def write_failure_file_if_necessary_at_end\n with_optional_failures_filename do |filename|\n if @script_results.failed?\n File.open(filename.to_s, \"w\") do |file|\n @script_results.each do |reason|\n file << reason << \"\\n\"\n end\n end\n else\n File.delete(filename.to_s) if FileTest.exist?(filename.to_s)\n end\n end\n end", "def create_test_output_file(test_output_file_path)\n mark_file_content = collect_mark_file_content\n\n test_file_content = mark_file_content.map do | element |\n if element.kind_of?(Array)\n element.map! { |array_content| array_content.to_s.gsub(/::.*\\z/,'::') }\n else\n element\n end\n end\n\n # Write test output contents to file.\n File.open(test_output_file_path, \"w+\") do |file|\n file.puts(test_file_content)\n end\n end", "def wrote_occurrence_file(current)\n if current % increment == 0\n info.attributes = {\n percent_complete: 50 + percent(current)/2,\n message: \"Wrote occurrence file for #{current}/#{species_count} species\"\n }\n info.save(path)\n end\n end", "def test_print_to_file\n File.delete('output-file.txt') if File.exists?('output-file.txt')\n assert_equal(File.exists?('output-file.txt'), false)\n @standings.print_to_file\n assert_equal(File.exists?('output-file.txt'), true)\n end", "def finished(inspected_files); end", "def write_spec_to_file!\n formatted_output = format_output(output, extension)\n abs_path = File.join(write_path, suggested_filename)\n\n assert_directory_exists!(abs_path)\n write_method.call(abs_path, formatted_output)\n end", "def work_received(results)\n # write results to disk\n @@output_file.puts results\n end", "def job_done job, results\n puts \"#{name}: Done #{job.id}\"\n jc = Job::COMPLETE_TEMPLATE.dup\n jc['id'] = job.id\n jc['result'] = results\n ts.write jc\n end", "def grabber_done(playlist_id)\n @outfile.close\n @bar_progress.percent = 100\n @button_start.state = 'normal'\n \n filename = \"#{playlist_id}#{OUTFILE_EXT}\"\n show_msg('Done', \"Finished OK. Output to #{filename}\")\nend", "def wait_for_runner_to_begin\n assert_file_exists @runner_began_flag\n end", "def write_summary(duration, total, failures, pending)\n _write do |f|\n f.puts _message(total, failures, pending, duration)\n f.puts _failed_paths.join(\"\\n\") if failures > 0\n end\n end", "def write_data\n \n puts \"Writing out new HR data\"\n processed_record =\".\"\n output_file = File.open(OUTPUT_FILE, 'w')\n \n @completed_users.each do |user| \n output_file.puts user.to_s \n STDERR.print processed_record\n end #basic puts but driven to open file\n \n output_file.close #closes\n puts \"\\nCompleted writing out new HR data \\n#{@completed_users.length} records processed\"\n\nend", "def save_to_file\n File.open(\"results/#{seq_name}\"+\".txt\", 'w') { |file|\n \n n=1\n \n @actions.each do |a|\n file.puts a.description\n n +=1 \n end\n } \n \n end", "def run_completed\n end", "def mark_as_done!\n @status = :finished\n end", "def save_file\n\tcounter = 1;\n\ttime = Time.now.strftime(\"%d/%m/%Y\")\n\treport_file_puts \"\"\n\treport_file_puts \"Title of saved TodoList: #{@title}\"\n\treport_file_puts \"Save time: #{time}\"\n\treport_file_puts \"----------------------------\"\n\t\t@items.each do |item|\n\n\t\treport_file_puts \"#{counter.to_s} #{item.description} Completion status: #{item.completed_status.to_s}\"\n\t\tcounter +=1;\t\n\tend\t\nend", "def finish\n @Done = true \n end", "def file_finished(file, offenses); end", "def done!(status = 0)\n @completed_at = Time.now\n @exitstatus = status\n save\n end", "def success(delayed_job)\n # Delete the file which has been parsed?\n STDOUT.putc '.'\n STDOUT.flush\n end", "def communicate_started\n File.open(\"#{@options[:output_directory]}/started.job\", 'w') do |f|\n f << \"Started Workflow #{::Time.now}\"\n # make sure data is written to the disk one way or the other\n begin\n f.fsync\n rescue StandardError\n f.flush\n end\n end\n end", "def mark_done\n @done = true\n end", "def summary_at_exit\n reporter = Speciny::Reporter.new(@description)\n @tests.each do |example, result|\n reporter.print_test_result(example, result)\n end\n end", "def communicate_started\r\n File.open(\"#{@options[:output_directory]}/started.job\", 'w') { |f| f << \"Started Workflow #{::Time.now}\" }\r\n end", "def done\n puts \"Done\"\n end", "def update_done(id)\n open('tweets.done', 'a') { |f|\n f.puts(id)\n }\n end", "def save\n File.open(@test_name, \"w+\") do |file|\n file.write(render)\n end\n end", "def log_complete\n @notifier.log \"#{identifier}: Done\", level: :collect\n end", "def communicate_failure\n File.open(\"#{@options[:output_directory]}/failed.job\", 'w') do |f|\n f << \"Failed Workflow #{::Time.now}\"\n # make sure data is written to the disk one way or the other\n begin\n f.fsync\n rescue StandardError\n f.flush\n end\n end\n end", "def mark_as_done!\n @done = true\n end", "def test_completed(test)\n case test.status\n when 'passed'\n puts \"\\e[34mTest:\\e[0m \\e[37m#{test.name} Line: #{test.lineNumber}\\e[0m Status: \\e[92mPassed\\e[0m\"\n when 'failed'\n puts \"\\e[34mTest:\\e[0m \\e[37m#{test.name} Line: #{test.lineNumber}\\e[0m Status: \\e[31mFailed\\e[0m\"\n when 'undefined'\n puts \"\\e[34mTest:\\e[0m \\e[37m#{test.name} Line: #{test.lineNumber}\\e[0m Status: \\e[93mUndefined\\e[0m\"\n when 'pending'\n puts \"\\e[34mTest:\\e[0m \\e[37m#{test.name} Line: #{test.lineNumber}\\e[0m Status: \\e[96mPending\\e[0m\"\n end\n end", "def report_end_test(test_status)\n @run_status.add_test_status(test_status)\n\n @listeners.each do |l|\n l.end_test(test_status)\n end\n end", "def after_run\n check_output_files\n show_results\n end", "def finish\n @finish = true\n end", "def finish\n @test_output = @test_output.join.split(\"\\n\")\n @test_description = @test_output.shift\n end", "def after_break\n #open(file_name, \"r\") do |f| \n open(\"./tmp/database_doings/doing_uniques/uniques_done.txt\", \"r\") do |f| \n g = f.read\n f.close\n exit(puts \"Processing is complete >> ./tmp/database_doings/doing_uniques/uniques_done.txt << is closed, console has been exited\")\n end\n end", "def write_report!\n notify.critical_error(\"Must run `test!` before writing a report\") if test.status.nil?\n in_test_dir do\n self.writer = GitTest::Writer.new(:path => report_path,\n :name => report_name,\n :report => test.report )\n in_report_branch do\n writer.save!\n commit_to_test_proj!\n end\n end\n end", "def done\r\n @done = true\r\n end", "def finish!\n # Create our sentinel file\n FileUtils.touch('/etc/.sorted')\n end", "def generateTestFile( filename )\n File.new(filename, \"w\")\n file = File.open(filename, \"w\")\n 100.times do # For expediency's sake I'll use a set of 100\n file.puts rand().to_s\n end\n file.close\nend", "def dump_progress(done, dumpfile)\n dump = Marshal.dump(done)\n open(dumpfile, 'wb') do |file|\n gzip = Zlib::GzipWriter.new(file)\n gzip.write(dump)\n gzip.close\n end\nend", "def complete\n @status = :ok\n do_stop\n log_complete\n end", "def create_goal_file\n File.open(\"Goal/goal#{file_counter}.txt\", 'w') { |file| file.write(\"#{final_name_info}\") }\nend", "def write_failure_file_if_necessary_at_beginning\n with_optional_failures_filename do |filename|\n File.open(filename.to_s, \"w\") do |file|\n file << \"Build CRASHED; this error is written out when the build starts, and replaced when it fails or succeeds normally. This is a hard-core problem like a JVM crash of the buildsystem, or something similar, instead.\\n\"\n end\n end\n end", "def mark_as_done\n @is_done = true\n end", "def output_to_report_file message\n @spec_report_file.puts message\n end", "def completed()\n end", "def write_fudgefile\n if exists?\n \"Fudgefile already exists.\"\n else\n writer { |file| file << build_templated }\n \"Fudgefile created.\"\n end\n end", "def persist_test_results(filepath)\n return if filepath.empty?\n\n results = @test_cases.select { |c| %i[fail error].include? c.test_status }.map(&:path)\n File.open(filepath, 'w') { |file| file.puts JSON.dump(results) }\n end", "def write_to_file(filename)\n IO.write(filename, @all_tasks.map(&:display).join(\"\\n\"))\n\tend", "def communicate_failure\r\n File.open(\"#{@options[:output_directory]}/failed.job\", 'w') { |f| f << \"Failed Workflow #{::Time.now}\" }\r\n end", "def clear_completed!\n update\n [@@logs[:todo], @@logs[:metrics]].each do |file|\n\tputs \"FILE: #{file.inspect}\"\n FileUtils.rm(file)\n FileUtils.touch(file)\n end\n @@todo.each do |line|\n add_todo(line)\n end\n end", "def write!\n # 1. skip if file already exists.\n if output_file_already_exists?\n RSpec::Scaffold.log(\"- #{@output_file} - already exists\", :puts)\n return\n end\n\n # 2. ensure parent directories exist\n FileUtils.makedirs(@output_file.parent)\n\n # 3. write to file\n File.open(@output_file, 'wb') do |f| # 'wb' originally\n f << @output_text\n end\n\n RSpec::Scaffold.log(\"+ #{@output_file}\")\n\n return @output_file.to_s\n end", "def finish!\n @io.write \"\\0\"\n if (@path)\n @io.fsync\n @io.close\n end \n end", "def report\n\t\t\tputs \"Tests: #{@ok} ok, #{@fail} failures.\"\n\t\t\tif (@fail > 0)\n\t\t\t\tputs \"*** THERE WERE FAILURES *** \"\n\t\t\telse \n\t\t\t\tputs \"*** ALL TESTS PASSED ***\"\n\t\t\tend\n\t\tend", "def finished\n @finished = true\n end", "def on_test_run_finished(_event)\n lifecycle.write_environment\n end", "def completed()\n @completed=true\n @tCompleted=Time.now\n end", "def finished_file(_file, _lints); end", "def done\n @done = true\n end", "def output_results\n puts(output_copy)\n exit_code = 0\n exit_code = 1 if @changed_files.any? && @flags.include?(:error_on_annotation)\n exit_code\n end", "def done!\n @done = true\n end", "def print_stat\n puts \"\\n\"\n puts \"********************\"\n puts \"Statistics:\"\n\n puts \"\\n\"\n puts \"Failed: #{$fail_uploaded_count}\"\n $not_uploaded_features_list.each do |feature|\n puts feature\n end\n\n puts \"\\n\"\n puts \"Success: #{$success_uploaded_count}\"\n $uploaded_features_list.each do |feature|\n puts feature\n end\n puts \"********************\"\n\n File.write('result.log', \"#{$updated_count},#{$created_count},#{$deleted_count}\")\nend", "def flush out_file, title=@title\n dump out_file, title\n ensure\n clear\n end", "def file_end(file, output)\n end", "def write_to_file(filename = \"listsave\")\n\t\tIO.write(filename, @tasks.map(&:to_s).join(\"\\n\"))\n\t\tputs \"List has been successfully saved to #{filename}...\"\n\tend", "def wrapup # :nodoc:\n log \"Finishing\"\n end", "def completed\n end", "def job_passed(id)\n `touch #{passed_file(id)}`\n end", "def write_pos_file()\r\n last_update = File.exist?(@pos.pos_file) ? File.mtime(@pos.pos_file) : Time.at(0)\r\n for state in @watched_files.values\r\n if last_update < state.last_emit\r\n @pos.write_to_file()\r\n break\r\n end\r\n end\r\n end", "def done\n @status = true\n end", "def write_file\n \n # if dirty?\n generate\n \n delete_file\n File.open(absolute_path.gsub(/\\.txt$/, \"\"), 'w+') do |f| \n f.write(generated_header)\n f.write(generated_content)\n end\n # not_dirty\n # end\n end", "def testing_end\n end", "def test!\n in_test_dir do\n notify.start(\"Running tests on: #{proj_branch}\")\n test.run!\n notify.done(\"Test finished: #{test.status}\", test.passed?)\n end\n end", "def addToLog flag\n result = flag ? 'Succeeded' : 'Failed'\n File.open(\"/Users/John/DropBox/datasets_processed.log\", 'a') do |f| \n dt = DateTime.now.strftime(\"%Y-%b-%d %H:%M:%S\")\n result = flag ? 'Succeeded' : 'Failed'\n line = [dt, filename.to_unspec, @qc, @rows, result].join(', ')\n f.write(\"#{line}\\n\") \n end\n end", "def setDone\n @done = Time.now\n end", "def work_received(results)\n\n # write results to disk\n results.each do |name,fasta,qual,comments|\n @@results.write_seq(name,fasta,qual,comments)\n end\n \n end", "def finish\n true\n end", "def export_job\n return nil if completed?\n export_sie = Services::ExportSie.new(self)\n if export_sie.create_file(sie_type)\n logger.info \"** sie_export #{id} create_file returned ok, marking complete\"\n complete\n else\n logger.info \"** sie_export #{id} create_file did NOT return ok, not marking complete\"\n end\n end", "def write_footer(file)\n Record.new(GRT_ENDSTR).write(file)\n end", "def done\n @out.puts @terminal_message\n end", "def test_reuse_single_file\n CheckFile @writer, @ioservice, @adlers, 'test tests test ', ['test ', 'tests', ' ', 'test ']\n end", "def complete!\n @completed = true\n @completed_at = Time.now\n end", "def end_of_section\n\t$report_file.puts(\"-------END OF SECTION-------\")\n\t$report_file.puts\nend", "def complete()\n if @status.status == 'running'\n @logger.info \"Workflow #{self.class.name} has completed successfully\"\n @status.finished\n end\n end", "def finish!\n Todoable.client.put(\"#{path}/finish\")\n true\n end" ]
[ "0.66625804", "0.6646036", "0.6387121", "0.61718774", "0.61125904", "0.60954624", "0.60485566", "0.603671", "0.5992934", "0.58318347", "0.5818525", "0.5753661", "0.57525164", "0.57284284", "0.57284075", "0.57007027", "0.5695459", "0.56833816", "0.5673226", "0.56328", "0.5612683", "0.5604607", "0.5601676", "0.55946255", "0.5569694", "0.55325556", "0.5521611", "0.55004287", "0.54971534", "0.54942423", "0.5488018", "0.54864514", "0.54449373", "0.5437001", "0.54295385", "0.53980607", "0.5395932", "0.53736115", "0.53550094", "0.53351533", "0.5329875", "0.5302672", "0.5300914", "0.529432", "0.5287406", "0.52770436", "0.52765864", "0.5270952", "0.52637446", "0.525851", "0.5251673", "0.52508223", "0.52471095", "0.5246502", "0.5236767", "0.52313805", "0.5230489", "0.5214794", "0.5212064", "0.5202114", "0.52011055", "0.51961887", "0.5195417", "0.5178156", "0.51779723", "0.5174833", "0.51638186", "0.51567006", "0.51318514", "0.5131453", "0.5118423", "0.511339", "0.5106087", "0.5099285", "0.5097153", "0.5084917", "0.5084813", "0.50814366", "0.5080934", "0.5080131", "0.5075523", "0.50739217", "0.50684935", "0.5063165", "0.50588167", "0.5054316", "0.5050444", "0.5047015", "0.5046241", "0.5042789", "0.50365126", "0.50349975", "0.5028372", "0.50282437", "0.50139236", "0.500657", "0.4999662", "0.4991749", "0.4990382", "0.49841577" ]
0.55451655
25
Store the related database object, in order to be able to correctly handle the database timezone.
def initialize(db) @db = db end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(object)\n db_id = derive_db_id(object.class.name, object.id)\n db.transaction do\n db[db_id] = object\n end\n end", "def _sync\n # Reset the stash map to ensure that it's reset before the next\n # transaction is being started.\n @_stash_map = nil\n\n db_obj = {\n 'class_id' => @store.class_map.class_to_id(self.class.to_s),\n 'data' => _serialize\n }\n @store.db.put_object(db_obj, @_id)\n end", "def save\n self.class.persistable\n DB[self.class.name] ||= {}\n DB[self.class.name][name] = self\n Maglev.commit_transaction\n end", "def save\n DB.transaction do\n DB[self.class.name] ||= {}\n DB[self.class.name][name] = self\n end\n end", "def persist; end", "def persist; end", "def persist; end", "def store(object)\n datastore.store(create_object(object))\n end", "def persist_to_database object, database\n object.with(session: database).save!\n $logger.debug \"..persisted to MongoDB: database: #{database.inspect}\\n....#{object.inspect}\\n\"\n end", "def __save_on_database(db, t)\n t.rubyrel_catalog.base_relvar_attributes << __to_catalog_tuple\n end", "def create_in_database(instance)\n return unless @mapping.strategy.build?(instance)\n\n created = @mapping.database_record_type.create!(instance)\n\n @runner.cache_timestamp instance\n @runner.cache_timestamp created\n rescue ActiveRecord::ActiveRecordError, Faraday::Error::ClientError => e\n DB.logger.error(SynchronizationError.new(e, instance))\n end", "def single_object_db=(v); end", "def persist\n \n end", "def save\n ## before_save hook ##\n before_save()\n\n if self._id.nil?\n self._id=BSON::ObjectId.new\n end\n self.class.db_collection.insert_one(to_hash)\n\n ## after_save hook ##\n after_save()\n self\n end", "def store_event_in_db(event_hash)\n newEvent = Event.new(name: event_hash[\"name\"], date: event_hash[\"dates\"][\"start\"][\"localDate\"], city: event_hash[\"_embedded\"][\"venues\"][0][\"city\"][\"name\"], state: event_hash[\"_embedded\"][\"venues\"][0][\"state\"][\"name\"], venue_name: event_hash[\"_embedded\"][\"venues\"][0][\"name\"])\n newEvent.save \n newEvent\nend", "def store\n Model.model_store.store(self)\n end", "def save\n self.id = klass.generate_identifier unless persisted? || id\n save_graph = RDF::Graph.new\n fill_save_graph save_graph\n Db.insert_data( save_graph , :graph => klass.object_graph )\n persist!\n end", "def __save_on_database(db)\n db.transaction{|t| \n all_objects_in_order.each {|obj|\n obj.__save_on_database(db, t)\n }\n }\n end", "def store\n self.class.store\n end", "def save\n self.class.mapper.put(self)\n end", "def save\n @@data_store.insert(self)\n self\n end", "def single_object_db; end", "def record_to_persist\n record\n end", "def save_object\n end", "def save\n self.class.save(self)\n end", "def save\n Ribs.with_handle(self.database) do |h|\n if self.class.persistent?(self.model)\n h.update_obj(self.model)\n else\n h.insert_obj(self.model)\n self.class.persistent(self.model)\n end\n end\n self.model\n end", "def add(obj)\n Maglev::PERSISTENT_ROOT[self][obj.__id__] = obj\n end", "def persisted?; end", "def persisted?; end", "def save\n super save\n end", "def save(object)\n tracker.queue(state(object).save(relation))\n self\n end", "def timezone\n @timezone || Sequel.database_timezone\n end", "def create_in_database(instance)\n return unless @strategy.build?(instance)\n @mapping.database_record_type.create!(instance)\n end", "def save\n CONNECTION.execute(\"UPDATE #{table_name} SET #{ready_for_sql(make_hash)} WHERE id = #{self.id}\")\n return self\n end", "def save(*)\n result = super(dump(:ttl))\n get({}, true)\n result\n end", "def save(**options)\n options[:ttl] = self.created_at + self.expires_in + 30\n super(**options)\n end", "def store_object(object)\n\n volatile_data = object.dehydrate()\n\n open_store(\"goids\", false) do |gd|\n gd[object.goid] = object.class.to_s\n end\n\n open_store(object.class, false) do |gd|\n gd[object.goid] = Marshal.dump(object)\n end\n\n if object.respond_to? :equipment\n object.equipment.each do |o|\n store_object(o) unless o.is_a? Player #this shouldn't happen, but who knows\n end\n end\n\n @saved += 1\n\n object.rehydrate(volatile_data)\n\n log \"Stored #{object} # #{object.game_object_id}\", Logger::Ultimate\n end", "def save\n # Update the updated_at timestamp.\n # If we had servers in multiple time zones, we'd want\n # to use utc in the next line. This might be important\n # if we go cloud in multiple availability zones, this\n # way time is consistent across zones.\n # self.updated_at = Time.now.utc\n self.updated_at = Time.now\n\n # Flag that will determine if this is the first time we save.\n first_save = false\n # if this is our first time saving this transaction\n if(@state == :new)\n @state = :started\n first_save = true\n # if new, grab a numeric id and assign it to this object\n if(@numeric_id == nil)\n @numeric_id = Store.db.incr(\"#{Transaction.db_global_prefix}:numeric_id_count\")\n end\n end\n\n # Now lets convert the transaction object to a json. Note:\n # We have to retrieve this here, incase we ever need values here\n # from the Store. If we do it inside the multi or pipelined\n # we won't have those values availble when building the json\n # and all we'll have is a Redis::Future object. By doing\n # the following to_json call here, we would've retrieved the data\n # needed before the save, properly.\n json = self.to_json\n # do a pipeline command, executing all commands in an atomic fashion.\n # inform the pipelined save if this is the first time we're saving the\n # transaction, so that proper jobs may be enqueued.\n pipelined_save(json, first_save)\n # puts caller\n if Config.display_hints\n debug \"#{\"Hint\".green}: View the transaction data in Redis using: GET #{db_id}\\n\"+\n \"#{\"Hint\".green}: View the last #{LAST_TRANSACTIONS_TO_KEEP_IN_CACHE} transactions using: \"+\n \"LRANGE #{db_list} 0 -1\\n\"+\n \"#{\"Hint\".green}: View the items in pending queue using: LRANGE #{queue_pending} 0 -1\\n\"+\n \"#{\"Hint\".green}: View the last item in the pending queue using: LINDEX #{queue_pending} 0\"\n end\n return true\n end", "def save\n self.saved_at = Time.now\n end", "def create_timezone\n DataTimezone.new(self)\n end", "def store; end", "def store; end", "def store; end", "def store_new(object)\n raise IdentityConflict if contains?(object)\n store(object)\n end", "def add_to_database destination\n\t\tdestination_airport_object = Airport.make_destination destination\n\t\tparse_flights.each do |hash|\n\t\t\tnext if hash[\"Actual Arrival Time\"] == \"00:00\"\n\t\t\tdate = hash[\"Date (MM/DD/YYYY)\"]\n\t\t\tnew_date = format_date date\n\t\t\tairline = hash[\"Carrier Code\"]\n\t\t\tnumber = hash[\"Flight Number\"]\n\t\t\tairport = hash[\"Origin Airport \"]\n\t\t\tairline_object = Airline.find_by_name(airline)\n\t\t\tif airline_object.nil?\n\t\t\t\tairline_object = Airline.create(:name => hash[\"Carrier Code\"])\n\t\t\tend\n\t\t\tflight_object = Flight.find_by_number(number)\n\t\t\tif flight_object.nil?\n\t\t\t\tflight_object = Flight.create(\n\t\t\t\t\t:number => hash[\"Flight Number\"],\n\t\t\t\t\t:airline_id => airline_object.id\t\n\t\t\t\t\t)\n\t\t\tend\n\t\t\torigin_airport_object = Airport.find_by_name(airport)\n\t\t\tif origin_airport_object.nil? #if the current airport in the hash isn't already in the database, make it\n\t\t\t\torigin_airport_object = Airport.create(:name => hash[\"Origin Airport \"])\n\t\t\tend\n\t\t\tarrival_object = Arrival.create(\n\t\t\t\t:date => new_date,\n\t\t\t\t:scheduled_time => hash[\"Scheduled Arrival Time\"],\n\t \t\t:actual_time => hash[\"Actual Arrival Time\"],\n\t \t\t:flight_id => flight_object.id,\n\t \t\t:origin_airport_id => origin_airport_object.id,\n\t \t\t:destination_airport_id => destination_airport_object.id\n\t \t\t)\n\t\tend\n\tend", "def store?; end", "def create\n self[:created] = Time.now.to_s\n save\n end", "def save\n object.save\n end", "def to_database\n {\n type: self.class.name,\n params: params,\n # account: Current.account,\n }\n\n end", "def _save\n properties\n end", "def save\n connection.save_table(self)\n end", "def to(wallable)\n self.wallable = wallable\n save\n self\n end", "def set_DB()\n self.is_db = 1\n save()\n end", "def persist(data)\n\t\tupdate_design_for self.shared_data_context\n\t\t\n\t\td = CouchRest::Document.new\n\t\td.database = proxy_database\n\n\t\t#copy data in to document\n\t\tdata.each do |key,value|\n\t\t\td[\"#{key}\"] = value\n\t\t\tputs \"added: #{key}\"\n\t\tend\n\t\td[:type] = self.shared_data_context.name\n\t\td[:date] = DateTime.now\n\n\t\tbegin\n\t\t\td.save false\n\t\trescue => e\n\t\t\tputs \"NOT SAVED: #{e.response}\"\n\t\t\t#TODO: properly handle this stuff\n\t\tend#\n\tend", "def save\n\t\t\tsuper\n\t\t\t@@env = self\n\t\tend", "def save(table = nil)\n # Converts object to hash\n hash = {}\n instance_variables.map { |q| hash[q.to_s.gsub('@', '')] = instance_variable_get(q) }\n\n dataset = select_dataset(table)\n hash['body'] = hash['body'].to_s if hash['body']\n\n if instance_variables.include?(:@id) && id.is_a?(Integer)\n # Object has a id and thereby is only updated\n dataset.where(id: id).update(hash)\n else\n # Object is inserted into database\n DB.transaction do\n hash.delete('id')\n dataset.insert(hash)\n # Retrives the new id\n if self.class.columns.include?(:id)\n id = dataset.limit(1).order(:id).reverse\n instance_variable_set(:@id, id.first[:id])\n end\n end\n end\n end", "def save\n result = nil\n # iterate over each instance variable and insert create row to table\n\t\t\t\t obj = self.inst_strip_braces(self.object)\n self.instance_variables.each do |method|\n method = method.to_s.gsub(/@/,\"\")\n # Don't save objects with braces to database\n val = self.send(method.to_sym)\n # add rows excluding object, source_id and update_type\n unless self.method_name_reserved?(method) or val.nil?\n result = Rhom::RhomDbAdapter::insert_into_table(Rhom::TABLE_NAME,\n {\"source_id\"=>self.get_inst_source_id,\n \"object\"=>obj,\n \"attrib\"=>method,\n \"value\"=>val,\n \"update_type\"=>'create'})\n end\n end\n # Create a temporary query record to display in the list\n Rho::RhoConfig::sources[self.class.name.to_s]['attribs'].each do |attrib|\n result = Rhom::RhomDbAdapter::insert_into_table(Rhom::TABLE_NAME,\n {\"source_id\"=>self.get_inst_source_id,\n \"object\"=>obj,\n \"attrib\"=>attrib['attrib'],\n \"value\"=>self.send(attrib['attrib'].to_sym),\n \"update_type\"=>'query'})\n end\n result\n end", "def store(obj_type, name, object)\n validate(\n {\n :obj_type => obj_type,\n :name => name,\n :object => object,\n },\n {\n :object => { :respond_to => :to_json },\n }\n )\n rows = get_view(\"id_map\", \"name_to_id\", :key => [ obj_type, name ])[\"rows\"]\n uuid = rows.empty? ? UUIDTools::UUID.random_create.to_s : rows.first.fetch(\"id\")\n\n db_put_response = @rest.put_rest(\"#{couchdb_database}/#{uuid}\", object)\n\n if object.respond_to?(:add_to_index)\n Chef::Log.info(\"Sending #{obj_type}(#{uuid}) to the index queue for addition.\")\n object.add_to_index(:database => couchdb_database, :id => uuid, :type => obj_type)\n end\n\n db_put_response\n end", "def save!\n $redis.hset RedisContainer, self.full_name, self.to_json\n end", "def persist\n dump = self.dump\n\n if dirty?(dump)\n @mapper.update(@remote_key, dump, @remote_dump)\n return self.class.new(@mapper, @object, dump)\n end\n\n self\n end", "def save\n #see if PID is not yet specified in DC. Note that according the rest of the code, the PID is put in DC when the object is first saved. \n #That means the below expression becomes true only if this is the object is saved first time.\n update_dc_id = get_dc.identifier == \"\"\n \n #Save the object. This generates the PID if this is a new object.\n status = super\n \n dc = get_dc\n if update_dc_id && status\n \n dc.identifier = self.pid\n \n #We need to set up the following field at some point.\n dc.creator = \"TODO\" if dc.creator == \"\"\n dc.created = \"TODO\" if dc.created == \"\"\n \n #Since the DC is updated, let's save the object again.\n status = super \n end\n \n #Return the save status.\n return status\n end", "def save(instance)\n @pstore.transaction do\n @registry << instance\n @pstore[:registry] = @registry\n end\n end", "def save\n update({})\n end", "def save\n MoxiworksPlatform::Event.update(self.to_hash)\n end", "def persistent(obj)\n (@persistent ||= {})[obj.object_id] = true\n end", "def store\n connection.store\n end", "def populate_timezones\n if new_record?\n self.created_at_timezone ||= Time.zone.name\n else\n if self.deleted?\n self.deleted_at_timezone ||= Time.zone.name\n end\n end\n end", "def persist\n raise NotImplemented, \"#persist must be defined\"\n end", "def set_location params\n sequel_db = get_db params[:database]\n sequel_db.transaction do\n object_record = sequel_db[:objects].where( :id => params[:persistence_id] )\n raise \"persistence_id must correspond to an existing object\" if object_record.empty?\n object_record.update :location_object_id => params[:location_persistence_id]\n end\n nil\n end", "def add_to_database\n CONNECTION.execute(\"INSERT INTO locations (name) VALUES ('#{self.name})';\")\n self.id = CONNECTION.last_insert_row_id\n \n return self\n end", "def save\n\t\ttransfer_content from: if rid.rid?\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdb.update self, attributes, version\n\t\t\t\t\t\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdb.create_record self, attributes: attributes, cache: false \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\tActiveOrient::Base.store_rid self\n\tend", "def save\n $redis.hsetnx RedisContainer, self.full_name, self.to_json\n end", "def register_last_activity_time_to_db\n return unless sorcery_config.register_last_activity_time\n return unless logged_in?\n\n current_user.set_last_activity_at(Time.current)\n end", "def save(*)\n update_magic_properties\n clear_association_cache\n create_or_update\n end", "def before_create\n temp_time = Time.sl_local\n self.created_at = temp_time\n self.modified_at = temp_time\n end", "def save(wallet)\n db.transaction do\n db[wallet.address] = wallet\n end\n end", "def save()\n File.write(@database_file, @data.to_json)\n end", "def insert(object)\n key_name = attributes.key[0].name\n tuple = dump(object)\n tuple.delete(key_name)\n key_value = relation.insert(tuple)\n\n object.public_send(\"#{key_name}=\", key_value)\n\n object\n end", "def save\n REDIS.zadd :event, id, date unless exist?\n end", "def save()\n person_session = PersonSession.new({\n 'date_time_added' => @date_time_added,\n 'reserve' => @reserve.to_s,\n 'person_id' => @person.id,\n 'session_id' => @session.id\n })\n person_session.save()\n end", "def hard_save(instance)\n SubmissionViewingEvent.create(instance.to_h)\n end", "def save!\n raise \"A database must be setted\" unless self.database\n response = id.nil? ? self.database.post( self ) : self.database.put( self )\n pristine_copy\n response\n end", "def save\r\n # raise error if schema is not same between from and to.\r\n # so , create sql from record map\r\n #keys = get_schema.map{|v| v[0]}\r\n keys = @__stored_map__.keys\r\n sql = \"insert into #{self.class.table_name} (#{keys.join(',')}) values( \"\r\n\r\n keys.each_with_index do |key , index|\r\n v = @__stored_map__[key]\r\n sql << ',' if index != 0\r\n sql << (v.kind_of?(String) ? \"'#{v}'\" : v.to_s)\r\n end\r\n sql << \")\"\r\n puts sql if $DEBUG\r\n self.class.execute_sql(sql)\r\n end", "def save\n response = perform_save(nil)\n response_data = ActiveSupport::HashWithIndifferentAccess.new(response.data)\n\n if new_record?\n created_object = self.class.new(client, self.class.map_to_scope_parameters(attributes).merge(response_data))\n\n self.id = created_object.id\n self.attributes.merge!(created_object.attributes)\n else\n self[:updated_at] = response_data[:updated_at]\n end\n\n mark_as_saved!\n self\n end", "def save\n requires :name, :type, :ttl, :rrdatas\n\n service.create_change(self.zone.id, [resource_record_set_format], [])\n self\n end", "def initialize\n save\n end", "def save\n create_or_update\n end", "def save\n create_or_update\n end", "def save\n create_or_update\n end", "def save\n raise \"Unhashed entry during save\" unless @hash\n raise \"Entry without mime type during save\" unless @mimetype\n @data[:mimetype] = @mimetype\n @data[:ctime] = @ctime.utc.to_i\n @data[:mtime] = @mtime.utc.to_i\n @data[:name] = @name\n @data[:size] = @size\n @data[:tags] = @tags\n @data[:locations] ||= Array.new\n unless @data[:locations].include? @location\n @data[:locations] << @location\n end\n if ::Ordnung.database.read @hash\n ::Ordnung.database.update @hash, @data\n else\n ::Ordnung.database.create @hash, @data\n end\n @hash\n end", "def save\n raise NotImplementedError\n end", "def add_instance(instance)\n self.save unless self.persisted?\n instance.ie = self\n self.instances << instance\n instance.save && self.save\n end", "def save\n json = JSON.dump @attributes\n\n @dbm[@id] = json\n\n true\n end", "def save\n put_object\n true\n end", "def to_new_record!\n store_before_to_new_record_values\n reset_persistence_values\n @new_record = true\n end", "def persist_new(entity)\n cargo_persistence.create(to_dao(entity))\n end", "def save!\n object.save!\n end", "def database(loc)\n @db = GeoIPCity::Database.new(loc, :filesystem)\n end", "def set_timezone\n tz = Profile.find_by_user_id(current_user.id).timezone\n @timezone = Time.now.in_time_zone(tz).strftime('%z')\n if current_user\n User.current = current_user\n end\n end", "def save()\n super\n end", "def save()\n super\n end" ]
[ "0.66798556", "0.63102967", "0.6261971", "0.62364614", "0.6150229", "0.6150229", "0.6150229", "0.61287105", "0.61158574", "0.60939944", "0.6093928", "0.5954322", "0.5951211", "0.5909323", "0.5870558", "0.5864742", "0.58198434", "0.57542545", "0.5726686", "0.57196975", "0.5718372", "0.5666151", "0.56173766", "0.55796725", "0.557717", "0.55627346", "0.5532898", "0.55303097", "0.55303097", "0.5525038", "0.5518881", "0.5511149", "0.5509785", "0.55037725", "0.5499213", "0.54717594", "0.54636997", "0.54552805", "0.5451833", "0.54437613", "0.5438039", "0.5438039", "0.5438039", "0.54309446", "0.5429393", "0.5429048", "0.5428701", "0.5417884", "0.54168844", "0.5414153", "0.5392061", "0.5385618", "0.5380774", "0.53668743", "0.5365658", "0.5361542", "0.53581667", "0.5354949", "0.53418577", "0.5337013", "0.53299636", "0.5313341", "0.5306097", "0.5293265", "0.5286144", "0.52761805", "0.52694273", "0.5254504", "0.52508616", "0.5249251", "0.5247351", "0.52383024", "0.52240664", "0.52201533", "0.52176976", "0.5216214", "0.52153915", "0.52069455", "0.52024525", "0.5197956", "0.51912975", "0.5189511", "0.5188341", "0.51879644", "0.5179607", "0.5176691", "0.5172174", "0.5172174", "0.5172174", "0.5172095", "0.5169211", "0.51579916", "0.5156053", "0.5154133", "0.5151896", "0.51478034", "0.51448274", "0.51323736", "0.512801", "0.51274717", "0.51274717" ]
0.0
-1
Return blobs as instances of Sequel::SQL::Blob instead of Amalgamite::Blob
def blob(s) SQL::Blob.new(s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_sequel_blob\n SQL::Blob.new(self)\n end", "def to_sequel_blob\n self\n end", "def typecast_value_blob(value)\n value.is_a?(Sequel::SQL::Blob) ? value : Sequel::SQL::Blob.new(value)\n end", "def blob(s)\n if s.is_a?(SQL::Blob)\n s\n else\n SQL::Blob.new(s)\n end\n end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def to_blob; end", "def blob\n dbf.blob\n end", "def blob; end", "def blob; end", "def to_blob\n @blob\n end", "def to_blob(constraints = {})\n to_datastream(constraints).to_blob\n end", "def to_blob(constraints = {})\n to_datastream(constraints).to_blob\n end", "def blobs\n contents.select { |v| v.kind_of? Gitlab::Git::Blob }\n end", "def blob\n @blob ||= image.to_blob\n end", "def blobs\n @blobs ||= ApiFactory.new 'GitData::Blobs'\n end", "def blob_tables\n execute('select table_name from information_schema.tables where table_schema = ?', ['blob']).map(&:first)\n end", "def blob\n nil\n end", "def blob\n @blob ||= ($repo.gblob(@rev + ':' + @name))\n end", "def to_blob\n File.binread(path)\n end", "def blob\n generate\n storage.get(path).body\n end", "def to_blob\n f = File.new @path\n f.binmode\n f.read\n ensure\n f.close if f\n end", "def write_blobs\n unless @blobs_to_write.empty?\n @blobs_to_write.each do |blob|\n blob.write_to_column!\n end\n end\n end", "def blob?\n @blob\n end", "def type_literal_generic_file(column)\n :blob\n end", "def BlobWithMode\n Git::BlobWithMode\n end", "def blob(arg)\r\n file MojoMagick::tempfile(arg)\r\n end", "def to_blob\n #@blob ||= Net::SSH::Buffer.from(:string, ssh_type,\n # :bignum, p, :bignum, q, :bignum, g, :bignum, pub_key).to_s\n SSHUtils.convert_string(ssh_type)<<\n SSHUtils.convert_bignum(p)<<\n SSHUtils.convert_bignum(q)<<\n SSHUtils.convert_bignum(g)<<\n SSHUtils.convert_bignum(pub_key)\n end", "def to_blob\n #@blob ||= Net::SSH::Buffer.from(:string, ssh_type, :bignum, e, :bignum, n).to_s\n SSHUtils.convert_string(ssh_type)<<\n SSHUtils.convert_bignum(e)<<\n SSHUtils.convert_bignum(n)\n end", "def literal_blob_append(sql, v)\n sql << \"'\" << db.synchronize(@opts[:server]){|c| c.escape_bytea(v)} << \"'\"\n end", "def save2blob()\n url = URI.parse(getUrl)\n h = Net::HTTP.start(url.host, url.port) do |http|\n resp, data = http.get(url.path + '?' + url.query)\n return data\n end\n end", "def contents\n if persisted?\n f=Photo.mongo_client.database.fs.find_one(:_id=>BSON::ObjectId.from_string(@id))\n if f \n buffer = \"\"\n f.chunks.reduce([]) do |x,chunk| \n buffer << chunk.data.data \n end\n return buffer\n end \n end\n end", "def blobs(container, key = nil, options = {})\n key ||= properties.key1\n\n query = \"restype=container&comp=list\"\n options.each { |okey, ovalue| query += \"&#{okey}=#{[ovalue].flatten.join(',')}\" }\n\n response = blob_response(key, query, container)\n\n doc = Nokogiri::XML(response.body)\n\n results = doc.xpath('//Blobs/Blob').collect do |node|\n hash = Hash.from_xml(node.to_s)['Blob'].merge(:container => container)\n hash.key?('Snapshot') ? BlobSnapshot.new(hash) : Blob.new(hash)\n end\n\n results.concat(next_marker_results(doc, :blobs, container, key, options))\n end", "def pg_jsonb\n Sequel::Postgres::JSONBArray.new(self)\n end", "def tree_blob(ref, path)\n ref ||= 'master'\n commit = self.commit ref\n tree = commit.tree_rpc\n Tree.content_by_path(self, tree.id, path, commit.id, tree.path)\n end", "def to_blob\n stream = StringIO.new\n @surface.write_to_png(stream)\n stream.string\n end", "def blob(id)\n head \"/blobs/#{id}\"\n end", "def create_blob(content)\n options = {\n headers: headers,\n body: {\n content: content,\n encoding: \"base64\"\n }.to_json\n }\n response = self.class.post(\"#{BASE_URI}/repos/#{@owner}/#{@repo}/git/blobs\", options)\n response.parsed_response\n end", "def blobs_for_committish(committish)\n commits = grit.batch(committish)\n unless commits.empty?\n commits.first.tree.blobs\n end\n end", "def blob(repo)\n @blob ||= Grit::Blob.create(repo,\n :id => @sha, :name => name, :size => @size)\n end", "def blob(id, commit_sha=nil, path=nil)\n blob = self.lookup(id); blob_entry={}\n if commit_sha && path\n commit = self.lookup(commit_sha)\n unless commit\n root_tree = commit.tree\n blob_entry = Gitlab::Git::Blob.find_entry_by_path(self, root_tree.oid, path)\n end\n end\n if blob\n Gitlab::Git::Blob.new(\n id: blob.oid,\n name: blob_entry[:name],\n size: blob.size,\n data: blob.content,\n mode: blob_entry[:mode],\n path: path,\n commit_id: commit_sha,\n )\n end\n end", "def list_blobs(blobs)\n blobs.each do |blob|\n puts blob.name\n end\nend", "def io\n @io ||= StringIO.new(blob, 'r+b')\n end", "def get_all_files()\n return $db.execute(\"SELECT * FROM files\")\nend", "def result_value_of(declared_type, value)\n if value.is_a?(::Amalgalite::Blob)\n SQL::Blob.new(value.to_s)\n elsif value.is_a?(String) && declared_type\n (meth = self.class.sql_to_method(declared_type.downcase)) ? send(meth, value) : value\n else\n super\n end\n end", "def literal_blob_append(sql, v)\n sql << \"'\" << v.gsub(/[\\000-\\037\\047\\134\\177-\\377]/n){|b| \"\\\\#{(\"%o\" % b[0..1].unpack(\"C\")[0]).rjust(3, '0')}\"} << \"'\"\n end", "def each_blob\n each_pair do |key, value|\n next unless value.kind_of?(Array)\n yield(key, value)\n end\n end", "def <<(blob)\n @buf << blob\n buf_flush if @buf.size > BUFFER_SIZE\n self\n end", "def visit_blob(binding_type)\n #TODO: consider moving the conversion right in here.\n self.result = binding_type.to_ruby(input)\n end", "def blob(oid, destination)\n begin\n res = barerepo.blob_at oid, destination\n rescue\n return nil\n end\n res\n end", "def blob(oid, destination)\n begin\n res = barerepo.blob_at oid, destination\n rescue\n return nil\n end\n res\n end", "def store_blob(blob)\n super #=> returns blob[:tempfile]\n end", "def find_blob_data(sha, path)\n commit = barerepo.lookup sha\n tree = barerepo.lookup commit.tree_id\n blob = tree.path path\n blobdata = barerepo.read(blob[:oid]).data\n image = {\n name: blob[:name],\n data: blobdata\n }\n [image , commit]\n end", "def bytes\n @lmdb.transaction do\n if ret = @dbs[:control]['bytes']\n ret.unpack1 'Q>'\n end\n end\n end", "def data= blob\n $postgres.exec_prepared('wsfile_update', [self.id, {value: blob, format: 1}])\n end", "def literal_blob_append(sql, v)\n if v.empty?\n sql << \"''\"\n else\n sql << \"x'#{v.unpack('H*').first}'\"\n end\n end", "def store_blob(object,field_name,blob)\n super #=> returns blob[:tempfile]\n end", "def get_b\n n = self.get_i32\n OSC::Blob.new(self.get_data(n))\n end", "def get_blob(container, blob, options={})\n query = { }\n StorageService.with_query query, 'snapshot', options[:snapshot]\n StorageService.with_query query, 'timeout', options[:timeout].to_s if options[:timeout]\n uri = blob_uri(container, blob, query)\n\n headers = StorageService.common_headers\n options[:start_range] = 0 if options[:end_range] and not options[:start_range]\n if options[:start_range]\n StorageService.with_header headers, 'x-ms-range', \"bytes=#{options[:start_range]}-#{options[:end_range]}\"\n StorageService.with_header headers, 'x-ms-range-get-content-md5', true if options[:get_content_md5]\n end\n add_blob_conditional_headers options, headers\n\n response = call(:get, uri, nil, headers, options)\n result = Serialization.blob_from_headers(response.headers)\n result.name = blob unless result.name\n return result, response.body\n end", "def dataset(opts=nil)\n Sequel::JDBC::Pervasive::Dataset.new(self)\n end", "def get_blob(container, blob, options={})\n query = { }\n query['snapshot'] = options[:snapshot] if options[:snapshot]\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n uri = blob_uri(container, blob, query)\n\n headers = service_properties_headers\n options[:start_range] = 0 if options[:end_range] and not options[:start_range]\n if options[:start_range]\n headers['x-ms-range'] = \"bytes=#{options[:start_range]}-#{options[:end_range]}\"\n headers['x-ms-range-get-content-md5'] = true if options[:get_content_md5]\n end\n\n response = call(:get, uri, nil, headers)\n result = Serialization.blob_from_headers(response.headers)\n result.name = blob unless result.name\n return result, response.body\n end", "def get_audio_content\n begin\n audio_sql = \"SELECT * FROM mediacontent WHERE HighQFilePath IS NOT NULL\";\n audio_sql += \" AND (ContentTypeID = 2) AND (HighQFilePath LIKE '%mp3')\";\n audio_sql += \" AND HighQFilePath != ''\"\n audio_content_data = Immutable.dbh.execute(audio_sql);\n return audio_content_data;\n rescue DBI::DatabaseError => e\n Immutable.log.error \"Error code: #{e.err}\"\n Immutable.log.error \"Error message: #{e.errstr}\"\n Immutable.log.error \"Error SQLSTATE: #{e.state}\"\n abort('An error occurred while getting audio content data from DB, Check migration log for more details');\n end\n end", "def postgres_upload_binary_data(data, remote_fname=nil)\n remote_fname ||= Rex::Text::rand_text_alpha(8) + \".dll\"\n\n # From the Postgres documentation:\n # SELECT lo_creat(-1); -- returns OID of new, empty large object\n # Doing it this way instead of calling lo_create with a random number\n # ensures that we don't accidentally hit the id of a real object.\n resp = postgres_query \"select lo_creat(-1)\"\n unless resp and resp[:complete] and resp[:complete].rows[0]\n print_error \"Failed to get a new loid\"\n return\n end\n\n oid = resp[:complete].rows[0][0].to_i\n\n queries = [ \"delete from pg_largeobject where loid=#{oid}\" ]\n\n # Break the data into smaller chunks that can fit in the size allowed in\n # the pg_largeobject data column.\n # From the postgres documentation:\n # \"The amount of data per page is defined to be LOBLKSIZE (which is\n # currently BLCKSZ/4, or typically 2 kB).\"\n # Empirically, it seems that 8kB is fine on 9.x, but we play it safe and\n # stick to 2kB.\n chunks = []\n while ((c = data.slice!(0..2047)) && c.length > 0)\n chunks.push c\n end\n\n chunks.each_with_index do |chunk, pageno|\n b64_data = postgres_base64_data(chunk)\n insert = \"insert into pg_largeobject (loid,pageno,data) values(%d, %d, decode('%s', 'base64'))\"\n queries.push( \"#{insert}\"%[oid, pageno, b64_data] )\n end\n queries.push \"select lo_export(#{oid}, '#{remote_fname}')\"\n\n # Now run each of the queries we just built\n queries.each do |q|\n resp = postgres_query(q)\n if resp && resp[:sql_error]\n print_error \"Could not write the library to disk.\"\n print_error resp[:sql_error]\n # Can't really recover from this, bail\n return nil\n end\n end\n return remote_fname\n end", "def dataset(opts=nil)\n Sequel::Swift::Postgres::Dataset.new(self, opts)\n end", "def attachment\n mail.attachments.map do |attachment|\n blob = ActiveStorage::Blob.create_after_upload!(\n io: StringIO.new(attachment.decoded),\n filename: attachment.filename,\n content_type: attachment.content_type\n )\n return blob\n end\n end", "def to_bson\n data.bytesize.to_bson + SUBTYPES.fetch(type) + data\n end", "def object_data(path)\n blob = path_to_object(path)\n return nil if (not blob) || (blob.kind_of? Grit::Tree)\n blob.kind_of?(Grit::Blob) ? blob.data : blob\n end", "def read_blob(ref, filename)\n blob = repository&.blob_at(ref, filename)\n\n raise 'Blob not found' unless blob\n raise 'File is not readable' unless blob.readable_text?\n\n blob\n end", "def getBlobById(blob_id)\n b = @repo.blob(blob_id).data\n if b == \"\"\n # either the blob doesn't exist or it does but the data is empty\n return false\n end\n return b\n end", "def download_blob_to_tempfile(&block); end", "def download_blob_to_tempfile(&block); end", "def get_file_data(file_id)\n return $db.execute(\"SELECT * FROM files WHERE file_id = ?\", file_id).first\nend", "def select_data_from_db(limits)\n return unless any?\n records_array = retrieve_records(limits)\n csv_string = convert_to_csv(records_array)\n Base64.encode64(csv_string)\n end", "def write_lobs(table_name, klass, attributes)\n # is class with composite primary key>\n is_with_cpk = klass.respond_to?(:composite?) && klass.composite?\n if is_with_cpk\n id = klass.primary_key.map {|pk| attributes[pk.to_s] }\n else\n id = quote(attributes[klass.primary_key])\n end\n klass.columns.select { |col| col.sql_type =~ /LOB$/i }.each do |col|\n value = attributes[col.name]\n # RSI: changed sequence of next two lines - should check if value is nil before converting to yaml\n next if value.nil? || (value == '')\n value = value.to_yaml if col.text? && klass.serialized_attributes[col.name]\n uncached do\n if is_with_cpk\n lob = select_one(\"SELECT #{col.name} FROM #{table_name} WHERE #{klass.composite_where_clause(id)} FOR UPDATE\",\n 'Writable Large Object')[col.name]\n else\n lob = select_one(\"SELECT #{col.name} FROM #{table_name} WHERE #{klass.primary_key} = #{id} FOR UPDATE\",\n 'Writable Large Object')[col.name]\n end\n @connection.write_lob(lob, value, col.type == :binary)\n end\n end\n end", "def blob_to_base64 (photo)\n\t\t#Convierte de formato '/xFF' a Base64 para poder mostrar la foto en la vista\n\t\treturn \"data:image/jpeg;base64,\" + [photo].pack('m0')\n\tend", "def convert_type(v)\n case v\n when Java::NetSourceforgeJtdsJdbc::ClobImpl\n convert_type(v.getSubString(1, v.length))\n else\n super\n end\n end", "def to_blob(image_format = 'PNG')\n warn '#to_blob is deprecated. Please use `to_image.to_blob` instead'\n to_image.to_blob do\n self.format = image_format\n end\n end", "def with_markup(force_extension = nil)\n ret = @blob.data\n [\"*\", (force_extension || extension), \"xml\"].inject(ret){|memo, mup|\n markup = Markup.choose_for(mup)\n Markup::measure_to_stdout(markup, self) do\n markup.new(memo, self).to_html\n end\n }\n end", "def blob(val)\n val.gsub(/[\\000-\\037\\047\\134\\177-\\377]/) do |b|\n \"\\\\#{ b[0].to_s(8).rjust(3, '0') }\"\n end\n end", "def clean_content_blobs\n ContentBlob.where(asset: nil).where('created_at < ?', BLOB_GRACE_PERIOD.ago).select do |blob|\n Rails.logger.info(\"Cleaning up content blob #{blob.id}\")\n blob.reload\n blob.destroy if blob.asset.nil?\n end\n end", "def list_blobs(name, options={})\n # Query\n query = { 'comp' => 'list' }\n query['prefix'] = options[:prefix].gsub(/\\\\/, '/') if options[:prefix]\n query['delimiter'] = options[:delimiter] if options[:delimiter]\n query['marker'] = options[:marker] if options[:marker]\n query['maxresults'] = options[:max_results].to_s if options[:max_results]\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n included_datasets = []\n included_datasets.push('metadata') if options[:metadata] == true\n included_datasets.push('snapshots') if options[:snapshots] == true\n included_datasets.push('uncommittedblobs') if options[:uncommittedblobs] == true\n included_datasets.push('copy') if options[:copy] == true\n\n query['include'] = included_datasets.join ',' if included_datasets.length > 0\n\n # Scheme + path\n uri = container_uri(name, query)\n \n # Call\n response = call(:get, uri, nil, {}, options)\n \n # Result\n if response.success?\n Serialization.blob_enumeration_results_from_xml(response.body)\n else\n response.exception\n end\n end", "def contents\n f = self.class.mongo_client.database.fs.find_one({:_id=>BSON::ObjectId.from_string(@id)})\n if f\n buffer = \"\"\n f.chunks.reduce([]) do |x, chunk|\n buffer << chunk.data.data\n end\n return buffer\n end\n end", "def contents\n \tdoc = self.class.mongo_client.database.fs.find_one(:_id => BSON::ObjectId(@id))\n \tif doc\n \t buffer = \"\"\n \t doc.chunks.reduce([]) do |x, chunk|\n \t buffer << chunk.data.data\n \t end\n \t return buffer\n \tend\n end", "def list_blobs(path='')\n list(path).delete_if { |k,v| not v.kind_of?(Grit::Blob) }\n end", "def download_blob_to(file) #:doc:\n file.binmode\n blob.download { |chunk| file.write(chunk) }\n file.flush\n file.rewind\n end", "def get_blobs(container)\n return $azure_blob_service.list_blobs(container.name)\nend", "def load_attachments(table:, columns:, original_columns:)\n sql_base = <<-SQL\n INSERT INTO searcher_records(original_id, original_type, project_id, project_name, container_id, container_type, original_created_on, original_updated_on, #{columns.join(\", \")})\n SELECT base.id, '#{table.classify}', t.id, t.name, container_id, container_type, #{transform(original_columns)} FROM #{table} AS base\n SQL\n sql_rest = <<-SQL\n JOIN projects AS t ON (base.container_id = t.id AND base.container_type = 'Project')\n SQL\n execute(\"#{sql_base} #{sql_rest};\")\n\n sql_base = <<-SQL\n INSERT INTO searcher_records(original_id, original_type, project_id, project_name, container_id, container_type, status_id, is_private, original_created_on, original_updated_on, #{columns.join(\", \")})\n SELECT base.id, '#{table.classify}', t.project_id, p.name, container_id, container_type, status_id, is_private, #{transform(original_columns)} FROM #{table} AS base\n SQL\n sql_rest = <<-SQL\n JOIN issues AS t ON (base.container_id = t.id AND base.container_type = 'Issue')\n JOIN projects AS p ON (t.project_id = p.id)\n SQL\n execute(\"#{sql_base} #{sql_rest};\")\n\n sql_base = <<-SQL\n INSERT INTO searcher_records(original_id, original_type, project_id, project_name, container_id, container_type, original_created_on, original_updated_on, #{columns.join(\", \")})\n SELECT base.id, '#{table.classify}', t.project_id, p.name, container_id, container_type, #{transform(original_columns)} FROM #{table} AS base\n SQL\n %w(documents news versions).each do |target|\n sql_rest = <<-SQL\n JOIN #{target} AS t ON (base.container_id = t.id AND base.container_type = '#{target.classify}')\n JOIN projects AS p ON (t.project_id = p.id)\n SQL\n execute(\"#{sql_base} #{sql_rest};\")\n end\n\n sql_rest = <<-SQL\n JOIN messages AS m ON (base.container_id = m.id AND base.container_type = 'Message')\n JOIN boards AS t ON (m.board_id = t.id)\n JOIN projects AS p ON (t.project_id = p.id)\n SQL\n execute(\"#{sql_base} #{sql_rest};\")\n\n sql_rest = <<-SQL\n JOIN wiki_pages AS wp ON (base.container_id = wp.id AND base.container_type = 'WikiPage')\n JOIN wikis AS t ON (wp.wiki_id = t.id)\n JOIN projects AS p ON (t.project_id = p.id)\n SQL\n execute(\"#{sql_base} #{sql_rest};\")\n end", "def set_blob\n @blob = Blob.find(params[:id])\n end", "def dataset\n ds = Sequel::Dataset.new(self)\n end", "def dataset\n ds = Sequel::Dataset.new(self)\n end", "def create_page_blob(container, blob, length, options={})\n query = { }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n uri = blob_uri(container, blob, query)\n\n headers = service_properties_headers\n\n # set x-ms-blob-type to PageBlob\n headers['x-ms-blob-type'] = 'PageBlob'\n\n # ensure content-length is 0 and x-ms-blob-content-length is the blob length\n headers['Content-Length'] = 0.to_s\n headers['x-ms-blob-content-length'] = length.to_s\n\n # set x-ms-sequence-number from options (or default to 0)\n headers['x-ms-sequence-number'] = (options[:sequence_number] || 0).to_s\n\n # set the rest of the optional headers\n headers['Content-Type'] = options[:content_type] if options[:content_type]\n headers['Content-Encoding'] = options[:content_encoding] if options[:content_encoding]\n headers['Content-Language'] = options[:content_language] if options[:content_language]\n headers['Content-MD5'] = options[:content_md5] if options[:content_md5]\n headers['Cache-Control'] = options[:cache_control] if options[:cache_control]\n\n headers['x-ms-blob-content-type'] = options[:blob_content_type] if options[:blob_content_type]\n headers['x-ms-blob-content-encoding'] = options[:blob_content_encoding] if options[:blob_content_encoding]\n headers['x-ms-blob-content-language'] = options[:blob_content_language] if options[:blob_content_language]\n headers['x-ms-blob-content-md5'] = options[:blob_content_md5] if options[:blob_content_md5]\n headers['x-ms-blob-cache-control'] = options[:blob_cache_control] if options[:blob_cache_control]\n\n add_metadata_to_headers(options[:metadata], headers) if options[:metadata]\n\n # call PutBlob with empty body\n response = call(:put, uri, nil, headers)\n\n result = Serialization.blob_from_headers(response.headers)\n result.name = blob\n\n result\n end", "def query_b2(client)\n\n urls = []\n results = client.query(\"select photo from imageuploader\")\n\n results.each do |result|\n file = result[\"photo\"]\n\n url = b2_generate_file_url(file)\n urls.push(url)\n end\n\n return urls\n\nend", "def try_blobs(meth)\n old_blob&.public_send(meth) || new_blob&.public_send(meth)\n end", "def contents\n\tRails.logger.debug {\"getting gridfs content #{@id}\"}\n f=self.class.mongo_client.database.fs.find_one(:_id=>BSON::ObjectId.from_string(@id))\n # read f into buffer, array of chunks is reduced to single buffer and returned to caller.\n # this is how file is broken apart and put together and assembled. Buffer is sent back to browser\n # to disaply on the screen\n if f \n buffer = \"\"\n f.chunks.reduce([]) do |x,chunk| \n buffer << chunk.data.data \n end\n return buffer\n end \n\nend", "def get_all_public_files()\n return $db.execute(\"SELECT * FROM files WHERE publicity = 1\")\nend", "def objects\n @lmdb.transaction do\n if ret = @dbs[:control]['objects']\n ret.unpack1 'Q>' # 64-bit unsigned network-endian integer\n end\n end\n end", "def query_s3(db)\n\n secure_urls = []\n query = db.exec(\"select photo from imageuploader\")\n\n query.to_a.each do |hash|\n secure_url = generate_url(\"imageuploader\", hash[\"photo\"])\n secure_urls.push(secure_url)\n end\n\n return secure_urls\n\nend" ]
[ "0.79718906", "0.75431347", "0.7399565", "0.73858136", "0.7078076", "0.7078076", "0.7078076", "0.7078076", "0.7078076", "0.7078076", "0.70250577", "0.67801374", "0.67801374", "0.6623174", "0.6377873", "0.6377873", "0.62105966", "0.6203107", "0.6162549", "0.60899836", "0.60007906", "0.5908771", "0.5819581", "0.5815295", "0.57978475", "0.5753813", "0.57454884", "0.57065946", "0.5697123", "0.56734663", "0.5660046", "0.5654559", "0.5583292", "0.5543665", "0.5471348", "0.5438288", "0.54365563", "0.5432705", "0.5406215", "0.539399", "0.5339694", "0.5334132", "0.53254807", "0.52603906", "0.5257983", "0.524504", "0.52338034", "0.5206813", "0.52016604", "0.51925987", "0.5165464", "0.51628953", "0.51521367", "0.51521367", "0.5146527", "0.5136326", "0.51212835", "0.51141286", "0.50910795", "0.5068939", "0.5062359", "0.5059935", "0.50472564", "0.5046886", "0.5026329", "0.5024248", "0.50166106", "0.50082684", "0.49992827", "0.49936002", "0.49934846", "0.49799612", "0.49778578", "0.49778578", "0.4973837", "0.49720585", "0.49714577", "0.49454686", "0.494104", "0.49393025", "0.49288318", "0.49168426", "0.4900111", "0.48838088", "0.48784864", "0.48749456", "0.48679587", "0.48557442", "0.48525423", "0.4847135", "0.4843645", "0.48435664", "0.48435664", "0.48393366", "0.48362562", "0.48335785", "0.4818235", "0.48155686", "0.48093376", "0.48081106" ]
0.74515295
2
Return numeric/decimal types as instances of BigDecimal instead of Float
def decimal(s) BigDecimal.new(s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def numeric?; float?; end", "def typecast_value_decimal(value)\n if value.is_a?(String)\n BigDecimal.new(value)\n else\n super\n end\n end", "def to_f\n case @kind\n when :float_lit, :float_exp_lit,\n :integer_lit, :integer_exp_lit,\n :single_string_lit, :double_string_lit\n @value.to_f\n else\n self.to_i.to_f\n end\n end", "def typecast_value_decimal(value)\n case value\n when BigDecimal\n value\n when Numeric\n BigDecimal.new(value.to_s)\n when String\n _typecast_value_string_to_decimal(value)\n else\n raise InvalidValue, \"invalid value for BigDecimal: #{value.inspect}\"\n end\n end", "def numericize\n\t\tcollect(&:to_f)\n\tend", "def cast(value, precision = MAXIMUM, _scale = nil)\n case value\n when BigDecimal\n value\n when String\n BigDecimal(value)\n else\n BigDecimal(value, precision > MAXIMUM ? MAXIMUM : precision)\n end\n end", "def coerce(other)\n xy = [other, self]\n if self.class != other.class then\n xy.map! do |obj|\n if obj.kind_of?(Float) then\n obj\n elsif obj.respond_to?(:to_f) then\n obj.to_f\n else\n raise TypeError, \"cannot convert #{obj.class} to Float\"\n end\n end\n end\n xy\n end", "def to_f\n return nil if value.nil?\n value.to_f.with_decimals decimals\n end", "def to_d\n @object.respond_to?(:to_d) ? @object.to_d : BigDecimal(@object.to_s)\n rescue FloatDomainError\n ::Float::NAN\n end", "def to_d\n @object.respond_to?(:to_d) ? @object.to_d : BigDecimal(@object.to_s)\n rescue FloatDomainError\n ::Float::NAN\n end", "def mongoize\n ::BigDecimal.mongoize(self)\n end", "def typecast_value_float(value)\n Float(value)\n end", "def to_f\n self.class.new(@value.to_f)\n end", "def to_f\n self.map {|e| e.to_f}\n end", "def to_f\n Float(value)\n end", "def to_d\n @object.respond_to?(:to_d) ? @object.to_d : BigDecimal(@object.to_s)\n end", "def to_d\n @object.respond_to?(:to_d) ? @object.to_d : BigDecimal(@object.to_s)\n end", "def post_process_float( val )\n\t\t\treturn Float( val.to_s )\n\t\tend", "def convert_value_by_type\n case self.value_type\n when 'Numeric'\n unless self.multiplier.nil? || self.multiplier.blank?\n val = self.value.include?('.') ? self.value.to_f : self.value.to_i\n return val.send(self.multiplier.to_sym)\n else\n return self.value.to_f\n end\n when 'Boolean'\n return self.value == '1'\n else\n return self.value\n end\n end", "def get_vat_decimal\n case company_business_type\n when 'Rekisteröity yhdistys'\n BigDecimal.new('0')\n else\n BigDecimal.new('0.10') # 10 %\n end\n end", "def get_vat_decimal\n case company_business_type\n when 'Rekisteröity yhdistys'\n BigDecimal.new('0')\n else\n BigDecimal.new('0.10') # 10 %\n end\n end", "def to_f; end", "def bigdecimal(n)\n return object(n.to_f) #, :as => :bigdecimal\n end", "def to_f\n amount.to_f\n end", "def cast\n return to_f if numeric? && index(\".\")\n return to_i if numeric?\n if boolean?\n return true if self =~ /\\Atrue\\z/i\n return false if self =~ /\\Afalse\\z/i\n end\n self\n end", "def to_f() end", "def to_f() end", "def to_f() end", "def to_f() end", "def Float(p0) end", "def to_f\n (BigDecimal.new(cents.to_s) / currency.subunit_to_unit).to_f\n end", "def to_f\n (BigDecimal.new(cents.to_s) / currency.subunit_to_unit).to_f\n end", "def to_f\n @amount.to_f\n end", "def coerce(value)\n return 0.0 unless value.respond_to?(:to_f)\n\n value.to_f\n end", "def type\n 'Edm.Decimal'\n end", "def number_f\n return @number_f\n end", "def to_f\n end", "def to_f\n end", "def to_f\n end", "def should_be_float?(field_info, field)\n field_info[\"type\"] == \"REAL\"\n end", "def instantiate amount, currency\n if amount.is_a?(BigDecimal)\n amount\n else\n BigDecimal(amount.to_s, precision_for(amount, currency))\n end\n end", "def float cols\n decode_values :float, cols\n end", "def is_float?\n self.to_f.to_s == self\n end", "def float\n Util.from_bytes :float, value\n end", "def to_f\n @value.to_f\n end", "def to_decimal(float_price)\n decimal.Decimal('%<float_price>.2f', float_price: float_price)\nend", "def type\n Attribute::Float\n end", "def type\n Attribute::Float\n end", "def numeric(object)\n object.to_s =~ /(^[-+]?[0-9]+$)|(\\.0+)$/ ? object.to_i : Float(object)\n end", "def toDecimal\r\n self\r\n end", "def type_literal_generic_float(column)\n :\"double precision\"\n end", "def typecast_to_float(value)\n typecast_to_numeric(value, :to_f)\n end", "def to_f\n if isFloat? then\n value = exp.to_f\n return value\n elsif exp == \"Infinity\" then return @@MAX_VALUE\n elsif exp == \"-Infinity\" then return @@MIN_VALUE\n else\n raise \"Non-float conversion in expression: \" + exp\n end\n end", "def to_f \n return self.value\n end", "def number_type b\n if b.include?(\".\")\n return b.to_f.round(2)\n else\n return b.to_i\n end\nend", "def coerce_float(value, options = {})\n Float(value) rescue nil\n end", "def coerce_float(value, options = {})\n Float(value) rescue nil\n end", "def floats cols\n decode_values :float, cols, true\n end", "def to_float(value)\n return value.to_f if value.is_a?(Numeric)\n value = value.to_s if value.is_a?(Symbol)\n value.to_f if value.is_a?(String) && value.match?(NUMBER_PATTERN)\n end", "def to_f\n @object.to_f\n end", "def to_f\n @object.to_f\n end", "def to_f\n @object.to_f\n end", "def to_f\n @object.to_f\n end", "def typecast_to_bigdecimal(value)\n typecast_to_numeric(value, :to_d)\n end", "def to_f\n @amount.to_f\n end", "def price\n BigDecimal('3.0')\n end", "def coerce_float(value, _options = {})\n Float(value) rescue nil\n end", "def to_f\n @value.to_f\n end", "def to_f\n @value.to_f\n end", "def to_f\n @value.to_f\n end", "def to_f\n @value.to_f\n end", "def big_decimal\n require 'bigdecimal'\n BigDecimal.class_eval do\n alias_method :inspect_orig, :inspect\n alias_method :inspect, :to_s\n end\n end", "def test_Complex_InstanceMethods_to_f\n\t\tassert_equal(2.0, Complex(2, 0).to_f)\n\tend", "def to_ruby\n if CF.CFNumberIsFloatType(self) == 0\n to_i\n else\n to_f\n end\n end", "def test_should_multiply_by_a_Fixnum_or_Float\n currency1 = Currency.new(\"USD\", 4.0)\n\n assert_equal Currency.new(\"USD\", 12.0), currency1 * 3\n end", "def to_f\n (self.v || self.d).to_f\n end", "def numeric?\n !!Float(self) rescue false\n end", "def price\n BigDecimal('5.0')\n end", "def to_float(num)\n return num unless num.is_a? Numeric\n num.to_f\n end", "def prec_f() end", "def to_stringified_float(int)\r\n # your code goes here\r\n # use of methods\r\n\r\n int.to_f.to_s\r\nend", "def value_to_decimal(value)\n return nil if value.blank?\n # Using .class is faster than .is_a? and\n # subclasses of BigDecimal will be handled\n # in the else clause\n if value.class == BigDecimal\n value\n elsif value.respond_to?(:to_d)\n value.to_d\n else\n value.to_s.to_d\n end\n end", "def to_stringified_float(int)\n # your code goes here\n return (int.to_f).to_s\nend", "def to_big_decimal\n @big_decimal ||= BigDecimal.new(to_s)\n end", "def column_value_decimal\n column_value.to_f.to_s\n end", "def dbms_type_cast(columns, values)\n int_column = {}\n columns.each_with_index do |c, i|\n int_column[i] = c.type == 3 && c.scale == 0\n end\n\n float_column = {}\n columns.each_with_index do |c, i|\n float_column[i] = c.type == 3 && c.scale != 0\n end\n\n values.each do |row|\n row.each_index do |idx|\n val = row[idx]\n if val\n if int_column[idx]\n row[idx] = val.to_i\n elsif float_column[idx]\n row[idx] = val.to_f\n elsif val.is_a?(String)\n row[idx] = val.force_encoding('UTF-8')\n end\n end\n end\n end\n end", "def get_float(key)\n get(key, \"f\")\n end", "def to_float\n (@numerador.to_f()/@denominador.to_f)\n end", "def to_f_with_method\n to_x_with_method.to_f\n end", "def float?\n @kind == :float_lit || @kind == :float_exp_lit\n end", "def float?\n self.class.float?(self)\n end", "def checked(value)\n value = zero() if value.respond_to?(:nan?) && value.nan?\n value = zero() if value.respond_to?(:infinity?) && value.infinity?\n value = zero() if value.nil?\n value = value.to_f if value.is_a? BigDecimal\n\n value\n end", "def float?(field)\n self.send(field).is_a? Float\n end", "def to_float_or_int(v)\n v.match('\\.').nil? ? Integer(v) : Float(v)\n end", "def apply_validations_for_decimal\n apply_validations_for_float\n end", "def __getobj__\n @float\n end", "def literal_float(value)\n if value.finite?\n super\n elsif value.nan?\n \"'NaN'\"\n elsif value.infinite? == 1\n \"'Infinity'\"\n else\n \"'-Infinity'\"\n end\n end", "def float?\n type == \"FLOAT\" || type == \"FLOAT64\"\n end", "def test_NilClass_InstanceMethod_to_f\n\t\tassert_equal(0.0, nil.to_f)\n\tend", "def to_builtin\n\t\treal? ? to_f : to_c\n\tend" ]
[ "0.6786891", "0.6606618", "0.64820707", "0.6433429", "0.6386626", "0.6277584", "0.6251534", "0.6250775", "0.6210805", "0.6210805", "0.6187229", "0.6184887", "0.61290574", "0.60851866", "0.605962", "0.6056973", "0.6056973", "0.6053664", "0.5966792", "0.5951107", "0.5951107", "0.59473604", "0.59430146", "0.59315544", "0.59292585", "0.59252036", "0.59252036", "0.59252036", "0.59252036", "0.5916911", "0.59086484", "0.59086484", "0.5906678", "0.5899732", "0.5874823", "0.5872459", "0.5870005", "0.5870005", "0.5870005", "0.58596444", "0.58550984", "0.58283687", "0.58244646", "0.58219844", "0.58111465", "0.58066595", "0.5805594", "0.5805594", "0.5802269", "0.5800264", "0.5778613", "0.5773337", "0.5762895", "0.5752598", "0.5712159", "0.57096934", "0.57096934", "0.57024086", "0.57011837", "0.5698764", "0.5698764", "0.5698764", "0.5698764", "0.5698159", "0.5695516", "0.5692948", "0.5692732", "0.56875026", "0.56875026", "0.56875026", "0.56875026", "0.5675106", "0.56654245", "0.56639963", "0.5660247", "0.56531185", "0.562576", "0.56018054", "0.5594632", "0.5581881", "0.5565208", "0.5565093", "0.5549625", "0.5548627", "0.55338734", "0.5533445", "0.5526131", "0.5498906", "0.54961544", "0.54954153", "0.5495368", "0.5479144", "0.5478662", "0.5476415", "0.5475377", "0.54741216", "0.54709125", "0.5469498", "0.5462686", "0.5452676" ]
0.57323474
54
Return datetime types as instances of Sequel.datetime_class
def datetime(s) @db.to_application_timestamp(s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datetime_classes\n [DateTime, Time, defined?(FmRest::StringDateTime) && FmRest::StringDateTime].compact.freeze\n end", "def convert_to_ruby_time_classes\n [Java::JavaSql::Timestamp, Java::JavaSql::Date]\n end", "def typecast_value_datetime(value)\n Sequel.typecast_to_application_timestamp(value)\n end", "def type_literal_generic_datetime(column)\n :datetime\n end", "def datetime_attributes\n name.constantize.columns.map do |column|\n next unless column.type == :datetime\n\n column.name.to_sym\n end.compact\n end", "def to_datetime()\n #This is a stub, used for indexing\n end", "def to_datetime string_or_datetime\n if string_or_datetime.is_a?(String)\n Sequel.string_to_datetime(string_or_datetime)\n else\n string_or_datetime\n end\n end", "def date_class\n ::DateTime\n end", "def to_sequel_time\n begin\n Sequel.datetime_class.parse(self)\n rescue => e\n raise Sequel::Error::InvalidValue, \"Invalid time value '#{self}' (#{e.message})\"\n end\n end", "def get_datetimes(row)\n mm, dd, yyyy = get_date(row, \"Date\")\n start_hh, start_mm = get_time(row, \"Start Time\")\n end_hh, end_mm = get_time(row, \"End Time\")\n [Time.local(yyyy, mm, dd, start_hh, start_mm), Time.local(yyyy, mm, dd, end_hh, end_mm)]\nend", "def to_datetime\n begin\n DateTime.parse(self)\n rescue => e\n raise Sequel::Error::InvalidValue, \"Invalid date value '#{self}' (#{e.message})\"\n end\n end", "def type_literal_generic_datetime(column)\n :timestamp\n end", "def datetime\n new(:datetime, DATE_TIME_REGEXP, lambda { |raw| Time.parse(raw).to_datetime })\n end", "def type\n 'Edm.DateTime'\n end", "def subtype\n self.datetime_type\n end", "def typecast_value_datetime(value)\n if convert_infinite_timestamps\n case value\n when *INFINITE_DATETIME_VALUES\n value\n else\n super\n end\n else\n super\n end\n end", "def to_sql\n self.to_datetime.to_sql\n \tend", "def set_time_as_datetime(options)\n options[:type] = DateTime if options[:type] == Time\n end", "def ruby_value\n to_datetime\n end", "def to_datetime\n ::DateTime.new(@year, @month, @day, @hour, @minute, @second)\n end", "def insert_timestamps\n timestamps = {}\n if model_class.columns.include?(:created_at)\n timestamps[:created_at] = Sequel.function(:NOW)\n end\n if model_class.columns.include?(:updated_at)\n timestamps[:updated_at] = Sequel.function(:NOW)\n end\n timestamps\n end", "def from_database_type(obj)\n case obj\n when String, Float, Integer, NilClass, TrueClass, FalseClass\n obj\n when java.sql.Date, java.sql.Time, java.sql.Timestamp\n Time.at(obj.time/1000)\n when java.sql.Blob\n String.from_java_bytes(obj.get_bytes(1,obj.length))\n when java.sql.Clob\n obj.get_sub_string(1, obj.length)\n when java.math.BigDecimal\n BigDecimal.new(obj.to_s)\n else\n raise \"Can't find correct type to convert #{obj.inspect} into\"\n end\n end", "def class_date_attributes_or_arguments\n @time_jawn_date_time_attributes || datetime_attributes\n end", "def to_datetime\n to_time.to_datetime\n end", "def type_cast(value, type)\n case value\n when Array\n value.collect { |v| type_cast(v, type) }\n else\n # Let's leverage ActiveRecord's type casting, so that casting is consistent\n # with the other models.\n column_for_type_cast = ::ActiveRecord::ConnectionAdapters::Column.new(\"\", nil)\n column_for_type_cast.instance_variable_set(:@type, type)\n value = column_for_type_cast.type_cast(value)\n Time.zone && value.is_a?(Time) ? value.in_time_zone : value\n end\n end", "def convert_row(row)\n return nil if row.nil?\n row.collect do |col|\n if col.is_a? ::ODBC::Date\n DBI::Date.new(col.year, col.month, col.day)\n elsif col.is_a? ::ODBC::Time\n DBI::Time.new(col.hour, col.minute, col.second)\n elsif col.is_a? ::ODBC::TimeStamp\n DBI::Timestamp.new(col.year, col.month, col.day,\n col.hour, col.minute, col.second, col.fraction)\n else\n col\n end\n end\n end", "def datetime(name, option={})\n option[:is_a] = :datetime\n register_attribute_member(name, option)\n define_attribute_accessor(name, option)\n define_validations(name, option)\n end", "def to_datetime\n self\n end", "def setup_type_convertor_map\n super\n @type_convertor_map[Java::JavaSQL::Types::INTEGER] = @type_convertor_map[Java::JavaSQL::Types::BIGINT]\n @basic_type_convertor_map[Java::JavaSQL::Types::INTEGER] = @basic_type_convertor_map[Java::JavaSQL::Types::BIGINT]\n @type_convertor_map[Java::JavaSQL::Types::DATE] = lambda do |r, i|\n if v = r.getString(i)\n Sequel.string_to_date(v)\n end\n end\n @type_convertor_map[Java::JavaSQL::Types::BLOB] = lambda do |r, i|\n if v = r.getBytes(i)\n Sequel::SQL::Blob.new(String.from_java_bytes(v))\n elsif !r.wasNull\n Sequel::SQL::Blob.new('')\n end\n end\n end", "def datetime?\n type == \"DATETIME\"\n end", "def typecast_value(column_type, value)\n return nil if value.nil?\n case column_type\n when :integer\n Integer(value)\n when :string\n value.to_s\n when :float\n Float(value)\n when :decimal\n case value\n when BigDecimal\n value\n when String, Float\n value.to_d\n when Integer\n value.to_s.to_d\n else\n raise ArgumentError, \"invalid value for BigDecimal: #{value.inspect}\"\n end\n when :boolean\n case value\n when false, 0, \"0\", /\\Af(alse)?\\z/i\n false\n else\n value.blank? ? nil : true\n end\n when :date\n case value\n when Date\n value\n when DateTime, Time\n Date.new(value.year, value.month, value.day)\n when String\n value.to_date\n else\n raise ArgumentError, \"invalid value for Date: #{value.inspect}\"\n end\n when :time\n case value\n when Time\n value\n when String\n value.to_time\n else\n raise ArgumentError, \"invalid value for Time: #{value.inspect}\"\n end\n when :datetime\n raise(ArgumentError, \"invalid value for #{tc}: #{value.inspect}\") unless value.is_one_of?(DateTime, Date, Time, String)\n if Sequel.datetime_class === value\n # Already the correct class, no need to convert\n value\n else\n # First convert it to standard ISO 8601 time, then\n # parse that string using the time class.\n (Time === value ? value.iso8601 : value.to_s).to_sequel_time\n end\n else\n value\n end\n end", "def convert_datetimes_intelligently!\n dt_attrs = @converted_headers.select { |obj| obj.match(/_(?:dt?|at|on)\\z/) }\n dt_idxs = dt_attrs.map { |obj| @converted_headers.find_index(obj) }\n\n spreadsheet.map! { |row|\n dt_idxs.each { |idx|\n to_convert = row[idx]\n row[idx] = to_convert.try(:to_datetime) || to_convert\n }\n row }\n end", "def parse_datetime_date(type, resource)\n year = resource[\"#{type}(1i)\"].to_i\n month = resource[\"#{type}(2i)\"].to_i\n day = resource[\"#{type}(3i)\"].to_i\n hour = resource[\"#{type}(4i)\"].to_i\n minute = resource[\"#{type}(5i)\"].to_i\n DateTime.new(year, month, day, hour, minute)\n end", "def create_datetime_options(attrs, method = nil)\n values = if (time = attrs[:value])\n case time\n when Time, DateTime\n { :day => time.day,\n :month => time.month,\n :year => time.year,\n :hour => time.hour,\n :minute => time.min }\n when Date\n { :day => time.day,\n :month => time.month,\n :year => time.year }\n end\n end\n\n datetime_options.inject({}) do |h, (suffix, defaults)|\n h[suffix] = defaults.merge(attrs).merge(\n :id => '%s_%s' % [attrs[:id] || attrs[:name], suffix],\n :name => '%s[%s]' % [attrs[:name] || attrs[:id], suffix],\n :value => values && values[suffix]\n ) ; h\n end\n end", "def bson_type\n ::Time::BSON_TYPE\n end", "def visit_date_time(binding_type)\n dt_str = DateTimeConverter.convert_from_datetime(input)\n self.result = binding_type.definition.new_value(dt_str)\n end", "def typecast_value_time(value)\n case value\n when Time\n if value.is_a?(SQLTime)\n value\n else\n # specifically check for nsec == 0 value to work around JRuby 1.6 ruby 1.9 mode bug\n SQLTime.create(value.hour, value.min, value.sec, (value.respond_to?(:nsec) && value.nsec != 0) ? value.nsec/1000.0 : value.usec)\n end\n when String\n Sequel.string_to_time(value)\n when Hash\n SQLTime.create(*[:hour, :minute, :second].map{|x| (value[x] || value[x.to_s]).to_i})\n else\n raise Sequel::InvalidValue, \"invalid value for Time: #{value.inspect}\"\n end\n end", "def apply_validations_for_datetime\n flex_column_class.validates_each field_name do |record, attr, value|\n record.errors.add(attr, \"must be a Time or DateTime\") if value && (! value.kind_of?(Time)) && (value.class.name != 'DateTime')\n end\n end", "def to_datetime\n @date_time_value\n end", "def visit_date_time(binding_type)\n self.result = binding_type.to_ruby(input)\n end", "def type\n 'Edm.Time'\n end", "def to_datetime\n ::DateTime.parse(self, false) unless blank?\n end", "def validates_as_datetime(*attr_names)\n configuration = { :message => \"attribute should be of type Time\" }\n validates_each(attr_names, configuration) do |record, attr_name, value|\n unless value.is_a?(Time)\n record.errors.add(attr_name, :invalid, :default => configuration[:message], :value => value)\n end\n end\n end", "def typecast_to_datetime(value)\n if value.kind_of?(Hash)\n typecast_hash_to_datetime(value)\n else\n DateTime.parse(value.to_s)\n end\n end", "def test_datetime2_truncate_usec_on_assigment_default_precision\n time = Time.parse('2018-12-31T23:59:21.341867923')\n record = DateTime2Types.new(my_datetime: time)\n\n assert_equal 23, record.my_datetime.hour\n assert_equal 59, record.my_datetime.min\n assert_equal 21, record.my_datetime.sec\n assert_equal 341_867, record.my_datetime.usec\n assert_equal 341_867_000, record.my_datetime.nsec\n end", "def select_datetime(datetime, options)\n select_date(datetime, options)\n select_time(datetime, options)\n end", "def timestamps(opts={})\n @attrs[:created_at] = Attributes::DatetimeAttr.new(:created_at, opts)\n @attrs[:updated_at] = Attributes::DatetimeAttr.new(:updated_at, opts)\n nil\n end", "def type_cast_for_schema(value) # :nodoc:\n case value\n when 'toDate(now()', 'CAST(now() AS Date)'\n 'now()'.inspect\n else\n value.inspect\n end\n end", "def to_a\n return [@t_year, @t_month, @t_day, @t_hour, @t_min, @t_sec, @t_usec]\n end", "def convert_datetime(date_symbol_or_string)\n attribute = date_symbol_or_string.to_s\n return nil if self[attribute + '(1i)'].nil? || self[attribute + '(2i)'].nil? || self[attribute + '(3i)'].nil? || self[attribute + '(4i)'].nil? || self[attribute + '(5i)'].nil? \n return Time.local(self[attribute + '(1i)'].to_i, self[attribute + '(2i)'].to_i, self[attribute + '(3i)'].to_i, self[attribute + '(4i)'].to_i, self[attribute + '(5i)'].to_i) \n end", "def to_bson\n #----------\n Time.utc( self.year, self.month, self.day )\n end", "def to_datetime(val)\n case val\n when String\n Time.parse(val)\n when Fixnum\n Time.at(val)\n else raise \"Could not parse #{val.inspect} as Time\"\n end\n end", "def coerce_datetime(datetime_string)\n case datetime_string\n when /^(\\d{4}-\\d{2}-\\d{2})$/\n datetime_string\n when /^(\\d{4}-\\d{2}-\\d{2})/\n datetime = datetime_escape(datetime_string)\n datetime.strftime(Sparkql::FunctionResolver::STRFTIME_DATE_FORMAT)\n else\n datetime_string\n end\n end", "def type_literal_generic_time(column)\n column[:only_time] ? :time : :datetime\n end", "def datetime_field(object_name, method, options = T.unsafe(nil)); end", "def format_datetime\n if @opts[:as] == :select\n values = {}\n if v = @attr[:value]\n v = DateTime.parse(v) unless v.is_a?(Time) || v.is_a?(DateTime)\n values[:year], values[:month], values[:day], values[:hour], values[:minute], values[:second] = v.year, v.month, v.day, v.hour, v.min, v.sec\n end\n _format_date_select(values, @opts[:order] || DEFAULT_DATETIME_ORDER)\n else\n _format_input('datetime-local')\n end\n end", "def to_datetime\n ::DateTime.civil(year, month, day, hour, min, sec, Rational(utc_offset, 86400), 0)\n end", "def datetime(key, options = {})\n before_all(key, options)\n begin; store(key, ->(item){DateTime.parse(item.to_s)} , options); rescue; raise_type_error(key, \"DateTime\"); end\n end", "def result\n map_value(converted_value: RDF::Literal.new(\n value.value,\n datatype: PermissiveSchema.valkyrie_datetime\n ))\n end", "def timestamps\n c = datetime_attr :created_at\n u = datetime_attr :updated_at\n [c, u]\n end", "def type_literal_generic_date(column)\n :date\n end", "def typecast(value)\n if value.kind_of?(Range) then Range.new(typecast(value.first), typecast(value.last))\n elsif value.kind_of?(Array) then value.map{|v| typecast(v)}\n elsif primitive == BigDecimal then super(value).to_f\n elsif primitive == DateTime then Time.parse(super(value).to_s).to_i\n elsif primitive == Date then Time.parse(super(value).to_s).to_i\n elsif primitive == Time then super(value).to_i\n else\n super(value) # Good luck\n end\n end", "def fetch\n row = @result.fetch\n return row unless @bind_result\n row.zip(@bind_result).map do |col, type|\n if col.nil?\n nil\n elsif [Numeric, Integer, Fixnum].include? type\n col.to_i\n elsif type == String\n col.to_s\n elsif type == Float && !col.is_a?(Float)\n col.to_i.to_f\n elsif type == Mysql::Time && !col.is_a?(Mysql::Time)\n if col.to_s =~ /\\A\\d+\\z/\n i = col.to_s.to_i\n if i < 100000000\n y = i/10000\n m = i/100%100\n d = i%100\n h, mm, s = 0\n else\n y = i/10000000000\n m = i/100000000%100\n d = i/1000000%100\n h = i/10000%100\n mm= i/100%100\n s = i%100\n end\n if y < 70\n y += 2000\n elsif y < 100\n y += 1900\n end\n Mysql::Time.new(y, m, d, h, mm, s)\n else\n Mysql::Time.new\n end\n else\n col\n end\n end\n end", "def typecast_attributes\n @attributes.each_pair do |name,value|\n # skip primary key columns\n # ajay Singh --> skip the loop if attribute is null (!name.present?)\n next if (name == \"id\") or (!name.present?)\n attr_type = attr_type_for(name)\n \n # empty attributes should stay empty (e.g. an empty int field shouldn't be typecast as 0)\n if [:datetime, :datetimecombo, :int].include? attr_type && (value.nil? || value == '')\n @attributes[name] = nil\n next\n end\n \n case attr_type\n when :bool\n @attributes[name] = (value == \"1\")\n when :datetime, :datetimecombo\n begin\n @attributes[name] = DateTime.parse(value)\n rescue\n @attributes[name] = value\n end\n when :int\n @attributes[name] = value.to_i\n end\n end\n @attributes\n end", "def date_classes\n [Date, defined?(FmRest::StringDate) && FmRest::StringDate].compact.freeze\n end", "def typecast_hash_to_datetime(value)\n DateTime.new(*extract_time(value))\n end", "def to_datetime(dt)\n return nil if dt.nil?\n dt = Time.at(dt) if dt.is_a? Integer\n case dt\n when DateTime then dt\n when ::Date then DateTime.new(dt.year, dt.month, dt.day, 0, 0, 0)\n when Time then DateTime.new(dt.year, dt.month, dt.day, dt.hour, dt.min, dt.sec)\n when String then DateTime.parse(dt)\n else\n if dt.is_a? ::Date\n dt = DateTime.new(dt.year, dt.month, dt.day, 0, 0, 0)\n else\n raise ArgumentError, \"unknown input datetime format: #{dt.class.to_s} (#{dt.to_s})\"\n end\n end\n end", "def dbms_type_cast(columns, rows)\n # Cast the values to the correct type\n columns.each_with_index do |column, col_index|\n #puts \" #{column.name} type #{column.type} length #{column.length} nullable #{column.nullable} scale #{column.scale} precision #{column.precision} searchable #{column.searchable} unsigned #{column.unsigned}\"\n rows.each do |row|\n value = row[col_index]\n\n new_value = case\n when value.nil?\n nil\n when [ODBC::SQL_CHAR, ODBC::SQL_VARCHAR, ODBC::SQL_LONGVARCHAR].include?(column.type)\n # Do nothing, because the data defaults to strings\n # This also covers null values, as they are VARCHARs of length 0\n value.is_a?(String) ? value.force_encoding(\"UTF-8\") : value\n when [ODBC::SQL_DECIMAL, ODBC::SQL_NUMERIC].include?(column.type)\n column.scale == 0 ? value.to_i : value.to_f\n when [ODBC::SQL_REAL, ODBC::SQL_FLOAT, ODBC::SQL_DOUBLE].include?(column.type)\n value.to_f\n when [ODBC::SQL_INTEGER, ODBC::SQL_SMALLINT, ODBC::SQL_TINYINT, ODBC::SQL_BIGINT].include?(column.type)\n value.to_i\n when [ODBC::SQL_BIT].include?(column.type)\n value == 1\n when [ODBC::SQL_DATE, ODBC::SQL_TYPE_DATE].include?(column.type)\n value.to_date\n when [ODBC::SQL_TIME, ODBC::SQL_TYPE_TIME].include?(column.type)\n value.to_time\n when [ODBC::SQL_DATETIME, ODBC::SQL_TIMESTAMP, ODBC::SQL_TYPE_TIMESTAMP].include?(column.type)\n value.to_datetime\n # when [\"ARRAY\"?, \"OBJECT\"?, \"VARIANT\"?].include?(column.type)\n # TODO: \"ARRAY\", \"OBJECT\", \"VARIANT\" all return as VARCHAR\n # so we'd need to parse them to make them the correct type\n\n # As of now, we are just going to return the value as a string\n # and let the consumer handle it. In the future, we could handle\n # if here, but there's not a good way to tell what the type is\n # without trying to parse the value as JSON as see if it works\n # JSON.parse(value)\n when [ODBC::SQL_BINARY].include?(column.type)\n # These don't actually ever seem to return, even though they are\n # defined in the ODBC driver, but I left them in here just in case\n # so that future us can see what they should be\n value\n else\n # the use of @connection.types() results in a \"was not dropped before garbage collection\" warning.\n raise \"Unknown column type: #{column.type} #{@connection.types(column.type).first[0]}\"\n end\n\n row[col_index] = new_value\n end\n end\n rows\n end", "def test_datetime2_truncate_usec_on_assigment_precision_0\n time = Time.parse('2018-12-31T23:59:21.341867')\n record = DateTime2Types.new(my_datetime_alt: time)\n\n assert_equal 23, record.my_datetime_alt.hour\n assert_equal 59, record.my_datetime_alt.min\n assert_equal 21, record.my_datetime_alt.sec\n assert_equal 0, record.my_datetime_alt.usec\n assert_equal 0, record.my_datetime_alt.nsec\n end", "def timestamps\n column(:created_at, :datetime)\n column(:updated_at, :datetime)\n end", "def mongoize\n ret = { kind: kind }\n self.class.attribute_types.each do |name, type|\n value = send(name)\n next unless value\n\n case type.type\n when :string\n value = ::String.mongoize(value)\n when :integer\n value = ::Integer.mongoize(value)\n when :datetime\n value = ::DateTime.mongoize(value)\n end\n\n ret[name] = value\n end\n ret\n end", "def convert(t, dtype)\n dtype.each do |col, type|\n if type == Integer \n t[col] = t[col].map{|v| v.to_i unless v.nil?}\n elsif type == Float\n t[col] = t[col].map{|v| v.to_f unless v.nil?}\n elsif type == String\n t[col] = t[col].map{|v| v.to_s unless v.nil?}\n elsif type == DateTime\n t[col] = t[col].map do |dt|\n begin\n DateTime.parse dt.to_s\n rescue => exception\n end\n end\n elsif type == Date\n t[col] = t[col].map do |dt|\n begin\n Date.parse dt.to_s\n rescue => exception\n end\n end\n else\n throw \"Unsupported dtype '#{type}'\"\n end\n end\n end", "def typecast_value_date(value)\n case value\n when DateTime, Time\n Date.new(value.year, value.month, value.day)\n when Date\n value\n when String\n Sequel.string_to_date(value)\n when Hash\n Date.new(*[:year, :month, :day].map{|x| (value[x] || value[x.to_s]).to_i})\n else\n raise InvalidValue, \"invalid value for Date: #{value.inspect}\"\n end\n end", "def to_datetime(secs)\n DateTime.parse(Time.at(secs).to_s)\n end", "def get_3339_datetime_array\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/3339datetime'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'array' => 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 _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n decoded.map { |element| DateTimeHelper.from_rfc3339(element) }\n end", "def to_datetime\n # Thread-safety: It is possible that the value of @datetime may be \n # calculated multiple times in concurrently executing threads. It is not \n # worth the overhead of locking to ensure that @datetime is only \n # calculated once.\n \n unless @datetime\n # Avoid using Rational unless necessary.\n u = usec\n s = u == 0 ? sec : Rational(sec * 1000000 + u, 1000000)\n result = RubyCoreSupport.datetime_new(year, mon, mday, hour, min, s)\n return result if frozen?\n @datetime = result\n end\n \n @datetime\n end", "def select_datetime(datetime = Time.now, options = {})\r\n # include_blank not allowed!\r\n options.delete(:include_blank)\r\n order = options.delete(:order) || DEFAULT_DATETIME_ORDER.dup\r\n # Make sure it includes :ampm if 12-hour and vice-versa\r\n (options[:twelve_hour] = true) if order.include?(:ampm)\r\n (order << :ampm) if options[:twelve_hour] && !order.include?(:ampm)\r\n \r\n outstring = \"\"\r\n # Call the non-instanced helpers in order\r\n select_by_key = Proc.new { |key| self.send(\"select_#{key.to_s}\", datetime, cleanoptions(options, key)) }\r\n for key in order\r\n if key.is_a?(Symbol)\r\n outstring << select_by_key.call(key) rescue outstring << key.to_s\r\n else\r\n outstring << key.to_s \r\n end\r\n end\r\n outstring\r\n end", "def klass\n case type\n when :integer, :long then Fixnum\n when :float then Float\n when :double then BigDecimal\n when :timestamp, :time, :datetime then Time\n when :date then Date\n when :text, :string, :binary, :ascii then String\n when :boolean then Object\n when :uuid then ::Cql::TimeUuid\n when :list then DatastaxRails::Types::DynamicList\n when :set then DatastaxRails::Types::DynamicSet\n when :map then DatastaxRails::Types::DynamicMap\n end\n end", "def to_db(value)\n value = value.new_offset(0) if value.respond_to?(:new_offset)\n\n args = [value.year, value.month, value.day]\n args += (value.class == Date ? [0, 0, 0] : [value.hour, value.min, value.sec])\n\n Time.utc(*args).to_i\n end", "def timestamps(options = {})\n attribute(:created_at, options.update(type: :timestamp))\n attribute(:updated_at, options.update(type: :timestamp))\n end", "def datetime(key, opts={})\n @attrs[key.to_sym] = Attributes::DatetimeAttr.new(key, opts)\n end", "def typecast_to_datetime(value)\n if value.is_a?(Hash)\n typecast_hash_to_datetime(value)\n else\n DateTime.parse(value.to_s)\n end\n rescue ArgumentError\n nil\n end", "def type_literal_generic_only_time(column)\n :time\n end", "def datetime_convert(v)\n case v\n when nil, 0 then nil\n when Numeric then day_convert(v)\n when IsoYear then day_convert(v)\n when IsoDay then day_convert(v)\n when IsoDate then v.to_s\n when START_PATTERN[:complete] then datetime_clean($1)\n when START_PATTERN[:day] then $1\n when START_PATTERN[:year] then day_convert(v)\n else datetime_parse(v)\n end\n end", "def from_formotion!(data)\n self.returnable_columns.each{|column|\n if data[column] && column_type(column) == :date || column_type(column) == :time\n data[column] = Time.at(data[column]) unless data[column].nil?\n end\n value = self.send(\"#{column}=\", data[column])\n }\n end", "def type_to_sql(*args); connection.type_to_sql(*args); end", "def initialize_fields_by_type\n database_field_names.each do |field|\n field_info = self.class.get_table_info.select {|hash| hash[\"name\"] == field}.first\n initialize_to_correct_date_type(field_info, field) \n end\n end", "def convert_to_ruby_types(hash) \n hash.keys.each do |key|\n value = hash[key]\n next unless value # Leave nils as nils\n case key\n when 'uid', 'aid'; hash[key] = value.to_i\n when 'created_at'; hash[key] = DateTime.parse(value)\n when 'deleted'; hash[key] = value == 't'\n when 'value'; hash[key] = BigDecimal.new(value)\n when 'count'; hash[key] = value.to_i\n when 'period'\n value =~ /\"(.*?)\",\"(.*?)\"/\n hash[key] = [DateTime.parse($1), DateTime.parse($2)]\n end\n end\n hash\nend", "def typecast_value_date(value)\n if convert_infinite_timestamps\n case value\n when *INFINITE_DATETIME_VALUES\n value\n else\n super\n end\n else\n super\n end\n end", "def type_literal_generic_time(column)\n if column[:only_time]\n type_literal_generic_only_time(column)\n else\n type_literal_generic_datetime(column)\n end\n end", "def to_datetime\n # Thread-safety: It is possible that the value of @datetime may be\n # calculated multiple times in concurrently executing threads. It is not\n # worth the overhead of locking to ensure that @datetime is only\n # calculated once.\n\n unless @datetime\n # Avoid using Rational unless necessary.\n u = usec\n s = u == 0 ? sec : Rational(sec * 1000000 + u, 1000000)\n @datetime = DateTime.new(year, mon, mday, hour, min, s, OffsetRationals.rational_for_offset(offset))\n end\n\n @datetime\n end", "def to_datetime\n # Thread-safety: It is possible that the value of @datetime may be\n # calculated multiple times in concurrently executing threads. It is not\n # worth the overhead of locking to ensure that @datetime is only\n # calculated once.\n\n unless @datetime\n # Avoid using Rational unless necessary.\n u = usec\n s = u == 0 ? sec : Rational(sec * 1000000 + u, 1000000)\n @datetime = DateTime.new(year, mon, mday, hour, min, s, OffsetRationals.rational_for_offset(offset))\n end\n\n @datetime\n end", "def dbms_type_cast(columns, values)\n int_column = {}\n columns.each_with_index do |c, i|\n int_column[i] = c.type == 3 && c.scale == 0\n end\n\n float_column = {}\n columns.each_with_index do |c, i|\n float_column[i] = c.type == 3 && c.scale != 0\n end\n\n values.each do |row|\n row.each_index do |idx|\n val = row[idx]\n if val\n if int_column[idx]\n row[idx] = val.to_i\n elsif float_column[idx]\n row[idx] = val.to_f\n elsif val.is_a?(String)\n row[idx] = val.force_encoding('UTF-8')\n end\n end\n end\n end\n end", "def cast_types; end", "def get_datetime_array\n # the base uri for api requests\n _query_builder = Configuration.base_uri.dup\n\n # prepare query string for API call\n _query_builder << '/response/datetime'\n\n # process optional query parameters\n _query_builder = APIHelper.append_url_with_query_parameters _query_builder, {\n 'array' => true\n }\n\n # validate and preprocess url\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'user-agent' => 'Stamplay SDK',\n 'accept' => 'application/json'\n }\n\n # Create the HttpRequest object for the call\n _http_request = @http_client.get _query_url, headers: _headers\n \n # Call the on_before_request callback\n @http_call_back.on_before_request(_http_request) if @http_call_back\n\n # Invoke the API call and get the response\n _response = @http_client.execute_as_string(_http_request)\n\n # Call the on_after_response callback\n @http_call_back.on_after_response(_response) if @http_call_back\n\n # Endpoint error handling using HTTP status codes.\n if _response.status_code == 404\n return nil\n end\n\n # Global error handling using HTTP status codes.\n validate_response(_response)\n\n # Return appropriate response type\n decoded = APIHelper.json_deserialize(_response.raw_body)\n return decoded.map{|element| DateTime.iso8601(element)}\n end", "def dbd_types (model,model_attributes)\n #hard coded mapping look mapping table\n mapping = Hash[ \"binary\"=>\"base64Binary\",\"boolean\"=>\"boolean\",\"date\"=>\"date\",\"datetime\"=>\"dateTime\",\"decimal\"=>\"decimal\",\"float\"=>\"float\",\"integer\"=>\"integer\",\"string\"=>\"string\",\"text\"=>\"string\",\"time\"=>\"time\",\"timestamp\"=>\"dateTime\",]\n dtypes = Hash.new\n model.columns_hash.each_key do |m|\n #make xsd datatye\n dtypes[m.to_s] =\"xsd:#{mapping[model.columns_hash[m].type.to_s] }\"\n end\n #replace mapping\n model_attributes.each do |k,v|\n dtypes[k.to_s]=dtypes[v.to_s]\n end\n dtypes\n end", "def datetime_attr name, options = {}\n add_attribute(DateTimeAttribute.new(name, options))\n end", "def types\n must_be_open!\n @columns.map(&:last)\n end", "def get_unix_date_time_array\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/response/unixdatetime'\n _query_builder = APIHelper.append_url_with_query_parameters(\n _query_builder,\n 'array' => 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 _response = execute_request(_request)\n\n # Validate response against endpoint and global error codes.\n return nil if _response.status_code == 404\n validate_response(_response)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n decoded.map { |element| DateTimeHelper.from_unix(element) }\n end", "def typecast_to_primitive(value)\n \n if value.kind_of?(::DateTime)\n result = value.to_time\n else\n result = ::DateTime.parse(value.to_s).to_time \n end\n \n return result\n \n rescue ArgumentError\n value\n end", "def type_cast_code( var_name )\n case type \n when :datetime then \"#{self.class.name}.datetime_to_time(#{var_name})\"\n else\n super\n end\n end" ]
[ "0.69144017", "0.66842693", "0.65414476", "0.65162", "0.64956695", "0.63690585", "0.6348501", "0.6334922", "0.62061596", "0.60849583", "0.6074508", "0.5995087", "0.5943269", "0.58665824", "0.57891005", "0.5715284", "0.57107157", "0.5675761", "0.5662952", "0.5618169", "0.5593688", "0.5566192", "0.5542662", "0.5539683", "0.55389816", "0.5532808", "0.5515592", "0.5471733", "0.54194725", "0.53924346", "0.537791", "0.53615916", "0.53091294", "0.5307427", "0.52963364", "0.5271836", "0.52683276", "0.5268322", "0.5255005", "0.52352816", "0.5224534", "0.5218624", "0.5211627", "0.51914424", "0.5183755", "0.51833665", "0.5168103", "0.5165597", "0.51601267", "0.5157407", "0.51486504", "0.5146279", "0.5141053", "0.5140361", "0.51372445", "0.5129698", "0.51251113", "0.51201725", "0.51126057", "0.5109497", "0.51026094", "0.50978976", "0.5087444", "0.5070034", "0.50696343", "0.5058696", "0.50562125", "0.5050921", "0.50164926", "0.49851042", "0.49777144", "0.4967713", "0.49626657", "0.49626297", "0.4956406", "0.49242303", "0.49206045", "0.49104944", "0.48852858", "0.4884281", "0.48710743", "0.48637098", "0.48627067", "0.4858286", "0.48551598", "0.48504323", "0.48356333", "0.4832236", "0.48275906", "0.48231006", "0.4822578", "0.4822578", "0.48153922", "0.48045877", "0.48011068", "0.47941732", "0.47874677", "0.47850382", "0.47848347", "0.47771594", "0.47730914" ]
0.0
-1
Don't raise an error if the value is a string and the declared type doesn't match a known type, just return the value.
def result_value_of(declared_type, value) if value.is_a?(::Amalgalite::Blob) SQL::Blob.new(value.to_s) elsif value.is_a?(String) && declared_type (meth = self.class.sql_to_method(declared_type.downcase)) ? send(meth, value) : value else super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value?(value) value.is_a?(String) end", "def check_value!(value)\n # Allow nil and Strings to fall back on the validations for typecasting\n case value\n when nil, String, expected_type\n value\n else\n raise TypeError, \"#{@name} expected #{expected_type.inspect} but got #{value.inspect}\"\n end\n end", "def expect_string name, value\n expect_type name,\n value, \n \"string\",\n String\n end", "def string(value)\n message = \"Invalid typeface: must be a string\"\n raise ArgumentError, message unless value.is_a?(String)\n end", "def coerce str\n return str if Kiwi::Validator === self.type || self.type === str\n\n str = str.to_s.strip\n rule = Kiwi.input_types[self.type]\n raise TypeError, \"Can't coerce #{str.class} into #{self.type}\" unless rule\n\n rule.respond_to?(:call) ? rule.call(str) : str.__send__(rule)\n end", "def expected_type\n 'string'\n end", "def require_string(value)\n if value.nil? == true || value.to_s.empty?\n log_error_and_raise(\"expected string value, got nil or empty string\")\n end\n\n if value.is_a?(String) != true\n log_error_and_raise(\"expected string value, got #{value.class}, #{value.inspect}\")\n end\n\n end", "def typecast(value)\n return value if type === value || (value.nil? && type != TrueClass)\n\n if type == TrueClass then %w[ true 1 t ].include?(value.to_s.downcase)\n elsif type == String then value.to_s\n elsif type == Float then value.to_f\n elsif type == Fixnum then value.to_i\n elsif type == BigDecimal then BigDecimal(value.to_s)\n elsif type == DateTime then DateTime.parse(value.to_s)\n elsif type == Date then Date.parse(value.to_s)\n elsif type == Class then find_const(value)\n end\n end", "def convert_to_data_type_from_string(type, value)\n case type\n when \"boolean\"\n # Since we've determined this is a boolean data type, we can assume that:\n # If the value as an int is 1, return true\n # If the value as an int is 0 (not 1), return false\n value.to_i == 1\n when \"integer\"\n value.to_i\n when \"float\"\n value.to_f\n when \"string\", \"dictionary\"\n value\n when nil\n \"\"\n else\n raise \"Unknown or unsupported data type: #{type.class}\"\n end\n end", "def typecast_value_string(value)\n case value\n when Hash, Array\n raise Sequel::InvalidValue, \"invalid value for String: #{value.inspect}\"\n else\n value.to_s\n end\n end", "def cast_value(val)\n raise ArgumentError.new(\"Your value is not a String! (it's a #{val.class})\") if val.class != String && val.class != TrueClass && val.class != FalseClass\n \n if (Float val rescue false)\n Float val\n elsif (Integer val rescue false)\n Integer val\n elsif val =~ /^true$/i || val == true\n true\n elsif val =~ /^false$/i || val == false\n false\n else\n val\n end\n end", "def try(text)\n type.coerce(text) if match?(text)\n end", "def only_with_a_string(value)\r\n if value.is_a?(String)\r\n yield(value)\r\n return self\r\n else\r\n raise ArgumentError, 'only string values are accepted'\r\n end\r\n end", "def cast_with_string(object, type)\n object.is_a?(::String) ? :string : cast_without_string(object, type)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end", "def string_or_numeric!(v)\n case v\n when ''\n nil\n when String, Numeric\n true\n else\n raise Error, \"unexpected value received: #{v.inspect}\"\n end\n end", "def string_value(value)\r\n value\r\n end", "def datatype_extract(valid_types, value)\n valid_types.find do |type|\n begin\n return type.parse(value) if type.respond_to?(:parse)\n rescue ArgumentError\n end\n end\n nil\n end", "def type(value)\n _type(value) or fail ArgumentError, \"Unknown value for type: #{value}\"\n end", "def type(value)\n _type(value) or fail ArgumentError, \"Unknown value for type: #{value}\"\n end", "def to_type(str)\n if str && type && !mapping\n send(\"parse_#{type}\", str)\n elsif str && mapping && mapping.values.map(&:to_s).include?(str)\n mapping.find { |_, v| v.to_s == str.to_s }[0]\n else\n str\n end\n end", "def string_check(arg)\n return arg if arg.is_a?(String)\n return arg.send(:to_str) if arg.respond_to?(:to_str, true) # MRI honors it, even if private\n return arg.to_path if arg.respond_to?(:to_path)\n raise TypeError\n end", "def prepare_value(value)\n return value if value.nil? || value.is_a?(String)\n\n value.to_s\n end", "def validate_string(value)\n raise CustomErrors::FilterArgumentError, 'Value must be a string' unless value.is_a?(String)\n end", "def convert_string_value(property_value, property_type)\n return nil if property_value.nil?\n errmsg = \"Invalid property value (#{property_value}) for type (#{property_type})\"\n case property_type\n when 'INT'\n raise errmsg unless property_value =~ /^-?[0-9]+$/\n property_value.to_i\n when 'FLOAT'\n raise errmsg unless property_value =~ /^[+-]?[0-9]+\\.?[0-9]*([Ee][+-]?[0-9]+)?$/\n property_value.to_f\n when 'BOOL'\n raise errmsg unless %w(0 1).include? property_value\n property_value == \"1\"\n when 'DATE'\n begin\n Date.parse(property_value)\n rescue => e\n raise (errmsg + \": \" + e.message)\n end\n when 'TIMESTAMP'\n begin\n DateTime.parse(property_value)\n rescue => e\n raise (errmsg + \": \" + e.message)\n end\n when 'STRING'\n property_value.to_s\n else\n raise \"Unknown property type: #{property_type}\"\n end\n end", "def is_string?(); @type == GRT_STRING; end", "def should_be_string(data)\n if data.class != String\n raise \"Data needs to be a string; you passed in a #{data.class}: #{data}\"\n end\n end", "def string(value = '')\n return '' unless present?(value)\n\n send(value)\n rescue NoMethodError\n ''\n end", "def determine_dataype(value)\n return validate_field(value)\n end", "def is_strtype?(); @type == GRT_STRTYPE; end", "def to_type\n case @cfg.type_name\n when :bool\n bool_from_str(@str.downcase)\n when :int, :positive_int, :unsigned_int\n raise exc unless valid_int_str?(cleaned_num_str)\n cleaned_num_str.to_i\n when :float\n raise exc unless valid_float_str?(cleaned_num_str)\n cleaned_num_str.to_f\n when :string\n @str\n when :symbol\n @str.to_sym\n when :int_array, :positive_int_array, :unsigned_int_array\n ints_from_csv_str\n # add more _array types!\n when :float_array\n floats_from_csv_str\n else\n raise ConfigError, \"Type not yet supported: #{@cfg.type_name}.\"\n end\n end", "def typecaster(val, type)\n case type.to_sym\n when :string then val.to_s\n when :integer then val.to_i\n else\n raise \"Typecaster: i don't know this type: #{type}.\"\n end\n end", "def string?\n type == \"STRING\"\n end", "def convert_value(val)\n case basic_type\n when nil\n val\n when /^str/i\n (val.nil? or val.empty?) ? nil : val\n when /^bool/i\n if val.is_a?(TrueClass) or val.is_a?(FalseClass)\n val\n elsif val.is_a?(String)\n !!(['1', 't', 'T'].include?(val))\n elsif val.is_a?(Numeric)\n !!val.nonzero?\n else\n val\n end\n when /^int/i\n val.to_i\n else\n val\n end\n end", "def value_field\n \"string\"\n end", "def string(string)\n Types::String.cast(string)\n end", "def wrong_type_error(value, data_name, expected_type)\n \"#{data_name} was of wrong type, expected #{expected_type} and the value was #{value}\"\n end", "def auto_convert_value(value)\n return nil if value.nil?\n\n if data_type == Array\n return value.split(',') if value.kind_of?(String)\n elsif data_type == Integer\n return value.to_i if value.to_i.to_s == value.to_s\n elsif data_type == Float\n return value.to_f if value.to_f.to_s == value.to_s\n elsif allow_shell_conversion\n return value.shelljoin if value.kind_of?(Array)\n return value.map { |k, v| \"#{k.to_s.shellescape}=#{v.shellescape}\" }.join(' ') if value.kind_of?(Hash)\n elsif data_type == Hash && value.kind_of?(String)\n begin\n parsed = JSON.parse(value)\n return parsed if parsed.kind_of?(Hash)\n rescue JSON::ParserError\n end\n elsif data_type != String\n # Special treatment if the user specified true, false or YES, NO\n # There is no boolean type, so we just do it here\n if %w(YES yes true TRUE).include?(value)\n return true\n elsif %w(NO no false FALSE).include?(value)\n return false\n end\n end\n # rubocop:enable Metrics/PerceivedComplexity\n\n return value # fallback to not doing anything\n end", "def type *val\n return @chars_allowed if val.empty?\n\n dtype = val[0]\n #return self if @chars_allowed # disallow changing\n if dtype.is_a? Regexp \n @chars_allowed = dtype\n return self\n end\n dtype = dtype.to_s.downcase.to_sym if dtype.is_a? String\n case dtype # missing to_sym would have always failed due to to_s 2011-09-30 1.3.1\n when :integer, Integer\n @chars_allowed = /\\d/\n when :numeric, :float, Numeric, Float\n @chars_allowed = /[\\d\\.]/ \n when :alpha\n @chars_allowed = /[a-zA-Z]/ \n when :alnum\n @chars_allowed = /[a-zA-Z0-9]/ \n else\n raise ArgumentError, \"Field type: invalid datatype specified. Use :integer, :numeric, :float, :alpha, :alnum \"\n end\n self\n end", "def string?\n data_type == String\n end", "def type_cast(value, type)\n return nil if value.nil?\n case type\n when :string then value\n when :text then value\n when :money then string_to_money(value)\n when :integer then value.to_i rescue value ? 1 : 0\n when :float then value.to_f\n when :datetime then string_to_time(value)\n when :timestamp then string_to_time(value)\n when :time then string_to_dummy_time(value)\n when :date then string_to_date(value)\n when :boolean then value_to_boolean(value)\n else value\n end\n end", "def typecast_to_primitive(value)\n DataMapper::Ext::Module.find_const(model, value.to_s)\n rescue NameError\n value\n end", "def clean_value(value)\n case value\n when Symbol then value.to_s\n when TrueClass then 1\n when FalseClass then 0\n when /^\\d+$/ then value.to_i # Integer\n when /^\\d+(\\.\\d+)?([eE]\\d+)?$/ then value.to_f # Float\n when blank? then nil\n else value\n end \n end", "def datatype(value)\n _datatype(value) or fail ArgumentError, \"Unknown value for datatype: #{value}\"\n end", "def check_type(type, value)\n return unless type && value && !value.is_a?(type)\n\n \"should be of type #{type} but is of type #{value.class}\"\n end", "def check_and_set_string_type\n key = self.key.to_sym\n if KEY_TO_STRING_OPTIONS.key?(key)\n # If there are explicit string options, match the value to one of them.\n matched = false\n options = KEY_TO_STRING_OPTIONS[key]\n options.each do |opt|\n if Metadatum.str_to_basic_chars(text_raw_value) == Metadatum.str_to_basic_chars(opt)\n # Ex: Match 'neb ultra-iifs dna' to 'NEB Ultra II FS DNA'\n # Ex: Match '30-day mortality' to \"30 Day Mortality\"\n self.text_validated_value = opt\n matched = true\n break\n end\n end\n unless matched\n errors.add(:text_raw_value, \"#{text_raw_value} did not match options #{options.join(', ')}\")\n end\n else\n self.text_validated_value = text_raw_value\n end\n end", "def type_cast(value)\n case type\n when 'N' # number\n unpack_number(value)\n when 'I' # integer\n unpack_unsigned_long(value)\n when 'F' # float\n unpack_float(value)\n when 'D' # date\n decode_date(value)\n when 'T' # datetime\n decode_datetime(value)\n when 'L' # logical\n boolean(value)\n else\n value.to_s.strip\n end\n end", "def typecast(value)\n return type.typecast(value, self) if type.respond_to?(:typecast)\n return value if value.kind_of?(primitive) || value.nil?\n begin\n # TODO: optimize this using a Hash lookup table\n if primitive == Integer\n # only typecast a String that looks like a number\n value.to_s =~ /\\A(-?(?:0+|[1-9]\\d*)(?:\\.\\d+)?)\\z/ ? $1.to_i : value\n elsif primitive == String then value.to_s\n elsif primitive == TrueClass then %w[ true 1 t ].include?(value.to_s.downcase)\n elsif primitive == BigDecimal then BigDecimal(value.to_s)\n elsif primitive == Float then value.to_f\n elsif primitive == DateTime then typecast_to_datetime(value)\n elsif primitive == Time then typecast_to_time(value)\n elsif primitive == Date then typecast_to_date(value)\n elsif primitive == Class then self.class.find_const(value)\n else\n value\n end\n rescue\n value\n end\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n ResultType.send(:new, 'UNKNOWN', value)\n end", "def check_type(val, type)\n if val.class != type\n raise TypeError\n end\nend", "def parse_value(val, type)\n return nil if val.nil? || val.to_s.strip == ''\n \n case type\n when :raw then\n val\n \n when :string then\n if val.is_a?(Float)\n # Sometimes float values come in for \"integer\" columns from Excel,\n # so if the user asks for a string, strip off that \".0\" if present\n val.to_s.gsub(/\\.0+$/, '')\n else\n # Strip whitespace and we're good to go\n val.to_s.strip\n end\n \n when :integer, :int then \n if val.class < Numeric\n # If numeric, verify that there's no decimal places to worry about\n if (val.to_f % 1.0 == 0.0)\n val.to_i\n else\n nil\n end\n else \n # Convert to string, strip off trailing decimal zeros\n val = val.to_s.strip.gsub(/\\.0*$/, '')\n if val.integer?\n val.to_i\n else\n nil\n end\n end\n \n when :float then\n if val.class < Numeric\n val.to_f\n else \n # Clean up then verify it matches a valid float format & convert\n val = val.to_s.strip\n if val.match(/\\A-?[0-9]+(?:\\.[0-9]+)?\\z/)\n val.to_f\n else\n nil\n end\n end\n \n when :cents then\n if val.is_a?(String)\n val = val.gsub(/\\s*\\$\\s*/, '')\n end\n intval = parse_value(val, :integer)\n if !val.is_a?(Float) && intval\n intval * 100\n else\n floatval = parse_value(val, :float)\n if floatval\n (floatval * 100).round\n else\n nil\n end\n end\n \n when :date then\n # Pull out the date part of the string and convert\n date_str = val.to_s.extract(/[0-9]+[\\-\\/][0-9]+[\\-\\/][0-9]+/)\n date_str.to_date rescue nil\n \n when :bool then\n val_str = parse_value(val, :string).to_s.downcase\n if ['true','yes','y','t','1'].include?(val_str)\n return true\n elsif ['false','no','n','f','0'].include?(val_str)\n return false\n else\n nil\n end\n \n else\n raise \"Unknown column type #{type.inspect} - unimplemented?\"\n end\n end", "def type_cast(value) # :api: public\n cast_value(value) unless value.nil?\n end", "def interpret(value)\n value == \"\" ? nil : value\n end", "def typecast_to_class(value)\n value.to_s.constantize\n rescue NameError\n nil\n end", "def ensure_valid_default_value(value)\n if !value.nil? && types && types.none? { |type| type === value }\n raise TypeError, I18n.t(\"lita.config.type_error\", attribute: name, types: types.join(\", \"))\n end\n end", "def typecast_value(column, value)\n return value unless typecast_on_assignment && db_schema && (col_schema = db_schema[column])\n value = nil if '' == value and typecast_empty_string_to_nil and col_schema[:type] and ![:string, :blob].include?(col_schema[:type])\n raise(InvalidValue, \"nil/NULL is not allowed for the #{column} column\") if raise_on_typecast_failure && value.nil? && (col_schema[:allow_null] == false)\n begin\n model.db.typecast_value(col_schema[:type], value)\n rescue InvalidValue\n raise_on_typecast_failure ? raise : value\n end\n end", "def typecast_value(column, value)\n return value unless typecast_on_assignment && db_schema && (col_schema = db_schema[column])\n value = nil if '' == value and typecast_empty_string_to_nil and col_schema[:type] and ![:string, :blob].include?(col_schema[:type])\n raise(InvalidValue, \"nil/NULL is not allowed for the #{column} column\") if raise_on_typecast_failure && value.nil? && (col_schema[:allow_null] == false)\n begin\n model.db.typecast_value(col_schema[:type], value)\n rescue InvalidValue\n raise_on_typecast_failure ? raise : value\n end\n end", "def is_string(input)\n input.kind_of?(String)\n end", "def cast_value(value)\n case value_type\n when 'integer' then value.to_i\n when 'float' then value.to_f\n when 'string' then value.to_s\n else raise_invalid_type\n end\n end", "def type_cast(value)\n nil\n end", "def coerce_string(ctx, value:, **)\n value.to_s\n end", "def string?(input)\n input.class == String\nend", "def call(value)\n klass = value.class\n format_values = {\n name: name,\n got: klass,\n allowed: allowed_classes.join(CLASS_DELIM)\n }\n\n unless allowed_classes.any?(&klass.method(:equal?))\n fail TypeError, format(ERROR_FORMAT, format_values)\n end\n\n value\n end", "def cast_value(value)\n case value\n when String then decode_and_initialize(value)\n when Hash then extract_model_klass(value).new(value)\n when nil then value\n else\n raise_cast_error(value) unless value.class.ancestors.include?(StoreModel::Model)\n\n value\n end\n rescue ActiveModel::UnknownAttributeError => e\n handle_unknown_attribute(value, e)\n end", "def type_of_input(x)\n\n # Remember that the .class method tells you the type of a variable.\n if (x.class == Fixnum) then\n return \"number\"\n # elsif (x.class == ** fill in something here **) then\n # To make this work, you have to figure out what Ruby type is a string, just as it calls numbers Fixnum\n # return \"string\"\n end\nend", "def typecast(value)\n value\n end", "def value_parse value, type\n return nil if value.nil? || value.to_s.size == 0\n case type\n when :integer then value.to_i\n when :autoincrement then value.to_i\n when :string then value.to_s\n when :float then value.to_f\n when :bool then value.to_s.to_bool\n when :symbol then value.to_s.to_sym\n when :marshal then value.is_a?(String) ? Marshal.load(value) : value\n when :array then value.is_a?(String) ? Yajl::Parser.parse(value) : value\n when :hash then value.is_a?(String) ? Hashr.new(Yajl::Parser.parse(value)) : Hashr.new(value)\n when :time then value.is_a?(String) ? Time.parse(value) : value\n when :date then value.is_a?(String) ? Date.parse(value) : value\n else value\n end\n end", "def typecast(value)\n value\n end", "def typecast_value_string(value)\n value.to_s\n end", "def typecast_value(column, value)\n return value unless typecast_on_assignment && db_schema && (col_schema = db_schema[column]) && !model.serialized?(column)\n value = nil if value == '' and typecast_empty_string_to_nil and col_schema[:type] and ![:string, :blob].include?(col_schema[:type])\n raise(Error::InvalidValue, \"nil/NULL is not allowed for the #{column} column\") if raise_on_typecast_failure && value.nil? && (col_schema[:allow_null] == false)\n begin\n model.db.typecast_value(col_schema[:type], value)\n rescue Error::InvalidValue\n if raise_on_typecast_failure\n raise\n else\n value\n end\n end\n end", "def is_name_value?(val)\n val.is_a?(String) || val.is_a?(Symbol)\n end", "def get_type(type_str)\n return :integer if /^\\d+\\.$/.match(type_str)\n return :decimal if /^\\d+\\.\\d+$/.match(type_str)\n return :string\n end", "def validate(val)\n if ((val.is_a?(String)) &&\n (val.length > 0))\n return val\n else\n return nil\n end\n end", "def convert(value, type)\n begin\n case type\n when 'json' then JSON.parse(value)\n when 'base64' then JSON.parse(Base64.decode64(value))\n when 'integer' then Integer(value)\n when 'number' then Float(value)\n else\n value.to_s\n end\n rescue ArgumentError\n value.to_s\n end\n end", "def parse_value(value)\n if value.is_a?(String)\n if value.to_i.to_s == value\n value.to_i\n elsif value.to_f.to_s == value\n value.to_f\n elsif value.gsub(/^\\s+|\\s+$/, '') == '' || value == '(Not Specified)'\n nil\n elsif /^\\d{2}\\/\\d{2}\\/\\d{4}$/ =~ value\n Date.parse(value)\n elsif /^\\d{2}\\/\\d{2}\\/\\d{4}\\s\\d{2}:\\d{2}:\\d{2}$/ =~ value\n Time.parse(value)\n else\n value\n end\n else\n value\n end\n end", "def fix_meta_var(value)\n if value.is_a?(String)\n value = value.to_var\n end\n value\n end", "def try_to_s(value, key_name)\n raise Siba::CheckError, \"'#{key_name}' option should be string\" if [Array, Hash].any?{|a| value.is_a?(a)}\n value = value.to_s.strip\n raise Siba::CheckError, \"'#{key_name}' option should not be empty\" if value.empty?\n value\n end", "def serialize_allowed_value(v)\n { String => \"string\",\n Fixnum => \"integer\" }[v] || v\n end", "def value\n if self[:value_type].present?\n case self[:value_type].to_sym\n when :string, :text\n self[:value].to_s\n when :password\n self[:value].to_s\n when :decimal\n BigDecimal.new(self[:value].to_s).round(2, BigDecimal::ROUND_HALF_UP)\n when :integer\n self[:value].to_i\n when :boolean\n (self[:value].to_s =~ /^[t|1]/i) != nil\n else\n self[:value].is_a?(String) ? YAML.load(self[:value]) : self[:value]\n end\n else\n self[:value]\n end\n end", "def coerce(str, clazz)\n return str if str.kind_of?(clazz)\n if clazz == NilClass\n return nil if str.empty? or str == \"nil\"\n elsif clazz == Ruby::Boolean\n return true if str.to_s == \"true\"\n return false if str.to_s == \"false\"\n elsif clazz == TrueClass\n return true if str == \"true\"\n elsif clazz == FalseClass\n return false if str == \"false\"\n elsif [Fixnum, Bignum, Integer].include?(clazz)\n if str =~ /^[-+]?[0-9]+$/\n i = str.to_i\n return i if i.kind_of?(clazz)\n end\n elsif clazz == Float \n if str =~ /^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$/\n return str.to_f\n end\n elsif clazz == String\n return str\n elsif clazz == Symbol\n return str.to_sym\n elsif clazz == Class or clazz == Module\n parts, current = str.split(\"::\"), Kernel\n parts.each{|part| current = current.const_get(part.to_sym)}\n return current if current.kind_of?(clazz)\n elsif clazz == Regexp\n return Regexp::compile(str)\n elsif clazz.respond_to?(:parse)\n return clazz.parse(str)\n end\n raise TypeSystem::CoercionError, \"Unable to coerce #{str} to a #{clazz}\"\n rescue TypeSystem::CoercionError\n raise\n rescue StandardError => ex\n raise TypeSystem::CoercionError, \"Unable to coerce #{str} to a #{clazz}: #{ex.message}\"\n end", "def _coerce_type(value)\n # Handle quoted strings\n if value =~ STRING_REGEX\n return value[1..value.length - 2]\n end\n\n # Handle booleans\n if BOOLEANS.include?(value)\n return !!(value =~ BOOLEAN_TRUE_REGEX)\n end\n\n # Handle numeric values, coerce to int or float appropriately\n if _is_numeric?(value)\n value = Float(value)\n return value % 1.0 == 0 ? value.to_i : value\n end\n\n # Handle lists\n if value.include?(LIST_DELIM)\n array = []\n value.split(LIST_DELIM).each do |val|\n # Coerce each list value to its appropriate type\n array << _coerce_type(val)\n end\n return array\n end\n\n # Otherwise, just return the value as a string\n value\n end", "def instrument_type(value)\n if value.kind_of?(Array)\n value = value.find { |v| !v.nil? }\n end\n value.nil? ? nil : value.to_s\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def from_string(value)\n const_get(value)\n rescue NameError\n BackingType.send(:new, 'UNKNOWN', value)\n end", "def valid_value?\n if ape_type == 'utf8' || ape_type == 'external'\n # :nocov:\n if RUBY_VERSION >= '1.9'\n # :nocov:\n begin\n map!{|v| v.to_s.encode('UTF-8')}\n rescue EncodingError\n return false\n end\n end\n string_value.unpack('U*')\n end\n rescue ArgumentError\n false\n else\n true\n end", "def parse_by_type(value, type)\n case type\n when \"Integer\"\n Integer(value)\n when \"String\"\n value.inspect\n # when \"IntegerArray\"\n # [JSON(value)]\n when \"StringArray\"\n value\n else\n value\n end\n value\n end", "def type_of_type(value)\n if value.is_a?(Range) || value.is_a?(Array) || value.is_a?(Hash)\n :complex\n else\n :simple\n end\nend", "def capfile_cast(val)\n casted_val = Webistrano::Deployer.type_cast(val).class\n\n if casted_val == String\n val.inspect\n elsif casted_val == Symbol\n val.to_s\n elsif casted_val == Array\n val.to_s\n elsif casted_val == Hash\n val.to_s\n elsif (casted_val == TrueClass ) || (casted_val == FalseClass)\n val\n elsif casted_val == NilClass\n 'nil'\n end\n end", "def value_coercion(value); end", "def compatible_string(value, label: 'Argument')\n unless value.is_a? String\n raise ArgumentError, \"#{label} must be a String\"\n end\n\n unless value.length >= 2\n raise ArgumentError, \"#{label} must be 2 or more characters long\"\n end\n\n unless value.length < @max_input_length\n raise ArgumentError, \"#{label} must be less than #{@max_input_length} characters long\"\n end\n\n value.downcase\n end", "def get_type(value) #method\n if value == 'verdadero'\n true\n elsif value == 'falso'\n false\n elsif value.include? '.'\n value.to_f\n elsif value.scan(/\\D/).empty?\n value.to_i\n else\n value\n end\n end", "def plain_string?\n (type == :string || type == :text) && # String typed\n !value.nil? &&\n !value.empty? &&\n !is_text_run? && # No inline styles\n !is_formula? &&\n !is_array_formula?\n end", "def parse_attribute(value, type)\n case type\n when 'INTEGER'\n value.to_i\n when 'BOOLEAN'\n value.to_i == 1\n when 'TEXT'\n value.strip\n else\n raise 'Invalid data type'\n end\n end", "def convert_to_type(value)\n if true_boolean?(value)\n return true\n elsif false_boolean?(value)\n return false\n elsif float?(value)\n converted_value = Float(value)\n elsif number?(value)\n converted_value = Integer(value)\n elsif path?(value)\n converted_value = value.strip\n elsif string?(value)\n converted_value = value.delete(\"\\\"\").strip\n elsif array?(value)\n vals = value.split(\",\")\n converted_value = vals.map { |v| v.delete(\"\\\"\").strip }\n elsif empty_setting?(value)\n fail INI::InvalidSetting, \"Invalid or blank setting value \\\n in config file: #{value}\"\n else\n converted_value = value.strip\n end\n converted_value\n end", "def get_input_type(val)\n if val =~ /^[-+]?[0-9]*\\.[0-9]+$/ # float\n return 'f', val.to_f\n elsif val =~ /^[-+]?[0-9]+$/ #integer\n return 'i', val.to_i\n elsif val.nil?\n return nil, nil\n else\n return 's', val #if not int, float or nil I will just call it a string\n end\nend" ]
[ "0.7221479", "0.72147024", "0.7171598", "0.71323115", "0.6995909", "0.69278914", "0.6885108", "0.6774034", "0.6739352", "0.67273307", "0.66842705", "0.66587967", "0.6496547", "0.642965", "0.637667", "0.6370853", "0.6370853", "0.6367957", "0.63265306", "0.63171583", "0.6294709", "0.6294709", "0.62590337", "0.625077", "0.6238119", "0.62379783", "0.62283725", "0.62132007", "0.62120813", "0.6204438", "0.61856943", "0.6178008", "0.6136412", "0.6115467", "0.6082255", "0.6069299", "0.60631394", "0.601211", "0.60007817", "0.59875995", "0.5974726", "0.59735847", "0.5959245", "0.5956469", "0.59482664", "0.594109", "0.59097373", "0.5900463", "0.5888306", "0.588566", "0.5884913", "0.587858", "0.5856058", "0.5848995", "0.58310956", "0.58301", "0.58230376", "0.5817768", "0.5817768", "0.5817041", "0.5811737", "0.5809912", "0.5804169", "0.580043", "0.5792319", "0.5788185", "0.57881474", "0.57786816", "0.57745445", "0.577443", "0.57728577", "0.57680446", "0.5767563", "0.57650644", "0.5754305", "0.57522464", "0.57500625", "0.5749321", "0.57481235", "0.5740791", "0.57398194", "0.57392454", "0.5723802", "0.57121575", "0.57022524", "0.57022524", "0.57022524", "0.57022524", "0.57022524", "0.57022524", "0.56990594", "0.5698316", "0.56957823", "0.5694485", "0.5693194", "0.5675736", "0.5672467", "0.56697416", "0.5668817", "0.5665786", "0.56538343" ]
0.0
-1
Connect to the database. Since SQLite is a file based database, the only options available are :database (to specify the database name), and :timeout, to specify how long to wait for the database to be available if it is locked, given in milliseconds (default is 5000).
def connect(server) opts = server_opts(server) opts[:database] = ':memory:' if blank_object?(opts[:database]) db = ::Amalgalite::Database.new(opts[:database]) db.busy_handler(::Amalgalite::BusyTimeout.new(opts.fetch(:timeout, 5000)/50, 50)) db.type_map = SequelTypeMap.new(self) connection_pragmas.each{|s| log_connection_yield(s, db){db.execute_batch(s)}} db end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_to_db()\n SQLite3::Database.new('db/database.db')\n end", "def open_db\n if Config.db =~ /^sqlite:\\/{3}(.+)$/\n dir = File.dirname($1)\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n end\n\n Sequel.datetime_class = Time\n\n @db = Sequel.connect(Config.db, :encoding => 'utf8')\n @db.test_connection\n\n if trait[:sql_log]\n require 'logger'\n @db.logger = Logger.new(trait[:sql_log])\n end\n\n rescue => e\n Ramaze::Log.error(\"Unable to connect to database: #{e}\")\n exit(1)\n end", "def db_connect_sqlite3(*args)\n\t\t\tprint_error(\"Note that sqlite is not supported due to numerous issues.\")\n\t\t\tprint_error(\"It may work, but don't count on it\")\n\n\t\t\tif(args[0] and (args[0] == \"-h\" || args[0] == \"--help\"))\n\t\t\t\tprint_status(\"Usage: db_connect [database-file-path]\")\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\tinfo = db_parse_db_uri_sqlite3(args[0])\n\t\t\tdbfile = info[:path]\n\t\t\topts = { 'adapter' => 'sqlite3', 'database' => dbfile }\n\n\t\t\tif (not ::File.exists?(dbfile))\n\t\t\t\tprint_status(\"Creating a new database file...\")\n\t\t\tend\n\n\t\t\tif (not framework.db.connect(opts))\n\t\t\t\traise RuntimeError.new(\"Failed to connect to the database: #{framework.db.error}\")\n\t\t\tend\n\n\t\t\tprint_status(\"Successfully connected to the database\")\n\t\t\tprint_status(\"File: #{dbfile}\")\n\t\tend", "def connect_database\n logger.debug \"Connecting to database(#{@config.persist_username}#{@config.persist_host}:#{@config.persist_port}) with timeout(#{@config.persist_timeout})\"\n @database.connect(@config.persist_host, @config.persist_port, @config.persist_username, @config.persist_password, @config.persist_timeout)\n end", "def connect_to_db(path) \n db = SQLite3::Database.new(path)\n db.results_as_hash = true\n return db\n end", "def _connect_database\n _send_command(\"db_connect #{@options[:db_user]}:#{@options[:db_pass]}@#{@options[:db_host]}/#{@options[:db_name]}\")\n end", "def connect\n Alf::Tools::friendly_require('sequel')\n @db ||= ::Sequel.connect(@uri, @options)\n end", "def open_database\n if File.exist? @database_path\n validate_database\n @db = SQLite3::Database.new @database_path\n else\n initialize_database\n end\n end", "def get_connection(dbfile)\n if defined?(JRUBY_VERSION) # JRuby\n require 'dbi'\n\n db = DBI.connect(\"DBI:Jdbc:SQLite:#{dbfile}\", nil, nil, 'driver' => 'org.sqlite.JDBC')\n class << db\n # jdbc/sqlite3 has no Database#execute_batch method\n def execute_batch(batch)\n batch.strip.split(';').each do |sth|\n self.do(sth.strip)\n end\n end\n\n # jdbc/sqlite3 instead of 'close' uses 'disconnect' method\n def close\n self.disconnect\n end\n\n alias_method :do_transaction, :transaction\n # Disable auto-commit, perform transaction and restore default DBI auto-commit behavior\n def transaction(&block)\n self['AutoCommit'] = false\n self.do_transaction(&block)\n self['AutoCommit'] = true\n end\n end\n else # MRI Ruby\n require 'sqlite3'\n db = SQLite3::Database.new(dbfile)\n end\n\n db\n end", "def connect_database\n\n\t\t@db = Redis.new\n\n\t\t@db = Redis.connect(\n\t\t\t:db => \"#{Settings.redis.db}\",\n\t\t\t:host => \"#{Settings.redis.host}\",\n\t\t\t:port => Settings.redis.port,\n\t\t\t:password => Settings.redis.password\n\t\t)\n\t\t\n\tend", "def db_connect\n @dbh and db_close\n puts \"DEBUG: Opening DB\" if $DEBUG\n @dbh = DBI.connect(\"dbi:Pg:#{@database[:database]}:#{@database[:host]}\",\n @database[:user],\n @database[:password])\n end", "def db_connect\n @dbh and db_close\n puts \"DEBUG: Opening DB\" if $DEBUG\n @dbh = DBI.connect(\"dbi:Pg:#{@database[:database]}:#{@database[:host]}\",\n @database[:user],\n @database[:password])\n end", "def create_connection()\n\t\tconnection_properties = java.util.Properties.new\n\t\t@settings.each do |k,v|\n\t\t\tconnection_properties[k] = v\n\t\tend\n\t\treturn java.sql.DriverManager.getConnection(\"jdbc:sqlite:#{@file}\",connection_properties)\n\tend", "def open\n close\n @db = SQLite3::Database.new(@options[:filename])\n self\n end", "def connect_non_hash\r\n db=SQLite3::Database.new(\"db/slutpro.db\")\r\n return db\r\n end", "def connect(username=DEFAULT_USERNAME, password=DEFAULT_PASSWORD, lang=DEFAULT_LANG, host=DEFAULT_HOST, port=DEFAULT_PORT, db_name=DEFAULT_DATABASE, auth_type=DEFAULT_AUTHTYPE)\n # TODO: handle pools of connections\n \n @username = username\n @password = password\n @lang = lang\n @host = host\n @port = port\n @db_name = db_name\n @auth_type = auth_type\n \n @connection = MonetDBConnection.new(user = @username, passwd = @password, lang = @lang, host = @host, port = @port)\n @connection.connect(@db_name, @auth_type)\n end", "def establish_config_database_connection(database_path)\n RFlow.logger.debug \"Establishing connection to config database (#{Dir.getwd}) '#{database_path}'\"\n ActiveRecord::Base.logger = RFlow.logger\n ConfigurationItem.establish_connection(:adapter => 'sqlite3', :database => database_path)\n end", "def connect_to_database\n # If no input parameters are defined then read the database params\n # from the command line or the default ones\n unless @db_params then self.database_params= DB_PARAMS end\n\n PGconn.connect( @db_params[:host],\n @db_params[:port],\n @db_params[:options],\n @db_params[:tty],\n @db_params[:dbname],\n @db_params[:login],\n @db_params[:password] )\n end", "def test_nil_timeout\n conn = Base.sqlite3_connection database: \":memory:\",\n adapter: \"sqlite3\",\n timeout: nil\n conn.connect!\n assert conn, \"made a connection\"\n end", "def connect(username=DEFAULT_USERNAME, password=DEFAULT_PASSWORD, lang=DEFAULT_LANG, host=DEFAULT_HOST, port=DEFAULT_PORT, db_name=DEFAULT_DATABASE, auth_type=DEFAULT_AUTHTYPE)\n\t\t# TODO: handle pools of connections\n\n\t\t@username = username\n\t\t@password = password\n\t\t@lang = lang\n\t\t@host = host\n\t\t@port = port\n\t\t@db_name = db_name\n\t\t@auth_type = auth_type\n\n\t\t@connection = MonetDBConnection.new(user = @username, passwd = @password, lang = @lang, host = @host, port = @port)\n\t\t@connection.connect(@db_name, @auth_type)\n\tend", "def connect dbname=nil\n dbname ||= getdbname\n return nil unless dbname\n #$log.debug \"XXX: CONNECT got #{dbname} \"\n $current_db = dbname\n $db = SQLite3::Database.new(dbname) if dbname\n return $db\nend", "def open(options)\n @db ||= options[:connection]\n return @db if @db\n\n if options[:path] && !File.exist?(options[:path])\n @db = SQLite3::Database.new(options[:path])\n setup\n end\n\n raise StoreException.new(\"Attempt to open missing database file #{options[:path]}\") unless File.exist?(options[:path])\n @db = SQLite3::Database.new(options[:path])\n end", "def db_connect\n database_connect_options = @options['database']\n db_connector = DatabaseConnector.new(database_connect_options)\n return db_connector.client\n end", "def connect(*args)\n @@connection = FluidDB::Connection.new(*args)\n end", "def connect(opts={})\n\n\t\treturn false if not @usable\n\n\t\tnopts = opts.dup\n\t\tif (nopts['port'])\n\t\t\tnopts['port'] = nopts['port'].to_i\n\t\tend\n\n\t\tnopts['pool'] = 256\n\n\t\tbegin\n\t\t\tcreate_db(nopts)\n\n\t\t\t# Configure the database adapter\n\t\t\tActiveRecord::Base.establish_connection(nopts)\n\n\t\t\t# Migrate the database, if needed\n\t\t\tmigrate\n\n\t\t\t# Set the default workspace\n\t\t\tframework.db.workspace = framework.db.default_workspace\n\t\trescue ::Exception => e\n\t\t\tself.error = e\n\t\t\telog(\"DB.connect threw an exception: #{e}\")\n\t\t\tdlog(\"Call stack: #{$@.join\"\\n\"}\", LEV_1)\n\t\t\treturn false\n\t\tensure\n\t\t\t# Database drivers can reset our KCODE, do not let them\n\t\t\t$KCODE = 'NONE' if RUBY_VERSION =~ /^1\\.8\\./\n\t\tend\n\n\tend", "def connect(processName)\n\t\t\t@procName = processName\n\t\t\t@db_name = processName + \".db\"\n\t\t\t\n\t\t\t# create the new db if it doesn't exist\n\t\t\tif(!File.exists?(@db_name))\n\t\t\t\tcreate_db\n\t\t\tend\n\n\t\t\t@db = SQLite3::Database.open(@db_name) \n\t\tend", "def connect()\n db = SQLite3::Database.new('database/database.db')\n db.results_as_hash = true \n return db\nend", "def connect_to_database(options)\n connection_hash = {:adapter => 'postgres',\n :database => options[:database_name],\n :user => options[:database_user],\n :password => options[:database_password],\n :test => true}\n\n if options[:database_host]\n connection_hash[:host] = options[:database_host]\n end\n\n @connection = Sequel.connect(connection_hash)\n end", "def connect\n first_tentative = true\n begin\n\tdatabase = ActiveOrient.database\n logger.progname = 'OrientDB#Connect'\n r = @res[\"/connect/#{database}\"].get\n if r.code == 204\n \t logger.info{\"Connected to database #{database}\"}\n \t true\n \t else\n \t logger.error{\"Connection to database #{database} could NOT be established\"}\n \t nil\n \t end\n rescue RestClient::Unauthorized => e\n if first_tentative\n \t logger.info{\"Database #{database} NOT present --> creating\"}\n \t first_tentative = false\n \t create_database database: database\n \t retry\n else\n \t Kernel.exit\n end\n end\n end", "def connect \n\t\t\tfirst_tentative = true\n\t\t\tbegin\n\t\t\t\tdatabase = ActiveOrient.database\n\t\t\t\tlogger.progname = 'OrientDB#Connect'\n\t\t\t\tr = ActiveOrient.db_pool.checkout do | conn |\n\t\t\t\t\tr = conn[\"/connect/#{database}\"].get\n\t\t\t\tend\n\t\t\t\tif r.code == 204\n\t\t\t\t\tlogger.info{\"Connected to database #{database}\"}\n\t\t\t\t\ttrue\n\t\t\t\telse\n\t\t\t\t\tlogger.error{\"Connection to database #{database} could NOT be established\"}\n\t\t\t\t\tnil\n\t\t\t\tend\n\t\t\trescue RestClient::Unauthorized => e\n\t\t\t\tif first_tentative\n\t\t\t\t\tlogger.info{\"Database #{database} NOT present --> creating\"}\n\t\t\t\t\tfirst_tentative = false\n\t\t\t\t\tcreate_database database: database\n\t\t\t\t\tretry\n\t\t\t\telse\n\t\t\t\t\tKernel.exit\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def connect\n config = @connection_options\n @connection = case config[:mode]\n when :dblib\n appname = config[:appname] || configure_application_name || Rails.application.class.name.split('::').first rescue nil\n login_timeout = config[:login_timeout].present? ? config[:login_timeout].to_i : nil\n timeout = config[:timeout].present? ? config[:timeout].to_i/1000 : nil\n encoding = config[:encoding].present? ? config[:encoding] : nil\n TinyTds::Client.new({\n :dataserver => config[:dataserver],\n :host => config[:host],\n :port => config[:port],\n :username => config[:username],\n :password => config[:password],\n :database => config[:database],\n :appname => appname,\n :login_timeout => login_timeout,\n :timeout => timeout,\n :encoding => encoding,\n :azure => config[:azure]\n }).tap do |client|\n if config[:azure]\n client.execute(\"SET ANSI_NULLS ON\").do\n client.execute(\"SET CURSOR_CLOSE_ON_COMMIT OFF\").do\n client.execute(\"SET ANSI_NULL_DFLT_ON ON\").do\n client.execute(\"SET IMPLICIT_TRANSACTIONS OFF\").do\n client.execute(\"SET ANSI_PADDING ON\").do\n client.execute(\"SET QUOTED_IDENTIFIER ON\")\n client.execute(\"SET ANSI_WARNINGS ON\").do\n else\n client.execute(\"SET ANSI_DEFAULTS ON\").do\n client.execute(\"SET CURSOR_CLOSE_ON_COMMIT OFF\").do\n client.execute(\"SET IMPLICIT_TRANSACTIONS OFF\").do\n end\n client.execute(\"SET TEXTSIZE 2147483647\").do\n end\n when :odbc\n if config[:dsn].include?(';')\n driver = ODBC::Driver.new.tap do |d|\n d.name = config[:dsn_name] || 'Driver1'\n d.attrs = config[:dsn].split(';').map{ |atr| atr.split('=') }.reject{ |kv| kv.size != 2 }.inject({}){ |h,kv| k,v = kv ; h[k] = v ; h }\n end\n ODBC::Database.new.drvconnect(driver)\n else\n ODBC.connect config[:dsn], config[:username], config[:password]\n end.tap do |c|\n begin\n c.use_time = true\n c.use_utc = ActiveRecord::Base.default_timezone == :utc\n rescue Exception => e\n warn \"Ruby ODBC v0.99992 or higher is required.\"\n end\n end\n end\n @spid = _raw_select('SELECT @@SPID', fetch: :rows).first.first\n configure_connection\n rescue\n raise unless @auto_connecting\n end", "def connect(dbname, user, auth, attr)\n connection = factory.create_connection\n connection.connection_string = dbname\n connection.open\n return create_database(connection, attr);\n rescue RuntimeError, System::Data::SqlClient::SqlException => err\n raise DBI::DatabaseError.new(err.message)\n end", "def connect\n return unless configuration\n @database = @@connections[name][db_name]\n return true if connected?\n\n begin\n @database = case name\n when \"mongodb\" then MongoDB.new(credentials)\n when \"postgresql\" then Postgres.new(credentials)\n when /^mysql(2)?$/ then Mysql.new(credentials)\n when /^sqlite(2|3)?$/ then Sqlite.new(sqlite_credentials)\n when \"rethinkdb\" then Labrador::RethinkDB.new(credentials)\n else\n add_error(I18n.t('adapters.unsupported_adapter', adapter: name))\n nil\n end\n rescue Exception => e\n add_error(e.to_s)\n end\n\n @@connections[name][db_name] = @database\n end", "def establish_connection(database_url_or_options = {}, options = {})\n\n case database_url_or_options\n when String\n uri = URI.parse(database_url_or_options)\n @table_name = options.fetch(:table_name, \"application_cache\").freeze\n @pg = PG::Connection.new(\n host: uri.host,\n port: uri.port,\n user: uri.user,\n password: uri.password,\n dbname: uri.path.tr(\"/\",\"\"),\n sslmode: \"prefer\",\n )\n else\n @table_name = database_url_or_options.fetch(:table_name, \"application_cache\").freeze\n @pg = PG::Connection.new(\n host: database_url_or_options[:host],\n port: database_url_or_options[:port],\n user: database_url_or_options[:username],\n password: database_url_or_options[:password],\n dbname: database_url_or_options[:database],\n sslmode: \"prefer\",\n )\n end\n\n end", "def connectDB\n \t#config = YAML.load_file( '/home/ubuntu/DB-Performance-Testing/config/db.yml' )['DB2']\n config = YAML.load_file( @@path + '../config/db.yml' )['DB2']\n\t cstring = \"DATABASE=#{config['db']};HOSTNAME=#{config['hostname']};\"\n\t cstring += \"PORT=#{config['port']};PROTOCOL=#{config['protocol']};UID=#{config['uid']};PWD=#{config['pwd']};\"\n\t @conn = IBM_DB.connect(cstring,\"\",\"\")\n end", "def connect\n \n require \"sequel\"\n require \"sequel_model\"\n\n if File.exists?(config_file)\n Merb.logger.info!(\"Connecting to the '#{config[:database]}' database on '#{config[:host]}' using '#{config[:adapter]}' ...\")\n connection = ::Sequel.connect(config_options(config))\n Merb.logger.error!(\"Connection Error: #{e}\") unless connection\n connection\n else\n copy_sample_config\n Merb.logger.set_log(STDERR)\n Merb.logger.error! \"No database.yml file found in #{Merb.root}/config.\"\n Merb.logger.error! \"A sample file was created called config/database.sample.yml for you to copy and edit.\"\n exit(1)\n end\n \n end", "def connect\n PG::Connection.new(:host => host, :port => port, :user => user, :password => password, :sslmode => sslmode, :dbname => dbname)\n end", "def connect config\n @db = ::Sequel.connect config\n rescue ::Sequel::DatabaseError => e\n retry if on_error e\n end", "def new_connection(params)\n Pod4.logger.info(__FILE__){ \"Connecting to DB\" }\n client = TinyTds::Client.new(params)\n raise \"Bad Connection\" unless client.active?\n\n client.execute(\"use [#{self.class.db}]\").do\n\n client\n\n rescue => e\n handle_error(e)\n end", "def activerecord_connect\n Sequel.connect(\n adapter: activerecord_config.fetch(\"adapter\"),\n database: activerecord_config.fetch(\"database\"),\n )\n end", "def connect\n @db = Sequel.mysql(@database,\n :user => @db_user,\n :password => @db_password,\n :host => @host,\n :encoding => 'utf8')\n end", "def db_create_sqlite3(*args)\n\t\t\tcmd_db_disconnect()\n\n\t\t\tif(args[0] and (args[0] == \"-h\" || args[0] == \"--help\"))\n\t\t\t\tprint_status(\"Usage: db_create [database-file-path]\")\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\tinfo = db_parse_db_uri_sqlite3(args[0])\n\t\t\tdbfile = info[:path]\n\t\t\topts = { 'adapter' => 'sqlite3', 'database' => dbfile }\n\n\t\t\tif (::File.exists?(dbfile))\n\t\t\t\tprint_status(\"The specified database already exists, connecting\")\n\t\t\telse\n\t\t\t\tprint_status(\"Creating a new database instance...\")\n\t\t\t\trequire_library_or_gem('sqlite3')\n\t\t\tend\n\n\t\t\tif (not framework.db.connect(opts))\n\t\t\t\traise RuntimeError.new(\"Failed to connect to the database: #{framework.db.error}\")\n\t\t\tend\n\n\t\t\tprint_status(\"Successfully connected to the database\")\n\n\t\t\tprint_status(\"File: #{dbfile}\")\n\t\tend", "def test_nil_timeout\n conn = Base.sqlite3_connection :database => ':memory:',\n :adapter => 'sqlite3',\n :timeout => nil\n assert conn, 'made a connection'\n end", "def get_db_connection\n config = read_database_config\n if config.dig(:adapter) == 'postgresql'\n config[:user] = config.delete(:username) if config[:username]\n config[:dbname] = config.delete(:database) if config[:database]\n config.delete(:adapter)\n valid_param_keys = PG::Connection.conndefaults_hash.keys + [:requiressl]\n config.slice!(*valid_param_keys)\n @db ||= PG::Connection.new(config)\n elsif config.dig(:adapter) == 'mysql2'\n @db ||= Mysql2::Client.new(config)\n else\n @db ||= SQLite3::Database.open(\"spectacles-#{Rails.env}.db\")\n end\n end", "def test_connection\n settings = {\n adapter: 'sqlite3',\n database: temp_file(\"\")\n }\n ActiveRecord::Base.establish_connection(settings)\n ActiveRecord::Base.connection\nend", "def connect\n PG::Connection.new(:host => host, :port => port, :user => user, :password => password, :dbname => dbname)\n end", "def connect(options = {})\n return @pool = options[:pool] if options[:pool]\n options = options.dup\n timeout = options.delete(:timeout) || 5\n pool_size = options.delete(:pool_size) || 1\n @pool = Squirm::Pool.new(timeout)\n pool_size.times do\n conn = PG::Connection.open(options)\n yield conn if block_given?\n @pool.checkin conn\n end\n end", "def connect_database\n begin\n db = PG.connect( :dbname => 'artdb' )\n rescue PGError\n puts 'Failed to connect to artdb database.'\n end\n return db\nend", "def open(opts)\n db = Database.new(opts)\n yield db if block_given?\n db\n end", "def db()\n db = SQLite3::Database.new(\"db/database.db\")\n db.results_as_hash = true\n return db\n end", "def connect_db\n ActiveRecord::Base.establish_connection($config)\n log(\"Connected to database\")\nrescue => e\n fatal(\"Failed to connect to the database: #{e}\")\n exit\nend", "def open\n create_database\n end", "def initialize_database(database_path = './secrets.db')\n DataMapper.finalize\n\n database_path = File.expand_path database_path\n\n @dm = DataMapper.setup(:default, \"sqlite:///#{database_path}\")\n\n return if File.exist? database_path\n\n SQLite3::Database.new(database_path)\n DataMapper.auto_migrate!\n end", "def initialize\n @database = Sequel.connect(ENV['DATABASE_URL'])\n end", "def dbconnect(db=nil, host=nil, username=nil, password=nil)\n config = $mydbi_config[:default] \n\n # optionally reset the config to a named datasource\n if db.instance_of?(Symbol)\n if $mydbi_config.key?(db)\n config = $mydbi_config[db] \n db = nil\n else\n throw ArgumentError.new(\"No database connection named ':#{db}' is configured\")\n end\n end\n\n db = config[:db] if db.nil?\n host = config[:host] if host.nil?\n username = config[:username] if username.nil?\n password = config[:password] if password.nil?\n\n $mydbi_db = DBI.connect(\"DBI:Mysql:#{db}:#{host}\", username, password)\nend", "def database\n Database.initialize_with(connection)\n end", "def establish_connection(database_yaml_path:, environment:)\n erb_template = File.read(database_yaml_path)\n configuration = YAML.load(ERB.new(erb_template).result)\n ActiveRecord::Base.establish_connection(configuration.fetch(environment))\n\n TransactionRetry.apply_activerecord_patch\n TransactionRetry.max_retries = TYPE_DIRECTORIES.length\n end", "def db_connect\n dsn = sequel_dsn\n\n is_postgres = dsn.start_with?('postgres') ||\n dsn.start_with?('jdbc:postgres')\n\n is_jruby = RUBY_PLATFORM =~ /java/\n\n if is_postgres\n Sequel.extension :pg_array_ops\n Sequel::Database.extension :pg_array\n Sequel::Database.extension :pg_hstore\n Sequel::Database.extension :pg_json\n Sequel::Database.extension :pg_inet\n\n unless is_jruby\n Sequel::Database.extension :pg_streaming\n end\n end\n\n Sequel.connect(dsn)\n end", "def database\n @database ||= begin\n if ENV['DATABASE_URL']\n Sequel.connect(ENV['DATABASE_URL'])\n elsif RUBY_PLATFORM == 'java'\n Sequel.connect(jdbc_settings)\n else\n Sequel.connect(database_settings)\n end\n end\n end", "def connect_to_database\n config = Rails.configuration.database_configuration\n host = config[Rails.env][\"host\"]\n dbname = config[Rails.env][\"database\"]\n username = config[Rails.env][\"username\"]\n password = config[Rails.env][\"password\"]\n \n client = Mysql2::Client.new(:host => host, :username => username, :password => password, :flags => Mysql2::Client::MULTI_STATEMENTS)\n \n if client.query(\"SHOW DATABASES LIKE '#{dbname}'\").count == 0\n print \"Database '#{dbname}' not found, creating...\"\n client.query(\"CREATE DATABASE #{dbname}\")\n print \"\\n\" + File.open(SETUP_FILE,\"r\").read\n client.select_db(dbname)\n client.query(File.open(SETUP_FILE,\"r\").read)\n end\n \n finalClient = Mysql2::Client.new(:host => host, :username => username, :password => password, :database => dbname)\n \n return finalClient\n \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 open\n connection_string = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='\n connection_string << @mdb\n @database = Sequel.ado(:conn_string=>connection_string) # connect to Access DB\n end", "def connect\n ::Informix.connect(@opts[:database], @opts[:user], @opts[:password])\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 open_connection\n\tbegin\n\t\tdb = Mysql.new $db_hostname, $db_user, $db_pass\n\trescue Mysql::Error\n\t\tabort \"Oops! Couldn't connect to database! Make sure you entered the correct information.\"\n\tend\n\treturn db\nend", "def open( tran: false, mode: :immediate ) # tran = true transaction\n #DBlog::stoD( parse_caller( caller.first ) ) if $debug == true\n @db = SQLite3::Database.new( @DBfile )\n @db.busy_timeout(1000)\n ecount = 0\n roll = false\n begin\n roll = false\n if tran == true\n @db.transaction( mode ) do\n roll = true\n yield self\n end\n else\n yield self\n end\n rescue SQLite3::BusyException => e\n DBlog::sto(\"SQLite3::BusyException tran = #{tran.to_s} #{ecount}\")\n begin\n @db.rollback() if roll == true\n rescue\n DBlog::sto(\"rollback fail #{$!}\")\n end\n if ecount > 59\n Commlib::errPrint( \"SQLite3::BusyException exit\", $!, e )\n return\n else\n #Commlib::errPrint( \"SQLite3::BusyException retry\", $!, e )\n ecount += 1\n sleep( 1 )\n DBlog::sto(\"retry\")\n retry\n end\n rescue => e\n Commlib::errPrint( \"SQLite3::another error\", $!, e )\n begin\n @db.rollback() if roll == true\n rescue\n DBlog::sto(\"rollback fail #{$!}\")\n end\n return\n ensure\n close()\n end\n end", "def reconnect\n if @connection != nil\n self.close\n \n @connection = MonetDBConnection.new(user = @username, passwd = @password, lang = @lang, host = @host, port = @port)\n @connection.connect(db_name = @db_name, auth_type = @auth_type)\n end\n end", "def connection\n PG.connect(\n dbname: @dbname, host: @host, port: @port,\n user: @user, password: @password\n )\n end", "def connect\n return self.dbh if self.dbh && self.dbh.connected?\n begin\n Gem.clear_paths rescue nil\n require 'dbi'\n return self.dbh = ::DBI.connect(\"dbi:Mysql:dbname=#{default_db}\")\n rescue LoadError => e\n if self.interpreter.writing?\n raise e\n else\n return false\n end\n rescue ::DBI::OperationalError => e\n if self.interpreter.writing?\n raise e\n else\n return false\n end\n end\n end", "def db\n @db ||= (create_directory cache_path; SQLite3::Database.new cache_path)\n end", "def initialize( path )\n @db = SQLite3::Database.new( path )\n @count_hits = false\n @busy_retries = 100\n\n # Wait up to 10 seconds to access locked database\n @db.busy_handler do |resource,retries|\n sleep 0.1\n retries<@busy_retries\n end\n \n # Create the table, if it doesn't exist\n if @db.table_info(TABLE_NAME).empty?\n @db.execute( %Q{\n CREATE TABLE #{TABLE_NAME} (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n key TEXT,\n value TEXT,\n hits INTEGER DEFAULT 0,\n created_at INTEGER,\n updated_at INTEGER\n );\n } )\n @db.execute( %Q{ CREATE UNIQUE INDEX key_index ON #{TABLE_NAME} (key) } )\n end\n end", "def load_database\n password = nil\n if not File.exists?(@options.db_file) then\n hsay 'Creating initial database.', :information\n password = prompt(\"Initial Password for (#{@options.db_file})\", :echo => \"*\", :validate => true)\n else\n password = prompt(\"Password for (#{@options.db_file})\", :echo => \"*\")\n end\n @db = Keybox::Storage::Container.new(password,@options.db_file)\n end", "def test_conn_with_named_parameters \n db = MonetDB.new()\n \n db.conn({ :user => \"monetdb\", :passwd => \"monetdb\", :port => 50000, :host => \"localhost\", :database => \"ruby_test\"})\n assert_equal(true, db.is_connected?)\n db.close\n end", "def db\n unless @db # not connected\n @db = Sequel.connect(self.db_uri, :logger => self.log)\n end\n @db\n end", "def create_db\n SQLite3::Database.new \"flatiron.db\"\nend", "def connect_local\n ActiveRecord::Base.establish_connection(\n :adapter => 'postgresql',\n :encoding => 'unicode',\n :database => ENV['DB_NAME'], # accessmon\n :username => ENV['DB_USERNAME'], # accessmon\n :password => ENV['DB_PASSWORD'],\n :pool => POOL_COUNT,\n :port => PORT_NUMBER,\n :host => 'localhost')\n end", "def connect_to_db(db='thesis')\n ActiveRecord::Base.establish_connection(\n :adapter => \"postgresql\",\n :host => \"localhost\",\n :username => \"thesis\",\n :password => \"thesis\",\n :database => db.to_s,\n :encoding => \"utf8\"\n )\nend", "def find_or_create_db(filename)\n SQLite3::Database.new(filename)\n end", "def open_connection\n\tbegin\n\t\tdb = Mysql.new($db_hostname, $db_user, $db_pass)\n\trescue Mysql::Error\n\t\tabort \"Oops! Couldn't connect to database! Make sure you entered the correct information.\"\n\tend\n\treturn db\nend", "def read(path)\n @dbh = attempt_sqlite3_connection(path) if Pathname(path).exist?\n self\n end", "def initialize_database\n @db = SQLite3::Database.new @database_path\n File.chmod 0600, @database_path\n begin\n @db.execute 'drop table if exists host;'\n @db.execute <<-SQL\n create table host (\n id INT,\n name varchar(254)\n );\n SQL\n sync_host_table\n rescue\n File.unlink @database_path\n raise\n end\n end", "def connect()\r\n begin\r\n raise InvalidOperationException, 'connection is already open' unless @conn.nil?\r\n load_driver\r\n uri =\r\n if @host.nil?\r\n nil\r\n elsif running_on_windows\r\n \"tcp://#{ @host }:#{ @port }\"\r\n else\r\n \"tcp://#{ @host }:#{ @port }\"\r\n #\"unix:#{ @host }/.s.PGSQL.#{ @port }\"\r\n end\r\n @conn = PostgresPR::Connection.new( @catalog, @user, @pass, uri ) \r\n rescue Exception => ex\r\n on_connect_error( ex, self )\r\n end\r\n end", "def connect\n url = ENV['CIDB_DATABASE_URL']\n fatal! 'CIDB_DATABASE_URL not set' if url.nil? || url.empty?\n\n CIDB.connect\n rescue NoMethodError\n fatal! 'CIDB_DATABASE_URL malformed, no adapter name'\n rescue Sequel::Error => err\n fatal! \"Database connection failed (#{err.class}): #{err}\"\n end", "def conn\n unless @conn\n # open the database config file\n db_config = YAML.load(ERB.new(File.read(\"config/ourstage_database.yml\")).result )\n database = db_config[environment]['database']\n @conn = EventMachine::Postgres.new(:database => database)\n @conn.setnonblocking(true) # may not be needed? \n end\n @conn\n end", "def connect( *args )\n return PG::Connection.new( *args )\n end", "def connection\n @db = Connection.client\nend", "def initialize_database\n config = YAML::load(IO.read(Antfarm::Helpers.defaults_file))\n # Database setup based on adapter specified\n if config && config[ANTFARM_ENV] && config[ANTFARM_ENV].has_key?('adapter')\n if config[ANTFARM_ENV]['adapter'] == 'sqlite3'\n config[ANTFARM_ENV]['database'] = Antfarm::Helpers.db_file(ANTFARM_ENV)\n elsif config[ANTFARM_ENV]['adapter'] == 'postgres'\n config[ANTFARM_ENV]['database'] = ANTFARM_ENV\n else\n # If adapter specified isn't one of sqlite3 or postgresql,\n # default to SQLite3 database configuration.\n config = nil\n end\n else\n # If the current environment configuration doesn't specify a\n # database adapter, default to SQLite3 database configuration.\n config = nil\n end\n # Default to SQLite3 database configuration\n config ||= { ANTFARM_ENV => { 'adapter' => 'sqlite3', 'database' => Antfarm::Helpers.db_file(ANTFARM_ENV) } }\n if config[ANTFARM_ENV]['adapter'] == 'postgres'\n DataMapper.setup(:default, \"postgres:///#{config[ANTFARM_ENV]['database']}\")\n else\n DataMapper.setup(:default, \"sqlite3://#{config[ANTFARM_ENV]['database']}\")\n end\n end", "def db_setup\n path_to_db = \"/tmp/temp_humidity.db\"\n SQLite3::Database.open(path_to_db).tap do | db |\n # Do anything here before we begin\n end\nend", "def connect\n if (@type == \"db2\")\n @config\n Models::Databases::SiteDatabase::Base.setup_connection(@config)\n elsif (@type == \"bops\")\n @config\n Models::Databases::Bops::Base.setup_connection(@config)\n else\n Models::Databases::Dyces::Base.setup_connection(@config)\n end\n\n @connection = @type\n\n Log.instance.debug \"Connected to #@db_url\"\n self\n end", "def connect_db_method\n begin\n self.con = PG.connect :dbname => self.dbname, :user => self.username, :password => self.password\n return true\n rescue PG::Error => e\n puts e.message\n puts \"Sorry Connection cannot be established\"\n # => Forceful exit from the program\n Kernel.exit(0)\n end\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 conn\n config = YAML.load_file('db/pg_config.yml')[Rails.env]\n PG.connect(host: config['host'], port: 5432, dbname: config['dbname'],\n user: config['user'], password: config['password'])\n end", "def initialize(dbname = Namey.db_path) \n @db = Sequel.connect(dbname)\n end", "def openthedatabase\n @db = SQLite3::Database.new(@thedatabase)\nend", "def connect\n \n if !self.connected?\n \n # connect to the MySQL server\n @dbh = DBI.connect(\"DBI:Mysql:#{@dataBase}:#{@host}\", \n\t \"#{@user}\", \"#{@password}\")\n @connected=true\n \n end\n end", "def connect_database\n options_file = @config.persist_options_file\n logger.debug \"Loading options from file '#{$config_file_path}/#{options_file}'\"\n # if a persist_options_file parameter was included in the server configuration,\n # then load it (as YAML) into the 'options' Hash map\n options = {}\n if options_file && !(options_file.empty?)\n full_path_to_file = \"#{$app_root}/config/#{options_file}\"\n raise RuntimeError.new \"Options file '#{full_path_to_file}' from server configuration does not exist\" unless File.file?(full_path_to_file)\n begin\n options = YAML::load(File.open(full_path_to_file))\n rescue Error => e\n raise RuntimeError.new \"Failed to load options file (#{e.class}): #{e.message}\"\n end\n raise RuntimeError.new \"Options file '#{full_path_to_file}' from server configuration is not a YAML file\" unless options.class == Hash\n end\n # now, check for any \"old-style\" configuration parameters, and merge them\n # with any options that may have been read from an options file (above).\n # Note that values specified in an options file (read above) will override\n # the \"old-style\" options read here\n if @config.persist_mode == :cassandra\n options = { 'hosts' => @config.persist_host, 'username' => @config.persist_username,\n 'password' => @config.persist_password, 'port' => @config.persist_port,\n 'timeout' => @config.persist_timeout, 'keyspace' => @config.persist_dbname}.merge(options)\n elsif [:mongo, :postgres].include?(@config.persist_mode)\n options = { 'host' => @config.persist_host, 'username' => @config.persist_username,\n 'password' => @config.persist_password, 'port' => @config.persist_port,\n 'timeout' => @config.persist_timeout, 'dbname' => @config.persist_dbname}.merge(options)\n end\n @database.connect(options)\n end", "def connect\n @conn = PG.connect(\n :dbname => 'HackerNewsAppDB1',\n :user => 'paul',\n :password => 'password')\n end", "def initialize(db)\n super\n\n @path = @db.opts[:path] if @db.opts[:path]\n @preload_results = true\n\n if @db.opts[:conn]\n @conn = @db.opts[:conn]\n else\n org.sqlite.JDBC\n reconnect\n end\n end", "def connect\n @client = Redis.new(host: @host, port: @port)\n @logger.info(\"Connecting to database #{@host}:#{@port}\")\n end", "def db\n unless @db\n @db = ::Sequel.connect(uri)\n @db.logger = @options[:sequel_logger]\n end\n @db\n end" ]
[ "0.7518225", "0.74078405", "0.7138726", "0.6950009", "0.68906164", "0.6744066", "0.6677083", "0.66769075", "0.66544205", "0.6634824", "0.658784", "0.658784", "0.656098", "0.6491284", "0.648088", "0.64782315", "0.64599586", "0.64572763", "0.64544857", "0.6419102", "0.6416198", "0.6364418", "0.63397735", "0.63365674", "0.6332937", "0.6315686", "0.6243288", "0.6192933", "0.6180347", "0.61767983", "0.617442", "0.6163755", "0.61629045", "0.61394024", "0.61306375", "0.611811", "0.60678476", "0.6057086", "0.6048543", "0.6042238", "0.6022447", "0.6020145", "0.60114473", "0.5958921", "0.59515345", "0.594654", "0.5933414", "0.5895304", "0.5851862", "0.58266336", "0.5825977", "0.58152795", "0.58152044", "0.58117795", "0.5789938", "0.5780189", "0.57775795", "0.5765021", "0.57588613", "0.5742599", "0.574143", "0.5739782", "0.5738113", "0.5726947", "0.57254595", "0.57143766", "0.5710035", "0.5701176", "0.56928563", "0.5685847", "0.5681127", "0.56795996", "0.5668808", "0.56647235", "0.56604886", "0.5656747", "0.5656299", "0.5651303", "0.5645075", "0.5643837", "0.5641608", "0.5638576", "0.5633887", "0.56219983", "0.56217027", "0.5621225", "0.5619609", "0.56190056", "0.55968875", "0.559014", "0.5582388", "0.55749834", "0.557356", "0.55692446", "0.5568115", "0.55663157", "0.5565834", "0.5550032", "0.5546544", "0.5541782" ]
0.6398596
21
Amalgalite is just the SQLite database without a separate SQLite installation.
def database_type :sqlite end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_db\n SQLite3::Database.new \"flatiron.db\"\nend", "def default_adapter; :sqlite3 end", "def db\n @db ||= (create_directory cache_path; SQLite3::Database.new cache_path)\n end", "def connect_non_hash\r\n db=SQLite3::Database.new(\"db/slutpro.db\")\r\n return db\r\n end", "def open_db\n if Config.db =~ /^sqlite:\\/{3}(.+)$/\n dir = File.dirname($1)\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n end\n\n Sequel.datetime_class = Time\n\n @db = Sequel.connect(Config.db, :encoding => 'utf8')\n @db.test_connection\n\n if trait[:sql_log]\n require 'logger'\n @db.logger = Logger.new(trait[:sql_log])\n end\n\n rescue => e\n Ramaze::Log.error(\"Unable to connect to database: #{e}\")\n exit(1)\n end", "def openthedatabase\n @db = SQLite3::Database.new(@thedatabase)\nend", "def connect_to_db()\n SQLite3::Database.new('db/database.db')\n end", "def sqlite(dbname)\n db = SQLite3::Database.new dbname + '.sqlite3'\n yield db\n db.close\nend", "def initialize\n @client = SQLite3::Database.new 'haunt.db' # Edit that to change loc\n @dbs = []\n @client.execute(\n \"SELECT name FROM sqlite_master WHERE type = \\\"table\\\"\") do |row|\n @dbs << row[0]\n end\n end", "def _db\n @_db ||= Sequel::DATABASES.first || Sequel.sqlite\n end", "def setup_storage\n ActiveRecord::Base.establish_connection(\n adapter: 'sqlite3',\n database: 'meshchat.sqlite3',\n pool: 128\n )\n\n create_database\n end", "def db; end", "def db; end", "def install_databases\n package 'sqlite3'\n package 'libsqlite3-dev'\n\n package 'mysql-client'\n package 'mysql-server'\n package 'libmysql-dev', 'libmysqlclient-dev', /^libmysqlclient\\d*-dev$/\n\n package 'postgresql-client'\n package 'libpq-dev'\n\n # TODO: NoSQL stores.\n end", "def get_db\n db = SQLite3::Database.new 'BarberShop.db'\n db.results_as_hash = true\n return db\n end", "def db() \n fat = SQLite3::Database.new(\"db/database.db\") \n fat.results_as_hash = true\n return fat\nend", "def get_db\n db = SQLite3::Database.new 'base.db'\n db.results_as_hash = true\n return db\nend", "def db_setup\n log_debug\n db_file = find_db\n db_tmp = '/tmp/plex_missing_tmp.db'\n @db = ''\n \n # cp to tmp as the db is locked if being used\n `cp \"#{db_file}\" #{db_tmp}`\n \n # not too sure why but i was having a problem where a 0 byte file was cp'd\n # def a local issue i assume but the check was needed\n if test ?s, db_tmp\n @db = SQLite3::Database.new db_tmp\n else \n puts \"error-> can not open #{db_tmp} for reasing\"\n exit 2\n end\n end", "def sqlite?\n env_db == :sqlite3\nend", "def find_or_create_db(filename)\n SQLite3::Database.new(filename)\n end", "def initialize_database(path, current_schema_version)\n\t\t\tLOGGER.debug \"[initialize_database] Let's initialize\"\n\t\t\tclose_database\n\t\t\tFile.delete(path) if File.file?(path) # Quickest way to wipe the schema in SQlite\n\t\t\tdb = open_database(path)\n\t\t\tdb.execute \"CREATE TABLE items(feed_name text, created_at datetime, updated_at datetime, fetched_at datetime, title text, creator text, read boolean, icon text, details text, url text);\"\n\t\t\tdb.execute \"CREATE TABLE fetch_histories(feed_name text PRIMARY KEY, fetched_at datetime, failure_count integer, last_failure_detail text);\"\n\t\t\tdb.execute \"CREATE TABLE schema_version(version integer);\"\n\t\t\tdb.execute \"INSERT INTO schema_version(version) VALUES (#{current_schema_version});\"\n\t\t\tdb\n\t\tend", "def connect_to_db(path) \n db = SQLite3::Database.new(path)\n db.results_as_hash = true\n return db\n end", "def get_db\n db = SQLite3::Database.new 'barbershop.db'\n db.results_as_hash = true\n\n db\nend", "def ext_db_path; end", "def ext_db_path; end", "def database; datastore['DATABASE']; end", "def initialize_database\n config = YAML::load(IO.read(Antfarm::Helpers.defaults_file))\n # Database setup based on adapter specified\n if config && config[ANTFARM_ENV] && config[ANTFARM_ENV].has_key?('adapter')\n if config[ANTFARM_ENV]['adapter'] == 'sqlite3'\n config[ANTFARM_ENV]['database'] = Antfarm::Helpers.db_file(ANTFARM_ENV)\n elsif config[ANTFARM_ENV]['adapter'] == 'postgres'\n config[ANTFARM_ENV]['database'] = ANTFARM_ENV\n else\n # If adapter specified isn't one of sqlite3 or postgresql,\n # default to SQLite3 database configuration.\n config = nil\n end\n else\n # If the current environment configuration doesn't specify a\n # database adapter, default to SQLite3 database configuration.\n config = nil\n end\n # Default to SQLite3 database configuration\n config ||= { ANTFARM_ENV => { 'adapter' => 'sqlite3', 'database' => Antfarm::Helpers.db_file(ANTFARM_ENV) } }\n if config[ANTFARM_ENV]['adapter'] == 'postgres'\n DataMapper.setup(:default, \"postgres:///#{config[ANTFARM_ENV]['database']}\")\n else\n DataMapper.setup(:default, \"sqlite3://#{config[ANTFARM_ENV]['database']}\")\n end\n end", "def db()\n db = SQLite3::Database.new(\"db/database.db\")\n db.results_as_hash = true\n return db\n end", "def open_database\n if File.exist? @database_path\n validate_database\n @db = SQLite3::Database.new @database_path\n else\n initialize_database\n end\n end", "def database\n @__database__ ||= begin\n db = SQLite3::Database.new(\"weather.db\")\n db.results_as_hash = true\n db \n end\nend", "def initialize_database\n @db = SQLite3::Database.new @database_path\n File.chmod 0600, @database_path\n begin\n @db.execute 'drop table if exists host;'\n @db.execute <<-SQL\n create table host (\n id INT,\n name varchar(254)\n );\n SQL\n sync_host_table\n rescue\n File.unlink @database_path\n raise\n end\n end", "def sqlite3_db_name\n @database_url.scan(/sqlite3:\\/\\/localhost\\/(.+)/)[0][0]\n end", "def db_create_sqlite3(*args)\n\t\t\tcmd_db_disconnect()\n\n\t\t\tif(args[0] and (args[0] == \"-h\" || args[0] == \"--help\"))\n\t\t\t\tprint_status(\"Usage: db_create [database-file-path]\")\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\tinfo = db_parse_db_uri_sqlite3(args[0])\n\t\t\tdbfile = info[:path]\n\t\t\topts = { 'adapter' => 'sqlite3', 'database' => dbfile }\n\n\t\t\tif (::File.exists?(dbfile))\n\t\t\t\tprint_status(\"The specified database already exists, connecting\")\n\t\t\telse\n\t\t\t\tprint_status(\"Creating a new database instance...\")\n\t\t\t\trequire_library_or_gem('sqlite3')\n\t\t\tend\n\n\t\t\tif (not framework.db.connect(opts))\n\t\t\t\traise RuntimeError.new(\"Failed to connect to the database: #{framework.db.error}\")\n\t\t\tend\n\n\t\t\tprint_status(\"Successfully connected to the database\")\n\n\t\t\tprint_status(\"File: #{dbfile}\")\n\t\tend", "def initialize_database(database_path = './secrets.db')\n DataMapper.finalize\n\n database_path = File.expand_path database_path\n\n @dm = DataMapper.setup(:default, \"sqlite:///#{database_path}\")\n\n return if File.exist? database_path\n\n SQLite3::Database.new(database_path)\n DataMapper.auto_migrate!\n end", "def connect()\n db = SQLite3::Database.new('database/database.db')\n db.results_as_hash = true \n return db\nend", "def database\n db = SQLite3::Database.new 'foosey.db'\n\n yield db\nrescue SQLite3::Exception => e\n puts e\n puts e.backtrace\nensure\n db.close if db\nend", "def default_database; ENV['APP_DB'] end", "def initialize\n #Opens a SQLite 3 database file\n @db = SQLite3::Database.new File.join(Dir.pwd,\"lib\",\"app\",\"TentsAndTrees\",\"Game\",\"Core\",\"DB\",\"db.sqlite\")\n end", "def db_connect_sqlite3(*args)\n\t\t\tprint_error(\"Note that sqlite is not supported due to numerous issues.\")\n\t\t\tprint_error(\"It may work, but don't count on it\")\n\n\t\t\tif(args[0] and (args[0] == \"-h\" || args[0] == \"--help\"))\n\t\t\t\tprint_status(\"Usage: db_connect [database-file-path]\")\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\tinfo = db_parse_db_uri_sqlite3(args[0])\n\t\t\tdbfile = info[:path]\n\t\t\topts = { 'adapter' => 'sqlite3', 'database' => dbfile }\n\n\t\t\tif (not ::File.exists?(dbfile))\n\t\t\t\tprint_status(\"Creating a new database file...\")\n\t\t\tend\n\n\t\t\tif (not framework.db.connect(opts))\n\t\t\t\traise RuntimeError.new(\"Failed to connect to the database: #{framework.db.error}\")\n\t\t\tend\n\n\t\t\tprint_status(\"Successfully connected to the database\")\n\t\t\tprint_status(\"File: #{dbfile}\")\n\t\tend", "def setup_database\n Hanami::Model.load!\n end", "def create_default_databases()\n # Create subfolder for databases if needed.\n dir = \"./databases\"\n Dir.mkdir(dir) unless Dir.exist?(dir)\n # TODO: sanity check: if db-file exist, create copy first, make sure the\n # name of the copy makes it highly unlikely to match an already existing\n # file, e.g. current epoch.\n # TODO: Create DBs\nend", "def open\n create_database\n end", "def create_link_to_dummy_directory\n FileUtils.ln_sf(\"#{destination_root}/db\", Rails.root.join('db'))\n end", "def test_can_initialize_with_single_environment\r\n assert_nothing_raised do\r\n DBGeni::Base.installer_for_environment(helper_sqlite_single_environment_file, 'development')\r\n end\r\n end", "def ext_db_path=(_arg0); end", "def ext_db_path=(_arg0); end", "def driver_check_sqlite3\n\t\trequire 'sqlite3'\n\tend", "def create_initial_database\n db_class = RailsInstaller::Database.dbs[config['database']]\n in_directory(install_directory) do\n db_class.create(self)\n end\n end", "def open\n close\n @db = SQLite3::Database.new(@options[:filename])\n self\n end", "def create_db(opts)\n\t\tbegin\n\t\t\tcase opts[\"adapter\"]\n\t\t\twhen 'sqlite3'\n\t\t\t\t# Sqlite just needs the file to be writable. ActiveRecord creates\n\t\t\t\t# it if it doesn't exist and checks permissions if it does. This\n\t\t\t\t# all happens during establish_connection(), so we don't need to\n\t\t\t\t# bother with creating anything here.\n\t\t\twhen 'postgresql','mysql'\n\t\t\t\tActiveRecord::Base.establish_connection(opts.merge('database' => nil))\n\t\t\t\tActiveRecord::Base.connection.create_database(opts['database'])\n\t\t\t\tActiveRecord::Base.remove_connection\n\t\t\tend\n\t\trescue ::Exception => e\n\t\t\tilog(\"Trying to continue despite failed database creation: #{e}\")\n\t\tend\n\tend", "def database\n @database ||= Database.create # defaults to 'aqua' \n end", "def create_database # :nodoc:\n @db = HDB.new\n if !@db.open(@path, default_flags)\n raise CorpusError.new(\"Error creating the database: #{@db.errmsg(@db.ecode)}\")\n end\n end", "def run_sqlite_scipt(path, adapter = dss, ctx = {})\n raise 'Not implemented yet!'\n end", "def test_sqlite3_gem_installation\n in_external_dir(\"../firstapp\") do\n assert_equal \"sqlite3-1.\", `bundle show sqlite3`[/sqlite3-1./]\n end\n end", "def appDB\n appEM.db\nend", "def test_db_creates_table\n db = ::SQLite3::Database.new(self.class::DATABASE_NAME)\n assert_equal(db.table_info('reports'), [])\n\n db = ::WeatherReport::Database.db(database_name: self.class::DATABASE_NAME)\n assert !db.table_info('reports').empty?\n end", "def db\n\t\tframework.db.active\n\tend", "def read_db()\n if File.exist?('public/tokens.db')\n db = SQLite3::Database.open './public/tokens.db'\n else\n db = []\n end\nend", "def slapd_init_db_backend\n slapd_init_db_path_matcher[2]\n end", "def database\n database = @writable_database || (@database ||= Xapian::Database.new(path))\n \n if self.expired?\n puts 'reloaded'\n database.reopen \n end\n \n database\n end", "def get_db\n manif = Project.miga_online_manif\n @downloadable = manif[:databases].map do |name, i|\n local = Project.find_by(path: name)\n local_v = (local.miga.metadata[:release] || 'unknown') if local && local.miga\n latest = i[:versions][i[:latest].to_sym]\n file = File.join(Settings.miga_projects, latest[:path])\n downloading = File.size(file) * 100 / latest[:size] if File.exist?(file)\n i.merge(name: name, local: local_v, downloading: downloading)\n end\n end", "def db\n framework.db.active\n end", "def create_database\n options = { database: Orientdb::ORM.connection_uri.database, user: Orientdb::ORM.connection_uri.user, password: Orientdb::ORM.connection_uri.password, type: :graph, storage: :memory }\n Orientdb::ORM.with { |conn| conn.client.create_database( options ) }\nend", "def initialize(file = File.expand_path(File.join(File.dirname(__FILE__), '../../../db/ush.sqlite.db')))\n FileUtils.touch(file) unless File.exist?(file) # create the db if it doesnt already exist\n puts \"Database is being stored at #{file}\"\n @db = SQLite3::Database.new(file)\n @db.execute 'CREATE TABLE IF NOT EXISTS pairings(url TEXT, code TEXT)'\n end", "def connect dbname=nil\n dbname ||= getdbname\n return nil unless dbname\n #$log.debug \"XXX: CONNECT got #{dbname} \"\n $current_db = dbname\n $db = SQLite3::Database.new(dbname) if dbname\n return $db\nend", "def get_db\n # we want to check a couple levels 2011-09-28 \n unless @db\n unless File.exists? @file\n 3.times do |i|\n @file = \"../#{@file}\"\n break if File.exists? @file\n end\n end\n end\n @db ||= DB.new @file\n end", "def create_db(db_name)\n\n db = SQLite3::Database.new(db_name + \".db\")\n db.results_as_hash = true\n current_db_name = (db_name + \".db\")\n\n # Create Project Table\n create_project_table = <<-SQL\n CREATE TABLE IF NOT EXISTS projects(\n id INTEGER PRIMARY KEY,\n name VARCHAR(255),\n client VARCHAR(255)\n )\n SQL\n\n # Create Geologists Table\n create_geo_table = <<-SQL\n CREATE TABLE IF NOT EXISTS geologists(\n id INTEGER PRIMARY KEY,\n name VARCHAR(255),\n company VARCHAR(255)\n )\n SQL\n\n # Create Borehole Table\n create_borehole_table = <<-SQL\n CREATE TABLE IF NOT EXISTS boreholes(\n id INTEGER PRIMARY KEY,\n designation VARCHAR(255),\n northing REAL,\n easting REAL,\n elevation REAL,\n project_id INTEGER,\n FOREIGN KEY (project_id) REFERENCES projects(id)\n )\n SQL\n \n # Create Samples Table\n create_sample_table = <<-SQL\n CREATE TABLE IF NOT EXISTS samples(\n id INTEGER PRIMARY KEY,\n bh_id INTEGER, \n logger_id INTEGER,\n depth REAL,\n USCS VARCHAR(63),\n color VARCHAR(127),\n wetness VARCHAR(63),\n percent_gravel INTEGER,\n percent_sand INTEGER,\n percent_fines INTEGER,\n plasticity VARCHAR(63),\n toughness VARCHAR(63),\n other VARCHAR(255),\n FOREIGN KEY (bh_id) REFERENCES boreholes(id),\n FOREIGN KEY (logger_id) REFERENCES geologists(id)\n )\n SQL\n\n db.execute(create_project_table)\n db.execute(create_geo_table)\n db.execute(create_borehole_table)\n db.execute(create_sample_table)\n\n db\nend", "def initialize\n\t\t# Define the database connection to the dentist_book.db SQLite database.\n\t\t@dbConnection = SQLite3::Database.new( \"./../db/dentist_book.db\" )\n\tend", "def db_path\n @db\n end", "def database! name\n create_db(name) rescue nil\n database name\n end", "def establish_connection\n ActiveRecord::Base.establish_connection adapter: \"sqlite3\", database: \":memory:\"\n\n ActiveRecord::Migration.create_table :visits do |t|\n t.string :city\n t.datetime :visit_date\n end\nend", "def db_setup\n path_to_db = File.join(File.dirname(__FILE__), \"temp_humidity.db\")\n SQLite3::Database.open(path_to_db).tap do | db |\n # Do anything here before we begin\n end\nend", "def query_enable_dblink\n <<-SQL.strip\n -- Load extension\n CREATE EXTENSION IF NOT EXISTS dblink SCHEMA public;\n SQL\n end", "def handle_database_creation\n database = Sequel.sqlite('./actions_db.db') # memory database, requires sqlite3\n database.create_table? :\"#{@username}_follows\" do\n primary_key :id\n String :user_id\n String :username\n Time :follow_time\n end\n database.create_table? :\"#{@username}_likes\" do\n primary_key :id\n String :media_id\n String :user_id\n String :shortcode\n Time :like_time\n end\n @table_follows = database[:\"#{@username}_follows\"]\n @table_likes = database[:\"#{@username}_likes\"]\n end", "def db_setup\n path_to_db = \"/tmp/temp_humidity.db\"\n SQLite3::Database.open(path_to_db).tap do | db |\n # Do anything here before we begin\n end\nend", "def db_record\n db or MyBiaDJ::Table(:files)[:path => relative_path, :name => name.to_s]\n end", "def website_connection(subdomain)\n\t default_connection.dup.update(:database => (\"db/\" + subdomain + \".sqlite3\"))\n\tend", "def db\n @db ||= find_or_create_database\n end", "def init_db\n db_filename = './coord_cache.db'\n puts \"Creating db file '#{db_filename}'\" unless File.exist?(db_filename)\n @coord_db = SQLite3::Database.new(db_filename)\n @coord_db.execute('CREATE TABLE IF NOT EXISTS coords ' \\\n '(id INTEGER PRIMARY KEY AUTOINCREMENT, ' \\\n ' osm_id BIGINT, ' \\\n ' lat REAL, ' \\\n ' lon REAL)')\nend", "def database\n \"--db='#{ name }'\"\n end", "def openDBRanked()\n\t\t@rankedDB \t\t= SQLite3::Database.new File.expand_path('../../../Data/ranked.db', File.dirname(__FILE__))\n\t\t@rankedTimeDB \t= SQLite3::Database.new File.expand_path('../../../Data/rankedTime.db', File.dirname(__FILE__))\n\tend", "def sqlite3_all_tables\n return @dbh.execute(\"select * from sqlite_master where type='table';\")\n end", "def a_dbm\n get_dbm[0]\n end", "def setup_database!\n mapper = Praxis::Application.instance.plugins[:praxis_mapper]\n Sequel.connect(mapper.config.repositories[\"default\"]['connection_settings'].dump) do |db|\n db.create_table! :people do\n primary_key :id\n string :name\n end\n end\nend", "def setup_database\n require \"sequel\"\n\n options = {\n :max_connections => 16,\n :pool_timeout => 240\n }\n\n database_config = YAML.load_file(\"#{$intrigue_basedir}/config/database.yml\")\n database_host = database_config[$intrigue_environment][\"host\"] || \"localhost\"\n database_port = database_config[$intrigue_environment][\"port\"] || 5432\n database_user = database_config[$intrigue_environment][\"user\"]\n database_pass = database_config[$intrigue_environment][\"password\"]\n database_name = database_config[$intrigue_environment][\"database\"]\n database_debug = database_config[$intrigue_environment][\"debug\"]\n\n if database_pass \n $db = Sequel.connect(\"postgres://#{database_user}:#{database_pass}@#{database_host}:#{database_port}/#{database_name}\", options)\n else\n $db = Sequel.connect(\"postgres://#{database_user}@#{database_host}:#{database_port}/#{database_name}\", options)\n end\n\n $db.loggers << Logger.new($stdout) if database_debug\n\n # Allow datasets to be paginated\n $db.extension :pagination\n Sequel.extension :pg_json_ops\n Sequel.extension :migration\nend", "def create_database!(name=nil)\n db = if name\n self.server.database!(db_name_with_prefix(name))\n else\n self.database!\n end\n create_rotation_filter(db)\n if self.respond_to?(:design_doc)\n design_doc.sync!(db)\n # or maybe this?:\n #self.design_docs.each do |design|\n # design.migrate(to_db)\n #end\n end\n return db\n end", "def tes_load_db\n setup_clean_accounts\n Movements.create('any', '2013-01-01', 10, @cash, @income)\n\n SQLite.dbs_close_all\n Accounts.delete_all(true)\n SQLite.dbs_open_load\n\n Accounts.dump true\n end", "def ask_for_database db\n if not @db_setted and yes?(\"Are you going to use #{db[:name]}?\")\n # Save the db to use\n @db_setted = true\n\n # Set settings con config/database.yml\n inside 'config' do\n remove_file 'database.yml'\n copy_file \"database_#{db[:name]}.yml\", 'database.yml'\n end\n\n # Adds the gem to the Gemfile\n gem db[:gem_name]\n gsub_file('Gemfile', /^(gem \\\"#{db[:gem_name]}\\\".*)/){ |*match|\n \"# Use #{db[:name]} as the database for Active Record\\n#{match[0]}\\n\"\n }\n\n # Remove default sqlite gem\n gsub_file 'Gemfile', /.*sqlite.*\\n*/, ''\n end\nend", "def alchemy\r\n end", "def create_database(name)\n end", "def connect(server)\n opts = server_opts(server)\n opts[:database] = ':memory:' if blank_object?(opts[:database])\n db = ::Amalgalite::Database.new(opts[:database])\n db.busy_handler(::Amalgalite::BusyTimeout.new(opts.fetch(:timeout, 5000)/50, 50))\n db.type_map = SequelTypeMap.new(self)\n connection_pragmas.each{|s| log_connection_yield(s, db){db.execute_batch(s)}}\n db\n end", "def database\n @writable_database || (@database ||= Xapian::Database.new(path))\n end", "def use_test_database\n # log.debug \"Setting up test database\"\n options = { database_env: 'test' }\n if Translatomatic::Database.enabled?(options)\n Translatomatic::Database.new(options)\n else\n # log.debug \"database is disabled\"\n TestConfig.instance.database_disabled = true\n nil\n end\n end", "def database\n default = begin\n YAML.load_file(\"config/database.yml\")['production']['adapter'].strip\n rescue\n nil\n end\n menu_with_default \"Select a database for production:\", [\"postgres\", \"mysql\", \"sqlite3\"], default\n end", "def dotfile_databases(database, env)\n return '' if database == 'sqlite3'\n\n db = { username: \"DB_USER=appUser123\\n\",\n password: \"DB_PASSWORD=App($)Password\\n\",\n sid: '',\n host: '' }\n\n case database\n when 'oracle'\n db = { username: \"DB_USER=system\\n\",\n password: \"DB_PASSWORD=oracle\\n\",\n sid: \"DB_SID=xe\\n\" }\n when 'sqlserver'\n db[:username] = \"DB_USER=SA\\n\"\n db[:password] = \"DB_PASSWORD=yourStrong(!)Password\\n\"\n end\n db[:host] = \"DB_HOST=localhost\\n\" unless env == 'docker'\n\n \"#{db[:username]}#{db[:password]}#{db[:host]}#{db[:sid]}\"\nend", "def initialize\n #p Dir[\"*.rb\"]\n\n #? what inital set to?\n @current_user = nil\n\n # do these exist beyond the scope of this init function?\n ActiveRecord::Base.logger = Logger.new(File.open('/home/kevin/webdev/ruby/bleater/database/bleater.log', 'w'))\n\n ActiveRecord::Base.establish_connection(\n :adapter => 'sqlite3',\n :database => '/home/kevin/webdev/ruby/bleater/database/bleater.db'\n )\n\n end", "def db\n return @db unless @db.nil?\n\n Sequel.single_threaded = true\n @db = Sequel.connect(config(:sql_url), :encoding => 'utf8')\n #@db.loggers << Logger.new(STDOUT)\n if @db.tables.empty?\n dir = File.join(File.dirname(__FILE__), 'migrations')\n puts \"Database empty, running migrations from #{dir}\"\n Sequel.extension :migration\n Sequel::Migrator.apply(@db, dir)\n end\n\n @db\n end", "def init_sqlite3\n require 'sqlite3'\n @db = SQLite3::Database.open(CACHE_PATH)\n @db.execute 'CREATE TABLE IF NOT EXISTS coordinates(lng REAL, lat REAL, neighborhood TEXT);'\n @db.execute 'CREATE INDEX IF NOT EXISTS coordinates_idx ON coordinates (lng, lat);'\n end", "def init_example_db\n # Create repos table\n database.create_table :repos do\n primary_key :id\n String :name\n foreign_id :token_id\n end\n\n # Add example repositories\n r = database[:repos]\n r.insert(:name => \"josefwaller/pycatan\")\n r.insert(:name => \"josefwaller/github_dash\")\n r.insert(:name => \"rails/rails\")\n\n # Create tokens table\n database.create_table :tokens do\n primary_key :id\n String :token\n String :name\n end\n\n # Add example token\n t = database[:tokens]\n ENV['GITHUB_DASH_TOKEN'] ||= \"ThisIsAnExampleGithubApiKey\"\n t.insert(:token => ENV['GITHUB_DASH_TOKEN'])\n end", "def database\n \"--db='#{ name }'\" if name\n end" ]
[ "0.64350206", "0.61068255", "0.6103155", "0.60929257", "0.6028462", "0.601257", "0.6006739", "0.59370416", "0.59343433", "0.5915107", "0.58316845", "0.58198816", "0.58198816", "0.57879275", "0.5786545", "0.5778258", "0.5775086", "0.57092655", "0.5705476", "0.5705361", "0.57040656", "0.57010293", "0.5694661", "0.5690437", "0.5690437", "0.5677478", "0.56619114", "0.56459516", "0.5622476", "0.5581511", "0.5572305", "0.5541978", "0.5538812", "0.5534351", "0.54971486", "0.5493596", "0.5480241", "0.5474737", "0.5471254", "0.54656315", "0.54394966", "0.54279435", "0.54221267", "0.5416949", "0.54098266", "0.5407382", "0.54012877", "0.53964996", "0.537584", "0.53687686", "0.5359617", "0.5351265", "0.5335247", "0.53198695", "0.53136176", "0.52942634", "0.5291185", "0.528381", "0.52818805", "0.52751875", "0.5267489", "0.52606946", "0.52603805", "0.5251058", "0.5239601", "0.523938", "0.52311766", "0.5215165", "0.521334", "0.5213159", "0.52009374", "0.519701", "0.5196334", "0.51854557", "0.5182997", "0.5175885", "0.5166999", "0.5151086", "0.51493245", "0.51402783", "0.5129233", "0.5124635", "0.511069", "0.5106862", "0.5106182", "0.5105305", "0.5101656", "0.5100835", "0.50975025", "0.50920004", "0.50767326", "0.507362", "0.5070153", "0.5068547", "0.50640196", "0.50507843", "0.50393957", "0.5034586", "0.50344604", "0.5027268" ]
0.63700455
1
Run the given SQL with the given arguments. Returns nil.
def execute_ddl(sql, opts=OPTS) _execute(sql, opts){|conn| log_connection_yield(sql, conn){conn.execute_batch(sql)}} nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(sql, args=nil)\n q = query(sql, args)\n block_given? ? yield(q) : q.cmd_tuples\n end", "def execute(sql, args=nil)\n args = args.map{|v| @db.bound_variable_arg(v, self)} if args\n q = check_disconnect_errors{execute_query(sql, args)}\n begin\n block_given? ? yield(q) : q.cmd_tuples\n ensure\n q.clear if q && q.respond_to?(:clear)\n end\n end", "def execute(sql, args=nil)\n\t\t\t\t\targs = args.map{|v| @db.bound_variable_arg(v, self)} if args\n\t\t\t\t\tq = check_disconnect_errors{execute_query(sql, args)}\n\t\t\t\t\tbegin\n\t\t\t\t\t\tblock_given? ? yield(q) : q.cmd_tuples\n\t\t\t\t\tensure\n\t\t\t\t\t\tq.clear if q && q.respond_to?(:clear)\n\t\t\t\t\tend\n\t\t\t\tend", "def execute(*args)\n @db.execute(*args)\n end", "def execute *params\r\n sql = parse_args( *params )\r\n @driver.execute( sql )\r\n end", "def execute_query(sql, args)\n @db.log_connection_yield(sql, self, args){args ? async_exec(sql, args) : async_exec(sql)}\n end", "def run_sql(query)\n raw_run_sql(query)\n end", "def execute sql\n db[sql]\n end", "def execute(sql, name = nil)\n # check for some DDL and DML statements\n puts \"Running sql? #{RUN_SQL}\"\n\n if /(create |alter |drop |insert |delete |update )/i.match sql.squish\n File.open(SQL_FILENAME, 'a') { |f| f.puts \"#{sql};\\n\" }\n puts \"Rails.env: #{Rails.env} - #{ENV['FPHS_POSTGRESQL_SCHEMA']}\"\n old_execute sql, name if RUN_SQL\n else\n # pass everything else to the aliased execute\n puts \"------------- (#{name}) ---------------\"\n puts sql || ''\n puts \"------------- ---------------\"\n old_execute sql, name if RUN_SQL\n end\n end", "def execute(sql)\n raise NotImplementedError, \"#execute should be overridden by adapters\"\n end", "def execute(sql)\n @database_handle.execute(sql)\n end", "def execute(sql, *args, &block)\n @db.execute(rewrite_table_names(sql), *args, &block)\n end", "def execute(sql, *params)\n self.connect\n return nil if ! self.connected? && self.interpreter.preview?\n begin\n sth = self.dbh.prepare(sql)\n if params.empty?\n sth.execute\n else\n sth.execute(*params)\n end\n return sth\n rescue ::DBI::ProgrammingError => e\n raise \"#{e.message} -- #{sql}\"\n end\n end", "def query(sql, args=nil)\n args = args.map{|v| @db.bound_variable_arg(v, self)} if args\n check_disconnect_errors{super}\n end", "def execute(sql, name = nil, binds = []) #:nodoc:\r\n if name == :skip_logging\r\n query(sql, binds)\r\n else\r\n log(sql, name, binds) { query(sql, binds) }\r\n end\r\n end", "def execute(sql)\n @db.send(:_execute, self, sql, :log=>false) \n end", "def exec(sql)\n Logging.with_logged_query self, sql do\n raw_connection.exec sql\n end\n end", "def run_sql(sql)\n #connect to the|db|\n conn = PG.connect(:dbname => 'rogbloll')\n\n\n #execute the db in the argument\n res = conn.exec(sql)\n\n #now close the db\n conn.close\n\n #now return the result of the query...\n res\n\n\n \n end", "def execute_query(sql, args)\n\t\t\t\t\t@db.log_connection_yield(sql, self, args){args ? self.async_exec(sql, args) : self.async_exec(sql)}\n\t\t\t\tend", "def _execute(sql, name = nil)\n @connection.execute(sql)\n end", "def run_sql(sql, arr = []) # array is for security feature\n db = PG.connect(ENV['DATABASE_URL'] || {dbname: 'picgallary'})\n results = db.exec_params(sql, arr)\n db.close\n return results\n end", "def execute(sql)\n raise(ArgumentError, \"Bad sql parameter\") unless sql.kind_of?(String)\n\n client = ensure_connected\n\n Pod4.logger.debug(__FILE__){ \"execute: #{sql}\" }\n r = client.execute(sql)\n\n r.do\n r\n\n rescue => e\n handle_error(e)\n end", "def exec_query(sql, name = 'SQL', binds = [])\n execute(sql, name, binds)\n end", "def execute(sql, args = nil, bulk_args = nil, http_options = {})\n @logger.debug sql\n req = Net::HTTP::Post.new('/_sql', headers)\n body = { 'stmt' => sql }\n body['args'] = args if args\n body['bulk_args'] = bulk_args if bulk_args\n req.body = body.to_json\n response = request(req, http_options)\n @logger.debug response.body\n\n case response.code\n when /^2\\d{2}/\n ResultSet.new response.body\n else\n @logger.info(response.body)\n raise CrateRuby::CrateError, response.body\n end\n end", "def execute(sql, name = nil)\n exec_no_cache(sql, name, nil)\n end", "def execute(sql, name = nil) #:nodoc:\n log(sql, name) { @connection.exec sql }\n end", "def run_sql(sql_query)\n begin\n CONNECTION.execute(sql_query)\n rescue Exception => msg\n msg\n end\n end", "def run_sql(sql)\n\tdb = PG.connect(dbname: 'address_book', host: 'localhost')\n\tresult = db.exec(sql)\n\tdb.close\n\tresult\nend", "def execute(sql, name = nil, skip_logging = false)\n translate(sql) do |sql, args|\n if (name == :skip_logging) or skip_logging\n @connection.execute(sql, *args)\n else\n log(sql, args, name) do\n @connection.execute(sql, *args)\n end\n end\n end\n end", "def exec_query(sql, name = 'SQL', binds = [])\n if name == :skip_logging\n #execute(sql, name)\n hash_query(sql, name, binds)\n else\n log(sql, name) do\n #execute(sql, name)\n hash_query(sql, name, binds)\n end\n end \n end", "def call(*args)\n in_context do\n self.execute(*args)\n end\n end", "def execute(sql, name = nil, _binds = [])\n log(sql, name) do\n @connection.do(sql)\n end\n end", "def execute(sql)\n @logger.debug(\"SQL: #{sql}\") if @logger\n retrieve_connection.query(sql)\n end", "def execute(sql, name = nil, binds = [])\n log(sql, name) do\n sql = bind_params(binds, sql) if prepared_statements\n @connection.do(sql)\n end\n end", "def run_sql(sql)\n\tconn = PG.connect(dbname: \"video_store\", host: 'localhost')\n\tresult = conn.exec(sql)\n\tconn.close\n\tresult \nend", "def run_sql(sql)\n db = PG.connect(dbname: 'goodfoodhunting')\n results = db.exec(sql)\n db.close\n results\nend", "def exec(sql, *bindvars, &block)\n ret = nil\n thread = Thread.new { ret = super }\n thread.join\n ret\n rescue Interrupt\n self.break\n raise\n end", "def sql_raw(*args)\n sql, bind = parse_args(*args)\n return SQL::QueryMaker.new(nil, Proc.new { sql }, bind)\n end", "def run_sql(sql)\n conn = PG.connect(dbname: 'goodfoodhunting')\n result = conn.exec(sql)\n conn.close\n return result\nend", "def execute(sql, name = nil)\n raise NotImplementedError, \"execute is an abstract method\"\n end", "def query(sql)\n database.execute2(sql)\n end", "def run_sql(statement, params)\n @low_card_model.connection.execute(@low_card_model.send(:sanitize_sql, [ statement, params ]))\n end", "def execute_dui(sql, opts={})\n synchronize(opts[:server]) do |conn|\n begin\n conn.execute(sql)\n rescue SwiftError => e\n raise_error(e)\n end\n end\n end", "def run_sql(sql)\n db = PG.connect(:dbname => 'movies', :host => 'localhost')\n result = db.exec(sql)\n db.close\n result\n end", "def do_execute(sql, name = 'SQL')\n log(sql, name) { raw_connection_do(sql) }\n end", "def execute(args=nil)\r\n puts \"Executing #{name}\"\r\n execute_base(args)\r\n end", "def run_sql(sql)\n conn = PG.connect(dbname: \"memetube\", host: \"localhost\")\n begin\n result = conn.exec(sql)\n ensure\n conn.close\n end\n result\nend", "def execute_query(sql, *vars)\n if vars && vars.count > 0\n @database.prepare(sql).execute(*vars.flatten)\n else\n @database.prepare(sql).execute\n end\n rescue\n puts \"MyMysql.execute_query(): #{$!}\" if @@verbose\n end", "def ask(sql, *args, into: nil)\n catch(:ok) do\n each(sql, *args, into: into) { |row| throw :ok, row }\n nil\n end\n end", "def run_sql(sql_query)\n begin\n CONNECTION.execute(sql_query)\n rescue Exception => msg\n @errors << msg\n false\n end\n end", "def run_sql(sql, arr = [])\n db = PG.connect(ENV['DATABASE_URL'] || {dbname: 'native_plants'})\n results = db.exec_params(sql, arr)\n db.close\n return results\nend", "def execute(sql, *args, &block)\n @db.log_yield(sql){super}\n rescue SwiftError => e\n @db.send(:raise_error, e)\n end", "def execute\n ActiveRecord::Base.connection.execute(source)\n end", "def run_sql(sql)\n connection = PG.connect(dbname: \"facebook_lab\", host: \"localhost\")\n result = connection.exec(sql)\n connection.close\n result\nend", "def execute(sql)\r\n\t\t@connection.Execute(sql)\r\n\tend", "def run_sql(sql_query)\n\tconn = PG.connect(dbname: 'first_crud_app')\n\tresult = conn.exec(sql_query)\n\tconn.close\n\tresult\nend", "def execute(args)\r\n begin\r\n if args.length > 1\r\n eval args.to_a[1..-1].join(' '), @binding\r\n else\r\n \"ERROR:#{args[0]}: No argument given\"\r\n end\r\n rescue Exception => e\r\n \"ERROR:#{args[0]}: #{e}\"\r\n end\r\n end", "def execute(sql, opts=OPTS, &block)\n synchronize(opts[:server]){|conn| check_database_errors{_execute(conn, sql, opts, &block)}}\n end", "def exec(sql, rescue_exception = true)\n debug(sql) if $DBG\n exec_statement(sql)\n rescue Object => ex\n if rescue_exception\n handle_sql_exception(ex, sql)\n else\n raise\n end\n end", "def run_sql(sql)\n conn = PG.connect(dbname: 'movies')\n result = conn.exec(sql)\n conn.close\n result\nend", "def execute(sql)\n log_info(sql)\n @pool.hold {|c| c.immediate(sql)}\n end", "def psql(args)\n \"psql -X -q #{args}\"\nend", "def query_script(example, sql, log_name=nil)\n log_name ||= 'Run SQL Script'\n\n debuggable_sql = SqlPreprocessor.debuggable_sql(sql)\n executable_sql = SqlPreprocessor.executable_sql(sql, example)\n\n example.metadata[:sql] += ((example.metadata[:sql] == '' ? '' : \"\\n\\n\") + \"-- #{log_name.split(/\\r\\n|\\n/).join(\"\\n-- \")}\\n#{debuggable_sql}\")\n application.query_script(executable_sql)\n end", "def exec_query(sql, name = 'SQL', _binds = [], prepare: false)\n log(sql, name) do\n result = @connection.run(sql)\n ActiveRecord::Result.new(result.columns, result.rows)\n end\n end", "def sql! sql=nil\n require 'niceql'\n puts Niceql::Prettifier.prettify_sql sql || $last_sql_command\n end", "def execute_sql\n ActiveRecord::Base.connection.execute(@sql)\n end", "def call(*args)\n params = build_params args\n cstmt = @connection.prepare_call \"{call #{name}(#{Array.new(@cols.length){'?'}.join ', '})}\"\n begin\n process_result( args, cstmt.call(*params) )\n ensure\n cstmt.close\n end\n end", "def execute(sql, opts = {}, &block)\n res = nil\n synchronize(opts[:server]) do |conn|\n res = check_database_errors do\n if sql.is_a?(Symbol)\n execute_prepared_statement(conn, sql, opts, &block)\n else\n log_yield(sql) do\n conn.query(sql, opts[:arguments])\n end\n end\n end\n yield res if block_given?\n res.cmd_tuples\n end\n end", "def _execute(conn, sql, opts, &block)\n if sql.is_a?(Symbol)\n execute_prepared_statement(conn, sql, opts, &block)\n else\n conn.execute(sql, opts[:arguments], &block)\n end\n end", "def execute_sql(sql_code)\n done = system \"sh db_execute.sh \\\"#{sql_code}\\\"\"\n raise Exception.new(\"Issue executing sql code: #{sql_code}\") unless done\nend", "def execute(sql, tx = nil)\n run(:_send_query, [sql], tx)\n end", "def run_sql_script(path, adapter = dss, ctx = {})\n sql = ErbHelper.new.process(path, ctx)\n puts sql\n adapter.run sql\n end", "def escape_sql(args)\n return @text if args.empty?\n sql = @text.dup\n vars = args.dup\n\n replacements = 0\n mismatch = false\n\n sql.gsub!(/'[^']*'|\"[^\"]*\"|`[^`]*`|\\?/) do |x|\n next x unless x == '?'\n replacements += 1\n if vars.empty?\n mismatch = true\n else\n var = vars.shift\n connection.quote_value(var)\n end\n end\n\n if !vars.empty? || mismatch\n raise ArgumentError, \"Binding mismatch: #{args.size} for #{replacements}\"\n else\n sql\n end\n end", "def execute(initial_args, options = T.unsafe(nil)); end", "def sanitize_sql(*args)\n klass.send(:sanitize_sql, args)\n end", "def execute(sql, opts={}, &block)\n if opts[:sproc]\n call_sproc(sql, opts, &block)\n else\n synchronize(opts[:server]){|conn| _execute(conn, sql, opts, &block)}\n end\n end", "def execute(sql, name = 'SQL')\n log(sql, name) do\n @connection.async_exec(sql)\n end\n end", "def execute(sql)\n begin\n db = SQLite3::Database.new(@@db_file)\n @@_set_db_handler.call(db)\n if block_given?\n db.execute(sql) do |row|\n yield row\n end\n else\n return db.execute(sql)\n end\n ensure\n db.close\n end\n end", "def exec_query(sql, name = 'SQL', binds = [])\n log(sql, name, binds) do\n result = without_prepared_statement?(binds) ? exec_no_cache(sql) :\n exec_cache(sql, binds)\n result_array = result_as_array(result)\n if ActiveRecord::VERSION::MAJOR >= 4\n column_types = compute_field_types(result)\n ret = ActiveRecord::Result.new(result.fields, result_array, column_types)\n else\n ret = ActiveRecord::Result.new(result.fields, result_array)\n end\n result.clear\n ret\n end\n end", "def execute(*values)\n IBM_DB.execute(@stmt, values)\n end", "def execute\n result = nil\n ActiveRecord::Base.connection_pool.with_connection do |con|\n result = con.execute(to_sql)\n end\n if @sql_returning.nil?\n nil\n else\n if @returning_flat\n result.values.map{|r| r.first}\n else\n result\n end\n end\n end", "def execute_batch(sql, *args, &block)\n @db.execute_batch(rewrite_table_names(sql), *args, &block)\n end", "def execute\n # build the query string\n # run the query\n # return the results\n end", "def exec_query(sql, name = nil, binds = NO_BINDS, prepare: false, async: false)\n sql = transform_query(sql)\n\n if preventing_writes? && write_query?(sql)\n raise ActiveRecord::ReadOnlyError, \"Write query attempted while in readonly mode: #{sql}\"\n end\n\n materialize_transactions\n mark_transaction_written_if_write(sql)\n\n binds = convert_legacy_binds_to_attributes(binds) if binds.first.is_a?(Array)\n\n if without_prepared_statement?(binds)\n log(sql, name) { @connection.execute_query(sql) }\n else\n log(sql, name, binds) do\n # this is different from normal AR that always caches\n cached_statement = fetch_cached_statement(sql) if prepare && @jdbc_statement_cache_enabled\n @connection.execute_prepared_query(sql, binds, cached_statement)\n end\n end\n end", "def query(*args, &block)\n if args.empty?\n @query\n else\n if args[0].is_a?(String)\n @query = args[0].strip\n else\n @query = build_arel(\n args.inject({}) do |acc, param|\n acc.merge(\n param.is_a?(Hash) ? param : Hash[ [[param, nil]] ]\n )\n end,\n block).to_sql\n end\n end\n end", "def execute(sql, opts=OPTS, &block)\n if opts[:sproc]\n call_sproc(sql, opts, &block)\n elsif sql.is_a?(Symbol)\n execute_prepared_statement(sql, opts, &block)\n else\n synchronize(opts[:server]){|conn| _execute(conn, sql, opts, &block)}\n end\n end", "def execute_dui(sql, opts=OPTS)\n _execute(sql, opts){|conn| log_connection_yield(sql, conn){conn.execute_batch(sql)}; conn.row_changes}\n end", "def execute(sql, opts=OPTS, &block)\n super(sql, {:arguments=>bind_arguments}.merge(opts), &block)\n end", "def cti_execute_sql(sql)\n return execute(sql) if sql.is_a?(String)\n sql.map do |query|\n execute(query)\n end\n end", "def exec_query(sql, name = 'SQL', binds = [])\n translate(sql) do |sql, args|\n unless binds.empty?\n args = binds.map { |col, val| type_cast(val, col) } + args\n end\n log(expand(sql, args), name) do\n result, rows = @connection.execute(sql, *args) { |cursor| [cursor.fields, cursor.fetchall] }\n if result.respond_to?(:map)\n cols = result.map { |col| col.name } \n ActiveRecord::Result.new(cols, rows)\n else\n result\n end\n end\n end\n end", "def execute(*args)\n executes.concat(args)\n end", "def execute_dui(sql, opts=OPTS, &block)\n super(sql, {:arguments=>bind_arguments}.merge(opts), &block)\n end", "def execute(sql, name = nil, &block)\n log(sql, name) do\n @connection.query(sql, &block)\n end\n end", "def execute(sql, opts=OPTS, &block)\n synchronize(opts[:server]){|c| _execute(c, sql, opts, &block)} \n end", "def execute(sql)\n stmt = IBM_DB.exec(@conn, sql)\n raise Error.new(error_msg, error_sqlstate) unless stmt\n Statement.new(stmt)\n end", "def execute(*args, env: nil, log: true, &block)\n env ||= environment\n status(\"Execute: #{args.join(\" \")}\") if log\n env.execute(*args, &block)\n end", "def exec_query(sql, name = nil, binds = [])\n result = without_prepared_statement?(binds) ? exec_no_cache(sql, name, binds) :\n exec_cache(sql, name, binds)\n result_array = result_as_array(result)\n if ArVer::GTEQ_4\n column_types = compute_field_types(result)\n ret = ActiveRecord::Result.new(result.fields, result_array, column_types)\n else\n ret = ActiveRecord::Result.new(result.fields, result_array)\n end\n result.clear\n ret\n end", "def execute(sql, name = nil) \n # Only skip select statements from logging \n unless /^(select|show|begin|commit)/i.match(sql.strip) \n\t\tFile.open( File.join(RAILS_ROOT, 'db', 'ddl.sql'),'a') {|f|\n\t\t\ttemp_sql = sql.gsub(\"\\n\",\"\") \n\t\t\ttemp_sql = temp_sql + ';' if adapter_name != 'IBM_DB2' or adapter_name != 'IBM_DB'\n\t\t\tf.puts temp_sql\n\t\t}\n end\n\t old_execute sql, name\n end", "def raw_run_sql(query)\n vprint_status \"{SQLi} Executing (#{query})\"\n if @hex_encode_strings\n query = hex_encode_strings(query)\n vprint_status \"{SQLi} Encoded to (#{query})\"\n end\n @query_proc.call(query)\n end", "def exec_sql_script_in_db(db_name, db_user, db_pass, sql_script)\n # connecting to the given database\n conn = PG.connect(\n :dbname => db_name,\n :user => db_user,\n :password => db_pass)\n\n # actually executing the script\n conn.exec(sql_script)\nend", "def run\n case @command\n when \"update\"\n puts \"Updating database\"\n update_database\n when \"search\"\n # Make sure the database exists\n ensure_database\n @search.do_search(@args[0], @args[1])\n when \"\"\n # Make sure the database exists\n ensure_database\n @search.main\n else\n puts \"Invalid command, please try again.\"\n end\n\n end" ]
[ "0.74507695", "0.7110664", "0.70995957", "0.70335305", "0.6844515", "0.6713801", "0.6710364", "0.67001057", "0.6601989", "0.6577286", "0.6560464", "0.6544741", "0.6495394", "0.64886", "0.6478463", "0.64776546", "0.6475999", "0.64702666", "0.64698017", "0.64581996", "0.6455174", "0.6446169", "0.64399487", "0.6429844", "0.6420377", "0.64049965", "0.639547", "0.63914055", "0.63903177", "0.63879955", "0.63667595", "0.63665015", "0.63629127", "0.6318728", "0.631845", "0.63150436", "0.6314728", "0.6308997", "0.62677497", "0.6261795", "0.6247059", "0.6233922", "0.6233154", "0.6210923", "0.62106425", "0.6208824", "0.61977386", "0.61883265", "0.6175532", "0.6172154", "0.6159602", "0.6110317", "0.60759985", "0.60492957", "0.6029429", "0.602531", "0.6022555", "0.6018308", "0.6016187", "0.60079986", "0.59998006", "0.59585494", "0.594639", "0.5941541", "0.5928577", "0.59139955", "0.59103316", "0.5907845", "0.59078234", "0.58939135", "0.58841527", "0.5883138", "0.58691514", "0.58485925", "0.58373374", "0.5834369", "0.5828554", "0.5818562", "0.5804024", "0.57967937", "0.5789155", "0.57839596", "0.5775618", "0.57723814", "0.5772306", "0.5772226", "0.57556087", "0.5745927", "0.5731423", "0.5719706", "0.5718874", "0.5704328", "0.5697879", "0.5680772", "0.56716895", "0.56491315", "0.5617545", "0.56155926", "0.55916095", "0.55799925", "0.5577553" ]
0.0
-1
Run the given SQL with the given arguments and return the number of changed rows.
def execute_dui(sql, opts=OPTS) _execute(sql, opts){|conn| log_connection_yield(sql, conn){conn.execute_batch(sql)}; conn.row_changes} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sql_update(sql)\n exec(sql)\n # return affected rows.\n end", "def update_sql(sql, name = nil) #:nodoc:\r\n execute( sql, name )\r\n return @affected_rows\r\n end", "def affected\n IBM_DB.num_rows(@stmt)\n end", "def update_sql(sql, name = nil) #:nodoc:\n super\n self.affected_rows\n end", "def dml(cmd)\n job?(cmd) ? 0 : job.num_dml_affected_rows\n end", "def affected_rows(conn)\n s = conn.info\n if s && s =~ /Rows matched:\\s+(\\d+)\\s+Changed:\\s+\\d+\\s+Warnings:\\s+\\d+/\n $1.to_i\n else\n conn.affected_rows\n end\n end", "def query(sql, *binds)\n ds = mysql.fetch(sql, *binds)\n mysql.execute_dui(ds.update_sql) {|c| return c.last_id > 0 ? c.last_id : c.affected_rows}\n end", "def affected_rows(*args, &blk)\n execute(false) do |conn|\n conn.send(:affected_rows, *args, &blk)\n end\n end", "def changes\n @database.affected_rows\n end", "def execute_dui(sql, opts=OPTS)\n execute(sql, opts.merge(:meth=>:numrows))\n end", "def delete_sql(sql, name = nil) #:nodoc:\r\n execute( sql, name )\r\n return @affected_rows\r\n end", "def exec_update(sql, name, binds)\n exec_query(sql, name, binds)\n end", "def exec_update(sql, name = nil, binds = []) #:nodoc:\r\n log(sql, \"update\", binds) { query(sql, binds) }\r\n end", "def exec_update(sql, name, binds)\n exec_query(sql, name, binds)\n end", "def execute(sql, args=nil)\n args = args.map{|v| @db.bound_variable_arg(v, self)} if args\n q = check_disconnect_errors{execute_query(sql, args)}\n begin\n block_given? ? yield(q) : q.cmd_tuples\n ensure\n q.clear if q && q.respond_to?(:clear)\n end\n end", "def update_sql(from_id, to_id)\n <<~SQL\n WITH updated_records AS #{Gitlab::Database::AsWithMaterialized.materialized_if_supported} (\n UPDATE services SET active = TRUE\n WHERE services.project_id BETWEEN #{Integer(from_id)} AND #{Integer(to_id)} AND services.properties = '{}' AND services.type = '#{Migratable::PrometheusService.type}'\n AND #{group_cluster_condition(from_id, to_id)} AND services.active = FALSE\n RETURNING *\n )\n SELECT COUNT(*) as number_of_updated_records\n FROM updated_records\n SQL\n end", "def execute(sql, args=nil)\n\t\t\t\t\targs = args.map{|v| @db.bound_variable_arg(v, self)} if args\n\t\t\t\t\tq = check_disconnect_errors{execute_query(sql, args)}\n\t\t\t\t\tbegin\n\t\t\t\t\t\tblock_given? ? yield(q) : q.cmd_tuples\n\t\t\t\t\tensure\n\t\t\t\t\t\tq.clear if q && q.respond_to?(:clear)\n\t\t\t\t\tend\n\t\t\t\tend", "def count_by_sql(sql)\n count(sql)\n sql =~ /.*\\bwhere\\b(.*)/i\n count(:conditions => $1 || \"\")\n end", "def execute\n # First, execute the SQL, applying the valid after_filters\n ret = apply_after_filters(execute_sql)\n\n # Set changed property to true\n changed\n\n # Notify all observers of the ids of the current result\n # set\n notify_observers(\n ret.collect{|instance| instance.send(model.primary_key)},\n self\n )\n\n # Reset the Query\n reset!\n\n # Return the results\n ret\n end", "def substitute_count(sql)\n sql = \"select count(*) \\\"result_count\\\" from (#{sql}) t\".dup if count_only\n sql\n end", "def count_sql_queries_to_load\n result = 0\n\n ActiveSupport::Notifications.subscribe('sql.active_record') do |_name, _start, _finish, _id, payload|\n result += 1\n end\n\n yield\n\n result\n end", "def exec_delete(sql, name = 'SQL', binds = [])\n log(sql, name, binds) do\n result = without_prepared_statement?(binds) ? exec_no_cache(sql) :\n exec_cache(sql, binds)\n affected = result.cmd_tuples\n result.clear\n affected\n end\n end", "def processed_rows\n edited_rows_count + created_rows_count\n end", "def count_by_sql(sql)\n count = connection.select_one(sql, \"#{name} Count\").values.first\n return count ? count.to_i : 0\n end", "def execute(sql, args=nil)\n q = query(sql, args)\n block_given? ? yield(q) : q.cmd_tuples\n end", "def exec_delete(sql, name, binds)\n execute to_sql(sql, binds), name\n self.affected_rows\n end", "def update!(changes)\n Mao.sql(with_options(:update => changes).sql) do |pg_result|\n pg_result.cmd_tuples\n end\n end", "def affected_rows\n @connection.gathered_data[:affected_rows]\n end", "def exec_delete(sql, name = nil, binds = [])\n result = without_prepared_statement?(binds) ? exec_no_cache(sql, name, binds) :\n exec_cache(sql, name, binds)\n affected = result.cmd_tuples\n result.clear\n affected\n end", "def run_sql(query)\n raw_run_sql(query)\n end", "def flag_row_deltas\n logger.debug \"Flagging row deltas for #{name}\"\n\n q = \"SELECT #{pkey_selection(audit)} FROM #{audit} INNER JOIN #{watched} ON #{pkey_equality_condition} WHERE #{differences_filter}\"\n r = db.query(q).to_a\n\n unless r.count.zero?\n q = \"UPDATE #{audit} SET `_has_delta` = 1 WHERE #{condition_from_hashes(r, audit)}\"\n db.query(q) \n logger.warn \"Flagged #{r.count} rows for check in #{name}\" \n end\n end", "def execute(*args)\n @db.execute(*args)\n end", "def _execute(conn, sql, opts)\n stmt = log_connection_yield(sql, conn){conn.execute(sql)}\n if block_given?\n yield(stmt)\n else \n stmt.affected\n end\n ensure\n stmt.free if stmt\n end", "def counts_number_of_bears_with_goofy_temperaments\n \"Write your SQL query here\"\n \"SELECT count(*) FROM bears WHERE temperament = 'goofy' \";\nend", "def getrowcount\n @rowcount = @db.execute(\"select count(*) from #{@tablename}\").to_s\nend", "def count_tables(main)\n sql = \"show tables; select found_rows();\"\n res = %x(mysql --defaults-extra-file=#{main.config[:mysql_options]} --database=#{main.config[:db_name]} -e '#{sql}')\n res.match(/\\d+/)[0].to_i\nend", "def run_sql(sql)\n #connect to the|db|\n conn = PG.connect(:dbname => 'rogbloll')\n\n\n #execute the db in the argument\n res = conn.exec(sql)\n\n #now close the db\n conn.close\n\n #now return the result of the query...\n res\n\n\n \n end", "def update(values={})\n execute_dui(update_sql(values)){|c| return c.affected_rows}\n end", "def edited_rows_count\n @edited_rows_codes.count\n end", "def edited_rows_count\n @edited_rows_codes.count\n end", "def edited_rows_count\n @edited_rows_codes.count\n end", "def exec_query(sql, name = 'SQL', binds = [])\n if name == :skip_logging\n #execute(sql, name)\n hash_query(sql, name, binds)\n else\n log(sql, name) do\n #execute(sql, name)\n hash_query(sql, name, binds)\n end\n end \n end", "def to_i\n @affected_rows\n end", "def test_update_email_count\n\t\tres = DB.exec(\"SELECT email_count FROM people WHERE id=3\")\n\t\tassert_equal '4', res[0]['email_count']\n\t\tDB.exec(\"UPDATE emails SET person_id=3 WHERE id IN (5, 10)\")\n\t\tres = DB.exec(\"SELECT email_count FROM people WHERE id=3\")\n\t\tassert_equal '6', res[0]['email_count']\n\t\tDB.exec(\"DELETE FROM emails WHERE id=9\")\n\t\tres = DB.exec(\"SELECT email_count FROM people WHERE id=3\")\n\t\tassert_equal '5', res[0]['email_count']\n\t\tDB.exec(\"UPDATE emails SET person_id=NULL WHERE id IN (5, 10)\")\n\t\tres = DB.exec(\"SELECT email_count FROM people WHERE id=3\")\n\t\tassert_equal '3', res[0]['email_count']\n\t\tDB.exec(\"INSERT INTO emails(person_id, profile, their_email, their_name) VALUES (3, 'sivers', 'x@x.x', 'x')\")\n\t\tres = DB.exec(\"SELECT email_count FROM people WHERE id=3\")\n\t\tassert_equal '4', res[0]['email_count']\n\tend", "def call(*args)\n params = build_params args\n cstmt = @connection.prepare_call \"{call #{name}(#{Array.new(@cols.length){'?'}.join ', '})}\"\n begin\n process_result( args, cstmt.call(*params) )\n ensure\n cstmt.close\n end\n end", "def query(sql, args=nil)\n args = args.map{|v| @db.bound_variable_arg(v, self)} if args\n check_disconnect_errors{super}\n end", "def execute_update!( activerecord_class )\n collector = @row_collectors[ activerecord_class.table_name ]\n process_text_log << \"Updating #{ activerecord_class.name }...\\r\\n\"\n sql_diff_text_log << \"\\r\\n-- Updates for #{ activerecord_class.name }:\\r\\n\"\n is_ok = true\n begin\n collector.non_duplicates_rows.each do |row|\n sql_attributes = {}\n if row.respond_to?(:swimmer_id) # Correct the swimmer_id link:\n row.swimmer_id = @master_swimmer.id\n sql_attributes['swimmer_id'] = @master_swimmer.id\n end\n # Correct the badge link, when included in the matrix:\n if row.respond_to?(:badge_id) && @dup_badge_matrix_ids.has_key?( row.badge_id )\n row.badge_id = @dup_badge_matrix_ids[ row.badge_id ]\n sql_attributes['badge_id'] = row.badge_id\n end\n\n if row.invalid? # Check validation:\n msg = \"\\r\\n\\r\\n-- *** Swimmer Merge: validation ERROR during #{ row.class.name } update!\\r\\n\" <<\n \"- row..............: #{ row.inspect }\\r\\n\" <<\n \"- sql_attributes...: #{ sql_attributes.inspect }\\r\\n\" <<\n \"\\r\\n- ERROR............: #{ ValidationErrorTools.recursive_error_for( row ) }\\r\\n\"\n# DEBUG\n puts msg\n process_text_log << msg\n end\n row.save!\n # Build-up SQL-diff:\n if sql_attributes.size > 0 # (false = no additional comment)\n sql_diff_text_log << to_sql_update( row, false, sql_attributes, \"\\r\\n\" )\n end\n end\n rescue\n process_text_log << \"\\r\\n\\r\\n*** Swimmer Merge: exception caught!\\r\\n\"\n process_text_log << \"*** Phase '#{ activerecord_class.name } UPDATE': #{ $!.to_s }\\r\\n\" if $!\n process_text_log << sql_diff_text_log\n is_ok = false\n end\n is_ok\n end", "def run_sql(sql_query)\n begin\n CONNECTION.execute(sql_query)\n rescue Exception => msg\n @errors << msg\n false\n end\n end", "def affected_rows()\n #This is a stub, used for indexing\n end", "def update_sql(sql, name = nil)\n execute(sql, name)\n end", "def update_sql(sql, name = nil)\n result = super\n result.length == 0 ? 0 : result.rows[0][0]\n end", "def run_sql(sql)\n db = PG.connect(dbname: 'goodfoodhunting')\n results = db.exec(sql)\n db.close\n results\nend", "def execute(sql)\n raise NotImplementedError, \"#execute should be overridden by adapters\"\n end", "def run_sql(sql)\n conn = PG.connect(dbname: 'goodfoodhunting')\n result = conn.exec(sql)\n conn.close\n return result\nend", "def delete\n execute_dui(delete_sql){|c| return c.affected_rows}\n end", "def execute_query(sql, args)\n @db.log_connection_yield(sql, self, args){args ? async_exec(sql, args) : async_exec(sql)}\n end", "def execute(sql)\n @database_handle.execute(sql)\n end", "def query(sql, name = nil) #:nodoc:\n log(sql, name) do\n @connection.execute(sql).rows\n end\n end", "def ask(sql, *args, into: nil)\n catch(:ok) do\n each(sql, *args, into: into) { |row| throw :ok, row }\n nil\n end\n end", "def t_counts (conn, log, t)\n log.d(\"Checking counts.\");\n q = \"SELECT COUNT(*) AS c FROM #{t}\";\n log.d(q);\n conn.query(q) do |r|\n log.d(r[:c]);\n end\nend", "def exec_query(sql, name = 'SQL', _binds = [], prepare: false)\n log(sql, name) do\n result = @connection.run(sql)\n ActiveRecord::Result.new(result.columns, result.rows)\n end\n end", "def run(args)\n state = @proc.state\n context = @proc.context\n max_frame = context.stack_size - state.frame_pos\n if args.size == 1\n frame_pos = state.frame_pos\n else\n count_str = args[1]\n count_opts = {\n :msg_on_error => \n \"The '#{NAME}' command argument must eval to an integer. Got: %s\" % \n count_str,\n :min_value => 0,\n :max_valiue => context.stack_size - state.frame_pos\n }\n count = @proc.get_an_int(count_str, count_opts)\n return unless count\n frame_pos = count - 1 \n end\n context.stop_frame = frame_pos\n state.frame_pos = 0\n state.proceed\n @proc.leave_cmd_loop = true\n end", "def run_sql(sql)\n db = PG.connect(:dbname => 'movies', :host => 'localhost')\n result = db.exec(sql)\n db.close\n result\n end", "def execute_query(sql, args)\n\t\t\t\t\t@db.log_connection_yield(sql, self, args){args ? self.async_exec(sql, args) : self.async_exec(sql)}\n\t\t\t\tend", "def run_sql(sql)\n\tconn = PG.connect(dbname: \"video_store\", host: 'localhost')\n\tresult = conn.exec(sql)\n\tconn.close\n\tresult \nend", "def count(*args)\n # Ignore first arg if it is not a Hash\n a = self.respond_to?(:construct_count_options_from_legacy_args) ?\n construct_count_options_from_legacy_args(*args) :\n construct_count_options_from_args(*args)\n column_name, options = *a\n find_every(options).count()\n end", "def db_query_transform__count query\n tmp_table = \"resultset_table\"\n make_tmp_table = db_query_transform__subquery query, tmp_table\n \"SELECT COUNT(*) FROM #{make_tmp_table}\"\n end", "def check_rules_on_update\n logger.debug \"Running UPDATE checks for #{name}\"\n\n db.query(\"SELECT * FROM #{audit} WHERE `_has_delta` = 1\").each do |audit_row|\n pkey = audit_row.select { |k,v| primary_key.include?(k) }\n logger.debug \"Checking row: #{pkey}\"\n\n watched_row_query = \"SELECT * FROM #{watched} WHERE #{condition_from_hashes(pkey)}\"\n watched_row = db.query(watched_row_query).first\n\n # If we do not have a matched row here it'll show in the deletion checks, so we\n # do nothing specific here\n if watched_row\n fields.each do |f|\n violations = f.on_update(audit_row, watched_row)\n violations.compact.each { |v| record_violation(v[:description], audit_row, v[:rule_name], audit_row['_last_version'], f.name) }\n end\n\n rules[:update].each do |rule|\n v = rule.execute(audit_row, watched_row, self)\n record_violation(v, [watched_row, audit_row], rule.name, audit_row['_last_version']) if v\n end\n end\n end\n end", "def db_count_queries &block\n count = 0\n\n counter_f = ->(name, started, finished, unique_id, payload) {\n unless %w[ CACHE SCHEMA ].include? payload[:name]\n count += 1\n end\n }\n ActiveSupport::Notifications.subscribed(counter_f, \"sql.active_record\", &block)\n count\n end", "def update!(**args)\n @sql_expression = args[:sql_expression] if args.key?(:sql_expression)\n end", "def update!(**args)\n @sql_expression = args[:sql_expression] if args.key?(:sql_expression)\n end", "def count_all_entries(database)\n sql = <<-SQL\n SELECT hero_seen, COUNT(*) c FROM reports GROUP BY hero_seen HAVING c > 1\n SQL\n p database.execute(sql)\nend", "def run_sql(sql_query)\n begin\n CONNECTION.execute(sql_query)\n rescue Exception => msg\n msg\n end\n end", "def execute_sql_exitstatus(query, ctrl)\n shell_out(sql_command_string(query, nil, ctrl), user: 'root').exitstatus\n end", "def execute(sql, name = nil)\n # check for some DDL and DML statements\n puts \"Running sql? #{RUN_SQL}\"\n\n if /(create |alter |drop |insert |delete |update )/i.match sql.squish\n File.open(SQL_FILENAME, 'a') { |f| f.puts \"#{sql};\\n\" }\n puts \"Rails.env: #{Rails.env} - #{ENV['FPHS_POSTGRESQL_SCHEMA']}\"\n old_execute sql, name if RUN_SQL\n else\n # pass everything else to the aliased execute\n puts \"------------- (#{name}) ---------------\"\n puts sql || ''\n puts \"------------- ---------------\"\n old_execute sql, name if RUN_SQL\n end\n end", "def run_scan\n session = Session.new\n expected_result = {}\n expected_result[:conflict] = session.left.select_one( \\\n \"select count(id) as count from big_scan where diff_type = 'conflict'\")['count'].to_i\n expected_result[:left] = session.left.select_one( \\\n \"select count(id) as count from big_scan where diff_type = 'left'\")['count'].to_i\n expected_result[:right] = session.right.select_one( \\\n \"select count(id) as count from big_scan where diff_type = 'right'\")['count'].to_i\n \n number_records = session.left.select_one( \\\n \"select count(id) as count from big_scan\")['count'].to_i \\\n + expected_result[:right]\n number_differences = expected_result.values.inject {|sum, n| sum + n }\n received_result = {:conflict => 0, :left => 0, :right => 0}\n\n table_scan_class = TableScanHelper.scan_class(session)\n puts \"\\nScanning table big_scan (#{number_differences} differences in #{number_records} records) using #{table_scan_class.name}\"\n\n scan = table_scan_class.new session, 'big_scan'\n scan.progress_printer = RR::ScanProgressPrinters::ProgressBar\n benchmark = Benchmark.measure {\n scan.run do |diff_type, row|\n received_result[diff_type] += 1\n end\n }\n puts \"\\n time required: #{benchmark}\"\n \n received_result.should == expected_result\n end", "def run_sql(sql)\n conn = PG.connect(dbname: 'movies')\n result = conn.exec(sql)\n conn.close\n result\nend", "def update!(**args)\n @row_count = args[:row_count] if args.key?(:row_count)\n end", "def query(sql)\n database.execute2(sql)\n end", "def row_count \r\n assert_exists\r\n return rows.length\r\n end", "def age(id)\n row = @pgsql.exec('SELECT executed FROM daemon WHERE id = $1', [id])[0]\n return 10_000_000_000 if row.nil?\n Time.now - Time.parse(row['executed'])\n end", "def execute_batch_counting(projects_relation)\n end", "def execute(sql, *args, &block)\n @db.execute(rewrite_table_names(sql), *args, &block)\n end", "def update!(**args)\n @evaluated_count = args[:evaluated_count] if args.key?(:evaluated_count)\n @failing_rows_query = args[:failing_rows_query] if args.key?(:failing_rows_query)\n @null_count = args[:null_count] if args.key?(:null_count)\n @pass_ratio = args[:pass_ratio] if args.key?(:pass_ratio)\n @passed = args[:passed] if args.key?(:passed)\n @passed_count = args[:passed_count] if args.key?(:passed_count)\n @rule = args[:rule] if args.key?(:rule)\n end", "def execute *params\r\n sql = parse_args( *params )\r\n @driver.execute( sql )\r\n end", "def run_sql(sql)\n\tdb = PG.connect(dbname: 'address_book', host: 'localhost')\n\tresult = db.exec(sql)\n\tdb.close\n\tresult\nend", "def update(sql, name = nil) end", "def run_sql(sql)\n conn = PG.connect(dbname: \"memetube\", host: \"localhost\")\n begin\n result = conn.exec(sql)\n ensure\n conn.close\n end\n result\nend", "def exec_query(sql, name = 'SQL', binds = [])\n log(sql, name, binds) do\n result = without_prepared_statement?(binds) ? exec_no_cache(sql) :\n exec_cache(sql, binds)\n result_array = result_as_array(result)\n if ActiveRecord::VERSION::MAJOR >= 4\n column_types = compute_field_types(result)\n ret = ActiveRecord::Result.new(result.fields, result_array, column_types)\n else\n ret = ActiveRecord::Result.new(result.fields, result_array)\n end\n result.clear\n ret\n end\n end", "def exec_query(sql, name = 'SQL', binds = [], prepare: false) # rubocop:disable Lint/UnusedMethodArgument\n log(sql, name) do\n sql = bind_params(binds, sql) if prepared_statements\n stmt = @connection.run(sql)\n\n columns = stmt.columns\n values = stmt.to_a\n stmt.drop\n\n values = dbms_type_cast(columns.values, values)\n column_names = columns.keys.map { |key| format_case(key) }\n ActiveRecord::Result.new(column_names, values)\n end\n end", "def exec_query(sql, name = 'SQL', binds = [])\n execute(sql, name, binds)\n end", "def apply_single\n validate_schema\n\n # Prepare some lists of columns.\n key_cols = @db1.primary_key(@table1)\n data_cols = @db1.except_primary_key(@table1)\n all_cols = @db1.column_names(@table1)\n\n # Let our public know we are beginning.\n @patch.begin_diff\n\n # Advertise column names.\n @rc_columns = DiffColumns.new\n @rc_columns.title_row = all_cols\n @rc_columns.update(0)\n cells = all_cols.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"@@\",cells)\n @patch.apply_row(rc)\n\n # If requested, we will be providing context rows around changed rows.\n # This is not a natural thing to do with SQL, so we do it only on request.\n # When requested, we need to buffer row changes.\n @pending_rcs = []\n\n # Prepare some useful SQL fragments to assemble later.\n sql_table1 = @db1.quote_table(@table1)\n sql_table2 = @db1.quote_table(@table2)\n sql_key_cols = key_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_all_cols = all_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_key_match = key_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS #{sql_table2}.#{c}\"}.join(\" AND \")\n sql_data_mismatch = data_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS NOT #{sql_table2}.#{c}\"}.join(\" OR \")\n\n # For one query we will need to interleave columns from two tables. For\n # portability we need to give these columns distinct names.\n weave = all_cols.map{|c| [[sql_table1,@db1.quote_column(c)],\n [sql_table2,@db2.quote_column(c)]]}.flatten(1)\n dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]}\"}\n sql_dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]} AS #{c[0].gsub(/[^a-zA-Z0-9]/,'_')}_#{c[1].gsub(/[^a-zA-Z0-9]/,'_')}\"}.join(\",\")\n\n # Prepare a map of primary key offsets.\n keys_in_all_cols = key_cols.each.map{|c| all_cols.index(c)}\n keys_in_dbl_cols = keys_in_all_cols.map{|x| 2*x}\n\n # Find rows in table2 that are not in table1.\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table2} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table1} WHERE #{sql_key_match})\"\n apply_inserts(sql,all_cols,keys_in_all_cols)\n\n # Find rows in table1 and table2 that differ while having the same primary\n # key.\n sql = \"SELECT #{sql_dbl_cols} FROM #{sql_table1} INNER JOIN #{sql_table2} ON #{sql_key_match} WHERE #{sql_data_mismatch}\"\n apply_updates(sql,dbl_cols,keys_in_dbl_cols)\n\n # Find rows that are in table1 but not table2\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table1} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table2} WHERE #{sql_key_match})\"\n apply_deletes(sql,all_cols,keys_in_all_cols)\n\n # If we are supposed to provide context, we need to deal with row order.\n if @patch.want_context\n sql = \"SELECT #{sql_all_cols}, 0 AS __coopy_tag__ FROM #{sql_table1} UNION SELECT #{sql_all_cols}, 1 AS __coopy_tag__ FROM #{sql_table2} ORDER BY #{sql_key_cols}, __coopy_tag__\"\n apply_with_context(sql,all_cols,keys_in_all_cols)\n end\n\n # Done!\n @patch.end_diff\n end", "def apply_single\n validate_schema\n\n # Prepare some lists of columns.\n key_cols = @db1.primary_key(@table1)\n data_cols = @db1.except_primary_key(@table1)\n all_cols = @db1.column_names(@table1)\n\n # Let our public know we are beginning.\n @patch.begin_diff\n\n # Advertise column names.\n @rc_columns = DiffColumns.new\n @rc_columns.title_row = all_cols\n @rc_columns.update(0)\n cells = all_cols.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"@@\",cells)\n @patch.apply_row(rc)\n\n # If requested, we will be providing context rows around changed rows.\n # This is not a natural thing to do with SQL, so we do it only on request.\n # When requested, we need to buffer row changes.\n @pending_rcs = []\n\n # Prepare some useful SQL fragments to assemble later.\n sql_table1 = @db1.quote_table(@table1)\n sql_table2 = @db1.quote_table(@table2)\n sql_key_cols = key_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_all_cols = all_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_key_match = key_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS #{sql_table2}.#{c}\"}.join(\" AND \")\n sql_data_mismatch = data_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS NOT #{sql_table2}.#{c}\"}.join(\" OR \")\n\n # For one query we will need to interleave columns from two tables. For\n # portability we need to give these columns distinct names.\n weave = all_cols.map{|c| [[sql_table1,@db1.quote_column(c)],\n [sql_table2,@db2.quote_column(c)]]}.flatten(1)\n dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]}\"}\n sql_dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]} AS #{c[0].gsub(/[^a-zA-Z0-9]/,'_')}_#{c[1].gsub(/[^a-zA-Z0-9]/,'_')}\"}.join(\",\")\n\n # Prepare a map of primary key offsets.\n keys_in_all_cols = key_cols.each.map{|c| all_cols.index(c)}\n keys_in_dbl_cols = keys_in_all_cols.map{|x| 2*x}\n\n # Find rows in table2 that are not in table1.\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table2} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table1} WHERE #{sql_key_match})\"\n apply_inserts(sql,all_cols,keys_in_all_cols)\n\n # Find rows in table1 and table2 that differ while having the same primary\n # key.\n sql = \"SELECT #{sql_dbl_cols} FROM #{sql_table1} INNER JOIN #{sql_table2} ON #{sql_key_match} WHERE #{sql_data_mismatch}\"\n apply_updates(sql,dbl_cols,keys_in_dbl_cols)\n\n # Find rows that are in table1 but not table2\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table1} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table2} WHERE #{sql_key_match})\"\n apply_deletes(sql,all_cols,keys_in_all_cols)\n\n # If we are supposed to provide context, we need to deal with row order.\n if @patch.want_context\n sql = \"SELECT #{sql_all_cols}, 0 AS __coopy_tag__ FROM #{sql_table1} UNION SELECT #{sql_all_cols}, 1 AS __coopy_tag__ FROM #{sql_table2} ORDER BY #{sql_key_cols}, __coopy_tag__\"\n apply_with_context(sql,all_cols,keys_in_all_cols)\n end\n\n # Done!\n @patch.end_diff\n end", "def apply_single\n validate_schema\n\n # Prepare some lists of columns.\n key_cols = @db1.primary_key(@table1)\n data_cols = @db1.except_primary_key(@table1)\n all_cols = @db1.column_names(@table1)\n\n # Let our public know we are beginning.\n @patch.begin_diff\n\n # Advertise column names.\n @rc_columns = DiffColumns.new\n @rc_columns.title_row = all_cols\n @rc_columns.update(0)\n cells = all_cols.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"@@\",cells)\n @patch.apply_row(rc)\n\n # If requested, we will be providing context rows around changed rows.\n # This is not a natural thing to do with SQL, so we do it only on request.\n # When requested, we need to buffer row changes.\n @pending_rcs = []\n\n # Prepare some useful SQL fragments to assemble later.\n sql_table1 = @db1.quote_table(@table1)\n sql_table2 = @db1.quote_table(@table2)\n sql_key_cols = key_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_all_cols = all_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_key_match = key_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS #{sql_table2}.#{c}\"}.join(\" AND \")\n sql_data_mismatch = data_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS NOT #{sql_table2}.#{c}\"}.join(\" OR \")\n\n # For one query we will need to interleave columns from two tables. For\n # portability we need to give these columns distinct names.\n weave = all_cols.map{|c| [[sql_table1,@db1.quote_column(c)],\n [sql_table2,@db2.quote_column(c)]]}.flatten(1)\n dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]}\"}\n sql_dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]} AS #{c[0].gsub(/[^a-zA-Z0-9]/,'_')}_#{c[1].gsub(/[^a-zA-Z0-9]/,'_')}\"}.join(\",\")\n\n # Prepare a map of primary key offsets.\n keys_in_all_cols = key_cols.each.map{|c| all_cols.index(c)}\n keys_in_dbl_cols = keys_in_all_cols.map{|x| 2*x}\n\n # Find rows in table2 that are not in table1.\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table2} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table1} WHERE #{sql_key_match})\"\n apply_inserts(sql,all_cols,keys_in_all_cols)\n\n # Find rows in table1 and table2 that differ while having the same primary\n # key.\n sql = \"SELECT #{sql_dbl_cols} FROM #{sql_table1} INNER JOIN #{sql_table2} ON #{sql_key_match} WHERE #{sql_data_mismatch}\"\n apply_updates(sql,dbl_cols,keys_in_dbl_cols)\n\n # Find rows that are in table1 but not table2\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table1} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table2} WHERE #{sql_key_match})\"\n apply_deletes(sql,all_cols,keys_in_all_cols)\n\n # If we are supposed to provide context, we need to deal with row order.\n if @patch.want_context\n sql = \"SELECT #{sql_all_cols}, 0 AS __coopy_tag__ FROM #{sql_table1} UNION SELECT #{sql_all_cols}, 1 AS __coopy_tag__ FROM #{sql_table2} ORDER BY #{sql_key_cols}, __coopy_tag__\"\n apply_with_context(sql,all_cols,keys_in_all_cols)\n end\n\n # Done!\n @patch.end_diff\n end", "def apply_with_context(sql,all_cols,keys_in_all_cols)\n hits = {}\n @pending_rcs.each do |rc|\n hits[rc.key] = rc\n end \n hist = []\n n = 2\n pending = 0\n skipped = false\n noted = false\n last_row = nil\n @db1.fetch(sql,all_cols + [\"__coopy_tag__\"]) do |row|\n tag = row.pop.to_i\n k = keyify(row.values_at(*keys_in_all_cols))\n if hits[k]\n emit_skip(row) if skipped\n hist.each do |row0|\n cells = row0.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"\",cells)\n rc.columns = @rc_columns\n @patch.apply_row(rc)\n end\n hist.clear\n pending = n\n @patch.apply_row(hits[k])\n hits.delete(k)\n skipped = false\n noted = true\n elsif tag == 1\n # ignore redundant row\n elsif pending>0\n emit_skip(row) if skipped\n cells = row.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"\",cells)\n rc.columns = @rc_columns\n @patch.apply_row(rc)\n pending = pending-1\n skipped = false\n else\n hist << row\n if hist.length>n\n skipped = true\n last_row = row\n hist.shift\n end\n end\n end\n emit_skip(last_row) if skipped and noted\n end", "def apply_with_context(sql,all_cols,keys_in_all_cols)\n hits = {}\n @pending_rcs.each do |rc|\n hits[rc.key] = rc\n end \n hist = []\n n = 2\n pending = 0\n skipped = false\n noted = false\n last_row = nil\n @db1.fetch(sql,all_cols + [\"__coopy_tag__\"]) do |row|\n tag = row.pop.to_i\n k = keyify(row.values_at(*keys_in_all_cols))\n if hits[k]\n emit_skip(row) if skipped\n hist.each do |row0|\n cells = row0.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"\",cells)\n rc.columns = @rc_columns\n @patch.apply_row(rc)\n end\n hist.clear\n pending = n\n @patch.apply_row(hits[k])\n hits.delete(k)\n skipped = false\n noted = true\n elsif tag == 1\n # ignore redundant row\n elsif pending>0\n emit_skip(row) if skipped\n cells = row.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"\",cells)\n rc.columns = @rc_columns\n @patch.apply_row(rc)\n pending = pending-1\n skipped = false\n else\n hist << row\n if hist.length>n\n skipped = true\n last_row = row\n hist.shift\n end\n end\n end\n emit_skip(last_row) if skipped and noted\n end", "def apply_with_context(sql,all_cols,keys_in_all_cols)\n hits = {}\n @pending_rcs.each do |rc|\n hits[rc.key] = rc\n end \n hist = []\n n = 2\n pending = 0\n skipped = false\n noted = false\n last_row = nil\n @db1.fetch(sql,all_cols + [\"__coopy_tag__\"]) do |row|\n tag = row.pop.to_i\n k = keyify(row.values_at(*keys_in_all_cols))\n if hits[k]\n emit_skip(row) if skipped\n hist.each do |row0|\n cells = row0.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"\",cells)\n rc.columns = @rc_columns\n @patch.apply_row(rc)\n end\n hist.clear\n pending = n\n @patch.apply_row(hits[k])\n hits.delete(k)\n skipped = false\n noted = true\n elsif tag == 1\n # ignore redundant row\n elsif pending>0\n emit_skip(row) if skipped\n cells = row.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"\",cells)\n rc.columns = @rc_columns\n @patch.apply_row(rc)\n pending = pending-1\n skipped = false\n else\n hist << row\n if hist.length>n\n skipped = true\n last_row = row\n hist.shift\n end\n end\n end\n emit_skip(last_row) if skipped and noted\n end", "def count **args\n\t\tquery( **( { projection: 'COUNT(*)' }.merge args )).execute(reduce: true){|x| x[:\"COUNT(*)\"]}\n end", "def run_sql(sql, arr = []) # array is for security feature\n db = PG.connect(ENV['DATABASE_URL'] || {dbname: 'picgallary'})\n results = db.exec_params(sql, arr)\n db.close\n return results\n end", "def modified_records?\n @modified_records ||= begin\n created = creator_association_names.map {|name| send(name).select(\"id\").to_sql}\n updated = updater_association_names.map {|name| send(name).select(\"id\").to_sql}\n\n count = self.class.count_by_sql(%{\n SELECT\n CASE\n WHEN EXISTS (\n SELECT 1 FROM (\n #{(created + updated).join(' UNION ')}\n ) AS created\n ) THEN 1\n ELSE 0\n END AS count\n })\n\n count == 1\n end\n end" ]
[ "0.65926534", "0.63048047", "0.6213127", "0.60582316", "0.6021708", "0.5997024", "0.587067", "0.5829387", "0.5741632", "0.55804956", "0.5538182", "0.5518608", "0.55138236", "0.5482139", "0.547171", "0.5430524", "0.5404838", "0.5386027", "0.5377833", "0.53468674", "0.53310955", "0.53249246", "0.5309571", "0.5308707", "0.530541", "0.5289466", "0.5273552", "0.525772", "0.52171385", "0.5196997", "0.5175952", "0.51463354", "0.5131014", "0.5124044", "0.5117889", "0.51107836", "0.5110173", "0.5097589", "0.5085046", "0.5085046", "0.5085046", "0.50795203", "0.5079417", "0.50655496", "0.5054475", "0.50513715", "0.504814", "0.5047291", "0.50387996", "0.5031305", "0.5025389", "0.50116587", "0.5010919", "0.5003872", "0.49868712", "0.49781334", "0.49671337", "0.49376723", "0.4928897", "0.49225202", "0.4921772", "0.49158335", "0.49157822", "0.49156028", "0.49131402", "0.49130753", "0.4907905", "0.48980832", "0.48979437", "0.4896681", "0.4896681", "0.4885561", "0.4882371", "0.48800045", "0.48711413", "0.48665282", "0.48644525", "0.4861909", "0.48531142", "0.48518872", "0.48514637", "0.48468354", "0.48467058", "0.48456237", "0.48440462", "0.48403177", "0.4815127", "0.48117456", "0.48082823", "0.4795596", "0.4779875", "0.47797662", "0.47797662", "0.47797662", "0.47749156", "0.47749156", "0.47749156", "0.4774862", "0.47672895", "0.476057" ]
0.52809066
26
Run the given SQL with the given arguments and return the last inserted row id.
def execute_insert(sql, opts=OPTS) _execute(sql, opts){|conn| log_connection_yield(sql, conn){conn.execute_batch(sql)}; conn.last_insert_rowid} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil) #:nodoc:\r\n execute(sql, name)\r\n identity = last_inserted_id(nil)\r\n retval = id_value if retval == 0\r\n return retval\r\n end", "def insert(arel, name = nil, pk = nil, id_value = nil, sequence_name = nil, binds = [])\n exec_insert(to_sql(arel), name, binds)\n retval = last_inserted_id(nil)\n retval = id_value if retval == 0\n return retval\n end", "def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil, binds = [])\n # Extract the table from the insert sql. Yuck.\n table = sql.split(\" \", 4)[2].gsub('\"', '')\n\n # Try an insert with 'returning id' if available (PG >= 8.2)\n if supports_insert_with_returning? && id_value.nil?\n pk, sequence_name = *pk_and_sequence_for(table) unless pk\n if pk\n sql = substitute_binds(sql, binds)\n id_value = select_value(\"#{sql} RETURNING #{quote_column_name(pk)}\")\n clear_query_cache #FIXME: Why now?\n return id_value\n end\n end\n\n # Otherwise, plain insert\n execute(sql, name, binds)\n\n # Don't need to look up id_value if we already have it.\n # (and can't in case of non-sequence PK)\n unless id_value\n # If neither pk nor sequence name is given, look them up.\n unless pk || sequence_name\n pk, sequence_name = *pk_and_sequence_for(table)\n end\n\n # If a pk is given, fallback to default sequence name.\n # Don't fetch last insert id for a table without a pk.\n if pk && sequence_name ||= default_sequence_name(table, pk)\n id_value = last_insert_id(table, sequence_name)\n end\n end\n id_value\n end", "def last_insert_id(conn, opts=OPTS)\n statement(conn) do |stmt|\n rs = stmt.executeQuery('SELECT last_insert_rowid()')\n rs.next\n rs.getLong(1)\n end\n end", "def execute_insert(sql, opts=OPTS)\n execute(sql, opts.merge(:meth=>:autoid))\n end", "def sql_for_insert(sql, pk, id_value, sequence_name, binds)\n unless pk\n table_ref = extract_table_ref_from_insert_sql(sql)\n pk = primary_key(table_ref) if table_ref\n end\n\n sql = \"#{sql} RETURNING #{quote_column_name(pk)}\" if pk\n\n [sql, binds]\n end", "def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)\n execute(sql, name)\n id_value\n end", "def exec_insert(sql, name = nil, binds = [], pk = nil, sequence_name = nil)\n exec_query(sql, name, binds)\n end", "def insert(*values)\n execute_dui(insert_sql(*values)){|c| return c.last_id}\n end", "def last_insert_id(conn, opts={})\n stmt = conn.createStatement\n begin\n sql = opts[:prepared] ? 'SELECT @@IDENTITY' : 'SELECT SCOPE_IDENTITY()'\n rs = log_yield(sql){stmt.executeQuery(sql)}\n rs.next\n rs.getInt(1)\n ensure\n stmt.close\n end\n end", "def execute_insert(sql, opts=OPTS)\n synchronize(opts[:server]) do |c|\n if sql.is_a?(Symbol)\n execute_prepared_statement(sql, opts)\n else\n _execute(c, sql, opts)\n end\n _execute(c, \"SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1\", opts){|stmt| i = stmt.fetch_array.first.to_i; i}\n end\n rescue Connection::Error => e\n raise_error(e)\n end", "def insert\n DATABASE.execute(\"INSERT INTO students (name, age, github) VALUES (?, ?, ?)\", @name, @age, @github)\n @id = DATABASE.last_insert_row_id\n end", "def last_insert_id(conn, opts=OPTS)\n statement(conn) do |stmt|\n sql = opts[:prepared] ? 'SELECT @@IDENTITY' : 'SELECT SCOPE_IDENTITY()'\n rs = log_connection_yield(sql, conn){stmt.executeQuery(sql)}\n rs.next\n rs.getLong(1)\n end\n end", "def last_insert_id(conn, opts=OPTS)\n statement(conn) do |stmt|\n sql = opts[:prepared] ? 'SELECT @@IDENTITY' : 'SELECT SCOPE_IDENTITY()'\n rs = log_connection_yield(sql, conn){stmt.executeQuery(sql)}\n rs.next\n rs.getLong(1)\n end\n end", "def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)\n super\n\n exec_query('SELECT @@IDENTITY AS id')\n end", "def save()\n sql = \"INSERT INTO albums (artist_name, album_title, genre) VALUES ($1, $2, $3) RETURNING id;\"\n values = [@artist_name, @album_title, @genre]\n result = SqlRunner.run(sql, values)\n @id = result[0]['id'].to_i\nend", "def query(sql, *binds)\n ds = mysql.fetch(sql, *binds)\n mysql.execute_dui(ds.update_sql) {|c| return c.last_id > 0 ? c.last_id : c.affected_rows}\n end", "def save\n sql = <<-SQL\n INSERT INTO #{self.table_name_for_insert} (#{self.col_names_for_insert})\n VALUES (#{self.values_for_insert})\n SQL\n\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{self.table_name_for_insert}\")[0][0]\n end", "def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)\n return super if id_value\n pk = pk_from_insert_sql(sql) unless pk\n select_value(\"#{sql} RETURNING #{quote_column_name(pk)}\")\n end", "def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)\n return super if id_value\n pk = pk_from_insert_sql(sql) unless pk\n select_value(\"#{sql} RETURNING #{quote_column_name(pk)}\")\n end", "def insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)\n table = sql.split(\" \", 4)[2]\n super || last_insert_id(table, sequence_name || default_sequence_name(table, pk))\n end", "def exec_insert(sql, name, binds)\n exec_query(sql, name, binds)\n end", "def reaktor_insert(row)\n insert_id = 0\n unless row.idstore.nil?\n Log.write_log($import_log, \"reaktor_insert: Table: #{row.table_name} args: #{row.idstore.args * ', '}\")\n else\n Log.write_log($import_log, \"reaktor_insert: Table: #{row.table_name} No IdStore object\")\n end\n query = \"INSERT INTO #{row.table_name} (#{row.get_column_name_string})\\n VALUES (#{(['?']*row.size).join(', ')})\"\n sth = $dbh_ms.prepare(query)\n begin\n sth.execute(*row.get_column_values)\n rescue\n $stderr.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog\"\n Log.write_log('error', \"Could not insert data. Message: #{$!}. query: \\\"#{get_query_string(sth)}\\\"\")\n raise\n exit\n end\n begin\n insert_id = $dbh_ms.func(:insert_id) unless row.idstore.nil?\n rescue\n $stderr.puts \"### Error in #{__FILE__} on line #{__LINE__}. See errorlog\"\n Log.write_log('error', \"Could not get insert id. Message: #{$!}.\")\n raise\n exit\n end\n if insert_id > 0\n row.store_id(insert_id)\n Log.write_log($import_log, \"Insert id store to table: #{row.table_name} id_store parameters: (#{row.idstore.args * ', '}) id: #{insert_id}\")\n else\n unless row.idstore.nil?\n Log.write_log($import_log, \"No id stored for table: #{row.table_name} id_store parameters: (#{row.idstore.args * ', '})\")\n else\n Log.write_log($import_log, \"No id stored for table: #{row.table_name} No IdStore object\")\n end\n \n end\nend", "def insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)\n # Extract the table from the insert sql. Yuck.\n table = sql.split(\" \", 4)[2].gsub('\"', '')\n\n # Otherwise, insert then grab last_insert_id.\n if insert_id = super\n insert_id\n else\n # If neither pk nor sequence name is given, look them up.\n unless pk || sequence_name\n pk, sequence_name = *pk_and_sequence_for(table)\n end\n\n # If a pk is given, fallback to default sequence name.\n # Don't fetch last insert id for a table without a pk.\n if pk && sequence_name ||= default_sequence_name(table, pk)\n last_insert_id(table, sequence_name)\n end\n end\n end", "def last_insert_id\n @connection.sql(\"SELECT @@IDENTITY\")\n unless @connection.cmd_fail?\n id = @connection.top_row_result.rows.first.first\n if id\n id = id.to_i\n id = nil if id == 0\n end\n else\n id = nil\n end\n id\n end", "def execute_insert(sql, opts={})\n synchronize(opts[:server]) do |conn|\n conn.execute(sql)\n insert_result(conn, opts[:table], opts[:values])\n end\n end", "def exec_insert(sql, name, binds)\n exec_query(sql, name, binds)\n end", "def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end", "def last_insert_row_id\n SQLite::API.last_insert_row_id( @handle )\n end", "def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n\n DB[:conn].execute(sql)\n\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end", "def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n \n DB[:conn].execute(sql)\n \n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end", "def exec_insert(sql, name = nil, binds = []) #:nodoc:\r\n log(sql, \"insert\", binds) { query(sql, binds) }\r\n end", "def execute(*args)\n @db.execute(*args)\n end", "def last_insert_id(conn, opts={})\n nil\n end", "def last_insert_id(conn, opts={})\n nil\n end", "def save\n # binding.pry\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n # binding.pry\n DB[:conn].execute(sql)\n # binding.pry\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n # binding.pry\n end", "def insert(*args)\n r = super\n if s = opts[:sequence]\n with_sql(\"SELECT #{literal(s)}.currval FROM dual\").single_value.to_i\n else\n r\n end\n end", "def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end", "def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end", "def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end", "def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end", "def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end", "def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end", "def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end", "def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end", "def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end", "def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end", "def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end", "def save\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end", "def last_insert_row_id\n @database.insert_id\n end", "def save\n sql = \"INSERT INTO #{self.table_name_for_insert} (#{self.col_names_for_insert}) VALUES (#{self.values_for_insert})\"\n DB[:conn].execute(sql)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{self.table_name_for_insert}\")[0][0]\n end", "def insert\n DATABASE.execute(\"INSERT INTO locations (city) VALUES ('#{@city}')\")\n @id = DATABASE.last_insert_row_id # will return the value of the row id\n end", "def insert_sql(sql, name = nil, pri_key = nil, id_value = nil, sequence_name = nil)\n unless pri_key\n table_ref = extract_table_ref_from_insert_sql(sql)\n pri_key = primary_key(table_ref) if table_ref\n end\n\n if pri_key\n select_value(\"#{sql} RETURNING #{quote_column_name(pri_key)}\")\n else\n super\n end\n end", "def save\n sql = <<-SQL\n INSERT INTO #{table_name_for_insert} (#{col_names_for_insert})\n VALUES (#{values_for_insert})\n SQL\n\n DB[:conn].execute(sql)\n # need to assign .id here because does not have id when instantiated, but now has one via its database\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end", "def last_insert_id(table, sequence_name) #:nodoc:\n Integer(select_value(\"SELECT currval('#{sequence_name}')\"))\n end", "def execute(sql, args=nil)\n q = query(sql, args)\n block_given? ? yield(q) : q.cmd_tuples\n end", "def last_insert_id(sequence_name)\n r = exec_query(\"SELECT currval('#{sequence_name}')\", 'SQL')\n Integer(r.rows.first.first)\n end", "def insert\n DATABASE.execute(\"INSERT INTO dogs (name, breed, age, serial_num, colour, description, temperament_id, owner_id) VALUES \n ('#{@name}', '#{@breed}', #{@age}, #{@serial_num}, '#{@colour}', '#{@description}', #{@temperament_id}, #{@owner_id})\")\n @id = DATABASE.last_insert_row_id\n end", "def save\n sql = <<-SQL\n INSERT INTO students (name, grade)\n VALUES (?,?)\n SQL\n\n DB[:conn].execute(sql, self.name, self.grade)\n\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM students\")[0][0]\nend", "def save()\n sql = \"INSERT INTO transactions (amount, merchant_id, tag_id)\n VALUES ($1, $2, $3)\n RETURNING id\"\n values = [@amount, @merchant_id, @tag_id]\n @id = SqlRunner.run(sql, values)[0]['id'].to_i\n end", "def insert(sql, name = nil, pk = nil, id_value = nil) end", "def insert\n DATABASE.execute(\"INSERT INTO locations (location_name) \n VALUES ('#{@location_name}')\")\n @id = DATABASE.last_insert_row_id\n end", "def last_inserted_id(result)\n @connection.gathered_data[:last_id]\n end", "def insert \n DATABASE.execute(\"INSERT INTO contents (slide_order, title, body) \n VALUES (#{@slide_order}, '#{@title}', '#{@body}')\")\n @id = DATABASE.last_insert_row_id\n end", "def run_insert\n raise DataFactory::NoInsertStatement unless @insert_statement\n\n stmt = db_interface.execute_sql(@insert_statement, *@binds)\n stmt.close\n end", "def insert()\n query = \"INSERT INTO sale_items (sli_qty, sli_unit_price, sli_alb_id, sli_slo_id)\n VALUES ($1, $2, $3, $4) RETURNING sli_id\"\n @sli_id = DbHelper.run_sql_return_first_row_column_value(query,\n [@sli_qty, @sli_unit_price, @sli_alb_id, @sli_slo_id],\n 'sli_id').to_i\n end", "def insert()\n query = \"INSERT INTO artists (art_name, art_photo) VALUES ($1, $2) RETURNING art_id\"\n @art_id = DbHelper.run_sql_return_first_row_column_value(query, [@art_name, @art_photo], 'art_id').to_i;\n end", "def execute(sql, name = nil)\n #log(sql, name) do\n # TODO: @async\n begin\n table_name = get_table_name_from_sql(sql)\n set_identity_insert_on(table_name) if (is_insert_sql(sql) and includes_id_field(sql))\n \n command = System::Data::SqlClient::SqlCommand.new sql, @connection\n command.transaction = @transaction\n command.command_timeout = @config[:command_timeout] if @config.has_key?(:command_timeout)\n command.execute_non_query \n rescue System::Data::SqlClient::SqlException => e\n raise_statement_invalid_error sql, e\n ensure\n set_identity_insert_off(table_name) if (is_insert_sql(sql) and includes_id_field(sql))\n end\n end", "def pk_from_insert_sql(sql)\n sql[/into\\s+([^\\(]*).*values\\s*\\(/i]\n primary_key($1.strip) if $1\n end", "def pk_from_insert_sql(sql)\n sql[/into\\s+([^\\(]*).*values\\s*\\(/i]\n primary_key($1.strip) if $1\n end", "def save()\n #Create db connection\n db = PG.connect({dbname: \"pizza_shop\", host: \"localhost\"})\n\n #Create sql statment with placeholders for variables\n sql = \"INSERT INTO pizza_orders\n (first_name, last_name, topping, quantity)\n VALUES\n ($1, $2, $3, $4) RETURNING id;\"\n\n #Create array to store values to be added to SQL statment\n values = [@first_name, @last_name, @topping, @quantity]\n\n #Creates prepared DB stament called \"Save\" ready to be executed\n db.prepare(\"Save\",sql)\n\n #Executes db statement called \"Save\" which is combined with values array to get string\n result = db.exec_prepared(\"Save\", values)\n\n #Close DB connection\n db.close()\n\n @id = result[0][\"id\"].to_i\n end", "def execute\n result = nil\n ActiveRecord::Base.connection_pool.with_connection do |con|\n result = con.execute(to_sql)\n end\n if @sql_returning.nil?\n nil\n else\n if @returning_flat\n result.values.map{|r| r.first}\n else\n result\n end\n end\n end", "def insert_and_id field, value\n id = -1\n sql = \"INSERT INTO #{table_name(field)}(value) VALUES \" +\n \"(?)\"\n @db.connect do\n st = @db.prepared_stmt sql\n st.execute(value)\n sql = \"select last_insert_id()\"\n id = @db.query(sql).fetch_row[0].to_i\n end\n return id\n end", "def run\n if @prepared_type == :insert\n fetch_rows(prepared_sql){|r| return r.values.first}\n else\n super\n end\n end", "def save\n # INSERT INTO songs (name, album) VALUES ?, ?\n sql = \"INSERT INTO #{table_name_for_insert} (#{col_names_for_insert}) VALUES (#{values_for_insert})\"\n\n DB[:conn].execute(sql)\n\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end", "def last_inserted_id(result)\n if result.is_a? Fixnum\n result\n else\n result.first.first[1]\n end\n end", "def execute(sql, args=nil)\n\t\t\t\t\targs = args.map{|v| @db.bound_variable_arg(v, self)} if args\n\t\t\t\t\tq = check_disconnect_errors{execute_query(sql, args)}\n\t\t\t\t\tbegin\n\t\t\t\t\t\tblock_given? ? yield(q) : q.cmd_tuples\n\t\t\t\t\tensure\n\t\t\t\t\t\tq.clear if q && q.respond_to?(:clear)\n\t\t\t\t\tend\n\t\t\t\tend", "def _insert\n ds = _insert_dataset\n if _use_insert_select?(ds) && (h = _insert_select_raw(ds))\n _save_set_values(h)\n nil\n else\n iid = _insert_raw(ds)\n # if we have a regular primary key and it's not set in @values,\n # we assume it's the last inserted id\n if (pk = autoincrementing_primary_key) && pk.is_a?(Symbol) && !(vals = @values)[pk]\n vals[pk] = iid\n end\n pk\n end\n end", "def _insert\n ds = _insert_dataset\n if _use_insert_select?(ds) && (h = _insert_select_raw(ds))\n _save_set_values(h)\n nil\n else\n iid = _insert_raw(ds)\n # if we have a regular primary key and it's not set in @values,\n # we assume it's the last inserted id\n if (pk = autoincrementing_primary_key) && pk.is_a?(Symbol) && !(vals = @values)[pk]\n vals[pk] = iid\n end\n pk\n end\n end", "def save\n result = DB.exec(\"INSERT INTO books (name, author) VALUES ('#{@name}', '#{@author}') RETURNING id;\")\n @id = result.first().fetch(\"id\").to_i\nend", "def insert(*values)\n if @opts[:returning]\n # Already know which columns to return, let the standard code handle it\n super\n elsif @opts[:sql] || @opts[:disable_insert_returning]\n # Raw SQL used or RETURNING disabled, just use the default behavior\n # and return nil since sequence is not known.\n super\n nil\n else\n # Force the use of RETURNING with the primary key value,\n # unless it has been disabled.\n returning(*insert_pk).insert(*values){|r| return r.values.first}\n end\n end", "def insert(*values)\n if @opts[:returning]\n # Already know which columns to return, let the standard code handle it\n super\n elsif @opts[:sql] || @opts[:disable_insert_returning]\n # Raw SQL used or RETURNING disabled, just use the default behavior\n # and return nil since sequence is not known.\n super\n nil\n else\n # Force the use of RETURNING with the primary key value,\n # unless it has been disabled.\n returning(insert_pk).insert(*values){|r| return r.values.first}\n end\n end", "def execute(sql, args=nil)\n args = args.map{|v| @db.bound_variable_arg(v, self)} if args\n q = check_disconnect_errors{execute_query(sql, args)}\n begin\n block_given? ? yield(q) : q.cmd_tuples\n ensure\n q.clear if q && q.respond_to?(:clear)\n end\n end", "def save()\n sql = \"INSERT INTO transactions (merchant, tag_id, value, datestore) VALUES ('#{@merchant}', #{@tag_id}, #{@value}, '#{@datestore}') RETURNING *;\"\n transaction = SqlRunner.run( sql ).first\n @id = transaction['id'].to_i\nend", "def save()\n db = PG.connect({\n dbname: 'houses',\n host: 'localhost'\n })\n\nsql = \"INSERT INTO houses\n(address, value, num_bedrooms, year) VALUES\n($1, $2, $3, $4) RETURNING *\"\nvalues = [@address, @value, @num_bedrooms, @year]\ndb.prepare(\"save\", sql)\nresult = db.exec_prepared(\"save\", values)\n@id = result[0]['id'].to_i()\n\ndb.close()\nend", "def execute sql\n db[sql]\n end", "def last_inserted_id(result) #:nodoc:\r\n rs = ADS.instance.api.ads_execute_direct(@connection, 'SELECT LASTAUTOINC( CONNECTION ) FROM SYSTEM.IOTA')\r\n raise ActiveRecord::StatementInvalid.new(\"#{ADS.instance.api.ads_error(@connection)}:#{sql}\") if rs.nil?\r\n ADS.instance.api.ads_fetch_next(rs)\r\n retval, identity = ADS.instance.api.ads_get_column(rs, 0)\r\n ADS.instance.api.ads_free_stmt(rs)\r\n identity\r\n end", "def last_insert_id(table, sequence_name) #:nodoc:\n identity = select_value(\"SELECT scope_identity()\")\n if identity.class == System::DBNull\n nil\n else\n System::Convert.to_int32(identity)\n end\n end", "def execute(sql)\n @database_handle.execute(sql)\n end", "def save\n sql = \"\n INSERT INTO artists\n (name)\n values($1)\n RETURNING *\n \"\n values = [@name]\n result = SqlRunner.run(sql, values)\n @id = result[0][\"id\"].to_i\n end", "def insert(arel, name = nil, pk = nil, id_value = nil, sequence_name = nil, binds = [])\n sql, binds = sql_for_insert(to_sql(arel, binds), pk, id_value, sequence_name, binds)\n value = exec_insert(sql, name, binds)\n id_value\n end", "def save()\n sql = \"INSERT INTO transactions (merchant, amount, tag, tran_date) VALUES ('#{@merchant}', #{@amount}, '#{@tag}', '#{@tran_date}') RETURNING *;\"\n data = SqlRunner.run(sql)\n @id = data.first()['id'].to_i\n end", "def save()\n sql = \"INSERT INTO customers (name) VALUES ($1) RETURNING id\"\n values = [@name]\n @id = SqlRunner.run(sql, values)[0][\"id\"].to_i()\n end", "def insert_user(con, email_address)\n result = con.exec \"SELECT MAX(id) FROM users\"\n p result.values\n id = result.values[0][0].to_i + 1\n con.exec \"INSERT INTO users VALUES(#{id},'#{email_address}', 0)\"\nend", "def insert(*values)\n if @opts[:sql] || @opts[:returning]\n super\n else\n returning(insert_pk).insert(*values){|r| return r.values.first}\n end\n end", "def execute(sql, *params)\n self.connect\n return nil if ! self.connected? && self.interpreter.preview?\n begin\n sth = self.dbh.prepare(sql)\n if params.empty?\n sth.execute\n else\n sth.execute(*params)\n end\n return sth\n rescue ::DBI::ProgrammingError => e\n raise \"#{e.message} -- #{sql}\"\n end\n end", "def replace(*args)\n execute_dui(replace_sql(*args)){|c| return c.last_id}\n end", "def insert\n\n DBConnection.execute2(<<-SQL, attribute_values)\n INSERT INTO\n #{class_obj.table_name} #{sql_columns}\n VALUES\n #{sql_question_marks}\n SQL\n\n self.id = DBConnection.last_insert_row_id\n end", "def save\n sql = \"INSERT INTO cars(\n shop_id,\n make,\n model,\n style,\n price,\n image\n )\n VALUES ($1, $2, $3, $4, $5, $6)\n RETURNING id;\"\n values = [@shop_id, @make, @model, @style, @price, @image]\n @id = SqlRunner.run(sql,values)[0]['id'].to_i\n end", "def save()\n sql = \"INSERT INTO albums (title, genre, artist_id)\n VALUES ($1, $2, $3) RETURNING id\"\n values = [@title, @genre, @artist_id]\n results = SqlRunner.run(sql, values)\n @id = results[0]['id'].to_i()\n end" ]
[ "0.7050797", "0.6902247", "0.6831938", "0.67946815", "0.6682866", "0.666634", "0.666561", "0.66645235", "0.66423583", "0.6619891", "0.66145515", "0.6551884", "0.65190595", "0.65190595", "0.6498258", "0.64939034", "0.6453291", "0.6448851", "0.64439315", "0.64439315", "0.64415663", "0.6427712", "0.6416121", "0.6413789", "0.6409023", "0.6405333", "0.6402868", "0.6396618", "0.6385697", "0.6352117", "0.6347749", "0.6330398", "0.6302558", "0.6299559", "0.6299559", "0.6297587", "0.6295606", "0.6286437", "0.6286437", "0.6286437", "0.6286437", "0.6286437", "0.6286437", "0.6286437", "0.6286437", "0.6286437", "0.6286437", "0.6286437", "0.6286437", "0.6256422", "0.62487745", "0.6227762", "0.61752284", "0.61636055", "0.6118403", "0.6093094", "0.6090623", "0.60862964", "0.6063955", "0.6032034", "0.6026108", "0.60155106", "0.60001147", "0.5990232", "0.5980615", "0.5978898", "0.59656173", "0.5962347", "0.59541965", "0.59541965", "0.59354573", "0.59209377", "0.59108466", "0.5903736", "0.5903009", "0.58977866", "0.58861995", "0.5875254", "0.5875254", "0.5870095", "0.58624554", "0.58623797", "0.58586043", "0.58465135", "0.5845905", "0.5836932", "0.58292174", "0.581878", "0.5809822", "0.5776935", "0.5773637", "0.57687473", "0.5766118", "0.5753796", "0.57297915", "0.5728704", "0.5726181", "0.57244337", "0.571746", "0.57067484" ]
0.7131899
0
Run the given SQL with the given arguments and yield each row.
def execute(sql, opts=OPTS) _execute(sql, opts) do |conn| begin yield(stmt = log_connection_yield(sql, conn){conn.prepare(sql)}) ensure stmt.close if stmt end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(sql, args=nil)\n q = query(sql, args)\n block_given? ? yield(q) : q.cmd_tuples\n end", "def execute_all( sql ) # :yields: row\n loop do\n stmt = prepare( sql )\n stmt.execute do |result|\n result.each { |row| yield row if block_given? }\n end\n sql = stmt.remainder\n if sql.length > 0\n yield nil if block_given? # notify of new query starting\n else\n break\n end\n end\n end", "def execute_batch(sql, *args, &block)\n @db.execute_batch(rewrite_table_names(sql), *args, &block)\n end", "def each\n @pool.with do |conn|\n conn.send_query @sql\n conn.set_single_row_mode\n loop do\n res = conn.get_result\n break unless res\n res.check\n res.stream_each { |row| yield row }\n end\n end\n end", "def execute( *params )\n bind( *params )\n begin\n # save the error state at the beginning of the execution. We only want to\n # reraise the error if it was raised during this execution.\n s_before = $!\n if block_given? then\n while row = next_row\n yield row\n end\n else\n all_rows\n end\n ensure\n s = $!\n begin\n reset_for_next_execute!\n rescue\n # rescuing nothing on purpose\n end\n raise s if s != s_before\n end\n end", "def fetch_rows(sql)\n execute(sql) do |res|\n columns = set_columns(res)\n yield_hash_rows(res, columns) {|h| yield h}\n end\n end", "def execute(sql, args=nil)\n args = args.map{|v| @db.bound_variable_arg(v, self)} if args\n q = check_disconnect_errors{execute_query(sql, args)}\n begin\n block_given? ? yield(q) : q.cmd_tuples\n ensure\n q.clear if q && q.respond_to?(:clear)\n end\n end", "def execute(sql, args=nil)\n\t\t\t\t\targs = args.map{|v| @db.bound_variable_arg(v, self)} if args\n\t\t\t\t\tq = check_disconnect_errors{execute_query(sql, args)}\n\t\t\t\t\tbegin\n\t\t\t\t\t\tblock_given? ? yield(q) : q.cmd_tuples\n\t\t\t\t\tensure\n\t\t\t\t\t\tq.clear if q && q.respond_to?(:clear)\n\t\t\t\t\tend\n\t\t\t\tend", "def fetch_rows(sql)\n return cursor_fetch_rows(sql){|h| yield h} if @opts[:cursor]\n execute(sql){|res| yield_hash_rows(res, fetch_rows_set_cols(res)){|h| yield h}}\n end", "def each_row_batch_by_sql(sql, options={}, &block)\n options = {:connection => self.connection}.merge(options)\n cursor = PostgreSQLCursor::Cursor.new(sql, options)\n return cursor.each_row_batch(&block) if block_given?\n cursor.iterate_batched\n end", "def execute( sql, *bind_vars )\n stmt = prepare( sql )\n stmt.bind_params( *bind_vars )\n stmt.execute do |result|\n if block_given?\n result.each { |row| yield row }\n else\n return result.inject( [] ) { |arr,row| arr << row; arr }\n end\n end\n end", "def ask(sql, *args, into: nil)\n catch(:ok) do\n each(sql, *args, into: into) { |row| throw :ok, row }\n nil\n end\n end", "def execute(sql)\n begin\n db = SQLite3::Database.new(@@db_file)\n @@_set_db_handler.call(db)\n if block_given?\n db.execute(sql) do |row|\n yield row\n end\n else\n return db.execute(sql)\n end\n ensure\n db.close\n end\n end", "def fetch_rows(sql)\n execute(sql) do |stmt|\n self.columns = cols = stmt.result_fields.map{|c| output_identifier(c)}\n col_count = cols.size\n stmt.each do |result|\n row = {}\n col_count.times{|i| row[cols[i]] = result[i]}\n yield row\n end\n end\n end", "def execute(sql, opts = {}, &block)\n res = nil\n synchronize(opts[:server]) do |conn|\n res = check_database_errors do\n if sql.is_a?(Symbol)\n execute_prepared_statement(conn, sql, opts, &block)\n else\n log_yield(sql) do\n conn.query(sql, opts[:arguments])\n end\n end\n end\n yield res if block_given?\n res.cmd_tuples\n end\n end", "def execute_query(sql, args)\n @db.log_connection_yield(sql, self, args){args ? async_exec(sql, args) : async_exec(sql)}\n end", "def all(sql, *args, into: nil, &block)\n raise ArgumentError, \"all no longer support blocks, use each instead.\" if block\n\n rows, pg_source_oid, column_info = each_without_conversion(sql, *args, into: into)\n\n result = convert_rows_to_result rows, into: into, pg_source_oid: pg_source_oid\n\n # [TODO] - resolve associations. Note that this is only possible if the type\n # is not an Array (i.e. into is nil)\n\n result.pagination_scope = sql if sql.is_a?(::Simple::SQL::Connection::Scope) && sql.paginated?\n result.column_info = column_info\n result\n end", "def run_tuples(query, options = {})\n GRel::Debugger.debug \"QUERYING SELECT...\"\n GRel::Debugger.debug query\n GRel::Debugger.debug \"** LIMIT #{@last_query_context.limit}\" if @last_query_context.limit\n GRel::Debugger.debug \"** OFFSET #{@last_query_context.offset}\" if @last_query_context.offset\n GRel::Debugger.debug \"----------------------\"\n args = {}\n args[:accept] = options[:accept] if options[:accept]\n args[:offset] = @last_query_context.offset if @last_query_context.offset\n args[:limit] = @last_query_context.limit if @last_query_context.limit\n @connection.query(@db_name,query, args).body\n end", "def execute_query(sql, args)\n\t\t\t\t\t@db.log_connection_yield(sql, self, args){args ? self.async_exec(sql, args) : self.async_exec(sql)}\n\t\t\t\tend", "def fetch_rows(sql)\n execute(sql) do |r|\n i = -1\n cps = db.conversion_procs\n cols = r.fetch_fields.map do |f| \n # Pretend tinyint is another integer type if its length is not 1, to\n # avoid casting to boolean if convert_tinyint_to_bool is set.\n type_proc = f.type == 1 && cast_tinyint_integer?(f) ? cps[2] : cps[f.type]\n [output_identifier(f.name), type_proc, i+=1]\n end\n self.columns = cols.map(&:first)\n if opts[:split_multiple_result_sets]\n s = []\n yield_rows(r, cols){|h| s << h}\n yield s\n else\n yield_rows(r, cols){|h| yield h}\n end\n end\n self\n end", "def query( sql, *bind_vars, &block ) # :yields: result_set\n stmt = prepare( sql )\n stmt.bind_params( *bind_vars )\n stmt.execute( &block )\n end", "def _execute(conn, sql, opts)\n r = log_connection_yield((log_sql = opts[:log_sql]) ? sql + log_sql : sql, conn){conn.query(sql)}\n if opts[:type] == :select\n yield r if r\n elsif defined?(yield)\n yield conn\n end\n if conn.respond_to?(:more_results?)\n while conn.more_results? do\n if r\n r.free\n r = nil\n end\n begin\n conn.next_result\n r = conn.use_result\n rescue Mysql::Error => e\n raise_error(e, :disconnect=>true) if MYSQL_DATABASE_DISCONNECT_ERRORS.match(e.message)\n break\n end\n yield r if opts[:type] == :select\n end\n end\n rescue Mysql::Error => e\n raise_error(e)\n ensure\n r.free if r\n # Use up all results to avoid a commands out of sync message.\n if conn.respond_to?(:more_results?)\n while conn.more_results? do\n begin\n conn.next_result\n r = conn.use_result\n rescue Mysql::Error => e\n raise_error(e, :disconnect=>true) if MYSQL_DATABASE_DISCONNECT_ERRORS.match(e.message)\n break\n end\n r.free if r\n end\n end\n end", "def execute(sql, opts)\n r = synchronize(opts[:server]) do |conn|\n log_connection_yield((log_sql = opts[:log_sql]) ? sql + log_sql : sql, conn) do\n conn.query_with_flags(sql, timezone.nil? || timezone == :local ? LOCAL_TIME_QUERY_FLAGS : QUERY_FLAGS)\n end\n end\n yield r\n rescue ::Trilogy::Error => e\n raise_error(e)\n end", "def execute(sql, *args, &block)\n @db.execute(rewrite_table_names(sql), *args, &block)\n end", "def execute( *bind_vars )\n reset! if active? || done?\n\n bind_params(*bind_vars) unless bind_vars.empty?\n @results = ResultSet.new(@connection, self)\n\n step if 0 == column_count\n\n yield @results if block_given?\n @results\n end", "def each_row_for_next_chunk\n return nil if finished?\n raise \"#{self.class}: instance not prepared before running the iteration\" unless @prepared\n\n select_sql = @select_sql.present? ? @select_sql : '*'\n sql = \"SELECT #{select_sql} FROM #{data_table_name} WHERE #{data_where_scope} ORDER BY id ASC LIMIT #{Import::CHUNK_ROWS_COUNT} OFFSET #{@iteration_number * Import::CHUNK_ROWS_COUNT}\"\n pg_result = postgres.copy(\"COPY (#{sql}) TO STDOUT WITH CSV DELIMITER ','\") do |row|\n yield row\n end\n\n @iteration_number += 1\n check_if_finished\n end", "def execute_sql(my_sql)\n pg_result = ActiveRecord::Base.connection.execute(my_sql)\n\n # In this example we are just calling #to_a to convert the PG::Result to an\n # Array. PG::Result has a nice API for slicing and dicing itself so you may\n # want to to something clever instead. See\n # https://www.rubydoc.info/gems/pg/PG/Result for details.\n #\n # The important bit here is that we are copying all the data we care about\n # out of the PG::Result in preparation for later clearing the PG::Result\n results = pg_result.to_a\n\n # Calling #clear on the PG::Result is the important bit of cleanup and the\n # whole reason this method exists. See\n # https://www.rubydoc.info/gems/pg/PG/Result#clear-instance_method\n pg_result.clear\n\n yield results if block_given?\n\n results\nend", "def fetch_rows(sql, opts=OPTS, &block)\n db.execute(sql){|result| process_result_set(result, opts, &block)}\n self\n end", "def run(&block)\n case prepared_type\n when :select, :all\n # Most common scenario, so listed first\n all(&block)\n when :each\n each(&block)\n when :insert_select\n with_sql(prepared_sql).first\n when :first\n first\n when :insert, :update, :delete\n if opts[:returning] && supports_returning?(prepared_type)\n returning_fetch_rows(prepared_sql)\n elsif prepared_type == :delete\n delete\n else\n send(prepared_type, *prepared_modify_values)\n end\n when :insert_pk\n fetch_rows(prepared_sql){|r| return r.values.first}\n when Array\n case prepared_type[0]\n when :map, :as_hash, :to_hash, :to_hash_groups\n send(*prepared_type, &block) \n end\n else\n Sequel::Deprecation.deprecate(\"Using an unsupported prepared statement type (#{prepared_type.inspect})\", 'Switch to using :select as the prepared statement type')\n all(&block)\n end\n end", "def fetch_rows(sql, &block)\n execute(sql) do |r|\n r.each(:symbolize_keys => true, &block)\n end\n self\n end", "def each(*args, &block)\n @stmt.each(*args, &block)\n end", "def run\n _escaped_sql = escaped_sql\n @query_logger << _escaped_sql if @query_logger\n result = @conn.exec_query _escaped_sql\n row_class = OccamsRecord::Results.klass(result.columns, result.column_types, @eager_loaders.names, model: @eager_loaders.model, modules: @use)\n rows = result.rows.map { |row| row_class.new row }\n @eager_loaders.run!(rows, query_logger: @query_logger)\n rows\n end", "def _execute(conn, sql, opts)\n begin\n r = log_yield(sql){conn.query(sql)}\n if opts[:type] == :select\n yield r if r\n elsif block_given?\n yield conn\n end\n rescue ::Mysql2::Error => e\n raise_error(e, :disconnect=>MYSQL_DATABASE_DISCONNECT_ERRORS.match(e.message))\n end\n end", "def insert_sql_each\n return enum_for(__method__) unless block_given?\n each_row do |row|\n yield table_dataset.insert_sql( row )\n end\n end", "def each_instance_batch_by_sql(sql, options={}, &block)\n options = {:connection => self.connection}.merge(options)\n cursor = PostgreSQLCursor::Cursor.new(sql, options)\n return cursor.each_instance_batch(self, &block) if block_given?\n cursor.iterate_type(self).iterate_batched\n end", "def cursor_eachrow(sql, name='csr', transaction=true, buffer_size=10000)\n count = 0\n begin\n begin_db_transaction if transaction\n open_cursor(sql, name, buffer_size)\n while (row = fetch_cursor(name)) do\n count+= 1\n #puts \"EACH CSR #{row.inspect}\"\n yield row\n end\n close_cursor(name)\n ensure\n commit_db_transaction if transaction\n end\n count\n end", "def query(sql)\n path = 'query'\n io = request path, :post, {}, {query: sql}, stream: true\n io.each do |l|\n yield l\n end\n end", "def execute(*args)\n @db.execute(*args)\n end", "def call(*args)\n in_context do\n self.execute(*args)\n end\n end", "def fetch_rows(sql)\n execute(sql) do |stmt|\n columns = []\n convert = convert_smallint_to_bool\n cps = db.conversion_procs\n stmt.num_fields.times do |i|\n k = stmt.field_name i\n key = output_identifier(k)\n type = stmt.field_type(i).downcase.to_sym\n # decide if it is a smallint from precision\n type = :boolean if type == :int && convert && stmt.field_precision(i) < 8\n type = :blob if type == :clob && db.use_clob_as_blob\n columns << [key, cps[type]]\n end\n cols = columns.map{|c| c[0]}\n self.columns = cols\n\n while res = stmt.fetch_array\n row = {}\n res.zip(columns).each do |v, (k, pr)|\n row[k] = ((pr ? pr.call(v) : v) if v)\n end\n yield row\n end\n end\n self\n end", "def process_row(connection, row)\n Array(task.execute_sql(connection, row)).each do |sql|\n connection.execute(sql)\n end\n end", "def execute2( sql, *bind_vars )\n stmt = prepare( sql )\n stmt.bind_params( *bind_vars )\n stmt.execute do |result|\n if block_given?\n yield result.columns\n result.each { |row| yield row }\n else\n return result.inject( [ result.columns ] ) { |arr,row| arr << row; arr }\n end\n end\n end", "def open_cursor_with_sql(name, *sql_and_args, &block)\n connection.cursor_eachrow(sql_and_args, name, &block)\n end", "def each(opts = nil, &block)\n if graph = @opts[:graph]\n graph_each(opts, &block)\n else\n row_proc = @row_proc unless opts && opts[:naked]\n transform = @transform\n fetch_rows(select_sql(opts)) do |r|\n r = transform_load(r) if transform\n r = row_proc[r] if row_proc\n yield r\n end\n end\n self\n end", "def run_sql(sql, arr = []) # array is for security feature\n db = PG.connect(ENV['DATABASE_URL'] || {dbname: 'picgallary'})\n results = db.exec_params(sql, arr)\n db.close\n return results\n end", "def executeSQL(qStr, *params, &block)\n @statement_cache ||= {}\n #@statement_cache[qStr] ||= @db.prepare(qStr)\n @statement_cache[qStr] ||= qStr\n\n puts \"executeSQL: '#{qStr}', '#{params.join(\"', '\")}'\" if ::RdfContext::debug?\n if block_given?\n @db.execute(@statement_cache[qStr], *params) do |row|\n puts \"executeSQL res: #{row.inspect}\" if ::RdfContext::debug?\n row = row.keys.select{|k| k.is_a?(Integer)}.sort.map{|k| row[k]} if row.is_a?(Hash)\n yield(row)\n end\n else\n puts \"executeSQL no block given\" if ::RdfContext::debug?\n @db.execute(@statement_cache[qStr], *params)\n end\n rescue SQLite3::SQLException => e\n puts \"SQL Exception (ignored): #{e.message}\" if ::RdfContext::debug?\n end", "def exec_raw(sql, options = {})\n cursor = $connection.exec(sql)\n if(options[:return_hash])\n recordset, = pack_cursor(cursor, :return => \"hash\")\n return recordset\n else\n return_data = []\n while current_row = cursor.fetch()\n return_data.push(current_row)\n end\n return return_data\n end\n end", "def execute\n results = ResultSet.new( @db, @statement.to_s )\n\n if block_given?\n begin\n yield results\n ensure\n results.close\n end\n else\n return results\n end\n end", "def run_sql(sql)\n #connect to the|db|\n conn = PG.connect(:dbname => 'rogbloll')\n\n\n #execute the db in the argument\n res = conn.exec(sql)\n\n #now close the db\n conn.close\n\n #now return the result of the query...\n res\n\n\n \n end", "def with_sql_each(sql)\n if row_proc\n super(sql) do |obj|\n obj.forbid_lazy_load if obj.is_a?(InstanceMethods)\n yield obj\n end\n else\n super\n end\n end", "def execute\n # build the query string\n # run the query\n # return the results\n end", "def fetch_rows(sql, &block)\n raise NotImplementedError, NOTIMPL_MSG\n end", "def _execute(conn, sql, opts)\n stmt = log_connection_yield(sql, conn){conn.execute(sql)}\n if block_given?\n yield(stmt)\n else \n stmt.affected\n end\n ensure\n stmt.free if stmt\n end", "def queryUserTable\n @conn.exec( \"SELECT * FROM users\" ) do |result|\n result.each do |row|\n yield row if block_given?\n end\n end\nend", "def exec(sql, *bindvars, &block)\n ret = nil\n thread = Thread.new { ret = super }\n thread.join\n ret\n rescue Interrupt\n self.break\n raise\n end", "def run_sql(sql)\n db = PG.connect(dbname: 'goodfoodhunting')\n results = db.exec(sql)\n db.close\n results\nend", "def call(*args)\n params = build_params args\n cstmt = @connection.prepare_call \"{call #{name}(#{Array.new(@cols.length){'?'}.join ', '})}\"\n begin\n process_result( args, cstmt.call(*params) )\n ensure\n cstmt.close\n end\n end", "def run_sql(sql, arr = [])\n db = PG.connect(ENV['DATABASE_URL'] || {dbname: 'native_plants'})\n results = db.exec_params(sql, arr)\n db.close\n return results\nend", "def select(sql)\n raise(ArgumentError, \"Bad sql parameter\") unless sql.kind_of?(String)\n\n client = ensure_connected\n\n Pod4.logger.debug(__FILE__){ \"select: #{sql}\" }\n query = client.execute(sql)\n\n rows = []\n query.each do |r| \n\n if block_given? \n rows << yield(r)\n else\n rows << r\n end\n\n end\n\n query.cancel \n rows\n\n rescue => e\n handle_error(e)\n end", "def run_sql(limit: 100, cmds: $sql_commands, print: true, label: 'SELECT Results', collapsed: false, &block)\n Display.status(\"Running sql commands...\")\n cmds = [cmds] if cmds.is_a? String\n results = cmds.map do |cmd|\n dataset = run_cmd(cmd) || []\n if dataset.count > 0\n\n lbl = label\n lbl += \" (Top #{limit} of #{dataset.count})\" if dataset.count > limit\n lbl = \"-\" + lbl if collapsed\n\n block.call(dataset, lbl) if block\n\n Display.table(dataset.to_a.take(limit), label: lbl, allow_preview: true) if print\n end\n dataset\n end\n\n results.select! {|r| r.count > 0 }\n\n if results.length > 1\n $sql_multi = true\n $sql_results = results\n else\n $sql_multi = false\n $sql_results = results.first || []\n end\n\nrescue Sequel::DatabaseError => ex\n msg = ex.message.gsub(\"SQLite3::SQLException: \", \"\");\n puts Display.print(\"ERROR\", \"There was an error with the SQL query:\\n\\n#{msg.strip}\")\n []\nend", "def execute(sql, args = nil, bulk_args = nil, http_options = {})\n @logger.debug sql\n req = Net::HTTP::Post.new('/_sql', headers)\n body = { 'stmt' => sql }\n body['args'] = args if args\n body['bulk_args'] = bulk_args if bulk_args\n req.body = body.to_json\n response = request(req, http_options)\n @logger.debug response.body\n\n case response.code\n when /^2\\d{2}/\n ResultSet.new response.body\n else\n @logger.info(response.body)\n raise CrateRuby::CrateError, response.body\n end\n end", "def run_sql(query)\n raw_run_sql(query)\n end", "def execute\n result = nil\n ActiveRecord::Base.connection_pool.with_connection do |con|\n result = con.execute(to_sql)\n end\n if @sql_returning.nil?\n nil\n else\n if @returning_flat\n result.values.map{|r| r.first}\n else\n result\n end\n end\n end", "def execute *params\r\n sql = parse_args( *params )\r\n @driver.execute( sql )\r\n end", "def run_sql_file(file, &block)\n sql = clean_sql(File.read(file))\n\n split_sql_commands(sql).map do |cmd|\n run_cmd(cmd).tap do |result|\n block.call(cmd, result) if block\n end\n end\nend", "def each_without_conversion(sql, *args, into: nil)\n pg_result = exec_logged(sql, *args)\n\n column_info = collect_column_info(pg_result)\n rows = []\n pg_source_oid = nil\n\n if pg_result.ntuples > 0 && pg_result.nfields > 0\n decoder = Decoder.new(pg_result, into: (into ? Hash : nil), column_info: column_info)\n pg_source_oid = pg_result.ftable(0)\n\n pg_result.each_row do |row|\n rows << decoder.decode(row)\n end\n end\n\n [rows, pg_source_oid, column_info]\n ensure\n # optimization: If we wouldn't clear here the GC would do this later.\n pg_result.clear if pg_result && !pg_result.autoclear?\n end", "def execute\n ActiveRecord::Base.connection.execute(source)\n end", "def run_sql(sql)\n conn = PG.connect(dbname: \"memetube\", host: \"localhost\")\n begin\n result = conn.exec(sql)\n ensure\n conn.close\n end\n result\nend", "def execute(&block)\n TempTableContext.with_context(db) {|context| execute_in_context(context, &block)}\n end", "def cti_execute_sql(sql)\n return execute(sql) if sql.is_a?(String)\n sql.map do |query|\n execute(query)\n end\n end", "def run_sql(sql)\n conn = PG.connect(dbname: 'goodfoodhunting')\n result = conn.exec(sql)\n conn.close\n return result\nend", "def queryurlTable\n @conn.exec( \"SELECT * FROM urls\" ) do |result|\n result.each do |row|\n yield row if block_given?\n end\n end\n end", "def run_sql(sql)\n connection = PG.connect(dbname: \"facebook_lab\", host: \"localhost\")\n result = connection.exec(sql)\n connection.close\n result\nend", "def execute(*values)\n IBM_DB.execute(@stmt, values)\n end", "def _execute(conn, sql, opts, &block)\n if sql.is_a?(Symbol)\n execute_prepared_statement(conn, sql, opts, &block)\n else\n conn.execute(sql, opts[:arguments], &block)\n end\n end", "def each_row\n return rows.each unless block_given?\n\n rows.each { |row| yield(row) }\n end", "def run_sql(sql)\n conn = PG.connect(dbname: 'movies')\n result = conn.exec(sql)\n conn.close\n result\nend", "def run_sql(sql)\n db = PG.connect(:dbname => 'movies', :host => 'localhost')\n result = db.exec(sql)\n db.close\n result\n end", "def execute(sql)\n raise NotImplementedError, \"#execute should be overridden by adapters\"\n end", "def cursor_fetch_rows(sql)\n server_opts = {:server=>@opts[:server] || :read_only}\n cursor = @opts[:cursor]\n hold = cursor[:hold]\n cursor_name = quote_identifier(cursor[:cursor_name] || 'sequel_cursor')\n rows_per_fetch = cursor[:rows_per_fetch].to_i\n\n db.send(*(hold ? [:synchronize, server_opts[:server]] : [:transaction, server_opts])) do \n begin\n execute_ddl(\"DECLARE #{cursor_name} NO SCROLL CURSOR WITH#{'OUT' unless hold} HOLD FOR #{sql}\", server_opts)\n rows_per_fetch = 1000 if rows_per_fetch <= 0\n fetch_sql = \"FETCH FORWARD #{rows_per_fetch} FROM #{cursor_name}\"\n cols = nil\n # Load columns only in the first fetch, so subsequent fetches are faster\n execute(fetch_sql) do |res|\n cols = fetch_rows_set_cols(res)\n yield_hash_rows(res, cols){|h| yield h}\n return if res.ntuples < rows_per_fetch\n end\n loop do\n execute(fetch_sql) do |res|\n yield_hash_rows(res, cols){|h| yield h}\n return if res.ntuples < rows_per_fetch\n end\n end\n rescue Exception => e\n raise\n ensure\n begin\n execute_ddl(\"CLOSE #{cursor_name}\", server_opts)\n rescue\n raise e if e\n raise\n end\n end\n end\n end", "def run_sql(sql)\n\tconn = PG.connect(dbname: \"video_store\", host: 'localhost')\n\tresult = conn.exec(sql)\n\tconn.close\n\tresult \nend", "def each_query\n 1.upto(nqueries) do |n|\n yield(query(n))\n end\n end", "def exec_query(sql, name = 'SQL', binds = [])\n translate(sql) do |sql, args|\n unless binds.empty?\n args = binds.map { |col, val| type_cast(val, col) } + args\n end\n log(expand(sql, args), name) do\n result, rows = @connection.execute(sql, *args) { |cursor| [cursor.fields, cursor.fetchall] }\n if result.respond_to?(:map)\n cols = result.map { |col| col.name } \n ActiveRecord::Result.new(cols, rows)\n else\n result\n end\n end\n end\n end", "def exec_query(sql, name = 'SQL', binds = [])\n if name == :skip_logging\n #execute(sql, name)\n hash_query(sql, name, binds)\n else\n log(sql, name) do\n #execute(sql, name)\n hash_query(sql, name, binds)\n end\n end \n end", "def execute(sql, *args, &block)\n @db.log_yield(sql){super}\n rescue SwiftError => e\n @db.send(:raise_error, e)\n end", "def exec_query(sql, name = 'SQL', binds = [])\n log(sql, name, binds) do\n result = without_prepared_statement?(binds) ? exec_no_cache(sql) :\n exec_cache(sql, binds)\n result_array = result_as_array(result)\n if ActiveRecord::VERSION::MAJOR >= 4\n column_types = compute_field_types(result)\n ret = ActiveRecord::Result.new(result.fields, result_array, column_types)\n else\n ret = ActiveRecord::Result.new(result.fields, result_array)\n end\n result.clear\n ret\n end\n end", "def each\n while row=self.next\n yield row\n end\n end", "def each\n while row=self.next\n yield row\n end\n end", "def sql_raw(*args)\n sql, bind = parse_args(*args)\n return SQL::QueryMaker.new(nil, Proc.new { sql }, bind)\n end", "def multi_query(sql, *bind_values)\n @pool.acquire { |conn| conn.query(sql, *bind_values) }\n end", "def run_sql(sql)\n\tdb = PG.connect(dbname: 'address_book', host: 'localhost')\n\tresult = db.exec(sql)\n\tdb.close\n\tresult\nend", "def execute_dui(sql, opts=OPTS)\n _execute(sql, opts){|conn| log_connection_yield(sql, conn){conn.execute_batch(sql)}; conn.row_changes}\n end", "def query(*args, &block)\n if args.empty?\n @query\n else\n if args[0].is_a?(String)\n @query = args[0].strip\n else\n @query = build_arel(\n args.inject({}) do |acc, param|\n acc.merge(\n param.is_a?(Hash) ? param : Hash[ [[param, nil]] ]\n )\n end,\n block).to_sql\n end\n end\n end", "def each_query(options = {})\n options = { sort: false, subject_regex: nil }.merge(options)\n \n # Set the state variables\n current_rows = []\n current_query = nil\n\n # Read through rows until the query changes.\n each(subject_regex: options[:subject_regex]) do |hit|\n if hit.query == current_query\n current_rows << hit\n else\n if current_query\n current_rows.sort! if options[:sort]\n yield current_query, current_rows \n end\n\n current_query, current_rows = hit.query, [hit]\n end\n end\n \n # Yield the last query if any were found\n yield current_query, current_rows if current_query\n end", "def execute sql\n db[sql]\n end", "def retrieve( query, parameters = [] )\n @adapter.plan_query(query).execute(@connection, parameters) do |row|\n yield(Tuple.new(row))\n end\n end", "def exec_query(sql, name = nil, binds = [])\n result = without_prepared_statement?(binds) ? exec_no_cache(sql, name, binds) :\n exec_cache(sql, name, binds)\n result_array = result_as_array(result)\n if ArVer::GTEQ_4\n column_types = compute_field_types(result)\n ret = ActiveRecord::Result.new(result.fields, result_array, column_types)\n else\n ret = ActiveRecord::Result.new(result.fields, result_array)\n end\n result.clear\n ret\n end", "def multiple_query sql\n splited_sql = sql.split(';')\n splited_sql.each do |each_sql|\n query(each_sql)\n end\n end", "def find_in_batches(options={})\n\t\tstart = options[:start]\n\t\tbatch_size = options[:batch_size]\n\t\t# check options for start and batch_size values\n\t\tif start != nil && batch_size != nil\n\t\t\trows = connection.execute <<-SQL\n\t\t\t\tSELECT #{columns.join \",\"} FROM #{table}\n\t\t\t\tLIMIT #{batch_size} OFFSET #{start};\n\t\t\tSQL\n\t\telsif start != nil && batch_size == nil\n\t\t\trows = connection.execute <<-SQL\n\t\t\t\tSELECT #{columns.join \",\"} FROM #{table}\n\t\t\t\tOFFSET #{start};\n\t\t\tSQL\n\t\telsif start == nil && batch_size != nil \n\t\t\trows = connection.execute <<-SQL \n\t\t\t\tSELECT #{columns.join \",\"} FROM #{table}\n\t\t\t\tLIMIT #{batch_size};\n\t\t\tSQL\n\t\telse \n\t\t\trows = connection.execute <<-SQL \n\t\t\t\tSELECT #{columns.join \",\"} FROM #{table};\n\t\t\tSQL\n\t\tend\n\n\t\trow_array = rows_to_array(rows)\n\t\tyield(row_array)\n\n\tend", "def each\n if block_given?\n vals = []\n @query_schema.inputs.each_with_index do |input, i|\n vals << input.type.convert_from_ruby(@values[i])\n end\n @table.csv.each do |row|\n if @query_schema.inputs.zip(vals).all? {|input, val| row[input.pos] == val} and\n @query_schema.values.all? {|value| row[value.pos] == value.type.convert_from_ruby(value.value)}\n outputs = []\n cond = @query_schema.outputs.each do |output|\n val = row[output.pos]\n if output.options[:empty] == :ignore and val == \"\"\n break :break\n else\n outputs << output.type.convert_to_ruby(val)\n end\n end\n yield *outputs unless cond == :break\n end\n end\n else\n return Enumerator.new(self)\n end\n end" ]
[ "0.776345", "0.75568527", "0.69860876", "0.6938213", "0.6884923", "0.68494165", "0.68387896", "0.68384504", "0.67876095", "0.676762", "0.6716615", "0.6597958", "0.6541283", "0.64263046", "0.6382324", "0.635289", "0.6338962", "0.6299832", "0.62997025", "0.6296386", "0.6291277", "0.62889063", "0.62663704", "0.6265181", "0.62627023", "0.6253804", "0.62512386", "0.6235217", "0.62244713", "0.62060225", "0.62049323", "0.61948436", "0.61747885", "0.61459553", "0.6143207", "0.6122076", "0.61149555", "0.6109342", "0.60917175", "0.6088476", "0.6081044", "0.60617524", "0.60571265", "0.6057008", "0.6045935", "0.6011822", "0.59974504", "0.5971054", "0.59462154", "0.5913489", "0.58992606", "0.5886028", "0.58855915", "0.5878643", "0.5870167", "0.585835", "0.58552307", "0.5852755", "0.5846722", "0.5846205", "0.5837548", "0.58236444", "0.5812698", "0.5714084", "0.5709309", "0.5695978", "0.5677144", "0.5673701", "0.56616277", "0.5654853", "0.56495863", "0.56491405", "0.5639854", "0.56292707", "0.5629007", "0.5627076", "0.5618867", "0.55934775", "0.5590678", "0.55853105", "0.5584944", "0.55766225", "0.5566906", "0.55626285", "0.5548071", "0.5546467", "0.5540403", "0.5540403", "0.55350256", "0.55277103", "0.55239516", "0.55211234", "0.5517525", "0.55162436", "0.5513707", "0.55040234", "0.5497561", "0.54787666", "0.5478713", "0.54745907" ]
0.6261791
25
Run the given SQL with the given arguments and return the first value of the first row.
def single_value(sql, opts=OPTS) _execute(sql, opts){|conn| log_connection_yield(sql, conn){conn.first_value_from(sql)}} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_first_value( sql, *bind_vars )\n execute( sql, *bind_vars ) { |row| return row[0] }\n nil\n end", "def get_first_row( sql, *bind_vars )\n execute( sql, *bind_vars ) { |row| return row }\n nil\n end", "def query_return_first(sql, *binds)\n mysql.fetch(sql, *binds).first\n end", "def query_return_first_value(sql, *binds)\n mysql.fetch(sql, *binds).single_value\n end", "def query_single(sql, *params)\n results = run(sql, *params)\n results.each(as: :array, :first => true).first\n end", "def get_first_row(*args)\n @db.get_first_row(*args)\n end", "def call(*args)\n tuples = execute(*args)\n\n if result == :one\n tuples.first\n else\n tuples\n end\n end", "def call(*args)\n tuples = execute(*args)\n\n if result == :one\n tuples.first\n else\n tuples\n end\n end", "def fetch_row(sql)\n # Run the query\n results = query(sql)\n\n # Check result counts\n if results.count == 0\n check.critical(\"Expected to receive a single row, but result set is empty\", \"SQL: #{sql}\")\n end\n if results.count > 1\n check.critical(\"Expected to receive a single row, but result has #{results.count} lines\", \"SQL: #{sql}\")\n end\n\n # Get the first and only row\n return results.first\n end", "def fetch_first_field(sql)\n fetch_first_row(sql)&.values&.first\n end", "def fetch_value(sql)\n # Get the row\n row = fetch_row(sql)\n\n # Check field count\n if row.count > 1\n check.critical(\"Expected to receive a single value, but result has more than one field\", \"SQL: #{sql}\\nResult: #{row.inspect}\")\n end\n\n return row.values.first\n end", "def single(sql, values = [])\n r = $db.exec_params(sql, values)\n return nil if r.ntuples == 0\n convert_to_ruby_types(r.first)\nend", "def fetch_first_column(sql)\n fetch_rows(sql).map(&:values).map(&:first)\n end", "def execute_scalar( sql )\r\n resultset = execute( sql )\r\n return nil unless resultset.rowcount > 0\r\n raise InvalidOperationException.new( \"excecute_scalar can not return multiple rows\" ) if resultset.rowcount > 1\r\n return resultset.rows.first.send( resultset.columns.first.name.to_sym )\r\n end", "def getFirst_i( query, args=[] )\n res = self.exec( query, args ).values.first\n\n if res.is_a? Array\n res = res[0]\n end\n \n #self.bot.debug query + \" args: \" + args.inspect + \"\\n\"\n\n res.to_i\n end", "def sql_select_one(sql)\n result = sql_select_first_row(sql)\n return nil unless result\n result.first[1] # Value des Key/Value-Tupels des ersten Elememtes im Hash\n end", "def select_one(sql, name = nil)\n select(sql, name).first\n end", "def sql_select_first_row(sql)\n result = sql_select_all(sql)\n return nil if result.empty?\n result[0].extend SelectHashHelper # Erweitern Hash um Methodenzugriff auf Elemente\n end", "def select_one(sql, name = nil)\n result = select(sql, name)\n result.nil? ? nil : result.first\n end", "def select_one(sql, name = nil)\n result = select_all(sql, name)\n result.first if result\n end", "def select_value(sql, name = nil)\n if result = select_one(sql, name)\n result.values.first\n end\n end", "def first **args\n query( **( { order: \"@rid\" , limit: 1 }.merge args)).execute(reduce: true)\n\tend", "def select_one(stmt, bindvars={})\n sanity_check(stmt)\n row = nil\n execute(stmt, bindvars) do |sth|\n row = sth.fetch\n end\n row\n end", "def ask(sql, *args, into: nil)\n catch(:ok) do\n each(sql, *args, into: into) { |row| throw :ok, row }\n nil\n end\n end", "def select_one(sql)\n result = execute(sql)\n result.fetch_hash\n end", "def execute\n result = nil\n ActiveRecord::Base.connection_pool.with_connection do |con|\n result = con.execute(to_sql)\n end\n if @sql_returning.nil?\n nil\n else\n if @returning_flat\n result.values.map{|r| r.first}\n else\n result\n end\n end\n end", "def select_one(sql, name = nil) end", "def first\n\t\trow = connection.get_first_row <<-SQL\n\t\t\tSELECT #{columns.join \",\"} FROM #{table}\n\t\t\tORDER BY id ASC LIMIT 1;\n\t\tSQL\n\t\tinit_object_from_row(row)\n\tend", "def get_scalar sql_text\n @client.query(sql_text, :as => :array).first[0]\n end", "def execute(sql, args=nil)\n q = query(sql, args)\n block_given? ? yield(q) : q.cmd_tuples\n end", "def execute(*args)\n raw_execute(*args)['value']\n end", "def select_one(sql, *bindvars)\n ret = nil\n thread = Thread.new { ret = super }\n thread.join\n ret\n rescue Interrupt\n self.break\n raise\n end", "def get_single_column sql_text\n @client.query(sql_text, :as => :array).map{ |row| row[0] }\n end", "def pluck_one(sql, *bindvars)\n result = []\n exec(sql, *bindvars) { |row| result << row.first }\n result\n end", "def one(model, sql, params={})\n model.new(sql_query(sql, params).first)\n end", "def run\n if @prepared_type == :insert\n fetch_rows(prepared_sql){|r| return r.values.first}\n else\n super\n end\n end", "def find_first(conditions = nil, orderings = nil)\n sql = \"SELECT * FROM #{table_name} \"\n add_conditions!(sql, conditions)\n sql << \"ORDER BY #{orderings} \" unless orderings.nil?\n sql << \"LIMIT 1\"\n \n record = connection.select_one(sql, \"#{name} Load First\")\n instantiate(record) unless record.nil?\n end", "def getFirst_i_rand( selection, query, args )\n # Double our args since we are querying twice\n \n args = [ args ] if not args.is_a? Array\n\n nargs = Array.new args\n args.each do |a|\n nargs << a \n end\n\n args = nargs\n \n return( self.getFirst_i( \"SELECT \" + selection + \" FROM \" + query + \" OFFSET floor(RANDOM() * (SELECT count(*) FROM \" + query + \")) LIMIT 1\", args ) )\n end", "def update_sql(sql, name = nil)\n result = super\n result.length == 0 ? 0 : result.rows[0][0]\n end", "def select_first!\n limit(1).select!.first\n end", "def execute sql\n db[sql]\n end", "def call(*args)\n params = build_params args\n cstmt = @connection.prepare_call \"{call #{name}(#{Array.new(@cols.length){'?'}.join ', '})}\"\n begin\n process_result( args, cstmt.call(*params) )\n ensure\n cstmt.close\n end\n end", "def minmax(run)\n db = SQLite3::Database.open \"rand_int.db\" #open Database\n results = db.get_first_row \"SELECT * FROM Random WHERE entry=#{run}\" #get only first row of result set\n rescue SQLite3::Exception => e \n \n puts \"Exception occured\"\n puts e\n \n ensure\n db.close if db\n\n return \"Min: #{results[2]}, Max: #{results[3]}\"\nend", "def first(n=1)\n query(@sql + ' LIMIT ' + n.to_s, cache: false)\n end", "def sql_load\n row = DBIntf.get_first_row(\"SELECT * FROM #{tbl_name} #{generate_where_on_pk};\")\n return row.nil? ? reset : load_from_row(row)\n end", "def execute(sql, *params)\n self.connect\n return nil if ! self.connected? && self.interpreter.preview?\n begin\n sth = self.dbh.prepare(sql)\n if params.empty?\n sth.execute\n else\n sth.execute(*params)\n end\n return sth\n rescue ::DBI::ProgrammingError => e\n raise \"#{e.message} -- #{sql}\"\n end\n end", "def first(*args)\n find(:first, *args)\n end", "def first(*args)\n find(:first, *args)\n end", "def find_one(id)\n if id.is_a?(Integer) && id > 0\n row = connection.get_first_row <<-SQL\n SELECT #{columns.join \",\"} FROM #{table}\n WHERE id = #{id};\n SQL\n\n # converts a row into an object\n init_object_from_row(row)\n else\n puts \"Id must be a number greater than 0, Try again\"\n end\n end", "def find_first(*args)\n id = get_range(:count => 1, *args).first\n id && find_one(id, *args)\n end", "def run_sql(sql)\n #connect to the|db|\n conn = PG.connect(:dbname => 'rogbloll')\n\n\n #execute the db in the argument\n res = conn.exec(sql)\n\n #now close the db\n conn.close\n\n #now return the result of the query...\n res\n\n\n \n end", "def first(*args)\n find(:first, *args)\n end", "def get_entry(first_name, last_name)\n begin\n conn = open_db()\n query = \"select * from listings where fname = $1 and lname = $2\"\n conn.prepare('q_statement', query)\n user_hash = conn.exec_prepared('q_statement', [first_name, last_name])\n conn.exec(\"deallocate q_statement\")\n user_hash.to_a.size > 0 ? (return user_hash[0]) : (return {})\n rescue PG::Error => e\n puts 'Exception occurred'\n puts e.message\n ensure\n conn.close if conn\n end\nend", "def first\n results.first\n end", "def execute(*args)\n result = raw_execute(*args)\n result.payload.key?('value') ? result['value'] : result\n end", "def getDBValue(connection, query, id1, *id2)\r\n dbi_query = connection.prepare(query)\r\n dbi_query.execute(id1, *id2)\r\n #fetch the result\r\n return dbi_query.fetch\r\nend", "def select_values(sql, name = nil)\n result = select_rows(sql, name)\n result.map { |v| v[0] }\n end", "def query(sql, name, binds)\n \n rs = SA.instance.api.sqlany_execute_direct(@connection, sql)\n raise ActiveRecord::StatementInvalid.new(\"#{SA.instance.api.sqlany_error(@connection)}:#{sql}\") if rs.nil?\n \n max_cols = SA.instance.api.sqlany_num_cols(rs)\n fields = {}\n max_cols.times do |i|\n fields[i] = SA.instance.api.sqlany_get_column_info(rs, i)[2]\n end\n \n rows = []\n while SA.instance.api.sqlany_fetch_next(rs) == 1\n result = Array.new(max_cols)\n max_cols.times do |cols|\n result[cols] = SA.instance.api.sqlany_get_column(rs, cols)[1]\n end\n rows << result\n end\n @affected_rows = SA.instance.api.sqlany_affected_rows(rs)\n SA.instance.api.sqlany_free_stmt(rs)\n\n return rows, fields\n end", "def get_first_satisfiedPK\n # allColumns = @allColumnList.map do |field|\n # \t# \"#{field.colname} as #{field.relname}_#{field.colname} \"\n # \t\"#{field.relname}_#{field.colname} \"\n # end.join(',')\n query = \"select #{@allColumns_renamed} from golden_record where type = 'satisfied' and branch = '#{@branches[0].name}';\"\n res = DBConn.exec(query)\n abort(\"Cannot find satisfied tuple at #{@branches[0].name}!\") if res.ntuples == 0\n res\n end", "def execute_statement(sql)\n results = ActiveRecord::Base.connection.execute(sql)\n if results.present?\n return results\n else\n return nil\n end\n end", "def exec_query(sql, name = nil, binds = [])\n result = without_prepared_statement?(binds) ? exec_no_cache(sql, name, binds) :\n exec_cache(sql, name, binds)\n result_array = result_as_array(result)\n if ArVer::GTEQ_4\n column_types = compute_field_types(result)\n ret = ActiveRecord::Result.new(result.fields, result_array, column_types)\n else\n ret = ActiveRecord::Result.new(result.fields, result_array)\n end\n result.clear\n ret\n end", "def exec_query(sql, name = 'SQL', _binds = [], prepare: false)\n log(sql, name) do\n result = @connection.run(sql)\n ActiveRecord::Result.new(result.columns, result.rows)\n end\n end", "def exec_query(sql, name = 'SQL', binds = [])\n translate(sql) do |sql, args|\n unless binds.empty?\n args = binds.map { |col, val| type_cast(val, col) } + args\n end\n log(expand(sql, args), name) do\n result, rows = @connection.execute(sql, *args) { |cursor| [cursor.fields, cursor.fetchall] }\n if result.respond_to?(:map)\n cols = result.map { |col| col.name } \n ActiveRecord::Result.new(cols, rows)\n else\n result\n end\n end\n end\n end", "def array_query(sql, name, binds)\n query(sql, name, binds)[0]\n end", "def run(query:)\n Vidalia::log(\"SQL query text: \\\"#{query}\\\"\",:style => :debug)\n open_connection\n result = launch_query_command(query: query)\n if result.size > 0\n count = 1\n result.each do |r|\n Vidalia::log(\"SQL query result (#{count}): \\\"#{r.inspect}\\\"\",:style => :debug)\n count += 1\n end\n else\n Vidalia::log(\"SQL query: NO RESULTS FOUND\",:style => :debug)\n end\n rescue Exception => e\n raise e\n else\n return result\n ensure\n close_connection\n end", "def parameter_row\n rows.first\n end", "def run_sql(sql)\n conn = PG.connect(dbname: 'goodfoodhunting')\n result = conn.exec(sql)\n conn.close\n return result\nend", "def select_rows(sql, name = nil)\n select_raw(sql, name).last\n end", "def select_rows(sql, name = nil)\n select_raw(sql, name).last\n end", "def exec_query(sql, name = 'SQL', binds = [])\n log(sql, name, binds) do\n result = without_prepared_statement?(binds) ? exec_no_cache(sql) :\n exec_cache(sql, binds)\n result_array = result_as_array(result)\n if ActiveRecord::VERSION::MAJOR >= 4\n column_types = compute_field_types(result)\n ret = ActiveRecord::Result.new(result.fields, result_array, column_types)\n else\n ret = ActiveRecord::Result.new(result.fields, result_array)\n end\n result.clear\n ret\n end\n end", "def unpack\n if self.values().length == 1\n row = self.values()[0]\n if row.length == 1\n return row[0]\n else\n warn 'more than 1 column in result.'\n return row\n end\n else\n warn 'more than 1 row returned.'\n return self.values()\n end\n end", "def first\n\n wi(fetch_all({}).first)\n end", "def query(sql)\n database.execute2(sql)\n end", "def execute(sql)\n raise(ArgumentError, \"Bad sql parameter\") unless sql.kind_of?(String)\n\n client = ensure_connected\n\n Pod4.logger.debug(__FILE__){ \"execute: #{sql}\" }\n r = client.execute(sql)\n\n r.do\n r\n\n rescue => e\n handle_error(e)\n end", "def first(*args)\n find_first_or_last(:first, *args)\n end", "def lowest_student_gpa\n \"SELECT MIN(gpa) FROM students\"\nend", "def return_value(db, table, id, key)\r\n\tvalue_array = db.execute(\"SELECT #{key} FROM #{table} WHERE id=#{id}\")\r\n\r\n\t# If not defined, return nil\r\n\tif value_array.empty?\r\n\t\treturn nil\r\n\tend\r\n\tif value_array.length > 1\r\n\t\tputs \"ERROR! Multiple matches for id #{id}!\"\r\n\t\treturn nil\r\n\tend\r\n\t# If id is found, return value associated with key\r\n\treturn value_array[0][key]\r\nend", "def run_sql(sql, arr = []) # array is for security feature\n db = PG.connect(ENV['DATABASE_URL'] || {dbname: 'picgallary'})\n results = db.exec_params(sql, arr)\n db.close\n return results\n end", "def run_sql(sql)\n conn = PG.connect(dbname: \"memetube\", host: \"localhost\")\n begin\n result = conn.exec(sql)\n ensure\n conn.close\n end\n result\nend", "def execute(sql, args=nil)\n\t\t\t\t\targs = args.map{|v| @db.bound_variable_arg(v, self)} if args\n\t\t\t\t\tq = check_disconnect_errors{execute_query(sql, args)}\n\t\t\t\t\tbegin\n\t\t\t\t\t\tblock_given? ? yield(q) : q.cmd_tuples\n\t\t\t\t\tensure\n\t\t\t\t\t\tq.clear if q && q.respond_to?(:clear)\n\t\t\t\t\tend\n\t\t\t\tend", "def run_sql(query)\n raw_run_sql(query)\n end", "def first(*args)\n query = scoped_query(args.last.respond_to?(:merge) ? args.pop : {})\n\n if args.any?\n new_collection(query).first(*args)\n else\n query.repository.read(query.update(:limit => 1)).first\n end\n end", "def first\n result ? all.first : limit(1).all.first\n end", "def execute(sql, args=nil)\n args = args.map{|v| @db.bound_variable_arg(v, self)} if args\n q = check_disconnect_errors{execute_query(sql, args)}\n begin\n block_given? ? yield(q) : q.cmd_tuples\n ensure\n q.clear if q && q.respond_to?(:clear)\n end\n end", "def execute\n # build the query string\n # run the query\n # return the results\n end", "def select_one(sql, klass, options = {})\n sql = \"SELECT * FROM #{klass.table} \" + sql unless sql =~ /SELECT/i\n read_one(query(sql), klass)\n end", "def getFirst_array_rand( selection, query, args )\n # Double our args since we are querying twice\n \n args = [ args ] if not args.is_a? Array\n\n nargs = Array.new args\n args.each do |a|\n nargs << a \n end\n\n args = nargs\n \n r = self.getArray( \"SELECT \" + selection + \" FROM \" + query + \" OFFSET floor(RANDOM() * (SELECT count(*) FROM \" + query + \")) LIMIT 1\", args ) \n \n r = r[0] if r.is_a? Array and r.size == 1\n\n r\n end", "def query(sql, *binds)\n ds = mysql.fetch(sql, *binds)\n mysql.execute_dui(ds.update_sql) {|c| return c.last_id > 0 ? c.last_id : c.affected_rows}\n end", "def sql(cmd, res = [])\n @sqr = job?(cmd) ? res : job.data\n end", "def run_sql(sql_query)\n\tconn = PG.connect(dbname: 'first_crud_app')\n\tresult = conn.exec(sql_query)\n\tconn.close\n\tresult\nend", "def first_row_from(table, options = {})\n\t\tselect_from(table, { limit: 1 }.merge(options)).first\n\tend", "def first\n response = query(:per_page => 1, :page => 1).get!\n response[:results].first\n end", "def execute(*args)\n @db.execute(*args)\n end", "def query(sql)\n @dataset = @database[sql] #Take SQL string and connect it to a DB\n #puts(\"Datset\", dataset)\n @fields = Array.new #Create blank array of field/column names\n @fields = @dataset.columns #Gets table field/column names\n #print(\"Fields\", @fields, \"\\n\") #debug \n @fieldCount = @fields.length\n\n begin\n @data = @dataset.all #Executes SQL\n rescue\n @data = Array.new\n end\n end", "def extract_single_value(row, field)\n values = extract_values(row, field)\n return nil unless values.count.positive?\n\n values.first\n end", "def query(sql, name = nil) #:nodoc:\n #log(sql, name) do\n #TODO: @async\n select_rows sql, name\n end", "def sql_raw(*args)\n sql, bind = parse_args(*args)\n return SQL::QueryMaker.new(nil, Proc.new { sql }, bind)\n end", "def execute(sql, args = nil, bulk_args = nil, http_options = {})\n @logger.debug sql\n req = Net::HTTP::Post.new('/_sql', headers)\n body = { 'stmt' => sql }\n body['args'] = args if args\n body['bulk_args'] = bulk_args if bulk_args\n req.body = body.to_json\n response = request(req, http_options)\n @logger.debug response.body\n\n case response.code\n when /^2\\d{2}/\n ResultSet.new response.body\n else\n @logger.info(response.body)\n raise CrateRuby::CrateError, response.body\n end\n end", "def first(*args)\n all.send(:first, *args)\n end", "def find_by(**args)\n where(**args).first\n end" ]
[ "0.7733855", "0.74117714", "0.7393629", "0.732431", "0.7257244", "0.70951307", "0.69496214", "0.69496214", "0.68948066", "0.68589425", "0.673866", "0.6714616", "0.67020315", "0.66909945", "0.66905284", "0.6612036", "0.6549059", "0.64874566", "0.64864904", "0.64847827", "0.64583725", "0.64540577", "0.6429872", "0.63934815", "0.6360816", "0.6342442", "0.6334935", "0.63078076", "0.61799943", "0.6151093", "0.6026247", "0.60035324", "0.59765697", "0.5932066", "0.59008944", "0.5883924", "0.58245426", "0.5813437", "0.5693985", "0.5687246", "0.56834304", "0.56669927", "0.5665587", "0.56621796", "0.56492245", "0.56480527", "0.560623", "0.560623", "0.55984765", "0.5586037", "0.557913", "0.55718184", "0.55570745", "0.5556045", "0.5553035", "0.5551185", "0.55423933", "0.5533425", "0.55102044", "0.55097693", "0.55087227", "0.5495198", "0.5487138", "0.54865533", "0.5484272", "0.54762185", "0.5463242", "0.54520464", "0.54500127", "0.5445076", "0.5441059", "0.54286706", "0.5426494", "0.54057693", "0.5405008", "0.53890836", "0.5369283", "0.5356984", "0.53529435", "0.53511876", "0.5348644", "0.5347427", "0.5343149", "0.53431255", "0.5342176", "0.5330275", "0.53216535", "0.5307661", "0.5288639", "0.52803856", "0.5279188", "0.5277001", "0.5265228", "0.5261291", "0.52537405", "0.5248802", "0.52475303", "0.52344817", "0.52324045", "0.52302825" ]
0.6942135
8
The Amagalite adapter does not need the pool to convert exceptions. Also, force the max connections to 1 if a memory database is being used, as otherwise each connection gets a separate database.
def connection_pool_default_options o = super.dup # Default to only a single connection if a memory database is used, # because otherwise each connection will get a separate database o[:max_connections] = 1 if @opts[:database] == ':memory:' || blank_object?(@opts[:database]) o end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connection_pool_default_options\n o = super\n uri == 'jdbc:sqlite::memory:' ? o.merge(:max_connections=>1) : o\n end", "def connection_pool_maximum_reuse\n super\n end", "def connection_limit\n super\n end", "def connection_limit\n super\n end", "def connection_limit\n super\n end", "def connection_pool_maximum_size\n super\n end", "def with_connection(&db_logic)\n begin\n ActiveRecord::Base.connection_pool\n rescue Exception => e\n ActiveRecord::Base.establish_connection(\n adapter: db_adapter,\n database: db_file\n )\n ActiveRecord::Base.logger = Logger.new(File.open(db_log_file, 'a'))\n end\n\n ActiveRecord::Base.connection_pool.with_connection(&db_logic)\n end", "def initialize(db, opts = OPTS)\n super\n @max_size = Integer(opts[:max_connections] || 4)\n raise(Sequel::Error, ':max_connections must be positive') if @max_size < 1\n @mutex = Mutex.new \n @connection_handling = opts[:connection_handling]\n @available_connections = []\n @allocated = {}\n @allocated.compare_by_identity\n @timeout = Float(opts[:pool_timeout] || 5)\n @waiter = ConditionVariable.new\n end", "def connection_pool_default_options\n super.merge(:pool_reuse_connections=>:always, :pool_convert_exceptions=>false)\n end", "def initialize(db, opts = OPTS)\n super\n @max_size = Integer(opts[:max_connections] || 4)\n raise(Sequel::Error, ':max_connections must be positive') if @max_size < 1\n @mutex = Mutex.new \n # Size inside array so this still works while the pool is frozen.\n @size = [0]\n @allocated = {}\n @allocated.compare_by_identity\n @timeout = Float(opts[:pool_timeout] || 5)\n @queue = Queue.new\n end", "def all_active_connections\n super\n end", "def turn_off\n MAX_CONNECTIONS.times do\n connections << Sequel.connect(DATABASE_URL)\n end\n rescue Sequel::DatabaseConnectionError\n end", "def db_conn\n @db_conn_pool ||= ConnectionPool.new(size: 4, timeout: 2) do\n Mysql2::Client.new(self.db_settings)\n end\n end", "def with_connection(&block)\n base_model.connection_pool.with_connection(&block)\n end", "def ensure_db_connection\n conn = ActiveRecord::Base.connection\n begin\n try ||= 3\n conn.reconnect!\n rescue\n try -= 1\n # There is a issue where connection closed unexpectedly, need retry\n retry if try > 0\n end\n end", "def acquire(*a)\n conn = nil\n\n 1.times do\n if (conn = super) &&\n (timer = sync{@connection_timestamps.delete(conn)}) &&\n Sequel.elapsed_seconds_since(timer) > @connection_validation_timeout &&\n !db.valid_connection?(conn)\n\n case pool_type\n when :sharded_threaded, :sharded_timed_queue\n sync{@allocated[a.last].delete(Sequel.current)}\n else\n sync{@allocated.delete(Sequel.current)}\n end\n\n disconnect_connection(conn)\n redo\n end\n end\n\n conn\n end", "def connection\n begin\n @connections.hold { |dbh| yield(dbh) }\n rescue Mysql::Error => me\n \n @configuration.log.fatal(me)\n \n @connections.available_connections.each do |sock|\n begin\n sock.close\n rescue => se\n @configuration.log.error(se)\n end\n end\n \n @connections.available_connections.clear\n raise me\n end\n end", "def connection_pool_minimum_size\n super\n end", "def connection_pool_idle_timeout\n super\n end", "def empty_connection_pools!; end", "def set_connection_pool_maximum_reuse(opts)\n opts = check_params(opts,[:reuses])\n super(opts)\n end", "def hijack_db\n ActiveRecord::Base.establish_connection(\n :adapter => ENV['YAPTESTFE_DBTYPE'],\n :host => ENV['YAPTESTFE_DBIP'],\n :port => ENV['YAPTESTFE_DBPORT'].to_i,\n :username => ENV['YAPTESTFE_DBUSER'],\n :password => ENV['YAPTESTFE_DBPASS'],\n :database => ENV['YAPTESTFE_DBNAME']\n ) \n begin # catch db connection errors\n if not ActiveRecord::Base.connection.active?\n render :template => 'help/dberror', :layout => false\n end\n rescue PGError => msg\n logger.info \"DBERROR: #{msg}\"\n render :template => 'help/dberror', :layout => false\n end\n end", "def with_connection\n ActiveRecord::Base.connection_pool.with_connection do |conn|\n yield conn\n end\n end", "def with_connection\n ActiveRecord::Base.connection_pool.with_connection do |connection|\n connection.transaction do\n if connection.adapter_name == \"PostgreSQL\"\n connection.execute \"SET TRANSACTION READ ONLY\"\n connection.execute \"SET LOCAL statement_timeout = 100\"\n # TODO support equivalent options for other adapters (such as mysql)\n end\n\n yield connection\n end\n end\n end", "def with_two_connections\n run_without_connection do |original_connection|\n ActiveRecord::Base.establish_connection(original_connection.merge(pool_size: 2))\n begin\n ddl_connection = ActiveRecord::Base.connection_pool.checkout\n begin\n yield original_connection, ddl_connection\n ensure\n ActiveRecord::Base.connection_pool.checkin ddl_connection\n end\n ensure\n ActiveRecord::Base.connection_handler.clear_all_connections!(:all)\n end\n end\n end", "def with_connection_pooling\n # Verify active connections and remove and disconnect connections\n # associated with stale threads.\n ActiveRecord::Base.verify_active_connections!\n\n yield\n\n # This code checks in the connection being used by the current thread back\n # into the connection pool. It repeats this if you are using multiple\n # connection pools. It will not disconnect the connection.\n #\n # Returns any connections in use by the current thread back to the pool,\n # and also returns connections to the pool cached by threads that are no\n # longer alive.\n ActiveRecord::Base.clear_active_connections!\n\n end", "def increase_db_pool_size(world = nil)\n if world.nil?\n warn 'Deprecated: using `increase_db_pool_size` outside of Dynflow code is not needed anymore'\n return\n end\n if increase_db_pool_size?\n db_pool_size = calculate_db_pool_size(world)\n ::ActiveRecord::Base.connection_pool.disconnect!\n\n base_config = ::ActiveRecord::Base.configurations.configs_for(env_name: ::Rails.env)[0]\n config = if base_config.respond_to?(:configuration_hash)\n ::Dynflow::Utils::IndifferentHash.new(base_config.configuration_hash.dup)\n else\n base_config.config.dup\n end\n config['pool'] = db_pool_size if config['pool'].to_i < db_pool_size\n ::ActiveRecord::Base.establish_connection(config)\n end\n end", "def first_active_adapter\n now = Time.now.to_i\n unless @first_active_adapter and (now - @last_verification) < @reconnect_timeout\n @first_active_adapter = @adapters.detect do |a|\n a.reconnect! unless active = a.active?\n active\n end\n @last_verification = now\n end\n @first_active_adapter or raise ActiveRecordError, \"There are no active connections available.\"\n end", "def pool\n pool_connection = ConnectionPool.new(size: 10, timeout: 5) do \n Redis.new :db=> redis_db_index, :password=> redis_instance.password, :host=> redis_instance.host, :port=> redis_instance.port\n end \n return pool_connection \n end", "def start(max = 8)\n max.times do\n @pool << @wire.connection\n end\n @log.debug(\"PostgreSQL pool started with #{max} connections\")\n self\n end", "def set_connection_pool_maximum_size(opts)\n opts = check_params(opts,[:sizes])\n super(opts)\n end", "def configure\n yield self\n\n pool_size = 5\n host = @host.nil? ? 'minfraud.maxmind.com' : @host\n @connection_pool = ConnectionPool.new(size: pool_size) do\n make_http_client.persistent(\"https://#{host}\")\n end\n end", "def set_connection_limit(opts)\n opts = check_params(opts,[:limits])\n super(opts)\n end", "def set_connection_limit(opts)\n opts = check_params(opts,[:limits])\n super(opts)\n end", "def set_connection_limit(opts)\n opts = check_params(opts,[:limits])\n super(opts)\n end", "def initialize(opts = OPTS)\n @opts ||= opts\n @opts = connection_pool_default_options.merge(@opts)\n @loggers = Array(@opts[:logger]) + Array(@opts[:loggers])\n @opts[:servers] = {} if @opts[:servers].is_a?(String)\n @sharded = !!@opts[:servers]\n @opts[:adapter_class] = self.class\n @opts[:single_threaded] = @single_threaded = typecast_value_boolean(@opts.fetch(:single_threaded, Sequel.single_threaded))\n @default_string_column_size = @opts[:default_string_column_size] || DEFAULT_STRING_COLUMN_SIZE\n\n @schemas = {}\n @prepared_statements = {}\n @transactions = {}\n @symbol_literal_cache = {}\n\n @timezone = nil\n\n @dataset_class = dataset_class_default\n @cache_schema = typecast_value_boolean(@opts.fetch(:cache_schema, true))\n @dataset_modules = []\n @loaded_extensions = []\n @schema_type_classes = SCHEMA_TYPE_CLASSES.dup\n\n self.sql_log_level = @opts[:sql_log_level] ? @opts[:sql_log_level].to_sym : :info\n self.log_warn_duration = @opts[:log_warn_duration]\n self.log_connection_info = typecast_value_boolean(@opts[:log_connection_info])\n\n @pool = ConnectionPool.get_pool(self, @opts)\n\n reset_default_dataset\n adapter_initialize\n if typecast_value_boolean(@opts.fetch(:identifier_mangling, true))\n # SEQUEL5: Remove\n extension(:_deprecated_identifier_mangling)\n end\n\n unless typecast_value_boolean(@opts[:keep_reference]) == false\n Sequel.synchronize{::Sequel::DATABASES.push(self)}\n end\n Sequel::Database.run_after_initialize(self)\n if typecast_value_boolean(@opts[:preconnect]) && @pool.respond_to?(:preconnect, true)\n concurrent = typecast_value_string(@opts[:preconnect]) == \"concurrently\"\n @pool.send(:preconnect, concurrent)\n end\n end", "def active_connection\n super\n end", "def setup_connection_adapter\n ActiveRecord::Base.establish_connection(self.to_hash)\n end", "def connect config\n @db = ::Sequel.connect config\n rescue ::Sequel::DatabaseError => e\n retry if on_error e\n end", "def safe_connection(connection_pool)\n connection_pool.automatic_reconnect ||= true\n if !connection_pool.connected? && shards[Octopus.master_shard].connection.query_cache_enabled\n connection_pool.connection.enable_query_cache!\n end\n connection_pool.connection\n end", "def no_database_error(exc)\n logger.error exc.message\n logger.error exc.backtrace.join(\"\\n\")\n Thread.current[:db_name] = 'soluzionipa_new' \n AuthHub::SpiderModel.establish_connection({})\n flash[:error] = \"Non è possibile gestire le configurazioni dell'ente!\"\n redirect_to auth_hub.dashboard_url\n end", "def initialize(db)\n @db = db\n @options = {\n symbolize_keys: true,\n cast_booleans: true\n }\n\n db.opts.each do |key, value|\n case (key)\n when :database, :username, :password, :host, :port, :socket, :encoding, :charset, :compress, :timeout\n @options[key] = value\n when :user\n @options[:username] = value\n when :loggers\n if (value and !value.empty?)\n @options[:logging] = true\n @options[:logger] = value.first\n end\n end\n end\n \n @query_queue = [ ]\n\n @connections = { }\n @connection_pool = [ ]\n @connections_active = { }\n \n @connection_limit = db.opts[:connections] || self.class.size\n \n if (EventMachine.reactor_running? and self.class.trace?)\n EventMachine::PeriodicTimer.new(1) do\n dump_file = \"#{self.class.trace}.#{@options[:database]}\"\n \n File.open(dump_file, 'w') do |f|\n f.puts @options[:database]\n\n @connections.each do |c, x|\n next unless (x)\n \n f.puts \"\\t#{c.inspect} -> #{x.inspect}\"\n end\n @connection_pool.each do |c|\n f.puts \"\\t#{c.inspect} (pool)\"\n end\n \n @query_queue.each do |query, callback|\n f.puts \"\\t#{query}\"\n end\n end\n end\n end\n end", "def supports_concurrent_connections?\n !@memory_database\n end", "def adapter_initialize\n opts = @opts\n @mutex = Mutex.new\n @sqls = opts[:sqls] || []\n @shared_adapter = false\n\n case db_type = opts[:host] \n when String, Symbol\n db_type = db_type.to_sym\n unless mod = Sequel.synchronize{SHARED_ADAPTER_MAP[db_type]}\n begin\n require \"sequel/adapters/shared/#{db_type}\"\n rescue LoadError\n else\n mod = Sequel.synchronize{SHARED_ADAPTER_MAP[db_type]}\n end\n end\n\n if mod\n @shared_adapter = true\n extend(mod::DatabaseMethods)\n extend_datasets(mod::DatasetMethods)\n if mod.respond_to?(:mock_adapter_setup)\n mod.mock_adapter_setup(self)\n end\n end\n end\n\n unless @shared_adapter\n extend UnmodifiedIdentifiers::DatabaseMethods\n extend_datasets UnmodifiedIdentifiers::DatasetMethods\n end\n\n self.autoid = opts[:autoid]\n self.columns = opts[:columns]\n self.fetch = opts[:fetch]\n self.numrows = opts[:numrows]\n extend(opts[:extend]) if opts[:extend]\n sqls\n end", "def close_expired_connections\n raise NotImplementedError\n end", "def connections\n @connection_pool\n end", "def before_fork\n return unless (defined? ::DataObjects::Pooling)\n return if ::DataMapper.repository.adapter.to_s =~ /Sqlite3Adapter/\n ::DataMapper.logger.debug \"+-+-+-+-+ Cleaning up connection pool (#{::DataObjects::Pooling.pools.length}) +-+-+-+-+\"\n ::DataObjects::Pooling.pools.each {|p| p.dispose} \n end", "def inject_conn_into_models\n BaseModel.connection = self\n end", "def initialize(opts = {}, &block)\n @opts = opts\n \n # Determine if the DB is single threaded or multi threaded\n @single_threaded = opts[:single_threaded] || @@single_threaded\n # Construct pool\n if @single_threaded\n @pool = SingleThreadedPool.new(&block)\n else\n @pool = ConnectionPool.new(opts[:max_connections] || 4, &block)\n end\n @pool.connection_proc = block || proc {connect}\n\n @logger = opts[:logger]\n ::Sequel::DATABASES.push(self)\n end", "def delete_all_active_connections\n super\n end", "def connect(server)\n opts = server_opts(server)\n opts[:database] = ':memory:' if blank_object?(opts[:database])\n db = ::Amalgalite::Database.new(opts[:database])\n db.busy_handler(::Amalgalite::BusyTimeout.new(opts.fetch(:timeout, 5000)/50, 50))\n db.type_map = SequelTypeMap.new(self)\n connection_pragmas.each{|s| log_connection_yield(s, db){db.execute_batch(s)}}\n db\n end", "def clear_active_connections!\n self.ensure_ready\n self.connection_pool_list.each(&:release_connection)\n end", "def connection\n clear_errors!\n num_attempts = 0\n begin\n num_attempts += 1\n yield\n rescue Twitter::Error::TooManyRequests => error\n if num_attempts <= @@max_attempts\n # NOTE: Your process could go to sleep for up to 15 minutes but if you\n # retry any sooner, it will almost certainly fail with the same exception.\n errors << \"Rate limited! Will retry in #{error.rate_limit.reset_in} seconds\"\n sleep error.rate_limit.reset_in\n retry\n else\n raise ReachedMaximumRetriesException, \"Can't try any more attempts\"\n end\n rescue Twitter::Error => error\n errors << \"Error accessing the Twitter API. Please try later\"\n end\n end", "def rescue_from_dalli_ring_error(e)\n @dalli_retries ||= 0\n \n if @dalli_retries >= Excursion.configuration.retry_limit\n retries = @dalli_retries\n @dalli_retries = 0\n raise MemcacheServerError, \"Excursion memcache server is down! Retried #{retries} times.\"\n end\n\n #STDERR.puts \"Excursion memcache server has gone away! Retrying...\"\n sleep 1 # give it a chance to come back\n @dalli_retries += 1\n end", "def maximum_requests\n super\n end", "def connection_pool(options = {}, &block)\n options = valid_options.merge(options)\n initialize_connection_pool(options) unless defined?(@connection_pool)\n\n if block_given?\n @connection_pool.with(&block)\n else\n @connection_pool\n end\n end", "def with_connections\n source_model.connection_pool.with_connection do\n destination_model.connection_pool.with_connection do\n yield\n end\n end\n end", "def connection_pool_default_options\n {}\n end", "def bind_time_limit\n super\n end", "def set_connection_pool_idle_timeout(opts)\n opts = check_params(opts,[:timeouts])\n super(opts)\n end", "def jobs\n db[TABLE_NAME]\n rescue ::Sequel::DatabaseError => e\n retry if on_error e\n end", "def establish_connections\n klass = Struct.new(:ip,:port)\n if t_servers = BackgrounDRb::BDRB_CONFIG[:client]\n connections = t_servers.split(',')\n connections.each do |conn_string|\n ip = conn_string.split(':')[0]\n port = conn_string.split(':')[1].to_i\n @bdrb_servers << klass.new(ip,port)\n end\n end\n @bdrb_servers << klass.new(BackgrounDRb::BDRB_CONFIG[:backgroundrb][:ip],BackgrounDRb::BDRB_CONFIG[:backgroundrb][:port].to_i)\n @bdrb_servers.each_with_index do |connection_info,index|\n next if @backend_connections.detect { |x| x.server_info == \"#{connection_info.ip}:#{connection_info.port}\" }\n @backend_connections << Connection.new(connection_info.ip,connection_info.port,self)\n end\n end", "def rescue_connection_failure(max_retries=60)\n retries = 0\n begin\n yield\n rescue Mongo::ConnectionFailure => ex\n puts ex\n retries += 1\n raise ex if retries > max_retries\n sleep(0.5)\n retry\n end\nend", "def connect_db\n ActiveRecord::Base.establish_connection($config)\n log(\"Connected to database\")\nrescue => e\n fatal(\"Failed to connect to the database: #{e}\")\n exit\nend", "def provide\n provided_connection = self.next\n\n if provided_connection\n\n @latest_blacklist_error = nil\n\n @proxy.error_handler.handle(provided_connection) do\n yield provided_connection\n end\n\n else\n raise Makara::Errors::AllConnectionsBlacklisted.new(@latest_blacklist_error)\n end\n\n\n rescue Makara::Errors::BlacklistConnection => e\n @latest_blacklist_error = e\n provided_connection._makara_blacklist!\n retry\n end", "def without_reconnect(&block); end", "def initialize(connection, database, logger = nil)\n super(connection, logger)\n context = connection.context\n context.init(logger)\n @limit = @offset = 0\n unless connection.sql_norow(\"USE #{database}\")\n raise \"Cannot USE #{database}\"\n end\n end", "def check_db_connection\n begin\n ActiveRecord::Base.verify_active_connections! if defined?(ActiveRecord)\n rescue Object => bdrb_error\n log_exception(bdrb_error)\n end\n end", "def rescue_connection_failure(max_retries = 30)\n retries = 0\n begin\n yield\n rescue Mongo::ConnectionFailure => ex\n retries += 1\n raise ex if retries > max_retries\n sleep(0.5)\n retry\n end\n end", "def create_connection_manager(ds)\n end", "def connect(options = {})\n return @pool = options[:pool] if options[:pool]\n options = options.dup\n timeout = options.delete(:timeout) || 5\n pool_size = options.delete(:pool_size) || 1\n @pool = Squirm::Pool.new(timeout)\n pool_size.times do\n conn = PG::Connection.open(options)\n yield conn if block_given?\n @pool.checkin conn\n end\n end", "def redis_connection_pool\n @redis_connection_pool ||= Stockpile::RedisConnection.connection_pool\n end", "def reexecute_connections?\n return true\n end", "def rescue_connection_failure(max_retries=30)\n retries = 0\n begin\n yield\n rescue Mongo::ConnectionFailure => ex\n #puts \"Rescue attempt #{retries}: from #{ex}\"\n retries += 1\n raise ex if retries > max_retries\n sleep(2)\n retry\n end\n end", "def dispose\n return if @connection_pool.nil?\n\n until @connection_pool.empty?\n conn = @connection_pool.pop(true)\n conn&.close\n end\n\n @connection_pool = nil\n end", "def initialize(options = {}, &block)\n @connections, @busy_connections, @queue = [], {},[]\n @connection_proc = block\n @size = options[:size] || 8\n if options[:eager]\n @size.times do\n @connections << @connection_proc.call\n end\n end\n end", "def initialize_pools(members)\n members.each do |member|\n @hosts << member.host_string\n\n if member.primary?\n @primary = member.host_port\n @primary_pool = Pool.new(self.connection, member.host, member.port,\n :size => self.connection.pool_size,\n :timeout => self.connection.connect_timeout,\n :node => member)\n elsif member.secondary? && !@secondaries.include?(member.host_port)\n @secondaries << member.host_port\n @secondary_pools << Pool.new(self.connection, member.host, member.port,\n :size => self.connection.pool_size,\n :timeout => self.connection.connect_timeout,\n :node => member)\n end\n end\n\n @max_bson_size = members.first.config['maxBsonObjectSize'] ||\n Mongo::DEFAULT_MAX_BSON_SIZE\n @arbiters = members.first.arbiters\n choose_read_pool\n end", "def enable_replica\n begin\n ActiveRecord::Base.connection.enable_replica\n yield\n rescue Makara::Errors::AllConnectionsBlacklisted => e\n yield\n ensure\n ActiveRecord::Base.connection.disable_replica\n end\n end", "def db_connection\n begin\n connection = PG.connect(dbname:'news')\n yield(connection)\n ensure\n connection.close\n end\nend", "def redis_pool; end", "def connections\n @connections ||= []\n end", "def prefork_action! # TODO : refactor\n ActiveRecord::Base.clear_all_connections! rescue nil\n end", "def all_connections\n yield @conn.first if @conn\n end", "def on_connection(conn)\n @backends.delete_if { |b| b.dead? }\n logger.debug \"Server:on_connection #{conn} backends #{@backends.count} loads #{@backends.map {|x| x.load}.inspect}\" if logger\n raise ::Heroku::Forward::Errors::BackendFailedToStartError.new if @backends.empty?\n # Find the one with the minimum load.\n b = @backends.select {|b| b.ready?}.reduce() { |t,v| t.load <= v.load ? t : v }\n # If there is no connection wait a bit and try again.\n if b\n prev_load = b.load\n if b.connect(conn)\n return\n else\n # This request is already toast. Just ignore, reset load.\n b.load = prev_load\n end\n else\n s = self\n logger.debug \"Server: EM queuing #{conn} because no available backends yet.\" if logger\n EM.next_tick do\n #logger.info \"Server: next_tick #{conn}.\" if logger\n sleep 1\n if @rejection_data\n s.reject_connection(conn)\n else\n s.on_connection(conn)\n end\n end\n end\n end", "def run_after_fork\n @app.restore_db_connections_after_fork\n end", "def db_cached_connect\n @dbh or db_connect\n end", "def db_cached_connect\n @dbh or db_connect\n end", "def database_error_classes\n [::Amalgalite::Error, ::Amalgalite::SQLite3::Error]\n end", "def delete_active_connection\n super\n end", "def connections\n @_connections ||= {}\n end", "def with_advisory_lock_connection\n pool = ::ActiveRecord::ConnectionAdapters::ConnectionHandler.new.establish_connection(\n ::ActiveRecord::Base.connection_db_config.configuration_hash.except(:prefer_secondary)\n )\n\n pool.with_connection { |connection| yield(connection) } # rubocop:disable Style/ExplicitBlockArgument\n ensure\n pool&.disconnect!\n end", "def load_persistent_connection_adapter(options={})\n adapter_config = {\n name: \"oanda_api\",\n idle_timeout: 10,\n keep_alive: 30,\n warn_timeout: 2,\n pool_size: OandaAPI.configuration.connection_pool_size,\n verify_mode: OpenSSL::SSL::VERIFY_PEER\n }.merge options\n\n Client.persistent_connection_adapter adapter_config\n end", "def initialize_adapter\n # if no adapter has been initialized, use memory adapter\n config[:adapter] ||= Adapters::Memory\n\n extend config[:adapter]\n after_initialize if respond_to? :after_initialize\n end", "def enforce_max_records_scan; end", "def default_adapter=(adapter); end", "def default_adapter=(adapter); end", "def default_adapter=(adapter); end", "def try_databases\n db = Database.new(application_root, config, settings)\n db.configure\n end", "def steal! # :nodoc:\n if in_use?\n if @owner != Thread.current\n pool.send :remove_connection_from_thread_cache, self, @owner\n\n @owner = Thread.current\n end\n else\n raise ActiveRecordError, \"Cannot steal connection, it is not currently leased.\"\n end\n end", "def reconnect! # :nodoc:\n super\n @raw_connection.reset!\n rescue OracleEnhanced::ConnectionException => e\n @logger.warn \"#{adapter_name} automatic reconnection failed: #{e.message}\" if @logger\n end" ]
[ "0.6586718", "0.65526295", "0.6497304", "0.6497304", "0.6497304", "0.6313745", "0.6311467", "0.6175766", "0.6105008", "0.6096257", "0.5994083", "0.59327847", "0.5848654", "0.5817521", "0.58068943", "0.57776797", "0.5763577", "0.57467824", "0.5726137", "0.5664444", "0.56280917", "0.56075364", "0.5488495", "0.54852116", "0.5483388", "0.54615116", "0.5457902", "0.5424679", "0.5407008", "0.5385741", "0.53377384", "0.53372127", "0.5294051", "0.5294051", "0.5294051", "0.5289145", "0.52698964", "0.5259771", "0.5259128", "0.5243541", "0.52373916", "0.5225561", "0.52022624", "0.519542", "0.51752394", "0.5173629", "0.5173036", "0.51705533", "0.51452833", "0.5113305", "0.51109034", "0.5081192", "0.50751364", "0.50678515", "0.5065118", "0.49898222", "0.49752283", "0.4974309", "0.49674353", "0.49598852", "0.49597096", "0.49573553", "0.49479568", "0.4941124", "0.49310008", "0.49221998", "0.4920672", "0.49191684", "0.4909306", "0.48957217", "0.48902544", "0.48837507", "0.48814094", "0.48769206", "0.48630112", "0.48577207", "0.4857606", "0.4853411", "0.4848339", "0.48443976", "0.4842884", "0.48418462", "0.48384067", "0.48353818", "0.4830252", "0.48274535", "0.48274535", "0.48236346", "0.48224893", "0.48224068", "0.48185262", "0.48183593", "0.48170778", "0.4806331", "0.47907683", "0.47907683", "0.47907683", "0.47879514", "0.47809786", "0.47786862" ]
0.6516531
2
Both main error classes that Amalgalite raises
def database_error_classes [::Amalgalite::Error, ::Amalgalite::SQLite3::Error] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error; end", "def error(description, result)\n raise \"Implement this in a sub-class\"\n end", "def error(*args); end", "def error\n end", "def original_error; end", "def original_error; end", "def error\n end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def errors; end", "def error?; end", "def error?; end", "def error?; end", "def error\n\t\t\traise 'Test'\n\t\tend", "def exceptions; end", "def error(exception) nil ; end", "def error\n raise Exception, \"An example of what an error looks like if you make a mistake using Commandable.\"\n end", "def error!\n throw NotImplementedError\n end", "def exceptions\n end", "def error(nvae)\n end", "def errorhandling\n end", "def error=(_arg0); end", "def error=(_arg0); end", "def error=(_arg0); end", "def error(ex) [:error, ex]; end", "def errors=(_); end", "def recover_from(_error); end", "def errors\n raise 'Method should implemented in inherit class'\n end", "def errors=(_arg0); end", "def errors=(_arg0); end", "def errors=(_arg0); end", "def errors=(_arg0); end", "def errmsg(message); end", "def handle_perform_error(_e); end", "def error\n nil\n end", "def error_message; end", "def error\n failure\n end", "def error\n\t\traise StandardError\n\tend", "def exception; end", "def exception; end", "def exception; end", "def exception; end", "def exception; end", "def error(string); end", "def error(string); end", "def load_error=(_arg0); end", "def error\n nil\n end", "def bold_error(*args); end", "def api_error; end", "def error(url); end", "def catch_exceptions; end", "def errors_for(_object); end", "def errback &block\n super\n end", "def errback &block\n super\n end", "def hastur_error!(code=501, message=\"FAIL\", bt=[])\n error = {\n :status => code,\n :message => message,\n :backtrace => bt.kind_of?(Array) ? bt[0..10] : bt\n }\n\n # remove this after getting the loggers to do the right thing\n STDERR.puts MultiJson.dump(error, :pretty => true)\n\n if self.is_a? Grape::API\n throw :error, error\n elsif self.is_a? Sinatra::Base\n error[:url] = request.url\n halt serialize(error, {})\n else\n abort \"BUG: not a Grape::API or Sinatra::Base\"\n end\n end", "def error!(url); end", "def error!\n # Unhandled exception\n if @exception\n exception_message\n exit 2\n # Some checksums did not match?\n elsif !(invalid_packages.empty? && invalid_metadata_files.empty?)\n error_message\n exit 2\n # We don't have checksums for some packages?\n elsif unverifiable_package_count != 0\n unverifiable_packages_message\n exit 2\n else\n success_message\n exit 0\n end\n end", "def check_errors;\n end", "def original_exception; end", "def error!\n throw :return, -1\n end", "def storage_failure=(_arg0); end", "def error\n return unless error?\n err || GenericError.new(error_code, error_msg)\n end", "def exception_class; end", "def rescue_from(exception); end", "def error\r\n @error\r\n end", "def show_error\n raise NotImplementedError\n end", "def fail\n\t\t# throw up this code and feed plezi your own lines :)\n\t\traise \"Plezi raising hell!\"\n\tend", "def on_error error\n raise error\n end", "def error(_message)\n raise NotImplementedError.new\n end", "def parse_error(error)\n case error\n when SocketError\n PuppetRepl::Exception::ConnectError.new(:message => \"Unknown host: #{Puppet[:server]}\")\n when Net::HTTPError\n PuppetRepl::Exception::AuthError.new(:message => error.message)\n when Errno::ECONNREFUSED\n PuppetRepl::Exception::ConnectError.new(:message => error.message)\n when Puppet::Error\n if error.message =~ /could\\ not\\ find\\ class/i\n PuppetRepl::Exception::NoClassError.new(:default_modules_paths => default_modules_paths,\n :message => error.message)\n elsif error.message =~ /default\\ node/i\n PuppetRepl::Exception::NodeDefinitionError.new(:default_site_manifest => default_site_manifest,\n :message => error.message)\n else\n error\n end\n else\n error\n end\n end", "def raise(exception); end", "def exception(*rest) end", "def log_error(exception); end", "def server_error\n\n end", "def fail(*args)\n super(*args)\n end", "def server_error?; end", "def parse_error(error)\n case error\n when SocketError\n PuppetDebugger::Exception::ConnectError.new(message: \"Unknown host: #{Puppet[:server]}\")\n when Net::HTTPError\n PuppetDebugger::Exception::AuthError.new(message: error.message)\n when Errno::ECONNREFUSED\n PuppetDebugger::Exception::ConnectError.new(message: error.message)\n when Puppet::Error\n if error.message =~ /could\\ not\\ find\\ class/i\n PuppetDebugger::Exception::NoClassError.new(default_modules_paths: default_modules_paths,\n message: error.message)\n elsif error.message =~ /default\\ node/i\n PuppetDebugger::Exception::NodeDefinitionError.new(default_site_manifest: default_site_manifest,\n message: error.message)\n else\n error\n end\n else\n error\n end\n end", "def handle_generic_error(exception)\n end", "def server_errors; end", "def raise(*rest) end", "def raise(*rest) end", "def code\n 'ViewModel.AbstractError'\n end", "def load_error; end", "def exception_on_syntax_error=(_arg0); end", "def continued_exception; end", "def error\n raise StandardError, 'Error parsing input'\n end", "def underlying_exception; end", "def serialize_error\n case error\n when Common::Exceptions::BaseError\n base_error\n when Common::Client::Errors::ClientError\n client_error\n when EMISRedis::VeteranStatus::NotAuthorized\n emis_error(:not_authorized)\n when EMISRedis::VeteranStatus::RecordNotFound\n emis_error(:not_found)\n when MPI::Errors::RecordNotFound\n mpi_error(404)\n when MPI::Errors::FailedRequestError\n mpi_error(503)\n when MPI::Errors::DuplicateRecords\n mpi_error(404)\n else\n standard_error\n end\n end" ]
[ "0.7430369", "0.7430369", "0.7430369", "0.7430369", "0.7430369", "0.7430369", "0.7430369", "0.74077344", "0.73176277", "0.71575886", "0.70921636", "0.70921636", "0.7085073", "0.69936454", "0.69936454", "0.69936454", "0.69936454", "0.69936454", "0.69936454", "0.69936454", "0.69936454", "0.69936454", "0.6976762", "0.6976762", "0.6976762", "0.69502497", "0.6923327", "0.68982506", "0.6853154", "0.6828977", "0.68169975", "0.68123627", "0.6784636", "0.67640996", "0.67640996", "0.67640996", "0.67615044", "0.6711521", "0.66598606", "0.66487527", "0.6639543", "0.6639543", "0.6639543", "0.6639543", "0.6565996", "0.65585923", "0.65477556", "0.6543574", "0.65314525", "0.65264654", "0.65253085", "0.65253085", "0.65253085", "0.65253085", "0.65253085", "0.65144044", "0.65144044", "0.65080464", "0.6488193", "0.6486601", "0.6465699", "0.6459247", "0.64522094", "0.6432726", "0.6400087", "0.6400087", "0.63283247", "0.6321039", "0.6245434", "0.62312186", "0.6228645", "0.6225802", "0.6220155", "0.62199956", "0.6216825", "0.6212548", "0.621017", "0.6206009", "0.61970204", "0.6196855", "0.6190877", "0.6189827", "0.6183195", "0.6173178", "0.6161048", "0.61606777", "0.6158045", "0.6150796", "0.61470145", "0.614655", "0.61434954", "0.6142982", "0.6142982", "0.6137158", "0.6135712", "0.61356115", "0.61316365", "0.61295885", "0.6128636", "0.6123415" ]
0.68004835
32
Yield a hash for each row in the dataset.
def fetch_rows(sql) execute(sql) do |stmt| self.columns = cols = stmt.result_fields.map{|c| output_identifier(c)} col_count = cols.size stmt.each do |result| row = {} col_count.times{|i| row[cols[i]] = result[i]} yield row end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n rows.hash\n end", "def each\n CSV.foreach(@file, @options) do |row|\n yield row.to_hash\n end\n end", "def hash\n value = 0\n my_rows = @rows\n r_size = my_rows.size\n for i in 0..r_size-1 do\n a_row = my_rows[i]\n a_size = a_row.size\n for j in 0..a_size-1 do\n value ^= a_row[j].hash\n end\n end\n return value\n end", "def each_hash\n if block_given?\n while row = next_hash\n yield row\n end\n else\n self.enum_for(:each_hash)\n end\n end", "def hashes(with_table=false, &block)\n rows = []\n self.each_hash(with_table) do |row|\n rows << ((block) ? yield(row) : row)\n end\n rows\n end", "def yield_hash_rows(res, cols)\n res.ntuples.times do |recnum|\n converted_rec = {}\n cols.each do |fieldnum, type_proc, fieldsym|\n value = res.getvalue(recnum, fieldnum)\n converted_rec[fieldsym] = (value && type_proc) ? type_proc.call(value) : value\n end\n yield converted_rec\n end\n end", "def yield_hash_rows(res, cols)\n res.ntuples.times do |recnum|\n converted_rec = {}\n cols.each do |fieldnum, type_proc, fieldsym|\n value = res.getvalue(recnum, fieldnum)\n converted_rec[fieldsym] = (value && type_proc) ? type_proc.call(value) : value\n end\n yield converted_rec\n end\n end", "def yale_row_as_hash i\n h = yale_nd_row(i, :hash)\n return h if i >= self.shape[1] || self[i,i].nil? || self[i,i] == 0\n h[i] = self[i,i]\n end", "def yale_nd_row_as_hash i\n yale_nd_row(i, :hash)\n end", "def raw\n @cache ||= Hash[ rows.map { |row| [row, cells(row)] } ]\n end", "def each_row\n @rows_processed = 0\n @data.each do |h|\n h = h.clone\n transform_row!(h)\n yield h\n @rows_processed += 1\n end\n end", "def row_hash(row)\n Hash[raw_headers.zip(row)].with_indifferent_access\n end", "def each\n return unless @result\n\n @result.each(as: :hash, symbolize_keys: true) do |row|\n next unless row # This sometimes happens when streaming results...\n row = Hash[row.map { |k, v| [k, v.to_s] }] if @type_translation == :string\n yield row\n end\n end", "def _each\n Engine.new(local_copy.encoded_io, csv_options.merge(headers: headers)).each do |row|\n\n some_value_present = false\n\n if not headers\n\n # represent the row as an array\n array = row.map do |v|\n v = RemoteTable.normalize_whitespace v\n if not some_value_present and not keep_blank_rows and v.present?\n some_value_present = true\n end\n v\n end\n if some_value_present or keep_blank_rows\n yield array\n end\n\n else\n\n # represent the row as a hash\n hash = ::ActiveSupport::OrderedHash.new\n row.each do |k, v|\n v = RemoteTable.normalize_whitespace v\n if not some_value_present and not keep_blank_rows and v.present?\n some_value_present = true\n end\n hash[k] = v\n end\n if some_value_present or keep_blank_rows\n yield hash\n end\n\n end\n end\n ensure\n local_copy.cleanup\n end", "def hash\r\n @row + @column\r\n end", "def hash\n @table.hash\n end", "def hash\n data.hash\n end", "def each_hash(result) # :nodoc:\n raise NotImplementedError\n end", "def each\n @data.each do |row|\n yield row\n end\n end", "def iterator\n return HashTabletIterator.new(@table)\n end", "def hash\n @data.dup.concat([@ts]).hash\n end", "def each_row(batch = ETL::Batch.new)\n @rows_processed = 0\n @data.each do |h|\n h = h.clone\n transform_row!(h)\n yield h\n @rows_processed += 1\n end\n end", "def each_hash(with_table=nil, &block)\n return enum_for(:each_hash, with_table) unless block\n while rec = fetch_hash(with_table)\n block.call rec\n end\n self\n end", "def each_hash(with_table=nil, &block)\n return enum_for(:each_hash, with_table) unless block\n while rec = fetch_hash(with_table)\n block.call rec\n end\n self\n end", "def to_hash\n @data.map do |row|\n hsh = {}\n @field_names.each_with_index.map{ |fld, i| hsh[fld] = row[i] }\n hsh\n end\n end", "def iterator\n HashTableIterator.new(@table)\n end", "def hash()\n #This is a stub, used for indexing\n end", "def _each\n delete_harmful!\n convert_eol_to_unix!\n transliterate_whole_file_to_utf8!\n skip_rows!\n\n Engine.new(local_copy.encoded_io, csv_options).each do |row|\n\n some_value_present = false\n\n if not headers\n\n # represent the row as an array\n array = row.map do |v|\n v = v.to_s\n if not some_value_present and not keep_blank_rows and v.present?\n some_value_present = true\n end\n v\n end\n if some_value_present or keep_blank_rows\n yield array\n end\n\n else\n\n # represent the row as a hash\n hash = ::ActiveSupport::OrderedHash.new\n row.each do |k, v|\n next unless k.present?\n v = v.to_s\n if not some_value_present and not keep_blank_rows and v.present?\n some_value_present = true\n end\n hash[k] = v\n end\n if some_value_present or keep_blank_rows\n yield hash\n end\n\n end\n end\n ensure\n local_copy.cleanup\n end", "def hashes\n return @hashes\n end", "def each\n pos = hash_size\n hoff0 = @hashes[0]\n while pos < hoff0\n key, value = *read_entry(pos)\n yield(key,value)\n pos += key.length + value.length + hashref_size\n end\n end", "def machine_hash(headers,rows)\n # This is just to give a nice data structure (a hash of )\n rows.each_with_index.map do |row, index|\n # todo - rearrange the hash so it is sorted - do we need the row index?\n Hash[headers.each_with_index.map { |header, pos| \n [header, row[pos] ]}\n ].merge('row' => index+2)\n end\n end", "def to_hash\r\n result = {}\r\n each do |elt|\r\n result[elt] = yield(elt)\r\n end\r\n result\r\n end", "def student_data_hash\n\n # turn data into 2 Dim array containing arrays of eles where delimiter is colon :\n clean_user_account_data = ruby_class_user_accounts.map { |x| x.split(/:/) }\n\n # turn data into a hash using 2 arrays for keys and values\n keys = %w[user_name password uid gid gcos_field home_directory login_shell]\n final_array_of_hashes = []\n\n clean_user_account_data.each do |account_data|\n hash = Hash.new\n keys.each_with_index { |item, index| hash[item] = account_data[index] }\n final_array_of_hashes << hash\n end\n final_array_of_hashes\n end", "def generate_data_hash(data_array)\r\n data_hash = {}\r\n data_array.each_index do |x|\r\n d = convert_to_string(data_array[x])\r\n d = clean_string(d)\r\n row = x + 1\r\n data_hash[row] = d unless d.nil?\r\n end\r\n # deleting the first row which contains the column header and not\r\n # a value\r\n data_hash.delete_if{|k,v| k == 1}\r\n\r\n return data_hash\r\n end", "def each_row\n @rows.each { |row| yield(row) }\n self\n end", "def hash\n [ data, type ].hash\n end", "def key_for(data)\n data.hash\n end", "def each_row\n return rows.each unless block_given?\n\n rows.each { |row| yield(row) }\n end", "def generate_data_values\n data_array = Array.new()\n @data.repository.each { |dataset|\n data_array << create_data_hash(dataset)\n }\n return data_array\n end", "def generate_row_key link\n # rowkey is 'md5_hashed_link'\n d = Digest::MD5.new\n d.hexdigest link\nend", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def all_hash\n results = CONNECTION.execute(\"SELECT * FROM #{get_table_name};\")\n return array_list = make_object_array(results)\n end", "def each_row\n return enum_for(:each_row) unless block_given?\n\n batch.un_pre_assembled_objects.each do |dobj|\n row = process_dobj(dobj)\n summary[:total_size] += row.counts[:total_size]\n if row.errors.empty?\n status = 'success'\n else\n summary[:objects_with_error] += 1\n status = 'error'\n end\n row.counts[:mimetypes].each { |k, v| summary[:mimetypes][k] += v }\n # log the output to a running progress file\n File.open(batch.batch_context.progress_log_file, 'a') { |f| f.puts log_progress_info(dobj, status).to_yaml }\n yield row.to_h\n end\n end", "def fetch_rows(sql)\n execute(sql) do |res|\n columns = set_columns(res)\n yield_hash_rows(res, columns) {|h| yield h}\n end\n end", "def hash\n [first_row_index, first_cell_index, last_row_index, last_cell_index, allow_splitting].hash\n end", "def rows\n @rows ||= begin\n row_indexes.map do |e|\n e.map do |e|\n @input[e]\n end\n end\n end\n end", "def each\r\n assert_exists\r\n arr_rows = rows\r\n for i in 0..arr_rows.length - 1 do\r\n yield arr_rows[i]\r\n end\r\n end", "def resultset_to_hash(resultset)\n meta = resultset.meta_data\n rows = []\n\n while resultset.next\n row = {}\n\n (1..meta.column_count).each do |i|\n name = meta.column_name i\n row[name] = case meta.column_type(i)\n when -6, -5, 5, 4\n # TINYINT, BIGINT, INTEGER\n resultset.get_int(i).to_i\n when 41\n # Date\n resultset.get_date(i)\n when 92\n # Time\n resultset.get_time(i).to_i\n when 93\n # Timestamp\n resultset.get_timestamp(i)\n when 2, 3, 6\n # NUMERIC, DECIMAL, FLOAT\n case meta.scale(i)\n when 0\n resultset.get_long(i).to_i\n else\n BigDecimal.new(resultset.get_string(i).to_s)\n end\n when 1, -15, -9, 12\n # CHAR, NCHAR, NVARCHAR, VARCHAR\n resultset.get_string(i).to_s\n else\n resultset.get_string(i).to_s\n end\n end\n\n rows << row\n end\n rows\nend", "def each\n value.each_with_index do |resource, index|\n yield Row.new(resource, self, index)\n end\n end", "def rows\n @pz.group_by.each_with_index { |val, n| row_id(n) }\n end", "def rows\n @rows ||= if ActiveRecord::Base.connection.adapter_name == \"PostgreSQL\"\n result.entries\n else\n [].tap do |row_hashes|\n result.entries.map do |row|\n hash = {}\n result.fields.each do |field|\n hash[field] = row[result.fields.index(field)]\n end\n row_hashes << hash\n end\n end\n end\n end", "def hash\n values.hash ^ known_data.hash\n end", "def hash\n\n self.h.fei.hash\n end", "def all_chunk_hashes\n\t\t\n\t\tbegin\n\t\t\t@all_chunk_map = \"\"\n\t\t\t0.upto(num_chunks-1) { |i|\n\t\t\t\t@all_chunk_map += sha1_chunk(i)\n\t\t\t}\n\n\t\tend unless @all_chunk_map\n\t\t@all_chunk_map\n\tend", "def row_to_hsh(row)\n h = Hash[@headers.zip(row)]\n h.symbolize_keys\n end", "def all_hash\n CONNECTION.execute(\"SELECT * FROM #{table_name};\")\n end", "def kv_table(table)\n transform_table!(table).rows_hash\nend", "def iteration_hash(data_hash = self.data, &block)\n yield data_hash\n cid = data_hash[:__cid__]\n code = Codes[cid]\n code.in.each do |input|\n next if !data_hash[input].is_a?(Hash)\n # -- recursive -- #\n iteration_hash(data_hash[input], &block)\n # -- recursive -- #\n end\n end", "def to_hash\n @data\n end", "def rows\n RowCollection.new(@data)\n end", "def hash(*) end", "def create_row_headers_index_hash\n collect_row_headers\n @row_hash = Hash[(0...@row_headers.size).zip(@row_headers)] # ==> {0=>0, 1=>734638, 2=>734639, 3=>734640, 4=>734641, 5=>734642, 6=>734643, 7=>734644, 8=>734645, 9=>734646}\nend", "def yield_rows(r, cols)\n while row = r.fetch_row\n h = {}\n cols.each{|n, p, i| v = row[i]; h[n] = (v && p) ? p.call(v) : v}\n yield h\n end\n end", "def to_hashed(tile_data)\n tokenized = tile_data.split(\",\").map{|x| x.to_i}\n tiles = []\n i = 0\n while i < tokenized.length do\n x = x_coord(tokenized[i])\n y = y_coord(tokenized[i])\n index = tokenized[i+1]\n tiles << {x: x, y: y, index: index}\n i += 3\n end\n tiles\nend", "def each\n while row = next_row\n yield row\n end\n return self\n end", "def next_hash\n result = @stmt.step\n return nil if result.nil?\n unless result.kind_of?(Hash)\n result_ary = result\n result = {}\n result_ary.each_with_index do |el, i|\n result[@stmt.column_name(i)] = el\n end\n end\n result\n end", "def hash\n @matrix\n end", "def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end", "def to_hash()\n @data\n end", "def to_hash\n @data\n end", "def key_iterator\n HashTableIterator.new(@table, false)\n end", "def each\n while row=self.next\n yield row\n end\n end", "def each\n while row=self.next\n yield row\n end\n end", "def each_row\n @sheet.rowIterator.each { |row| yield row }\n end", "def to_hash\n @data.to_hash\n end", "def each\n @worksheet.rows.each { |row| yield row.values }\n end", "def to_hash\n @data.dup\n end", "def fetch_hash_all\n fetch_many0(nil, Hash)\n end", "def make_decoding_or_key_rows\n hash_of_rows = {}\n i = 0\n hash_of_rows[i += 1] = make_row until i == 12\n hash_of_rows\n end", "def hash\n\t\t[@id].hash\n\tend", "def each_hash(the_query, with_table_names = false, &block)\n begin\n if with_table_names\n # We have to build the hash ourselves, if we want table names included\n query(the_query, { as: :array, cache_rows: false })\n if @result != nil\n fields = @result.fields\n tables = @result.respond_to?(:tables) ? @result.tables : [] # My addition to mysql2 results.c\n\n result = []\n @result.each do |row|\n hrow = {}\n (0...row.length).each do |i|\n field_name = tables[i].nil? ? fields[i] : \"#{tables[i]}.#{fields[i]}\"\n hrow[field_name] = row[i]\n end\n yield hrow\n result << hrow\n end\n return result\n end\n else\n query(the_query, { as: :hash, cache_rows: false })\n if @result != nil\n if block_given?\n @result.each(&block)\n else\n return @result.to_a\n end\n end\n end\n rescue Mysql2::Error => e\n # puts \"#{e.errno}: #{e.error}\"\n raise e\n ensure\n if block_given? && @result != nil\n @result.free\n end\n end\n end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash\n swap\n scatter\n completed_string\n end", "def hash()\n #This is a stub, used for indexing\nend", "def hash\n [self[0], self[1]].hash\n end", "def hash\n @__set.to_a.hash\n end" ]
[ "0.769702", "0.70204306", "0.69263905", "0.6918874", "0.67279625", "0.6503315", "0.6503315", "0.649634", "0.64826393", "0.64541084", "0.64433444", "0.6407485", "0.621739", "0.62135524", "0.62021893", "0.6159725", "0.60882926", "0.606204", "0.5966222", "0.5965614", "0.5962944", "0.59624785", "0.5950535", "0.5950535", "0.59382945", "0.5929331", "0.58846676", "0.58820266", "0.5862137", "0.58505464", "0.58441687", "0.5826254", "0.57537335", "0.57512814", "0.57478", "0.574171", "0.5726799", "0.57252735", "0.5723449", "0.5712493", "0.5689094", "0.5689094", "0.5689094", "0.5689094", "0.5689094", "0.5689094", "0.5689094", "0.56809205", "0.5661878", "0.56614584", "0.5654925", "0.5637223", "0.5631187", "0.5622992", "0.56209064", "0.56167364", "0.5615347", "0.5613847", "0.56094384", "0.5604603", "0.56038934", "0.55848145", "0.5584324", "0.5573022", "0.5553186", "0.5548539", "0.55434734", "0.55289006", "0.55274427", "0.5517657", "0.5516308", "0.55144805", "0.5511799", "0.55049384", "0.5503297", "0.55025727", "0.5494024", "0.5485366", "0.5485366", "0.54809535", "0.5480571", "0.54799867", "0.54794234", "0.54782635", "0.54742146", "0.54689705", "0.54677886", "0.5463228", "0.5463228", "0.5463228", "0.5463228", "0.5463228", "0.5463228", "0.5463228", "0.5463228", "0.5463228", "0.5463228", "0.5457167", "0.54477173", "0.54448086", "0.54333186" ]
0.0
-1
Quote the string using the adapter instance method.
def literal_string_append(sql, v) db.synchronize(@opts[:server]){|c| sql << c.quote(v)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quote\n %Q{\"#{self}\"}\n end", "def quote_string(s)\n @provider.quote_string(s)\n end", "def quote_string(s)\n @provider.quote_string(s)\n 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 quoted_string; end", "def my_quote\n\tend", "def quote(value); end", "def quotes\n end", "def esc\r\n \"\\\"#{self}\\\"\"\r\n end", "def quotes; end", "def quote_string(s) #:nodoc:\n @connection.escape(s)\n end", "def quote_string( s ) #:nodoc:\n @connection.escape( s )\n end", "def set_quote\n \n end", "def quote(item)\n \"\\\"#{item}\\\"\"\n end", "def quote( val )\n\t\treturn %q{\"%s\"} % [ val.to_s.gsub(/\"/, '\\\\\"') ]\n\tend", "def escape_double_quotes\r\n return self.gsub('\"', '\\\"')\r\n end", "def quote(s)\n \"\\\"#{s}\\\"\"\n end", "def v(s)\n connection.quote(s)\n end", "def quote(string)\n\t\t\tstring.nil? ? \"NULL\" : \"'#{super}'\"\n\t\tend", "def quote(sep = nil)\n sep ||= \"'\"\n sep + self + sep\n end", "def q(str)\n str.class == String ? ActiveRecord::Base.connection.quote_string(str) : str\n end", "def escape(str)\n return ActiveRecord::Base.connection.quote_string(str)\n end", "def quoted(value)\n sql _scope.connection.quote(value)\n end", "def quoted(value)\n sql _scope.connection.quote(value)\n end", "def quote(value)\n sanity_check\n @handle.quote(value)\n end", "def quote(name)\n raise NotImplementedError\n end", "def quoted\n with_opts(:quoted=>true)\n end", "def quote(text)\n \"#{quotes[0]}#{text}#{quotes[1]}\"\n end", "def single_quote\n # single quote string here\n 'Hello World and others!'\nend", "def quote_string(string)\n with_raw_connection(allow_retry: true, materialize_transactions: false) do |connection|\n connection.escape(string)\n end\n end", "def quote(value)\n string = value.to_s\n unquoted = unquote(string)\n escaped = unquoted.gsub(QuoteNotEscapedMatcher, \"\\\\\\\"\")\n %Q{\"#{escaped}\"}\n end", "def qq esc = nil\n %[\"#{esc ? self.gsub('\"') { esc } : self}\"]\n end", "def force_quotes?() @force_quotes end", "def quote(value)\n return \"'#{value}'\" if value.is_a?(String)\n\n value.to_s\n end", "def quote\n fetch('simpsons.quotes')\n end", "def escape(string)\n #This is a stub, used for indexing\n end", "def quote(s, column = nil)\n dummy_conn.quote(s)\n end", "def quote(value)\n return value.inspect unless value.is_a? String\n\n if value.include?(\"'\")\n value.inspect\n else\n \"'#{value}'\"\n end\n end", "def dquote( str ) #:nodoc:\n unless str =~ /^\".*?\"$/\n '\"' + str.gsub(/[\"\\\\]/n) {|s| '\\\\' + s } + '\"'\n else\n str\n end\n end", "def as_you_like_it_quote; end", "def quote_string(s) #:nodoc:\n s.gsub(/'/, \"''\") # ' (for ruby-mode)\n end", "def quote(value, column = nil)\n case value\n when String, ActiveSupport::Multibyte::Chars\n value_S = value.to_s\n if column && column.type == :binary && column.class.respond_to?(:string_to_binary)\n \"'#{column.class.string_to_binary(value_S)}'\"\n else\n super(value, column)\n end\n else\n super(value, column)\n end\n end", "def quote(string)\n string.to_s.gsub(/^|$/, '\"')\n end" ]
[ "0.7064646", "0.6971321", "0.6971321", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6923958", "0.6891963", "0.68340236", "0.6736045", "0.65891796", "0.6577086", "0.6563182", "0.65478224", "0.6546206", "0.6485704", "0.6446003", "0.64093614", "0.64064866", "0.64052737", "0.6386428", "0.6356641", "0.6353711", "0.6227505", "0.6222699", "0.61695707", "0.61695707", "0.61598414", "0.61532426", "0.61469084", "0.61443377", "0.61389476", "0.61042243", "0.6079338", "0.6016792", "0.601579", "0.6000606", "0.5968853", "0.59682924", "0.59681284", "0.5951223", "0.5947915", "0.5945064", "0.59426004", "0.59387577", "0.5898965" ]
0.0
-1